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


PHP SectionManager::fetchIDFromHandle方法代码示例

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


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

示例1: init

 public static function init()
 {
     if (REST_API::getOutputFormat() == 'csv') {
         REST_API::sendError(sprintf('%s output format not supported.', strtoupper(REST_API::getOutputFormat())), 401, 'xml');
     }
     $request_uri = REST_API::getRequestURI();
     $section_reference = $request_uri[0];
     $sections = NULL;
     if (is_null($section_reference)) {
         $sections = SectionManager::fetch();
     } elseif (is_numeric($section_reference)) {
         $sections = SectionManager::fetch($section_reference);
     } else {
         $section_id = SectionManager::fetchIDFromHandle($section_reference);
         if ($section_id) {
             $sections = SectionManager::fetch($section_id);
         }
     }
     if (!is_array($sections)) {
         $sections = array($sections);
     }
     if (!reset($sections) instanceof Section) {
         REST_API::sendError(sprintf("Section '%s' not found.", $section_reference), 404);
     }
     self::$_sections = $sections;
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:26,代码来源:rest.sections.php

示例2: initaliseAdminPageHead

 public function initaliseAdminPageHead($context)
 {
     $page = Administration::instance()->Page;
     if ($page instanceof contentPublish) {
         $callback = Administration::instance()->getPageCallback();
         if ($callback['context']['page'] !== 'edit') {
             return;
         }
         $sm = new SectionManager(Administration::instance());
         $current_section = $sm->fetch($sm->fetchIDFromHandle($callback['context']['section_handle']));
         $current_section_hash = $this->serialiseSectionSchema($current_section);
         $duplicate_sections = array();
         foreach ($sm->fetch() as $section) {
             $section_hash = $this->serialiseSectionSchema($section);
             if ($section_hash == $current_section_hash && $section->get('handle')) {
                 $duplicate_sections[$section->get('handle')] = $section->get('name');
             }
         }
         if (count($duplicate_sections) < 2) {
             $duplicate_sections = NULL;
         }
         Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('duplicate-entry', " . json_encode(array('current-section' => $callback['context']['section_handle'], 'duplicate-sections' => $duplicate_sections)) . ");", array('type' => 'text/javascript')), time());
         $page->addScriptToHead(URL . '/extensions/duplicate_entry/assets/duplicate_entry.js', 10001);
         // add particular css for SSM
         Administration::instance()->Page->addElementToHead(new XMLElement('style', "body.inline.subsection #duplicate-entry { display: none; visibility: collapse }", array('type' => 'text/css')), time() + 101);
     }
 }
开发者ID:symphonists,项目名称:duplicate_entry,代码行数:27,代码来源:extension.driver.php

示例3: init

 public static function init()
 {
     if (REST_API::getOutputFormat() == 'csv' && !REST_API::getHTTPMethod() == 'get') {
         REST_API::sendError(sprintf('%s output format not supported for %s requests.', strtoupper(REST_API::getOutputFormat()), strtoupper(REST_API::getHTTPMethod())), 401, 'xml');
     }
     $request_uri = REST_API::getRequestURI();
     self::$_section_handle = $request_uri[0];
     self::$_entry_id = $request_uri[1];
     $section_id = SectionManager::fetchIDFromHandle(self::$_section_handle);
     if (!$section_id) {
         REST_API::sendError('Section not found.', 404);
     }
     self::$_section_id = $section_id;
     self::setDatasourceParam('included_elements', $_REQUEST['fields']);
     self::setDatasourceParam('limit', $_REQUEST['limit']);
     self::setDatasourceParam('page', $_REQUEST['page']);
     self::setDatasourceParam('sort', $_REQUEST['sort']);
     self::setDatasourceParam('order', $_REQUEST['order']);
     self::setDatasourceParam('groupby', $_REQUEST['groupby']);
     $filters = $_REQUEST['filter'];
     if (!is_null($filters) && !is_array($filters)) {
         $filters = array($filters);
     }
     self::setDatasourceParam('filters', $filters);
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:25,代码来源:rest.entries.php

示例4: hasInstance

 public static function hasInstance($ext_name = NULL, $section_handle)
 {
     $sid = SectionManager::fetchIDFromHandle($section_handle);
     $section = SectionManager::fetch($sid);
     $fm = $section->fetchFields($ext_name);
     return is_array($fm) && !empty($fm);
 }
开发者ID:nitriques,项目名称:enhanced_upload_field,代码行数:7,代码来源:extension.driver.php

示例5: __viewIndex

 public function __viewIndex()
 {
     $sm = new SectionManager($this->_Parent);
     $section = $sm->fetch($sm->fetchIDFromHandle($_GET['section']));
     $field_id = $_GET['field'];
     $fields = $section->fetchFields();
     foreach ($fields as $field) {
         if ($field->get('id') == $field_id) {
             $upload_field = $field;
         }
     }
     if (!$upload_field) {
         die('0|Invalid Field ID');
     }
     $status = $upload_field->checkPostFieldData($_FILES['Filedata'], $message);
     if ($status != Field::__OK__) {
         die($status . '|' . $message);
     }
     $processData = $upload_field->processRawFieldData($_FILES['Filedata'], $status, $message);
     if ($status != Field::__OK__) {
         die($status . '|' . $message);
     }
     echo Field::__OK__ . '|' . $processData['file'];
     die;
 }
开发者ID:nickdunn,项目名称:uploadify,代码行数:25,代码来源:content.upload.php

示例6: initializeAdmin

 public function initializeAdmin($context)
 {
     $page = Administration::instance()->Page;
     $context = $page->getContext();
     $callback = Administration::instance()->getPageCallback();
     // only proceed on New or Edit publish pages
     if ($page instanceof contentPublish and in_array($context['page'], array('new', 'edit'))) {
         $page->addStylesheetToHead(URL . '/extensions/publish_tabs/assets/publish_tabs.publish.css', 'screen', 9001);
         $page->addScriptToHead(URL . '/extensions/publish_tabs/assets/publish_tabs.publish.js', 9002);
         include_once TOOLKIT . '/class.sectionmanager.php';
         $section_id = SectionManager::fetchIDFromHandle($callback['context']['section_handle']);
         $section = SectionManager::fetch($section_id);
         if (!$section instanceof Section) {
             return;
         }
         $tabs = array();
         $current_tab = '';
         $index = -1;
         foreach ($section->fetchFieldsSchema() as $i => $field) {
             if ($i == 0 && $field['type'] != 'publish_tabs') {
                 $current_tab = 'untitled-tab';
                 $tabs[++$index]['tab_id'] = $current_tab;
             }
             if ($field['type'] == 'publish_tabs') {
                 $current_tab = $field['id'];
                 $tabs[++$index]['tab_id'] = $current_tab;
             } else {
                 $tabs[$index][$field['location']][] = 'field-' . $field['id'];
             }
         }
         $page->addElementToHead(new XMLElement('script', "Symphony.Context.add('publish-tabs', " . json_encode($tabs) . ")", array('type' => 'text/javascript')), 9003);
     }
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:33,代码来源:extension.driver.php

示例7: getSectionId

 public function getSectionId()
 {
     $sectionManager = new SectionManager(Frontend::instance());
     $section_id = $sectionManager->fetchIDFromHandle(General::sanitize($_REQUEST['MUUsource']));
     if (!($section = $sectionManager->fetch($section_id))) {
         return NULL;
     } else {
         return $section_id;
     }
 }
开发者ID:scottkf,项目名称:massuploadutility,代码行数:10,代码来源:content.index.php

示例8: findSection

 public static function findSection($handle)
 {
     if (!is_numeric($handle)) {
         $handle = SectionManager::fetchIDFromHandle($handle);
     }
     $ret = SectionManager::fetch($handle);
     if (!is_object($ret)) {
         self::throwEx('Section does not exist');
     }
     return $ret;
 }
开发者ID:alpacaaa,项目名称:image_info,代码行数:11,代码来源:class.images_info.php

示例9: initaliseAdminPageHead

 public function initaliseAdminPageHead($context)
 {
     $page = $context['oPage'];
     $assets_path = '/extensions/massuploadutility/assets/';
     // to check if it's an excluded section
     $section_id = SectionManager::fetchIDFromHandle($page->_context['section_handle']);
     if ($page instanceof contentPublish and $page->_context['page'] == 'new' and $this->validateSection($section_id) and $this->validateUser()) {
         Administration::instance()->Page->addStylesheetToHead(URL . $assets_path . 'massuploadutility.css', 'screen', 14145);
         Administration::instance()->Page->addScriptToHead(URL . $assets_path . 'massuploadutility.publish.js', 14156);
         Administration::instance()->Page->addScriptToHead(URL . $assets_path . 'jquery.html5_upload.js', 14156);
     }
 }
开发者ID:scottkf,项目名称:massuploadutility,代码行数:12,代码来源:extension.driver.php

示例10: appendScripts

 public function appendScripts($context)
 {
     $callback = $context['parent']->getPageCallback();
     if (in_array($callback['driver'], array('blueprintspages', 'blueprintsutilities'))) {
         $context['parent']->Page->addScriptToHead(URL . '/extensions/zencoding/assets/zen_textarea.min.js', 1000, false);
     }
     if ($callback['driver'] == 'publish') {
         $sectionManager = new SectionManager($context['parent']);
         $section_id = $sectionManager->fetchIDFromHandle($callback['context']['section_handle']);
         if ($this->__isAllowedSection($section_id)) {
             $context['parent']->Page->addScriptToHead(URL . '/extensions/zencoding/assets/zen_textarea.min.js', 1000, false);
         }
     }
 }
开发者ID:eKoeS,项目名称:symphony-zencoding,代码行数:14,代码来源:extension.driver.php

示例11: __viewIndex

 public function __viewIndex()
 {
     header('content-type: text/javascript');
     $sm = new SectionManager($this->_Parent);
     $section_id = $sm->fetchIDFromHandle($_GET['section']);
     $section = $sm->fetch($section_id);
     $em = new EntryManager($this->_Parent);
     $entry_id = $_GET['entry'];
     $e = $em->fetch($entry_id);
     $fields = array();
     $data = $e[0]->getData();
     foreach ($section->fetchFieldsSchema() as $field) {
         // Set field names and take strange date field name into account
         $field['element_name'] = $field['type'] == 'date' ? 'fields[' . $field['element_name'] . ']' . $field['element_name'] : 'fields[' . $field['element_name'] . ']';
         // Populate field elements with value, depending on field type
         switch ($field['type']) {
             case 'author':
                 $fields[$field['element_name']] = $data[$field['id']]['author_id'];
                 break;
             case 'upload':
                 $fields[$field['element_name']] = $data[$field['id']]['file'];
                 break;
             case 'selectbox_link':
                 $fields[$field['element_name']] = $data[$field['id']]['relation_id'];
                 break;
             case 'input':
             case 'textarea':
             case 'taglist':
             case 'select':
             case 'checkbox':
             case 'date':
             case 'order_entries':
                 $fields[$field['element_name']] = $data[$field['id']]['value'];
                 break;
             default:
                 if (!empty($data[$field['id']]['value'])) {
                     $fields[$field['element_name']] = $data[$field['id']]['value'];
                 } else {
                     // Fall back on first array element
                     // Add field type to switch for accurate specification
                     $fields[$field['element_name']] = $data[$field['id']][0];
                 }
                 break;
         }
     }
     echo 'jQuery(document).ready(function() { jQuery(\'form\').populate(' . json_encode($fields) . ")});\n";
     exit;
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:48,代码来源:content.data.php

示例12: dAdminPagePreGenerate

 public function dAdminPagePreGenerate($context)
 {
     $callback = Administration::instance()->getPageCallback();
     if ($callback['context']['page'] === 'edit') {
         /** @var $cxt XMLElement */
         $cxt = $context['oPage']->Context;
         if (!$cxt instanceof XMLElement) {
             return;
         }
         $actions = $cxt->getChildByName('ul', 0);
         // append list of actions if missing
         if (!$actions instanceof XMLElement) {
             $ul = new XMLelement('ul', null, array('class' => 'actions'));
             $cxt->appendChild($ul);
             $actions = $cxt->getChildByName('ul', 0);
         }
         // fetch entries
         $section_id = SectionManager::fetchIDFromHandle($callback['context']['section_handle']);
         $section = SectionManager::fetch($section_id);
         EntryManager::setFetchSorting($section->getSortingField(), $section->getSortingOrder());
         $entries = EntryManager::fetch(null, $section_id, null, null, null, null, null, false, false);
         // get next and prev
         $entry_id = $prev_id = $next_id = $callback['context']['entry_id'];
         $count = count($entries);
         for ($i = 0; $i < $count; $i++) {
             if ($entries[$i]['id'] == $entry_id) {
                 $prev_id = $i == 0 ? $entries[$count - 1]['id'] : $entries[$i - 1]['id'];
                 $next_id = $i == $count - 1 ? $entries[0]['id'] : $entries[$i + 1]['id'];
                 break;
             }
         }
         if ($prev_id == $entry_id && $next_id == $entry_id) {
             return;
         }
         // add buttons
         $li = new XMLelement('li', null, array('class' => 'entry-nav'));
         if ($prev_id !== $entry_id) {
             $li->appendChild(Widget::Anchor(__('&larr; Previous'), SYMPHONY_URL . $callback['pageroot'] . 'edit/' . $prev_id, null, 'button entry-nav-prev', null, array('accesskey' => 'z')));
         }
         if ($next_id !== $entry_id) {
             $li->appendChild(Widget::Anchor(__('Next &rarr;'), SYMPHONY_URL . $callback['pageroot'] . 'edit/' . $next_id, null, 'button entry-nav-next', null, array('accesskey' => 'x')));
         }
         $actions->appendChild($li);
     }
 }
开发者ID:sputnikenmeister,项目名称:entry_nav,代码行数:45,代码来源:extension.driver.php

示例13: getSection

 /**
  * Get a Section object from a handle or ID. If section is not found, returns null
  *
  * @param $section (optional) - section handle or ID. If null, section handle will be taken form $callback
  *
  * @return null|Section
  */
 public static function getSection($section = null)
 {
     if ($section instanceof Section) {
         return $section;
     }
     if ($section === null) {
         $callback = Administration::instance()->getPageCallback();
         if (!isset($callback['context']['section_handle'])) {
             return null;
         }
         $section = $callback['context']['section_handle'];
     }
     $section_id = is_numeric($section) ? $section : SectionManager::fetchIDFromHandle($section);
     $s = SectionManager::fetch($section_id);
     if (!$s instanceof Section) {
         return null;
     }
     return $s;
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:26,代码来源:class.LSE.php

示例14: __viewIndex

 public function __viewIndex()
 {
     header('content-type: text/javascript');
     $sm = new SectionManager($this->_Parent);
     $section_id = $sm->fetchIDFromHandle($_GET['section']);
     $section = $sm->fetch($section_id);
     $fields = array();
     foreach ($section->fetchFilterableFields() as $field) {
         $html = new XMLElement('html');
         $field->displayPublishPanel($html);
         $dom = new DomDocument();
         $dom->loadXML($html->generate());
         $xpath = new DomXPath($dom);
         $count = 0;
         // if the generated HTML contains a file upload element
         foreach ($xpath->query("//*[name()='input' and @type='file']") as $file) {
             $fields[$field->get('element_name')]['section'] = $_GET['section'];
             $fields[$field->get('element_name')]['field_id'] = $field->get('id');
             $fields[$field->get('element_name')]['handle'] = $field->get('element_name');
             $fields[$field->get('element_name')]['destination'] = $field->get('destination');
             // if a validator regular expression has been set we need to parse and explode into Uploadify syntax
             if ($field->get('validator')) {
                 $validator = str_replace('$/i', '', $field->get('validator'));
                 $validator = trim($validator, '():?[]\\/.');
                 $validator = explode('|', $validator);
                 foreach ($validator as $type) {
                     if ($type == 'jpe?g') {
                         $fields[$field->get('element_name')]['types'] .= '*.jpg;*.jpeg;';
                     } else {
                         $fields[$field->get('element_name')]['types'] .= '*.' . $type . ';';
                     }
                 }
                 $fields[$field->get('element_name')]['types'] = trim($fields[$field->get('element_name')]['types'], ';');
             } else {
                 $fields[$field->get('element_name')]['types'] = '*.*';
             }
         }
     }
     echo 'var upload_fields = ', json_encode($fields), ";\n";
     echo 'var PHPSESSID = "', session_id(), "\";\n";
     exit;
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:42,代码来源:content.upload_fields.php

示例15: adminPagePostCallback

 public function adminPagePostCallback($context)
 {
     // check if logged in
     if (!Administration::instance()->isLoggedIn()) {
         return;
     }
     // check driver
     if ($context['callback']['driver'] !== 'publish') {
         return;
     }
     // get context
     $page = $context['callback']['context']['page'];
     $section = $context['callback']['context']['section_handle'];
     // check section
     if (!($section = SectionManager::fetchIDFromHandle($section))) {
         return;
     }
     if (!($section = SectionManager::fetch($section))) {
         return;
     }
     // check setting
     if ($section->get('single') !== 'yes') {
         return;
     }
     // set flag
     $this->single = true;
     // check page
     if ($page === 'edit') {
         return;
     }
     // check entries
     if ($entries = EntryManager::fetch(null, $section->get('id'), 1, 0)) {
         // set entry
         $context['callback']['context']['entry_id'] = current($entries)->get('id');
         // reroute
         $context['callback']['context']['page'] = 'edit';
     } else {
         // reroute
         $context['callback']['context']['page'] = 'new';
     }
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:41,代码来源:extension.driver.php


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