public function view()
 {
     $this->setPageType('table');
     $this->appendSubheading(__('Templated Text Formatters'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/templatedtextformatters/edit/', __('Create a new hub'), 'create button'));
     $aTableHead = array(array(__('Title'), 'col'), array(__('Type'), 'col'), array(__('Description'), 'col'));
     $aTableBody = array();
     $formatters = $this->_driver->listAll();
     if (!is_array($formatters) || empty($formatters)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $tfm = new TextformatterManager($this->_Parent);
         foreach ($formatters as $id => $data) {
             $formatter = $tfm->create($id);
             $about = $formatter->about();
             $td1 = Widget::TableData(Widget::Anchor($about['name'], URL . "/symphony/extension/templatedtextformatters/edit/{$id}/", $about['name']));
             $td2 = Widget::TableData($about['templatedtextformatters-type']);
             $td3 = Widget::TableData($about['description']);
             $td1->appendChild(Widget::Input('items[' . $id . ']', NULL, 'checkbox'));
             // Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
     $div->appendChild(Widget::Select('with-selected', $options));
     $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($div);
 }
 /**
  * Create row for page on the manage page fields page.  This contains the applicable actions
  * for the page fields.
  *
  * @param array page The page details.
  * @param bool Is the row odd or not?
  *
  * @return Widget Row for page.
  */
 private function createViewPageFieldsRowForPage($page, $isOdd)
 {
     $class = array();
     $pageTitle = $this->_Parent->resolvePageTitle($page['id']);
     $pageUrl = URL . '/' . $this->_Parent->resolvePagePath($page['id']) . '/';
     $pageEditUrl = URL . '/symphony/blueprints/pages/edit/' . $page['id'] . '/';
     $colTitle = Widget::TableData(Widget::Anchor($pageTitle, $pageEditUrl, $page['handle']));
     $colTitle->appendChild(Widget::Input("items[{$page['id']}]", null, 'checkbox'));
     $colUrl = Widget::TableData(Widget::Anchor($pageUrl, $pageUrl));
     if ($page['section_id'] == NULL) {
         $colActions = Widget::TableData(Widget::Anchor('Create', URL . PF_MANAGE_URL . 'create/' . $page['id'] . '/'));
     } else {
         $colActions = Widget::TableData();
         $colActions->appendChild(Widget::Anchor('Edit', URL . '/symphony/blueprints/sections/edit/' . $page['section_id'] . '/'));
         $colActions->appendChild(new XMLElement('span', ', '));
         $colActions->appendChild(Widget::Anchor('Delete', URL . PF_MANAGE_URL . 'delete/' . $page['section_id'] . '/'));
     }
     if ($isOdd) {
         $class[] = 'odd';
     }
     if (in_array($page['id'], $this->_hilights)) {
         $class[] = 'failed';
     }
     return Widget::TableRow(array($colTitle, $colUrl, $colActions), implode(' ', $class));
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle('Symphony – Importers');
     $tableHead = array(array('Name', 'col'), array('Version', 'col'), array('Author', 'col'));
     $tableBody = array();
     if (!is_array($this->_importers) or empty($this->_importers)) {
         $tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
     } else {
         foreach ($this->_importers as $importer) {
             $importer = (object) $importer;
             $col_name = Widget::TableData(Widget::Anchor($this->_driver->truncateValue($importer->name), $this->_uri . "/importers/edit/{$importer->handle}/"));
             $col_name->appendChild(Widget::Input("items[{$importer->id}]", null, 'checkbox'));
             $col_version = Widget::TableData($this->_driver->truncateValue($importer->version));
             $col_author = Widget::TableData($this->_driver->truncateValue($importer->version));
             if (isset($importer->author['website']) and preg_match('/^[^\\s:\\/?#]+:(?:\\/{2,3})?[^\\s.\\/?#]+(?:\\.[^\\s.\\/?#]+)*(?:\\/[^\\s?#]*\\??[^\\s?#]*(#[^\\s#]*)?)?$/', $importer->author['website'])) {
                 $col_author = Widget::Anchor($importer->author['name'], General::validateURL($importer->author['website']));
             } elseif (isset($importer->author['email']) and preg_match('/^\\w(?:\\.?[\\w%+-]+)*@\\w(?:[\\w-]*\\.)+?[a-z]{2,}$/i', $importer->author['email'])) {
                 $col_author = Widget::Anchor($importer->author['name'], 'mailto:' . $importer->author['email']);
             } else {
                 $col_author = $importer->author['name'];
             }
             $col_author = Widget::TableData($col_author);
             $tableBody[] = Widget::TableRow(array($col_name, $col_version, $col_author));
         }
     }
     $table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody));
     $this->Form->appendChild($table);
 }
 function view()
 {
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
     $create_button = Widget::Anchor('Create a New Role', extension_members::baseURL() . 'new/', 'Create a new role', 'create button');
     $this->setPageType('table');
     $this->appendSubheading('Member Roles ' . $create_button->generate(false));
     $aTableHead = array(array('Name', 'col'), array('Members', 'col'));
     $roles = $this->_driver->fetchRoles();
     $aTableBody = array();
     if (!is_array($roles) || empty($roles)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $sectionManager = new SectionManager($this->_Parent);
         $section = $sectionManager->fetch($this->_Parent->Database->fetchVar('parent_section', 0, "SELECT `parent_section` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->usernameAndPasswordField() . "' LIMIT 1"));
         $bEven = true;
         $role_field_name = $this->_Parent->Database->fetchVar('element_name', 0, "SELECT `element_name` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->roleField() . "' LIMIT 1");
         foreach ($roles as $role) {
             $member_count = $this->_Parent->Database->fetchVar('count', 0, "SELECT COUNT(*) AS `count` FROM `tbl_entries_data_" . $this->_driver->roleField() . "` WHERE `role_id` = '" . $role->id() . "'");
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($role->name(), extension_members::baseURL() . 'edit/' . $role->id() . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$member_count}", URL . '/symphony/publish/' . $section->get('handle') . '/?filter=' . $role_field_name . ':' . $role->id()));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2), $bEven ? 'odd' : NULL);
             $bEven = !$bEven;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
 }
 /**
  * Display the publish panel
  * @param \XMLElement $wrapper
  * @param null $data
  * @param null $flagWithError
  * @param null $fieldnamePrefix
  * @param null $fieldnamePostfix
  */
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     if (!is_dir($this->get('destination') . '/')) {
         $flagWithError = __('The destination directory, <code>%s</code>, does not exist.', array($this->get('destination')));
     } elseif (!$flagWithError && !is_writable($this->get('destination') . '/')) {
         $flagWithError = __('Destination folder, <code>%s</code>, is not writable. Please check permissions.', array($this->get('destination')));
     }
     $label = Widget::Label($this->get('label'));
     $class = 'file';
     $label->setAttribute('class', $class);
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', __('Optional')));
     }
     $span = new XMLElement('span', NULL, array('class' => 'frame'));
     if ($data['file']) {
         $span->appendChild(Widget::Anchor(basename($data['file']), URL . '/symphony/extension/private_upload/?file=' . $data['file']));
     }
     $span->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $data['file'], $data['file'] ? 'hidden' : 'file'));
     $label->appendChild($span);
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Sections'))));
     $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), $this->_Parent->getCurrentPageURL() . 'new/', __('Create a section'), 'create button'));
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'));
     $aTableBody = array();
     if (!is_array($sections) || empty($sections)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         $bOdd = true;
         foreach ($sections as $s) {
             $entry_count = intval(Symphony::Database()->fetchVar('count', 0, "SELECT count(*) AS `count` FROM `tbl_entries` WHERE `section_id` = '" . $s->get('id') . "' "));
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($s->get('name'), $this->_Parent->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$entry_count}", URL . '/symphony/publish/' . $s->get('handle') . '/'));
             $td3 = Widget::TableData($s->get('navigation_group'));
             $td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), $bOdd ? 'odd' : NULL);
             $bOdd = !$bOdd;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm'), array('delete-entries', false, __('Delete Entries'), 'confirm'));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
 function prepareTableValue($data, XMLElement $link = NULL)
 {
     if (!is_array($data) || is_array($data) && !isset($data['relation_id'])) {
         return parent::prepareTableValue(NULL);
     }
     $link = Widget::Anchor($data['value'], URL . '/symphony/extension/nested_cats/overview/edit/' . $data['relation_id']);
     return $link;
 }
Example #8
0
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Member Roles'))));
     if (is_null(extension_Members::getFieldHandle('role')) && !is_null(extension_Members::getMembersSection())) {
         $this->pageAlert(__('There is no Member: Role field in the active Members section. <a href="%s%d/">Add Member: Role field?</a>', array(SYMPHONY_URL . '/blueprints/sections/edit/', extension_Members::getMembersSection())), Alert::NOTICE);
     }
     $this->appendSubheading(__('Member Roles'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a Role'), 'create button', NULL, array('accesskey' => 'c')));
     $roles = RoleManager::fetch();
     $aTableHead = array(array(__('Name'), 'col'), array(__('Members'), 'col'));
     $aTableBody = array();
     if (!is_array($roles) || empty($roles)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         if (is_null(extension_Members::getMembersSection())) {
             $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('No Member section has been specified in <a href="%s">Preferences</a>. Please do this first.', array(SYMPHONY_URL . '/system/preferences/')), 'inactive', NULL, count($aTableHead)))));
         } else {
             $sectionManager = new SectionManager(Administration::instance());
             $section = $sectionManager->fetch(extension_Members::getMembersSection());
             $with_selected_roles = array();
             $hasRoles = !is_null(extension_Members::getFieldHandle('role'));
             foreach ($roles as $role) {
                 // Setup each cell
                 $td1 = Widget::TableData(Widget::Anchor($role->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $role->get('id') . '/', null, 'content'));
                 if ($role->get('id') != Role::PUBLIC_ROLE) {
                     $td1->appendChild(Widget::Input("items[{$role->get('id')}]", null, 'checkbox'));
                 }
                 // Get the number of members for this role, as long as it's not the Public Role.
                 if ($hasRoles && $role->get('id') != Role::PUBLIC_ROLE) {
                     $member_count = Symphony::Database()->fetchVar('count', 0, sprintf("SELECT COUNT(*) AS `count` FROM `tbl_entries_data_%d` WHERE `role_id` = %d", extension_Members::getField('role')->get('id'), $role->get('id')));
                     $td2 = Widget::TableData(Widget::Anchor("{$member_count}", SYMPHONY_URL . '/publish/' . $section->get('handle') . '/?filter=' . extension_Members::getFieldHandle('role') . ':' . $role->get('id')));
                 } else {
                     if ($role->get('id') == Role::PUBLIC_ROLE) {
                         $td2 = Widget::TableData(__('This is the role assumed by the general public.'));
                     } else {
                         $td2 = Widget::TableData(__('None'), 'inactive');
                     }
                 }
                 // Add cells to a row
                 $aTableBody[] = Widget::TableRow(array($td1, $td2));
                 if ($hasRoles && $role->get('id') != Role::PUBLIC_ROLE) {
                     $with_selected_roles[] = array("move::" . $role->get('id'), false, $role->get('name'));
                 }
             }
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(0 => array(null, false, __('With Selected...')), 2 => array('delete', false, __('Delete'), 'confirm'), 3 => array('delete-members', false, __('Delete Members'), 'confirm'));
     if (count($with_selected_roles) > 0) {
         $options[1] = array('label' => __('Move Members To'), 'options' => $with_selected_roles);
     }
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
Example #9
0
 public function prepareSourceColumnValue()
 {
     $section = Section::loadFromHandle($this->_parameters->section);
     if ($section instanceof Section) {
         return Widget::TableData(Widget::Anchor($section->name, ADMIN_URL . '/blueprints/sections/edit/' . $section->handle . '/', array('title' => $section->handle)));
     } else {
         return Widget::TableData(__('None'), array('class' => 'inactive'));
     }
 }
 function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Authors'))));
     if (Administration::instance()->Author->isDeveloper()) {
         $this->appendSubheading(__('Authors'), Widget::Anchor(__('Add an Author'), $this->_Parent->getCurrentPageURL() . 'new/', __('Add a new author'), 'create button'));
     } else {
         $this->appendSubheading(__('Authors'));
     }
     $authors = AuthorManager::fetch();
     $aTableHead = array(array(__('Name'), 'col'), array(__('Email Address'), 'col'), array(__('Last Seen'), 'col'));
     $aTableBody = array();
     if (!is_array($authors) || empty($authors)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         $bOdd = true;
         foreach ($authors as $a) {
             if (intval($a->get('superuser')) == 1) {
                 $group = 'admin';
             } else {
                 $group = 'author';
             }
             ## Setup each cell
             if (Administration::instance()->Author->isDeveloper() || Administration::instance()->Author->get('id') == $a->get('id')) {
                 $td1 = Widget::TableData(Widget::Anchor($a->getFullName(), $this->_Parent->getCurrentPageURL() . 'edit/' . $a->get('id') . '/', $a->get('username'), $group));
             } else {
                 $td1 = Widget::TableData($a->getFullName(), 'inactive');
             }
             $td2 = Widget::TableData(Widget::Anchor($a->get('email'), 'mailto:' . $a->get('email'), 'Email this author'));
             if ($a->get('last_seen') != NULL) {
                 $td3 = Widget::TableData(DateTimeObj::get(__SYM_DATETIME_FORMAT__, strtotime($a->get('last_seen'))));
             } else {
                 $td3 = Widget::TableData('Unknown', 'inactive');
             }
             if (Administration::instance()->Author->isDeveloper()) {
                 if ($a->get('id') != Administration::instance()->Author->get('id')) {
                     $td3->appendChild(Widget::Input('items[' . $a->get('id') . ']', NULL, 'checkbox'));
                 }
             }
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), $bOdd ? 'odd' : NULL);
             $bOdd = !$bOdd;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     if (Administration::instance()->Author->isDeveloper()) {
         $tableActions = new XMLElement('div');
         $tableActions->setAttribute('class', 'actions');
         $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
         $tableActions->appendChild(Widget::Select('with-selected', $options));
         $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
         $this->Form->appendChild($tableActions);
     }
 }
Example #11
0
 protected function buildJumpItem($name, $link, $active = false)
 {
     $item = new XMLElement('li');
     $anchor = Widget::Anchor($name, $link);
     $anchor->setAttribute('class', 'inactive');
     if ($active == true) {
         $anchor->setAttribute('class', 'active');
     }
     $item->appendChild($anchor);
     return $item;
 }
 protected function __build()
 {
     parent::__build(isset($this->_params['version']) ? $this->_params['version'] : Symphony::Configuration()->get('version', 'symphony'));
     // Add Release Notes for the latest migration
     if (isset($this->_params['release-notes'])) {
         $h1 = end($this->Form->getChildrenByName('h1'));
         if ($h1 instanceof XMLElement) {
             $h1->appendChild(new XMLElement('em', Widget::Anchor(__('Release Notes'), $this->_params['release-notes'])));
         }
     }
 }
 protected function __buildColumnHeader($label = '', $column_name, $default_direction)
 {
     if ($default_direction == 'asc') {
         $direction = 'asc';
         $direction_reverse = 'desc';
     } else {
         $direction = 'desc';
         $direction_reverse = 'asc';
     }
     return array(Widget::Anchor($label, $this->__buildURL(array('pagination->current-page' => 1, 'sort->column' => $column_name, 'sort->direction' => $this->sort->column == $column_name && $this->sort->direction == $direction ? $direction_reverse : $direction)), '', $this->sort->column == $column_name ? 'active' : ''), 'col', array('class' => $column_name));
 }
 public function displayPublishPanel(&$wrapper, $data = null, $flagWithError = null, $prefix = null, $postfix = null)
 {
     $sortorder = $this->get('sortorder');
     $element_name = $this->get('element_name');
     $allow_override = null;
     $label = Widget::Label('', null, 'subsection');
     $h4 = new XMLElement('h4');
     $anchor = Widget::Anchor(($this->get('collapse') == 'yes' ? '(+) ' : '(-) ') . $this->get('label'), '#' . $this->get('num_fields'), null, 'collapse_field ' . ($this->get('collapse') == 'yes' ? 'hide' : ''));
     $h4->appendChild($anchor);
     $label->appendChild($h4);
     $wrapper->appendChild($label);
 }
Example #15
0
 public function view()
 {
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9126341);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/scripts.js', 9126342);
     $create_button = Widget::Anchor(__('Create a new role'), extension_members::baseURL() . 'roles_new/', __('Create a new role'), 'create button');
     $this->setPageType('table');
     $this->appendSubheading(__('Member Roles ') . $create_button->generate(false));
     $aTableHead = array(array(__('Name'), 'col'), array(__('Members'), 'col'));
     $roles = $this->_driver->fetchRoles();
     $aTableBody = array();
     if (!is_array($roles) || empty($roles)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } elseif (is_null(extension_members::memberSectionID())) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('No Member section has been specified in <a href="' . URL . '/symphony/extension/members/setup/">Member Setup</a>. Please do this first.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $sectionManager = new SectionManager($this->_Parent);
         $section = $sectionManager->fetch($this->_driver->memberSectionID());
         $bEven = true;
         $role_field_name = Symphony::Database()->fetchVar('element_name', 0, "SELECT `element_name` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->roleField() . "' LIMIT 1");
         $with_selected_roles = array();
         foreach ($roles as $role) {
             $member_count = Symphony::Database()->fetchVar('count', 0, "SELECT COUNT(*) AS `count` FROM `tbl_entries_data_" . $this->_driver->roleField() . "` WHERE `role_id` = '" . $role->id() . "'");
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($role->name(), extension_members::baseURL() . 'roles_edit/' . $role->id() . '/', NULL, 'content'));
             if (extension_Members::GUEST_ROLE_ID == $role->id()) {
                 $td2 = Widget::TableData(__('N/A'), 'inactive');
             } else {
                 $td2 = Widget::TableData(Widget::Anchor("{$member_count}", URL . '/symphony/publish/' . $section->get('handle') . '/?filter=' . $role_field_name . ':' . $role->id()));
             }
             if (!in_array($role->id(), array(extension_Members::GUEST_ROLE_ID, extension_Members::INACTIVE_ROLE_ID))) {
                 $td2->appendChild(Widget::Input("items[" . $role->id() . "]", null, 'checkbox'));
             }
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2), $bEven ? 'odd' : NULL);
             if ($role->id() != extension_Members::GUEST_ROLE_ID) {
                 $with_selected_roles[] = array("move::" . $role->id(), false, $role->name());
             }
             $bEven = !$bEven;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), 2 => array('delete-members', false, __('Delete Members')), array('delete', false, __('Delete')));
     if (count($with_selected_roles) > 0) {
         $options[1] = array('label' => __('Move Members To'), 'options' => $with_selected_roles);
     }
     ksort($options);
     $tableActions->appendChild(Widget::Select('with-selected', $options, array('id' => 'with-selected')));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
Example #16
0
 function view()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Translation Manager'))));
     $this->appendSubheading(__('Languages'), Widget::Anchor(__('Create New'), $this->_Parent->getCurrentPageURL() . 'edit/', __('Create new translation'), 'create button'));
     $link = new XMLElement('link');
     $link->setAttributeArray(array('rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen', 'href' => URL . '/extensions/translationmanager/assets/admin.css'));
     $this->addElementToHead($link, 500);
     $this->addScriptToHead(URL . '/extensions/translationmanager/assets/admin.js', 501);
     $default = $this->_tm->defaultDictionary();
     $translations = $this->_tm->listAll();
     $allextensions = $this->_Parent->ExtensionManager->listAll();
     $current = $this->_Parent->Configuration->get('lang', 'symphony');
     $warnings = array_shift($default);
     $allnames = array('symphony' => __('Symphony'));
     foreach ($allextensions as $extension => $about) {
         $allnames[$extension] = $about['name'];
     }
     $aTableHead = array(array(__('Name'), 'col'), array(__('Code'), 'col'), array(__('Extensions*'), 'col', array('title' => __('Out of %s (including Symphony)', array(count($allextensions) + 1)))), array(__('Translated*'), 'col', array('title' => __('Out of %1$s (with %2$s parser warnings)', array(count($default), count($warnings) > 0 ? count($warnings) : __('no'))))), array(__('Obsolete'), 'col'), array(__('Current'), 'col'));
     $aTableBody = array();
     if (!is_array($translations) || empty($translations)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         foreach ($translations as $lang => $extensions) {
             $language = $this->_tm->get($lang);
             $translated = array_intersect_key(array_filter($language['dictionary'], 'trim'), $default);
             $obsolete = array_diff_key($language['dictionary'], $default);
             $names = array_intersect_key($allnames, array_fill_keys($extensions, true));
             if (!$language['about']['name']) {
                 $language['about']['name'] = $lang;
             }
             $td1 = Widget::TableData(Widget::Anchor($language['about']['name'], $this->_Parent->getCurrentPageURL() . 'edit/' . $lang . '/', $lang));
             $td2 = Widget::TableData($lang);
             $td3 = Widget::TableData((string) count($extensions), NULL, NULL, NULL, array('title' => implode(', ', $names)));
             $td4 = Widget::TableData(count($translated) . ' <small>(' . floor(count($translated) / count($default) * 100) . '%)</small>');
             $td5 = Widget::TableData((string) count($obsolete));
             $td6 = Widget::TableData($lang == $current ? __('Yes') : __('No'));
             $td1->appendChild(Widget::Input('item', $lang, 'radio'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5, $td6), 'single' . ($lang == $this->_Parent->Configuration->get('lang', 'symphony') ? ' current' : ''));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'languages');
     $this->Form->appendChild($table);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')), array('switch', false, __('Make it current')), array('export', false, __('Export ZIP')));
     $div->appendChild(Widget::Select('with-selected', $options));
     $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($div);
 }
Example #17
0
 function view()
 {
     $vimeo_videos = array();
     $mode = 'view';
     if (isset($_POST['update'])) {
         $mode = 'update';
     }
     try {
         $vimeo_fields = $this->Database()->query("SELECT field_id FROM tbl_fields_vimeo_video");
         foreach ($vimeo_fields as $field) {
             $videos = $this->Database()->query(sprintf("SELECT entry_id, clip_id, title, caption, plays, user_name, user_url, thumbnail_url FROM tbl_entries_data_%d", $field->field_id));
             foreach ($videos as $video) {
                 if ($mode == 'update') {
                     VimeoHelper::updateClipInfo($video->clip_id, $field->field_id, $video->entry_id, $this->Database());
                 } else {
                     array_push($vimeo_videos, $video);
                 }
             }
         }
     } catch (Exception $e) {
         print_r($this->Database()->lastError());
         die;
     }
     if ($mode == 'update') {
         header('location: ' . URL . '/symphony/extension/vimeo_videos/videos/');
     }
     usort($vimeo_videos, array($this, 'comparePlays'));
     $this->setPageType('table');
     $this->addStylesheetToHead(URL . '/extensions/vimeo_videos/assets/vimeo_video.css', 'screen', 190);
     $this->appendSubheading(__('Vimeo Videos (ordered by most plays)'));
     $aTableHead = array(array('', 'col'), array('Plays', 'col'), array('Description', 'col'), array('User', 'col'));
     $aTableBody = array();
     if (count($vimeo_videos) == 0) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         foreach ($vimeo_videos as $video) {
             $thumbnail = Widget::TableData(Widget::Anchor('<img src="' . URL . '/image/2/75/75/5/1/' . str_replace('http://', '', $video->thumbnail_url) . '" alt="' . $video->title . '" width="75" height="75"/>', "http://vimeo.com/{$video->clip_id}/", 'View video'));
             $description = Widget::TableData("<strong>" . $video->title . "</strong><br />" . $video->caption);
             $user = Widget::TableData(Widget::Anchor($video->user_name, $video->user_url, 'View user profile'));
             $plays = Widget::TableData($video->plays);
             $aTableBody[] = Widget::TableRow(array($thumbnail, $plays, $description, $user));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $actions = new XMLElement('div');
     $actions->setAttribute('class', 'actions');
     $actions->appendChild(Widget::Input('update', __('Update video info'), 'submit'));
     $this->Form->appendChild($actions);
 }
 function __viewIndex()
 {
     $this->addStylesheetToHead(URL . '/extensions/nested_cats/assets/nested_cats.css', 'screen', 120);
     $this->addScriptToHead(URL . '/extensions/nested_cats/assets/nested_cats.js', 200);
     $this->setTitle('Symphony &ndash; Nested Cats &ndash; Overview');
     $this->setPageType('table');
     $this->appendSubheading('Overview', Widget::Anchor('Create New', URL . '/symphony/extension/nested_cats/overview/new/', 'Create a new category', 'create button'));
     $aTableHead = array(array('Title', 'col'));
     $tree = $this->_driver->getTree('lft', 0);
     $right = array($tree[0]['rgt']);
     array_shift($tree);
     if (!is_array($tree) || empty($tree)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData('None found.', 'inactive', NULL, count($aTableHead)))));
     } else {
         $tableData = array();
         foreach ($tree as $branch) {
             while ($right[count($right) - 1] < $branch['rgt']) {
                 array_pop($right);
             }
             $isBranch = $branch['rgt'] != $branch['lft'] + 1 ? true : false;
             $c = count($right) - 1;
             $class = $isBranch ? 'n' . $c . ' is_branch' : 'n' . $c;
             $tableData[] = Widget::TableData(Widget::Anchor($branch['title'], $this->_Parent->getCurrentPageURL() . 'edit/' . $branch['id'] . '/', 'Edit Category: ' . $branch['title'], $class));
             ###### With-Selected Input
             $tableData[count($tableData) - 1]->appendChild(Widget::Input('items[' . $branch['id'] . ']', NULL, 'checkbox'));
             $aTableBody[] = Widget::TableRow($tableData, $bEven ? 'even' : NULL);
             $bEven = !$bEven;
             unset($tableData);
             $right[] = $branch['rgt'];
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, 'With Selected...'), array('delete', false, 'Delete'));
     $wrapDiv = new XMLElement('div');
     $wrapDiv->appendChild(Widget::Select('with-selected', $options, array('id' => 'sel')));
     $wrapDiv->appendChild(Widget::Input('action[apply]', 'Apply', 'submit'));
     $tableActions->appendChild($wrapDiv);
     // 		$tableActions->appendChild(Widget::Select('with-selected', $options, array('id' => 'sel')));
     // 		$tableActions->appendChild(Widget::Input('action[apply]', 'Apply', 'submit'));
     $notice = new XMLElement('p', 'All categories that are decsendants of selected will be also deleted.');
     $notice->setAttribute('id', 'note');
     $notice->setAttribute('class', 'hidden');
     $tableActions->appendChild($notice);
     $this->Form->appendChild($tableActions);
 }
Example #19
0
 public function view()
 {
     $this->setPageType('table');
     $this->setTitle('Symphony &ndash; Cron');
     $this->appendSubheading('Cron Tasks', [Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a cron task'), 'create button', null, ['accesskey' => 'c'])]);
     Extension_Cron::init();
     $iterator = new Lib\CronTaskIterator(realpath(MANIFEST . '/cron'), Symphony::Database());
     $aTableHead = [['Name', 'col'], ['Description', 'col'], ['Enabled', 'col'], ['Last Executed', 'col'], ['Next Execution', 'col'], ['Last Output', 'col']];
     $aTableBody = [];
     if ($iterator->count() == 0) {
         $aTableBody = [Widget::TableRow([Widget::TableData(__('None found.'), 'inactive', null, count($aTableHead))], 'odd')];
     } else {
         foreach ($iterator as $ii => $task) {
             $td1 = Widget::TableData(Widget::Anchor($task->name, sprintf('%sedit/%s/', Administration::instance()->getCurrentPageURL(), $task->filename)));
             $td1->appendChild(Widget::Label(__('Select Task %s', [$task->filename]), null, 'accessible', null, array('for' => 'task-' . $ii)));
             $td1->appendChild(Widget::Input('items[' . $task->filename . ']', 'on', 'checkbox', array('id' => 'task-' . $ii)));
             $td2 = Widget::TableData(is_null($task->description) ? 'None' : $task->description);
             if (is_null($task->description)) {
                 $td2->setAttribute('class', 'inactive');
             }
             $td3 = Widget::TableData($task->enabledReal() == true ? 'Yes' : 'No');
             if ($task->enabled == false) {
                 $td3->setAttribute('class', 'inactive');
             }
             $td4 = Widget::TableData(!is_null($task->getLastExecutionTimestamp()) ? DateTimeObj::get(__SYM_DATETIME_FORMAT__, $task->getLastExecutionTimestamp()) : 'Unknown');
             if (is_null($task->getLastExecutionTimestamp())) {
                 $td4->setAttribute('class', 'inactive');
             }
             $td5 = Widget::TableData(!is_null($task->nextExecution()) ? self::__minutesToHumanReadable(ceil($task->nextExecution() * (1 / 60))) : 'Unknown');
             if (is_null($task->nextExecution()) || $task->enabledReal() == false) {
                 $td5->setAttribute('class', 'inactive');
             }
             if (is_null($task->getLog())) {
                 $td6 = Widget::TableData('None', 'inactive');
             } else {
                 $td6 = Widget::TableData(Widget::Anchor('view', sprintf('%slog/%s/', Administration::instance()->getCurrentPageURL(), $task->filename)));
             }
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5, $td6));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = [[null, false, __('With Selected...')], ['enable', false, __('Enable')], ['disable', false, __('Disable')], ['delete', false, __('Delete'), 'confirm', null, ['data-message' => __('Are you sure you want to delete the selected tasks?')]]];
     $tableActions->appendChild(Widget::Apply($options));
     $this->Form->appendChild($tableActions);
 }
Example #20
0
 function view()
 {
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/filemanager/assets/styles.css', 'screen', 70);
     $FileManager =& $this->_Parent->ExtensionManager->create('filemanager');
     $path = DOCROOT . $FileManager->getStartLocation() . (is_array($this->_context) && !empty($this->_context) ? '/' . implode('/', $this->_context) . '/' : NULL);
     if (is_writable($path)) {
         // Build file/dir creation menu
         $create_menu = new XMLElement('ul');
         $create_menu->setAttribute('class', 'create-menu');
         $li = new XMLElement('li');
         $li->appendChild(Widget::Anchor(__('New Directory'), extension_filemanager::baseURL() . 'new/directory/' . (is_array($this->_context) && !empty($this->_context) ? implode('/', $this->_context) . '/' : NULL), __('New Directory'), 'button create'));
         $create_menu->appendChild($li);
         $li = new XMLElement('li');
         $li->appendChild(Widget::Anchor(__('New File'), extension_filemanager::baseURL() . 'new/file/' . (is_array($this->_context) && !empty($this->_context) ? implode('/', $this->_context) . '/' : NULL), __('New File'), 'button create'));
         $create_menu->appendChild($li);
         $li = new XMLElement('li');
         $li->appendChild(Widget::Anchor(__('Upload File'), extension_filemanager::baseURL() . 'new/upload/' . (is_array($this->_context) && !empty($this->_context) ? implode('/', $this->_context) . '/' : NULL), __('Upload File'), 'button create'));
         $create_menu->appendChild($li);
     } else {
         $create_menu = new XMLElement('p', __('This directory is not writable'));
         $create_menu->setAttribute('class', 'create-menu');
     }
     $this->setPageType('table');
     $this->appendSubheading(trim($FileManager->getStartLocationLink(), '/') . (is_array($this->_context) ? $FileManager->buildBreadCrumbs($this->_context) : NULL));
     $this->Form->appendChild($create_menu);
     $Iterator = new DirectoryIterator($path);
     $aTableHead = array(array(__('Name'), 'col'), array(__('Size'), 'col'), array(__('Permissions'), 'col'), array(__('Modified'), 'col'), array(__('Available Actions'), 'col'));
     $aTableBody = array();
     if (iterator_count($Iterator) <= 0) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         foreach ($Iterator as $file) {
             if ($row = $FileManager->buildTableRow($file, $path != DOCROOT . $FileManager->getStartLocation())) {
                 $aTableBody[] = $row;
             }
         }
     }
     sort($aTableBody);
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('archive', false, __('Archive')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
Example #21
0
 public function prepareTableValue($data, XMLElement $link = NULL)
 {
     if (!is_array($data) || is_array($data) && !isset($data['relation_id'])) {
         return parent::prepareTableValue(NULL);
     }
     if (!is_array($data['relation_id'])) {
         $data['relation_id'] = array($data['relation_id']);
         $data['value'] = array($data['value']);
         $data['handle'] = array($data['handle']);
     }
     $output = NULL;
     foreach ($data['relation_id'] as $k => $v) {
         $link = Widget::Anchor($data['value'][$k], URL . '/symphony/extension/nestedcats/list/view/' . $data['relation_id'][$k]);
         $output .= $link->generate() . ' ';
     }
     return trim($output);
 }
 public function dAdminPagePreGenerate($context)
 {
     $callback = Administration::instance()->getPageCallback();
     if ($callback['context']['page'] === 'edit') {
         /** @var $cxt XMLElement */
         $cxt = $context['oPage']->Context;
         if (!$cxt instanceof XMLElement) {
             return;
         }
         $actions = $cxt->getChildByName('ul', 0);
         // append list of actions if missing
         if (!$actions instanceof XMLElement) {
             $ul = new XMLelement('ul', null, array('class' => 'actions'));
             $cxt->appendChild($ul);
             $actions = $cxt->getChildByName('ul', 0);
         }
         // fetch entries
         $section_id = SectionManager::fetchIDFromHandle($callback['context']['section_handle']);
         $section = SectionManager::fetch($section_id);
         EntryManager::setFetchSorting($section->getSortingField(), $section->getSortingOrder());
         $entries = EntryManager::fetch(null, $section_id, null, null, null, null, null, false, false);
         // get next and prev
         $entry_id = $prev_id = $next_id = $callback['context']['entry_id'];
         $count = count($entries);
         for ($i = 0; $i < $count; $i++) {
             if ($entries[$i]['id'] == $entry_id) {
                 $prev_id = $i == 0 ? $entries[$count - 1]['id'] : $entries[$i - 1]['id'];
                 $next_id = $i == $count - 1 ? $entries[0]['id'] : $entries[$i + 1]['id'];
                 break;
             }
         }
         if ($prev_id == $entry_id && $next_id == $entry_id) {
             return;
         }
         // add buttons
         $li = new XMLelement('li', null, array('class' => 'entry-nav'));
         if ($prev_id !== $entry_id) {
             $li->appendChild(Widget::Anchor(__('&larr; Previous'), SYMPHONY_URL . $callback['pageroot'] . 'edit/' . $prev_id, null, 'button entry-nav-prev', null, array('accesskey' => 'z')));
         }
         if ($next_id !== $entry_id) {
             $li->appendChild(Widget::Anchor(__('Next &rarr;'), SYMPHONY_URL . $callback['pageroot'] . 'edit/' . $next_id, null, 'button entry-nav-next', null, array('accesskey' => 'x')));
         }
         $actions->appendChild($li);
     }
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Sections'))));
     $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a section'), 'create button', NULL, array('accesskey' => 'c')));
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'));
     $aTableBody = array();
     if (!is_array($sections) || empty($sections)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         foreach ($sections as $s) {
             $entry_count = intval(Symphony::Database()->fetchVar('count', 0, "SELECT count(*) AS `count` FROM `tbl_entries` WHERE `section_id` = '" . $s->get('id') . "' "));
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($s->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$entry_count}", SYMPHONY_URL . '/publish/' . $s->get('handle') . '/'));
             $td3 = Widget::TableData($s->get('navigation_group'));
             $td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable selectable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm', null, array('data-message' => __('Are you sure you want to delete the selected sections?'))), array('delete-entries', false, __('Delete Entries'), 'confirm', null, array('data-message' => __('Are you sure you want to delete all entries in the selected sections?'))));
     if (is_array($sections) && !empty($sections)) {
         $index = 3;
         $options[$index] = array('label' => __('Set navigation group'), 'options' => array());
         $groups = array();
         foreach ($sections as $s) {
             if (in_array($s->get('navigation_group'), $groups)) {
                 continue;
             }
             $groups[] = $s->get('navigation_group');
             $value = 'set-navigation-group-' . urlencode($s->get('navigation_group'));
             $options[$index]['options'][] = array($value, false, $s->get('navigation_group'));
         }
     }
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
Example #24
0
 public function addCustomPreferenceFieldsets($context)
 {
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', 'Mailchimp'));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'group');
     $api = Widget::Label('API Key');
     $api->appendChild(Widget::Input('settings[mailchimp][key]', General::Sanitize($this->getKey())));
     $api->appendChild(new XMLElement('p', Widget::Anchor(__('Generate your API Key'), 'http://kb.mailchimp.com/article/where-can-i-find-my-api-key'), array('class' => 'help')));
     $group->appendChild($api);
     $list = Widget::Label('Default List ID');
     $list->appendChild(Widget::Input('settings[mailchimp][list]', General::Sanitize($this->getList())));
     $list->appendChild(new XMLElement('p', __('Can be overidden from the frontend'), array('class' => 'help')));
     $group->appendChild($list);
     $fieldset->appendChild($group);
     $context['wrapper']->appendChild($fieldset);
 }
 /**
  * Generates the create new functionality.
  *
  * @param XMLElement               $wrapper
  *	 The XMLElement wrapper in which the view is placed
  * @param fieldSelectBox_Link_image $field
  *	 The field instance
  */
 public function generateCreate(XMLElement &$wrapper, fieldSelectBox_Link_image $field)
 {
     if ($field->get('enable_create') == 1) {
         $related_sections = $field->findRelatedSections();
         usort($related_sections, function ($a, $b) {
             return strcasecmp($a->get('name'), $b->get('name'));
         });
         $create_options = array();
         $buttons = new XMLElement('span', __('Create new entry in'), array('class' => 'sblp-buttons'));
         foreach ($related_sections as $idx => $section) {
             /** @var $section Section */
             $create_options[] = array(SYMPHONY_URL . '/publish/' . $section->get('handle') . '/new/', $idx == 0, $section->get("name"));
         }
         $buttons->appendChild(Widget::Select('sblp_section_selector_' . $field->get('id'), $create_options, array('class' => 'sblp-section-selector')));
         $buttons->appendChild(Widget::Anchor(__("Go"), SYMPHONY_URL . '/publish/' . $related_sections[0]->get('handle') . '/new/', null, 'create button sblp-add'));
         $wrapper->appendChild($buttons);
     }
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Page Templates'))));
     $this->appendSubheading(__('Page Templates'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/pagetemplates/new/', __('Create a new page'), 'create button'));
     $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_templates` AS p\n\t\t\t\tORDER BY\n\t\t\t\t\tp.sortorder ASC\n\t\t\t");
     $aTableHead = array(array(__('Title'), 'col'), array(__('<acronym title="Universal Resource Locator">URL</acronym> Parameters'), 'col'), array(__('Type'), 'col'), array(__('Available Actions'), col));
     $aTableBody = array();
     if (!is_array($pages) or empty($pages)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', null, count($aTableHead))), 'odd'));
     } else {
         $bOdd = true;
         foreach ($pages as $page) {
             $page_title = $this->resolvePageTitle($page['id']);
             $page_url = URL . '/' . $this->resolvePagePath($page['id']) . '/';
             $page_edit_url = URL . '/symphony/extension/pagetemplates/edit/' . $page['id'] . '/';
             $page_types = $this->_Parent->Database->fetchCol('type', "SELECT `type` FROM `tbl_pages_types` WHERE page_id = '" . $page['id'] . "' ORDER BY `type` ASC");
             $col_title = Widget::TableData(Widget::Anchor($page_title, $page_edit_url, $page['handle']));
             $col_title->appendChild(Widget::Input("items[{$page['id']}]", null, 'checkbox'));
             $col_action = Widget::TableData(Widget::Anchor('New "' . $page_title . '" Page', URL . '/symphony/extension/pagetemplates/spawn/' . $page['id']));
             if ($page['params']) {
                 $col_params = Widget::TableData(trim($page['params'], '/'));
             } else {
                 $col_params = Widget::TableData(__('None'), 'inactive');
             }
             if (!empty($page_types)) {
                 $col_types = Widget::TableData(implode(', ', $page_types));
             } else {
                 $col_types = Widget::TableData(__('None'), 'inactive');
             }
             $aTableBody[] = Widget::TableRow(array($col_title, $col_params, $col_types, $col_action), $bOdd ? 'odd' : NULL);
             $bOdd = !$bOdd;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), 'orderable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
Example #27
0
 function prepareTableValue($data, XMLElement $link = NULL)
 {
     if (!is_array($data) || empty($data)) {
         return;
     }
     $value = NULL;
     if (isset($data['username']) && !is_array($data['username'])) {
         $data['username'] = array($data['username']);
         $data['member_id'] = array($data['member_id']);
     }
     if (!is_null($link)) {
         return parent::prepareTableValue(array('value' => @implode(', ', $data['username']), $link));
     }
     foreach ($data['username'] as $index => $username) {
         $a = Widget::Anchor($username, URL . '/symphony/publish/' . self::$_driver->memberSectionHandle() . '/edit/' . $data['member_id'][$index] . '/', "Edit Member '{$username}'");
         $value .= $a->generate() . ', ';
     }
     return trim($value, ', ');
 }
 public function __viewIndex()
 {
     // Set the page to display as a table:
     $this->setPageType('table');
     $this->appendSubheading(__('Author Roles'), Widget::Anchor(__('Create New'), $this->_uri . 'roles/new/', __('Create a new role'), 'create button'));
     // Set the table head:
     $tableHead = array(array(__('Role Name'), 'col'), array(__('Authors with this role'), 'col'));
     // Set the table body:
     $tableBody = array();
     // Fill the table with available roles:
     $roles = $this->_driver->getRoles();
     if (empty($roles)) {
         // No roles found, create an empty row:
         $tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
     } else {
         foreach ($roles as $role) {
             $row = new XMLElement('tr');
             $td = new XMLElement('td', '<a href="' . $this->_url . 'roles/edit/' . $role['id'] . '/">' . $role['name'] . '</a>');
             $td->appendChild(Widget::Input('items[' . $role['id'] . ']', NULL, 'checkbox'));
             $row->appendChild($td);
             // Authors:
             $authors = $this->_driver->getAuthors($role['id']);
             if (empty($authors)) {
                 $row->appendChild(new XMLElement('td', '<em>none</em>'));
             } else {
                 $links = array();
                 foreach ($authors as $author) {
                     $links[] = '<a href="' . URL . '/symphony/system/authors/edit/' . $author['id'] . '/">' . $author['first_name'] . ' ' . $author['last_name'] . '</a>';
                 }
                 $row->appendChild(new XMLElement('td', implode(', ', $links)));
             }
             $tableBody[] = $row;
         }
     }
     // Create the table element:
     $table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody), 'selectable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm', null, array('data-message' => __('Are you sure you want to delete the selected roles?'))));
     $tableActions->appendChild(Widget::Apply($options));
     $this->Form->appendChild($tableActions);
 }
 public function __viewEdit()
 {
     $this->doTheEdit();
     if (!($role_id = $this->_context[1])) {
         redirect(Extension_Sections_Event::baseURL() . 'permissions/');
     }
     if (!($existing = RoleManager::fetch($role_id))) {
         throw new SymphonyErrorPage(__('The role you requested to edit does not exist.'), __('Role not found'), 'error');
     }
     // check if sections exist
     $sections = SectionManager::fetch();
     if (!is_array($sections) || empty($sections)) {
         return $this->Form->appendChild($this->buildErrorMessage(__('No sections found. <a href="%s">Create a new one?</a>', array(SYMPHONY_URL . '/blueprints/sections/new/'))));
     }
     // Add in custom assets
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/sections_event/assets/sections_event.permissions_single.css', 'screen', 111);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/sections_event/assets/sections_event.permissions_single.js', 114);
     // Append any Page Alerts from the form's
     if (isset($this->_context[2])) {
         switch ($this->_context[2]) {
             case 'saved':
                 $this->pageAlert(__('Role permissions updated at %1$s. <a href="%2$s" accesskey="a">View all Roles</a>', array($time = Widget::Time('', __SYM_TIME_FORMAT__)->generate(), Extension_Sections_Event::baseURL() . 'permissions/')), Alert::SUCCESS);
                 break;
         }
     }
     $this->setPageType('form');
     $this->setTitle(__('Symphony &ndash; Section permissions &ndash; ') . $existing->get('name'));
     $this->appendSubheading($existing->get('name'));
     if (isset($_POST['permissions'])) {
         $permissions = $_POST['permissions'];
     } else {
         $permissions = array();
         $permissions['fields'] = SE_PerMan::getCrud('field')->fetchAll($role_id);
         $permissions['sections'] = SE_PerMan::getCrud('section')->fetchAll($role_id);
     }
     $this->insertBreadcrumbs(array(Widget::Anchor(__('Section permissions'), Extension_Sections_Event::baseURL() . 'permissions/')));
     $div = new XMLElement('div', null, array('class' => 'permissions clearfix'));
     $div->appendChild($this->buildSectionPermissions($role_id, $permissions));
     $div->appendChild($this->buildFieldPermissions($role_id, $permissions));
     $this->Form->appendChild($div);
     $this->Form->appendChild($this->buildActions());
 }
 function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Extensions'))));
     $this->appendSubheading(__('Extensions'));
     $this->Form->setAttribute('action', URL . '/symphony/system/extensions/');
     $ExtensionManager = $this->_Parent->ExtensionManager;
     $extensions = $ExtensionManager->listAll();
     ## Sort by extensions name:
     uasort($extensions, array('ExtensionManager', 'sortByName'));
     $aTableHead = array(array(__('Name'), 'col'), array(__('Enabled'), 'col'), array(__('Version'), 'col'), array(__('Author'), 'col'));
     $aTableBody = array();
     if (!is_array($extensions) || empty($extensions)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         foreach ($extensions as $name => $about) {
             ## Setup each cell
             $td1 = Widget::TableData(!empty($about['table-link']) && $about['status'] == EXTENSION_ENABLED ? Widget::Anchor($about['name'], $this->_Parent->getCurrentPageURL() . 'extension/' . trim($about['table-link'], '/') . '/') : $about['name']);
             $td2 = Widget::TableData($about['status'] == EXTENSION_ENABLED ? __('Yes') : __('No'));
             $td3 = Widget::TableData($about['version']);
             $link = $about['author']['name'];
             if (isset($about['author']['website'])) {
                 $link = Widget::Anchor($about['author']['name'], General::validateURL($about['author']['website']));
             } elseif (isset($about['author']['email'])) {
                 $link = Widget::Anchor($about['author']['name'], 'mailto:' . $about['author']['email']);
             }
             $td4 = Widget::TableData($link);
             $td4->appendChild(Widget::Input('items[' . $name . ']', 'on', 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4), $about['status'] == EXTENSION_NOT_INSTALLED ? 'inactive' : NULL);
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('enable', false, __('Enable')), array('disable', false, __('Disable')), array('uninstall', false, __('Uninstall'), 'confirm'));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }