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


PHP FieldManager::fetch方法代码示例

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


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

示例1: view

 public function view()
 {
     $sectionManager = new SectionManager(Administration::instance());
     $fieldManager = new FieldManager(Administration::instance());
     // Fetch sections & populate a dropdown with the available upload fields
     $section = $sectionManager->fetch($_GET['section']);
     foreach ($section->fetchFields() as $field) {
         if (!preg_match(Extension_BulkImporter::$supported_fields['upload'], $field->get('type'))) {
             continue;
         }
         $element = new XMLElement("field", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type')));
         $this->_Result->appendChild($element);
     }
     // Check to see if any Sections link to this using the Section Associations table
     $associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t`child_section_field_id`\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_sections_association`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`parent_section_id` = %d\n\t\t\t\t", Symphony::Database()->cleanValue($_GET['section'])));
     if (is_array($associations) && !empty($associations)) {
         foreach ($associations as $related_field) {
             $field = $fieldManager->fetch($related_field['child_section_field_id']);
             if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) {
                 continue;
             }
             $element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name')));
             $this->_Result->appendChild($element);
         }
     }
     // Check for Subsection Manager
     if (Symphony::ExtensionManager()->fetchStatus('subsectionmanager') == EXTENSION_ENABLED) {
         $associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`field_id`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_fields_subsectionmanager`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`subsection_id` = %d\n\t\t\t\t\t", Symphony::Database()->cleanValue($_GET['section'])));
         if (is_array($associations) && !empty($associations)) {
             foreach ($associations as $related_field) {
                 $field = $fieldManager->fetch($related_field['field_id']);
                 if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) {
                     continue;
                 }
                 $element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name')));
                 $this->_Result->appendChild($element);
             }
         }
     }
     // Check for BiLink
     if (Symphony::ExtensionManager()->fetchStatus('bilinkfield') == EXTENSION_ENABLED) {
         $associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`field_id`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_fields_bilink`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`linked_section_id` = %d\n\t\t\t\t\t", Symphony::Database()->cleanValue($_GET['section'])));
         if (is_array($associations) && !empty($associations)) {
             foreach ($associations as $related_field) {
                 $field = $fieldManager->fetch($related_field['field_id']);
                 if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) {
                     continue;
                 }
                 $element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name')));
                 $this->_Result->appendChild($element);
             }
         }
     }
 }
开发者ID:brendo,项目名称:bulkimporter,代码行数:54,代码来源:content.ajaxsectioninfo.php

示例2: entrySaved

 public function entrySaved($context)
 {
     require_once MANIFEST . '/jit-recipes.php';
     require_once MANIFEST . '/jit-precaching.php';
     require_once TOOLKIT . '/class.fieldmanager.php';
     $fm = new FieldManager(Symphony::Engine());
     $section = $context['section'];
     if (!$section) {
         require_once TOOLKIT . '/class.sectionmanager.php';
         $sm = new SectionManager(Symphony::Engine());
         $section = $sm->fetch($context['entry']->get('section_id'));
     }
     // iterate over each field in this entry
     foreach ($context['entry']->getData() as $field_id => $data) {
         // get the field meta data
         $field = $fm->fetch($field_id);
         // iterate over the field => recipe mapping
         foreach ($cached_recipes as $cached_recipe) {
             // check a mapping exists for this section/field combination
             if ($section->get('handle') != $cached_recipe['section']) {
                 continue;
             }
             if ($field->get('element_name') != $cached_recipe['field']) {
                 continue;
             }
             // iterate over the recipes mapped for this section/field combination
             foreach ($cached_recipe['recipes'] as $cached_recipe_name) {
                 // get the file name, includes path relative to workspace
                 $file = $data['file'];
                 if (!isset($file) || is_null($file)) {
                     continue;
                 }
                 // trim the filename from path
                 $uploaded_file_path = explode('/', $file);
                 array_pop($uploaded_file_path);
                 // image path relative to workspace
                 if (is_array($uploaded_file_path)) {
                     $uploaded_file_path = implode('/', $uploaded_file_path);
                 }
                 // iterate over all JIT recipes
                 foreach ($recipes as $recipe) {
                     // only process if the recipe has a URL Parameter (name)
                     if (is_null($recipe['url-parameter'])) {
                         continue;
                     }
                     // if not using wildcard, only process specified recipe names
                     if ($cached_recipe_name != '*' && $cached_recipe_name != $recipe['url-parameter']) {
                         continue;
                     }
                     // process the image using the usual JIT URL and get the result
                     $image_data = file_get_contents(URL . '/image/' . $recipe['url-parameter'] . $file);
                     // create a directory structure that matches the JIT URL structure
                     General::realiseDirectory(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $uploaded_file_path);
                     // save the image to disk
                     file_put_contents(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $file, $image_data);
                 }
             }
         }
     }
 }
开发者ID:nickdunn,项目名称:jit_precaching,代码行数:60,代码来源:extension.driver.php

示例3: view

 public function view()
 {
     $this->addHeaderToPage('Content-Type', 'text/html');
     $field_id = $this->_context[0];
     $entry_id = $this->_context[1];
     $this->_context['entry_id'] = $entry_id;
     try {
         $entry = EntryManager::fetch($entry_id);
         $entry = $entry[0];
         if (!is_a($entry, 'Entry')) {
             $this->_status = 404;
             return;
         }
         $field = FieldManager::fetch($field_id);
         if (!is_a($field, 'Field')) {
             $this->_status = 404;
             return;
         }
         $field->set('id', $field_id);
         $entry_data = $entry->getData();
         $data = new XMLElement('field');
         $field->displayPublishPanel($data, $entry_data[$field_id]);
         echo $data->generate(true);
         exit;
         $this->_Result->appendChild($data);
     } catch (Exception $e) {
     }
 }
开发者ID:jonmifsud,项目名称:email_newsletter_manager,代码行数:28,代码来源:content.publishfield.php

示例4: getXPath

 public function getXPath($entry)
 {
     $fieldManager = new FieldManager(Symphony::Engine());
     $entry_xml = new XMLElement('entry');
     $section_id = $entry->get('section_id');
     $data = $entry->getData();
     $fields = array();
     $entry_xml->setAttribute('id', $entry->get('id'));
     $associated = $entry->fetchAllAssociatedEntryCounts();
     if (is_array($associated) and !empty($associated)) {
         foreach ($associated as $section => $count) {
             $handle = Symphony::Database()->fetchVar('handle', 0, "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\ts.handle\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_sections` AS s\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ts.id = '{$section}'\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t");
             $entry_xml->setAttribute($handle, (string) $count);
         }
     }
     // Add fields:
     foreach ($data as $field_id => $values) {
         if (empty($field_id)) {
             continue;
         }
         $field = $fieldManager->fetch($field_id);
         $field->appendFormattedElement($entry_xml, $values, false, null);
     }
     $xml = new XMLElement('data');
     $xml->appendChild($entry_xml);
     $dom = new DOMDocument();
     $dom->strictErrorChecking = false;
     $dom->loadXML($xml->generate(true));
     $xpath = new DOMXPath($dom);
     if (version_compare(phpversion(), '5.3', '>=')) {
         $xpath->registerPhpFunctions();
     }
     return $xpath;
 }
开发者ID:nickdunn,项目名称:reflectionfield,代码行数:34,代码来源:extension.driver.php

示例5: appendErrors

 /**
  * Appends errors generated from fields during the execution of an Event
  *
  * @param XMLElement $result
  * @param array $fields
  * @param array $errors
  * @param object $post_values
  * @throws Exception
  * @return XMLElement
  */
 public static function appendErrors(XMLElement $result, array $fields, $errors, $post_values)
 {
     $result->setAttribute('result', 'error');
     $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.'), array('message-id' => EventMessages::ENTRY_ERRORS)));
     foreach ($errors as $field_id => $message) {
         $field = FieldManager::fetch($field_id);
         // Do a little bit of a check for files so that we can correctly show
         // whether they are 'missing' or 'invalid'. If it's missing, then we
         // want to remove the data so `__reduceType` will correctly resolve to
         // missing instead of invalid.
         // @see https://github.com/symphonists/s3upload_field/issues/17
         if (isset($_FILES['fields']['error'][$field->get('element_name')])) {
             $upload = $_FILES['fields']['error'][$field->get('element_name')];
             if ($upload === UPLOAD_ERR_NO_FILE) {
                 unset($fields[$field->get('element_name')]);
             }
         }
         if (is_array($fields[$field->get('element_name')])) {
             $type = array_reduce($fields[$field->get('element_name')], array('SectionEvent', '__reduceType'));
         } else {
             $type = $fields[$field->get('element_name')] == '' ? 'missing' : 'invalid';
         }
         $error = self::createError($field, $type, $message);
         $result->appendChild($error);
     }
     if (isset($post_values) && is_object($post_values)) {
         $result->appendChild($post_values);
     }
     return $result;
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:40,代码来源:class.event.section.php

示例6: findAllFields

 public function findAllFields($section_id)
 {
     $fieldManager = new FieldManager(Symphony::Engine());
     $fields = $fieldManager->fetch(NULL, $section_id, 'ASC', 'sortorder', NULL, NULL, 'AND (type != "fop")');
     if (is_array($fields) && !empty($fields)) {
         foreach ($fields as $field) {
             $options[] = 'entry/' . $field->get('element_name');
         }
     }
     return $options;
 }
开发者ID:nanymor,项目名称:fop,代码行数:11,代码来源:field.fop.php

示例7: fetch

 /**
  * This function will return an array of Entry objects given an ID or an array of ID's.
  * Do not provide `$entry_id` as an array if not specifying the `$section_id`. This function
  * is commonly passed custom SQL statements through the `$where` and `$join` parameters
  * that is generated by the fields of this section
  *
  * @param integer|array $entry_id
  *  An array of Entry ID's or an Entry ID to return
  * @param integer $section_id
  *  The ID of the Section that these entries are contained in
  * @param integer $limit
  *  The limit of entries to return
  * @param integer $start
  *  The starting offset of the entries to return
  * @param string $where
  *  Any custom WHERE clauses
  * @param string $joins
  *  Any custom JOIN's
  * @param boolean $group
  *  Whether the entries need to be grouped by Entry ID or not
  * @param boolean $records_only
  *  If this is set to true, an array of Entry objects will be returned
  *  without any basic pagination information. Defaults to false
  * @param boolean $buildentries
  *  Whether to return an array of entry ID's or Entry objects. Defaults to
  *  true, which will return Entry objects
  * @param array $element_names
  *  Choose whether to get data from a subset of fields or all fields in a section,
  *  by providing an array of field names. Defaults to null, which will load data
  *  from all fields in a section.
  */
 public function fetch($entry_id = null, $section_id = null, $limit = null, $start = null, $where = null, $joins = null, $group = false, $buildentries = true, $element_names = null)
 {
     $sort = null;
     if (!$entry_id && !$section_id) {
         return false;
     }
     if (!$section_id) {
         $section_id = $this->fetchEntrySectionID($entry_id);
     }
     $section = $this->sectionManager->fetch($section_id);
     if (!is_object($section)) {
         return false;
     }
     ## SORTING
     // A single $entry_id doesn't need to be sorted on
     if (!is_array($entry_id) && !is_null($entry_id) && is_int($entry_id)) {
         $sort = null;
     } else {
         if ($this->_fetchSortDirection == 'RAND') {
             $sort = 'ORDER BY RAND() ';
         } else {
             if ($this->_fetchSortField == 'date') {
                 $sort = 'ORDER BY `e`.`creation_date` ' . $this->_fetchSortDirection;
             } else {
                 if ($this->_fetchSortField == 'id') {
                     $sort = 'ORDER BY `e`.`id`' . $this->_fetchSortDirection;
                 } else {
                     if ($this->_fetchSortField && ($field = $this->fieldManager->fetch($this->_fetchSortField))) {
                         $field->buildSortingSQL($joins, $where, $sort, $this->_fetchSortDirection);
                         if (!$group) {
                             $group = $field->requiresSQLGrouping();
                         }
                     } else {
                         if ($section->get('entry_order') && ($field = $this->fieldManager->fetch($section->get('entry_order')))) {
                             $field->buildSortingSQL($joins, $where, $sort, $section->get('entry_order_direction'));
                             if (!$group) {
                                 $group = $field->requiresSQLGrouping();
                             }
                         } else {
                             $sort = 'ORDER BY `e`.`id`' . $this->_fetchSortDirection;
                         }
                     }
                 }
             }
         }
     }
     if ($entry_id && !is_array($entry_id)) {
         $entry_id = array($entry_id);
     }
     $sql = "\n\t\t\t\tSELECT  " . ($group ? 'DISTINCT ' : '') . "`e`.id,\n\t\t\t\t\t\t`e`.section_id, e.`author_id`,\n\t\t\t\t\t\tUNIX_TIMESTAMP(e.`creation_date`) AS `creation_date`\n\t\t\t\tFROM `tbl_entries` AS `e`\n\t\t\t\t{$joins}\n\t\t\t\tWHERE 1\n\t\t\t\t" . ($entry_id ? "AND `e`.`id` IN ('" . implode("', '", $entry_id) . "') " : '') . "\n\t\t\t\t" . ($section_id && !is_null($sort) ? "AND `e`.`section_id` = '{$section_id}' " : '') . "\n\t\t\t\t{$where}\n\t\t\t\t{$sort}\n\t\t\t\t" . ($limit ? 'LIMIT ' . intval($start) . ', ' . intval($limit) : '');
     $rows = Symphony::Database()->fetch($sql);
     return $buildentries && (is_array($rows) && !empty($rows)) ? $this->__buildEntries($rows, $section_id, $element_names) : $rows;
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:84,代码来源:class.entrymanager.php

示例8: prepareTableValue

 public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = NULL)
 {
     // build this entry fully
     $entries = EntryManager::fetch($entry_id);
     if ($entries === false) {
         return parent::prepareTableValue(NULL, $link, $entry_id);
     }
     $entry = reset(EntryManager::fetch($entry_id));
     // get the first field inside this tab
     $field_id = Symphony::Database()->fetchVar('id', 0, "SELECT `id` FROM `tbl_fields` WHERE `parent_section` = '" . $this->get('parent_section') . "' AND `sortorder` = " . ($this->get('sortorder') + 1) . " ORDER BY `sortorder` LIMIT 1");
     if ($field_id === NULL) {
         return parent::prepareTableValue(NULL, $link, $entry_id);
     }
     $field = FieldManager::fetch($field_id);
     // get the first field's value as a substitude for the tab's return value
     return $field->prepareTableValue($entry->getData($field_id), $link, $entry_id);
 }
开发者ID:henrysingleton,项目名称:publish_tabs,代码行数:17,代码来源:field.publish_tabs.php

示例9: appendErrors

 /**
  * Appends errors generated from fields during the execution of an Event
  *
  * @param XMLElement $result
  * @param array $fields
  * @param array $errors
  * @param object $post_values
  * @return XMLElement
  */
 public static function appendErrors(XMLElement $result, array $fields, $errors, $post_values)
 {
     $result->setAttribute('result', 'error');
     $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.')));
     foreach ($errors as $field_id => $message) {
         $field = FieldManager::fetch($field_id);
         if (is_array($fields[$field->get('element_name')])) {
             $type = array_reduce($fields[$field->get('element_name')], array('SectionEvent', '__reduceType'));
         } else {
             $type = $fields[$field->get('element_name')] == '' ? 'missing' : 'invalid';
         }
         $result->appendChild(new XMLElement($field->get('element_name'), null, array('label' => General::sanitize($field->get('label')), 'type' => $type, 'message' => General::sanitize($message))));
     }
     if (isset($post_values) && is_object($post_values)) {
         $result->appendChild($post_values);
     }
     return $result;
 }
开发者ID:nils-werner,项目名称:symphony-2,代码行数:27,代码来源:class.event.section.php

示例10: appendErrors

 /**
  * Appends errors generated from fields during the execution of an Event
  *
  * @param XMLElement $result
  * @param array $fields
  * @param array $errors
  * @param object $post_values
  * @throws Exception
  * @return XMLElement
  */
 public static function appendErrors(XMLElement $result, array $fields, $errors, $post_values)
 {
     $result->setAttribute('result', 'error');
     $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.'), array('message-id' => EventMessages::ENTRY_ERRORS)));
     foreach ($errors as $field_id => $message) {
         $field = FieldManager::fetch($field_id);
         if (is_array($fields[$field->get('element_name')])) {
             $type = array_reduce($fields[$field->get('element_name')], array('SectionEvent', '__reduceType'));
         } else {
             $type = $fields[$field->get('element_name')] == '' ? 'missing' : 'invalid';
         }
         $error = self::createError($field, $type, $message);
         $result->appendChild($error);
     }
     if (isset($post_values) && is_object($post_values)) {
         $result->appendChild($post_values);
     }
     return $result;
 }
开发者ID:valery,项目名称:symphony-2,代码行数:29,代码来源:class.event.section.php

示例11: get

 private function get($database, $field_id, $search, $max)
 {
     // Get entries
     if (!empty($search)) {
         // Get columns
         $columns = Symphony::Database()->fetchCol('column_name', sprintf("SELECT column_name\n                    FROM information_schema.columns\n                    WHERE table_schema = '%s'\n                    AND table_name = 'tbl_entries_data_%d'\n                    AND column_name != 'id'\n                    AND column_name != 'entry_id';", $database, $field_id));
         // Build where clauses
         $where = array();
         foreach ($columns as $column) {
             $where[] = "`{$column}` LIKE '%{$search}%'";
         }
         // Build query
         $query = sprintf("SELECT * from sym_entries_data_%d WHERE %s%s;", $field_id, implode($where, " OR "), $max);
     } else {
         $query = sprintf("SELECT * from sym_entries_data_%d%s;", $field_id, $max);
     }
     // Fetch field values
     $data = Symphony::Database()->fetch($query);
     if (!empty($data)) {
         $field = FieldManager::fetch($field_id);
         $parent_section = SectionManager::fetch($field->get('parent_section'));
         $parent_section_handle = $parent_section->get('handle');
         foreach ($data as $field_data) {
             $entry_id = $field_data['entry_id'];
             if ($field instanceof ExportableField && in_array(ExportableField::UNFORMATTED, $field->getExportModes())) {
                 // Get unformatted value
                 $value = $field->prepareExportValue($field_data, ExportableField::UNFORMATTED, $entry_id);
             } elseif ($field instanceof ExportableField && in_array(ExportableField::VALUE, $field->getExportModes())) {
                 // Get formatted value
                 $value = $field->prepareExportValue($field_data, ExportableField::VALUE, $entry_id);
             } else {
                 // Get value from parameter pool
                 $value = $field->getParameterPoolValue($field_data, $entry_id);
             }
             $this->_Result['entries'][$entry_id]['value'] = $value;
             $this->_Result['entries'][$entry_id]['section'] = $parent_section_handle;
             $this->_Result['entries'][$entry_id]['link'] = APPLICATION_URL . '/publish/' . $parent_section_handle . '/edit/' . $entry_id . '/';
         }
     }
 }
开发者ID:newsdeeply,项目名称:association_ui_selector,代码行数:40,代码来源:content.query.php

示例12: buildElementOptions

 /**
  * Build element options.
  *
  * @param array $association
  *  Association data
  * @param array  $settings
  *  Data Source settings
  * @param number $section_id
  *  Section ID
  * @return array
  *  Element options
  */
 private function buildElementOptions($association, $settings, $section_id)
 {
     $elements = array();
     $label = FieldManager::fetchHandleFromID($association['child_section_field_id']);
     $fields = FieldManager::fetch(null, $association['parent_section_id']);
     if (is_array($fields) || $fields instanceof Traversable) {
         foreach ($fields as $field) {
             $modes = $field->fetchIncludableElements();
             foreach ($modes as $mode) {
                 $value = $association['parent_section_id'] . '|#|' . $association['parent_section_field_id'] . '|#|' . $label . '|#|' . $mode;
                 $selected = false;
                 if ($section_id == $settings['section_id'] && isset($settings[$label])) {
                     if (in_array($mode, $settings[$label]['elements'])) {
                         $selected = true;
                     }
                 }
                 $elements[] = array($value, $selected, $mode);
             }
         }
     }
     return array('label' => $label, 'data-label' => $section_id, 'options' => $elements);
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:34,代码来源:extension.driver.php

示例13: view

 public function view()
 {
     $handle = General::sanitize($_GET['handle']);
     $section = General::sanitize($_GET['section']);
     $options = array();
     $filters = array();
     if (!empty($handle) && !empty($section)) {
         $section_id = SectionManager::fetchIDFromHandle($section);
         $field_id = FieldManager::fetchFieldIDFromElementName($handle, $section_id);
         $field = FieldManager::fetch($field_id);
         if (!empty($field) && $field->canPublishFilter() === true) {
             if (method_exists($field, 'getToggleStates')) {
                 $options = $field->getToggleStates();
             } elseif (method_exists($field, 'findAllTags')) {
                 $options = $field->findAllTags();
             }
         }
     }
     foreach ($options as $value => $data) {
         $filters[] = array('value' => $value ? $value : $data, 'text' => $data ? $data : $value);
     }
     $this->_Result['filters'] = $filters;
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:23,代码来源:content.ajaxfilters.php

示例14: view

 public function view()
 {
     $entry_id = General::sanitize($_GET['entry_id']);
     $field_ids = explode(',', General::sanitize($_GET['field_id']));
     $parent_section_id = EntryManager::fetchEntrySectionID($entry_id);
     if ($parent_section_id) {
         $parent_section = SectionManager::fetch($parent_section_id);
         $parent_section_handle = $parent_section->get('handle');
         // Fetch entry
         $value = '';
         if (!empty($field_ids[0])) {
             $entry = EntryManager::fetch($entry_id);
             foreach ($field_ids as $field_id) {
                 $field_data = $entry[0]->getData($field_id);
                 if (!empty($field_data)) {
                     $field = FieldManager::fetch($field_id);
                     if ($field instanceof ExportableField && in_array(ExportableField::UNFORMATTED, $field->getExportModes())) {
                         // Get unformatted value
                         $value = $field->prepareExportValue($field_data, ExportableField::UNFORMATTED, $entry_id);
                     } elseif ($field instanceof ExportableField && in_array(ExportableField::VALUE, $field->getExportModes())) {
                         // Get formatted value
                         $value = $field->prepareExportValue($field_data, ExportableField::VALUE, $entry_id);
                     } else {
                         // Get value from parameter pool
                         $value = $field->getParameterPoolValue($field_data, $entry_id);
                     }
                 }
             }
         }
         // Set data
         $this->_Result['entry']['value'] = $value;
         $this->_Result['entry']['section'] = $parent_section_handle;
         $this->_Result['entry']['link'] = APPLICATION_URL . '/publish/' . $parent_section_handle . '/edit/' . $entry_id . '/';
     }
     // Return results
     return $this->_Result;
 }
开发者ID:newsdeeply,项目名称:association_ui_selector,代码行数:37,代码来源:content.get.php

示例15: appendScriptToHead

 public function appendScriptToHead($context)
 {
     $page_callback = Administration::instance()->getPageCallback();
     $page_callback = $page_callback['context'];
     if (isset($page_callback['section_handle']) && $page_callback['page'] == 'index') {
         // find sort settings for this section (sort field ID and direction)
         $section_id = SectionManager::fetchIDFromHandle($page_callback['section_handle']);
         if (!$section_id) {
             return;
         }
         $section = SectionManager::fetch(SectionManager::fetchIDFromHandle($page_callback['section_handle']));
         // we only want a valid entry order field and ascending order only
         if ($section->getSortingOrder() !== 'asc' || !is_numeric($section->getSortingField())) {
             return;
         }
         $field = FieldManager::fetch($section->getSortingField());
         if ($field->get('type') !== 'order_entries') {
             return;
         }
         Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('order-entries', " . json_encode(array('id' => $field->get('id'), 'force-sort' => $field->get('force_sort'))) . ");", array('type' => 'text/javascript')), time());
         Administration::instance()->Page->addScriptToHead(URL . '/extensions/order_entries/assets/order_entries.publish.js', time());
         Symphony::Configuration()->set("pagination_maximum_rows", 99999, "symphony");
     }
 }
开发者ID:klaftertief,项目名称:order_entries,代码行数:24,代码来源:extension.driver.php


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