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


PHP entity_selector::add_type方法代码示例

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


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

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

示例2: addslashes

 function image_may_be_shown($id)
 {
     if ($this->params['alternate_source_page_id']) {
         $page_id = $this->params['alternate_source_page_id'];
         if (!($site_id = get_owner_site_id($page_id))) {
             $site_id = $this->site_id;
         }
     } else {
         $page_id = $this->cur_page->id();
         $site_id = $this->site_id;
     }
     $es = new entity_selector();
     $es->add_type(id_of('image'));
     $es->set_env('site', $site_id);
     $es->add_right_relationship($page_id, relationship_id_of('minisite_page_to_image'));
     $es->add_relation('entity.id = ' . addslashes($id));
     $result = $es->run_one();
     //echo 'given id='.$id;
     if (!empty($result)) {
         //echo 'returning true';
         return true;
     } else {
         //echo 'returning false';
         return false;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:image_sidebar.php

示例3: user_has_access_to_media

 /**
  * Determines whether or not the current user has access to the specified media work.  If no username is provided, this function defaults to the currently-loggin-in username.
  *
  * @param string $username
  * @return boolean user has access
  */
 public function user_has_access_to_media($username = '')
 {
     // First, get the restricted group--if one exists
     $es = new entity_selector();
     $es->add_type(id_of('group_type'));
     $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_restricted_to_group'));
     $group = current($es->run_one());
     if (!empty($group)) {
         $gh = new group_helper();
         $gh->set_group_by_id($group->id());
         if ($gh->requires_login()) {
             if (!$username) {
                 $username = reason_check_authentication();
             }
             if ($username) {
                 if (!$gh->is_username_member_of_group($username)) {
                     return false;
                 }
             } else {
                 return false;
             }
         }
     }
     return true;
     // Return true if the user has access to view media work
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:32,代码来源:media_work_helper.php

示例4: foreach

 function get_pages_needing_change()
 {
     if (!isset($this->pages_needing_change)) {
         $es = new entity_selector();
         $es->add_type(id_of('minisite_page'));
         $es->enable_multivalue_results();
         $es->limit_tables('page_node');
         $es->limit_fields('custom_page');
         $es->add_relation('page_node.custom_page = "blurb"');
         $es->add_left_relationship_field('minisite_page_to_text_blurb', 'entity', 'id', 'blurb_id');
         $result = $es->run_one();
         foreach ($result as $k => $page) {
             $blurbs = is_array($page->get_value('blurb_id')) ? $page->get_value('blurb_id') : array($page->get_value('blurb_id'));
             foreach ($blurbs as $blurb_id) {
                 $blurb = new entity($blurb_id);
                 $content = $blurb->get_value('content');
                 $demoted_content = demote_headings($content, 1);
                 if ($content == $demoted_content) {
                     $pages_needing_page_type_change[$k] = $k;
                 }
             }
         }
         $this->pages_needing_change = isset($pages_needing_page_type_change) ? array_keys($pages_needing_page_type_change) : false;
     }
     return $this->pages_needing_change;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:blurb_page_type_change.php

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

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

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

示例8: addslashes

 function _produce_borrowing_nav()
 {
     $ret = '';
     $nes = new entity_selector();
     $nes->add_type(id_of('type'));
     $nes->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_cannot_edit_type'));
     $nes->add_relation('`entity`.`id` = "' . addslashes($this->admin_page->type_id) . '"');
     $nes->set_num(1);
     $nes->limit_tables();
     $nes->limit_fields();
     $ns = $nes->run_one();
     $show_edit = reason_user_has_privs($this->admin_page->user_id, 'edit') && !$this->admin_page->is_second_level() && empty($ns) ? true : false;
     /* $type = new entity($this->admin_page->type_id);
     			$name = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
     			if(function_exists('mb_strtolower'))
     				$name = mb_strtolower($name);
     			else
     				$name = strtolower($name); */
     $ret .= '<div class="borrowNav">' . "\n";
     $ret .= '<ul>';
     if ($show_edit) {
         $ret .= '<li><a href="' . $this->admin_page->get_owned_list_link($this->admin_page->type_id) . '"><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/bullet_edit.png" alt="" /> Add &amp; edit</a></li>';
     }
     $ret .= '<li class="current"><strong><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/car.png" alt="" /> Borrow</strong></li>';
     $ret .= '</ul>' . "\n";
     $ret .= '</div>' . "\n";
     // if(reason_user_has_privs($this->admin_page->user_id,'edit'))
     return $ret;
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:29,代码来源:sharing.php

示例9: name_es

function name_es($name)
{
    $es = new entity_selector();
    $es->add_type(id_of('content_table'));
    $es->add_relation('entity.name = "' . $name . '"');
    $results = $es->run_one();
    return $results;
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:8,代码来源:classified.php

示例10: _link_in_db

 protected function _link_in_db()
 {
     $es = new entity_selector(id_of('master_admin'));
     $es->add_type(id_of('admin_link'));
     $es->add_relation('`url` = "?cur_module=AdminTools"');
     $es->set_num(1);
     $results = $es->run_one();
     return !empty($results);
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:9,代码来源:add_admin_tools.php

示例11: get_loki_1_entity

 /**
  * @return object loki 1 entity if it exists
  */
 protected function get_loki_1_entity()
 {
     $es = new entity_selector(id_of('master_admin'));
     $es->add_type(id_of('html_editor_type'));
     $es->add_relation('entity.name = "Loki 1"');
     $es->set_num(1);
     $result = $es->run_one();
     return !empty($result) ? reset($result) : FALSE;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:12,代码来源:remove_loki_1.php

示例12:

 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

示例13: get_minisite_template

function get_minisite_template($theme_id)
{
    $template = false;
    $es = new entity_selector();
    $es->add_type(id_of('minisite_template'));
    $es->add_right_relationship($theme_id, relationship_id_of('theme_to_minisite_template'));
    $tmp = $es->run_one();
    return current($tmp);
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:9,代码来源:generate_page.php

示例14:

 function get_images_in_new_order($page_id)
 {
     $es = new entity_selector();
     $es->add_type(id_of('image'));
     $es->add_right_relationship($page_id, relationship_id_of('minisite_page_to_image'));
     $es->add_rel_sort_field($page_id, relationship_id_of('minisite_page_to_image'), 'rel_sort_order');
     $es->add_field('relationship', 'id', 'rel_id');
     $es->set_order('rel_sort_order ASC, dated.datetime ASC, meta.description ASC, entity.id ASC');
     return $es->run_one();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:10,代码来源:image_ordering.php

示例15:

 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


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