Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SMWPageLister Class Reference

Public Member Functions

 __construct ( $diWikiPages, $diProperty, $limit, $from='', $until='')
 
 getNavigationLinks (Title $title, $query=[])
 
 formatList ( $cutoff=6)
 

Static Public Member Functions

static getRequestOptions ( $limit, $from, $until)
 
static getQuery (SMWDescription $description, $limit, $from, $until)
 
static getColumnList ( $start, $end, $diWikiPages, $diProperty, $moreCallback=null)
 
static getShortList ( $start, $end, $diWikiPages, $diProperty, $moreCallback=null)
 

Protected Member Functions

 makeSelfLink (Title $title, $linkText, array $parameters)
 

Protected Attributes

 $mDiWikiPages
 
 $mDiProperty
 
 $mLimit
 
 $mFrom
 
 $mUntil
 

Detailed Description

Helper class to generate HTML lists of wiki pages, with support for paged navigation using the from/until and limit settings as in MediaWiki's CategoryPage.

The class attempts to allow as much code as possible to be shared among different places where similar lists are used.

Some code adapted from CategoryPage.php

Author
Nikolas Iwan
Markus Krötzsch
Jeroen De Dauw

Constructor & Destructor Documentation

◆ __construct()

SMWPageLister::__construct (   $diWikiPages,
  $diProperty,
  $limit,
  $from = '',
  $until = '' 
)

Constructor

Parameters
$diWikiPagesarray of SMWDIWikiPage
$diPropertymixed SMWDIProperty that the wikipages are values of, or null
$limitinteger maximal amount of items to display
$fromstring if the results were selected starting from this string
$untilstring if the results were selected reaching until this string

Member Function Documentation

◆ formatList()

SMWPageLister::formatList (   $cutoff = 6)

Format a list of data items chunked by letter, either as a bullet list or a columnar format, depending on the length.

Parameters
$cutoffinteger, use columns for more results than that
Returns
string

◆ getColumnList()

static SMWPageLister::getColumnList (   $start,
  $end,
  $diWikiPages,
  $diProperty,
  $moreCallback = null 
)
static

Format a list of SMWDIWikiPage objects chunked by letter in a three-column list, ordered vertically.

Parameters
$startinteger
$endinteger
$diWikiPagesarray of SMWDIWikiPage
$diPropertySMWDIProperty that the wikipages are values of, or null
Returns
string

◆ getNavigationLinks()

SMWPageLister::getNavigationLinks ( Title  $title,
  $query = [] 
)

Generates the prev/next link part to the HTML code of the top and bottom section of the page. Whether and how these links appear depends on specified boundaries, limit, and results. The title is required to create a link to the right page. The query array gives optional further parameters to append to all navigation links.

Parameters
$titleTitle
$queryarray that associates parameter names to parameter values
Returns
string

◆ getQuery()

static SMWPageLister::getQuery ( SMWDescription  $description,
  $limit,
  $from,
  $until 
)
static

Make SMWQuery suitable for obtaining a list of results based on the given description, limit, and from or until string. One more result than the limit will be created, and the results may have to be reversed in order if $until is nonempty.

Parameters
$descriptionSMWDescription main query description
$limitinteger
$fromstring can be empty if no from condition is desired
$untilstring can be empty if no until condition is desired
Returns
SMWQuery

◆ getRequestOptions()

static SMWPageLister::getRequestOptions (   $limit,
  $from,
  $until 
)
static

Make SMWRequestOptions suitable for obtaining a list of results for the given limit, and from or until string. One more result than the limit will be created, and the results may have to be reversed in order if ascending is set to false in the resulting object.

Parameters
$limitinteger
$fromstring can be empty if no from condition is desired
$untilstring can be empty if no until condition is desired
Returns
SMWRequestOptions

◆ getShortList()

static SMWPageLister::getShortList (   $start,
  $end,
  $diWikiPages,
  $diProperty,
  $moreCallback = null 
)
static

Format a list of diWikiPages chunked by letter in a bullet list.

Parameters
$startinteger
$endinteger
$diWikiPagesarray of SMWDataItem
$diPropertySMWDIProperty that the wikipages are values of, or null
Returns
string

◆ makeSelfLink()

SMWPageLister::makeSelfLink ( Title  $title,
  $linkText,
array  $parameters 
)
protected

Format an HTML link with the given text and parameters.

Returns
string

The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy