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

PHP EntryManager类代码示例

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

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



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

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


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


示例3: view

 public function view()
 {
     $section_handle = (string) $this->context[0];
     $page = isset($this->context[1]) ? (int) $this->context[1] : 1;
     if (empty($section_handle)) {
         die('Invalid section handle');
     }
     $config = (object) Symphony::Configuration()->get('elasticsearch');
     ElasticSearch::init();
     $type = ElasticSearch::getTypeByHandle($section_handle);
     if ($page === 1) {
         // delete all documents in this index
         $query = new Elastica_Query(array('query' => array('match_all' => array())));
         $type->type->deleteByQuery($query);
     }
     // get new entries
     $em = new EntryManager(Symphony::Engine());
     $entries = $em->fetchByPage($page, $type->section->get('id'), (int) $config->{'reindex-batch-size'}, NULL, NULL, FALSE, FALSE, TRUE);
     foreach ($entries['records'] as $entry) {
         ElasticSearch::indexEntry($entry, $type->section);
     }
     $entries['total-entries'] = 0;
     // last page, count how many entries in the index
     if ($entries['remaining-pages'] == 0) {
         // wait a few seconds, allow HTTP requests to complete...
         sleep(5);
         $entries['total-entries'] = $type->type->count();
     }
     header('Content-type: application/json');
     echo json_encode(array('pagination' => array('total-pages' => (int) $entries['total-pages'], 'total-entries' => (int) $entries['total-entries'], 'remaining-pages' => (int) $entries['remaining-pages'], 'next-page' => $page + 1)));
     exit;
 }
开发者ID:nickdunn,项目名称:elasticsearch,代码行数:32,代码来源:content.reindex.php


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


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


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


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


示例8: __deleteMembers

 private function __deleteMembers($role_id)
 {
     $sql = "SELECT `entry_id` FROM `tbl_entries_data_" . $this->_driver->roleField() . "` WHERE `role_id` = {$role_id}";
     $members = Administration::Database()->fetchCol('entry_id', $sql);
     ###
     # Delegate: Delete
     # Description: Prior to deletion of entries. Array of Entries is provided.
     #              The array can be manipulated
     Administration::instance()->ExtensionManager->notifyMembers('Delete', '/publish/', array('entry_id' => &$checked));
     $entryManager = new EntryManager($this->_Parent);
     $entryManager->delete($members);
 }
开发者ID:bauhouse,项目名称:members,代码行数:12,代码来源:content.roles.php


示例9: __filterEntries

 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


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


示例11: grab

 function grab($param = array())
 {
     extract($this->_env, EXTR_PREFIX_ALL, 'env');
     include_once TOOLKIT . '/class.entrymanager.php';
     $entryManager = new EntryManager($this->_parent);
     $section_id = $entryManager->fetchSectionIDFromHandle($this->__resolveDefine("dsFilterPARENTSECTION"));
     $schema = $entryManager->fetchEntryFieldSchema($section_id, NULL, $this->_dsFilterCUSTOMFIELD);
     $schema = $schema[0];
     ##Check the cache
     $hash_id = md5(get_class($this));
     if ($param['caching'] && ($cache = $this->check_cache($hash_id))) {
         return $cache;
         exit;
     }
     ##------------------------------
     ##Create the XML container
     $xml = new XMLElement("categories-list");
     $xml->setAttribute("section", "customfield");
     ##Populate the XML
     if (empty($schema) || !is_array($schema)) {
         $xml->addChild(new XMLElement("error", "No Records Found."));
         return $xml;
     } else {
         $ops = preg_split('/,/', $schema['values'], -1, PREG_SPLIT_NO_EMPTY);
         $ops = array_map("trim", $ops);
         $xml->addChild(new XMLElement("name", $schema['name']));
         $xml->setAttribute("handle", $schema['handle']);
         $options = new XMLElement("options");
         foreach ($ops as $o) {
             if ($schema['type'] == 'multiselect') {
                 $table = 'tbl_entries2customfields_list';
             } else {
                 $table = 'tbl_entries2customfields';
             }
             $count = $this->_db->fetchVar('count', 0, "SELECT count(id) AS `count` FROM `{$table}` WHERE `field_id` = '" . $schema['id'] . "' AND value_raw = '{$o}' ");
             $xO = new XMLElement("option", $o);
             $xO->setAttribute('entry-count', $count);
             $xO->setAttribute('handle', Lang::createHandle($o, $this->_parent->getConfigVar('handle_length', 'admin')));
             $options->addChild($xO);
         }
         $xml->addChild($options);
     }
     ##------------------------------
     ##Write To Cache
     if ($param['caching']) {
         $result = $xml->generate($param['indent'], $param['indent-depth']);
         $this->write_to_cache($hash_id, $result, $this->_cache_sections);
         return $result;
     }
     return $xml;
 }
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:51,代码来源:data.categories_list.php


示例12: unserializeEntry

 public function unserializeEntry($entry_id, $version)
 {
     $entry = unserialize(file_get_contents(MANIFEST . '/versions/' . $entry_id . '/' . $version . '.dat'));
     $entryManager = new EntryManager(Symphony::Engine());
     $new_entry = $entryManager->create();
     $new_entry->set('id', $entry['id']);
     $new_entry->set('author_id', $entry['author_id']);
     $new_entry->set('section_id', $entry['section_id']);
     $new_entry->set('creation_date', $entry['creation_date']);
     $new_entry->set('creation_date_gmt', $entry['creation_date_gmt']);
     foreach ($entry['data'] as $field_id => $value) {
         $new_entry->setData($field_id, $value);
     }
     return $new_entry;
 }
开发者ID:andrewminton,项目名称:entry_versions,代码行数:15,代码来源:class.entryversionsmanager.php


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


示例14: __viewIndex

 public function __viewIndex()
 {
     header('content-type: text/javascript');
     $sm = new SectionManager($this->_Parent);
     $section_id = $sm->fetchIDFromHandle($_GET['section']);
     $section = $sm->fetch($section_id);
     $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


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


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


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


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


示例19: __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();
     $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/sent/');
 }
开发者ID:bauhouse,项目名称:forum,代码行数:20,代码来源:event.forum_resend_activation_email.php


示例20: grab

 /**
  * Fetch raw recipient data.
  *
  * Usage of the getSlice function, which also parses the XSLT for the name
  * and checks the email is recommended. This function is here mainly for
  * internal reasons.
  *
  * Be advised, this function returns an array of entry objects.
  *
  * @todo bugtesting and error handling
  * @return array
  */
 public function grab()
 {
     parent::grab();
     $where_and_joins = $this->getWhereJoinsAndGroup();
     $entries = EntryManager::fetchByPage($this->dsParamSTARTPAGE > 0 ? $this->dsParamSTARTPAGE : 1, $this->getSource(), $this->dsParamLIMIT >= 0 ? $this->dsParamLIMIT : NULL, $where_and_joins['where'], $where_and_joins['joins'], false, false, true, array_merge(array($this->emailField), $this->nameFields));
     // The count method of the entrymanager does not work properly, so this hack is needed :(
     $count = $this->getCount();
     $entries['total-entries'] = $count;
     $entries['total-pages'] = ceil($count / $this->dsParamLIMIT);
     $entries['remaining-pages'] = $entries['total-pages'] - $entries['current-page'];
     return $entries;
 }
开发者ID:MST-SymphonyCMS,项目名称:email_newsletter_manager,代码行数:24,代码来源:class.recipientsourcesection.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Env类代码示例发布时间:2022-05-23
下一篇:
PHP Entry类代码示例发布时间: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