本文整理汇总了PHP中Layout::createColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::createColumn方法的具体用法?PHP Layout::createColumn怎么用?PHP Layout::createColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layout
的用法示例。
在下文中一共展示了Layout::createColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
// Essentials --------------------------------------------------------
$fieldset = Widget::Fieldset(__('Essentials'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
$left->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Content'));
$label = Widget::Label(__('Source XML'));
$input = Widget::Textarea('fields[xml]', $this->parameters()->{'xml'}, array('rows' => '24', 'cols' => '50', 'class' => 'code'));
$label->appendChild($input);
if (isset($errors->{'xml'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'xml'});
}
$fieldset->appendChild($label);
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例2: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/bbcww_api_client/assets/view.js'));
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
if (isset($errors->{'about::name'})) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
} else {
$fieldset->appendChild($label);
}
$field_groups = $options = array();
foreach ($this->driver->getMemberSections() as $section) {
$source = $section->{'api-source'};
$field_groups[$section->handle] = array('fields' => $section->fields, 'section' => $section);
if (!isset($options[$source])) {
$options[$source] = array('label' => ucwords(strtr($source, '-', ' ')), 'options' => array());
}
$options[$source]['options'][] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
}
$label = Widget::Label(__('Section'));
$label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
$fieldset->appendChild($label);
$left->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
foreach ($this->driver->getMemberSections() as $section) {
$this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
}
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例3: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'));
$layout = new Layout();
$column_1 = $layout->createColumn(Layout::SMALL);
$column_2 = $layout->createColumn(Layout::SMALL);
$column_3 = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
if (isset($errors->{'about::name'})) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
} else {
$fieldset->appendChild($label);
}
$label = Widget::Label(__('Section'));
$options = array();
foreach (new SectionIterator() as $section) {
$options[] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
}
$label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
$fieldset->appendChild($label);
$column_1->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Processing Options'));
$label = Widget::Label(__('Filter Rules'));
$filters = $this->parameters()->filters;
if (!is_array($filters)) {
$filters = array();
}
$options = array(array('admin-only', in_array('admin-only', $filters), __('Admin Only')), array('send-email', in_array('send-email', $filters), __('Send Email')), array('expect-multiple', in_array('expect-multiple', $filters), __('Allow Multiple')));
###
# Delegate: AppendEventFilter
# Description: Allows adding of new filter rules to the Event filter
# rule select box. A reference to the $options array is provided, and selected filters
Extension::notify('AppendEventFilter', '/blueprints/events/', array('selected' => $filters, 'options' => &$options));
$label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple')));
$fieldset->appendChild($label);
$label = Widget::Label();
$input = Widget::Input('fields[output-id-on-save]', 'yes', 'checkbox');
if ($this->parameters()->{'output-id-on-save'} == true) {
$input->setAttribute('checked', 'checked');
}
$label->appendChild($input);
$label->appendChild(new DOMText(__('Add entry ID to the parameter pool in the format of $this-name-id when saving is successful.')));
$fieldset->appendChild($label);
$column_2->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
foreach (new SectionIterator() as $section) {
$this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
}
$column_3->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例4: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = $wrapper->ownerDocument;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'), 55533140);
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$middle = $layout->createColumn(Layout::LARGE);
$right = $layout->createColumn(Layout::SMALL);
// Essentials --------------------------------------------------------
$fieldset = Widget::Fieldset(__('Essentials'), null, array('class' => 'settings'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
$left->appendChild($fieldset);
// Filtering ---------------------------------------------------------
$fieldset = Widget::Fieldset(__('Filtering'), '<code>{$param}</code> or <code>Value</code>', array('class' => 'settings'));
// Filters
$duplicator = new Duplicator(__('Add Filter'));
$filters = array('id' => __('ID'), 'username' => __('Username'), 'first-name' => __('First Name'), 'last-name' => __('Last Name'), 'email' => __('Email Address'));
foreach ($filters as $handle => $name) {
$this->appendFilter($duplicator, $handle, $name);
if (is_array($this->parameters()->filters) && array_key_exists($handle, $this->parameters()->filters)) {
$this->appendFilter($duplicator, $handle, $name, $this->parameters()->filters[$handle]);
}
}
$duplicator->appendTo($fieldset);
$middle->appendChild($fieldset);
// Output options ----------------------------------------------------
$fieldset = Widget::Fieldset(__('Output Options'));
$select = Widget::Select('fields[included-elements][]', array(array('username', in_array('username', $this->parameters()->{"included-elements"}), 'username'), array('name', in_array('name', $this->parameters()->{"included-elements"}), 'name'), array('email-address', in_array('email-address', $this->parameters()->{"included-elements"}), 'email-address'), array('language', in_array('language', $this->parameters()->{"included-elements"}), 'language'), array('authentication-token', in_array('authentication-token', $this->parameters()->{"included-elements"}), 'authentication-token'), array('default-section', in_array('default-section', $this->parameters()->{"included-elements"}), 'default-section')));
$select->setAttribute('class', 'filtered');
$select->setAttribute('multiple', 'multiple');
$label = Widget::Label(__('Included Elements'));
$label->appendChild($select);
$fieldset->appendChild($label);
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例5: view
public function view()
{
$this->lists = (object) array('status' => array(Extension::STATUS_ENABLED => array(), Extension::STATUS_DISABLED => array(), Extension::STATUS_NOT_INSTALLED => array(), Extension::STATUS_REQUIRES_UPDATE => array()), 'type' => array(), 'extensions' => array());
## Setup page
$filter = $this->_context[0] == 'type' || $this->_context[0] == 'status' ? $this->_context[0] : NULL;
$value = isset($this->_context[1]) ? $this->_context[1] : NULL;
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Extensions'))));
$this->appendSubheading(__('Extensions'));
$path = ADMIN_URL . '/system/extensions/';
$this->Form->setAttribute('action', Administration::instance()->getCurrentPageURL());
## Define layout
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$left->setAttribute('class', 'column small filters');
$right = $layout->createColumn(Layout::LARGE);
## Process extensions and build lists
foreach (new ExtensionIterator() as $extension) {
$pathname = Extension::getPathFromClass(get_class($extension));
$handle = Extension::getHandleFromPath($pathname);
$status = Extension::status($handle);
// List of extensions
$this->lists->extensions[$handle] = array('object' => $extension, 'path' => $path, 'handle' => $handle, 'status' => $status);
// List of extension handles grouped by status
if (!is_array($this->lists->status[$status])) {
$this->lists->status[$status] = array();
}
$this->lists->status[$status][] = $handle;
// List of extension handles grouped by type
if (isset($extension->about()->type) && is_array($extension->about()->type) && !empty($extension->about()->type)) {
foreach ($extension->about()->type as $t) {
if (!isset($this->lists->type[$t])) {
$this->lists->type[$t] = array();
}
$this->lists->type[$t][] = $handle;
}
}
}
## Build status filter menu
$h4 = $this->createElement('h4', __('Filter by Status'));
$left->appendChild($h4);
$ul = $this->createElement('ul');
## Main status overview
$li = $this->createElement('li', Widget::Anchor(__('Overview'), $path));
if (is_null($filter)) {
$li->setAttribute('class', 'active');
}
$ul->appendChild($li);
foreach ($this->lists->status as $status => $extensions) {
if (!empty($extensions)) {
$li = $this->createElement('li', Widget::Anchor(self::$status_translation[$status], "{$path}status/{$status}"));
if ($value == $status) {
$li->setAttribute('class', 'active');
}
$count = $this->createElement('span', (string) count($extensions));
$li->appendChild($count);
$ul->appendChild($li);
}
}
$left->appendChild($ul);
## Build type filter menu
$h4 = $this->createElement('h4', __('Filter by Type'));
$left->appendChild($h4);
$ul = $this->createElement('ul');
foreach ($this->lists->type as $type => $extensions) {
if (!empty($extensions)) {
$li = $this->createElement('li', Widget::Anchor(ucwords($type), "{$path}type/{$type}"));
if ($value == $type) {
$li->setAttribute('class', 'active');
}
$count = $this->createElement('span', (string) count($extensions));
$li->appendChild($count);
$ul->appendChild($li);
}
}
$left->appendChild($ul);
## If a filter and value are specified...
if (!is_null($filter) && !is_null($value)) {
## If there are extensions in the list, build the table
if (isset($this->lists->{$filter}[$value])) {
$right->appendChild($this->buildTable($this->lists->{$filter}[$value]));
} else {
## Otherwise pass an empty array so we get the
## 'No Records Found' message
$right->appendChild($this->buildTable());
}
## and append table actions
$tableActions = $this->createElement('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'));
$right->appendChild($tableActions);
## Otherwise, build the overview
} else {
## Requires Update
if (!empty($this->lists->status[Extension::STATUS_REQUIRES_UPDATE])) {
$count = count($this->lists->status[Extension::STATUS_REQUIRES_UPDATE]);
$div = $this->createElement('div');
$div->setAttribute('class', 'tools');
$h4 = $this->createElement('h4', __('Updates'));
//.........这里部分代码省略.........
示例6: __viewExtensions
public function __viewExtensions()
{
$this->appendSubheading(__('Settings'));
$this->appendTabs();
$path = ADMIN_URL . '/symphony/system/settings/';
// No settings for extensions here
if (Extension::delegateSubscriptionCount('AddSettingsFieldsets', '/system/settings/extensions/') <= 0) {
redirect($path);
}
// Status message:
$callback = Administration::instance()->getPageCallback();
if (isset($callback['flag']) && !is_null($callback['flag'])) {
switch ($callback['flag']) {
case 'saved':
$this->alerts()->append(__('System settings saved at %1$s.', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__))), AlertStack::SUCCESS);
break;
}
}
$extension_fieldsets = array();
###
# Delegate: AddSettingsFieldsets
# Description: Add Extension settings fieldsets. Append fieldsets to the array provided. They will be distributed evenly accross the 3 columns
Extension::notify('AddSettingsFieldsets', '/system/settings/extensions/', array('fieldsets' => &$extension_fieldsets));
if (empty($extension_fieldsets)) {
redirect($path);
}
$layout = new Layout();
$left = $layout->createColumn(Layout::LARGE);
$center = $layout->createColumn(Layout::LARGE);
$right = $layout->createColumn(Layout::LARGE);
foreach ($extension_fieldsets as $index => $fieldset) {
$index += 1;
if ($index % 3 == 0) {
$right->appendChild($fieldset);
} elseif ($index % 2 == 0) {
$center->appendChild($fieldset);
} else {
$left->appendChild($fieldset);
}
}
$layout->appendTo($this->Form);
$div = $this->createElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Submit('action[save]', __('Save Changes'), array('accesskey' => 's')));
$this->Form->appendChild($div);
}
示例7: __form
private function __form(Section $existing = null)
{
// Status message:
$callback = Administration::instance()->getPageCallback();
if (isset($callback['flag']) && !is_null($callback['flag'])) {
switch ($callback['flag']) {
case 'saved':
$this->alerts()->append(__('Section updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/sections/new/', ADMIN_URL . '/blueprints/sections/')), AlertStack::SUCCESS);
break;
case 'created':
$this->alerts()->append(__('Section created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/sections/new/', ADMIN_URL . '/blueprints/sections/')), AlertStack::SUCCESS);
break;
}
}
if (!$this->alerts()->valid() and $existing instanceof Section) {
$this->appendSyncAlert();
}
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Sections'))));
$this->appendSubheading($existing instanceof Section ? $existing->name : __('New Section'));
if ($existing instanceof Section) {
$this->appendViewOptions();
}
// Essentials:
$fieldset = $this->createElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild($this->createElement('h3', __('Essentials')));
$label = Widget::Label('Name');
$label->appendChild(Widget::Input('essentials[name]', $this->section->name));
$fieldset->appendChild(isset($this->errors->name) ? Widget::wrapFormElementWithError($label, $this->errors->name) : $label);
$label = Widget::Label(__('Navigation Group'));
$label->appendChild($this->createElement('em', __('Created if does not exist')));
$label->appendChild(Widget::Input('essentials[navigation-group]', $this->section->{"navigation-group"}));
$fieldset->appendChild(isset($this->errors->{'navigation-group'}) ? Widget::wrapFormElementWithError($label, $this->errors->{'navigation-group'}) : $label);
$navigation_groups = Section::fetchUsedNavigationGroups();
if (is_array($navigation_groups) && !empty($navigation_groups)) {
$ul = $this->createElement('ul', NULL, array('class' => 'tags singular'));
foreach ($navigation_groups as $g) {
$ul->appendChild($this->createElement('li', $g));
}
$fieldset->appendChild($ul);
}
$input = Widget::Input('essentials[hidden-from-publish-menu]', 'yes', 'checkbox', $this->section->{'hidden-from-publish-menu'} == 'yes' ? array('checked' => 'checked') : array());
$label = Widget::Label(__('Hide this section from the Publish menu'));
$label->prependChild($input);
$fieldset->appendChild($label);
$left->appendChild($fieldset);
// Fields
$fieldset = $this->createElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild($this->createElement('h3', __('Fields')));
$div = $this->createElement('div');
$h3 = $this->createElement('h3', __('Fields'));
$h3->setAttribute('class', 'label');
$div->appendChild($h3);
$duplicator = new Duplicator(__('Add Field'));
$duplicator->setAttribute('id', 'section-duplicator');
$fields = $this->section->fields;
$types = array();
foreach (new FieldIterator() as $pathname) {
$type = preg_replace(array('/^field\\./', '/\\.php$/'), NULL, basename($pathname));
$types[$type] = Field::load($pathname);
}
// To Do: Sort this list based on how many times a field has been used across the system
uasort($types, create_function('$a, $b', 'return strnatcasecmp($a->name(), $b->name());'));
if (is_array($types)) {
foreach ($types as $type => $field) {
$defaults = array();
$field->findDefaultSettings($defaults);
$field->section = $this->section->handle;
foreach ($defaults as $key => $value) {
$field->{$key} = $value;
}
$item = $duplicator->createTemplate($field->name());
$field->displaySettingsPanel($item, new MessageStack());
}
}
if (is_array($fields)) {
foreach ($fields as $position => $field) {
$field->sortorder = $position;
if ($this->errors->{"field::{$position}"}) {
$messages = $this->errors->{"field::{$position}"};
} else {
$messages = new MessageStack();
}
$item = $duplicator->createInstance($field->name, $field->name());
$field->displaySettingsPanel($item, $messages);
}
}
$duplicator->appendTo($fieldset);
$right->appendChild($fieldset);
$layout->appendTo($this->Form);
$div = $this->createElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Submit('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : 'Create Section', array('accesskey' => 's')));
if ($this->_context[0] == 'edit') {
$div->appendChild(Widget::Submit('action[delete]', __('Delete'), array('class' => 'confirm delete', 'title' => __('Delete this section'))));
}
//.........这里部分代码省略.........
示例8: displayJoinedPublishPanel
public function displayJoinedPublishPanel(SymphonyDOMElement $wrapper, Section $section, array $fields, MessageStack $errors, Entry $entry)
{
$document = $wrapper->ownerDocument;
$layout = new Layout();
foreach ($section->layout as $data) {
$column = $layout->createColumn($data->size);
foreach ($data->fieldsets as $data) {
$fieldset = $document->createElement('fieldset');
if (isset($data->collapsed) && $data->collapsed == 'yes') {
$fieldset->setAttribute('class', 'collapsed');
}
if (isset($data->name) && strlen(trim($data->name)) > 0) {
$fieldset->appendChild($document->createElement('h3', $data->name));
}
foreach ($data->fields as $handle) {
$field = $fields[$handle];
if (!$field instanceof Field) {
continue;
}
$div = $document->createElement('div', NULL, array('class' => trim(sprintf('field field-%s %s', $field->handle(), $field->required == 'yes' ? 'required' : ''))));
$field->displayPublishPanel($div, isset($errors->{$field->{'element-name'}}) ? $errors->{$field->{'element-name'}} : new MessageStack(), $entry, $entry->data()->{$field->{'element-name'}});
$fieldset->appendChild($div);
}
$column->appendChild($fieldset);
}
}
$layout->appendTo($wrapper);
}
示例9: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
// Essentials --------------------------------------------------------
$fieldset = Widget::Fieldset(__('Essentials'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
$left->appendChild($fieldset);
// Filtering ---------------------------------------------------------
$p = $page->createElement('p');
$p->setAttribute('class', 'help');
$p->appendChild($page->createElement('code', '{$param}'));
$p->setValue(' or ');
$p->appendChild($page->createElement('code', 'Value'));
$fieldset = Widget::Fieldset(__('Filtering'), $p);
// Parent View:
$label = Widget::Label(__('Parent View'));
$input = Widget::Input('fields[parent]', General::sanitize($this->parameters()->parent));
$label->appendChild($input);
if (isset($errors->{'parent'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'parent'});
}
$fieldset->appendChild($label);
$ul = $page->createElement('ul');
$ul->setAttribute('class', 'tags');
foreach (new ViewIterator() as $view) {
$ul->appendChild($page->createElement('li', $view->path));
}
$fieldset->appendChild($ul);
// View Type:
$label = Widget::Label(__('View Type'));
$input = Widget::Input('fields[type]', General::sanitize($this->parameters()->type));
$label->appendChild($input);
if (isset($errors->{'type'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'type'});
}
$fieldset->appendChild($label);
$ul = $page->createElement('ul');
$ul->setAttribute('class', 'tags');
foreach (View::fetchUsedTypes() as $type) {
$ul->appendChild($page->createElement('li', $type));
}
$fieldset->appendChild($ul);
/*
if (isset($this->parameters()->parent) && !is_null($this->parameters()->parent)){
$li = new XMLElement('li');
$li->setAttribute('class', 'unique');
$li->appendChild(new XMLElement('h4', __('Parent View')));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input(
'fields[parent]', General::sanitize($this->parameters()->parent)
));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
}
$li = new XMLElement('li');
$li->setAttribute('class', 'unique template');
$li->appendChild(new XMLElement('h4', __('Parent View')));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[parent]'));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'tags');
foreach(View::fetchUsedTypes() as $type) $ul->appendChild(new XMLElement('li', $type));
if (isset($this->parameters()->type) && !is_null($this->parameters()->type)){
$li = new XMLElement('li');
$li->setAttribute('class', 'unique');
$li->appendChild(new XMLElement('h4', __('View Type')));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input(
'fields[type]',
General::sanitize($this->parameters()->type)
));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
}
$li = new XMLElement('li');
$li->setAttribute('class', 'unique template');
$li->appendChild(new XMLElement('h4', __('View Type')));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[type]'));
$li->appendChild($label);
$li->appendChild($ul);
//.........这里部分代码省略.........
示例10: __viewEdit
public function __viewEdit()
{
$layout = new Layout();
$left = $layout->createColumn(Layout::LARGE);
$right = $layout->createColumn(Layout::SMALL);
$this->_existing_file = isset($this->_context[1]) ? $this->_context[1] . '.xsl' : NULL;
## Handle unknown context
if (!in_array($this->_context[0], array('new', 'edit'))) {
throw new AdministrationPageNotFoundException();
}
## Edit Utility context
if ($this->_context[0] == 'edit') {
$file_abs = UTILITIES . '/' . $this->_existing_file;
$filename = $this->_existing_file;
if (!is_file($file_abs) && !is_readable($file_abs)) {
redirect(ADMIN_URL . '/blueprints/utilities/new/');
}
$fields['name'] = $filename;
$fields['template'] = file_get_contents($file_abs);
$this->Form->setAttribute('action', ADMIN_URL . '/blueprints/utilities/edit/' . $this->_context[1] . '/');
} else {
$fields['name'] = '';
$fields['template'] = file_get_contents(TEMPLATES . '/template.utility.txt');
$filename = '';
}
$formHasErrors = $this->errors->valid();
if ($formHasErrors) {
$this->alerts()->append(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), AlertStack::ERROR);
}
if (isset($this->_context[2])) {
switch ($this->_context[2]) {
case 'saved':
$this->alerts()->append(__('Utility updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/utilities/new/', ADMIN_URL . '/blueprints/utilities/')), AlertStack::SUCCESS);
break;
case 'created':
$this->alerts()->append(__('Utility created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/utilities/new/', ADMIN_URL . '/blueprints/utilities/')), AlertStack::SUCCESS);
break;
}
}
$this->setTitle(__($this->_context[0] == 'new' ? '%1$s – %2$s' : '%1$s – %2$s – %3$s', array(__('Symphony'), __('Utilities'), $filename)));
$this->appendSubheading($this->_context[0] == 'new' ? __('New Utility') : $filename);
if (!empty($_POST)) {
$fields = $_POST['fields'];
}
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', $fields['name']));
$fieldset->appendChild(isset($this->errors->name) ? Widget::wrapFormElementWithError($label, $this->errors->name) : $label);
$label = Widget::Label(__('XSLT'));
$label->appendChild(Widget::Textarea('fields[template]', $fields['template'], array('rows' => 30, 'cols' => 80, 'class' => 'code')));
$fieldset->appendChild(isset($this->errors->template) ? Widget::wrapFormElementWithError($label, $this->errors->template) : $label);
$left->appendChild($fieldset);
$utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
$utilities = $utilities['filelist'];
if (is_array($utilities) && !empty($utilities)) {
$fieldset = Widget::Fieldset(__('Utilities'));
$ul = $this->createElement('ul');
$ul->setAttribute('id', 'utilities');
$i = 0;
foreach ($utilities as $util) {
$li = $this->createElement('li');
if ($i++ % 2 != 1) {
$li->setAttribute('class', 'odd');
}
$li->appendChild(Widget::Anchor($util, ADMIN_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/', array()));
$ul->appendChild($li);
}
$fieldset->appendChild($ul);
$right->appendChild($fieldset);
}
$layout->appendTo($this->Form);
$div = $this->createElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Submit('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create Utility'), array('accesskey' => 's')));
if ($this->_context[0] == 'edit') {
$div->appendChild(Widget::Submit('action[delete]', __('Delete'), array('class' => 'confirm delete', 'title' => __('Delete this utility'))));
}
$this->Form->appendChild($div);
}
示例11: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'));
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::SMALL);
// Essentials --------------------------------------------------------
$fieldset = Widget::Fieldset(__('Essentials'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
// Section:
$field_groups = $options = array();
foreach (new SectionIterator() as $section) {
$field_groups[$section->handle] = array('fields' => $section->fields, 'section' => $section);
$options[] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
}
$label = Widget::Label(__('Section'));
$label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
$fieldset->appendChild($label);
$left->appendChild($fieldset);
// Conditions ---------------------------------------------------------
$fieldset = Widget::Fieldset(__('Conditions'), '<code>$param</code>');
$duplicator = new Duplicator(__('Add Condition'));
//$duplicator->setAttribute('class', 'conditions-duplicator');
// Templates:
$this->appendCondition($duplicator);
// Instances:
if (is_array($this->parameters()->conditions) && !empty($this->parameters()->conditions)) {
foreach ($this->parameters()->conditions as $condition) {
$this->appendCondition($duplicator, $condition);
}
}
$duplicator->appendTo($fieldset);
$left->appendChild($fieldset);
// Filtering ---------------------------------------------------------
$fieldset = Widget::Fieldset(__('Filtering'), '<code>{$param}</code> or <code>Value</code>');
$container_filter_results = $page->createElement('div');
$fieldset->appendChild($container_filter_results);
// Redirect/404 ------------------------------------------------------
/*
$label = Widget::Label(__('Required URL Parameter <i>Optional</i>'));
$label->appendChild(Widget::Input('fields[required_url_param]', $this->parameters()->required_url_param));
$fieldset->appendChild($label);
$p = new XMLElement('p', __('An empty result will be returned when this parameter does not have a value. Do not wrap the parameter with curly-braces.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
*/
$left->appendChild($fieldset);
// Sorting -----------------------------------------------------------
$fieldset = Widget::Fieldset(__('Sorting'));
$container_sort_by = $page->createElement('div');
$fieldset->appendChild($container_sort_by);
$label = Widget::Label(__('Sort Order'));
$options = array(array('asc', 'asc' == $this->parameters()->{'sort-order'}, __('Acending')), array('desc', 'desc' == $this->parameters()->{'sort-order'}, __('Descending')), array('random', 'random' == $this->parameters()->{'sort-order'}, __('Random')));
$label->appendChild(Widget::Select('fields[sort-order]', $options));
$fieldset->appendChild($label);
$right->appendChild($fieldset);
// Limiting ----------------------------------------------------------
$fieldset = Widget::Fieldset(__('Limiting'), '<code>{$param}</code> or <code>Value</code>');
// Show a maximum of # results
$label = Widget::Label(__('Limit results per page'));
$input = Widget::Input('fields[limit]', $this->parameters()->limit);
$label->appendChild($input);
if (isset($errors->limit)) {
$label = Widget::wrapFormElementWithError($label, $errors->limit);
}
$fieldset->appendChild($label);
// Show page # of results:
$label = Widget::Label(__('Show page of results'));
$input = Widget::Input('fields[page]', $this->parameters()->page);
$label->appendChild($input);
if (isset($errors->page)) {
$label = Widget::wrapFormElementWithError($label, $errors->page);
}
$fieldset->appendChild($label);
// Can redirect on empty:
$fieldset->appendChild(Widget::Input('fields[redirect-404-on-empty]', 'no', 'hidden'));
$label = Widget::Label(__('Redirect to 404 page when no results are found'));
$input = Widget::Input('fields[redirect-404-on-empty]', 'yes', 'checkbox');
if ($this->parameters()->{'redirect-404-on-empty'} == true) {
$input->setAttribute('checked', 'checked');
}
$label->prependChild($input);
$fieldset->appendChild($label);
$right->appendChild($fieldset);
// Output options ----------------------------------------------------
$fieldset = Widget::Fieldset(__('Output Options'));
//$container_parameter_output = $page->createElement('div');
$context_content = $page->createElement('div');
$fieldset->appendChild($context_content);
$fieldset->appendChild(Widget::Input('fields[append-pagination]', 'no', 'hidden'));
$label = Widget::Label(__('Append pagination data'));
//.........这里部分代码省略.........
示例12: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = $wrapper->ownerDocument;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'), 55533140);
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
// Essentials --------------------------------------------------------
$fieldset = Widget::Fieldset(__('Essentials'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
// Source ------------------------------------------------------------
$label = Widget::Label(__('Source URL'));
$label->appendChild(Widget::Input('fields[url]', General::sanitize($this->parameters()->url)));
if (isset($errors->url)) {
$label = Widget::wrapFormElementWithError($label, $errors->url);
}
$fieldset->appendChild($label);
$fragment = $page->createDocumentFragment();
$fragment->appendXML(__('Use <code>{$param}</code> syntax to specify dynamic portions of the URL.'));
$fieldset->appendChild($page->createElement('p', $fragment, array('class' => 'help')));
$left->appendChild($fieldset);
// Timeouts ------------------------------------------------------------
$fieldset = Widget::Fieldset(__('Time Limits'));
$label = Widget::Label(__('Cache Limit'));
$label->appendChild(Widget::Input('fields[cache-lifetime]', max(0, intval($this->parameters()->{'cache-lifetime'}))));
if (isset($errors->{'cache-lifetime'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'cache-lifetime'});
}
$fieldset->appendChild($label);
$fragment = $page->createDocumentFragment();
$fragment->appendXML(__('How often to refresh the cache.'));
$fieldset->appendChild($page->createElement('p', $fragment, array('class' => 'help')));
$label = Widget::Label(__('Gateway Timeout'));
$label->appendChild(Widget::Input('fields[timeout]', max(1, intval($this->parameters()->{'timeout'}))));
if (isset($errors->{'timeout'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'timeout'});
}
$fieldset->appendChild($label);
$fragment = $page->createDocumentFragment();
$fragment->appendXML(__('How long to wait for a response.'));
$fieldset->appendChild($page->createElement('p', $fragment, array('class' => 'help')));
$left->appendChild($fieldset);
// Included Elements
$fieldset = Widget::Fieldset(__('XML Processing'));
$label = Widget::Label(__('Included Elements'));
$label->appendChild(Widget::Input('fields[xpath]', General::sanitize($this->parameters()->xpath)));
if (isset($errors->xpath)) {
$label = Widget::wrapFormElementWithError($label, $errors->xpath);
}
$fieldset->appendChild($label);
$help = Symphony::Parent()->Page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Use an XPath expression to select which elements from the source XML to include.'));
$fieldset->appendChild($help);
$right->appendChild($fieldset);
// Namespace Declarations
$fieldset = Widget::Fieldset(__('Namespace Declarations'), $page->createElement('em', 'Optional'));
$duplicator = new Duplicator(__('Add Namespace'));
$this->appendNamespace($duplicator);
if (is_array($this->parameters()->namespaces)) {
foreach ($this->parameters()->namespaces as $index => $namespace) {
$this->appendNamespace($duplicator, $namespace);
}
}
$duplicator->appendTo($fieldset);
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例13: __form
private function __form()
{
$this->insertNodeIntoHead($this->createStylesheetElement(URL . '/extensions/aac/assets/roles.css'));
$this->insertNodeIntoHead($this->createScriptElement(URL . '/extensions/aac/assets/roles.js'));
// The "symphony.selectable.js" messes up the checkboxes, so remove it
foreach ($this->xpath("//head/script[contains(@src, 'symphony/assets/js/symphony.selectable.js')]") as $element) {
$element->parentNode->removeChild($element);
}
if (!in_array($this->_context[0], array('new', 'edit'))) {
throw new AdministrationPageNotFoundException();
}
$callback = Administration::instance()->getPageCallback();
if (isset($callback['flag'])) {
switch ($callback['flag']) {
case 'saved':
$this->alerts()->append(__('Role updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Roles</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/extension/aac/roles/new/', ADMIN_URL . '/extension/aac/roles/')), AlertStack::SUCCESS);
break;
case 'created':
$this->alerts()->append(__('Role created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Roles</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/extension/aac/roles/new/', ADMIN_URL . '/extension/aac/roles/')), AlertStack::SUCCESS);
break;
}
}
/**********
INSERT logic for determining the current role and
whether the user has permission to edit it
**********/
$this->setTitle(__($this->_context[0] == 'new' ? '%1$s – %2$s – Untitled' : '%1$s – %2$s – %3$s', array(__('Symphony'), __('Roles'), $this->role->name)));
$this->appendSubheading($this->_context[0] == 'new' ? __('Untitled') : $this->role->name);
// SETUP PAGE
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$middle = $layout->createColumn(Layout::LARGE);
$right = $layout->createColumn(Layout::LARGE);
/** ESSENTIALS **/
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', $this->role->name));
$fieldset->appendChild(isset($this->errors->name) ? Widget::wrapFormElementWithError($label, $this->errors->name) : $label);
$label = Widget::Label(__('Description'));
$label->appendChild(Widget::Textarea('fields[description]', $this->role->description, array('rows' => 7, 'cols' => 50)));
$fieldset->appendChild(isset($this->errors->description) ? Widget::wrapFormElementWithError($label, $this->errors->description) : $label);
$left->appendChild($fieldset);
/// PUBLISHING PERMISSIONS
$fieldset = Widget::Fieldset(__('Publishing Permissions'));
$sections = new SectionIterator();
if ($sections->length() <= 0) {
$p = $this->createElement('p', 'No sections exist. ');
$p->appendChild(Widget::Anchor(__('Create one'), ADMIN_URL . '/sections/new/'));
$fieldset->appendChild($p);
} else {
$thead = array(array(__('Section'), 'col'), array(__('Create'), 'col', array('class' => 'checkbox')), array(__('Edit'), 'col', array('class' => 'checkbox')));
$tbody = array();
/*
// TODO: Global permissions set all permissions
$td1 = Widget::TableData(__('Global Permissions'));
$td2 = Widget::TableData(
Widget::Input('global-add', '1', 'checkbox'),
array('class' => 'checkbox')
);
$td3 = Widget::TableData(NULL, array('class' => 'edit'));
$td3->appendChild($this->createElement('p', NULL, array('class' => 'global-slider')));
$td3->appendChild($this->createElement('span', 'n/a'));
$tbody[] = Widget::TableRow(array($td1, $td2, $td3), array('class' => 'global'));
*/
foreach ($sections as $section) {
$td1 = Widget::TableData($section->name);
// TODO: Remove this and implement sliders
$td2 = Widget::TableData();
$td2->appendChild(Widget::Input("fields[permissions][publish::{$section->handle}][create]", '0', 'checkbox', array('checked' => 'checked', 'style' => 'display: none;')));
$td2->appendChild(Widget::Input("fields[permissions][publish::{$section->handle}][create]", '1', 'checkbox', (int) $this->role->permissions()->{"publish::{$section->handle}.create"} > 0 ? array('checked' => 'checked') : NULL));
$edit_level = (int) $this->role->permissions()->{"publish::{$section->handle}.edit"};
$td3 = Widget::TableData(Widget::Select("fields[permissions][publish::{$section->handle}][edit]", array(array('0', false, 'None'), array(1, $edit_level == 1, 'Own'), array(2, $edit_level == 2, 'All'))));
/*
$td2 = Widget::TableData(
Widget::Input(
"fields[permissions][{$section->handle}][create]",
'1',
'checkbox',
($permissions['create'] == 1 ? array('checked' => 'checked') : array())
),
array('class' => 'checkbox')
);
$td3 = Widget::TableData(NULL, array('class' => 'edit'));
$td3->appendChild($this->createElement('p', NULL, array('class' => 'slider')));
$td3->appendChild(
$this->createElement('span', '')
);
$td3->appendChild(
Widget::Input('fields[permissions][' . $section->handle .'][edit]',
(isset($permissions['edit']) ? $permissions['edit'] : '0'),
'hidden'
)
//.........这里部分代码省略.........
示例14: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = $wrapper->ownerDocument;
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
$left->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Gravatar'), '<code>{$param}</code> or <code>Value</code>');
$label = Widget::Label(__('Email Addresses'));
$input = Widget::Input('fields[addresses]', $this->parameters()->{'addresses'});
$label->appendChild($input);
if (isset($errors->{'addresses'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'addresses'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Enter email addresses separated by commas.'));
$fieldset->appendChild($label);
$fieldset->appendChild($help);
$label = Widget::Label(__('Default Image'));
$input = Widget::Input('fields[default]', $this->parameters()->{'default'});
$label->appendChild($input);
if (isset($errors->{'default'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'default'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('An image to use as a fallback, either identicon, monsterid, wavatar, 404 or a URL to your own image.'));
$fieldset->appendChild($label);
$fieldset->appendChild($help);
$size = $page->createElement('div');
$label = Widget::Label(__('Size'));
$input = Widget::Input('fields[size]', $this->parameters()->{'size'});
$label->appendChild($input);
if (isset($errors->{'size'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'size'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Images sized from 1 to 512 pixels. Defaults to 80 pixels.'));
$size->appendChild($label);
$size->appendChild($help);
$rating = $page->createElement('div');
$label = Widget::Label(__('Rating'));
$input = Widget::Input('fields[rating]', $this->parameters()->{'rating'});
$label->appendChild($input);
if (isset($errors->{'rating'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'rating'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Specify a content rating of g, pg, r, or x. Defaults to g.'));
$rating->appendChild($label);
$rating->appendChild($help);
$fieldset->appendChild(Widget::Group($size, $rating));
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例15: __form
public function __form(Entry $existing = NULL)
{
$callback = Administration::instance()->getPageCallback();
$section = Section::load(sprintf('%s/%s.xml', SECTIONS, $callback['context']['section_handle']));
// Check that a layout and fields exist
if (isset($section->fields)) {
$this->alerts()->append(__('It looks like you\'re trying to create an entry. Perhaps you want fields first? <a href="%s">Click here to create some.</a>', array(ADMIN_URL . '/blueprints/sections/edit/' . $section->handle . '/')), AlertStack::ERROR);
}
$this->Form->setAttribute('enctype', 'multipart/form-data');
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), $section->name)));
$subheading = __('New Entry');
if (!is_null($existing) && $existing instanceof Entry) {
if (is_null($this->entry) || !$this->entry instanceof Entry) {
$this->entry = $existing;
}
// Grab the first field in the section
$first_field = $section->fields[0];
$field_data = (object) array();
if (!is_null($existing->data()->{$first_field->{'element-name'}})) {
$field_data = $existing->data()->{$first_field->{'element-name'}};
}
$subheading = $first_field->prepareTableValue($field_data);
}
if (is_null($this->entry) || !$this->entry instanceof Entry) {
$this->entry = new Entry();
}
$this->entry->section = $callback['context']['section_handle'];
$this->appendSubheading($subheading);
$this->entry->findDefaultFieldData();
$this->Form->appendChild(Widget::Input('MAX_FILE_SIZE', Symphony::Configuration()->core()->symphony->{'maximum-upload-size'}, 'hidden'));
// Check if there is a field to prepopulate
if (isset($_REQUEST['prepopulate']) && strlen(trim($_REQUEST['prepopulate'])) > 0) {
$field_handle = key($_REQUEST['prepopulate']);
$value = stripslashes(rawurldecode($_REQUEST['prepopulate'][$field_handle]));
$prepopulate_filter = "?prepopulate[{$field_handle}]=" . rawurlencode($value);
$this->Form->setAttribute('action', Administration::instance()->getCurrentPageURL() . $prepopulate_filter);
if (is_null($existing)) {
$this->entry->data()->{$field_handle}->value = $value;
}
}
// Status message:
if (isset($callback['flag']) and !is_null($callback['flag'])) {
switch ($callback['flag']) {
case 'saved':
$this->alerts()->append(__('Entry updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Entries</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/new/' . $prepopulate_filter, ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/')), AlertStack::SUCCESS);
break;
case 'created':
$this->alerts()->append(__('Entry created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Entries</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/new/' . $prepopulate_filter, ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/')), AlertStack::SUCCESS);
break;
}
}
// Load all the fields for this section
$section_fields = array();
foreach ($section->fields as $index => $field) {
$section_fields[$field->{'element-name'}] = $field;
}
$layout = new Layout();
if (is_array($section->layout) && !empty($section->layout)) {
foreach ($section->layout as $data) {
$column = $layout->createColumn($data->size);
foreach ($data->fieldsets as $data) {
$fieldset = $this->createElement('fieldset');
if (isset($data->collapsed) && $data->collapsed == 'yes') {
$fieldset->setAttribute('class', 'collapsed');
}
if (isset($data->name) && strlen(trim($data->name)) > 0) {
$fieldset->appendChild($this->createElement('h3', $data->name));
}
foreach ($data->fields as $handle) {
$field = $section_fields[$handle];
if (!$field instanceof Field) {
continue;
}
$div = $this->createElement('div', NULL, array('class' => trim(sprintf('field field-%s %s %s', $field->handle(), $this->__calculateWidth($field->width), $field->required == 'yes' ? 'required' : ''))));
$field->displayPublishPanel($div, isset($this->errors->{$field->{'element-name'}}) ? $this->errors->{$field->{'element-name'}} : new MessageStack(), $this->entry, $this->entry->data()->{$field->{'element-name'}});
$fieldset->appendChild($div);
}
$column->appendChild($fieldset);
}
$layout->appendTo($this->Form);
}
} else {
$this->alerts()->append(__('You haven\'t set any section layout rules. <a href="%s">Click here to define a layout.</a>', array(ADMIN_URL . '/blueprints/sections/layout/' . $section->handle . '/')), AlertStack::ERROR);
$column = $layout->createColumn(Layout::LARGE);
$fieldset = $this->createElement('fieldset');
$header = $this->createElement('h3', __('Untitled'));
$fieldset->appendChild($header);
if (is_array($section->fields)) {
foreach ($section->fields as $field) {
$div = $this->createElement('div', NULL, array('class' => trim(sprintf('field field-%s %s %s', $field->handle(), $this->__calculateWidth($field->width), $field->required == 'yes' ? 'required' : 'optional'))));
$field->displayPublishPanel($div, isset($this->errors->{$field->{'element-name'}}) ? $this->errors->{$field->{'element-name'}} : new MessageStack(), $this->entry, $this->entry->data()->{$field->{'element-name'}});
$fieldset->appendChild($div);
}
}
$column->appendChild($fieldset);
$layout->appendTo($this->Form);
}
$div = $this->createElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Submit('action[save]', $existing ? __('Save Changes') : __('Create Entry'), array('accesskey' => 's')));
//.........这里部分代码省略.........