Perforce Chronicle 2012.2/486814
API Documentation
|
Implements categorization of content primarily for navigation. More...
Public Member Functions | |
getEntries (array $options=array()) | |
Retrieve the content entries within this category. | |
getIndexContent () | |
Get the content entry id used as an index page for this category or null if utilizing the default presentation. | |
getUri () | |
Get the URI to view this category. | |
hasIndexContent () | |
Check if the category specifies a valid index content page. | |
setIndexContent ($indexContent) | |
Update the index content with a new value. | |
Public Attributes | |
const | OPTION_DEREFERENCE = 'dereference' |
Static Protected Attributes | |
static | $_fields |
Specify the fields for category metadata. | |
static | $_idField = 'id' |
All records should have an id field. | |
static | $_nestingAllowed = true |
Specifies whether this category allows child categories. | |
static | $_storageSubPath = 'categories' |
Specifies the root path for folder category entries. |
Implements categorization of content primarily for navigation.
Category_Model_Category::getEntries | ( | array $ | options = array() | ) |
Retrieve the content entries within this category.
By default, this will return a list of unique entry identifiers sorted by 'title' field.
array | $options | options to influence fetching content entries: OPTION_RECURSIVE - whether to include entries in sub-categories OPTION_DEREFERENCE - influence type of values returned in the output array; if true, then return entry objects, otherwise return entry ids any other options will be passed to the record query |
Reimplemented from P4Cms_Categorization_CategoryAbstract.
{ // convert $options to record query options $options['paths'] = parent::getEntries($options); // sort by title if sorting key is not set in options if (!isset($options['sortBy'])) { $options['sortBy'] = 'title'; } // if not dereferencing, limit fields to id as we don't need other fields $dereference = isset($options[static::OPTION_DEREFERENCE]) && $options[static::OPTION_DEREFERENCE]; if (!$dereference) { $options['limitFields'] = P4Cms_Content::getIdField(); } // remove special options to avoid possible interference with query options unset($options[static::OPTION_DEREFERENCE]); unset($options[static::OPTION_RECURSIVE]); // create record query with assembled options $query = new P4Cms_Record_Query($options); // get content entries via P4Cms_Content::fetchAll() to ensure that // all third-parties filtering via pub/sub is applied $entries = P4Cms_Content::fetchAll($query, $this->getAdapter()); // if dereference, return shallow copy of the entries iterator, // otherwise return list of entries ids return $dereference ? $entries->toArray(true) : $entries->invoke('getId'); }
Category_Model_Category::getIndexContent | ( | ) |
Get the content entry id used as an index page for this category or null if utilizing the default presentation.
{ return $this->_getValue('indexContent'); }
Category_Model_Category::getUri | ( | ) |
Get the URI to view this category.
{ $params = array( 'module' => 'category', 'controller' => 'index', 'action' => 'index', 'category' => $this->getId(), ); $router = Zend_Controller_Front::getInstance()->getRouter(); return $router->assemble($params, 'category', null, false); }
Category_Model_Category::hasIndexContent | ( | ) |
Check if the category specifies a valid index content page.
{ $id = $this->_getValue('indexContent'); return (strlen($id) && P4Cms_Content::exists($id)); }
Category_Model_Category::setIndexContent | ( | $ | indexContent | ) |
Update the index content with a new value.
string | $indexContent | The new content |
{ return $this->_setValue('indexContent', $indexContent); }
Category_Model_Category::$_fields [static, protected] |
array( 'title' => array( 'accessor' => 'getTitle', 'mutator' => 'setTitle' ), 'description' => array( 'accessor' => 'getDescription', 'mutator' => 'setDescription' ), 'indexContent' => array( 'accessor' => 'getIndexContent', 'mutator' => 'setIndexContent' ) )
Specify the fields for category metadata.
Reimplemented from P4Cms_Categorization_CategoryAbstract.
Category_Model_Category::$_idField = 'id' [static, protected] |
All records should have an id field.
Reimplemented from P4Cms_Record.
Category_Model_Category::$_nestingAllowed = true [static, protected] |
Specifies whether this category allows child categories.
Reimplemented from P4Cms_Categorization_CategoryAbstract.
Category_Model_Category::$_storageSubPath = 'categories' [static, protected] |
Specifies the root path for folder category entries.
Reimplemented from P4Cms_Categorization_CategoryAbstract.
const Category_Model_Category::OPTION_DEREFERENCE = 'dereference' |