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);
 }
 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);
 }
 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);
 }
 public function __viewEdit()
 {
     $this->setPageType('form');
     $fields = array();
     // Verify page exists:
     if ($this->_context[0] == 'edit') {
         if (!($page_id = $this->_context[1])) {
             redirect(URL . '/symphony/blueprints/pages/');
         }
         $existing = $this->_Parent->Database->fetchRow(0, "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tp.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_pages` AS p\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tp.id = '{$page_id}'\n\t\t\t\t\tLIMIT 1\n\t\t\t\t");
         if (!$existing) {
             $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'));
         }
     }
     // Status message:
     if (isset($this->_context[2])) {
         $this->pageAlert(__('%s %s at %s. <a href="%s">Create another?</a> <a href="%s">View all %s</a>', array(__('Page'), $this->_context[2] == 'saved' ? 'updated' : 'created', DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), URL . '/symphony/blueprints/pages/new/', URL . '/symphony/blueprints/pages/', __('Pages'))), Alert::SUCCESS);
     }
     // Find values:
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     } else {
         if ($this->_context[0] == 'edit') {
             $fields = $existing;
             $types = $this->_Parent->Database->fetchCol('type', "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tp.type\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_pages_types` AS p\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tp.page_id = '{$page_id}'\n\t\t\t\t\tORDER BY\n\t\t\t\t\t\tp.type ASC\n\t\t\t\t");
             $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);
         }
     }
     $title = $fields['title'];
     if (trim($title) == '') {
         $title = $existing['title'];
     }
     $this->setTitle(__($title ? '%1$s &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %2$s', array(__('Symphony'), __('Pages'), $title)));
     $this->appendSubheading($title ? $title : __('Untitled'));
     // Title --------------------------------------------------------------
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Page Settings')));
     $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);
 }
}
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();
?>
&amp;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>
 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);
 }
 public function __viewEdit()
 {
     $this->setPageType('form');
     $fields = array();
     $nesting = Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes';
     // Verify page exists:
     if ($this->_context[0] == 'edit') {
         if (!($page_id = $this->_context[1])) {
             redirect(SYMPHONY_URL . '/blueprints/pages/');
         }
         $existing = Symphony::Database()->fetchRow(0, "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tp.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_pages` AS p\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tp.id = '{$page_id}'\n\t\t\t\t\tLIMIT 1\n\t\t\t\t");
         if (!$existing) {
             Administration::instance()->errorPageNotFound();
         }
     }
     // Status message:
     $flag = $this->_context[2];
     if (isset($flag)) {
         if (isset($_REQUEST['parent']) && is_numeric($_REQUEST['parent'])) {
             $link_suffix = "?parent=" . $_REQUEST['parent'];
         } elseif ($nesting == true && isset($existing) && !is_null($existing['parent'])) {
             $link_suffix = '?parent=' . $existing['parent'];
         }
         switch ($flag) {
             case 'saved':
                 $this->pageAlert(__('Page updated at %1$s. <a href="%2$s" accesskey="c">Create another?</a> <a href="%3$s" accesskey="a">View all Pages</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), SYMPHONY_URL . '/blueprints/pages/new/' . $link_suffix, SYMPHONY_URL . '/blueprints/pages/' . $link_suffix)), Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Page created at %1$s. <a href="%2$s" accesskey="c">Create another?</a> <a href="%3$s" accesskey="a">View all Pages</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), SYMPHONY_URL . '/blueprints/pages/new/' . $link_suffix, SYMPHONY_URL . '/blueprints/pages/' . $link_suffix)), Alert::SUCCESS);
                 break;
         }
     }
     // Find values:
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     } elseif ($this->_context[0] == 'edit') {
         $fields = $existing;
         $types = Symphony::Database()->fetchCol('type', "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tp.type\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_pages_types` AS p\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tp.page_id = '{$page_id}'\n\t\t\t\t\tORDER BY\n\t\t\t\t\t\tp.type ASC\n\t\t\t\t");
         $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);
     } elseif (isset($_REQUEST['parent']) && is_numeric($_REQUEST['parent'])) {
         $fields['parent'] = $_REQUEST['parent'];
     }
     $title = $fields['title'];
     if (trim($title) == '') {
         $title = $existing['title'];
     }
     $this->setTitle(__($title ? '%1$s &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %2$s', array(__('Symphony'), __('Pages'), $title)));
     if ($existing) {
         $template_name = $fields['handle'];
         if ($existing['parent']) {
             $parents = $this->__getParent($existing['parent']);
             $template_name = $parents . '_' . $fields['handle'];
         }
         $this->appendSubheading(__($title ? $title : __('Untitled')), Widget::Anchor(__('Edit Template'), SYMPHONY_URL . '/blueprints/pages/template/' . $template_name, __('Edit Page Template'), 'button', NULL, array('accesskey' => 't')));
     } else {
         $this->appendSubheading($title ? $title : __('Untitled'));
     }
     // Title --------------------------------------------------------------
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Page Settings')));
     $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 = Symphony::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'], '/' . 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'])));
     }
 }
    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 &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %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);
        $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);
        $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()) {
            foreach ($types as $type) {
                $ul->appendChild(new XMLElement('li', $type));
            }
        }
        $div3->appendChild($ul);
        $group->appendChild($div3);
        $div->appendChild($group);
        $this->Form->appendChild($div);
        $fieldset = new XMLElement('fieldset');
        $fieldset->setAttribute('class', 'primary');
        $label = Widget::Label(__('Title'));
        $label->appendChild(Widget::Input('fields[title]', General::sanitize($fields['title'])));
        $fieldset->appendChild(isset($this->_errors['title']) ? $this->wrapFormElementWithError($label, $this->_errors['title']) : $label);
        $label = Widget::Label(__('Body'));
        $label->appendChild(Widget::Textarea('fields[body]', '25', '50', General::sanitize($fields['body']), array('class' => 'code')));
        $fieldset->appendChild(isset($this->_errors['body']) ? $this->wrapFormElementWithError($label, $this->_errors['body']) : $label);
        $this->Form->appendChild($fieldset);
        $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
        $utilities = $utilities['filelist'];
        if (is_array($utilities) && !empty($utilities)) {
            $div = new XMLElement('div');
            $div->setAttribute('class', 'secondary');
            $h3 = new XMLElement('h3', __('Utilities'));
            $h3->setAttribute('class', 'label');
            $div->appendChild($h3);
            $ul = new XMLElement('ul');
            $ul->setAttribute('id', 'utilities');
            foreach ($utilities as $util) {
                $li = new XMLElement('li');
                $li->appendChild(Widget::Anchor($util, URL . '/symphony/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/', NULL));
                $ul->appendChild($li);
            }
            $div->appendChild($ul);
            $this->Form->appendChild($div);
        }
        $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);
    }
 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 &ndash; Member Roles &ndash; ' . $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']);
         }
     }
     $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', 'Operations'));
     if ($role_id == 1) {
         $fieldset->appendChild(new XMLElement('p', 'The default role cannot be deleted', array('class' => 'help')));
     }
     $aTableBody = array();
     $roles = $this->_driver->fetchRoles();
     $options = array();
     foreach ($roles as $role) {
         if ($role_id == $role->id()) {
             continue;
         }
         $options[] = array($role->id(), false, $role->name());
     }
     ## Setup each cell
     $td1 = Widget::TableData('Move');
     $td2 = Widget::TableData(Widget::Select('fields[new_role]', $options));
     $td3 = Widget::TableData(Widget::Input('action[move]', 'Move', 'submit', array('class' => 'confirm')));
     ## Add a row to the body array, assigning each cell to the row
     $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
     if ($role_id != 1) {
         ## Setup each cell
         $td1 = Widget::TableData('Move and Delete');
         $td2 = Widget::TableData(Widget::Select('fields[replacement_role]', $options));
         $td3 = Widget::TableData(Widget::Input('action[delete]', 'Delete', 'submit', array('class' => 'confirm')));
         ## Add a row to the body array, assigning each cell to the row
         $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
     }
     $table = Widget::Table(NULL, NULL, Widget::TableBody($aTableBody), NULL, 'role-operations');
     $table->setAttributeArray(array('cellspacing' => '0', 'cellpadding' => '0'));
     $fieldset->appendChild($table);
     $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]', 'Save Changes', 'submit', array('accesskey' => 's')));
     $this->Form->appendChild($div);
 }
 public function render_panel($context)
 {
     $config = $context['config'];
     switch ($context['type']) {
         case 'datasource_to_table':
             $ds = DatasourceManager::create($config['datasource'], NULL, false);
             if (!$ds) {
                 $context['panel']->appendChild(new XMLElement('div', __('The Data Source with the name <code>%s</code> could not be found.', array($config['datasource']))));
                 return;
             }
             $param_pool = array();
             $xml = $ds->grab($param_pool);
             if (!$xml) {
                 return;
             }
             $xml = $xml->generate();
             require_once TOOLKIT . '/class.xsltprocess.php';
             $proc = new XsltProcess();
             $data = $proc->process($xml, file_get_contents(EXTENSIONS . '/dashboard/lib/datasource-to-table.xsl'));
             $context['panel']->appendChild(new XMLElement('div', $data));
             break;
         case 'rss_reader':
             require_once TOOLKIT . '/class.gateway.php';
             require_once CORE . '/class.cacheable.php';
             $cache_id = md5('rss_reader_cache' . $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']);
                 }
                 $xml = $new_data;
                 if (empty($xml) && $data) {
                     $xml = $data['data'];
                 }
             } 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;
     }
 }
Beispiel #11
0
 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">
             		<p class="slider"></p>
             		<span></span>
             		<input type="hidden" name="{ANY NAME}" value="{EXISTING-VALUE:1}"/>
             	</td>-->
             </tr>
             */
             ## 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: MemberRolePermissionFieldsetsEdit
     # Description: Add custom fieldsets to the role page
     Administration::instance()->ExtensionManager->notifyMembers('MemberRolePermissionFieldsetsEdit', '/extension/members/roles_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 = ASDCLoader::instance()->query(sprintf("SELECT * FROM `tbl_pages` %s ORDER BY `title` ASC", $this->_context[0] == 'edit' ? "WHERE `id` != '{$page_id}' " : NULL));
     $label = Widget::Label(__('Deny Access'));
     $options = array();
     if ($pages->length() > 0) {
         foreach ($pages as $page) {
             $options[] = array($page->id, @in_array($page->id, $fields['page_access']), '/' . Administration::instance()->resolvePagePath($page->id));
         }
     }
     $label->appendChild(Widget::Select('fields[page_access][]', $options, array('multiple' => 'multiple')));
     $fieldset->appendChild($label);
     $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);
 }
Beispiel #12
0
 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);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
     if (!$isNew && $existing->get('id') != Role::PUBLIC_ROLE) {
         $button = new XMLElement('button', __('Delete'));
         $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this Role'), 'type' => 'submit', 'accesskey' => 'd'));
         $div->appendChild($button);
     }
     $this->Form->appendChild($div);
 }
 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 &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %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()) {
         foreach ($types as $type) {
             $ul->appendChild(new XMLElement('li', $type));
         }
     }
     $div3->appendChild($ul);
     $fieldset->appendChild($div3);
     $this->Form->appendChild($fieldset);
     /*$utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
     			$utilities = $utilities['filelist'];			
     			
     			if(is_array($utilities) && !empty($utilities)){
     			
     				$div = new XMLElement('div');
     				$div->setAttribute('class', 'secondary');
     				
     				$h3 = new XMLElement('h3', __('Utilities'));
     				$h3->setAttribute('class', 'label');
     				$div->appendChild($h3);
     				
     				$ul = new XMLElement('ul');
     				$ul->setAttribute('id', 'utilities');
     			
     				$i = 0;
     				foreach($utilities as $util){
     					$li = new XMLElement('li');
     
     					if ($i++ % 2 != 1) {
     						$li->setAttribute('class', 'odd');
     					}
     
     					$li->appendChild(Widget::Anchor($util, URL . '/symphony/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/', NULL));
     					$ul->appendChild($li);
     				}
     			
     				$div->appendChild($ul);
     			
     				$this->Form->appendChild($div);
     							
     			}*/
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
     $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);
 }
Beispiel #14
0
 public function __getEvents()
 {
     $EventManager = new EventManager($this->_Parent);
     return $EventManager->listAll();
 }