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

List of all members.

Public Member Functions

 __construct ($title, IContextSource $context, $from= '', $until= '', $query=array())
 Constructor.
 addImage (Title $title, $sortkey, $pageLength, $isRedirect=false)
 Add a page in the image namespace.
 addPage ($title, $sortkey, $pageLength, $isRedirect=false)
 Add a miscellaneous page.
 addSubcategory (Title $title, $sortkey, $pageLength)
 Add a subcategory to the internal lists, using a title object.
 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

 $articles
 $articles_start_char
 $children
 $children_start_char
 $collation
 $flip
 $from
 $gallery
 $imgsNoGallery
 $imgsNoGallery_start_char
 $imgsNoGalley
 $limit
 $nextPage
 $showGallery
 $title
 $until

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

 $cat
 $query

Detailed Description

Definition at line 6 of file CategoryViewer.php.


Constructor & Destructor Documentation

CategoryViewer::__construct ( title,
IContextSource context,
from = '',
until = '',
query = array() 
)

Constructor.

Since:
1.19 $context is a second, required parameter
Parameters:
$titleTitle
$contextIContextSource
$fromString
$untilString
$queryArray

Definition at line 61 of file CategoryViewer.php.

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

Here is the call graph for this function:


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$title,:The title (usually $this->title)
String$section,:Which section
Returns:
Title

Definition at line 600 of file CategoryViewer.php.

References $section, $title, and Title\makeTitle().

Referenced by pagingLinks().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Add a page in the image namespace.

Parameters:
$titleTitle
$sortkey
$pageLength
$isRedirectbool

Definition at line 197 of file CategoryViewer.php.

References $flip, $wgContLang, and Linker\link().

Referenced by doCategoryQuery().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Add a miscellaneous page.

Parameters:
$title
$sortkey
$pageLength
$isRedirectbool

Definition at line 227 of file CategoryViewer.php.

References $title, $wgContLang, and Linker\link().

Referenced by doCategoryQuery().

Here is the call graph for this function:

Here is the caller graph for this function:

CategoryViewer::addSubcategory ( Title title,
sortkey,
pageLength 
)

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

Deprecated:
since 1.17 kept for compatibility, please use addSubcategoryObject instead

Definition at line 161 of file CategoryViewer.php.

References addSubcategoryObject(), Category\newFromTitle(), and wfDeprecated().

Here is the call graph for this function:

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

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

Parameters:
$catCategory
$sortkey
$pageLength

Definition at line 140 of file CategoryViewer.php.

References $title, getSubcategorySortChar(), Category\getTitle(), and Linker\link().

Referenced by addSubcategory(), and doCategoryQuery().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 120 of file CategoryViewer.php.

Referenced by getHTML().

Here is the caller graph for this function:

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:
$articlesArray
$articles_start_charArray
Returns:
String
Access:
private

Definition at line 484 of file CategoryViewer.php.

References $articles, $articles_start_char, $columns, and wfMsgHtml().

Referenced by formatList().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 257 of file CategoryViewer.php.

References $cat, $count, $dbr, $res, $title, addImage(), addPage(), addSubcategoryObject(), Category\newFromRow(), Title\newFromRow(), and wfGetDB().

Referenced by getHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 242 of file CategoryViewer.php.

Referenced by getHTML().

Here is the caller graph for this function:

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:
$articlesArray
$articles_start_charArray
$cutoffInt
Returns:
String
Access:
private

Definition at line 452 of file CategoryViewer.php.

References $articles, $articles_start_char, columnList(), Html\rawElement(), and shortList().

Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
string

Definition at line 438 of file CategoryViewer.php.

Referenced by getCategoryTop(), and getHTML().

Here is the caller graph for this function:

Returns:
string

Definition at line 334 of file CategoryViewer.php.

References getCategoryBottom().

Referenced by getHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Note for grepping: uses the messages category-article-count, category-article-count-limited, category-subcat-count, category-subcat-count-limited, category-file-count, category-file-count-limited.

Parameters:
$rescntInt: The number of items returned by our database query.
$dbcntInt: The number of items according to the category table.
$typeString: 'subcat', 'article', or 'file'
Returns:
String: A message giving the number of items, to output to HTML.

Definition at line 634 of file CategoryViewer.php.

References wfMessage().

Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
string

Definition at line 396 of file CategoryViewer.php.

References formatList(), getCountMessage(), getSectionPagingLinks(), and wfMsg().

Referenced by getHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
string

Definition at line 367 of file CategoryViewer.php.

References formatList(), getCountMessage(), getSectionPagingLinks(), and wfMsg().

Referenced by getHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 425 of file CategoryViewer.php.

References pagingLinks().

Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
string

Definition at line 344 of file CategoryViewer.php.

References formatList(), getCountMessage(), getSectionPagingLinks(), and wfMsg().

Referenced by getHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

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).

Definition at line 176 of file CategoryViewer.php.

References $title, and $wgContLang.

Referenced by addSubcategoryObject().

Here is the caller graph for this function:

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

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

Parameters:
$firstString The 'until' parameter for the generated URL
$lastString The 'from' parameter for the genererated URL
$typeString A prefix for parameters, 'page' or 'subcat' or 'file'
Returns:
String HTML

Definition at line 560 of file CategoryViewer.php.

References addFragmentToTitle(), Linker\linkKnown(), and wfMessage().

Referenced by getSectionPagingLinks().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Parameters:
$articlesArray
$articles_start_charArray
Returns:
String

Definition at line 537 of file CategoryViewer.php.

References $articles, and $articles_start_char.

Referenced by formatList().

Here is the caller graph for this function:


Member Data Documentation

CategoryViewer::$articles

Definition at line 7 of file CategoryViewer.php.

Referenced by columnList(), formatList(), and shortList().

CategoryViewer::$articles_start_char

Definition at line 7 of file CategoryViewer.php.

Referenced by columnList(), formatList(), and shortList().

CategoryViewer::$cat [private]

Definition at line 43 of file CategoryViewer.php.

Referenced by doCategoryQuery().

CategoryViewer::$children

Definition at line 7 of file CategoryViewer.php.

CategoryViewer::$children_start_char

Definition at line 7 of file CategoryViewer.php.

CategoryViewer::$collation

Definition at line 32 of file CategoryViewer.php.

CategoryViewer::$flip

Definition at line 22 of file CategoryViewer.php.

Referenced by addImage().

CategoryViewer::$from

Definition at line 7 of file CategoryViewer.php.

Referenced by __construct().

CategoryViewer::$gallery

Definition at line 37 of file CategoryViewer.php.

CategoryViewer::$imgsNoGallery

Definition at line 7 of file CategoryViewer.php.

CategoryViewer::$imgsNoGallery_start_char

Definition at line 7 of file CategoryViewer.php.

CategoryViewer::$imgsNoGalley

Definition at line 7 of file CategoryViewer.php.

CategoryViewer::$limit

Definition at line 7 of file CategoryViewer.php.

CategoryViewer::$nextPage

Definition at line 17 of file CategoryViewer.php.

CategoryViewer::$query [private]

Definition at line 49 of file CategoryViewer.php.

Referenced by __construct().

CategoryViewer::$showGallery

Definition at line 7 of file CategoryViewer.php.

CategoryViewer::$title
CategoryViewer::$until

Definition at line 7 of file CategoryViewer.php.

Referenced by __construct().


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