本文整理汇总了PHP中PageManager::getChildPagesCount方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::getChildPagesCount方法的具体用法?PHP PageManager::getChildPagesCount怎么用?PHP PageManager::getChildPagesCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::getChildPagesCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Pages'), __('Symphony'))));
$nesting = Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes';
if ($nesting == true && isset($_GET['parent']) && is_numeric($_GET['parent'])) {
$parent = PageManager::fetchPageByID((int) $_GET['parent'], array('title', 'id'));
}
$this->appendSubheading(isset($parent) ? $parent['title'] : __('Pages'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/' . ($nesting == true && isset($parent) ? "?parent={$parent['id']}" : NULL), __('Create a new page'), 'create button', NULL, array('accesskey' => 'c')));
if (isset($parent)) {
$this->insertBreadcrumbsUsingPageIdentifier($parent['id'], false);
}
$aTableHead = array(array(__('Title'), 'col'), array(__('Template'), 'col'), array('<abbr title="' . __('Universal Resource Locator') . '">' . __('URL') . '</abbr>', 'col'), array('<abbr title="' . __('Universal Resource Locator') . '">' . __('URL') . '</abbr> ' . __('Parameters'), 'col'), array(__('Type'), 'col'));
$aTableBody = array();
if ($nesting == true) {
$aTableHead[] = array(__('Children'), 'col');
$where = array('parent ' . (isset($parent) ? " = {$parent['id']} " : ' IS NULL '));
} else {
$where = array();
}
$pages = PageManager::fetch(true, array('*'), $where);
if (!is_array($pages) or empty($pages)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', null, count($aTableHead))), 'odd'));
} else {
foreach ($pages as $page) {
$class = array();
$page_title = $nesting == true ? $page['title'] : PageManager::resolvePageTitle($page['id']);
$page_url = URL . '/' . PageManager::resolvePagePath($page['id']) . '/';
$page_edit_url = Administration::instance()->getCurrentPageURL() . 'edit/' . $page['id'] . '/';
$page_template = PageManager::createFilePath($page['path'], $page['handle']);
$page_template_url = Administration::instance()->getCurrentPageURL() . 'template/' . $page_template . '/';
$col_title = Widget::TableData(Widget::Anchor($page_title, $page_edit_url, $page['handle']));
$col_title->appendChild(Widget::Input("items[{$page['id']}]", null, 'checkbox'));
$col_template = Widget::TableData(Widget::Anchor($page_template . '.xsl', $page_template_url));
$col_url = Widget::TableData(Widget::Anchor($page_url, $page_url));
if ($page['params']) {
$col_params = Widget::TableData(trim($page['params'], '/'));
} else {
$col_params = Widget::TableData(__('None'), 'inactive');
}
if (!empty($page['type'])) {
$col_types = Widget::TableData(implode(', ', $page['type']));
} else {
$col_types = Widget::TableData(__('None'), 'inactive');
}
if (in_array($page['id'], $this->_hilights)) {
$class[] = 'failed';
}
$columns = array($col_title, $col_template, $col_url, $col_params, $col_types);
if ($nesting == true) {
if (PageManager::hasChildPages($page['id'])) {
$col_children = Widget::TableData(Widget::Anchor(PageManager::getChildPagesCount($page['id']) . ' →', SYMPHONY_URL . '/blueprints/pages/?parent=' . $page['id']));
} else {
$col_children = Widget::TableData(__('None'), 'inactive');
}
$columns[] = $col_children;
}
$aTableBody[] = Widget::TableRow($columns, implode(' ', $class));
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), 'orderable selectable');
$this->Form->appendChild($table);
$tableActions = new XMLElement('div');
$tableActions->setAttribute('class', 'actions');
$options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm', null, array('data-message' => __('Are you sure you want to delete the selected pages?'))));
/**
* Allows an extension to modify the existing options for this page's
* With Selected menu. If the `$options` parameter is an empty array,
* the 'With Selected' menu will not be rendered.
*
* @delegate AddCustomActions
* @since Symphony 2.3.2
* @param string $context
* '/blueprints/pages/'
* @param array $options
* An array of arrays, where each child array represents an option
* in the With Selected menu. Options should follow the same format
* expected by `Widget::__SelectBuildOption`. Passed by reference.
*/
Symphony::ExtensionManager()->notifyMembers('AddCustomActions', '/blueprints/pages/', array('options' => &$options));
if (!empty($options)) {
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
}