public function __viewIndex() { $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Utilities')))); $this->appendSubheading(__('Utilities'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new utility'), 'class' => 'create button'))); $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES); $utilities = $utilities['filelist']; $uTableHead = array(array(__('Name'), 'col')); $uTableBody = array(); $colspan = count($uTableHead); if (!is_array($utilities) or empty($utilities)) { $uTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd'))); } else { foreach ($utilities as $util) { $uRow = Widget::TableData(Widget::Anchor($util, ADMIN_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/')); $uRow->appendChild(Widget::Input("items[{$util}]", null, 'checkbox')); $uTableBody[] = Widget::TableRow(array($uRow)); } } $table = Widget::Table(Widget::TableHead($uTableHead), null, Widget::TableBody($uTableBody), array('id' => 'utilities-list')); $this->Form->appendChild($table); $tableActions = $this->createElement('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); }
function __viewIndex() { $link = new XMLElement('link'); $this->addElementToHead($link, 500); $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Configuration')))); $this->setPageType('table'); $this->appendSubheading(__('Configuration')); ## Table Headings $aTableHead = array(array('Group', 'col'), array('Setting', 'col'), array('Value', 'col')); ## Get Configuration Settings and display as a table list $config_settings = Symphony::Configuration()->get(); $tableData = array(); foreach ($config_settings as $key => $groups) { foreach ($groups as $name => $value) { $setting_group = $key; $setting_name = $name; $setting_value = $value; $tableData[] = Widget::TableData($setting_group); $tableData[] = Widget::TableData($setting_name); $tableData[] = Widget::TableData($setting_value); $aTableBody[] = Widget::TableRow($tableData, $bEven ? 'even' : NULL); $bEven = !$bEven; unset($tableData); } } $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody)); $this->Form->appendChild($table); ## Edit Button $tableActions = new XMLElement('div'); $tableActions->setAttribute('class', 'actions'); $tableActions->appendChild(Widget::Input('action[edit]', __('Edit Settings'), 'submit')); $this->Form->appendChild($tableActions); }
public function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %2$s', array(__('Utilities'), __('Symphony')))); $this->appendSubheading(__('Utilities'), Widget::Anchor(__('Create New'), SYMPHONY_URL . '/blueprints/utilities/new/', __('Create a new utility'), 'create button')); $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES); $utilities = $utilities['filelist']; $aTableHead = array(array(__('Name'), 'col')); $aTableBody = array(); if (!is_array($utilities) || empty($utilities)) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd')); } else { foreach ($utilities as $u) { $name = Widget::TableData(Widget::Anchor($u, SYMPHONY_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $u) . '/')); $name->appendChild(Widget::Input('items[' . $u . ']', null, 'checkbox')); $aTableBody[] = Widget::TableRow(array($name)); } } $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable'); $this->Form->appendChild($table); $tableActions = new XMLElement('div'); $tableActions->setAttribute('class', 'actions'); $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm')); $tableActions->appendChild(Widget::Apply($options)); $this->Form->appendChild($tableActions); }
public function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %2$s', array(__('Sections'), __('Symphony')))); $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a section'), 'create button', NULL, array('accesskey' => 'c'))); $sections = SectionManager::fetch(NULL, 'ASC', 'sortorder'); $aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col')); $aTableBody = array(); if (!is_array($sections) || empty($sections)) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd')); } else { foreach ($sections as $s) { $entry_count = EntryManager::fetchCount($s->get('id')); // Setup each cell $td1 = Widget::TableData(Widget::Anchor($s->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content')); $td2 = Widget::TableData(Widget::Anchor("{$entry_count}", SYMPHONY_URL . '/publish/' . $s->get('handle') . '/')); $td3 = Widget::TableData($s->get('navigation_group')); $td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', 'checkbox')); // Add a row to the body array, assigning each cell to the row $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3)); } } $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable selectable'); $this->Form->appendChild($table); $tableActions = new XMLElement('div'); $tableActions->setAttribute('class', 'actions'); $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm', null, array('data-message' => __('Are you sure you want to delete the selected sections?'))), array('delete-entries', false, __('Delete Entries'), 'confirm', null, array('data-message' => __('Are you sure you want to delete all entries in the selected sections?')))); if (is_array($sections) && !empty($sections)) { $index = 3; $options[$index] = array('label' => __('Set navigation group'), 'options' => array()); $groups = array(); foreach ($sections as $s) { if (in_array($s->get('navigation_group'), $groups)) { continue; } $groups[] = $s->get('navigation_group'); $value = 'set-navigation-group-' . urlencode($s->get('navigation_group')); $options[$index]['options'][] = array($value, false, $s->get('navigation_group')); } } /** * Allows an extension to modify the existing options for this page's * With Selected menu. If the `$options` parameter is an empty array, * the 'With Selected' menu will not be rendered. * * @delegate AddCustomActions * @since Symphony 2.3.2 * @param string $context * '/blueprints/sections/' * @param array $options * An array of arrays, where each child array represents an option * in the With Selected menu. Options should follow the same format * expected by `Widget::__SelectBuildOption`. Passed by reference. */ Symphony::ExtensionManager()->notifyMembers('AddCustomActions', '/blueprints/sections/', array('options' => &$options)); if (!empty($options)) { $tableActions->appendChild(Widget::Apply($options)); $this->Form->appendChild($tableActions); } }
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); }
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); }
/** * 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)); }
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); }
public function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %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); }
public function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('RestEngine Settings')))); $this->appendSubheading(__('RestEngine API Resources'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Associate a Symphony page with a REST API section'), 'create button', NULL, array('accesskey' => 'c'))); $pageMapping = RestResourceManager::fetch(); //$pageMapping = array(); $TableHead = array(array(__('Page'), 'col'), array(__('Resource Base URL'), 'col'), array(__('Section'), 'col'), array(__('Unique ID Field'), 'col'), array(__('Unique ID URL Parameter'), 'col'), array(__('Format URL Parameter'), 'col')); $TableBody = array(); if (!is_array($pageMapping) || empty($pageMapping)) { $TableBody = array(Widget::TableRow(array(Widget::TableData(__('There are currently no RestEngine API pages. Click Crete New above to add one.'), 'inactive', NULL, count($TableHead))))); } else { foreach ($pageMapping as $page) { $pageTd = Widget::TableData(Widget::Anchor($page->get('page_title'), Administration::instance()->getCurrentPageURL() . 'edit/' . $page->get('id') . '/', null, 'content')); $resourceURL = Widget::TableData(Widget::Anchor($page->get('page_uri'), $page->get('page_uri'), null)); $sectionTd = Widget::TableData($page->get('section_name')); $fieldTd = Widget::TableData($page->get('field_name')); $uidParamTd = Widget::TableData($page->get('uid_parameter')); $formatParamTd = Widget::TableData($page->get('format_parameter')); $TableBody[] = Widget::TableRow(array($pageTd, $resourceURL, $sectionTd, $fieldTd, $uidParamTd, $formatParamTd)); } } $table = Widget::Table(Widget::TableHead($TableHead), NULL, Widget::TableBody($TableBody), 'selectable'); $this->Form->appendChild($table); $tableActions = new XMLElement('div'); $tableActions->setAttribute('class', 'actions'); $options = array(0 => array(null, false, __('With Selected...')), 1 => array('delete', false, __('Delete'), 'confirm')); $tableActions->appendChild(Widget::Apply($options)); $this->Form->appendChild($tableActions); }
public function __viewIndex() { $this->setTitle(__('Symphony') . ' – ' . __('Users')); $this->appendSubheading(__('Users'), Widget::Anchor(__('Add a User'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Add a new User'), 'class' => 'create button'))); $users = new UserIterator(); $aTableHead = array(array(__('Name'), 'col'), array(__('Email Address'), 'col'), array(__('Last Seen'), 'col')); $aTableBody = array(); $colspan = count($aTableHead); if ($users->length() == 0) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd'))); } else { foreach ($users as $u) { ## Setup each cell $td1 = Widget::TableData(Widget::Anchor($u->getFullName(), Administration::instance()->getCurrentPageURL() . '/edit/' . $u->id . '/', array('title' => $u->username))); $td2 = Widget::TableData(Widget::Anchor($u->email, 'mailto:' . $u->email, array('title' => 'Email this user'))); if ($u->last_seen != NULL) { $td3 = Widget::TableData(DateTimeObj::get(__SYM_DATETIME_FORMAT__, strtotime($u->last_seen))); } else { $td3 = Widget::TableData('Unknown', array('class' => 'inactive')); } $td3->appendChild(Widget::Input('items[' . $u->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); $tableActions = $this->createElement('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); }
public function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %2$s', array(__('Authors'), __('Symphony')))); if (Administration::instance()->Author->isDeveloper()) { $this->appendSubheading(__('Authors'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a new author'), 'create button', NULL, array('accesskey' => 'c'))); } else { $this->appendSubheading(__('Authors')); } Sortable::initialize($this, $authors, $sort, $order); $columns = array(array('label' => __('Name'), 'sortable' => true, 'handle' => 'name'), array('label' => __('Email Address'), 'sortable' => true, 'handle' => 'email'), array('label' => __('Last Seen'), 'sortable' => true, 'handle' => 'last_seen')); if (Administration::instance()->Author->isDeveloper()) { $columns = array_merge($columns, array(array('label' => __('User Type'), 'sortable' => true, 'handle' => 'user_type'), array('label' => __('Language'), 'sortable' => true, 'handle' => 'language'))); } $aTableHead = Sortable::buildTableHeaders($columns, $sort, $order, isset($_REQUEST['filter']) ? '&filter=' . $_REQUEST['filter'] : ''); $aTableBody = array(); if (!is_array($authors) || empty($authors)) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd')); } else { foreach ($authors as $a) { // Setup each cell if (Administration::instance()->Author->isDeveloper() || Administration::instance()->Author->get('id') == $a->get('id')) { $td1 = Widget::TableData(Widget::Anchor($a->getFullName(), Administration::instance()->getCurrentPageURL() . 'edit/' . $a->get('id') . '/', $a->get('username'), 'author')); } else { $td1 = Widget::TableData($a->getFullName(), 'inactive'); } $td2 = Widget::TableData(Widget::Anchor($a->get('email'), 'mailto:' . $a->get('email'), __('Email this author'))); if (!is_null($a->get('last_seen'))) { $td3 = Widget::TableData(DateTimeObj::format($a->get('last_seen'), __SYM_DATETIME_FORMAT__)); } else { $td3 = Widget::TableData(__('Unknown'), 'inactive'); } $td4 = Widget::TableData($a->isDeveloper() ? __("Developer") : __("Author")); $languages = Lang::getAvailableLanguages(); $td5 = Widget::TableData($a->get("language") == NULL ? __("System Default") : $languages[$a->get("language")]); if (Administration::instance()->Author->isDeveloper()) { if ($a->get('id') != Administration::instance()->Author->get('id')) { $td3->appendChild(Widget::Input('items[' . $a->get('id') . ']', NULL, 'checkbox')); } } // Add a row to the body array, assigning each cell to the row if (Administration::instance()->Author->isDeveloper()) { $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5)); } else { $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3)); } } } $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable'); $this->Form->appendChild($table); if (Administration::instance()->Author->isDeveloper()) { $tableActions = new XMLElement('div'); $tableActions->setAttribute('class', 'actions'); $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm', null, array('data-message' => __('Are you sure you want to delete the selected authors?')))); $tableActions->appendChild(Widget::Apply($options)); $this->Form->appendChild($tableActions); } }
public function view() { //Page options $this->setPageType('table'); $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Campaign Monitor Subscribers')))); $this->appendSubheading(__('Campaign Monitor Subscribers')); //Form action $this->Form->setAttribute('action', $this->_Parent->getCurrentPageURL()); //Get Campaign Monitor preferences $api_key = $this->_Parent->Configuration->get('api_key', 'campaign_monitor'); $list_id = $this->_Parent->Configuration->get('list_id', 'campaign_monitor'); //New Campaign Monitor instance $cm = new CampaignMonitor($api_key); //Get subscriber list $result = $cm->subscribersGetActive(0, $list_id); $subscribers = $result['anyType']['Subscriber']; //Subscriber table headers $aTableHead = array(array(__('Name'), 'col'), array(__('Email Address'), 'col'), array(__('Date Subscribed'), 'col'), array(__('Status'), 'col')); $aTableBody = array(); if (!is_array($subscribers) || empty($subscribers)) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('You currently have no subscribers.'), 'inactive', NULL, count($aTableHead))), 'odd')); } else { if (is_array($subscribers[0])) { //Check if the subscriber list is longer than one, in which case it's an array of arrays foreach ($subscribers as $subscriber) { $td1 = Widget::TableData($subscriber["Name"]); $td2 = Widget::TableData($subscriber["EmailAddress"]); $td2->appendChild(Widget::Input('items[' . $subscriber["EmailAddress"] . ']', 'on', 'checkbox')); $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscriber["Date"]))); $td4 = Widget::TableData($subscriber["State"]); //Add table data to row and body $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4)); } } else { //Single subscriber $td1 = Widget::TableData($subscribers["Name"]); $td2 = Widget::TableData($subscribers["EmailAddress"]); $td2->appendChild(Widget::Input('items[' . $subscribers["EmailAddress"] . ']', 'on', 'checkbox')); $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscribers["Date"]))); $td4 = Widget::TableData($subscribers["State"]); //Add table data to row and body $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4)); } } $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable'); //Append the subscriber table to the page $this->Form->appendChild($table); //Actions for this page $tableActions = new XMLElement('div'); $tableActions->setAttribute('class', 'actions'); $options = array(array(NULL, false, __('With Selected...')), array('unsubscribe', false, __('Unsubscribe'))); $tableActions->appendChild(Widget::Select('with-selected', $options)); $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit')); //Append actions to the page $this->Form->appendChild($tableActions); }
function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %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); } }
public function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Pages')))); $this->appendSubheading(__('Pages'), Widget::Anchor(__('Create New'), $this->_Parent->getCurrentPageURL() . '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` 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(__('Template'), 'col'), array(__('<acronym title="Universal Resource Locator">URL</acronym>'), 'col'), array(__('<acronym title="Universal Resource Locator">URL</acronym> Parameters'), 'col'), array(__('Type'), '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) { $class = array(); $page_title = $this->_Parent->resolvePageTitle($page['id']); $page_url = URL . '/' . $this->_Parent->resolvePagePath($page['id']) . '/'; $page_edit_url = $this->_Parent->getCurrentPageURL() . 'edit/' . $page['id'] . '/'; $page_template = $this->__createHandle($page['path'], $page['handle']); $page_template_url = $this->_Parent->getCurrentPageURL() . 'template/' . $page_template . '/'; $page_types = $this->_Parent->Database->fetchCol('type', "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tt.type\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_pages_types` AS t\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tt.page_id = '" . $page['id'] . "'\n\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\tt.type ASC\n\t\t\t\t\t"); $col_title = Widget::TableData(Widget::Anchor($page_title, $page_edit_url, $page['handle'])); $col_title->appendChild(Widget::Input("items[{$page['id']}]", null, 'checkbox')); $col_template = Widget::TableData(Widget::Anchor($page_template . '.xsl', $page_template_url)); $col_url = Widget::TableData(Widget::Anchor($page_url, $page_url)); 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'); } if ($bOdd) { $class[] = 'odd'; } if (in_array($page['id'], $this->_hilights)) { $class[] = 'failed'; } $aTableBody[] = Widget::TableRow(array($col_title, $col_template, $col_url, $col_params, $col_types), implode(' ', $class)); $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); }
function view() { $this->setPageType('table'); $this->setTitle(__('%1$s – %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); }
public function view() { parent::view(FALSE); if (isset($this->mode)) { $section = $this->mode; header('Content-Type: application/json'); echo file_get_contents(WORKSPACE . '/elasticsearch/mappings/' . $section . '.json'); die; } $this->addScriptToHead(URL . '/extensions/elasticsearch/assets/elasticsearch.mappings.js', 101); $this->addStylesheetToHead(URL . '/extensions/elasticsearch/assets/elasticsearch.mappings.css', 'screen', 102); $this->setPageType('table'); $this->setTitle(__('Symphony') . ' – ' . __('ElasticSearch') . ' – ' . __('Mappings')); $this->appendSubheading(__('Mappings')); $types = ElasticSearch::getAllTypes(); $tableHead = array(); $tableBody = array(); $tableHead[] = array(__('Section'), 'col'); $tableHead[] = array(__('Mapped Fields'), 'col'); $tableHead[] = array(__('Mapping JSON'), 'col'); $tableHead[] = array(__('Entries'), 'col'); if (!is_array($types) or empty($types)) { $tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead))))); } else { foreach ($types as $type) { $col_name = Widget::TableData($type->section->get('name')); $col_name->appendChild(Widget::Input('items[' . $type->section->get('handle') . ']', NULL, 'checkbox')); $col_fields = Widget::TableData(implode(', ', $type->fields)); $col_json = Widget::TableData(sprintf('<a href="%s">%s.json</a>', $type->section->get('handle'), $type->section->get('handle'))); if ($type->type) { $count = $type->type->count(); $col_count = Widget::TableData('<span id="reindex-' . $type->section->get('handle') . '">' . (string) $count . ' ' . ($count == 1 ? 'entry' : 'entries') . '</span>', $count_class . ' count-column'); } else { $col_count = Widget::TableData('Rebuild mapping before continuing', $count_class . ' count-column inactive'); } $attributes = array('data-handle' => $type->section->get('handle')); if (in_array($type->section->get('handle'), $this->reindex) && $type->type) { $attributes['data-reindex'] = 'yes'; } $tableBody[] = Widget::TableRow(array($col_name, $col_fields, $col_json, $col_count), NULL, NULL, NULL, $attributes); } } $table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody), 'selectable'); $this->Form->appendChild($table); $actions = new XMLElement('div'); $actions->setAttribute('class', 'actions'); $options = array(array(null, false, __('With Selected...')), array('reindex', false, __('Reindex Entries')), array('rebuild', false, __('Rebuild Mapping')), array('delete', false, __('Delete Mapping'))); $actions->appendChild(Widget::Apply($options)); $this->Form->appendChild($actions); }
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); }
public function view() { $this->setPageType('table'); $this->setTitle('Symphony – Cron'); $this->appendSubheading('Cron Tasks', [Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a cron task'), 'create button', null, ['accesskey' => 'c'])]); Extension_Cron::init(); $iterator = new Lib\CronTaskIterator(realpath(MANIFEST . '/cron'), Symphony::Database()); $aTableHead = [['Name', 'col'], ['Description', 'col'], ['Enabled', 'col'], ['Last Executed', 'col'], ['Next Execution', 'col'], ['Last Output', 'col']]; $aTableBody = []; if ($iterator->count() == 0) { $aTableBody = [Widget::TableRow([Widget::TableData(__('None found.'), 'inactive', null, count($aTableHead))], 'odd')]; } else { foreach ($iterator as $ii => $task) { $td1 = Widget::TableData(Widget::Anchor($task->name, sprintf('%sedit/%s/', Administration::instance()->getCurrentPageURL(), $task->filename))); $td1->appendChild(Widget::Label(__('Select Task %s', [$task->filename]), null, 'accessible', null, array('for' => 'task-' . $ii))); $td1->appendChild(Widget::Input('items[' . $task->filename . ']', 'on', 'checkbox', array('id' => 'task-' . $ii))); $td2 = Widget::TableData(is_null($task->description) ? 'None' : $task->description); if (is_null($task->description)) { $td2->setAttribute('class', 'inactive'); } $td3 = Widget::TableData($task->enabledReal() == true ? 'Yes' : 'No'); if ($task->enabled == false) { $td3->setAttribute('class', 'inactive'); } $td4 = Widget::TableData(!is_null($task->getLastExecutionTimestamp()) ? DateTimeObj::get(__SYM_DATETIME_FORMAT__, $task->getLastExecutionTimestamp()) : 'Unknown'); if (is_null($task->getLastExecutionTimestamp())) { $td4->setAttribute('class', 'inactive'); } $td5 = Widget::TableData(!is_null($task->nextExecution()) ? self::__minutesToHumanReadable(ceil($task->nextExecution() * (1 / 60))) : 'Unknown'); if (is_null($task->nextExecution()) || $task->enabledReal() == false) { $td5->setAttribute('class', 'inactive'); } if (is_null($task->getLog())) { $td6 = Widget::TableData('None', 'inactive'); } else { $td6 = Widget::TableData(Widget::Anchor('view', sprintf('%slog/%s/', Administration::instance()->getCurrentPageURL(), $task->filename))); } $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5, $td6)); } } $table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive')); $this->Form->appendChild($table); $tableActions = new XMLElement('div'); $tableActions->setAttribute('class', 'actions'); $options = [[null, false, __('With Selected...')], ['enable', false, __('Enable')], ['disable', false, __('Disable')], ['delete', false, __('Delete'), 'confirm', null, ['data-message' => __('Are you sure you want to delete the selected tasks?')]]]; $tableActions->appendChild(Widget::Apply($options)); $this->Form->appendChild($tableActions); }
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 – Nested Cats – 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); }
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); }
public function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %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); }
private function __indexPage() { $versioning = new DIM_Versioning(); $link = new XMLElement('link'); $this->addElementToHead($link, 500); $this->setPageType('table'); $this->appendSubheading(__('DIM Log')); $aTableHead = array(array("Text", "col"), array("Type", "col"), array("Timestamp", "col")); $logger = new DIM_Logger(); $aTableBody = array(); foreach ($logger->readLog() as $i) { $td1 = Widget::TableData($i["text"]); $td2 = Widget::TableData($i["class"]); $td3 = Widget::TableData($i["timestamp"]); $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3)); } $this->Form->appendChild(Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), "")); }
function view() { $this->setPageType('table'); $heading = new XMLElement('h2', 'Data Source Cache'); $this->Form->appendChild($heading); $aTableHead = array(array('Data Source', 'col'), array('Cache files', 'col'), array('Cache size', 'col')); $dsm = new DatasourceManager($this->_Parent); $datasources = $dsm->listAll(); $cachedata = $this->driver->buildCacheFileList(); $aTableBody = array(); if (!is_array($datasources) || empty($datasources)) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead))))); } else { $bEven = false; foreach ($datasources as $ds) { $datasource = $dsm->create($ds['handle']); if (isset($datasource->dsParamCACHE) && is_numeric($datasource->dsParamCACHE) && $datasource->dsParamCACHE > 0 && is_numeric($datasource->getSource())) { $name = Widget::TableData($ds['name']); $name->appendChild(Widget::Input("items[{$ds['handle']}]", null, 'checkbox')); $files = Widget::TableData(isset($cachedata[$ds['handle']]['count']) ? $cachedata[$ds['handle']]['count'] : '0'); if (isset($cachedata[$ds['handle']]['size'])) { if ($cachedata[$ds['handle']]['size'] < 1024) { $size_str = $cachedata[$ds['handle']]['size'] . "b"; } else { $size_str = floor($cachedata[$ds['handle']]['size'] / 1024) . "kb"; } } else { $size_str = "0kb"; } $size = Widget::TableData($size_str); $aTableBody[] = Widget::TableRow(array($name, $files, $size), $bEven ? 'even' : NULL); $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...')), array('clear', false, __('Clear Cache'))); $tableActions->appendChild(Widget::Select('with-selected', $options)); $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit')); $this->Form->appendChild($tableActions); }
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); }
function __viewIndex() { $this->setPageType('table'); $this->setTitle(__('%1$s – %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); }
public function __viewIndex() { $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Sections')))); $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new section'), 'class' => 'create button'))); $sections = new SectionIterator(); $aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'), array(__('Sync Status'), 'col')); $aTableBody = array(); $colspan = count($aTableHead); if ($sections->length() <= 0) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd'))); } else { foreach ($sections as $s) { $entry_count = 0; $result = Symphony::Database()->query("\n\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\tcount(*) AS `count`\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t`tbl_entries` AS e\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\te.section = '%s'\n\t\t\t\t\t\t", array($s->handle)); if ($result->valid()) { $entry_count = (int) $result->current()->count; } // Setup each cell $td1 = Widget::TableData(Widget::Anchor($s->name, Administration::instance()->getCurrentPageURL() . "/edit/{$s->handle}/", array('class' => 'content'))); $td2 = Widget::TableData(Widget::Anchor((string) $entry_count, ADMIN_URL . "/publish/{$s->handle}/")); $td3 = Widget::TableData($s->{'navigation-group'}); $td3->appendChild(Widget::Input("items[{$s->handle}]", 'on', 'checkbox')); if (Section::syncroniseStatistics($s)->synced) { $td4 = Widget::TableData(__('Synced'), array('class' => 'content inactive')); } else { $td4 = Widget::TableData(__('Not synced'), array('class' => 'content')); } // 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)); $table->setAttribute('id', 'sections-list'); $this->Form->appendChild($table); $tableActions = $this->createElement('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); }
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 email template', extension_members::baseURL() . 'email_templates_new/', 'Create a new email template', 'create button'); $this->setPageType('table'); $this->appendSubheading('Email Templates ' . $create_button->generate(false)); $aTableHead = array(array('Subject', 'col'), array('Type', 'col'), array('Roles', 'col')); $iterator = new EmailTemplateIterator(); $aTableBody = array(); if ($iterator->length() == 0) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead))))); } else { $bEven = true; foreach ($iterator as $e) { $td1 = Widget::TableData(Widget::Anchor($e->subject, extension_members::baseURL() . 'email_templates_edit/' . $e->id . '/', NULL, 'content')); $td2 = Widget::TableData($e->type); if (count($e->roles()) > 0) { $links = array(); foreach ($e->roles() as $role_id => $r) { $links[] = Widget::Anchor($r->name(), extension_members::baseURL() . 'roles_edit/' . $r->id() . '/', 'Edit this role.')->generate(); } $td3 = Widget::TableData(implode(', ', $links)); } else { $td3 = Widget::TableData('None', 'inactive'); } $td3->appendChild(Widget::Input("items[{$e->id}]", null, 'checkbox')); ## Add a row to the body array, assigning each cell to the row $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), $bEven ? 'odd' : NULL); $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...')), array('delete', false, __('Delete'))); $tableActions->appendChild(Widget::Select('with-selected', $options, array('id' => 'with-selected'))); $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit')); $this->Form->appendChild($tableActions); }
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))))); } elseif (!$this->_driver->memberSectionID()) { $this->pageAlert(__('You must set a section in <a href="%1$s">Member Preferences?</a>', array(extension_members::baseURL() . 'preferences/')), Alert::ERROR); $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())); $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); $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...')), array('delete-members', false, __('Delete Members'))); $tableActions->appendChild(Widget::Select('with-selected', $options)); $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit')); $this->Form->appendChild($tableActions); }
public function view() { // Start building the page $this->setPageType('table'); $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Documentation')))); $this->appendSubheading(__('Documentation'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/documenter/new/', __('Create a new documentation item'), 'create button')); // Grab all the documentation items $docs = Symphony::Database()->fetch("\n\t\t\t\tSELECT\n\t\t\t\t\td.*\n\t\t\t\tFROM\n\t\t\t\t\t`tbl_documentation` AS d\n\t\t\t\tORDER BY\n\t\t\t\t\td.pages ASC\n\t\t\t"); // Build the table $thead = array(array(__('Title'), 'col'), array(__('Pages'), 'col')); $tbody = array(); // If there are no records, display default message if (!is_array($docs) or empty($docs)) { $tbody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', null, count($thead))), 'odd')); } else { $bOdd = true; foreach ($docs as $doc) { $doc_edit_url = URL . '/symphony/extension/documenter/edit/' . $doc['id'] . '/'; $col_title = Widget::TableData(Widget::Anchor($doc['title'], $doc_edit_url)); $col_title->appendChild(Widget::Input("items[{$doc['id']}]", null, 'checkbox')); $pages = $doc['pages']; $pages = explode(',', $pages); $pages = join(', ', $pages); $col_pages = Widget::TableData($pages); $tbody[] = Widget::TableRow(array($col_title, $col_pages), $bOdd ? 'odd' : NULL); $bOdd = !$bOdd; } } $table = Widget::Table(Widget::TableHead($thead), null, Widget::TableBody($tbody), null); $table->setAttribute('class', 'selectable'); $this->Form->appendChild($table); $actions = new XMLElement('div'); $actions->setAttribute('class', 'actions'); $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete'))); $actions->appendChild(Widget::Apply($options)); $this->Form->appendChild($actions); }