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


PHP EntryManager::fetch方法代码示例

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


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

示例1: view

 public function view()
 {
     $this->_driver = $this->_Parent->ExtensionManager->create('export_entry');
     $this->target = $_GET['section'];
     $this->fieldID = $_GET['field'];
     if (!$this->validate()) {
         $this->_status = self::STATUS_BAD;
         $this->generate();
         return false;
     }
     $sectionManager = new SectionManager($this->_Parent);
     $entryManager = new EntryManager($this->_Parent);
     $section = $sectionManager->fetch($this->target);
     $fields = $section->fetchFields();
     /*	Get all the fields from the target section
      **	Loop them for the section Link field
      */
     foreach ($fields as $field) {
         if ($field->get("id") == $this->fieldID) {
             if ($field->get('type') == "bilink") {
                 $linked_section_id = $field->get("linked_section_id");
                 $linked_field_id = $field->get("linked_field_id");
             } else {
                 if ($field->get('type') == "selectbox_link") {
                     $linked_section_id = Symphony::Database()->fetchVar("parent_section_id", 0, "SELECT parent_section_id \n\t\t\t\t\t\t\tFROM `tbl_sections_association` \n\t\t\t\t\t\t\tWHERE `child_section_field_id` = {$field->get("id")}\n\t\t\t\t\t\t\tLIMIT 1");
                     $linked_field_id = $field->get("related_field_id");
                 } else {
                     if ($field->get('type') == "checkbox") {
                         $linked_section_id = false;
                         $el = new XMLElement("entry", 'Yes');
                         $el->setAttribute('id', 'yes');
                         $this->_Result->appendChild($el);
                         $el = new XMLElement("entry", 'No');
                         $el->setAttribute('id', 'no');
                         $this->_Result->appendChild($el);
                     }
                 }
             }
         }
     }
     if ($linked_section_id) {
         /*	Got the linked field, now get the other end of the
          **	link. Use the first Visible column as the output handle
          */
         $linked_field_id = $this->_driver->fetchVisibleFieldID($linked_section_id);
         /*	Foreach entry in the linked section, display the first
          **	column to be selected
          */
         $entries = $entryManager->fetch(null, $linked_section_id);
         foreach ($entries as $entry) {
             $data = current($entryManager->fetch($entry->get('id'), $linked_section_id));
             $values = $data->getData($linked_field_id);
             $el = new XMLElement("entry", General::sanitize($values['value']));
             $el->setAttribute('id', $entry->get('id'));
             $this->_Result->appendChild($el);
         }
     }
 }
开发者ID:6ui11em,项目名称:export_entry,代码行数:58,代码来源:content.ajaxentries.php

示例2: checkTemplates

 private function checkTemplates($pageId, $prefix = '')
 {
     // Link templates:
     $templates = Symphony::Database()->fetch(sprintf('SELECT * FROM `tbl_ckeditor_link_templates` WHERE `page_id` = %d;', $pageId));
     $entryTree = array();
     foreach ($templates as $template) {
         $section = SectionManager::fetch($template['section_id']);
         $entries = EntryManager::fetch(null, $template['section_id']);
         $fields = $section->fetchFields();
         foreach ($entries as $entry) {
             $link = $template['link'];
             // Replace the ID:
             $link = str_replace('{$id}', $entry->get('id'), $link);
             $data = $entry->getData();
             foreach ($fields as $field) {
                 // Replace the placeholders with the value:
                 // Check if the field has a 'handle':
                 $testData = $field->processRawFieldData('test', $field->__OK__);
                 if (isset($testData['handle'])) {
                     $link = str_replace('{$' . $field->get('element_name') . '}', $data[$field->get('id')]['handle'], $link);
                 }
             }
             $entryTree[] = array('handle' => $data[$field->get('id')]['handle'], 'path' => '', 'url' => $link, 'title' => $prefix . ' › ' . General::sanitize($data[$template['field_id']]['value']));
         }
     }
     return $entryTree;
 }
开发者ID:TwistedInteractive,项目名称:ckeditor,代码行数:27,代码来源:content.pages.php

示例3: __trigger

 protected function __trigger()
 {
     $result = new XMLElement(self::ROOTELEMENT);
     $success = false;
     self::__init();
     $db = ASDCLoader::instance();
     $Members = $this->_Parent->ExtensionManager->create('members');
     $Members->initialiseCookie();
     if ($Members->isLoggedIn() !== true) {
         $result->appendChild(new XMLElement('error', 'Must be logged in.'));
         $result->setAttribute('status', 'error');
         return $result;
     }
     $Members->initialiseMemberObject();
     // Make sure we dont accidently use an expired code
     extension_Members::purgeCodes();
     $em = new EntryManager($this->_Parent);
     $entry = end($em->fetch((int) $Members->Member->get('id')));
     $email = $entry->getData(self::findFieldID('email-address', 'members'));
     $name = $entry->getData(self::findFieldID('name', 'members'));
     $success = $Members->emailNewMember(array('entry' => $entry, 'fields' => array('username-and-password' => $entry->getData(self::findFieldID('username-and-password', 'members')), 'name' => $name['value'], 'email-address' => $email['value'])));
     if ($success == true && isset($_REQUEST['redirect'])) {
         redirect($_REQUEST['redirect']);
     }
     $result->setAttribute('result', $success === true ? 'success' : 'error');
     return $result;
 }
开发者ID:bauhouse,项目名称:members,代码行数:27,代码来源:event.members_resend_activation_email.php

示例4: __trigger

 protected function __trigger()
 {
     self::__init();
     $db = ASDCLoader::instance();
     $success = false;
     $Members = $this->_Parent->ExtensionManager->create('members');
     $Members->initialiseCookie();
     if ($Members->isLoggedIn() !== true) {
         redirect(URL . '/forbidden/');
     }
     $Members->initialiseMemberObject();
     // Make sure we dont accidently use an expired token
     extension_Members::purgeCodes();
     $activation_row = $db->query(sprintf("SELECT * FROM `tbl_members_codes` WHERE `token` = '%s' AND `member_id` = %d LIMIT 1", $db->escape($_POST['fields']['code']), (int) $Members->Member->get('id')))->current();
     // No code, you are a spy!
     if ($activation_row === false) {
         redirect(URL . '/members/activate/failed/');
     }
     // Got this far, all is well.
     $db->query(sprintf("UPDATE `tbl_entries_data_%d` SET `role_id` = %d WHERE `entry_id` = %d LIMIT 1", $Members->roleField(), 3, (int) $Members->Member->get('id')));
     extension_Members::purgeTokens((int) $Members->Member->get('id'));
     $em = new EntryManager($this->_Parent);
     $entry = end($em->fetch((int) $Members->Member->get('id')));
     $email = $entry->getData(self::findFieldID('email-address', 'members'));
     $name = $entry->getData(self::findFieldID('name', 'members'));
     $Members->emailNewMember(array('section' => $Members->memberSectionHandle(), 'entry' => $entry, 'fields' => array('username-and-password' => $entry->getData(self::findFieldID('username-and-password', 'members')), 'name' => $name['value'], 'email-address' => $email['value'])));
     redirect(URL . '/members/activate/success/');
 }
开发者ID:bauhouse,项目名称:forum,代码行数:28,代码来源:event.forum_activate_member.php

示例5: createEntryFromPost

 private function createEntryFromPost()
 {
     include_once TOOLKIT . '/class.sectionmanager.php';
     include_once TOOLKIT . '/class.entrymanager.php';
     // section id
     $source = $this->getSection();
     $section = SectionManager::fetch($source);
     $fields = $section->fetchFields();
     $entry = null;
     if ($id > 0) {
         // edit
         $entry = EntryManager::fetch($id);
         if (empty($entry)) {
             throw new Exception(sprintf(__('Entry id %s not found'), $id));
         }
         $entry = $entry[0];
     } else {
         // create
         $entry = EntryManager::create();
         $entry->set('section_id', $source);
     }
     foreach ($fields as $f) {
         $data = $this->getFieldValue($f->get('element_name'));
         if ($data != null) {
             $entry->setData($f->get('id'), $data);
         }
     }
     if (!$entry->commit()) {
         throw new Exception(sprintf('Could not create entry: %s', mysql_error()));
     }
     return $entry;
 }
开发者ID:BloodBrother,项目名称:symphony-2-template,代码行数:32,代码来源:class.insertSection.php

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

示例7: __doit

 private function __doit($source, $fields, &$result, $entry_id = NULL, $cookie = NULL)
 {
     include_once TOOLKIT . '/class.sectionmanager.php';
     include_once TOOLKIT . '/class.entrymanager.php';
     $sectionManager = new SectionManager($this->_Parent);
     if (!($section = $sectionManager->fetch($source))) {
         $result->setAttribute('result', 'error');
         $result->appendChild(new XMLElement('message', 'Section is invalid'));
         return false;
     }
     $entryManager = new EntryManager($this->_Parent);
     if (isset($entry_id) && $entry_id != NULL) {
         $entry =& $entryManager->fetch($entry_id);
         $entry = $entry[0];
         if (!is_object($entry)) {
             $result->setAttribute('result', 'error');
             $result->appendChild(new XMLElement('message', 'Invalid Entry ID specified. Could not create Entry object.'));
             return false;
         }
     } else {
         $entry =& $entryManager->create();
         $entry->set('section_id', $source);
     }
     if (__ENTRY_FIELD_ERROR__ == $entry->checkPostData($fields, $errors, $entry->get('id') ? true : false)) {
         $result->setAttribute('result', 'error');
         $result->appendChild(new XMLElement('message', 'Entry encountered errors when saving.'));
         foreach ($errors as $field_id => $message) {
             $field = $entryManager->fieldManager->fetch($field_id);
             $result->appendChild(new XMLElement($field->get('element_name'), NULL, array('type' => $fields[$field->get('element_name')] == '' ? 'missing' : 'invalid')));
         }
         if (isset($cookie) && is_object($cookie)) {
             $result->appendChild($cookie);
         }
         return false;
     } elseif (__ENTRY_OK__ != $entry->setDataFromPost($fields, $errors, false, $entry->get('id') ? true : false)) {
         $result->setAttribute('result', 'error');
         $result->appendChild(new XMLElement('message', 'Entry encountered errors when saving.'));
         foreach ($errors as $err) {
             $field = $entryManager->fieldManager->fetch($err['field_id']);
             $result->appendChild(new XMLElement($field->get('element_name'), NULL, array('type' => 'invalid')));
         }
         if (isset($cookie) && is_object($cookie)) {
             $result->appendChild($cookie);
         }
         return false;
     } else {
         if (!$entry->commit()) {
             $result->setAttribute('result', 'error');
             $result->appendChild(new XMLElement('message', 'Unknown errors where encountered when saving.'));
             if (isset($cookie) && is_object($cookie)) {
                 $result->appendChild($cookie);
             }
             return false;
         }
     }
     return $entry;
 }
开发者ID:bauhouse,项目名称:sym-forum-ensemble,代码行数:57,代码来源:event.forum_post.php

示例8: findEntries

 public static function findEntries($entries, Section $section)
 {
     $entries = explode(',', $entries);
     $ret = EntryManager::fetch($entries, $section->get('id'));
     if ($ret === false) {
         self::throwEx('An error occurred while processing entries');
     }
     return $ret;
 }
开发者ID:alpacaaa,项目名称:image_info,代码行数:9,代码来源:class.images_info.php

示例9: appendScriptToHead

 public function appendScriptToHead($context)
 {
     $this->static_section_name = '';
     $entryManager = new EntryManager($this->_Parent);
     $sections = $this->_Parent->Database->fetch("SELECT section_id AS id, handle FROM tbl_fields_static_section LEFT JOIN tbl_sections ON tbl_fields_static_section.section_id = tbl_sections.id");
     $this->section_data = array('handles' => array(), 'entries' => array());
     foreach ($sections as $key => $value) {
         $this->section_data['handles'][] = $value['handle'];
         $result = $entryManager->fetch(NULL, $value['id'], NULL, NULL, NULL, NULL, false, false);
         if (count($result) > 0) {
             $this->section_data['entries'][] = $result[0]['id'];
         } else {
             $this->section_data['entries'][] = NULL;
         }
     }
     $this->_page = Administration::instance()->Page;
     $section_handle = $this->_page->_context['section_handle'];
     $context = $this->_page->_context['page'];
     $url_entry = $this->_page->_context['entry_id'];
     $flag = $this->_page->_context['flag'];
     if (isset($section_handle)) {
         $section = $this->_Parent->Database->fetchRow(0, "SELECT id, name FROM tbl_sections WHERE handle='{$section_handle}'");
         $field = $this->_Parent->Database->fetchRow(0, "SELECT id FROM tbl_fields_static_section WHERE section_id=" . $section['id']);
         if ($field) {
             $entry = $this->getSectionEntry($section_handle);
             if ($context == 'new' && $entry) {
                 redirect(URL . '/symphony/publish/' . $section_handle . '/edit/' . $entry . '/');
             }
             if ($context == 'index') {
                 if ($entry) {
                     redirect(URL . '/symphony/publish/' . $section_handle . '/edit/' . $entry . '/');
                 } else {
                     redirect(URL . '/symphony/publish/' . $section_handle . '/new/');
                 }
             }
             if ($context == 'edit') {
                 if (!$entry) {
                     redirect(URL . '/symphony/publish/' . $section_handle . '/new/');
                 }
                 if ($url_entry != $entry) {
                     redirect(URL . '/symphony/publish/' . $section_handle . '/edit/' . $entry . '/');
                 }
             }
             if ($flag == 'saved' || $flag == 'created') {
                 $flag_msg = 'Entry updated at %1$s.';
                 if ($flag == 'created') {
                     $flag_msg = 'Entry created at %1$s.';
                 }
                 $this->_page->pageAlert(__($flag_msg, array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__))), Alert::SUCCESS);
             }
             $this->static_section_name = $section['name'];
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:54,代码来源:extension.driver.php

示例10: delete

 public static function delete()
 {
     $entry = EntryManager::fetch(self::$_entry_id);
     if (!$entry) {
         REST_API::sendError('Entry not found.', 404);
     } else {
         EntryManager::delete(self::$_entry_id);
         $response = new XMLElement('response', NULL, array('id' => self::$_entry_id, 'result' => 'success', 'type' => 'deleted'));
         $response->appendChild(new XMLElement('message', 'Entry deleted successfully.'));
         REST_API::sendOutput($response);
     }
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:12,代码来源:rest.entries.php

示例11: array

 function __filterEntries($subsection_id, $fields, $filter, $entry_id)
 {
     // Fetch taglist, select and upload fields
     $tag_fields = array();
     foreach ($fields as $field) {
         if (in_array($field->get('type'), array('taglist', 'select'))) {
             $tag_fields[] = $field->get('id');
         }
     }
     // Fetch entry data
     $entryManager = new EntryManager($this->_Parent);
     $entries = $entryManager->fetch($entry_id, $subsection_id);
     // Setup filter
     $gogoes = array();
     $nonos = array();
     $filters = array();
     if ($filter != '') {
         $filters = explode(', ', $filter);
     }
     foreach ($filters as $filter) {
         $operator = substr($filter, 0, 1);
         if ($operator == '-') {
             $nonos[] = substr($filter, 1);
         } else {
             $gogoes[] = $filter;
         }
     }
     // Filter entries and add select options
     $field_data = array();
     if (is_array($entries) && !empty($entries)) {
         foreach ($entries as $entry) {
             // Collect taglist and select field values
             $tags = array();
             foreach ($tag_fields as $field_id) {
                 $tag_values = $entry_data[$field_id]['value'];
                 if (!is_array($tag_values)) {
                     $tag_values = array($tag_values);
                 }
                 $tags = array_merge($tags, $tag_values);
             }
             // Investigate entry exclusion
             $filter_nonos = array_intersect($tags, $nonos);
             // Investigate entry inclusion
             $filter_gogoes = array_intersect($tags, $gogoes);
             // Filter entries
             if (empty($filter_nonos) && (!empty($filter_gogoes) || empty($gogoes))) {
                 $entry_data[] = array('data' => $entry->getData(), 'id' => $entry->get('id'));
             }
         }
     }
     // Return filtered entry data
     return $entry_data;
 }
开发者ID:bauhouse,项目名称:subsectionmanager,代码行数:53,代码来源:class.subsectionmanager.php

示例12: __viewIndex

 /**
  * Builds captions based on $_POST values.
  *
  * @return json object - { id: caption }
  */
 public function __viewIndex()
 {
     $related_section_id = intval($_POST['related_section_id']);
     $field_id = intval($_POST['field_id']);
     $items = explode(',', $_POST['items']);
     $id = array();
     foreach ($items as $item) {
         array_push($id, intval($item));
     }
     // fetch field data
     $sectionManager = new SectionManager($this->_Parent);
     $section = $sectionManager->fetch($related_section_id, 'ASC', 'name');
     $fields = $section->fetchFields();
     // fetch entry data
     $entryManager = new EntryManager($this->_Parent);
     $entries = $entryManager->fetch($id, $related_section_id);
     // create formated captions
     $result = array();
     $template = Administration::instance()->Database->fetch("SELECT `caption` \n\t\t\t\tFROM `tbl_fields_mediathek` \n\t\t\t\tWHERE `related_section_id` = " . $related_section_id . " \n\t\t\t\tAND `field_id`= " . $field_id . " \n\t\t\t\tLIMIT 0 , 1");
     $template = $template[0]['caption'];
     if (empty($template)) {
         $template = '{$' . $fields[0]->get('element_name') . '}';
     }
     foreach ($entries as $entry) {
         $caption = $template;
         $file = '';
         $entry_data = $entry->getData();
         foreach ($fields as $field) {
             $field_name = $field->get('element_name');
             $field_id = $field->get('id');
             $field_data = $entry_data[$field_id]['value'];
             if (is_array($field_data)) {
                 $field_value = implode(', ', $field_data);
             } elseif (empty($field_data) && $entry_data[$field_id]['file']) {
                 $field_value = $entry_data[$field_id]['file'];
             } else {
                 $field_value = $field_data;
             }
             $caption = str_replace('{$' . $field_name . '}', $field_value, $caption);
             // get file
             if (strpos($field->get('type'), 'upload') !== false && !empty($entry_data[$field->get('id')]['file'])) {
                 $file = $this->buildAttachment($entry_data[$field->get('id')]['file']);
             }
         }
         $result[$entry->_fields['id']] = '<span>' . $caption . '</span>' . $file;
     }
     if (empty($result)) {
         exit;
     }
     echo json_encode($result);
     exit;
 }
开发者ID:bitfyre,项目名称:mediathek,代码行数:57,代码来源:content.caption.php

示例13: getLastEntryID

 /**
  * Get the ID of the last entry. Last == sorting by the field from Section index
  *
  * @param $section
  * @see LSE::getSection()
  *
  * @return int|null
  */
 public static function getLastEntryID($section = null)
 {
     if (!($s = self::getSection($section))) {
         return null;
     }
     EntryManager::setFetchSortingDirection('DESC');
     $entry = EntryManager::fetch(null, $s->get('id'), 1);
     if (!is_array($entry) || empty($entry)) {
         return null;
     }
     $entry = current($entry);
     $id = (int) $entry->get('id');
     return $id;
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:22,代码来源:class.LSE.php

示例14: view

 public function view()
 {
     $entryManager = new EntryManager(Administration::instance());
     $field = $entryManager->fieldManager->fetch($_GET['field']);
     $section = $entryManager->sectionManager->fetch($field->get('parent_section'));
     $entry_column = current($section->fetchVisibleColumns());
     //	Display the first column from every entry in the linked section
     $entries = $entryManager->fetch(null, $field->get('parent_section'));
     foreach ($entries as $entry) {
         $values = $entry->getData($entry_column->get('id'));
         $el = new XMLElement("entry", General::sanitize($values['value']));
         $el->setAttribute('id', $entry->get('id'));
         $this->_Result->appendChild($el);
     }
 }
开发者ID:brendo,项目名称:bulkimporter,代码行数:15,代码来源:content.ajaxentries.php

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


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