BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
Category Class Reference
Collaboration diagram for Category:

Public Member Functions

 getName ()
 
 getID ()
 
 getPageCount ()
 
 getSubcatCount ()
 
 getFileCount ()
 
 getTitle ()
 
 getMembers ($limit=false, $offset= '')
 
 refreshCounts ()
 

Static Public Member Functions

static newFromName ($name)
 
static newFromTitle ($title)
 
static newFromID ($id)
 
static newFromRow ($row, $title=null)
 

Public Attributes

 $mSubcats = null
 
 $mFiles = null
 
const LOAD_ONLY = 0
 
const LAZY_INIT_ROW = 1
 

Protected Member Functions

 initialize ($mode=self::LOAD_ONLY)
 

Detailed Description

Category objects are immutable, strictly speaking. If you call methods that change the database, like to refresh link counts, the objects will be appropriately reinitialized. Member variables are lazy-initialized.

Todo:
Move some stuff from CategoryPage.php to here, and use that.

Member Function Documentation

Category::getFileCount ( )
Returns
mixed Number of member files, or false on failure
Category::getID ( )
Returns
mixed Category ID, or false on failure
Category::getMembers (   $limit = false,
  $offset = '' 
)

Fetch a TitleArray of up to $limit category members, beginning after the category sort key $offset.

Parameters
int | bool$limit
string$offset
Returns
TitleArray TitleArray object for category members.
Category::getName ( )
Returns
mixed DB key name, or false on failure
Category::getPageCount ( )
Returns
mixed Total number of member pages, or false on failure
Category::getSubcatCount ( )
Returns
mixed Number of subcategories, or false on failure
Category::getTitle ( )
Returns
Title|bool Title for this category, or false on failure.
Category::initialize (   $mode = self::LOAD_ONLY)
protected

Set up all member variables using a database query.

Parameters
int$mode
Exceptions
MWException
Returns
bool True on success, false on failure.
static Category::newFromID (   $id)
static

Factory function.

Parameters
int$idA category id
Returns
Category
static Category::newFromName (   $name)
static

Factory function.

Parameters
string$nameA category name (no "Category:" prefix). It need not be normalized, with spaces replaced by underscores.
Returns
Category|bool Category, or false on a totally invalid name
static Category::newFromRow (   $row,
  $title = null 
)
static

Factory function, for constructing a Category object from a result set

Parameters
object$rowResult set row, must contain the cat_xxx fields. If the fields are null, the resulting Category object will represent an empty category if a title object was given. If the fields are null and no title was given, this method fails and returns false.
Title$titleOptional title object for the category represented by the given row. May be provided if it is already known, to avoid having to re-create a title object later.
Returns
Category|false
static Category::newFromTitle (   $title)
static

Factory function.

Parameters
Title$titleTitle for the category page
Returns
Category|bool On a totally invalid name
Category::refreshCounts ( )

Refresh the counts for this category.

Returns
bool True on success, false on failure

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