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


PHP entity_selector::set_order方法代码示例

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


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

示例1: init

 /**
  * Standard Module init function
  *
  * @return void
  */
 function init()
 {
     parent::init();
     if (!reason_user_has_privs($this->admin_page->user_id, 'delete')) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you don\'t have the privileges to delete items on this site.';
     } elseif (empty($this->admin_page->site_id)) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you need to specify a site before batch deleting items.';
     } elseif (empty($this->admin_page->type_id)) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you need to specify a type before batch deleting items.';
     }
     if ($this->_ok_to_run) {
         $this->_type = new entity($this->admin_page->type_id);
         $this->admin_page->title = 'Batch Delete ' . $this->_type->get_value('plural_name');
         $es = new entity_selector($this->admin_page->site_id);
         $es->add_type($this->admin_page->type_id);
         $es->set_sharing('owns');
         $es->set_order('entity.last_modified DESC');
         // pray($this->admin_page->request);
         if (isset($this->admin_page->request['state']) && $this->admin_page->request['state'] == 'pending') {
             $status = 'Pending';
         } else {
             $status = 'Live';
         }
         $this->_items = $es->run_one('', $status);
         foreach (array_keys($this->_items) as $id) {
             if (!$this->admin_page->is_deletable($id)) {
                 unset($this->_items[$id]);
             }
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:39,代码来源:batch_delete.php

示例2: foreach

 function get_links()
 {
     $links = parent::get_links();
     $es = new entity_selector($this->admin_page->site_id);
     $es->add_type(id_of('event_type'));
     $es->set_order('dated.datetime DESC');
     $values = $es->run_one();
     //should adjust so that can't rearrange slots for events that have only one or no registration slots.
     //also, probably not for past events either.
     if ($values) {
         foreach ($values as $event_id => $event) {
             $es2 = new entity_selector($this->admin_page->site_id);
             $es2->add_type(id_of('registration_slot_type'));
             $es2->add_right_relationship($event_id, relationship_id_of('event_type_to_registration_slot_type'));
             $numSlots = $es2->get_one_count();
             if ($numSlots > 1) {
                 $date = $event->get_value('datetime');
                 $name = 'Sort slots for ' . $event->get_value('name') . ' - ' . prettify_mysql_datetime($date);
                 $link = $this->admin_page->make_link(array('event_id' => $event->id(), 'default_sort' => false), true);
                 $links[$name] = $link;
             }
         }
         $this->links = $links;
         return $this->links;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:registration_slot.php

示例3: build

 /**
  * Make sure that the model is configured with a valid URL.
  *
  * @return string json
  */
 function build()
 {
     if ($site_id = $this->config('site_id')) {
         $s = get_microtime();
         $es = new entity_selector();
         $es->add_type(id_of('social_account_type'));
         $es->add_right_relationship($site_id, relationship_id_of('site_to_social_account'));
         $es->add_rel_sort_field($site_id, relationship_id_of('site_to_social_account'));
         $es->set_order('rel_sort_order ASC');
         $es->limit_tables();
         $es->limit_fields();
         if ($results = $es->run_one()) {
             $result_keys = array_keys($results);
             $sih = reason_get_social_integration_helper();
             foreach ($result_keys as $id) {
                 // get the integrator if it supports the SocialAccountProfileLinks interface
                 if ($integrator = $sih->get_social_account_integrator($id, 'SocialAccountProfileLinks')) {
                     $profile_links[$id]['icon'] = $integrator->get_profile_link_icon($id);
                     $profile_links[$id]['text'] = $integrator->get_profile_link_text($id);
                     $profile_links[$id]['href'] = $integrator->get_profile_link_href($id);
                 }
             }
             if (!empty($profile_links)) {
                 return $profile_links;
             }
         }
         return false;
     } else {
         trigger_error('The ReasonSocialProfileLinksModel must be provided with the configuration parameter site_id.', FATAL);
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:36,代码来源:profile_links.php

示例4: array

		function _get_events()
		{
			if(!isset($this->events))
			{
				$es = new entity_selector($this->site_id);
				$es->add_type(id_of('event_type'));
				
				if(!in_array('archived',$this->params['show']))
				{
					$es->add_relation('`last_occurence` >= "'.addslashes(date('Y-m-d')).'"');
				}
				if(!in_array('upcoming',$this->params['show']))
				{
					$es->add_relation('`datetime` < "'.addslashes(date('Y-m-d',time() + (60*60*24))).'"');
				}
				if(!in_array('current',$this->params['show']))
				{
					$es->add_relation('(`last_occurence` < "'.addslashes(date('Y-m-d')).'" OR `datetime` >= "'.addslashes(date('Y-m-d',time() + (60*60*24))).'")');
				}
				$es->add_relation('`show_hide` = "show"');
				$es->set_order($this->params['order']);
				$this->_modify_events_es($es);
				$events = $es->run_one();
				$class = $this->get_model_class($this->params['model']);
				foreach($events as $id => $event)
				{
					$this->events[$id] = new $class($event);
				}
				if(empty($this->events))
					$this->events = array();
			}
			return $this->events;
		}
开发者ID:natepixel,项目名称:reason_package,代码行数:33,代码来源:module.php

示例5:

 function get_entity_selector()
 {
     $es = new entity_selector($this->admin_page->site_id);
     $es->add_type($this->admin_page->type_id);
     $es->set_order($this->get_table() . '.' . $this->get_field() . ' ASC');
     $es->set_sharing('owns');
     $es = $this->update_es($es);
     return $es;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:9,代码来源:sorter.php

示例6:

 function get_last_modified_item_selector()
 {
     $es = new entity_selector($this->site_id());
     $es->add_type($this->type());
     $es->limit_tables();
     $es->limit_fields('last_modified');
     $es->set_num(1);
     $es->set_order('last_modified DESC');
     return $es;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:10,代码来源:reason_json.php

示例7:

 function get_av_files($item, $num = 0)
 {
     $avf = new entity_selector();
     $avf->add_type(id_of('av_file'));
     $avf->add_right_relationship($item->id(), relationship_id_of('av_to_av_file'));
     $avf->set_order('av.media_format ASC, av.av_part_number ASC');
     if ($num) {
         $avf->set_num($num);
     }
     return $avf->run_one();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:11,代码来源:av_simple.php

示例8: run

 function run()
 {
     $site_id = $this->site_id;
     $es = new entity_selector($site_id);
     $es->add_type(id_of('google_map_type'));
     $es->add_right_relationship($this->cur_page->id(), relationship_id_of('page_to_google_map'));
     $es->add_rel_sort_field($this->cur_page->id(), relationship_id_of('page_to_google_map'));
     $es->set_order('rel_sort_order');
     $gmaps = $es->run_one();
     draw_google_map($gmaps);
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:11,代码来源:google_map.php

示例9: init

 function init($args = array())
 {
     parent::init($args);
     $s = new entity_selector();
     $s->add_type(id_of('site'));
     $s->set_order('entity.name');
     $s->add_relation('site.site_state = "Live"');
     $this->site_count = $s->get_one_count();
     $this->sites = $s->run_one();
     //pray($this->sites);
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:11,代码来源:live_sites.php

示例10: foreach

 function setup_associated_items()
 {
     // populate associated entity selector from scratch
     $ass_es = new entity_selector();
     $ass_es->add_type($this->type_id);
     if ($this->rel_direction == 'a_to_b') {
         $ass_es->add_right_relationship($this->admin_page->id, $this->admin_page->rel_id);
     } else {
         $ass_es->add_left_relationship($this->admin_page->id, $this->admin_page->rel_id);
     }
     $ass_es->add_right_relationship_field('owns', 'entity', 'id', 'site_owner_id');
     if ($this->rel_direction == 'a_to_b' && $this->check_is_rel_sortable()) {
         $this->columns['rel_sort_order'] = true;
         $ass_es->add_field('relationship', 'id', 'rel_id');
         $ass_es->add_rel_sort_field($this->admin_page->id);
         $ass_es->set_order('relationship.rel_sort_order ASC');
         if ($this->_cur_user_has_edit_privs() && !$this->get_relationship_lock_state()) {
             $this->alter_order_enable = true;
         }
     } else {
         $ass_es->add_field('relationship', 'site', 'rel_site_id');
     }
     if ($this->assoc_viewer_order_by($ass_es)) {
         $this->alter_order_enable = false;
     }
     $this->ass_vals = $ass_es->run_one();
     // check sharing on associated entities
     foreach ($this->ass_vals as $k => $val) {
         // setup sharing value
         if ($this->site_id == $val->get_value('site_owner_id')) {
             $this->ass_vals[$k]->set_value('sharing', 'owns');
         } else {
             $this->ass_vals[$k]->set_value('sharing', $this->check_borrow_status($k));
         }
     }
     // this verifies and updates the associated items rel_sort_order if this is an a to b relationship
     if ($this->rel_direction == 'a_to_b' && $this->check_is_rel_sortable()) {
         if (count($this->ass_vals) == 1 && isset($this->columns['rel_sort_order'])) {
             unset($this->columns['rel_sort_order']);
         }
         if ($ass_es->orderby == 'relationship.rel_sort_order ASC') {
             $rel_update_array = $this->validate_rel_sort_order($this->ass_vals, true);
         } else {
             $rel_update_array = $this->validate_rel_sort_order($this->ass_vals);
         }
         if (count($rel_update_array) > 0) {
             foreach ($rel_update_array as $k => $v) {
                 update_relationship($k, array('rel_sort_order' => $v));
             }
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:52,代码来源:associate.php

示例11:

 function alter_values()
 {
     $parent = new entity_selector();
     $parent->add_field('entity2', 'id', 'parent_id');
     $parent->add_table('allowable_relationship2', 'allowable_relationship');
     $parent->add_table('relationship2', 'relationship');
     $parent->add_table('entity2', 'entity');
     $parent->add_relation('entity2.id =  relationship2.entity_b');
     $parent->add_relation('entity.id = relationship2.entity_a');
     $parent->add_relation('relationship2.type = allowable_relationship2.id');
     $parent->add_relation('allowable_relationship2.name LIKE "%parent%"');
     $parent->set_order('sortable.sort_order');
     $this->es->swallow($parent);
     $this->remove_column('id');
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:15,代码来源:multiple_root_tree.php

示例12: reset

 function get_description($site)
 {
     $es = new entity_selector($site->id());
     $es->add_type(id_of('text_blurb'));
     $es->add_relation('entity.name = "Site Description"');
     $es->set_order('entity.last_modified DESC');
     $descriptions = $es->run_one();
     if (!empty($descriptions)) {
         reset($descriptions);
         $desc = current($descriptions);
         return $desc->get_value('content');
     } elseif ($site->get_value('description')) {
         return $site->get_value('description');
     } else {
         return NULL;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:17,代码来源:child_sites.php

示例13: entity

 /**
  * Quick and dirty helper function that gets the sites with available associations with that type.
  *
  * This function just checks for all sites that are currently set to share objects of the given type.
  * If the current site is live, it only selects those other sites which are also live.  It does
  * not check the sites to see if the site is actually sharing anything.
  * @return array An array of entities of the available sites in alphabetical order
  */
 function get_sites_with_available_associations()
 {
     $cur_site = new entity($this->page->site_id);
     $es = new entity_selector();
     $es->add_type(id_of('site'));
     if ($cur_site->get_value('site_state') == 'Live') {
         $es->add_relation('site.site_state = "Live"');
     }
     $es->add_relation('entity.id != ' . $this->page->site_id);
     $es->add_left_relationship($this->page->type_id, relationship_id_of('site_shares_type'));
     $es->set_order('name ASC');
     $results = $es->run_one();
     $return_array = array();
     foreach ($results as $e) {
         $return_array[$e->id()] = $e->get_value('name');
     }
     return $return_array;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:sharing_filter.php

示例14: get_image

 public function get_image()
 {
     if (!isset($this->_image)) {
         $es = new entity_selector();
         $es->add_type(id_of('image'));
         $es->add_right_relationship($this->_event->id(), relationship_id_of('event_to_image'));
         $es->add_rel_sort_field($this->_event->id(), relationship_id_of('event_to_image'));
         $es->set_order('rel_sort_order ASC');
         $es->set_num(1);
         $images = $es->run_one();
         if (!empty($images)) {
             $this->_image = current($images);
         } else {
             $this->_image = false;
         }
     }
     return $this->_image;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:18,代码来源:item.php

示例15: init

 function init($args = array())
 {
     $es = new entity_selector($this->site_id);
     $es->description = 'Selecting publications for this page';
     $es->add_type(id_of('publication_type'));
     $es->add_right_relationship($this->page_id, relationship_id_of('page_to_publication'));
     $es->set_num(1);
     $publications = $es->run_one();
     if (!empty($publications)) {
         $this->publication = current($publications);
         if ($this->publication->get_value('has_sections') == 'yes') {
             $es = new entity_selector($this->site_id);
             $es->description = 'Selecting news sections for this publication';
             $es->add_type(id_of('news_section_type'));
             $es->add_left_relationship($this->publication->id(), relationship_id_of('news_section_to_publication'));
             $es->set_order('sortable.sort_order ASC');
             $this->sections = $es->run_one();
         }
     }
     if (!empty($this->sections) && !empty($this->publication) && $this->publication->get_value('has_issues')) {
         if (!empty($this->request['issue_id'])) {
             $iss = new entity($this->request['issue_id']);
             if ($iss->get_values() && $iss->get_value('type') == id_of('issue_type')) {
                 $this->issue = $iss;
             }
         } else {
             $es = new entity_selector($this->site_id);
             $es->description = 'Selecting issues for this publication';
             $es->add_type(id_of('issue_type'));
             $es->limit_tables(array('dated', 'show_hide'));
             $es->limit_fields('dated.datetime');
             $es->set_order('dated.datetime DESC');
             $es->add_relation('show_hide.show_hide = "show"');
             $es->add_left_relationship($this->publication->id(), relationship_id_of('issue_to_publication'));
             $es->set_num(1);
             $issues = $es->run_one();
             if (!empty($issues)) {
                 $this->issue = current($issues);
             }
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:42,代码来源:sections.php


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