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


PHP entity_selector类代码示例

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


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

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

示例2: get_links

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

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

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

示例6: get_entity_selector

 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

示例7: init

 /**
  * Standard Module init function
  *
  * Sets up page variables and runs the entity selctor that grabs the users
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     $this->site = new entity($this->admin_page->site_id);
     $this->admin_page->title = 'Users with administrative access to ' . $this->site->get_value('name');
     $es = new entity_selector();
     $es->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_to_user'));
     $this->users = $es->run_one(id_of('user'));
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:16,代码来源:view_users.php

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

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

示例10: get_images_in_new_order

 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

示例11: get_av_files

 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

示例12: run_error_checks

 function run_error_checks()
 {
     parent::run_error_checks();
     $es = new entity_selector();
     $es->add_relation('audience_integration.directory_service_value = "' . reason_sql_string_escape($this->get_value('directory_service_value')) . '"');
     $es->add_relation('entity.id != ' . $this->get_value('id'));
     $es->set_num(1);
     $conflicts = $es->run_one(id_of('audience_type'));
     if (!empty($conflicts)) {
         $this->set_error('directory_service_value', 'The Directory Service Value you entered ("' . $this->get_value('directory_service_value') . '") is already in use. Each audience must have a unique directory service value.');
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:12,代码来源:audience.php

示例13: do_updates

 function do_updates($mode, $reason_user_id)
 {
     if ($mode != 'run' && $mode != 'test') {
         trigger_error('$mode most be either "run" or "test"');
         return;
     }
     $messages = array();
     $es = new entity_selector(id_of('master_admin'));
     $es->add_type(id_of('view_type'));
     $es->add_relation('url = "sections_and_issues.php"');
     $es->set_num(1);
     $view_types = $es->run_one();
     if (empty($view_types)) {
         if ('test' == $mode) {
             echo '<p>Would have added the view type sections_and_issues.php and the Sections and Issues view</p>' . "\n";
             return;
         } else {
             $view_type_id = reason_create_entity(id_of('master_admin'), id_of('view_type'), $reason_user_id, 'News Sections and Issues', array('url' => 'sections_and_issues.php'));
             $view_type = new entity($view_type_id);
             echo '<p>Added the view type sections_and_issues.php</p>' . "\n";
         }
     } else {
         echo '<p>sections_and_issues.php view type already added</p>' . "\n";
         $view_type = current($view_types);
     }
     $es = new entity_selector(id_of('master_admin'));
     $es->add_type(id_of('view'));
     $es->add_left_relationship($view_type->id(), relationship_id_of('view_to_view_type'));
     $es->set_num(1);
     $views = $es->run_one();
     if (empty($views)) {
         if ('test' == $mode) {
             echo '<p>Would have added the Sections and Issues view</p>' . "\n";
         } else {
             $es = new entity_selector(id_of('master_admin'));
             $es->add_type(id_of('field'));
             $es->add_relation('entity.name = "status"');
             $es->set_num(1);
             $fields = $es->run_one();
             $view_id = reason_create_entity(id_of('master_admin'), id_of('view'), $reason_user_id, 'News Sections and Issues', array('display_name' => 'Sections and Issues'));
             create_relationship($view_id, $view_type->id(), relationship_id_of('view_to_view_type'));
             create_relationship($view_id, id_of('news'), relationship_id_of('view_to_type'));
             if (!empty($fields)) {
                 $field = current($fields);
                 create_relationship($view_id, $field->id(), relationship_id_of('view_columns'));
                 create_relationship($view_id, $field->id(), relationship_id_of('view_searchable_fields'));
             }
             echo '<p>Added sections and issue view</p>';
         }
     } else {
         echo '<p>sections and issues view already added.</p>' . "\n";
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:53,代码来源:minor_updates.php

示例14: init

 function init($args = array())
 {
     $es = new entity_selector($this->parent->site_id);
     $es->description = 'Selecting blog/publications for this page';
     $es->add_type(id_of('publication_type'));
     $es->add_right_relationship($this->parent->cur_page->id(), relationship_id_of('page_to_publication'));
     $es->set_num(1);
     $blogs = $es->run_one();
     if (!empty($blogs)) {
         $this->blog = current($blogs);
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:12,代码来源:blog_description.php

示例15: run_job

 function run_job()
 {
     $es = new entity_selector($this->site_id);
     $es->add_type(id_of('news'));
     $result = $es->run_one();
     if ($result) {
         $ids = array_keys($result);
         foreach ($result as $id => $item) {
             reason_expunge_entity($id, $this->user_id);
         }
     }
     $es = new entity_selector($this->site_id);
     $es->add_type(id_of('publication_type'));
     $result = $es->run_one();
     if ($result) {
         $ids = array_keys($result);
         foreach ($result as $id => $item) {
             reason_expunge_entity($id, $this->user_id);
         }
     }
     $es = new entity_selector($this->site_id);
     $es->add_type(id_of('category_type'));
     $result = $es->run_one();
     if ($result) {
         $ids = array_keys($result);
         foreach ($result as $id => $item) {
             reason_expunge_entity($id, $this->user_id);
         }
     }
     $es = new entity_selector($this->site_id);
     $es->add_type(id_of('comment_type'));
     $result = $es->run_one();
     if ($result) {
         $ids = array_keys($result);
         foreach ($result as $id => $item) {
             reason_expunge_entity($id, $this->user_id);
         }
     }
     $es = new entity_selector($this->site_id);
     $es->add_type(id_of('minisite_page'));
     $result = $es->run_one();
     if ($result) {
         $root_page = root_finder($this->site_id);
         $ids = array_keys($result);
         foreach ($result as $id => $item) {
             if ($id != $root_page) {
                 reason_expunge_entity($id, $this->user_id);
             }
         }
     }
     $this->set_report('Zapped all the news, publications, categories, comments, and pages from the site');
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:52,代码来源:wordpress_cleanup_job.php


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