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


PHP DateTimeObj::format方法代码示例

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


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

示例1: __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);
     }
 }
开发者ID:bauhouse,项目名称:Piano-Sonata,代码行数:58,代码来源:content.systemauthors.php

示例2: __viewIndex

 public 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'), Administration::instance()->getCurrentPageURL() . 'new/', __('Add a new author'), 'create button', NULL, array('accesskey' => 'c')));
     } else {
         $this->appendSubheading(__('Authors'));
     }
     $aTableHead = array(array(__('Name'), 'col'), array(__('Email Address'), 'col'), array(__('Last Seen'), 'col'));
     $aTableBody = array();
     $authors = AuthorManager::fetch();
     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');
             }
             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));
         }
     }
     $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::Select('with-selected', $options));
         $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
         $this->Form->appendChild($tableActions);
     }
 }
开发者ID:benesch,项目名称:hilton-unar,代码行数:48,代码来源:content.systemauthors.php

示例3: formatDate

 /**
  * Format date
  *
  * @param string $date
  *  date
  * @param int $time
  *  if set to 1, add time
  * @param string $scheme
  *  date and time scheme
  * @param boolean $json
  *  if set to true, return JSON formatted result
  * @return 
  *  returns either an array or JSON object with the status and the parsed value of the given date
  */
 public static function formatDate($date = NULL, $time = 1, $scheme = NULL, $json = false)
 {
     // Get scheme
     if (empty($scheme)) {
         $scheme = __SYM_DATE_FORMAT__;
         if ($time == 1) {
             $scheme = __SYM_DATETIME_FORMAT__;
         }
     }
     // Get current time
     if (empty($date)) {
         $timestamp = time();
     } elseif (ctype_digit($date)) {
         // Switch between milliseconds and seconds
         if (strlen($date) > 10) {
             $date = substr($date, 0, -3);
         }
         $timestamp = $date;
     } else {
         $timestamp = $date;
     }
     // Parse date
     $timestamp = DateTimeObj::format($timestamp, 'U', false);
     // Invalid date
     if ($timestamp === false) {
         $result = array('status' => 'invalid', 'date' => $date, 'timestamp' => false);
     } else {
         $result = array('status' => 'valid', 'date' => DateTimeObj::format($timestamp, $scheme, true, date_default_timezone_get()), 'timestamp' => number_format($timestamp * 1000, 0, '', ''));
     }
     // Return result
     if ($json) {
         return json_encode($result);
     } else {
         return $result;
     }
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:50,代码来源:class.calendar.php

示例4: __form


//.........这里部分代码省略.........
          * Allows adding of new filter rules to the Event filter rule select box
          *
          * @delegate AppendEventFilter
          * @param string $context
          * '/blueprints/events/(edit|new|info)/'
          * @param array $selected
          *  An array of all the selected filters for this Event
          * @param array $options
          *  An array of all the filters that are available, passed by reference
          */
         Symphony::ExtensionManager()->notifyMembers('AppendEventFilter', '/blueprints/events/' . $this->_context[0] . '/', array('selected' => $filters, 'options' => &$options));
         $fieldset->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple', 'id' => 'event-filters')));
         $this->Form->appendChild($fieldset);
         // Connections
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Attach to Pages')));
         $p = new XMLElement('p', __('The event will only be available on the selected pages.'));
         $p->setAttribute('class', 'help');
         $fieldset->appendChild($p);
         $div = new XMLElement('div');
         $label = Widget::Label(__('Pages'));
         $pages = PageManager::fetch();
         $event_handle = str_replace('-', '_', Lang::createHandle($fields['name']));
         $connections = ResourceManager::getAttachedPages(RESOURCE_TYPE_EVENT, $event_handle);
         $selected = array();
         foreach ($connections as $connection) {
             $selected[] = $connection['id'];
         }
         $options = array();
         foreach ($pages as $page) {
             $options[] = array($page['id'], in_array($page['id'], $selected), PageManager::resolvePageTitle($page['id']));
         }
         $label->appendChild(Widget::Select('fields[connections][]', $options, array('multiple' => 'multiple')));
         $div->appendChild($label);
         $fieldset->appendChild($div);
         $this->Form->appendChild($fieldset);
         // Providers
         if (!empty($providers)) {
             foreach ($providers as $providerClass => $provider) {
                 if ($isEditing && $fields['source'] !== call_user_func(array($providerClass, 'getSource'))) {
                     continue;
                 }
                 call_user_func_array(array($providerClass, 'buildEditor'), array($this->Form, &$this->_errors, $fields, $handle));
             }
         }
     } else {
         // Author
         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']);
         } else {
             $link = $about['author']['name'];
         }
         if ($link) {
             $fieldset = new XMLElement('fieldset');
             $fieldset->setAttribute('class', 'settings');
             $fieldset->appendChild(new XMLElement('legend', __('Author')));
             $fieldset->appendChild(new XMLElement('p', $link->generate(false)));
             $this->Form->appendChild($fieldset);
         }
         // Version
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Version')));
         $version = array_key_exists('version', $about) ? $about['version'] : null;
         $release_date = array_key_exists('release-date', $about) ? $about['release-date'] : filemtime(EventManager::__getDriverPath($handle));
         if (preg_match('/^\\d+(\\.\\d+)*$/', $version)) {
             $fieldset->appendChild(new XMLElement('p', __('%1$s released on %2$s', array($version, DateTimeObj::format($release_date, __SYM_DATE_FORMAT__)))));
         } elseif (!is_null($version)) {
             $fieldset->appendChild(new XMLElement('p', __('Created by %1$s at %2$s', array($version, DateTimeObj::format($release_date, __SYM_DATE_FORMAT__)))));
         } else {
             $fieldset->appendChild(new XMLElement('p', __('Last modified on %s', array(DateTimeObj::format($release_date, __SYM_DATE_FORMAT__)))));
         }
         $this->Form->appendChild($fieldset);
     }
     // If we are editing an event, it assumed that the event has documentation
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('id', 'event-documentation');
     $fieldset->setAttribute('class', 'settings');
     if ($isEditing && method_exists($existing, 'documentation')) {
         $doc = $existing->documentation();
         if ($doc) {
             $fieldset->setValue('<legend>' . __('Documentation') . '</legend>' . PHP_EOL . General::tabsToSpaces(is_object($doc) ? $doc->generate(true, 4) : $doc));
         }
     }
     $this->Form->appendChild($fieldset);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', $isEditing ? __('Save Changes') : __('Create Event'), 'submit', array('accesskey' => 's')));
     if ($isEditing) {
         $button = new XMLElement('button', __('Delete'));
         $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this event'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this event?')));
         $div->appendChild($button);
     }
     if (!$readonly) {
         $this->Form->appendChild($div);
     }
 }
开发者ID:valery,项目名称:symphony-2,代码行数:101,代码来源:content.blueprintsevents.php

示例5: __form


//.........这里部分代码省略.........
     $this->setTitle(__($isEditing ? '%1$s &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %2$s', array(__('Symphony'), __('Events'), $about['name'])));
     $this->appendSubheading($isEditing ? $about['name'] : __('Untitled'));
     if (!$readonly) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Essentials')));
         $group = new XMLElement('div');
         $group->setAttribute('class', 'group');
         $label = Widget::Label(__('Name'));
         $label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
         $div = new XMLElement('div');
         if (isset($this->_errors['name'])) {
             $div->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
         } else {
             $div->appendChild($label);
         }
         $group->appendChild($div);
         $label = Widget::Label(__('Source'));
         $sections = $sectionManager->fetch(NULL, 'ASC', 'name');
         $options = array();
         if (is_array($sections) && !empty($sections)) {
             foreach ($sections as $s) {
                 $options[] = array($s->get('id'), $fields['source'] == $s->get('id'), General::sanitize($s->get('name')));
             }
         }
         $label->appendChild(Widget::Select('fields[source]', $options, array('id' => 'context')));
         $div = new XMLElement('div');
         if (isset($this->_errors['source'])) {
             $div->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['source']));
         } else {
             $div->appendChild($label);
         }
         $group->appendChild($div);
         $fieldset->appendChild($group);
         $label = Widget::Label(__('Filter Options'));
         $filters = is_array($fields['filters']) ? $fields['filters'] : array();
         $options = array(array('admin-only', in_array('admin-only', $filters), __('Admin Only')), array('send-email', in_array('send-email', $filters), __('Send Notification Email')), array('expect-multiple', in_array('expect-multiple', $filters), __('Allow Multiple')));
         /**
          * Allows adding of new filter rules to the Event filter rule select box
          *
          * @delegate AppendEventFilter
          * @param string $context
          * '/blueprints/events/(edit|new|info)/'
          * @param array $selected
          *  An array of all the selected filters for this Event
          * @param array $options
          *  An array of all the filters that are available, passed by reference
          */
         Symphony::ExtensionManager()->notifyMembers('AppendEventFilter', '/blueprints/events/' . $this->_context[0] . '/', array('selected' => $filters, 'options' => &$options));
         $label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple')));
         $fieldset->appendChild($label);
         $this->Form->appendChild($fieldset);
     }
     if ($readonly) {
         // Author
         if (isset($about['author']['website'])) {
             $link = Widget::Anchor($about['author']['name'], General::validateURL($about['author']['website']));
         } else {
             if (isset($about['author']['email'])) {
                 $link = Widget::Anchor($about['author']['name'], 'mailto:' . $about['author']['email']);
             } else {
                 $link = $about['author']['name'];
             }
         }
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Author')));
         $fieldset->appendChild(new XMLElement('p', $link->generate(false)));
         $this->Form->appendChild($fieldset);
         // Version
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Version')));
         if (preg_match('/^\\d+(\\.\\d+)*$/', $about['version'])) {
             $fieldset->appendChild(new XMLElement('p', __('%s released on %s', array($about['version'], DateTimeObj::format($about['release-date'], __SYM_DATE_FORMAT__)))));
         } else {
             $fieldset->appendChild(new XMLElement('p', __('Created by %s at %s', array($about['version'], DateTimeObj::format($about['release-date'], __SYM_DATE_FORMAT__)))));
         }
         $this->Form->appendChild($fieldset);
     }
     if ($isEditing) {
         // Description
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $doc = $existing->documentation();
         $fieldset->setValue('<legend>' . __('Description') . '</legend>' . self::CRLF . General::tabsToSpaces(is_object($doc) ? $doc->generate(true) : $doc, 2));
         $this->Form->appendChild($fieldset);
     }
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', $isEditing ? __('Save Changes') : __('Create Event'), 'submit', array('accesskey' => 's')));
     if ($isEditing) {
         $button = new XMLElement('button', __('Delete'));
         $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this event'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this event?')));
         $div->appendChild($button);
     }
     if (!$readonly) {
         $this->Form->appendChild($div);
     }
 }
开发者ID:benesch,项目名称:hilton-unar,代码行数:101,代码来源:content.blueprintsevents.php

示例6: prepareTableValue

 public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null)
 {
     $value = null;
     if (isset($data['value'])) {
         $value = DateTimeObj::format($data['value'], DateTimeObj::getSetting('datetime_format'), true);
     }
     return parent::prepareTableValue(array('value' => $value), $link, $entry_id = null);
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:8,代码来源:field.date.php

示例7: formatDate

 /**
  * Format the $data parameter according to this field's settings.
  *
  * @since Symphony 2.6.0
  * @param array $date
  *  The date to format
  * @return string
  */
 public function formatDate($date)
 {
     // Get format
     $format = 'date_format';
     if ($this->get('time') === 'yes') {
         $format = 'datetime_format';
     }
     return DateTimeObj::format($date, DateTimeObj::getSetting($format));
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:17,代码来源:field.date.php

示例8: __viewInfo

 public function __viewInfo()
 {
     $this->setPageType('form');
     $datasource = DatasourceManager::create($this->_context[1], array(), false);
     $about = $datasource->about();
     $this->setTitle(__('%1$s &ndash; %2$s &ndash; %3$s', array($about['name'], __('Data Source'), __('Symphony'))));
     $this->appendSubheading($this->_context[0] == 'info' ? $about['name'] : __('Untitled'));
     $this->insertBreadcrumbs(array(Widget::Anchor(__('Data Sources'), SYMPHONY_URL . '/blueprints/datasources/')));
     $this->Form->setAttribute('id', 'controller');
     $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']);
     }
     foreach ($about as $key => $value) {
         $fieldset = null;
         switch ($key) {
             case 'author':
                 if ($link) {
                     $fieldset = new XMLElement('fieldset');
                     $fieldset->appendChild(new XMLElement('legend', __('Author')));
                     $fieldset->appendChild(new XMLElement('p', $link->generate(false)));
                 }
                 break;
             case 'version':
                 $fieldset = new XMLElement('fieldset');
                 $fieldset->appendChild(new XMLElement('legend', __('Version')));
                 $release_date = array_key_exists('release-date', $about) ? $about['release-date'] : filemtime(DatasourceManager::__getDriverPath($this->_context[1]));
                 if (preg_match('/^\\d+(\\.\\d+)*$/', $value)) {
                     $fieldset->appendChild(new XMLElement('p', __('%1$s released on %2$s', array($value, DateTimeObj::format($release_date, __SYM_DATE_FORMAT__)))));
                 } else {
                     $fieldset->appendChild(new XMLElement('p', __('Created by %1$s at %2$s', array($value, DateTimeObj::format($release_date, __SYM_DATE_FORMAT__)))));
                 }
                 break;
             case 'description':
                 $fieldset = new XMLElement('fieldset');
                 $fieldset->appendChild(new XMLElement('legend', __('Description')));
                 $fieldset->appendChild(is_object($about['description']) ? $about['description'] : new XMLElement('p', $about['description']));
                 break;
             case 'example':
                 if (is_callable(array($datasource, 'example'))) {
                     $fieldset = new XMLElement('fieldset');
                     $fieldset->appendChild(new XMLElement('legend', __('Example XML')));
                     $example = $datasource->example();
                     if (is_object($example)) {
                         $fieldset->appendChild($example);
                     } else {
                         $p = new XMLElement('p');
                         $p->appendChild(new XMLElement('pre', '<code>' . str_replace('<', '&lt;', $example) . '</code>'));
                         $fieldset->appendChild($p);
                     }
                 }
                 break;
         }
         if ($fieldset) {
             $fieldset->setAttribute('class', 'settings');
             $this->Form->appendChild($fieldset);
         }
     }
     // Display source
     $file = DatasourceManager::__getClassPath($this->_context[1]) . '/data.' . $this->_context[1] . '.php';
     if (file_exists($file)) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Source')));
         $source = file_get_contents($file);
         $code = new XMLElement('code', htmlspecialchars($source));
         $pre = new XMLElement('pre');
         $pre->appendChild($code);
         $fieldset->appendChild($pre);
         $this->Form->appendChild($fieldset);
     }
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:74,代码来源:content.blueprintsdatasources.php

示例9: __viewIndex

 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Authors'), __('Symphony'))));
     if (Symphony::Author()->isDeveloper() || Symphony::Author()->isManager()) {
         $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 (Symphony::Author()->isDeveloper() || Symphony::Author()->isManager()) {
         $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']) ? '&amp;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 (Symphony::Author()->isDeveloper() || Symphony::Author()->isManager() && !$a->isDeveloper() || Symphony::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');
             }
             // Can this Author be edited by the current Author?
             if (Symphony::Author()->isDeveloper() || Symphony::Author()->isManager()) {
                 if ($a->get('id') != Symphony::Author()->get('id')) {
                     $td1->appendChild(Widget::Label(__('Select Author %s', array($a->getFullName())), null, 'accessible', null, array('for' => 'author-' . $a->get('id'))));
                     $td1->appendChild(Widget::Input('items[' . $a->get('id') . ']', 'on', 'checkbox', array('id' => 'author-' . $a->get('id'))));
                 }
             }
             $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');
             }
             if ($a->isDeveloper()) {
                 $type = 'Developer';
             } elseif ($a->isManager()) {
                 $type = 'Manager';
             } else {
                 $type = 'Author';
             }
             $td4 = Widget::TableData(__($type));
             $languages = Lang::getAvailableLanguages();
             $td5 = Widget::TableData($a->get("language") == null ? __("System Default") : $languages[$a->get("language")]);
             // Add a row to the body array, assigning each cell to the row
             if (Symphony::Author()->isDeveloper() || Symphony::Author()->isManager()) {
                 $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', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading'));
     $this->Form->appendChild($table);
     $version = new XMLElement('p', 'Symphony ' . Symphony::Configuration()->get('version', 'symphony'), array('id' => 'version'));
     $this->Form->appendChild($version);
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:62,代码来源:content.systemauthors.php

示例10: prepareTextValue

 public function prepareTextValue($data, $entry_id = null)
 {
     $value = '';
     if (isset($data['value'])) {
         $value = DateTimeObj::format($data['value'], DateTimeObj::getSetting('datetime_format'), true);
     }
     return $value;
 }
开发者ID:valery,项目名称:symphony-2,代码行数:8,代码来源:field.date.php

示例11: index

 function index(&$Page, &$Contents, $fields)
 {
     global $warnings;
     global $notices;
     global $languages;
     $Form = new XMLElement('form');
     $Form->setAttribute('action', kINSTALL_FILENAME . ($_GET['lang'] ? '?lang=' . $_GET['lang'] : ''));
     $Form->setAttribute('method', 'post');
     // START ENVIRONMENT SETTINGS
     $Environment = new XMLElement('fieldset');
     $Environment->appendChild(new XMLElement('legend', __('Environment Settings')));
     $Environment->appendChild(new XMLElement('p', __('Symphony is ready to be installed at the following location.')));
     $class = NULL;
     if (defined('kENVIRONMENT_WARNING') && kENVIRONMENT_WARNING == true) {
         $class = 'warning';
     }
     $Environment->appendChild(Widget::label(__('Root Path'), Widget::input('fields[docroot]', $fields['docroot']), $class));
     if (defined('ERROR') && defined('kENVIRONMENT_WARNING')) {
         $Environment->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning')));
     }
     $Form->appendChild($Environment);
     // START LOCALE SETTINGS
     $Environment = new XMLElement('fieldset');
     $Environment->appendChild(new XMLElement('legend', __('Website Preferences')));
     $Environment->appendChild(Widget::label(__('Name'), Widget::input('fields[general][sitename]', $fields['general']['sitename'])));
     $Fieldset = new XMLElement('fieldset');
     $Fieldset->appendChild(new XMLElement('legend', __('Date and Time')));
     $Fieldset->appendChild(new XMLElement('p', __('Customise how Date and Time values are displayed throughout the Administration interface.')));
     $options = array();
     $groups = array();
     $system_tz = isset($fields['region']['timezone']) ? $fields['region']['timezone'] : date_default_timezone_get();
     foreach (timezone_identifiers_list() as $tz) {
         if (preg_match('/\\//', $tz)) {
             $parts = preg_split('/\\//', $tz, 2, PREG_SPLIT_NO_EMPTY);
             $groups[$parts[0]][] = $parts[1];
         } else {
             $groups[$tz] = $tz;
         }
     }
     foreach ($groups as $key => $val) {
         if (is_array($val)) {
             $tmp = array('label' => $key, 'options' => array());
             foreach ($val as $zone) {
                 $tmp['options'][] = array("{$key}/{$zone}", "{$key}/{$zone}" == $system_tz, str_replace('_', ' ', $zone));
             }
             $options[] = $tmp;
         } else {
             $options[] = array($key, $key == $system_tz, str_replace('_', ' ', $key));
         }
     }
     $Fieldset->appendChild(Widget::label(__('Region'), Widget::Select('fields[region][timezone]', $options)));
     $dateformat = $fields['region']['date_format'];
     $label = Widget::Label(__('Date Format'));
     $dateFormats = array('Y/m/d', 'm/d/Y', 'm/d/y', 'Y-m-d', 'm-d-Y', 'm-d-y', 'd.m.Y', 'j.n.Y', 'd.m.y', 'j.n.y', 'd F Y', 'd M Y', 'j. F Y', 'j. M. Y');
     $dateOptions = array();
     foreach ($dateFormats as $dateOption) {
         $leadingZero = '';
         if (strpos($dateOption, 'j') !== false || strpos($dateOption, 'n') !== false) {
             $leadingZero = ' (' . __('no leading zeros') . ')';
         }
         $dateOptions[] = array($dateOption, $dateformat == $dateOption, DateTimeObj::format('now', $dateOption) . $leadingZero);
     }
     $label->appendChild(Widget::Select('fields[region][date_format]', $dateOptions));
     $Fieldset->appendChild($label);
     $timeformat = $fields['region']['time_format'];
     $label = Widget::Label(__('Time Format'));
     $timeformats = array(array('H:i:s', $timeformat == 'H:i:s', DateTimeObj::get('H:i:s')), array('H:i', $timeformat == 'H:i', DateTimeObj::get('H:i')), array('g:i:s a', $timeformat == 'g:i:s a', DateTimeObj::get('g:i:s a')), array('g:i a', $timeformat == 'g:i a', DateTimeObj::get('g:i a')));
     $label->appendChild(Widget::Select('fields[region][time_format]', $timeformats));
     $Fieldset->appendChild($label);
     $Environment->appendChild($Fieldset);
     $Form->appendChild($Environment);
     // START DATABASE SETTINGS
     $Database = new XMLElement('fieldset');
     $Database->appendChild(new XMLElement('legend', __('Database Connection')));
     $Database->appendChild(new XMLElement('p', __('Please provide Symphony with access to a database.')));
     $class = NULL;
     if (defined('kDATABASE_VERSION_WARNING') && kDATABASE_VERSION_WARNING == true) {
         $class = ' warning';
     }
     ## fields[database][name]
     $label = Widget::label(__('Database'), Widget::input('fields[database][name]', $fields['database']['name']), $class);
     $Database->appendChild($label);
     if (defined('ERROR') && defined('kDATABASE_VERSION_WARNING')) {
         $Database->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning')));
     }
     $class = NULL;
     if (defined('kDATABASE_CONNECTION_WARNING') && kDATABASE_CONNECTION_WARNING == true) {
         $class = ' warning';
     }
     $Div = new XMLElement('div');
     $Div->setAttribute('class', 'group' . $class);
     ## fields[database][username]
     $Div->appendChild(Widget::label(__('Username'), Widget::input('fields[database][username]', $fields['database']['username'])));
     ## fields[database][password]
     $Div->appendChild(Widget::label(__('Password'), Widget::input('fields[database][password]', $fields['database']['password'], 'password')));
     $Database->appendChild($Div);
     if (defined('ERROR') && defined('kDATABASE_CONNECTION_WARNING')) {
         $Database->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning')));
     }
     $Fieldset = new XMLElement('fieldset');
//.........这里部分代码省略.........
开发者ID:shobhalakshminarayana,项目名称:Bugaroo,代码行数:101,代码来源:include.install.php

示例12: __viewIndex

 /**
  * This function contains the minimal amount of logic for generating the
  * index table of a given `$resource_type`. The table has name, source, pages
  * release date and author columns. The values for these columns are determined
  * by the resource's `about()` method.
  *
  * As Datasources types can be installed using Providers, the Source column
  * can be overridden with a Datasource's `getSourceColumn` method (if it exists).
  *
  * @param integer $resource_type
  *  Either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DATASOURCE`
  */
 public function __viewIndex($resource_type)
 {
     $manager = ResourceManager::getManagerFromType($resource_type);
     $this->setPageType('table');
     Sortable::initialize($this, $resources, $sort, $order, array('type' => $resource_type));
     $columns = array(array('label' => __('Name'), 'sortable' => true, 'handle' => 'name'), array('label' => __('Source'), 'sortable' => true, 'handle' => 'source'), array('label' => __('Pages'), 'sortable' => false), array('label' => __('Release Date'), 'sortable' => true, 'handle' => 'release-date'), array('label' => __('Author'), 'sortable' => true, 'handle' => 'author'));
     $aTableHead = Sortable::buildTableHeaders($columns, $sort, $order, isset($_REQUEST['filter']) ? '&amp;filter=' . $_REQUEST['filter'] : '');
     $aTableBody = array();
     if (!is_array($resources) || empty($resources)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         foreach ($resources as $r) {
             // Resource name
             $action = isset($r['can_parse']) && $r['can_parse'] === true ? 'edit' : 'info';
             $name = Widget::TableData(Widget::Anchor($r['name'], SYMPHONY_URL . $_REQUEST['symphony-page'] . $action . '/' . $r['handle'] . '/', $r['handle']));
             // Resource type/source
             if (isset($r['source'], $r['source']['id'])) {
                 $section = Widget::TableData(Widget::Anchor($r['source']['name'], SYMPHONY_URL . '/blueprints/sections/edit/' . $r['source']['id'] . '/', $r['source']['handle']));
             } else {
                 if (isset($r['source']) && class_exists($r['source']['name']) && method_exists($r['source']['name'], 'getSourceColumn')) {
                     $class = call_user_func(array($manager, '__getClassName'), $r['handle']);
                     $section = Widget::TableData(call_user_func(array($class, 'getSourceColumn'), $r['handle']));
                 } else {
                     if (isset($r['source'], $r['source']['name'])) {
                         $section = Widget::TableData($r['source']['name']);
                     } else {
                         $section = Widget::TableData(__('Unknown'), 'inactive');
                     }
                 }
             }
             // Attached pages
             $pages = ResourceManager::getAttachedPages($resource_type, $r['handle']);
             $pagelinks = array();
             $i = 0;
             foreach ($pages as $p) {
                 ++$i;
                 $pagelinks[] = Widget::Anchor($p['title'], SYMPHONY_URL . '/blueprints/pages/edit/' . $p['id'] . '/')->generate() . (count($pages) > $i ? $i % 10 == 0 ? '<br />' : ', ' : '');
             }
             $pages = implode('', $pagelinks);
             if ($pages == '') {
                 $pagelinks = Widget::TableData(__('None'), 'inactive');
             } else {
                 $pagelinks = Widget::TableData($pages, 'pages');
             }
             // Release date
             $releasedate = Widget::TableData(Lang::localizeDate(DateTimeObj::format($r['release-date'], __SYM_DATETIME_FORMAT__)));
             // Authors
             $author = $r['author']['name'];
             if ($author) {
                 if (isset($r['author']['website'])) {
                     $author = Widget::Anchor($r['author']['name'], General::validateURL($r['author']['website']));
                 } else {
                     if (isset($r['author']['email'])) {
                         $author = Widget::Anchor($r['author']['name'], 'mailto:' . $r['author']['email']);
                     }
                 }
             }
             $author = Widget::TableData($author);
             $author->appendChild(Widget::Input('items[' . $r['handle'] . ']', null, 'checkbox'));
             $aTableBody[] = Widget::TableRow(array($name, $section, $pagelinks, $releasedate, $author));
         }
     }
     $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'));
     $pages = $this->pagesFlatView();
     $group_attach = array('label' => __('Attach to Page'), 'options' => array());
     $group_detach = array('label' => __('Detach from Page'), 'options' => array());
     $group_attach['options'][] = array('attach-all-pages', false, __('All'));
     $group_detach['options'][] = array('detach-all-pages', false, __('All'));
     foreach ($pages as $p) {
         $group_attach['options'][] = array('attach-to-page-' . $p['id'], false, $p['title']);
         $group_detach['options'][] = array('detach-from-page-' . $p['id'], false, $p['title']);
     }
     $options[] = $group_attach;
     $options[] = $group_detach;
     /**
      * 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/datasources/' or '/blueprints/events/'
      * @param array $options
//.........这里部分代码省略.........
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:101,代码来源:class.resourcespage.php

示例13: __viewIndex

 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %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']) ? '&amp;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?'))));
         /**
          * 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
          * '/system/authors/'
          * @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', '/system/authors/', array('options' => &$options));
         if (!empty($options)) {
             $tableActions->appendChild(Widget::Apply($options));
             $this->Form->appendChild($tableActions);
         }
     }
 }
开发者ID:nils-werner,项目名称:symphony-2,代码行数:75,代码来源:content.systemauthors.php

示例14: prepareTableValue

 public function prepareTableValue($data, XMLElement $link = NULL)
 {
     $value = null;
     if (isset($data['gmt']) && !is_null($data['gmt'])) {
         $value = DateTimeObj::format($data['gmt'], __SYM_DATETIME_FORMAT__, true);
     }
     return parent::prepareTableValue(array('value' => $value), $link);
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:8,代码来源:field.date.php

示例15: __viewInfo

 public function __viewInfo()
 {
     $this->setPageType('form');
     $datasource = DatasourceManager::create($this->_context[1], array(), false);
     $about = $datasource->about();
     $this->setTitle(__('%1$s &ndash; %2$s &ndash; %3$s', array($about['name'], __('Data Source'), __('Symphony'))));
     $this->appendSubheading($about['name']);
     $this->Form->setAttribute('id', 'controller');
     $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']);
     }
     foreach ($about as $key => $value) {
         $fieldset = NULL;
         switch ($key) {
             case 'author':
                 if ($link) {
                     $fieldset = new XMLElement('fieldset');
                     $fieldset->appendChild(new XMLElement('legend', __('Author')));
                     $fieldset->appendChild(new XMLElement('p', $link->generate(false)));
                 }
                 break;
             case 'version':
                 $fieldset = new XMLElement('fieldset');
                 $fieldset->appendChild(new XMLElement('legend', __('Version')));
                 if (preg_match('/^\\d+(\\.\\d+)*$/', $value)) {
                     $fieldset->appendChild(new XMLElement('p', __('%1$s released on %2$s', array($value, DateTimeObj::format($about['release-date'], __SYM_DATE_FORMAT__)))));
                 } else {
                     $fieldset->appendChild(new XMLElement('p', __('Created by %1$s at %2$s', array($value, DateTimeObj::format($about['release-date'], __SYM_DATE_FORMAT__)))));
                 }
                 break;
             case 'description':
                 $fieldset = new XMLElement('fieldset');
                 $fieldset->appendChild(new XMLElement('legend', __('Description')));
                 $fieldset->appendChild(is_object($about['description']) ? $about['description'] : new XMLElement('p', $about['description']));
             case 'example':
                 if (is_callable(array($datasource, 'example'))) {
                     $fieldset = new XMLElement('fieldset');
                     $fieldset->appendChild(new XMLElement('legend', __('Example XML')));
                     $example = $datasource->example();
                     if (is_object($example)) {
                         $fieldset->appendChild($example);
                     } else {
                         $p = new XMLElement('p');
                         $p->appendChild(new XMLElement('pre', '<code>' . str_replace('<', '&lt;', $example) . '</code>'));
                         $fieldset->appendChild($p);
                     }
                 }
                 break;
         }
         if ($fieldset) {
             $fieldset->setAttribute('class', 'settings');
             $this->Form->appendChild($fieldset);
         }
     }
 }
开发者ID:bauhouse,项目名称:Piano-Sonata,代码行数:58,代码来源:content.blueprintsdatasources.php


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