当前位置: 首页>>代码示例>>PHP>>正文


PHP EventManager::create方法代码示例

本文整理汇总了PHP中EventManager::create方法的典型用法代码示例。如果您正苦于以下问题:PHP EventManager::create方法的具体用法?PHP EventManager::create怎么用?PHP EventManager::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventManager的用法示例。


在下文中一共展示了EventManager::create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processEvents

 /**
  * The processEvents function executes all Events attached to the resolved
  * page in the correct order determined by `__findEventOrder()`. The results
  * from the Events are appended to the page's XML. Events execute first,
  * before Datasources.
  *
  * @uses FrontendProcessEvents
  * @uses FrontendEventPostProcess
  * @param string $events
  *  A string of all the Events attached to this page, comma separated.
  * @param XMLElement $wrapper
  *  The XMLElement to append the Events results to. Event results are
  *  contained in a root XMLElement that is the handlised version of
  *  their name.
  */
 private function processEvents($events, XMLElement &$wrapper)
 {
     /**
      * Manipulate the events array and event element wrapper
      * @delegate FrontendProcessEvents
      * @param string $context
      * '/frontend/'
      * @param array $env
      * @param string $events
      *  A string of all the Events attached to this page, comma separated.
      * @param XMLElement $wrapper
      *  The XMLElement to append the Events results to. Event results are
      *  contained in a root XMLElement that is the handlised version of
      *  their name.
      * @param array $page_data
      *  An associative array of page meta data
      */
     $this->ExtensionManager->notifyMembers('FrontendProcessEvents', '/frontend/', array('env' => $this->_env, 'events' => &$events, 'wrapper' => &$wrapper, 'page_data' => $this->_pageData));
     if (strlen(trim($events)) > 0) {
         $events = preg_split('/,\\s*/i', $events, -1, PREG_SPLIT_NO_EMPTY);
         $events = array_map('trim', $events);
         if (!is_array($events) || empty($events)) {
             return;
         }
         $pool = array();
         foreach ($events as $handle) {
             $pool[$handle] = $this->EventManager->create($handle, array('env' => $this->_env, 'param' => $this->_param));
         }
         uasort($pool, array($this, '__findEventOrder'));
         foreach ($pool as $handle => $event) {
             Frontend::instance()->Profiler->seed();
             $dbstats = Symphony::Database()->getStatistics();
             $queries = $dbstats['queries'];
             if ($xml = $event->load()) {
                 if (is_object($xml)) {
                     $wrapper->appendChild($xml);
                 } else {
                     $wrapper->setValue($wrapper->getValue() . self::CRLF . '	' . trim($xml));
                 }
             }
             $dbstats = Symphony::Database()->getStatistics();
             $queries = $dbstats['queries'] - $queries;
             Frontend::instance()->Profiler->sample($handle, PROFILE_LAP, 'Event', $queries);
         }
     }
     /**
      * Just after the page events have triggered. Provided with the XML object
      * @delegate FrontendEventPostProcess
      * @param string $context
      * '/frontend/'
      * @param XMLElement $xml
      *  The XMLElement to append the Events results to. Event results are
      *  contained in a root XMLElement that is the handlised version of
      *  their name.
      */
     $this->ExtensionManager->notifyMembers('FrontendEventPostProcess', '/frontend/', array('xml' => &$wrapper));
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:72,代码来源:class.frontendpage.php

示例2: injectFields

 private function injectFields(XMLElement &$form, array $callback)
 {
     // skip when creating new events
     if ($callback['context'][0] == 'new') {
         return $this->injectDefault($form);
     }
     $event = EventManager::create($callback['context'][1]);
     $event_source = null;
     if (method_exists($event, 'getSource')) {
         $event_source = $event->getSource();
     }
     // This isn't a typical event, so return
     if (!is_numeric($event_source)) {
         return null;
     }
     $section = SectionManager::fetch($event_source);
     // For whatever reason, the Section doesn't exist anymore
     if (!$section instanceof Section) {
         return null;
     }
     $this->injectDefaultValues($form, $event, $section);
 }
开发者ID:michael-e,项目名称:default_event_values,代码行数:22,代码来源:extension.driver.php

示例3: __form

 public function __form($readonly = false)
 {
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if ($formHasErrors) {
         $this->pageAlert(__('An error occurred while processing this form. See below for details.'), Alert::ERROR);
         // These alerts are only valid if the form doesn't have errors
     } elseif (isset($this->_context[2])) {
         $time = Widget::Time();
         switch ($this->_context[2]) {
             case 'saved':
                 $this->pageAlert(__('Event updated at %s.', array($time->generate())) . ' <a href="' . SYMPHONY_URL . '/blueprints/events/new/" accesskey="c">' . __('Create another?') . '</a> <a href="' . SYMPHONY_URL . '/blueprints/events/" accesskey="a">' . __('View all Events') . '</a>', Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Event created at %s.', array($time->generate())) . ' <a href="' . SYMPHONY_URL . '/blueprints/events/new/" accesskey="c">' . __('Create another?') . '</a> <a href="' . SYMPHONY_URL . '/blueprints/events/" accesskey="a">' . __('View all Events') . '</a>', Alert::SUCCESS);
                 break;
         }
     }
     $isEditing = $readonly ? true : false;
     $fields = array("name" => null, "filters" => null);
     $about = array("name" => null);
     $providers = Symphony::ExtensionManager()->getProvidersOf(iProvider::EVENT);
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
         if ($this->_context[0] == 'edit') {
             $isEditing = true;
         }
     } elseif ($this->_context[0] == 'edit' || $this->_context[0] == 'info') {
         $isEditing = true;
         $handle = $this->_context[1];
         $existing = EventManager::create($handle);
         $about = $existing->about();
         if ($this->_context[0] == 'edit' && !$existing->allowEditorToParse()) {
             redirect(SYMPHONY_URL . '/blueprints/events/info/' . $handle . '/');
         }
         $fields['name'] = $about['name'];
         $fields['source'] = $existing->getSource();
         $provided = false;
         if (!empty($providers)) {
             foreach ($providers as $providerClass => $provider) {
                 if ($fields['source'] == call_user_func(array($providerClass, 'getClass'))) {
                     $fields = array_merge($fields, $existing->settings());
                     $provided = true;
                     break;
                 }
             }
         }
         if (!$provided) {
             if (isset($existing->eParamFILTERS)) {
                 $fields['filters'] = $existing->eParamFILTERS;
             }
         }
     }
     // Handle name on edited changes, or from reading an edited datasource
     if (isset($about['name'])) {
         $name = $about['name'];
     } elseif (isset($fields['name'])) {
         $name = $fields['name'];
     }
     $this->setPageType('form');
     $this->setTitle(__($isEditing ? '%1$s &ndash; %2$s &ndash; %3$s' : '%2$s &ndash; %3$s', array($about['name'], __('Events'), __('Symphony'))));
     $this->appendSubheading($isEditing ? $about['name'] : __('Untitled'));
     $this->insertBreadcrumbs(array(Widget::Anchor(__('Events'), SYMPHONY_URL . '/blueprints/events/')));
     if (!$readonly) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Essentials')));
         // Target
         $sources = new XMLElement('div', null, array('class' => 'apply actions'));
         $div = new XMLElement('div');
         $label = Widget::Label(__('Target'), null, 'apply-label-left');
         $sources->appendChild($label);
         $sources->appendChild($div);
         $sections = SectionManager::fetch(null, 'ASC', 'name');
         $options = array();
         $section_options = array();
         $source = isset($fields['source']) ? $fields['source'] : null;
         if (is_array($sections) && !empty($sections)) {
             $section_options = array('label' => __('Sections'), 'options' => array());
             foreach ($sections as $s) {
                 $section_options['options'][] = array($s->get('id'), $source == $s->get('id'), General::sanitize($s->get('name')));
             }
         }
         $options[] = $section_options;
         // Loop over the event providers
         if (!empty($providers)) {
             $p = array('label' => __('From extensions'), 'options' => array());
             foreach ($providers as $providerClass => $provider) {
                 $p['options'][] = array($providerClass, $fields['source'] == $providerClass, $provider);
             }
             $options[] = $p;
         }
         $div->appendChild(Widget::Select('source', $options, array('id' => 'event-context')));
         if (isset($this->_errors['source'])) {
             $this->Context->prependChild(Widget::Error($sources, $this->_errors['source']));
         } else {
             $this->Context->prependChild($sources);
         }
         $this->Form->appendChild(Widget::Input('fields[source]', $options[0]['options'][0][0], 'hidden', array('id' => 'event-source')));
         // Name
         $group = new XMLElement('div');
//.........这里部分代码省略.........
开发者ID:valery,项目名称:symphony-2,代码行数:101,代码来源:content.blueprintsevents.php

示例4: EventManager

<?php

/***
 *
 * Symphony web publishing system
 *
 * Copyright 2004–2006 Twenty One Degrees Pty. Ltd.
 *
 * @version 1.7
 * @licence https://github.com/symphonycms/symphony-1.7/blob/master/LICENCE
 *
 ***/
$EM = new EventManager(array('parent' => &$Admin));
$oEvent =& $EM->create($_REQUEST['file']);
$about = $oEvent->about();
$GLOBALS['pageTitle'] = 'Events > ' . $about['name'];
$date = $Admin->getDateObj();
$link = $about['author']['name'];
if (isset($about['author']['website'])) {
    $link = '<a href="' . General::validateURL($about['author']['website']) . '">' . $about['author']['name'] . '</a>';
} elseif (isset($about['author']['email'])) {
    $link = '<a href="mailto:' . $about['author']['email'] . '">' . $about['author']['name'] . '</a>';
}
?>


<form id="controller" action="" method="post">
  	<h2><?php 
print $about['name'];
?>
</h2>
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:31,代码来源:sym_blueprint_events_info.php

示例5: __form

 public function __form($readonly = false)
 {
     $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);
     }
     if (isset($this->_context[2])) {
         switch ($this->_context[2]) {
             case 'saved':
                 $this->pageAlert(__('Event updated at %1$s. <a href="%2$s" accesskey="c">Create another?</a> <a href="%3$s" accesskey="a">View all Events</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), SYMPHONY_URL . '/blueprints/events/new/', SYMPHONY_URL . '/blueprints/components/')), Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Event created at %1$s. <a href="%2$s" accesskey="c">Create another?</a> <a href="%3$s" accesskey="a">View all Events</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), SYMPHONY_URL . '/blueprints/events/new/', SYMPHONY_URL . '/blueprints/components/')), Alert::SUCCESS);
                 break;
         }
     }
     $isEditing = $readonly ? true : false;
     $fields = array();
     $sectionManager = new SectionManager($this->_Parent);
     if ($this->_context[0] == 'edit' || $this->_context[0] == 'info') {
         $isEditing = true;
         $handle = $this->_context[1];
         $EventManager = new EventManager($this->_Parent);
         $existing =& $EventManager->create($handle);
         $about = $existing->about();
         if ($this->_context[0] == 'edit' && !$existing->allowEditorToParse()) {
             redirect(SYMPHONY_URL . '/blueprints/events/info/' . $handle . '/');
         }
         $fields['name'] = $about['name'];
         $fields['source'] = $existing->getSource();
         $fields['filters'] = $existing->eParamFILTERS;
     }
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     }
     $this->setPageType('form');
     $this->setTitle(__($isEditing ? '%1$s &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %2$s', array(__('Symphony'), __('Events'), $about['name'])));
     $this->appendSubheading($isEditing ? $about['name'] : __('Untitled'));
     if (!$readonly) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Essentials')));
         $group = new XMLElement('div');
         $group->setAttribute('class', 'group');
         $label = Widget::Label(__('Name'));
         $label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
         $div = new XMLElement('div');
         if (isset($this->_errors['name'])) {
             $div->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
         } else {
             $div->appendChild($label);
         }
         $group->appendChild($div);
         $label = Widget::Label(__('Source'));
         $sections = $sectionManager->fetch(NULL, 'ASC', 'name');
         $options = array();
         if (is_array($sections) && !empty($sections)) {
             foreach ($sections as $s) {
                 $options[] = array($s->get('id'), $fields['source'] == $s->get('id'), General::sanitize($s->get('name')));
             }
         }
         $label->appendChild(Widget::Select('fields[source]', $options, array('id' => 'context')));
         $div = new XMLElement('div');
         if (isset($this->_errors['source'])) {
             $div->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['source']));
         } else {
             $div->appendChild($label);
         }
         $group->appendChild($div);
         $fieldset->appendChild($group);
         $label = Widget::Label(__('Filter Options'));
         $filters = is_array($fields['filters']) ? $fields['filters'] : array();
         $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));
         $label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple')));
         $fieldset->appendChild($label);
         $this->Form->appendChild($fieldset);
     }
     if ($isEditing) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $doc = $existing->documentation();
         $fieldset->setValue('<legend>' . __('Description') . '</legend>' . self::CRLF . General::tabsToSpaces(is_object($doc) ? $doc->generate(true) : $doc, 2));
         $this->Form->appendChild($fieldset);
     }
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', $isEditing ? __('Save Changes') : __('Create Event'), 'submit', array('accesskey' => 's')));
     if ($isEditing) {
//.........这里部分代码省略.........
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:101,代码来源:content.blueprintsevents.php

示例6: switch

 function __form($readonly = false)
 {
     $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);
     }
     if (isset($this->_context[2])) {
         switch ($this->_context[2]) {
             case 'saved':
                 $this->pageAlert(__('Event updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Events</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), URL . '/symphony/blueprints/events/new/', URL . '/symphony/blueprints/components/')), Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Event created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Events</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), URL . '/symphony/blueprints/events/new/', URL . '/symphony/blueprints/components/')), Alert::SUCCESS);
                 break;
         }
     }
     $isEditing = $readonly ? true : false;
     $fields = array();
     $sectionManager = new SectionManager($this->_Parent);
     if ($this->_context[0] == 'edit' || $this->_context[0] == 'info') {
         $isEditing = true;
         $handle = $this->_context[1];
         $EventManager = new EventManager($this->_Parent);
         $existing =& $EventManager->create($handle);
         $about = $existing->about();
         $fields['name'] = $about['name'];
         $fields['source'] = $existing->getSource();
         $fields['filters'] = $existing->eParamFILTERS;
     }
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     }
     $this->setPageType('form');
     $this->setTitle(__($isEditing ? '%1$s &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %2$s', array(__('Symphony'), __('Events'), $about['name'])));
     $this->appendSubheading($isEditing ? $about['name'] : __('Untitled'));
     if (!$readonly) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Essentials')));
         $div = new XMLElement('div');
         $div->setAttribute('class', 'group');
         $label = Widget::Label(__('Name'));
         $label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
         if (isset($this->_errors['name'])) {
             $div->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
         } else {
             $div->appendChild($label);
         }
         $label = Widget::Label(__('Source'));
         $sections = $sectionManager->fetch(NULL, 'ASC', 'name');
         $options = array();
         if (is_array($sections) && !empty($sections)) {
             foreach ($sections as $s) {
                 $options[] = array($s->get('id'), $fields['source'] == $s->get('id'), $s->get('name'));
             }
         }
         $label->appendChild(Widget::Select('fields[source]', $options, array('id' => 'context')));
         $div->appendChild($label);
         $fieldset->appendChild($div);
         $label = Widget::Label(__('Filter Rules'));
         $options = array(array('admin-only', @in_array('admin-only', $fields['filters']), __('Admin Only')), array('send-email', @in_array('send-email', $fields['filters']), __('Send Email')), array('expect-multiple', @in_array('expect-multiple', $fields['filters']), __('Allow Multiple')));
         ###
         # Delegate: AppendEventFilter
         # Description: Allows adding of new filter rules to the Event filter rule select box. A reference to the $options array is provided, and selected filters
         $this->_Parent->ExtensionManager->notifyMembers('AppendEventFilter', '/blueprints/events/' . $this->_context[0] . '/', array('selected' => $fields['filters'], 'options' => &$options));
         $label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple')));
         $fieldset->appendChild($label);
         $fieldset->appendChild(new XMLElement('p', __('This event will not be processed if any of these rules return true.'), array('class' => 'help')));
         $this->Form->appendChild($fieldset);
     }
     if ($isEditing) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $doc = $existing->documentation();
         $fieldset->setValue('<legend>' . __('Description') . '</legend>' . self::CRLF . General::tabsToSpaces(is_object($doc) ? $doc->generate(true) : $doc, 2));
         $this->Form->appendChild($fieldset);
     }
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', $isEditing ? __('Save Changes') : __('Create Event'), 'submit', array('accesskey' => 's')));
     if ($isEditing) {
         $button = new XMLElement('button', __('Delete'));
         $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this event'), 'type' => 'submit'));
         $div->appendChild($button);
     }
     if (!$readonly) {
         $this->Form->appendChild($div);
     }
 }
开发者ID:bauhouse,项目名称:sym-form-builder,代码行数:89,代码来源:content.blueprintsevents.php

示例7: EventManager

 /**
  * イベントマネージャー
  */
 public function EventManager()
 {
     return $this->_event_manager ? $this->_event_manager : ($this->_event_manager = EventManager::create($this));
 }
开发者ID:nora-worker,项目名称:core,代码行数:7,代码来源:EventClientTrait.php

示例8: __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 &ndash; Member Roles'));
         $this->appendSubheading(__('Untitled'));
         $fields = array('name' => null, 'permissions' => null, 'page_access' => null);
     } else {
         $this->setTitle(__('Symphony &ndash; Member Roles &ndash; ') . $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);
//.........这里部分代码省略.........
开发者ID:andrewminton,项目名称:members,代码行数:101,代码来源:content.roles.php

示例9: preInjectXML

 public function preInjectXML($context)
 {
     $EventManager = new EventManager($this->_Parent);
     // we have to load the events twice to look for a lock-entry event attached
     if (strlen(trim($context['events'])) > 0) {
         $events = preg_split('/,\\s*/i', $context['events'], -1, PREG_SPLIT_NO_EMPTY);
         $events = array_map('trim', $events);
         if (!is_array($events) || empty($events)) {
             return;
         }
         foreach ($events as $handle) {
             $event = $EventManager->create($handle);
             if ($event->eParamFILTERS && in_array("lock-entry", $event->eParamFILTERS)) {
                 $this->locked = true;
                 return;
             }
         }
     }
 }
开发者ID:scottkf,项目名称:pessimistic-db-locking,代码行数:19,代码来源:extension.driver.php

示例10: testCreate

 /**
  * @covers ::create
  * @covers ::observe
  */
 public function testCreate()
 {
     $this->cnt = 0;
     $em = EventManager::create();
     return $em;
 }
开发者ID:nora-worker,项目名称:core,代码行数:10,代码来源:EventManagerTest.php


注:本文中的EventManager::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。