本文整理汇总了PHP中Widget::Apply方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::Apply方法的具体用法?PHP Widget::Apply怎么用?PHP Widget::Apply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::Apply方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Utilities'), __('Symphony'))));
$this->appendSubheading(__('Utilities'), Widget::Anchor(__('Create New'), SYMPHONY_URL . '/blueprints/utilities/new/', __('Create a new utility'), 'create button'));
$utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
$utilities = $utilities['filelist'];
$aTableHead = array(array(__('Name'), 'col'));
$aTableBody = array();
if (!is_array($utilities) || empty($utilities)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
} else {
foreach ($utilities as $u) {
$name = Widget::TableData(Widget::Anchor($u, SYMPHONY_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $u) . '/'));
$name->appendChild(Widget::Input('items[' . $u . ']', null, 'checkbox'));
$aTableBody[] = Widget::TableRow(array($name));
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), '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'));
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
示例2: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Sections'), __('Symphony'))));
$this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a section'), 'create button', NULL, array('accesskey' => 'c')));
$sections = SectionManager::fetch(NULL, 'ASC', 'sortorder');
$aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'));
$aTableBody = array();
if (!is_array($sections) || empty($sections)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
} else {
foreach ($sections as $s) {
$entry_count = EntryManager::fetchCount($s->get('id'));
// Setup each cell
$td1 = Widget::TableData(Widget::Anchor($s->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content'));
$td2 = Widget::TableData(Widget::Anchor("{$entry_count}", SYMPHONY_URL . '/publish/' . $s->get('handle') . '/'));
$td3 = Widget::TableData($s->get('navigation_group'));
$td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', 'checkbox'));
// Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
}
}
$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 sections?'))), array('delete-entries', false, __('Delete Entries'), 'confirm', null, array('data-message' => __('Are you sure you want to delete all entries in the selected sections?'))));
if (is_array($sections) && !empty($sections)) {
$index = 3;
$options[$index] = array('label' => __('Set navigation group'), 'options' => array());
$groups = array();
foreach ($sections as $s) {
if (in_array($s->get('navigation_group'), $groups)) {
continue;
}
$groups[] = $s->get('navigation_group');
$value = 'set-navigation-group-' . urlencode($s->get('navigation_group'));
$options[$index]['options'][] = array($value, false, $s->get('navigation_group'));
}
}
/**
* 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/sections/'
* @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/sections/', array('options' => &$options));
if (!empty($options)) {
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
}
示例3: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('RestEngine Settings'))));
$this->appendSubheading(__('RestEngine API Resources'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Associate a Symphony page with a REST API section'), 'create button', NULL, array('accesskey' => 'c')));
$pageMapping = RestResourceManager::fetch();
//$pageMapping = array();
$TableHead = array(array(__('Page'), 'col'), array(__('Resource Base URL'), 'col'), array(__('Section'), 'col'), array(__('Unique ID Field'), 'col'), array(__('Unique ID URL Parameter'), 'col'), array(__('Format URL Parameter'), 'col'));
$TableBody = array();
if (!is_array($pageMapping) || empty($pageMapping)) {
$TableBody = array(Widget::TableRow(array(Widget::TableData(__('There are currently no RestEngine API pages. Click Crete New above to add one.'), 'inactive', NULL, count($TableHead)))));
} else {
foreach ($pageMapping as $page) {
$pageTd = Widget::TableData(Widget::Anchor($page->get('page_title'), Administration::instance()->getCurrentPageURL() . 'edit/' . $page->get('id') . '/', null, 'content'));
$resourceURL = Widget::TableData(Widget::Anchor($page->get('page_uri'), $page->get('page_uri'), null));
$sectionTd = Widget::TableData($page->get('section_name'));
$fieldTd = Widget::TableData($page->get('field_name'));
$uidParamTd = Widget::TableData($page->get('uid_parameter'));
$formatParamTd = Widget::TableData($page->get('format_parameter'));
$TableBody[] = Widget::TableRow(array($pageTd, $resourceURL, $sectionTd, $fieldTd, $uidParamTd, $formatParamTd));
}
}
$table = Widget::Table(Widget::TableHead($TableHead), NULL, Widget::TableBody($TableBody), 'selectable');
$this->Form->appendChild($table);
$tableActions = new XMLElement('div');
$tableActions->setAttribute('class', 'actions');
$options = array(0 => array(null, false, __('With Selected...')), 1 => array('delete', false, __('Delete'), 'confirm'));
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
示例4: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Authors'), __('Symphony'))));
if (Administration::instance()->Author->isDeveloper()) {
$this->appendSubheading(__('Authors'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a new author'), 'create button', NULL, array('accesskey' => 'c')));
} else {
$this->appendSubheading(__('Authors'));
}
Sortable::initialize($this, $authors, $sort, $order);
$columns = array(array('label' => __('Name'), 'sortable' => true, 'handle' => 'name'), array('label' => __('Email Address'), 'sortable' => true, 'handle' => 'email'), array('label' => __('Last Seen'), 'sortable' => true, 'handle' => 'last_seen'));
if (Administration::instance()->Author->isDeveloper()) {
$columns = array_merge($columns, array(array('label' => __('User Type'), 'sortable' => true, 'handle' => 'user_type'), array('label' => __('Language'), 'sortable' => true, 'handle' => 'language')));
}
$aTableHead = Sortable::buildTableHeaders($columns, $sort, $order, isset($_REQUEST['filter']) ? '&filter=' . $_REQUEST['filter'] : '');
$aTableBody = array();
if (!is_array($authors) || empty($authors)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
} else {
foreach ($authors as $a) {
// Setup each cell
if (Administration::instance()->Author->isDeveloper() || Administration::instance()->Author->get('id') == $a->get('id')) {
$td1 = Widget::TableData(Widget::Anchor($a->getFullName(), Administration::instance()->getCurrentPageURL() . 'edit/' . $a->get('id') . '/', $a->get('username'), 'author'));
} else {
$td1 = Widget::TableData($a->getFullName(), 'inactive');
}
$td2 = Widget::TableData(Widget::Anchor($a->get('email'), 'mailto:' . $a->get('email'), __('Email this author')));
if (!is_null($a->get('last_seen'))) {
$td3 = Widget::TableData(DateTimeObj::format($a->get('last_seen'), __SYM_DATETIME_FORMAT__));
} else {
$td3 = Widget::TableData(__('Unknown'), 'inactive');
}
$td4 = Widget::TableData($a->isDeveloper() ? __("Developer") : __("Author"));
$languages = Lang::getAvailableLanguages();
$td5 = Widget::TableData($a->get("language") == NULL ? __("System Default") : $languages[$a->get("language")]);
if (Administration::instance()->Author->isDeveloper()) {
if ($a->get('id') != Administration::instance()->Author->get('id')) {
$td3->appendChild(Widget::Input('items[' . $a->get('id') . ']', NULL, 'checkbox'));
}
}
// Add a row to the body array, assigning each cell to the row
if (Administration::instance()->Author->isDeveloper()) {
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5));
} else {
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
}
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable');
$this->Form->appendChild($table);
if (Administration::instance()->Author->isDeveloper()) {
$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 authors?'))));
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
}
示例5: buildActions
/**
* Utility method that generates the 'action' panel
*/
public static function buildActions($hasData, array $additionalActions = null)
{
$tableActions = new XMLElement('div');
$tableActions->setAttribute('class', 'actions');
if ($hasData == true) {
$options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm'));
if ($additionalActions != null) {
array_push($options, $additionalActions);
}
$tableActions->appendChild(Widget::Apply($options));
}
return $tableActions;
}
示例6: view
public function view()
{
parent::view(FALSE);
if (isset($this->mode)) {
$section = $this->mode;
header('Content-Type: application/json');
echo file_get_contents(WORKSPACE . '/elasticsearch/mappings/' . $section . '.json');
die;
}
$this->addScriptToHead(URL . '/extensions/elasticsearch/assets/elasticsearch.mappings.js', 101);
$this->addStylesheetToHead(URL . '/extensions/elasticsearch/assets/elasticsearch.mappings.css', 'screen', 102);
$this->setPageType('table');
$this->setTitle(__('Symphony') . ' – ' . __('ElasticSearch') . ' – ' . __('Mappings'));
$this->appendSubheading(__('Mappings'));
$types = ElasticSearch::getAllTypes();
$tableHead = array();
$tableBody = array();
$tableHead[] = array(__('Section'), 'col');
$tableHead[] = array(__('Mapped Fields'), 'col');
$tableHead[] = array(__('Mapping JSON'), 'col');
$tableHead[] = array(__('Entries'), 'col');
if (!is_array($types) or empty($types)) {
$tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
} else {
foreach ($types as $type) {
$col_name = Widget::TableData($type->section->get('name'));
$col_name->appendChild(Widget::Input('items[' . $type->section->get('handle') . ']', NULL, 'checkbox'));
$col_fields = Widget::TableData(implode(', ', $type->fields));
$col_json = Widget::TableData(sprintf('<a href="%s">%s.json</a>', $type->section->get('handle'), $type->section->get('handle')));
if ($type->type) {
$count = $type->type->count();
$col_count = Widget::TableData('<span id="reindex-' . $type->section->get('handle') . '">' . (string) $count . ' ' . ($count == 1 ? 'entry' : 'entries') . '</span>', $count_class . ' count-column');
} else {
$col_count = Widget::TableData('Rebuild mapping before continuing', $count_class . ' count-column inactive');
}
$attributes = array('data-handle' => $type->section->get('handle'));
if (in_array($type->section->get('handle'), $this->reindex) && $type->type) {
$attributes['data-reindex'] = 'yes';
}
$tableBody[] = Widget::TableRow(array($col_name, $col_fields, $col_json, $col_count), NULL, NULL, NULL, $attributes);
}
}
$table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody), 'selectable');
$this->Form->appendChild($table);
$actions = new XMLElement('div');
$actions->setAttribute('class', 'actions');
$options = array(array(null, false, __('With Selected...')), array('reindex', false, __('Reindex Entries')), array('rebuild', false, __('Rebuild Mapping')), array('delete', false, __('Delete Mapping')));
$actions->appendChild(Widget::Apply($options));
$this->Form->appendChild($actions);
}
示例7: view
public function view()
{
$this->setPageType('table');
$this->setTitle('Symphony – Cron');
$this->appendSubheading('Cron Tasks', [Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a cron task'), 'create button', null, ['accesskey' => 'c'])]);
Extension_Cron::init();
$iterator = new Lib\CronTaskIterator(realpath(MANIFEST . '/cron'), Symphony::Database());
$aTableHead = [['Name', 'col'], ['Description', 'col'], ['Enabled', 'col'], ['Last Executed', 'col'], ['Next Execution', 'col'], ['Last Output', 'col']];
$aTableBody = [];
if ($iterator->count() == 0) {
$aTableBody = [Widget::TableRow([Widget::TableData(__('None found.'), 'inactive', null, count($aTableHead))], 'odd')];
} else {
foreach ($iterator as $ii => $task) {
$td1 = Widget::TableData(Widget::Anchor($task->name, sprintf('%sedit/%s/', Administration::instance()->getCurrentPageURL(), $task->filename)));
$td1->appendChild(Widget::Label(__('Select Task %s', [$task->filename]), null, 'accessible', null, array('for' => 'task-' . $ii)));
$td1->appendChild(Widget::Input('items[' . $task->filename . ']', 'on', 'checkbox', array('id' => 'task-' . $ii)));
$td2 = Widget::TableData(is_null($task->description) ? 'None' : $task->description);
if (is_null($task->description)) {
$td2->setAttribute('class', 'inactive');
}
$td3 = Widget::TableData($task->enabledReal() == true ? 'Yes' : 'No');
if ($task->enabled == false) {
$td3->setAttribute('class', 'inactive');
}
$td4 = Widget::TableData(!is_null($task->getLastExecutionTimestamp()) ? DateTimeObj::get(__SYM_DATETIME_FORMAT__, $task->getLastExecutionTimestamp()) : 'Unknown');
if (is_null($task->getLastExecutionTimestamp())) {
$td4->setAttribute('class', 'inactive');
}
$td5 = Widget::TableData(!is_null($task->nextExecution()) ? self::__minutesToHumanReadable(ceil($task->nextExecution() * (1 / 60))) : 'Unknown');
if (is_null($task->nextExecution()) || $task->enabledReal() == false) {
$td5->setAttribute('class', 'inactive');
}
if (is_null($task->getLog())) {
$td6 = Widget::TableData('None', 'inactive');
} else {
$td6 = Widget::TableData(Widget::Anchor('view', sprintf('%slog/%s/', Administration::instance()->getCurrentPageURL(), $task->filename)));
}
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5, $td6));
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
$this->Form->appendChild($table);
$tableActions = new XMLElement('div');
$tableActions->setAttribute('class', 'actions');
$options = [[null, false, __('With Selected...')], ['enable', false, __('Enable')], ['disable', false, __('Disable')], ['delete', false, __('Delete'), 'confirm', null, ['data-message' => __('Are you sure you want to delete the selected tasks?')]]];
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
示例8: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Sections'), __('Symphony'))));
$this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a section'), 'create button', NULL, array('accesskey' => 'c')));
$sections = SectionManager::fetch(NULL, 'ASC', 'sortorder');
$aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'));
$aTableBody = array();
if (!is_array($sections) || empty($sections)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
} else {
foreach ($sections as $s) {
$entry_count = EntryManager::fetchCount($s->get('id'));
// Setup each cell
$td1 = Widget::TableData(Widget::Anchor($s->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content'));
$td2 = Widget::TableData(Widget::Anchor("{$entry_count}", SYMPHONY_URL . '/publish/' . $s->get('handle') . '/'));
$td3 = Widget::TableData($s->get('navigation_group'));
$td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', 'checkbox'));
// Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
}
}
$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 sections?'))), array('delete-entries', false, __('Delete Entries'), 'confirm', null, array('data-message' => __('Are you sure you want to delete all entries in the selected sections?'))));
if (is_array($sections) && !empty($sections)) {
$index = 3;
$options[$index] = array('label' => __('Set navigation group'), 'options' => array());
$groups = array();
foreach ($sections as $s) {
if (in_array($s->get('navigation_group'), $groups)) {
continue;
}
$groups[] = $s->get('navigation_group');
$value = 'set-navigation-group-' . urlencode($s->get('navigation_group'));
$options[$index]['options'][] = array($value, false, $s->get('navigation_group'));
}
}
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
示例9: __viewIndex
public function __viewIndex()
{
// Set the page to display as a table:
$this->setPageType('table');
$this->appendSubheading(__('Author Roles'), Widget::Anchor(__('Create New'), $this->_uri . 'roles/new/', __('Create a new role'), 'create button'));
// Set the table head:
$tableHead = array(array(__('Role Name'), 'col'), array(__('Authors with this role'), 'col'));
// Set the table body:
$tableBody = array();
// Fill the table with available roles:
$roles = $this->_driver->getRoles();
if (empty($roles)) {
// No roles found, create an empty row:
$tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
} else {
foreach ($roles as $role) {
$row = new XMLElement('tr');
$td = new XMLElement('td', '<a href="' . $this->_url . 'roles/edit/' . $role['id'] . '/">' . $role['name'] . '</a>');
$td->appendChild(Widget::Input('items[' . $role['id'] . ']', NULL, 'checkbox'));
$row->appendChild($td);
// Authors:
$authors = $this->_driver->getAuthors($role['id']);
if (empty($authors)) {
$row->appendChild(new XMLElement('td', '<em>none</em>'));
} else {
$links = array();
foreach ($authors as $author) {
$links[] = '<a href="' . URL . '/symphony/system/authors/edit/' . $author['id'] . '/">' . $author['first_name'] . ' ' . $author['last_name'] . '</a>';
}
$row->appendChild(new XMLElement('td', implode(', ', $links)));
}
$tableBody[] = $row;
}
}
// Create the table element:
$table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody), '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 roles?'))));
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
示例10: view
public function view()
{
// Start building the page
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Documentation'))));
$this->appendSubheading(__('Documentation'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/documenter/new/', __('Create a new documentation item'), 'create button'));
// Grab all the documentation items
$docs = Symphony::Database()->fetch("\n\t\t\t\tSELECT\n\t\t\t\t\td.*\n\t\t\t\tFROM\n\t\t\t\t\t`tbl_documentation` AS d\n\t\t\t\tORDER BY\n\t\t\t\t\td.pages ASC\n\t\t\t");
// Build the table
$thead = array(array(__('Title'), 'col'), array(__('Pages'), 'col'));
$tbody = array();
// If there are no records, display default message
if (!is_array($docs) or empty($docs)) {
$tbody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', null, count($thead))), 'odd'));
} else {
$bOdd = true;
foreach ($docs as $doc) {
$doc_edit_url = URL . '/symphony/extension/documenter/edit/' . $doc['id'] . '/';
$col_title = Widget::TableData(Widget::Anchor($doc['title'], $doc_edit_url));
$col_title->appendChild(Widget::Input("items[{$doc['id']}]", null, 'checkbox'));
$pages = $doc['pages'];
$pages = explode(',', $pages);
$pages = join(', ', $pages);
$col_pages = Widget::TableData($pages);
$tbody[] = Widget::TableRow(array($col_title, $col_pages), $bOdd ? 'odd' : NULL);
$bOdd = !$bOdd;
}
}
$table = Widget::Table(Widget::TableHead($thead), null, Widget::TableBody($tbody), null);
$table->setAttribute('class', 'selectable');
$this->Form->appendChild($table);
$actions = new XMLElement('div');
$actions->setAttribute('class', 'actions');
$options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
$actions->appendChild(Widget::Apply($options));
$this->Form->appendChild($actions);
}
示例11: view
public function view()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Templated Text Formatters'), __('Symphony'))));
$this->appendSubheading(__('Templated Text Formatters'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/templatedtextformatters/edit/', __('Create a new formatter'), 'create button', NULL, array('accesskey' => 'c')));
$aTableHead = array(array(__('Name'), 'col'), array(__('Type'), 'col'), array(__('Description'), 'col'));
$aTableBody = array();
$formatters = $this->_driver->listAll();
if (!is_array($formatters) || empty($formatters)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
} else {
foreach ($formatters as $id => $data) {
$formatter = TextformatterManager::create($id);
$about = $formatter->about();
$td1 = Widget::TableData(Widget::Anchor($about['name'], URL . "/symphony/extension/templatedtextformatters/edit/{$id}/", $about['name']));
$td2 = Widget::TableData($about['templatedtextformatters-type']);
$td3 = Widget::TableData(General::sanitize($about['description']));
$td1->appendChild(Widget::Label(__('Select Text Formatter %s', array($about['name'])), null, 'accessible', null, array('for' => 'ttf-' . $id)));
$td1->appendChild(Widget::Input('items[' . $id . ']', 'on', 'checkbox', array('id' => 'ttf-' . $id)));
// Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
$this->Form->appendChild($table);
$version = new XMLElement('p', 'Symphony ' . Symphony::Configuration()->get('version', 'symphony'), array('id' => 'version'));
$this->Form->appendChild($version);
$div = new XMLElement('div');
$div->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 text formatters?'))));
Symphony::ExtensionManager()->notifyMembers('AddCustomActions', '/templatedtextformatters/', array('options' => &$options));
if (!empty($options)) {
$div->appendChild(Widget::Apply($options));
$this->Form->appendChild($div);
}
}
示例12: __viewIndex
//.........这里部分代码省略.........
* Either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DATASOURCE`
*/
public function __viewIndex($resource_type)
{
$manager = ResourceManager::getManagerFromType($resource_type);
$this->setPageType('table');
Sortable::initialize($this, $resources, $sort, $order, array('type' => $resource_type));
$columns = array(array('label' => __('Name'), 'sortable' => true, 'handle' => 'name'), array('label' => __('Source'), 'sortable' => true, 'handle' => 'source'), array('label' => __('Pages'), 'sortable' => false), array('label' => __('Release Date'), 'sortable' => true, 'handle' => 'release-date'), array('label' => __('Author'), 'sortable' => true, 'handle' => 'author'));
$aTableHead = Sortable::buildTableHeaders($columns, $sort, $order, isset($_REQUEST['filter']) ? '&filter=' . $_REQUEST['filter'] : '');
$aTableBody = array();
if (!is_array($resources) || empty($resources)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
} else {
foreach ($resources as $r) {
// Resource name
$action = isset($r['can_parse']) && $r['can_parse'] === true ? 'edit' : 'info';
$name = Widget::TableData(Widget::Anchor($r['name'], SYMPHONY_URL . $_REQUEST['symphony-page'] . $action . '/' . $r['handle'] . '/', $r['handle']));
// Resource type/source
if (isset($r['source'], $r['source']['id'])) {
$section = Widget::TableData(Widget::Anchor($r['source']['name'], SYMPHONY_URL . '/blueprints/sections/edit/' . $r['source']['id'] . '/', $r['source']['handle']));
} else {
if (isset($r['source']) && class_exists($r['source']['name']) && method_exists($r['source']['name'], 'getSourceColumn')) {
$class = call_user_func(array($manager, '__getClassName'), $r['handle']);
$section = Widget::TableData(call_user_func(array($class, 'getSourceColumn'), $r['handle']));
} else {
if (isset($r['source'], $r['source']['name'])) {
$section = Widget::TableData($r['source']['name']);
} else {
$section = Widget::TableData(__('Unknown'), 'inactive');
}
}
}
// Attached pages
$pages = ResourceManager::getAttachedPages($resource_type, $r['handle']);
$pagelinks = array();
$i = 0;
foreach ($pages as $p) {
++$i;
$pagelinks[] = Widget::Anchor($p['title'], SYMPHONY_URL . '/blueprints/pages/edit/' . $p['id'] . '/')->generate() . (count($pages) > $i ? $i % 10 == 0 ? '<br />' : ', ' : '');
}
$pages = implode('', $pagelinks);
if ($pages == '') {
$pagelinks = Widget::TableData(__('None'), 'inactive');
} else {
$pagelinks = Widget::TableData($pages, 'pages');
}
// Release date
$releasedate = Widget::TableData(Lang::localizeDate(DateTimeObj::format($r['release-date'], __SYM_DATETIME_FORMAT__)));
// Authors
$author = $r['author']['name'];
if ($author) {
if (isset($r['author']['website'])) {
$author = Widget::Anchor($r['author']['name'], General::validateURL($r['author']['website']));
} else {
if (isset($r['author']['email'])) {
$author = Widget::Anchor($r['author']['name'], 'mailto:' . $r['author']['email']);
}
}
}
$author = Widget::TableData($author);
$author->appendChild(Widget::Input('items[' . $r['handle'] . ']', null, 'checkbox'));
$aTableBody[] = Widget::TableRow(array($name, $section, $pagelinks, $releasedate, $author));
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), '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'));
$pages = $this->pagesFlatView();
$group_attach = array('label' => __('Attach to Page'), 'options' => array());
$group_detach = array('label' => __('Detach from Page'), 'options' => array());
$group_attach['options'][] = array('attach-all-pages', false, __('All'));
$group_detach['options'][] = array('detach-all-pages', false, __('All'));
foreach ($pages as $p) {
$group_attach['options'][] = array('attach-to-page-' . $p['id'], false, $p['title']);
$group_detach['options'][] = array('detach-from-page-' . $p['id'], false, $p['title']);
}
$options[] = $group_attach;
$options[] = $group_detach;
/**
* 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/datasources/' or '/blueprints/events/'
* @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', $_REQUEST['symphony-page'], array('options' => &$options));
if (!empty($options)) {
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
}
示例13: __viewIndex
//.........这里部分代码省略.........
* @param integer $section_id
* The current Section ID
* @param Entry $entry_id
* The entry object, please note that this is by error and this will
* be removed in Symphony 2.4. The entry object is available in
* the 'entry' key as of Symphony 2.3.1.
* @param Entry $entry
* The entry object for this row
*/
Symphony::ExtensionManager()->notifyMembers('AddCustomPublishColumnData', '/publish/', array('tableData' => &$tableData, 'section_id' => $section->get('id'), 'entry_id' => $entry, 'entry' => $entry));
$tableData[count($tableData) - 1]->appendChild(Widget::Label(__('Select Entry %d', array($entry->get('id'))), null, 'accessible', null, array('for' => 'entry-' . $entry->get('id'))));
$tableData[count($tableData) - 1]->appendChild(Widget::Input('items[' . $entry->get('id') . ']', null, 'checkbox', array('id' => 'entry-' . $entry->get('id'))));
// Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow($tableData, null, 'id-' . $entry->get('id'));
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
$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 entries?'))));
$toggable_fields = $section->fetchToggleableFields();
if (is_array($toggable_fields) && !empty($toggable_fields)) {
$index = 2;
foreach ($toggable_fields as $field) {
$toggle_states = $field->getToggleStates();
if (is_array($toggle_states)) {
$options[$index] = array('label' => __('Set %s', array($field->get('label'))), 'options' => array());
foreach ($toggle_states as $value => $state) {
$options[$index]['options'][] = array('toggle-' . $field->get('id') . '-' . $value, false, $state);
}
}
$index++;
}
}
/**
* 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
* '/publish/'
* @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', '/publish/', array('options' => &$options));
if (!empty($options)) {
$tableActions->appendChild(Widget::Apply($options));
$this->Form->appendChild($tableActions);
}
if ($entries['total-pages'] > 1) {
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'page');
// First
$li = new XMLElement('li');
if ($current_page > 1) {
$li->appendChild(Widget::Anchor(__('First'), Administration::instance()->getCurrentPageURL() . '?pg=1' . ($filter_querystring ? "&" . $filter_querystring : '')));
} else {
$li->setValue(__('First'));
}
$ul->appendChild($li);
// Previous
$li = new XMLElement('li');
if ($current_page > 1) {
$li->appendChild(Widget::Anchor(__('← Previous'), Administration::instance()->getCurrentPageURL() . '?pg=' . ($current_page - 1) . ($filter_querystring ? "&" . $filter_querystring : '')));
} else {
$li->setValue(__('← Previous'));
}
$ul->appendChild($li);
// Summary
$li = new XMLElement('li');
$li->setAttribute('title', __('Viewing %1$s - %2$s of %3$s entries', array($entries['start'], $current_page != $entries['total-pages'] ? $current_page * Symphony::Configuration()->get('pagination_maximum_rows', 'symphony') : $entries['total-entries'], $entries['total-entries'])));
$pgform = Widget::Form(Administration::instance()->getCurrentPageURL(), 'get', 'paginationform');
$pgmax = max($current_page, $entries['total-pages']);
$pgform->appendChild(Widget::Input('pg', null, 'text', array('data-active' => __('Go to page …'), 'data-inactive' => __('Page %1$s of %2$s', array((string) $current_page, $pgmax)), 'data-max' => $pgmax)));
$li->appendChild($pgform);
$ul->appendChild($li);
// Next
$li = new XMLElement('li');
if ($current_page < $entries['total-pages']) {
$li->appendChild(Widget::Anchor(__('Next →'), Administration::instance()->getCurrentPageURL() . '?pg=' . ($current_page + 1) . ($filter_querystring ? "&" . $filter_querystring : '')));
} else {
$li->setValue(__('Next →'));
}
$ul->appendChild($li);
// Last
$li = new XMLElement('li');
if ($current_page < $entries['total-pages']) {
$li->appendChild(Widget::Anchor(__('Last'), Administration::instance()->getCurrentPageURL() . '?pg=' . $entries['total-pages'] . ($filter_querystring ? "&" . $filter_querystring : '')));
} else {
$li->setValue(__('Last'));
}
$ul->appendChild($li);
$this->Contents->appendChild($ul);
}
}
示例14: __viewIndex
//.........这里部分代码省略.........
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_payer_email)) {
$col[] = Widget::TableData(General::sanitize($log_payer_email));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_address_street)) {
$col[] = Widget::TableData(General::sanitize($log_address_street));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_mc_currency)) {
$col[] = Widget::TableData(General::sanitize($log_mc_currency));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_tax)) {
$col[] = Widget::TableData(General::sanitize($log_tax));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_mc_gross)) {
$col[] = Widget::TableData(General::sanitize($log_mc_gross));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_mc_fee)) {
$col[] = Widget::TableData(General::sanitize($log_mc_fee));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_txn_type)) {
$col[] = Widget::TableData(General::sanitize($log_txn_type));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
if (!empty($log_txn_id)) {
$col[] = Widget::TableData(General::sanitize($log_txn_id));
} else {
$col[] = Widget::TableData('None', 'inactive');
}
$tr = Widget::TableRow($col);
if ($log_payment_status == 'Denied') {
$tr->setAttribute('class', 'denied');
}
$tb[] = $tr;
}
}
$table = Widget::Table(Widget::TableHead($th), NULL, Widget::TableBody($tb), 'selectable');
$this->Form->appendChild($table);
$actions = new XMLElement('div');
$actions->setAttribute('class', 'actions');
$options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
$actions->appendChild(Widget::Apply($options));
$this->Form->appendChild($actions);
# Pagination:
if ($pages > 1) {
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'page');
## First
$li = new XMLElement('li');
if ($page > 1) {
$li->appendChild(Widget::Anchor('First', Administration::instance()->getCurrentPageURL() . '?pg=1'));
} else {
$li->setValue('First');
}
$ul->appendChild($li);
## Previous
$li = new XMLElement('li');
if ($page > 1) {
$li->appendChild(Widget::Anchor('← Previous', Administration::instance()->getCurrentPageURL() . '?pg=' . ($page - 1)));
} else {
$li->setValue('← Previous');
}
$ul->appendChild($li);
## Summary
$li = new XMLElement('li', 'Page ' . $page . ' of ' . max($page, $pages));
$li->setAttribute('title', 'Viewing ' . $start . ' - ' . $end . ' of ' . $total . ' entries');
$ul->appendChild($li);
## Next
$li = new XMLElement('li');
if ($page < $pages) {
$li->appendChild(Widget::Anchor('Next →', Administration::instance()->getCurrentPageURL() . '?pg=' . ($page + 1)));
} else {
$li->setValue('Next →');
}
$ul->appendChild($li);
## Last
$li = new XMLElement('li');
if ($page < $pages) {
$li->appendChild(Widget::Anchor('Last', Administration::instance()->getCurrentPageURL() . '?pg=' . $pages));
} else {
$li->setValue('Last');
}
$ul->appendChild($li);
$this->Form->appendChild($ul);
}
}
示例15: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('Symphony') . ' – ' . __('XML Importers'));
$this->appendSubheading(__('XML Importers'), Widget::Anchor(__('Create New'), "{$this->_uri}/importers/new/", __('Create a new XML Importer'), 'create button'));
$tableHead = array();
$tableBody = array();
// Columns, with sorting:
foreach ($this->_table_columns as $column => $values) {
if ($values[1]) {
if ($column == $this->_table_column) {
if ($this->_table_direction == 'desc') {
$direction = 'asc';
$label = 'ascending';
} else {
$direction = 'desc';
$label = 'descending';
}
} else {
$direction = 'asc';
$label = 'ascending';
}
$link = $this->generateLink(array('sort' => $column, 'order' => $direction));
$anchor = Widget::Anchor($values[0], $link, __("Sort by {$label} " . strtolower($values[0])));
if ($column == $this->_table_column) {
$anchor->setAttribute('class', 'active');
}
$tableHead[] = array($anchor, 'col');
} else {
$tableHead[] = array($values[0], 'col');
}
}
if (!is_array($this->_importers) or empty($this->_importers)) {
$tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
} else {
foreach ($this->_importers as $importer) {
$col_name = Widget::TableData(Widget::Anchor($importer['about']['name'], "{$this->_uri}/importers/edit/{$importer['about']['handle']}/"));
$col_name->appendChild(Widget::Input("items[{$importer['about']['handle']}]", null, 'checkbox'));
$col_date = Widget::TableData(DateTimeObj::get(__SYM_DATETIME_FORMAT__, strtotime($importer['about']['updated'])));
if (!empty($importer['source'])) {
$col_url = Widget::TableData(General::sanitize($importer['source']));
} else {
$col_url = Widget::TableData(__('None'), 'inactive');
}
if (!empty($importer['included-elements'])) {
$col_elements = Widget::TableData(General::sanitize($importer['included-elements']));
} else {
$col_elements = Widget::TableData(__('None'), 'inactive');
}
if (isset($importer['about']['email'])) {
$col_author = Widget::TableData(Widget::Anchor($importer['about']['author']['name'], 'mailto:' . $importer['about']['author']['email']));
} else {
if (isset($importer['about']['author']['name'])) {
$col_author = Widget::TableData($importer['about']['author']['name']);
} else {
$col_author = Widget::TableData(__('None'), 'inactive');
}
}
$tableBody[] = Widget::TableRow(array($col_name, $col_url, $col_elements, $col_date, $col_author), null);
}
}
$table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
$this->Form->appendChild($table);
$actions = new XMLElement('div');
$actions->setAttribute('class', 'actions');
$options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm'), array('run', false, __('Run')));
$actions->appendChild(Widget::Apply($options));
$this->Form->appendChild($actions);
// Pagination:
if ($this->_pagination->pages > 1) {
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'page');
// First:
$li = new XMLElement('li');
$li->setValue(__('First'));
if ($this->_pagination->page > 1) {
$li->setValue(Widget::Anchor(__('First'), $this->generateLink(array('pg' => 1)))->generate());
}
$ul->appendChild($li);
// Previous:
$li = new XMLElement('li');
$li->setValue(__('← Previous'));
if ($this->_pagination->page > 1) {
$li->setValue(Widget::Anchor(__('← Previous'), $this->generateLink(array('pg' => $this->_pagination->page - 1)))->generate());
}
$ul->appendChild($li);
// Summary:
$li = new XMLElement('li', __('Page %s of %s', array($this->_pagination->page, max($this->_pagination->page, $this->_pagination->pages))));
$li->setAttribute('title', __('Viewing %s - %s of %s entries', array($this->_pagination->start, $this->_pagination->end, $this->_pagination->total)));
$ul->appendChild($li);
// Next:
$li = new XMLElement('li');
$li->setValue(__('Next →'));
if ($this->_pagination->page < $this->_pagination->pages) {
$li->setValue(Widget::Anchor(__('Next →'), $this->generateLink(array('pg' => $this->_pagination->page + 1)))->generate());
}
$ul->appendChild($li);
// Last:
$li = new XMLElement('li');
$li->setValue(__('Last'));
//.........这里部分代码省略.........