MediaWiki  REL1_24
CategoryViewer Class Reference
Inheritance diagram for CategoryViewer:
Collaboration diagram for CategoryViewer:

List of all members.

Public Member Functions

 __construct ($title, IContextSource $context, $from=array(), $until=array(), $query=array())
 addImage (Title $title, $sortkey, $pageLength, $isRedirect=false)
 Add a page in the image namespace.
 addPage ($title, $sortkey, $pageLength, $isRedirect=false)
 Add a miscellaneous page.
 addSubcategoryObject (Category $cat, $sortkey, $pageLength)
 Add a subcategory to the internal lists, using a Category object.
 clearCategoryState ()
 doCategoryQuery ()
 finaliseCategoryState ()
 formatList ($articles, $articles_start_char, $cutoff=6)
 Format a list of articles chunked by letter, either as a bullet list or a columnar format, depending on the length.
 getCategoryBottom ()
 getCategoryTop ()
 getHTML ()
 Format the category data list.
 getImageSection ()
 getPagesSection ()
 getSubcategorySection ()
 getSubcategorySortChar ($title, $sortkey)
 Get the character to be used for sorting subcategories.

Static Public Member Functions

static columnList ($articles, $articles_start_char)
 Format a list of articles chunked by letter in a three-column list, ordered vertically.

Public Attributes

string[] $articles
 *
array $articles_start_char
 *
array $children
 *
array $children_start_char
 *
Collation $collation
 *
array $flip
 *
array $from
 *
ImageGallery $gallery
 *
array $imgsNoGallery
 *
array $imgsNoGallery_start_char
 *
int $limit
 *
array $nextPage
 *
bool $showGallery
 *
Title $title
 *
array $until
 *

Protected Attributes

array $prevPage
 *

Private Member Functions

 addFragmentToTitle ($title, $section)
 Takes a title, and adds the fragment identifier that corresponds to the correct segment of the category.
 getCountMessage ($rescnt, $dbcnt, $type)
 What to do if the category table conflicts with the number of results returned? This function says what.
 getSectionPagingLinks ($type)
 Get the paging links for a section (subcats/pages/files), to go at the top and bottom of the output.
 pagingLinks ($first, $last, $type= '')
 Create paging links, as a helper method to getSectionPagingLinks().

Static Private Member Functions

static shortList ($articles, $articles_start_char)
 Format a list of articles chunked by letter in a bullet list.

Private Attributes

Category $cat
 Category object for this page.
array $query
 The original query array, to be used in generating paging links.

Detailed Description

Definition at line 23 of file CategoryViewer.php.


Constructor & Destructor Documentation

CategoryViewer::__construct ( title,
IContextSource context,
from = array(),
until = array(),
query = array() 
)
Since:
1.19 $context is a second, required parameter
Parameters:
Title$title
IContextSource$context
array$fromAn array with keys page, subcat, and file for offset of results of each section (since 1.17)
array$untilAn array with 3 keys for until of each section (since 1.17)
array$query

Definition at line 69 of file CategoryViewer.php.


Member Function Documentation

CategoryViewer::addFragmentToTitle ( title,
section 
) [private]

Takes a title, and adds the fragment identifier that corresponds to the correct segment of the category.

Parameters:
Title$titleThe title (usually $this->title)
string$sectionWhich section
Exceptions:
MWException
Returns:
Title

Definition at line 643 of file CategoryViewer.php.

CategoryViewer::addImage ( Title title,
sortkey,
pageLength,
isRedirect = false 
)

Add a page in the image namespace.

Parameters:
Title$title
string$sortkey
int$pageLength
bool$isRedirect

Definition at line 206 of file CategoryViewer.php.

References $title, and Title\getDBkey().

CategoryViewer::addPage ( title,
sortkey,
pageLength,
isRedirect = false 
)

Add a miscellaneous page.

Parameters:
Title$title
string$sortkey
int$pageLength
bool$isRedirect

Definition at line 236 of file CategoryViewer.php.

CategoryViewer::addSubcategoryObject ( Category cat,
sortkey,
pageLength 
)

Add a subcategory to the internal lists, using a Category object.

Parameters:
Category$cat
string$sortkey
int$pageLength

Definition at line 157 of file CategoryViewer.php.

static CategoryViewer::columnList ( articles,
articles_start_char 
) [static]

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

TODO: Take the headers into account when creating columns, so they're more visually equal.

More distant TODO: Scrap this and use CSS columns, whenever IE finally supports those.

Parameters:
array$articles
string[]$articles_start_char
Returns:
string
Access:
private

Definition at line 522 of file CategoryViewer.php.

Definition at line 266 of file CategoryViewer.php.

CategoryViewer::formatList ( articles,
articles_start_char,
cutoff = 6 
)

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

Parameters:
array$articles
array$articles_start_char
int$cutoff
Returns:
string
Access:
private

Definition at line 490 of file CategoryViewer.php.

Returns:
string

Definition at line 476 of file CategoryViewer.php.

Returns:
string

Definition at line 355 of file CategoryViewer.php.

CategoryViewer::getCountMessage ( rescnt,
dbcnt,
type 
) [private]

What to do if the category table conflicts with the number of results returned? This function says what.

Each type is considered independently of the other types.

Parameters:
int$rescntThe number of items returned by our database query.
int$dbcntThe number of items according to the category table.
string$type'subcat', 'article', or 'file'
Returns:
string A message giving the number of items, to output to HTML.

Definition at line 673 of file CategoryViewer.php.

Format the category data list.

Returns:
string HTML output

Definition at line 88 of file CategoryViewer.php.

References $from, $query, $title, $until, from, IContextSource\getConfig(), Category\newFromTitle(), query, ContextSource\setContext(), Collation\singleton(), and title.

Returns:
string

Definition at line 417 of file CategoryViewer.php.

Returns:
string

Definition at line 388 of file CategoryViewer.php.

Get the paging links for a section (subcats/pages/files), to go at the top and bottom of the output.

Parameters:
string$type'page', 'subcat', or 'file'
Returns:
string HTML output, possibly empty if there are no other pages

Definition at line 451 of file CategoryViewer.php.

Returns:
string

Definition at line 365 of file CategoryViewer.php.

CategoryViewer::getSubcategorySortChar ( title,
sortkey 
)

Get the character to be used for sorting subcategories.

If there's a link from Category:A to Category:B, the sortkey of the resulting entry in the categorylinks table is Category:A, not A, which it SHOULD be. Workaround: If sortkey == "Category:".$title, than use $title for sorting, else use sortkey...

Parameters:
Title$title
string$sortkeyThe human-readable sortkey (before transforming to icu or whatever).
Returns:
string

Definition at line 185 of file CategoryViewer.php.

CategoryViewer::pagingLinks ( first,
last,
type = '' 
) [private]

Create paging links, as a helper method to getSectionPagingLinks().

Parameters:
string$firstThe 'until' parameter for the generated URL
string$lastThe 'from' parameter for the generated URL
string$typeA prefix for parameters, 'page' or 'subcat' or 'file'
Returns:
string HTML

Definition at line 602 of file CategoryViewer.php.

static CategoryViewer::shortList ( articles,
articles_start_char 
) [static, private]

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

Parameters:
array$articles
string[]$articles_start_char
Returns:
string

Definition at line 578 of file CategoryViewer.php.


Member Data Documentation

string [] CategoryViewer::$articles

*

Definition at line 30 of file CategoryViewer.php.

array CategoryViewer::$articles_start_char

*

Definition at line 32 of file CategoryViewer.php.

Category CategoryViewer::$cat [private]

Category object for this page.

*

Definition at line 56 of file CategoryViewer.php.

array CategoryViewer::$children

*

Definition at line 34 of file CategoryViewer.php.

array CategoryViewer::$children_start_char

*

Definition at line 36 of file CategoryViewer.php.

Collation CategoryViewer::$collation

*

Definition at line 52 of file CategoryViewer.php.

array CategoryViewer::$flip

*

Definition at line 48 of file CategoryViewer.php.

array CategoryViewer::$from

*

Definition at line 26 of file CategoryViewer.php.

Referenced by getHTML().

ImageGallery CategoryViewer::$gallery

*

Definition at line 54 of file CategoryViewer.php.

array CategoryViewer::$imgsNoGallery

*

Definition at line 42 of file CategoryViewer.php.

array CategoryViewer::$imgsNoGallery_start_char

*

Definition at line 40 of file CategoryViewer.php.

int CategoryViewer::$limit

*

Definition at line 24 of file CategoryViewer.php.

array CategoryViewer::$nextPage

*

Definition at line 44 of file CategoryViewer.php.

array CategoryViewer::$prevPage [protected]

*

Definition at line 46 of file CategoryViewer.php.

array CategoryViewer::$query [private]

The original query array, to be used in generating paging links.

*

Definition at line 58 of file CategoryViewer.php.

Referenced by getHTML().

bool CategoryViewer::$showGallery

*

Definition at line 38 of file CategoryViewer.php.

Title CategoryViewer::$title

*

Definition at line 50 of file CategoryViewer.php.

Referenced by addImage(), and getHTML().

array CategoryViewer::$until

*

Definition at line 28 of file CategoryViewer.php.

Referenced by getHTML().


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