本文整理汇总了PHP中EventManager::listAll方法的典型用法代码示例。如果您正苦于以下问题:PHP EventManager::listAll方法的具体用法?PHP EventManager::listAll怎么用?PHP EventManager::listAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventManager
的用法示例。
在下文中一共展示了EventManager::listAll方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __viewIndexEventNames
public function __viewIndexEventNames($context)
{
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
$options = array();
foreach ($events as $event) {
$selected = $this->_driver->isEventNameSelected($event['handle']);
$options[] = array($event['handle'], $selected, $event['name']);
}
$section = Widget::Label('Selected');
$section->appendChild(Widget::Select('settings[event-names][]', $options, array('multiple' => 'multiple')));
$context->appendChild($section);
}
示例2: __viewIndexEventNames
public function __viewIndexEventNames($context)
{
$events = EventManager::listAll();
$options = array();
foreach ($events as $event) {
$selected = $this->driver->isEventNameSelected($event['handle']);
$options[] = array($event['handle'], $selected, $event['name']);
}
$section = Widget::Label(__('Selected'));
$section->setAttribute('class', 'column');
$section->appendChild(Widget::Select('settings[event-names][]', $options, array('multiple' => 'multiple')));
$context->appendChild($section);
}
示例3: view
function view()
{
$this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
$formHasErrors = is_array($this->_errors) && !empty($this->_errors);
if ($formHasErrors) {
$this->pageAlert('An error occurred while processing this form. <a href="#error">See below for details.</a>', AdministrationPage::PAGE_ALERT_ERROR);
}
$this->setPageType('form');
$this->appendSubheading('Untitled');
$fields = array();
if (isset($_POST['fields'])) {
$fields = $_POST['fields'];
}
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', 'Essentials'));
$label = Widget::Label('Name');
$label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
if (isset($this->_errors['name'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
if (is_array($events) && !empty($events)) {
foreach ($events as $handle => $e) {
if (!$e['can_parse']) {
unset($events[$handle]);
}
}
}
if (is_array($events) && !empty($events)) {
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', 'Event Level Permissions'));
$aTableHead = array(array('Event', 'col'), array('Add', 'col'), array('Edit', 'col'), array('Delete', 'col'));
$aTableBody = array();
foreach ($events as $event_handle => $event) {
$permissions = $fields['permissions'][$event_handle];
## Setup each cell
$td1 = Widget::TableData($event['name']);
$td2 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][add]', 'yes', 'checkbox', isset($permissions['add']) ? array('checked' => 'checked') : NULL));
$td3 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][edit]', 'yes', 'checkbox', isset($permissions['edit']) ? array('checked' => 'checked') : NULL));
$td4 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][delete]', 'yes', 'checkbox', isset($permissions['delete']) ? array('checked' => 'checked') : NULL));
## Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4));
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'role-permissions');
$fieldset->appendChild($table);
$this->Form->appendChild($fieldset);
}
####
# Delegate: MemberRolePermissionFieldsetsNew
# Description: Add custom fieldsets to the role page
$ExtensionManager = new ExtensionManager($this->_Parent);
$ExtensionManager->notifyMembers('MemberRolePermissionFieldsetsNew', '/extension/members/new/', array('form' => &$this->Form, 'permissions' => $fields['permissions']));
#####
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', 'Page Level Permissions'));
$pages = $this->_Parent->Database->fetch("SELECT * FROM `tbl_pages` " . ($this->_context[0] == 'edit' ? "WHERE `id` != '{$page_id}' " : '') . "ORDER BY `title` ASC");
$label = Widget::Label('Allow Access');
$options = array();
if (is_array($pages) && !empty($pages)) {
foreach ($pages as $page) {
$options[] = array($page['id'], in_array($page['id'], $fields['page_access']), '/' . $this->_Parent->resolvePagePath($page['id']));
//$page['title']);
}
}
$label->appendChild(Widget::Select('fields[page_access][]', $options, array('multiple' => 'multiple')));
$fieldset->appendChild($label);
$this->Form->appendChild($fieldset);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', 'Email Template'));
$fieldset->appendChild(new XMLElement('p', 'When adding a member, they will receive an email based on the template you specify. <br /><br />Leave everything blank if you do not wish for new members in this group to receive an email.', array('class' => 'help')));
$label = Widget::Label('Subject');
$label->appendChild(Widget::Input('fields[email_subject]', General::sanitize($fields['email_subject'])));
if (isset($this->_errors['email_subject'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['email_subject']));
} else {
$fieldset->appendChild($label);
}
$label = Widget::Label('Body');
$label->appendChild(Widget::Textarea('fields[email_body]', '25', '50', General::sanitize($fields['email_body'])));
$fieldset->appendChild(isset($this->_errors['email_body']) ? $this->wrapFormElementWithError($label, $this->_errors['email_body']) : $label);
$fieldset->appendChild(new XMLElement('p', 'You can add dynamic elements to the email by using <code>{$field-name}</code> syntax, where <code>field-name</code> corresponds to the fields of the new member.', array('class' => 'help')));
$this->Form->appendChild($fieldset);
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', 'Create', 'submit', array('accesskey' => 's')));
$this->Form->appendChild($div);
}
示例4: __viewEdit
//.........这里部分代码省略.........
$label = Widget::Label(__('Title'));
$label->appendChild(Widget::Input('fields[title]', General::sanitize($fields['title'])));
if (isset($this->_errors['title'])) {
$label = $this->wrapFormElementWithError($label, $this->_errors['title']);
}
$fieldset->appendChild($label);
// Handle -------------------------------------------------------------
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$column = new XMLElement('div');
$label = Widget::Label(__('URL Handle'));
$label->appendChild(Widget::Input('fields[handle]', $fields['handle']));
if (isset($this->_errors['handle'])) {
$label = $this->wrapFormElementWithError($label, $this->_errors['handle']);
}
$column->appendChild($label);
// Parent ---------------------------------------------------------
$label = Widget::Label(__('Parent Page'));
$pages = $this->_Parent->Database->fetch("\n\t\t\t\tSELECT\n\t\t\t\t\tp.*\n\t\t\t\tFROM\n\t\t\t\t\t`tbl_pages` AS p\n\t\t\t\tWHERE\n\t\t\t\t\tp.id != '{$page_id}'\n\t\t\t\tORDER BY\n\t\t\t\t\tp.title ASC\n\t\t\t");
$options = array(array('', false, '/'));
if (is_array($pages) && !empty($pages)) {
if (!function_exists('__compare_pages')) {
function __compare_pages($a, $b)
{
return strnatcasecmp($a[2], $b[2]);
}
}
foreach ($pages as $page) {
$options[] = array($page['id'], $fields['parent'] == $page['id'], '/' . $this->_Parent->resolvePagePath($page['id']));
}
usort($options, '__compare_pages');
}
$label->appendChild(Widget::Select('fields[parent]', $options));
$column->appendChild($label);
$group->appendChild($column);
// Parameters ---------------------------------------------------------
$column = new XMLElement('div');
$label = Widget::Label(__('URL Parameters'));
$label->appendChild(Widget::Input('fields[params]', $fields['params']));
$column->appendChild($label);
// Type -----------------------------------------------------------
$label = Widget::Label(__('Page Type'));
$label->appendChild(Widget::Input('fields[type]', $fields['type']));
if (isset($this->_errors['type'])) {
$label = $this->wrapFormElementWithError($label, $this->_errors['type']);
}
$column->appendChild($label);
$tags = new XMLElement('ul');
$tags->setAttribute('class', 'tags');
if ($types = $this->__fetchAvailablePageTypes()) {
foreach ($types as $type) {
$tags->appendChild(new XMLElement('li', $type));
}
}
$column->appendChild($tags);
$group->appendChild($column);
$fieldset->appendChild($group);
$this->Form->appendChild($fieldset);
// Events -------------------------------------------------------------
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Page Resources')));
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$label = Widget::Label(__('Events'));
$manager = new EventManager($this->_Parent);
$events = $manager->listAll();
$options = array();
if (is_array($events) && !empty($events)) {
foreach ($events as $name => $about) {
$options[] = array($name, @in_array($name, $fields['events']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
// Data Sources -------------------------------------------------------
$label = Widget::Label(__('Data Sources'));
$manager = new DatasourceManager($this->_Parent);
$datasources = $manager->listAll();
$options = array();
if (is_array($datasources) && !empty($datasources)) {
foreach ($datasources as $name => $about) {
$options[] = array($name, @in_array($name, $fields['data_sources']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[data_sources][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$fieldset->appendChild($group);
$this->Form->appendChild($fieldset);
// Controls -----------------------------------------------------------
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create Page'), 'submit', array('accesskey' => 's')));
if ($this->_context[0] == 'edit') {
$button = new XMLElement('button', __('Delete'));
$button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this page')));
$div->appendChild($button);
}
$this->Form->appendChild($div);
}
示例5: switch
}
if (isset($_GET['_f'])) {
switch ($_GET['_f']) {
case "saved":
$Admin->pageAlert("saved-time", array("Master", date("h:i:sa", $date->get(true, false))));
break;
}
}
if (!empty($_POST)) {
$fields = $_POST['fields'];
}
$fields['body'] = General::sanitize($fields['body']);
$DSM = new DatasourceManager(array('parent' => &$Admin));
$datasources = $DSM->listAll();
$EM = new EventManager(array('parent' => &$Admin));
$events = $EM->listAll();
?>
<form action="<?php
print $Admin->getCurrentPageURL();
?>
&file=<?php
print $_REQUEST['file'];
?>
" method="post">
<h2><?php
print $_REQUEST['file'];
?>
<a class="button configure" href="#config" title="Configure master settings">Configure</a></h2>
<fieldset>
<fieldset>
示例6: view
function view()
{
$this->appendSubheading(__('Components'));
$utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
$utilities = $utilities['filelist'];
$ul = new XMLElement('ul');
$ul->setAttribute('id', 'components');
$ul->setAttribute('class', 'triple group');
### EVENTS ###
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
$li = new XMLElement('li');
$h3 = new XMLElement('h3', __('Events'));
$h3->appendChild(Widget::Anchor(__('Create New'), URL . '/symphony/blueprints/events/new/', __('Create a new event'), 'create button'));
$li->appendChild($h3);
$list = new XMLElement('ul');
$list->setSelfClosingTag(false);
if (is_array($events) && !empty($events)) {
foreach ($events as $e) {
$item = new XMLElement('li');
$item->appendChild(Widget::Anchor($e['name'], URL . '/symphony/blueprints/events/' . ($e['can_parse'] ? 'edit' : 'info') . '/' . strtolower($e['handle']) . '/', 'event.' . $e['handle'] . '.php'));
$item->setAttribute('class', 'external');
$list->appendChild($item);
}
}
$li->appendChild($list);
$ul->appendChild($li);
######
### DATASOURCES ###
$DSManager = new DatasourceManager($this->_Parent);
$datasources = $DSManager->listAll();
$li = new XMLElement('li');
$h3 = new XMLElement('h3', __('Data Sources'));
$h3->appendChild(Widget::Anchor(__('Create New'), URL . '/symphony/blueprints/datasources/new/', __('Create a new data source'), 'create button'));
$li->appendChild($h3);
$list = new XMLElement('ul');
$list->setSelfClosingTag(false);
if (is_array($datasources) && !empty($datasources)) {
foreach ($datasources as $ds) {
$item = new XMLElement('li');
if ($ds['can_parse']) {
$item->appendChild(Widget::Anchor($ds['name'], URL . '/symphony/blueprints/datasources/edit/' . strtolower($ds['handle']) . '/', 'data.' . $ds['handle'] . '.php'));
} else {
$item->appendChild(Widget::Anchor($ds['name'], URL . '/symphony/blueprints/datasources/info/' . strtolower($ds['handle']) . '/', 'data.' . $ds['handle'] . '.php'));
}
$list->appendChild($item);
}
}
$li->appendChild($list);
$ul->appendChild($li);
######
### UTILITIES ###
$li = new XMLElement('li');
$h3 = new XMLElement('h3', __('Utilities'));
$h3->appendChild(Widget::Anchor(__('Create New'), URL . '/symphony/blueprints/utilities/new/', __('Create a new utility'), 'create button'));
$li->appendChild($h3);
$list = new XMLElement('ul');
$list->setSelfClosingTag(false);
if (is_array($utilities) && !empty($utilities)) {
foreach ($utilities as $u) {
$item = new XMLElement('li');
$item->appendChild(Widget::Anchor($u, URL . '/symphony/blueprints/utilities/edit/' . str_replace('.xsl', '', $u) . '/'));
$list->appendChild($item);
}
}
$li->appendChild($list);
$ul->appendChild($li);
######
$this->Form->appendChild($ul);
}
示例7: __viewEdit
//.........这里部分代码省略.........
if (!function_exists('__compare_pages')) {
function __compare_pages($a, $b)
{
return strnatcasecmp($a[2], $b[2]);
}
}
foreach ($pages as $page) {
$options[] = array($page['id'], $fields['parent'] == $page['id'], '/' . Administration::instance()->resolvePagePath($page['id']));
}
usort($options, '__compare_pages');
}
$label->appendChild(Widget::Select('fields[parent]', $options));
$column->appendChild($label);
$group->appendChild($column);
// Parameters ---------------------------------------------------------
$column = new XMLElement('div');
$label = Widget::Label(__('URL Parameters'));
$label->appendChild(Widget::Input('fields[params]', $fields['params']));
$column->appendChild($label);
// Type -----------------------------------------------------------
$label = Widget::Label(__('Page Type'));
$label->appendChild(Widget::Input('fields[type]', $fields['type']));
if (isset($this->_errors['type'])) {
$label = $this->wrapFormElementWithError($label, $this->_errors['type']);
}
$column->appendChild($label);
$tags = new XMLElement('ul');
$tags->setAttribute('class', 'tags');
if ($types = $this->__fetchAvailablePageTypes()) {
foreach ($types as $type) {
$tags->appendChild(new XMLElement('li', $type));
}
}
$column->appendChild($tags);
$group->appendChild($column);
$fieldset->appendChild($group);
$this->Form->appendChild($fieldset);
// Events -------------------------------------------------------------
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Page Resources')));
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$label = Widget::Label(__('Events'));
$manager = new EventManager($this->_Parent);
$events = $manager->listAll();
$options = array();
if (is_array($events) && !empty($events)) {
if (!is_array($fields['events'])) {
$fields['events'] = array();
}
foreach ($events as $name => $about) {
$options[] = array($name, in_array($name, $fields['events']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
// Data Sources -------------------------------------------------------
$label = Widget::Label(__('Data Sources'));
$manager = new DatasourceManager($this->_Parent);
$datasources = $manager->listAll();
$options = array();
if (is_array($datasources) && !empty($datasources)) {
if (!is_array($fields['data_sources'])) {
$fields['data_sources'] = array();
}
foreach ($datasources as $name => $about) {
$options[] = array($name, in_array($name, $fields['data_sources']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[data_sources][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$fieldset->appendChild($group);
$this->Form->appendChild($fieldset);
// Controls -----------------------------------------------------------
/**
* After all Page related Fields have been added to the DOM, just before the
* actions.
*
* @delegate AppendPageContent
* @param string $context
* '/blueprints/pages/'
* @param XMLElement $form
* @param array $fields
* @param array $errors
*/
Symphony::ExtensionManager()->notifyMembers('AppendPageContent', '/blueprints/pages/', array('form' => &$this->Form, 'fields' => &$fields, 'errors' => $this->_errors));
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create Page'), 'submit', array('accesskey' => 's')));
if ($this->_context[0] == 'edit') {
$button = new XMLElement('button', __('Delete'));
$button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this page'), 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this page?')));
$div->appendChild($button);
}
$this->Form->appendChild($div);
if (isset($_REQUEST['parent']) && is_numeric($_REQUEST['parent'])) {
$this->Form->appendChild(new XMLElement('input', NULL, array('type' => 'hidden', 'name' => 'parent', 'value' => $_REQUEST['parent'])));
}
}
示例8: array
function __form()
{
$this->setPageType('form');
$fields = array();
if ($this->_context[0] == 'edit') {
if (!($page_id = $this->_context[1])) {
redirect(URL . '/symphony/blueprints/pages/');
}
if (!($existing = $this->_Parent->Database->fetchRow(0, "SELECT * FROM `tbl_pages` WHERE `id` = '{$page_id}' LIMIT 1"))) {
$this->_Parent->customError(E_USER_ERROR, __('Page not found'), __('The page you requested to edit does not exist.'), false, true, 'error', array('header' => 'HTTP/1.0 404 Not Found'));
}
}
if (isset($this->_context[2])) {
switch ($this->_context[2]) {
case 'saved':
$this->pageAlert(__('Page updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Pages</a>', array(DateTimeObj::get(__SYM_TIME_FORMAT__), URL . '/symphony/blueprints/pages/new/', URL . '/symphony/blueprints/pages/')), Alert::SUCCESS);
break;
case 'created':
$this->pageAlert(__('Page created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Pages</a>', array(DateTimeObj::get(__SYM_TIME_FORMAT__), URL . '/symphony/blueprints/pages/new/', URL . '/symphony/blueprints/pages/')), Alert::SUCCESS);
break;
}
}
if (isset($_POST['fields'])) {
$fields = $_POST['fields'];
} elseif ($this->_context[0] == 'edit') {
$fields = $existing;
$types = $this->_Parent->Database->fetchCol('type', "SELECT `type` FROM `tbl_pages_types` WHERE page_id = '{$page_id}' ORDER BY `type` ASC");
$fields['type'] = @implode(', ', $types);
$fields['data_sources'] = preg_split('/,/i', $fields['data_sources'], -1, PREG_SPLIT_NO_EMPTY);
$fields['events'] = preg_split('/,/i', $fields['events'], -1, PREG_SPLIT_NO_EMPTY);
$fields['body'] = @file_get_contents(PAGES . '/' . trim(str_replace('/', '_', $fields['path'] . '_' . $fields['handle']), '_') . ".xsl");
} else {
$fields['body'] = '<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
omit-xml-declaration="yes"
encoding="UTF-8"
indent="yes" />
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>';
}
$title = $this->_context[0] == 'edit' ? $fields['title'] : NULL;
if (trim($title) == '') {
$title = $existing['title'];
}
$this->setTitle(__($title ? '%1$s – %2$s – %3$s' : '%1$s – %2$s', array(__('Symphony'), __('Pages'), $title)));
$this->appendSubheading($title ? $title : __('Untitled'));
$div = new XMLElement('div');
$div->setAttribute('id', 'configure');
$div->appendChild(new XMLElement('h3', __('URL Settings')));
$group = new XMLElement('div');
$group->setAttribute('class', 'triple group');
$pages = $this->_Parent->Database->fetch("SELECT * FROM `tbl_pages` " . ($this->_context[0] == 'edit' ? "WHERE `id` != '{$page_id}' " : '') . "ORDER BY `title` ASC");
$label = Widget::Label(__('Parent Page'));
$options = array(array('', false, '/'));
if (is_array($pages) and !empty($pages)) {
if (!function_exists('__compare_pages')) {
function __compare_pages($a, $b)
{
return strnatcasecmp($a[2], $b[2]);
}
}
foreach ($pages as $page) {
$options[] = array($page['id'], $fields['parent'] == $page['id'], '/' . $this->_Parent->resolvePagePath($page['id']));
}
usort($options, '__compare_pages');
}
$label->appendChild(Widget::Select('fields[parent]', $options));
$group->appendChild($label);
$label = Widget::Label(__('URL Handle'));
$label->appendChild(Widget::Input('fields[handle]', $fields['handle']));
$group->appendChild(isset($this->_errors['handle']) ? $this->wrapFormElementWithError($label, $this->_errors['handle']) : $label);
$label = Widget::Label(__('URL Parameters'));
$label->appendChild(Widget::Input('fields[params]', $fields['params']));
$group->appendChild($label);
$div->appendChild($group);
$div->appendChild(new XMLElement('h3', __('Page Metadata')));
$group = new XMLElement('div');
$group->setAttribute('class', 'triple group');
$label = Widget::Label(__('Events'));
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
$options = array();
if (is_array($events) && !empty($events)) {
foreach ($events as $name => $about) {
$options[] = array($name, @in_array($name, $fields['events']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$label = Widget::Label(__('Data Sources'));
$DSManager = new DatasourceManager($this->_Parent);
//.........这里部分代码省略.........
示例9: view
function view()
{
if (!($role_id = $this->_context[0])) {
redirect(extension_members::baseURL());
}
if (!($existing = $this->_driver->fetchRole($role_id, true))) {
$this->_Parent->customError(E_USER_ERROR, 'Role not found', 'The role you requested to edit does not exist.', false, true, 'error', array('header' => 'HTTP/1.0 404 Not Found'));
}
if (isset($this->_context[1])) {
switch ($this->_context[1]) {
case 'saved':
$this->pageAlert(__('%1$s updated successfully. <a href="%2$s">Create another?</a>', array('Role', extension_members::baseURL() . 'new/')), Alert::SUCCESS);
break;
case 'created':
$this->pageAlert(__('%1$s created successfully. <a href="%2$s">Create another?</a>', array('Role', extension_members::baseURL() . 'new/')), Alert::SUCCESS);
break;
case 'moved':
$this->pageAlert('All members have been successfully moved to new role.', Alert::SUCCESS);
break;
}
}
$this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
$formHasErrors = is_array($this->_errors) && !empty($this->_errors);
if ($formHasErrors) {
$this->pageAlert('An error occurred while processing this form. <a href="#error">See below for details.</a>', AdministrationPage::PAGE_ALERT_ERROR);
}
$this->setPageType('form');
$this->setTitle('Symphony – Member Roles – ' . $existing->name());
$this->appendSubheading($existing->name());
$fields = array();
if (isset($_POST['fields'])) {
$fields = $_POST['fields'];
} else {
$fields['name'] = $existing->name();
$fields['permissions'] = $existing->eventPermissions();
$fields['page_access'] = $existing->forbiddenPages();
$fields['email_subject'] = $existing->email_subject();
$fields['email_body'] = $existing->email_body();
}
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', 'Essentials'));
$label = Widget::Label('Name');
$label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
if (isset($this->_errors['name'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
if (is_array($events) && !empty($events)) {
foreach ($events as $handle => $e) {
$show_in_role_permissions = method_exists("event{$handle}", 'showInRolePermissions') && call_user_func(array("event{$handle}", 'showInRolePermissions')) === true ? true : false;
if (!$e['can_parse'] && !$show_in_role_permissions) {
unset($events[$handle]);
}
}
}
if (is_array($events) && !empty($events)) {
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', 'Event Level Permissions'));
$aTableHead = array(array('Event', 'col'), array('Add', 'col'), array('Edit', 'col'), array('Edit Own *', 'col'), array('Delete', 'col'), array('Delete Own *', 'col'));
$aTableBody = array();
foreach ($events as $event_handle => $event) {
$permissions = $fields['permissions'][$event_handle];
## Setup each cell
$td1 = Widget::TableData($event['name']);
$td2 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][add]', 'yes', 'checkbox', isset($permissions['add']) ? array('checked' => 'checked') : NULL));
$td3 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][edit]', 'yes', 'checkbox', isset($permissions['edit']) ? array('checked' => 'checked') : NULL));
$td4 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][edit_own]', 'yes', 'checkbox', isset($permissions['edit_own']) ? array('checked' => 'checked') : NULL));
$td5 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][delete]', 'yes', 'checkbox', isset($permissions['delete']) ? array('checked' => 'checked') : NULL));
$td6 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][delete_own]', 'yes', 'checkbox', isset($permissions['delete_own']) ? array('checked' => 'checked') : NULL));
## Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5, $td6));
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'role-permissions');
$fieldset->appendChild($table);
$fieldset->appendChild(new XMLElement('p', '* <em>Does not apply if global edit/delete is allowed</em>', array('class' => 'help')));
$this->Form->appendChild($fieldset);
}
####
# Delegate: MemberRolePermissionFieldsetsEdit
# Description: Add custom fieldsets to the role page
$ExtensionManager = new ExtensionManager($this->_Parent);
$ExtensionManager->notifyMembers('MemberRolePermissionFieldsetsEdit', '/extension/members/edit/', array('form' => &$this->Form, 'permissions' => $fields['permissions']));
#####
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', 'Page Level Permissions'));
$pages = $this->_Parent->Database->fetch("SELECT * FROM `tbl_pages` " . ($this->_context[0] == 'edit' ? "WHERE `id` != '{$page_id}' " : '') . "ORDER BY `title` ASC");
$label = Widget::Label('Deny Access');
$options = array();
if (is_array($pages) && !empty($pages)) {
foreach ($pages as $page) {
$options[] = array($page['id'], in_array($page['id'], $fields['page_access']), '/' . $this->_Parent->resolvePagePath($page['id']));
//$page['title']);
}
//.........这里部分代码省略.........
示例10: render_panel
//.........这里部分代码省略.........
}
} else {
$xml = $data['data'];
}
if (!$xml) {
$xml = '<error>' . __('Error: could not retrieve panel XML feed.') . '</error>';
}
require_once TOOLKIT . '/class.xsltprocess.php';
$proc = new XsltProcess();
$data = $proc->process($xml, file_get_contents(EXTENSIONS . '/dashboard/lib/rss-reader.xsl'), array('show' => $config['show']));
$context['panel']->appendChild(new XMLElement('div', $data));
break;
case 'html_block':
require_once TOOLKIT . '/class.gateway.php';
require_once CORE . '/class.cacheable.php';
$cache_id = md5('html_block_' . $config['url']);
$cache = new Cacheable(Administration::instance()->Database());
$data = $cache->check($cache_id);
if (!$data) {
$ch = new Gateway();
$ch->init();
$ch->setopt('URL', $config['url']);
$ch->setopt('TIMEOUT', 6);
$new_data = $ch->exec();
$writeToCache = true;
if ((int) $config['cache'] > 0) {
$cache->write($cache_id, $new_data, $config['cache']);
}
$html = $new_data;
if (empty($html) && $data) {
$html = $data['data'];
}
} else {
$html = $data['data'];
}
if (!$html) {
$html = '<p class="invalid">' . __('Error: could not retrieve panel HTML.') . '</p>';
}
$context['panel']->appendChild(new XMLElement('div', $html));
break;
case 'symphony_overview':
$container = new XMLElement('div');
$dl = new XMLElement('dl');
$dl->appendChild(new XMLElement('dt', __('Website Name')));
$dl->appendChild(new XMLElement('dd', Symphony::Configuration()->get('sitename', 'general')));
$current_version = Symphony::Configuration()->get('version', 'symphony');
require_once TOOLKIT . '/class.gateway.php';
$ch = new Gateway();
$ch->init();
$ch->setopt('URL', 'https://api.github.com/repos/symphonycms/symphony-2/tags');
$ch->setopt('TIMEOUT', $timeout);
$repo_tags = $ch->exec();
// tags request found
if (is_array($repo_tags)) {
$repo_tags = json_decode($repo_tags);
$tags = array();
foreach ($repo_tags as $tag) {
// remove tags that contain strings
if (preg_match('/[a-zA]/i', $tag->name)) {
continue;
}
$tags[] = $tag->name;
}
natsort($tags);
rsort($tags);
$latest_version = reset($tags);
} else {
$latest_version = $current_version;
}
$needs_update = version_compare($latest_version, $current_version, '>');
$dl->appendChild(new XMLElement('dt', __('Version')));
$dl->appendChild(new XMLElement('dd', $current_version . ($needs_update ? ' (<a href="http://getsymphony.com/download/releases/version/' . $latest_version . '/">' . __('Latest is %s', array($latest_version)) . "</a>)" : '')));
$container->appendChild(new XMLElement('h4', __('Configuration')));
$container->appendChild($dl);
$entries = 0;
foreach (SectionManager::fetch() as $section) {
$entries += EntryManager::fetchCount($section->get('id'));
}
$dl = new XMLElement('dl');
$dl->appendChild(new XMLElement('dt', __('Sections')));
$dl->appendChild(new XMLElement('dd', (string) count(SectionManager::fetch())));
$dl->appendChild(new XMLElement('dt', __('Entries')));
$dl->appendChild(new XMLElement('dd', (string) $entries));
$dl->appendChild(new XMLElement('dt', __('Data Sources')));
$dl->appendChild(new XMLElement('dd', (string) count(DatasourceManager::listAll())));
$dl->appendChild(new XMLElement('dt', __('Events')));
$dl->appendChild(new XMLElement('dd', (string) count(EventManager::listAll())));
$dl->appendChild(new XMLElement('dt', __('Pages')));
$dl->appendChild(new XMLElement('dd', (string) count(PageManager::fetch())));
$container->appendChild(new XMLElement('h4', __('Statistics')));
$container->appendChild($dl);
$context['panel']->appendChild($container);
break;
case 'markdown_text':
$formatter = TextformatterManager::create($config['formatter']);
$html = $formatter->run($config['text']);
$context['panel']->appendChild(new XMLElement('div', $html));
break;
}
}
示例11: view
public function view()
{
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9125341);
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/jquery-ui.css', 'screen', 9125342);
Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/jquery-ui.js', 9126342);
Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/members.js', 9126343);
$formHasErrors = is_array($this->_errors) && !empty($this->_errors);
if ($formHasErrors) {
$this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), AdministrationPage::PAGE_ALERT_ERROR);
}
$this->setPageType('form');
$this->appendSubheading(__('Untitled'));
$fields = array();
if (isset($_POST['fields'])) {
$fields = $_POST['fields'];
}
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', __('Essentials')));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
if (isset($this->_errors['name'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
if (is_array($events) && !empty($events)) {
foreach ($events as $handle => $e) {
$show_in_role_permissions = method_exists("event{$handle}", 'showInRolePermissions') && call_user_func(array("event{$handle}", 'showInRolePermissions')) === true ? true : false;
if (!$e['can_parse'] && !$show_in_role_permissions) {
unset($events[$handle]);
}
}
}
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', __('Event Level Permissions')));
$aTableHead = array(array(__('Event'), 'col'), array(__('Create'), 'col'), array(__('Edit'), 'col'));
$aTableBody = array();
/*
<tr class="global">
<td>Set Global Permissions</td>
<td class="add">
<input type="checkbox" name="add-global" value="no"/>
</td>
<td class="edit">
<p class="global-slider"></p>
<span>n/a</span>
</td>
<!--<td class="delete">
<p class="global-slider"></p>
<span>n/a</span>
</td>-->
</tr>
*/
## Setup each cell
$td1 = Widget::TableData(__('Global Permissions'));
$td2 = Widget::TableData(Widget::Input('global-add', '1', 'checkbox'), 'add');
$td3 = Widget::TableData(NULL, 'edit');
$td3->appendChild(new XMLElement('p', NULL, array('class' => 'global-slider')));
$td3->appendChild(new XMLElement('span', 'n/a'));
$td4 = Widget::TableData(NULL, 'delete');
$td4->appendChild(new XMLElement('p', NULL, array('class' => 'global-slider')));
$td4->appendChild(new XMLElement('span', 'n/a'));
## Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), 'global');
//, $td4
if (is_array($events) && !empty($events)) {
foreach ($events as $event_handle => $event) {
$permissions = $fields['permissions'][$event_handle];
## Setup each cell
$td1 = Widget::TableData($event['name']);
$td2 = Widget::TableData(Widget::Input("fields[permissions][{$event_handle}][create]", '1', 'checkbox', $permissions['create'] == 1 ? array('checked' => 'checked') : NULL), 'add');
$td3 = Widget::TableData(NULL, 'edit');
$td3->appendChild(new XMLElement('p', NULL, array('class' => 'slider')));
$span = new XMLElement('span');
$span->setSelfClosingTag(false);
$td3->appendChild($span);
$td3->appendChild(Widget::Input('fields[permissions][' . $event_handle . '][edit]', isset($permissions['edit']) ? $permissions['edit'] : '0', 'hidden'));
$td4 = Widget::TableData(NULL, 'delete');
$td4->appendChild(new XMLElement('p', NULL, array('class' => 'slider')));
$span = new XMLElement('span');
$span->setSelfClosingTag(false);
$td4->appendChild($span);
$td4->appendChild(Widget::Input('fields[permissions][' . $event_handle . '][delete]', isset($permissions['delete']) ? $permissions['delete'] : '0', 'hidden'));
/*
<tr>
<td>{EVENT-NAME}</td>
<td class="add">
<input type="checkbox" name="{ANY NAME}" value="{EXISTING STATE:No}"/>
</td>
<td class="edit">
<p class="slider"></p>
<span></span>
<input type="hidden" name="{ANY NAME}" value="{EXISTING-VALUE:1}"/>
</td>
<!--<td class="delete">
//.........这里部分代码省略.........
示例12: __viewEdit
public function __viewEdit()
{
$isNew = true;
$time = Widget::Time();
// Verify role exists
if ($this->_context[0] == 'edit') {
$isNew = false;
if (!($role_id = $this->_context[1])) {
redirect(extension_Members::baseURL() . 'roles/');
}
if (!($existing = RoleManager::fetch($role_id))) {
throw new SymphonyErrorPage(__('The role you requested to edit does not exist.'), __('Role not found'));
}
}
// Add in custom assets
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/members.roles.css', 'screen', 101);
Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/members.roles.js', 104);
// Append any Page Alerts from the form's
if (isset($this->_context[2])) {
switch ($this->_context[2]) {
case 'saved':
$this->pageAlert(__('Role updated at %s.', array($time->generate())) . ' <a href="' . extension_members::baseURL() . 'roles/new/" accesskey="c">' . __('Create another?') . '</a> <a href="' . extension_members::baseURL() . 'roles/" accesskey="a">' . __('View all Roles') . '</a>', Alert::SUCCESS);
break;
case 'created':
$this->pageAlert(__('Role created at %s.', array($time->generate())) . ' <a href="' . extension_members::baseURL() . 'roles/new/" accesskey="c">' . __('Create another?') . '</a> <a href="' . extension_members::baseURL() . 'roles/" accesskey="a">' . __('View all Roles') . '</a>', Alert::SUCCESS);
break;
}
}
// Has the form got any errors?
$formHasErrors = is_array($this->_errors) && !empty($this->_errors);
if ($formHasErrors) {
$this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR);
}
$this->setPageType('form');
if ($isNew) {
$this->setTitle(__('Symphony – Member Roles'));
$this->appendSubheading(__('Untitled'));
$fields = array('name' => null, 'permissions' => null, 'page_access' => null);
} else {
$this->setTitle(__('Symphony – Member Roles – ') . $existing->get('name'));
$this->appendSubheading($existing->get('name'));
if (isset($_POST['fields'])) {
$fields = $_POST['fields'];
} else {
$fields = array('name' => $existing->get('name'), 'permissions' => $existing->get('event_permissions'), 'page_access' => $existing->get('forbidden_pages'));
}
}
$this->insertBreadcrumbs(array(Widget::Anchor(__('Member Roles'), extension_members::baseURL() . 'roles/')));
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', __('Essentials')));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
if (isset($this->_errors['name'])) {
$fieldset->appendChild(Widget::Error($label, $this->_errors['name']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
$events = EventManager::listAll();
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', __('Event Level Permissions')));
$aTableBody = array();
if (is_array($events) && !empty($events)) {
foreach ($events as $event_handle => $event) {
$permissions = $fields['permissions'][$event_handle];
$td_name = Widget::TableData($event['name'], 'name');
$td_permission_create = Widget::TableData(sprintf('<label title="%s">%s <span>%s</span></label>', __('User can create new entries'), Widget::Input("fields[permissions][{$event_handle}][create]", (string) EventPermissions::CREATE, 'checkbox', $permissions['create'] == EventPermissions::CREATE ? array('checked' => 'checked') : NULL)->generate(), 'Create'), 'create');
$td_permission_none = Widget::TableData(sprintf('<label title="%s">%s <span>%s</span></label>', __('User cannot edit existing entries'), Widget::Input("fields[permissions][{$event_handle}][edit]", (string) EventPermissions::NO_PERMISSIONS, 'radio', $permissions['edit'] == EventPermissions::NO_PERMISSIONS ? array('checked' => 'checked') : NULL)->generate(), 'None'));
$td_permission_own = Widget::TableData(sprintf('<label title="%s">%s <span>%s</span></label>', __('User can edit their own entries only'), Widget::Input("fields[permissions][{$event_handle}][edit]", (string) EventPermissions::OWN_ENTRIES, 'radio', $permissions['edit'] == EventPermissions::OWN_ENTRIES ? array('checked' => 'checked') : NULL)->generate(), 'Own'));
$td_permission_all = Widget::TableData(sprintf('<label title="%s">%s <span>%s</span></label>', __('User can edit all entries'), Widget::Input("fields[permissions][{$event_handle}][edit]", (string) EventPermissions::ALL_ENTRIES, 'radio', $permissions['edit'] == EventPermissions::ALL_ENTRIES ? array('checked' => 'checked') : NULL)->generate(), 'All'));
// Create an Event instance
$ev = EventManager::create($event_handle, array());
$aTableBody[] = Widget::TableRow(array($td_name, $td_permission_create, $td_permission_none, $td_permission_own, $td_permission_all), method_exists($ev, 'ignoreRolePermissions') && $ev->ignoreRolePermissions() == true ? 'inactive' : '');
unset($ev);
}
}
$thead = Widget::TableHead(array(array(__('Event'), 'col', array('class' => 'name')), array(__('Create New'), 'col', array('class' => 'new', 'title' => __('Toggle all'))), array(__('No Edit'), 'col', array('class' => 'edit', 'title' => __('Toggle all'))), array(__('Edit Own'), 'col', array('class' => 'edit', 'title' => __('Toggle all'))), array(__('Edit All'), 'col', array('class' => 'edit', 'title' => __('Toggle all')))));
$table = Widget::Table($thead, NULL, Widget::TableBody($aTableBody), 'role-permissions');
$fieldset->appendChild($table);
$this->Form->appendChild($fieldset);
// Add Page Permissions [simple Deny/Allow]
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', __('Page Level Permissions')));
$label = Widget::Label(__('Deny Access'));
if (!is_array($fields['page_access'])) {
$fields['page_access'] = array();
}
$options = array();
$pages = PageManager::fetch(false, array('id'));
if (!empty($pages)) {
foreach ($pages as $page) {
$options[] = array($page['id'], in_array($page['id'], $fields['page_access']), '/' . PageManager::resolvePagePath($page['id']));
}
}
$label->appendChild(Widget::Select('fields[page_access][]', $options, array('multiple' => 'multiple')));
$fieldset->appendChild($label);
$this->Form->appendChild($fieldset);
//.........这里部分代码省略.........
示例13: view
function view()
{
$this->setPageType('form');
$this->addStylesheetToHead(URL . '/extensions/pages_editor_minimal/assets/screen.css', 'screen', 1200);
$fields = array();
if (!($page_id = $this->_context[0])) {
redirect(URL . '/symphony/blueprints/pages/');
}
if (!($existing = $this->_Parent->Database->fetchRow(0, "SELECT * FROM `tbl_pages` WHERE `id` = '{$page_id}' LIMIT 1"))) {
$this->_Parent->customError(E_USER_ERROR, __('Page not found'), __('The page you requested to edit does not exist.'), false, true, 'error', array('header' => 'HTTP/1.0 404 Not Found'));
}
if (isset($this->_context[1])) {
switch ($this->_context[1]) {
case 'saved':
$this->pageAlert(__('Page updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Pages</a>', array(DateTimeObj::get(__SYM_TIME_FORMAT__), URL . '/symphony/blueprints/pages/new/', URL . '/symphony/blueprints/pages/')), Alert::SUCCESS);
break;
case 'created':
$this->pageAlert(__('Page created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Pages</a>', array(DateTimeObj::get(__SYM_TIME_FORMAT__), URL . '/symphony/blueprints/pages/new/', URL . '/symphony/blueprints/pages/')), Alert::SUCCESS);
break;
}
}
if (isset($_POST['fields'])) {
$fields = $_POST['fields'];
} else {
$fields = $existing;
$types = $this->_Parent->Database->fetchCol('type', "SELECT `type` FROM `tbl_pages_types` WHERE page_id = '{$page_id}' ORDER BY `type` ASC");
$fields['type'] = @implode(', ', $types);
$fields['data_sources'] = preg_split('/,/i', $fields['data_sources'], -1, PREG_SPLIT_NO_EMPTY);
$fields['events'] = preg_split('/,/i', $fields['events'], -1, PREG_SPLIT_NO_EMPTY);
$fields['body'] = @file_get_contents(PAGES . '/' . trim(str_replace('/', '_', $fields['path'] . '_' . $fields['handle']), '_') . ".xsl");
}
$title = $fields['title'];
if (trim($title) == '') {
$title = $existing['title'];
}
$this->setTitle(__($title ? '%1$s – %2$s – %3$s' : '%1$s – %2$s', array(__('Symphony'), __('Pages'), $title)));
# $this->appendSubheading(($title ? $title : __('Untitled')));
$label = Widget::Label(__('Title'));
$label->appendChild(Widget::Input('fields[title]', General::sanitize($fields['title'])));
$this->Form->appendChild(isset($this->_errors['title']) ? $this->wrapFormElementWithError($label, $this->_errors['title']) : $label);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'primary');
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$label = Widget::Label(__('Events'));
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
$options = array();
if (is_array($events) && !empty($events)) {
foreach ($events as $name => $about) {
$options[] = array($name, @in_array($name, $fields['events']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$label = Widget::Label(__('Data Sources'));
$DSManager = new DatasourceManager($this->_Parent);
$datasources = $DSManager->listAll();
$options = array();
if (is_array($datasources) && !empty($datasources)) {
foreach ($datasources as $name => $about) {
$options[] = array($name, @in_array($name, $fields['data_sources']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[data_sources][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$fieldset->appendChild($group);
$this->Form->appendChild($fieldset);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'secondary');
$label = Widget::Label(__('URL Handle'));
$label->appendChild(Widget::Input('fields[handle]', $fields['handle']));
$fieldset->appendChild(isset($this->_errors['handle']) ? $this->wrapFormElementWithError($label, $this->_errors['handle']) : $label);
$pages = $this->_Parent->Database->fetch("SELECT * FROM `tbl_pages` WHERE `id` != '{$page_id}' ORDER BY `title` ASC");
$label = Widget::Label(__('Parent Page'));
$options = array(array('', false, '/'));
if (is_array($pages) and !empty($pages)) {
if (!function_exists('__compare_pages')) {
function __compare_pages($a, $b)
{
return strnatcasecmp($a[2], $b[2]);
}
}
foreach ($pages as $page) {
$options[] = array($page['id'], $fields['parent'] == $page['id'], '/' . $this->_Parent->resolvePagePath($page['id']));
}
usort($options, '__compare_pages');
}
$label->appendChild(Widget::Select('fields[parent]', $options));
$fieldset->appendChild($label);
$label = Widget::Label(__('URL Parameters'));
$label->appendChild(Widget::Input('fields[params]', $fields['params']));
$fieldset->appendChild($label);
$div3 = new XMLElement('div');
$label = Widget::Label(__('Page Type'));
$label->appendChild(Widget::Input('fields[type]', $fields['type']));
$div3->appendChild(isset($this->_errors['type']) ? $this->wrapFormElementWithError($label, $this->_errors['type']) : $label);
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'tags');
if ($types = $this->__fetchAvailablePageTypes()) {
//.........这里部分代码省略.........
示例14: __getEvents
public function __getEvents()
{
$EventManager = new EventManager($this->_Parent);
return $EventManager->listAll();
}