本文整理汇总了PHP中PageManager::resolvePageTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::resolvePageTitle方法的具体用法?PHP PageManager::resolvePageTitle怎么用?PHP PageManager::resolvePageTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::resolvePageTitle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pagesFlatView
/**
* This function creates an array of all page titles in the system.
*
* @return array
* An array of page titles
*/
public function pagesFlatView()
{
$pages = PageManager::fetch(false, array('id'));
foreach ($pages as &$p) {
$p['title'] = PageManager::resolvePageTitle($p['id']);
}
return $pages;
}
示例2: __form
//.........这里部分代码省略.........
$options = array(array('admin-only', in_array('admin-only', $filters), __('Admin Only')), array('send-email', in_array('send-email', $filters), __('Send Notification Email')), array('expect-multiple', in_array('expect-multiple', $filters), __('Allow Multiple')));
/**
* Allows adding of new filter rules to the Event filter rule select box
*
* @delegate AppendEventFilter
* @param string $context
* '/blueprints/events/(edit|new|info)/'
* @param array $selected
* An array of all the selected filters for this Event
* @param array $options
* An array of all the filters that are available, passed by reference
*/
Symphony::ExtensionManager()->notifyMembers('AppendEventFilter', '/blueprints/events/' . $this->_context[0] . '/', array('selected' => $filters, 'options' => &$options));
$fieldset->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple', 'id' => 'event-filters')));
$this->Form->appendChild($fieldset);
// Connections
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Attach to Pages')));
$p = new XMLElement('p', __('The event will only be available on the selected pages.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$div = new XMLElement('div');
$label = Widget::Label(__('Pages'));
$pages = PageManager::fetch();
$event_handle = str_replace('-', '_', Lang::createHandle($fields['name']));
$connections = ResourceManager::getAttachedPages(RESOURCE_TYPE_EVENT, $event_handle);
$selected = array();
foreach ($connections as $connection) {
$selected[] = $connection['id'];
}
$options = array();
foreach ($pages as $page) {
$options[] = array($page['id'], in_array($page['id'], $selected), PageManager::resolvePageTitle($page['id']));
}
$label->appendChild(Widget::Select('fields[connections][]', $options, array('multiple' => 'multiple')));
$div->appendChild($label);
$fieldset->appendChild($div);
$this->Form->appendChild($fieldset);
// Providers
if (!empty($providers)) {
foreach ($providers as $providerClass => $provider) {
if ($isEditing && $fields['source'] !== call_user_func(array($providerClass, 'getSource'))) {
continue;
}
call_user_func_array(array($providerClass, 'buildEditor'), array($this->Form, &$this->_errors, $fields, $handle));
}
}
} else {
// Author
if (isset($about['author']['website'])) {
$link = Widget::Anchor($about['author']['name'], General::validateURL($about['author']['website']));
} elseif (isset($about['author']['email'])) {
$link = Widget::Anchor($about['author']['name'], 'mailto:' . $about['author']['email']);
} else {
$link = $about['author']['name'];
}
if ($link) {
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Author')));
$fieldset->appendChild(new XMLElement('p', $link->generate(false)));
$this->Form->appendChild($fieldset);
}
// Version
$fieldset = new XMLElement('fieldset');
示例3: __form
//.........这里部分代码省略.........
$prefix = '$ds-' . (isset($this->_context[1]) ? Lang::createHandle($fields['name']) : __('untitled')) . '.';
$options = array(array('label' => __('Authors'), 'data-label' => 'authors', 'options' => array()));
foreach (array('id', 'username', 'name', 'email', 'user_type') as $p) {
$options[0]['options'][] = array($p, $fields['source'] == 'authors' && in_array($p, $fields['param']), $prefix . $p, null, null, array('data-handle' => $p));
}
foreach ($field_groups as $section_id => $section_data) {
$optgroup = array('label' => $section_data['section']->get('name'), 'data-label' => 'section-' . $section_data['section']->get('id'), 'options' => array());
foreach (array('id', 'creation-date', 'modification-date', 'author') as $p) {
$option = array('system:' . $p, $fields['source'] == $section_id && in_array('system:' . $p, $fields['param']), $prefix . 'system-' . $p, null, null, array('data-handle' => 'system-' . $p));
// Handle 'system:date' as an output paramater (backwards compatibility)
if ($p === 'creation-date') {
if ($fields['source'] == $section_id && in_array('system:date', $fields['param'])) {
$option[1] = true;
}
}
$optgroup['options'][] = $option;
}
if (is_array($section_data['fields']) && !empty($section_data['fields'])) {
foreach ($section_data['fields'] as $input) {
if (!$input->allowDatasourceParamOutput()) {
continue;
}
$optgroup['options'][] = array($input->get('element_name'), $fields['source'] == $section_id && in_array($input->get('element_name'), $fields['param']), $prefix . $input->get('element_name'), null, null, array('data-handle' => $input->get('element_name')));
}
}
$options[] = $optgroup;
}
$label->appendChild(Widget::Select('fields[param][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$fieldset->appendChild($group);
// Associations
$label = Widget::Checkbox('fields[associated_entry_counts]', $fields['associated_entry_counts'], __('Include a count of entries in associated sections'));
$this->setContext($label, array('sections'));
$fieldset->appendChild($label);
// Encoding
$label = Widget::Checkbox('fields[html_encode]', $fields['html_encode'], __('HTML-encode text'));
$this->setContext($label, array('sections'));
$fieldset->appendChild($label);
$this->Form->appendChild($fieldset);
// Static XML
if (!isset($fields['static_xml'])) {
$fields['static_xml'] = null;
}
$fieldset = new XMLElement('fieldset');
$this->setContext($fieldset, array('static-xml'));
$fieldset->appendChild(new XMLElement('legend', __('Static XML')));
$p = new XMLElement('p', __('Enter valid XML, exclude XML declaration'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$label = Widget::Label();
$label->appendChild(Widget::Textarea('fields[static_xml]', 12, 50, General::sanitize(stripslashes($fields['static_xml'])), array('class' => 'code', 'placeholder' => '<static>content</static>')));
if (isset($this->_errors['static_xml'])) {
$fieldset->appendChild(Widget::Error($label, $this->_errors['static_xml']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
// Connections
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Attach to Pages')));
$p = new XMLElement('p', __('The data will only be available on the selected pages.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$div = new XMLElement('div');
$label = Widget::Label(__('Pages'));
$pages = PageManager::fetch();
$ds_handle = str_replace('-', '_', Lang::createHandle($fields['name']));
$connections = ResourceManager::getAttachedPages(ResourceManager::RESOURCE_TYPE_DS, $ds_handle);
$selected = array();
foreach ($connections as $connection) {
$selected[] = $connection['id'];
}
$options = array();
foreach ($pages as $page) {
$options[] = array($page['id'], in_array($page['id'], $selected), PageManager::resolvePageTitle($page['id']));
}
$label->appendChild(Widget::Select('fields[connections][]', $options, array('multiple' => 'multiple')));
$div->appendChild($label);
$fieldset->appendChild($div);
$this->Form->appendChild($fieldset);
// Call the provided datasources to let them inject their filters
// @todo Ideally when a new Datasource is chosen an AJAX request will fire
// to get the HTML from the extension. This is hardcoded for now into
// creating a 'big' page and then hiding the fields with JS
if (!empty($providers)) {
foreach ($providers as $providerClass => $provider) {
call_user_func_array(array($providerClass, 'buildEditor'), array($this->Form, &$this->_errors, $fields, $handle));
}
}
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', $isEditing ? __('Save Changes') : __('Create Data Source'), 'submit', array('accesskey' => 's')));
if ($isEditing) {
$button = new XMLElement('button', __('Delete'));
$button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this data source'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this data source?')));
$div->appendChild($button);
}
$this->Form->appendChild($div);
}
示例4: getAttachedPages
/**
* Given the resource handle, this function will return an associative
* array of Page information, filtered by the pages the resource is attached to.
*
* @param integer $type
* The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS`
* @param string $r_handle
* The handle of the resource.
* @return array
* An associative array of Page information, according to the pages the resource is attached to.
*/
public static function getAttachedPages($type, $r_handle)
{
$col = self::getColumnFromType($type);
$pages = PageManager::fetch(false, array('id'), array(sprintf('`%s` = "%s" OR `%s` REGEXP "%s"', $col, $r_handle, $col, '^' . $r_handle . ',|,' . $r_handle . ',|,' . $r_handle . '$')));
if (is_array($pages)) {
foreach ($pages as $key => &$page) {
$pages[$key] = array('id' => $page['id'], 'title' => PageManager::resolvePageTitle($page['id']));
}
}
return is_null($pages) ? array() : $pages;
}
示例5: __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);
}
}