本文整理汇总了PHP中Widget::TableData方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::TableData方法的具体用法?PHP Widget::TableData怎么用?PHP Widget::TableData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::TableData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __viewIndex
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);
}
示例2: __viewIndex
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);
}
示例3: view
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);
}
示例4: __viewIndex
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);
}
}
示例5: __viewIndex
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);
}
示例6: __viewIndex
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);
}
示例7: createViewPageFieldsRowForPage
/**
* 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));
}
示例8: view
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);
}
示例9: __viewIndex
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);
}
示例10: __viewIndex
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);
}
示例11: __viewIndex
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);
}
示例12: __viewIndex
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);
}
}
示例13: __viewIndex
public function __viewIndex()
{
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Events'))));
$this->appendSubheading(__('Events'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new event'), 'class' => 'create button')));
$eTableHead = array(array(__('Name'), 'col'), array(__('Destination'), 'col'), array(__('Type'), 'col'), array(__('Used By'), 'col'));
$eTableBody = array();
$colspan = count($eTableHead);
$iterator = new EventIterator();
if (!$iterator->valid()) {
$eTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd')));
} else {
// Load Views so we can determine what Datasources are attached
if (!self::$_loaded_views) {
foreach (new ViewIterator() as $view) {
self::$_loaded_views[$view->guid] = array('title' => $view->title, 'handle' => $view->handle, 'events' => $view->{'events'});
}
}
foreach ($iterator as $pathname) {
$event = Event::load($pathname);
$view_mode = $event->allowEditorToParse() == true ? 'edit' : 'info';
$handle = Event::getHandleFromFilename($pathname);
$col_name = Widget::TableData(Widget::Anchor($event->about()->name, ADMIN_URL . "/blueprints/events/{$view_mode}/{$handle}/", array('title' => $event->parameters()->pathname)));
$col_name->appendChild(Widget::Input("items[{$handle}]", null, 'checkbox'));
// Destination
$col_destination = $event->prepareDestinationColumnValue();
// Used By
$fragment_views = $this->createDocumentFragment();
foreach (self::$_loaded_views as $view) {
if (is_array($view['events']) && in_array($handle, $view['events'])) {
if ($fragment_views->hasChildNodes()) {
$fragment_views->appendChild(new DOMText(', '));
}
$fragment_views->appendChild(Widget::Anchor($view['title'], ADMIN_URL . "/blueprints/views/edit/{$view['handle']}/"));
}
}
if (!$fragment_views->hasChildNodes()) {
$col_views = Widget::TableData(__('None'), array('class' => 'inactive'));
} else {
$col_views = Widget::TableData($fragment_views);
}
// Type
if (is_null($event->getType())) {
$col_type = Widget::TableData(__('Unknown'), array('class' => 'inactive'));
} else {
$col_type = Widget::TableData($this->types[$event->getType()]->name);
}
$eTableBody[] = Widget::TableRow(array($col_name, $col_destination, $col_type, $col_views));
}
}
$table = Widget::Table(Widget::TableHead($eTableHead), null, Widget::TableBody($eTableBody), array('id' => 'events-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);
}
示例14: prepareSourceColumnValue
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'));
}
}
示例15: view
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);
}