• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FieldManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: delete

 public function delete($section_id)
 {
     $query = "SELECT `id`, `sortorder` FROM tbl_sections WHERE `id` = '{$section_id}'";
     $details = Symphony::Database()->fetchRow(0, $query);
     ## Delete all the entries
     include_once TOOLKIT . '/class.entrymanager.php';
     $entryManager = new EntryManager($this->_Parent);
     $entries = Symphony::Database()->fetchCol('id', "SELECT `id` FROM `tbl_entries` WHERE `section_id` = '{$section_id}'");
     $entryManager->delete($entries);
     ## Delete all the fields
     $fieldManager = new FieldManager($this->_Parent);
     $fields = Symphony::Database()->fetchCol('id', "SELECT `id` FROM `tbl_fields` WHERE `parent_section` = '{$section_id}'");
     if (is_array($fields) && !empty($fields)) {
         foreach ($fields as $field_id) {
             $fieldManager->delete($field_id);
         }
     }
     ## Delete the section
     Symphony::Database()->delete('tbl_sections', " `id` = '{$section_id}'");
     ## Update the sort orders
     Symphony::Database()->query("UPDATE tbl_sections SET `sortorder` = (`sortorder` - 1) WHERE `sortorder` > '" . $details['sortorder'] . "'");
     ## Delete the section associations
     Symphony::Database()->delete('tbl_sections_association', " `parent_section_id` = '{$section_id}'");
     return true;
 }
开发者ID:aaronsalmon,项目名称:symphony-2,代码行数:25,代码来源:class.sectionmanager.php


示例4: 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


示例5: 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


示例6: process

 public static function process($options = array())
 {
     $default = array('entries' => array(), 'section' => null, 'field_name' => null, 'iptc' => true, 'exif' => true);
     $options = array_merge($default, $options);
     self::checkRequirements($options['exif']);
     if (!$options['field_name'] || !$options['entries'] || !$options['section']) {
         self::throwEx('Missing required option');
     }
     $root = new XMLElement(self::getRootElement());
     $field = FieldManager::fetchFieldIDFromElementName($options['field_name'], $options['section']->get('id'));
     foreach ($options['entries'] as $entry) {
         $data = $entry->getData($field);
         $rel = $data['file'];
         $img = WORKSPACE . $rel;
         $xml = new XMLElement('image', null, array('path' => $rel, 'entry_id' => $entry->get('id')));
         if ($options['iptc']) {
             $result = self::processIptc($img);
             $xml->appendChild($result);
         }
         if ($options['exif']) {
             $result = self::processExif($img);
             $xml->appendChild($result);
         }
         $root->appendChild($xml);
     }
     return $root;
 }
开发者ID:alpacaaa,项目名称:image_info,代码行数:27,代码来源:class.images_info.php


示例7: 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


示例8: 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


示例9: commit

 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     fieldMemberUsername::createSettingsTable();
     $fields = array('field_id' => $id, 'validator' => $this->get('validator'));
     return FieldManager::saveSettings($id, $fields);
 }
开发者ID:andrewminton,项目名称:members,代码行数:13,代码来源:field.memberusername.php


示例10: grab

 public function grab(array &$param_pool = NULL)
 {
     // remove placeholder elements
     unset($this->dsParamINCLUDEDELEMENTS);
     // fill with all included elements if none are set
     if (is_null(REST_Entries::getDatasourceParam('included_elements'))) {
         // get all fields in this section
         $fields = FieldManager::fetchFieldsSchema(REST_Entries::getSectionId());
         // add them to the data source
         foreach ($fields as $field) {
             $this->dsParamINCLUDEDELEMENTS[] = $field['element_name'];
         }
         // also add pagination
         $this->dsParamINCLUDEDELEMENTS[] = 'system:pagination';
     } else {
         $this->dsParamINCLUDEDELEMENTS = explode(',', REST_Entries::getDatasourceParam('included_elements'));
     }
     // fill the other parameters
     if (!is_null(REST_Entries::getDatasourceParam('limit'))) {
         $this->dsParamLIMIT = REST_Entries::getDatasourceParam('limit');
     }
     if (!is_null(REST_Entries::getDatasourceParam('page'))) {
         $this->dsParamSTARTPAGE = REST_Entries::getDatasourceParam('page');
     }
     if (!is_null(REST_Entries::getDatasourceParam('sort'))) {
         $this->dsParamSORT = REST_Entries::getDatasourceParam('sort');
     }
     if (!is_null(REST_Entries::getDatasourceParam('order'))) {
         $this->dsParamORDER = REST_Entries::getDatasourceParam('order');
     }
     // Do grouping
     if (!is_null(REST_Entries::getDatasourceParam('groupby'))) {
         $field_id = FieldManager::fetchFieldIDFromElementName(REST_Entries::getDatasourceParam('groupby'), REST_Entries::getSectionId());
         if ($field_id) {
             $this->dsParamGROUP = $field_id;
         }
     }
     // if API is calling a known entry, filter on System ID only
     if (!is_null(REST_Entries::getEntryId())) {
         $this->dsParamFILTERS['id'] = REST_Entries::getEntryId();
     } elseif (REST_Entries::getDatasourceParam('filters')) {
         foreach (REST_Entries::getDatasourceParam('filters') as $field_handle => $filter_value) {
             $filter_value = rawurldecode($filter_value);
             $field_id = FieldManager::fetchFieldIDFromElementName($field_handle, REST_Entries::getSectionId());
             if (is_numeric($field_id)) {
                 $this->dsParamFILTERS[$field_id] = $filter_value;
             }
         }
     }
     return $this->execute($param_pool);
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:51,代码来源:data.rest_api_entries.php


示例11: commit

 /**
  * Persist field configuration
  */
 function commit()
 {
     // set up standard Field settings
     if (!parent::commit()) {
         return FALSE;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return FALSE;
     }
     $fields = array();
     $fields['field_id'] = $id;
     return FieldManager::saveSettings($id, $fields);
 }
开发者ID:symphonists,项目名称:search_index,代码行数:17,代码来源:field.search_index.php


示例12: commit

 public function commit()
 {
     if (!Field::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['pre_populate'] = $this->get('pre_populate') ? $this->get('pre_populate') : 'no';
     $fields['mode'] = $this->get('mode') ? $this->get('mode') : 'normal';
     return FieldManager::saveSettings($id, $fields);
 }
开发者ID:symphonists,项目名称:datemodified,代码行数:15,代码来源:field.datemodified.php


示例13: commit

 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $state = $this->get('default_state');
     $entries = (int) $this->get('unique_entries');
     $steal = $this->get('unique_steal');
     $fields = array('field_id' => $id, 'default_state' => $state ? $state : 'off', 'unique_entries' => $entries > 0 ? $entries : 1, 'unique_steal' => $steal ? $steal : 'off');
     return FieldManager::saveSettings($id, $fields);
 }
开发者ID:symphonists,项目名称:uniquecheckboxfield,代码行数:15,代码来源:field.uniquecheckbox.php


示例14: 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


示例15: 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


示例16: 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


示例17: 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


示例18: 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


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FieldSet类代码示例发布时间:2022-05-23
下一篇:
PHP FieldList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap