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


PHP DataSource::getHandleFromFilename方法代码示例

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


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

示例1: __viewIndex

 public function __viewIndex()
 {
     // This is the 'correct' way to append a string containing an entity
     $title = $this->createElement('title');
     $title->appendChild($this->createTextNode(__('Symphony') . ' '));
     $title->appendChild($this->createEntityReference('ndash'));
     $title->appendChild($this->createTextNode(' ' . __('Data Sources')));
     $this->insertNodeIntoHead($title);
     $this->appendSubheading(__('Data Sources'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new data source'), 'class' => 'create button')));
     $datasources = new DatasourceIterator();
     $dsTableHead = array(array(__('Name'), 'col'), array(__('Source'), 'col'), array(__('Type'), 'col'), array(__('Used By'), 'col'));
     $dsTableBody = array();
     $colspan = count($dsTableHead);
     if ($datasources->length() <= 0) {
         $dsTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd')));
     } else {
         //	Load Views so we can determine what Datasources are attached
         if (!self::$_loaded_views) {
             foreach (new ViewIterator() as $view) {
                 self::$_loaded_views[$view->guid] = array('title' => $view->title, 'handle' => $view->handle, 'data-sources' => $view->{'data-sources'});
             }
         }
         foreach ($datasources as $pathname) {
             $ds = DataSource::load($pathname);
             $view_mode = $ds->allowEditorToParse() == true ? 'edit' : 'info';
             $handle = DataSource::getHandleFromFilename($pathname);
             // Name
             $col_name = Widget::TableData(Widget::Anchor($ds->about()->name, ADMIN_URL . "/blueprints/datasources/{$view_mode}/{$handle}/", array('title' => $ds->parameters()->pathname)));
             $col_name->appendChild(Widget::Input("items[{$handle}]", NULL, 'checkbox'));
             // Source
             try {
                 $col_source = $ds->prepareSourceColumnValue();
             } catch (Exception $e) {
                 $col_source = Widget::TableData(__('None'), array('class' => 'inactive'));
             }
             // Used By
             $fragment_views = $this->createDocumentFragment();
             foreach (self::$_loaded_views as $view) {
                 if (is_array($view['data-sources']) && in_array($handle, $view['data-sources'])) {
                     if ($fragment_views->hasChildNodes()) {
                         $fragment_views->appendChild(new DOMText(', '));
                     }
                     $fragment_views->appendChild(Widget::Anchor($view['title'], ADMIN_URL . "/blueprints/views/edit/{$view['handle']}/"));
                 }
             }
             if (!$fragment_views->hasChildNodes()) {
                 $col_views = Widget::TableData(__('None'), array('class' => 'inactive'));
             } else {
                 $col_views = Widget::TableData($fragment_views);
             }
             // Type
             if (is_null($ds->getType())) {
                 $col_type = Widget::TableData(__('Unknown'), array('class' => 'inactive'));
             } else {
                 $col_type = Widget::TableData($this->types[$ds->getType()]->name);
             }
             $dsTableBody[] = Widget::TableRow(array($col_name, $col_source, $col_type, $col_views));
         }
     }
     $table = Widget::Table(Widget::TableHead($dsTableHead), NULL, Widget::TableBody($dsTableBody), array('id' => 'datasources-list'));
     $this->Form->appendChild($table);
     $tableActions = $this->createElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:68,代码来源:content.blueprintsdatasources.php

示例2: __form


//.........这里部分代码省略.........
     $title = null;
     if (isset($fields['title'])) {
         $title = $fields['title'];
     }
     if (strlen(trim($title)) == 0) {
         $title = $existing instanceof View ? $existing->title : 'New View';
     }
     $this->setTitle(__($title ? '%1$s &ndash; %2$s &ndash; %3$s' : '%1$s &ndash; %2$s', array(__('Symphony'), __('Views'), $title)));
     if ($existing instanceof View) {
         $template_name = $fields['handle'];
         $this->appendSubheading(__($title ? $title : __('New View')));
         $viewoptions = array(__('Configuration') => Administration::instance()->getCurrentPageURL(), __('Template') => sprintf('%s/blueprints/views/template/%s/', ADMIN_URL, $view_pathname));
         $this->appendViewOptions($viewoptions);
     } else {
         $this->appendSubheading($title ? $title : __('Untitled'));
     }
     // Fieldset -----------------------------------------------------------
     $fieldset = Widget::Fieldset(__('Essentials'));
     // Title --------------------------------------------------------------
     $label = Widget::Label(__('Title'));
     $label->appendChild(Widget::Input('fields[title]', isset($fields['title']) ? $fields['title'] : null));
     if (isset($this->errors->title)) {
         $label = Widget::wrapFormElementWithError($label, $this->errors->title);
     }
     $fieldset->appendChild($label);
     // Type ---------------------------------------------------------------
     $container = $this->createElement('div');
     $label = Widget::Label(__('View Type'));
     $label->appendChild(Widget::Input('fields[types]', isset($fields['types']) ? $fields['types'] : null));
     if (isset($this->errors->types)) {
         $label = Widget::wrapFormElementWithError($label, $this->errors->types);
     }
     $tags = $this->createElement('ul');
     $tags->setAttribute('class', 'tags');
     foreach (self::__fetchAvailableViewTypes() as $t) {
         $tags->appendChild($this->createElement('li', $t));
     }
     $container->appendChild($label);
     $container->appendChild($tags);
     $fieldset->appendChild($container);
     $left->appendChild($fieldset);
     // Fieldset -----------------------------------------------------------
     $fieldset = Widget::Fieldset(__('URL Settings'));
     // Parent -------------------------------------------------------------
     $label = Widget::Label(__('Parent'));
     $options = array(array(NULL, false, '/'));
     foreach (new ViewIterator() as $v) {
         // Make sure the current view cannot be set as either a child of itself, or a child of
         // another view that is already at child of the current view.
         if (isset($existing) && $existing instanceof View && ($v->isChildOf($existing) || $v->guid == $existing->guid)) {
             continue;
         }
         $options[] = array($v->path, isset($fields['parent']) and $fields['parent'] == $v->path, "/{$v->path}");
     }
     $label->appendChild(Widget::Select('fields[parent]', $options));
     $fieldset->appendChild($label);
     // Handle -------------------------------------------------------------
     $label = Widget::Label(__('Handle'));
     $label->appendChild(Widget::Input('fields[handle]', isset($fields['handle']) ? $fields['handle'] : null));
     if (isset($this->errors->handle)) {
         $label = Widget::wrapFormElementWithError($label, $this->errors->handle);
     }
     $fieldset->appendChild($label);
     // Parameters ---------------------------------------------------------
     $label = Widget::Label(__('Parameters'));
     $label->appendChild(Widget::Input('fields[url-parameters]', isset($fields['url-parameters']) ? $fields['url-parameters'] : null));
     $fieldset->appendChild($label);
     $center->appendChild($fieldset);
     // Fieldset -----------------------------------------------------------
     $fieldset = Widget::Fieldset(__('Resources'));
     $label = Widget::Label(__('Events'));
     $options = array();
     foreach (new EventIterator() as $pathname) {
         $event = Event::load($pathname);
         $handle = Event::getHandleFromFilename($pathname);
         $options[] = array($handle, in_array($handle, (array) $fields['events']), $event->about()->name);
     }
     $label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple')));
     $fieldset->appendChild($label);
     // Data Sources -------------------------------------------------------
     $label = Widget::Label(__('Data Sources'));
     $options = array();
     foreach (new DataSourceIterator() as $pathname) {
         $ds = DataSource::load($pathname);
         $handle = DataSource::getHandleFromFilename($pathname);
         $options[] = array($handle, in_array($handle, (array) $fields['data-sources']), $ds->about()->name);
     }
     $label->appendChild(Widget::Select('fields[data-sources][]', $options, array('multiple' => 'multiple')));
     $fieldset->appendChild($label);
     $right->appendChild($fieldset);
     $layout->appendTo($this->Form);
     // Controls -----------------------------------------------------------
     $div = $this->createElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Submit('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create View'), array('accesskey' => 's')));
     if ($this->_context[0] == 'edit') {
         $div->appendChild(Widget::Submit('action[delete]', __('Delete'), array('class' => 'confirm delete', 'title' => __('Delete this view'))));
     }
     $this->Form->appendChild($div);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:101,代码来源:content.blueprintsviews.php


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