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


PHP EntryManager::fetchEntrySectionID方法代码示例

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


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

示例1: __fetchSectionsFromContext

 private function __fetchSectionsFromContext($context)
 {
     if ($context['delegate'] == 'EntryPreDelete' || $context['delegate'] == 'EntriesPostOrder') {
         $current_section_id = EntryManager::fetchEntrySectionID($context['entry_id'][0]);
     } else {
         if ($context['delegate'] == 'EventFinalSaveFilter') {
             $current_section_id = EntryManager::fetchEntrySectionID($context['entry']->get('id'));
         } else {
             $current_section_id = $context['section']->get('id');
         }
     }
     $data = Symphony::Database()->fetch(sprintf('SELECT DISTINCT `child_section_id`, `parent_section_id` FROM `tbl_sections_association`
                 WHERE `parent_section_id` = %d OR `child_section_id` = %d', $current_section_id, $current_section_id));
     $result = array($current_section_id);
     foreach ($data as $v) {
         array_push($result, $v['child_section_id']);
         array_push($result, $v['parent_section_id']);
     }
     return array_unique($result);
 }
开发者ID:andrrr,项目名称:cacheabledatasource,代码行数:20,代码来源:extension.driver.php

示例2: __fetchSectionsFromContext

    private function __fetchSectionsFromContext($context)
    {
        if (!is_null($this->_sectionsToFlush)) {
            return;
        }
        $this->_sectionsToFlush = array();
        if ($context['delegate'] == 'EntryPreDelete' || $context['delegate'] == 'EntriesPostOrder') {
            require_once TOOLKIT . '/class.entrymanager.php';
            $this->_sectionsToFlush[0] = EntryManager::fetchEntrySectionID($context['entry_id'][0]);
        } elseif ($context['delegate'] == 'EventFinalSaveFilter') {
            require_once TOOLKIT . '/class.entrymanager.php';
            $this->_sectionsToFlush[0] = EntryManager::fetchEntrySectionID($context['entry']->get('id'));
        } else {
            $this->_sectionsToFlush[0] = $context['section']->get('id');
        }
        $associatedSections = Symphony::Database()->fetch(sprintf('SELECT DISTINCT `child_section_id` value, `parent_section_id` value FROM `tbl_sections_association`
					WHERE `parent_section_id` = %d OR `child_section_id` = %d', $this->_sectionsToFlush[0], $this->_sectionsToFlush[0]));
        General::flattenArray($associatedSections);
        $associatedSections = array_unique(array_values($associatedSections));
        if (is_array($associatedSections) && !empty($associatedSections)) {
            $this->_sectionsToFlush = array_merge($this->_sectionsToFlush, $associatedSections);
        }
    }
开发者ID:symphonists,项目名称:cacheabledatasource,代码行数:23,代码来源:extension.driver.php

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

示例4: parseEntryAction

 public function parseEntryAction($context)
 {
     if ($this->validateUser()) {
         $action = $this->getActionFromDelegateName($context['delegate']);
         $ids = array();
         $section_id = null;
         // Entry IDs are provided in different formats depending
         // on if you're deleting or not. So standardize them.
         if ($action == 'deleted') {
             $ids = $context['entry_id'];
         } else {
             $section_id = $context['entry']->get('section_id');
             $ids = $context['entry']->get('id');
         }
         if ($ids && !is_array($ids)) {
             $ids = array($ids);
         }
         if (!$ids) {
             return;
         }
         // Loop through entries, validate section, and log them.
         foreach ($ids as $entry_id) {
             $current_section_id = $section_id;
             if (!$current_section_id) {
                 // This can be removed when dropping 2.5.x compat
                 if (!class_exists('EntryManager')) {
                     include_once TOOLKIT . '/class.entrymanager.php';
                 }
                 $current_section_id = EntryManager::fetchEntrySectionID($entry_id);
             }
             if ($this->validateSection($current_section_id)) {
                 Tracker::log($current_section_id, $entry_id, $action, $this->getAuthorID(), $this->getTimestamp());
             }
         }
     }
 }
开发者ID:symphonists,项目名称:tracker,代码行数:36,代码来源:extension.driver.php

示例5: parseEntryAction

 public function parseEntryAction($context)
 {
     if ($this->validateUser()) {
         $action = $this->getActionFromDelegateName($context['delegate']);
         // Entry IDs are provided in different formats depending
         // on if you're deleting or not. So standardize them.
         if ($action == 'deleted') {
             $ids = (array) $context['entry_id'];
         } else {
             $section_id = $context['entry']->get('section_id');
             $ids = (array) $context['entry']->get('id');
         }
         // Loop through entries, validate section, and log them.
         foreach ($ids as $entry_id) {
             if (!isset($section_id)) {
                 include_once TOOLKIT . '/class.entrymanager.php';
                 $section_id = EntryManager::fetchEntrySectionID($entry_id);
             }
             if ($this->validateSection($section_id)) {
                 Tracker::log($section_id, $entry_id, $action, $this->getAuthorID(), $this->getTimestamp());
             }
         }
     }
 }
开发者ID:rc1,项目名称:tracker,代码行数:24,代码来源:extension.driver.php

示例6: preloadSubsectionEntries

 /**
  * Preload subsection entries
  *
  * @param Array $parents
  *	Array of entry objects
  */
 public static function preloadSubsectionEntries($parents)
 {
     if (empty($parents) || !is_array($parents)) {
         return;
     }
     // Get parent data
     $fields = array();
     foreach ($parents as $entry) {
         $data = $entry->getData();
         // Get relation id
         foreach ($data as $field => $settings) {
             if (isset($settings['relation_id'])) {
                 if (!is_array($settings['relation_id'])) {
                     $settings['relation_id'] = array($settings['relation_id']);
                 }
                 foreach ($settings['relation_id'] as $relation_id) {
                     if (empty($relation_id)) {
                         continue;
                     }
                     $fields[$field][] = $relation_id;
                 }
             }
         }
     }
     // Store entries
     foreach ($fields as $field => $relation_id) {
         // Check for already loaded entries
         $entry_id = array_diff($relation_id, array_keys(self::$storage['entries']));
         // Load new entries
         if (!empty($entry_id)) {
             // Get subsection id
             $subsection_id = EntryManager::fetchEntrySectionID($entry_id[0]);
             // Fetch entries
             $entries = EntryManager::fetch($entry_id, $subsection_id);
             if (!empty($entries)) {
                 foreach ($entries as $entry) {
                     self::$storage['entries'][$entry->get('id')] = $entry;
                 }
             }
         }
     }
 }
开发者ID:symphonists,项目名称:subsectionmanager,代码行数:48,代码来源:extension.driver.php

示例7: resolveLinks

 public function resolveLinks($linked)
 {
     if (is_null($linked)) {
         return;
     }
     $entryManager = new EntryManager($this->_Parent);
     if (!is_array($linked)) {
         $section_id = $entryManager->fetchEntrySectionID($linked);
         $entry = end($entryManager->fetch($linked));
         $entry = $entry->getData($this->_driver->fetchVisibleFieldID($section_id));
         return $entry['value'];
     } else {
         $section_id = $entryManager->fetchEntrySectionID($linked[0]);
         $return = array();
         foreach ($linked as $k => $e) {
             $entry = end($entryManager->fetch($e));
             $entry = $entry->getData($this->_driver->fetchVisibleFieldID($section_id));
             $return[] = $entry['value'];
         }
         return implode(", ", $return);
     }
 }
开发者ID:6ui11em,项目名称:export_entry,代码行数:22,代码来源:content.export.php

示例8: __trigger

		protected function __trigger(){
		
			//Check the hash and the ID match
			if($_GET["hash"] == sha1($_GET["id"])) {
			
				
				//Get the entry object from the ID.
				if(!isset(self::$entryManager)) {
					self::$entryManager = new entryManager(Symphony::Engine());
				}
				$entry_id = $_GET["id"];
				$section_id = self::$entryManager->fetchEntrySectionID($entry_id);
				
				$entry = self::$entryManager->fetch($entry_id, $section_id);
				$entry = $entry[0];
				

				//Retreive the Pushed JSON from the Eventarc API.
				$data = json_decode(
					utf8_encode(file_get_contents("php://input")), 
					TRUE
				);
				
				//Eventarc entry id.
				$e_id = $data['e_id'];
				
				//Login to eventarc & return the API key.
				$eventarc = new Eventarc;
				$login_data = $eventarc->user_login($this->get('eventarc-username'),$this->get('eventarc-password'));
				$u_apikey = $login_data['u_apikey'];
				
				//Now retrieve the Event
				$eventarc = new Eventarc($u_apikey, $this->get('eventarc-username'));
				$event = $eventarc->event_get($e_id);
				
				//First save the standard event entry fields	
				$fields = array();
				foreach($event as $key => $value) {
					if($this->string_begins_with($key, 'e_')) {
						$fields[str_replace('e_', 'e-', $key)] = strip_tags($value);
					} else if ($this->string_begins_with($key, 'g_')) {
						$fields[str_replace('g_', 'g-', $key)] = strip_tags($value);
					} 
				}	
				//Update the e_status to be 'Yes/No' for Symphony;
				if($fields['e-status'] == 'active') {
					$fields['e-status'] = 'yes';
				} else {
					$fields['e-status'] = 'no';
				}
				//Now look for address details
				$address = $eventarc->event_get_address($e_id);
				foreach($address as $key => $value) {
					if($this->string_begins_with($key, 'a_')) {
						$fields[str_replace('a_', 'a-', $key)] = strip_tags($value);
					} 
				}
					
				if(!isset(self::$fieldManager)) {
					self::$fieldManager = new fieldManager(Symphony::Engine());
				}
				
				foreach($fields as $key => $value) {
					$field_id = self::$fieldManager->fetchFieldIDFromElementName($key);
					if(isset($field_id)) {
						$entry->setData($field_id, array(
							'value' => $value,
						));
					}
				}
				
				$entry->commit();
				
				return true;
			
			}
		}
开发者ID:nick-ryall,项目名称:eventarc,代码行数:77,代码来源:event.eventarc_updater.php

示例9: eventPreSaveFilter

 public function eventPreSaveFilter($context)
 {
     if ($context['fields'] === null && (RestEngine::getHTTPMethod() === 'put' || 'post')) {
         $parsedData = RestEngine::parseBodyContent();
         if ($context['entry_id'] === null && RestEngine::getHTTPMethod() === 'put') {
             $pageID = RestEngine::getPageID();
             $urlParams = $this::getPageURLParams();
             //use the page ID to look up the format and uid param settings
             $settings = RestResourceManager::getByPageID($pageID);
             if (array_key_exists($settings['uid_parameter'], $urlParams)) {
                 $entryIDValue = $urlParams[$settings['uid_parameter']];
                 if ($settings['field_id'] == 0) {
                     // 0 stands for using the Entry ID number directly so just
                     // check to see if that entry number exists in the correct section
                     $entrySection = EntryManager::fetchEntrySectionID($entryIDValue);
                     if ($entrySection == $settings['section_id']) {
                         //good to go
                         $entryID = $entryIDValue;
                     }
                 } else {
                     $fieldType = FieldManager::fetchFieldTypeFromID($settings['field_id']);
                     //TODO: Eventually add in a more robust field type management to distinguish between value and handle based fields if necessary, or do it by array searching?
                     if ($fieldType != 'memberemail') {
                         $query = "SELECT `entry_id` FROM `tbl_entries_data_" . $settings['field_id'] . "` WHERE `handle` = '" . $entryIDValue . "' LIMIT 1";
                     } else {
                         $query = "SELECT `entry_id` FROM `tbl_entries_data_" . $settings['field_id'] . "` WHERE `value` = '" . $entryIDValue . "' LIMIT 1";
                     }
                     $entryID = Symphony::Database()->fetchVar('entry_id', 0, $query);
                 }
                 if (is_null($entryID)) {
                     //no matching entry
                     $context['messages'][] = array('restengine:invalid-id', FALSE, __('The specified resource "%1$s" does not exist.', array($entryIDValue)));
                 } else {
                     //good to go
                     $context['entry_id'] = $entryID;
                 }
             } else {
                 $context['messages'][] = array('restengine:settings-error', FALSE, __('Invalid Rest Resource unique ID URL parameter: %1$s.', array($settings['uid_parameter'])));
                 //probably some kind of error needs returning here
             }
         }
         if (is_array($parsedData) && !empty($parsedData['data']) && $parsedData['errors'] === null) {
             //Create the post data cookie element.
             General::array_to_xml($context['post_values'], $parsedData, true);
             //TODO: check for field mapping
             //TODO: Do we need to error when message body contains properties that we don't have fields for in the assigned section?
             $context['fields'] = $parsedData['data'];
         }
     }
 }
开发者ID:rheingolden,项目名称:restengine,代码行数:50,代码来源:extension.driver.php


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