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


PHP PageManager::createFilePath方法代码示例

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


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

示例1: __viewEdit

 public function __viewEdit()
 {
     $this->setPageType('form');
     $fields = array("title" => null, "handle" => null, "parent" => null, "params" => null, "type" => null, "data_sources" => null);
     $existing = $fields;
     $nesting = Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes';
     // Verify page exists:
     if ($this->_context[0] == 'edit') {
         if (!($page_id = (int) $this->_context[1])) {
             redirect(SYMPHONY_URL . '/blueprints/pages/');
         }
         $existing = PageManager::fetchPageByID($page_id);
         if (!$existing) {
             Administration::instance()->errorPageNotFound();
         } else {
             $existing['type'] = PageManager::fetchPageTypes($page_id);
         }
     }
     // Status message:
     if (isset($this->_context[2])) {
         $flag = $this->_context[2];
         $link_suffix = '';
         if (isset($_REQUEST['parent']) && is_numeric($_REQUEST['parent'])) {
             $link_suffix = "?parent=" . $_REQUEST['parent'];
         } else {
             if ($nesting == true && isset($existing) && !is_null($existing['parent'])) {
                 $link_suffix = '?parent=' . $existing['parent'];
             }
         }
         switch ($flag) {
             case 'saved':
                 $this->pageAlert(__('Page updated at %s.', array(DateTimeObj::getTimeAgo())) . ' <a href="' . SYMPHONY_URL . '/blueprints/pages/new/" accesskey="c">' . __('Create another?') . '</a> <a href="' . SYMPHONY_URL . '/blueprints/pages/" accesskey="a">' . __('View all Pages') . '</a>', Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Page created at %s.', array(DateTimeObj::getTimeAgo())) . ' <a href="' . SYMPHONY_URL . '/blueprints/pages/new/" accesskey="c">' . __('Create another?') . '</a> <a href="' . SYMPHONY_URL . '/blueprints/pages/" accesskey="a">' . __('View all Pages') . '</a>', Alert::SUCCESS);
         }
     }
     // Find values:
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     } elseif ($this->_context[0] == 'edit') {
         $fields = $existing;
         if (!is_null($fields['type'])) {
             $fields['type'] = implode(', ', $fields['type']);
         }
         $fields['data_sources'] = preg_split('/,/i', $fields['data_sources'], -1, PREG_SPLIT_NO_EMPTY);
         $fields['events'] = preg_split('/,/i', $fields['events'], -1, PREG_SPLIT_NO_EMPTY);
     } elseif (isset($_REQUEST['parent']) && is_numeric($_REQUEST['parent'])) {
         $fields['parent'] = $_REQUEST['parent'];
     }
     $title = $fields['title'];
     if (trim($title) == '') {
         $title = $existing['title'];
     }
     $this->setTitle(__($title ? '%1$s &ndash; %2$s &ndash; %3$s' : '%2$s &ndash; %3$s', array($title, __('Pages'), __('Symphony'))));
     $page_id = isset($page_id) ? $page_id : null;
     if (!empty($title)) {
         $template_name = $fields['handle'];
         $page_url = URL . '/' . PageManager::resolvePagePath($page_id) . '/';
         if ($existing['parent']) {
             $parents = PageManager::resolvePagePath($existing['parent']);
             $template_name = PageManager::createFilePath($parents, $fields['handle']);
         }
         $this->appendSubheading($title, array(Widget::Anchor(__('View Page'), $page_url, __('View Page on Frontend'), 'button', NULL, array('target' => '_blank', 'accesskey' => 'v')), Widget::Anchor(__('Edit Page Template'), SYMPHONY_URL . '/blueprints/pages/template/' . $template_name, __('Edit Page Template'), 'button', NULL, array('accesskey' => 't'))));
     } else {
         $this->appendSubheading(!empty($title) ? $title : __('Untitled'));
     }
     if (isset($page_id)) {
         $this->insertBreadcrumbsUsingPageIdentifier($page_id, false);
     } else {
         $_GET['parent'] = isset($_GET['parent']) ? $_GET['parent'] : null;
         $this->insertBreadcrumbsUsingPageIdentifier((int) $_GET['parent'], true);
     }
     // Title --------------------------------------------------------------
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Page Settings')));
     $label = Widget::Label(__('Title'));
     $label->appendChild(Widget::Input('fields[title]', General::sanitize($fields['title'])));
     if (isset($this->_errors['title'])) {
         $label = Widget::Error($label, $this->_errors['title']);
     }
     $fieldset->appendChild($label);
     // Handle -------------------------------------------------------------
     $group = new XMLElement('div');
     $group->setAttribute('class', 'two columns');
     $column = new XMLElement('div');
     $column->setAttribute('class', 'column');
     $label = Widget::Label(__('URL Handle'));
     $label->appendChild(Widget::Input('fields[handle]', $fields['handle']));
     if (isset($this->_errors['handle'])) {
         $label = Widget::Error($label, $this->_errors['handle']);
     }
     $column->appendChild($label);
     // Parent ---------------------------------------------------------
     $label = Widget::Label(__('Parent Page'));
     $where = array(sprintf('id != %d', $page_id));
     $pages = PageManager::fetch(false, array('id'), $where, 'title ASC');
     $options = array(array('', false, '/'));
     if (!empty($pages)) {
//.........这里部分代码省略.........
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:101,代码来源:content.blueprintspages.php

示例2: resolvePageFileLocation

 /**
  * Resolves the path to this page's XSLT file. The Symphony convention
  * is that they are stored in the `PAGES` folder. If this page has a parent
  * it will be as if all the / in the URL have been replaced with _. ie.
  * /articles/read/ will produce a file `articles_read.xsl`
  *
  * @see toolkit.PageManager#createFilePath()
  * @param string $path
  *  The URL path to this page, excluding the current page. ie, /articles/read
  *  would make `$path` become articles/
  * @param string $handle
  *  The handle of the page.
  * @return string
  *  The path to the XSLT of the page
  */
 public static function resolvePageFileLocation($path, $handle)
 {
     return PAGES . '/' . PageManager::createFilePath($path, $handle) . '.xsl';
 }
开发者ID:nickdunn,项目名称:elasticsearch-surfin-shakespeare,代码行数:19,代码来源:class.pagemanager.php

示例3: __viewIndex

 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Pages'), __('Symphony'))));
     $nesting = Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes';
     if ($nesting && isset($_GET['parent']) && is_numeric($_GET['parent'])) {
         $parent = PageManager::fetchPageByID((int) $_GET['parent'], array('title', 'id'));
     }
     $this->appendSubheading(isset($parent) ? $parent['title'] : __('Pages'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/' . ($nesting && isset($parent) ? "?parent={$parent['id']}" : null), __('Create a new page'), 'create button', null, array('accesskey' => 'c')));
     if (isset($parent)) {
         $this->insertBreadcrumbsUsingPageIdentifier($parent['id'], false);
     }
     $aTableHead = array(array(__('Name'), 'col'), array(__('Template'), 'col'), array('<abbr title="' . __('Universal Resource Locator') . '">' . __('URL') . '</abbr>', 'col'), array(__('Parameters'), 'col'), array(__('Type'), 'col'));
     $aTableBody = array();
     if ($nesting) {
         $aTableHead[] = array(__('Children'), 'col');
         $where = array('parent ' . (isset($parent) ? " = {$parent['id']} " : ' IS NULL '));
     } else {
         $where = array();
     }
     $pages = PageManager::fetch(true, array('*'), $where);
     if (!is_array($pages) || empty($pages)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', null, count($aTableHead))), 'odd'));
     } else {
         foreach ($pages as $page) {
             $class = array();
             $page_title = $nesting ? $page['title'] : PageManager::resolvePageTitle($page['id']);
             $page_url = URL . '/' . PageManager::resolvePagePath($page['id']) . '/';
             $page_edit_url = Administration::instance()->getCurrentPageURL() . 'edit/' . $page['id'] . '/';
             $page_template = PageManager::createFilePath($page['path'], $page['handle']);
             $col_title = Widget::TableData(Widget::Anchor($page_title, $page_edit_url, $page['handle']));
             $col_title->appendChild(Widget::Label(__('Select Page %s', array($page_title)), null, 'accessible', null, array('for' => 'page-' . $page['id'])));
             $col_title->appendChild(Widget::Input('items[' . $page['id'] . ']', 'on', 'checkbox', array('id' => 'page-' . $page['id'])));
             $col_template = Widget::TableData($page_template . '.xsl');
             $col_url = Widget::TableData(Widget::Anchor($page_url, $page_url));
             if ($page['params']) {
                 $col_params = Widget::TableData(trim($page['params'], '/'));
             } else {
                 $col_params = Widget::TableData(__('None'), 'inactive');
             }
             if (!empty($page['type'])) {
                 $col_types = Widget::TableData(implode(', ', $page['type']));
             } else {
                 $col_types = Widget::TableData(__('None'), 'inactive');
             }
             if (in_array($page['id'], $this->_hilights)) {
                 $class[] = 'failed';
             }
             $columns = array($col_title, $col_template, $col_url, $col_params, $col_types);
             if ($nesting) {
                 if (PageManager::hasChildPages($page['id'])) {
                     $col_children = Widget::TableData(Widget::Anchor(PageManager::getChildPagesCount($page['id']) . ' &rarr;', SYMPHONY_URL . '/blueprints/pages/?parent=' . $page['id']));
                 } else {
                     $col_children = Widget::TableData(__('None'), 'inactive');
                 }
                 $columns[] = $col_children;
             }
             $aTableBody[] = Widget::TableRow($columns, implode(' ', $class));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody), 'orderable selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
     $this->Form->appendChild($table);
     $version = new XMLElement('p', 'Symphony ' . Symphony::Configuration()->get('version', 'symphony'), array('id' => 'version'));
     $this->Form->appendChild($version);
     $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 pages?'))));
     /**
      * 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/pages/'
      * @param array $options
      *  An array of arrays, where each child array represents an option
      *  in the With Selected menu. Options should follow the same format
      *  expected by `Widget::__SelectBuildOption`. Passed by reference.
      */
     Symphony::ExtensionManager()->notifyMembers('AddCustomActions', '/blueprints/pages/', array('options' => &$options));
     if (!empty($options)) {
         $tableActions->appendChild(Widget::Apply($options));
         $this->Form->appendChild($tableActions);
     }
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:87,代码来源:content.blueprintspages.php


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