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


PHP relationship_id_of函数代码示例

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


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

示例1: _produce_borrowing_nav

 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

示例2: process

 function process()
 {
     //prep site
     $this->helper->ensure_type_is_on_site(id_of('publication_type'));
     $this->helper->ensure_type_is_on_site(id_of('group_type'));
     $this->helper->ensure_nobody_group_is_on_site();
     // gather core information
     $pub_type_id = id_of('publication_type');
     $name = trim(strip_tags($this->get_value('pub_name')));
     // populate values array
     $values['new'] = 0;
     $values['description'] = trim(get_safer_html($this->get_value('pub_description')));
     $values['unique_name'] = trim(strip_tags($this->get_value('pub_unique_name')));
     $values['state'] = 'Live';
     $values['hold_comments_for_review'] = 'no';
     $values['posts_per_page'] = turn_into_int($this->get_value('pub_posts_per_page'));
     $values['blog_feed_string'] = trim(strip_tags($this->get_value('pub_rss_feed_url')));
     $values['publication_type'] = 'Newsletter';
     $values['has_issues'] = 'no';
     $values['has_sections'] = 'no';
     $values['date_format'] = $this->get_value('date_format');
     // create the publication
     $pub_id = reason_create_entity($this->site_id, $pub_type_id, $this->user_id, $name, $values);
     // associate with nobody posting and commenting groups
     create_relationship($pub_id, id_of('nobody_group'), relationship_id_of('publication_to_authorized_posting_group'));
     create_relationship($pub_id, id_of('nobody_group'), relationship_id_of('publication_to_authorized_commenting_group'));
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:27,代码来源:migrator_screen_3.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: 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

示例5: link_section_to_parent

 protected function link_section_to_parent($section)
 {
     //echo round(memory_get_usage()/1024,2)."K at point A\n";
     if ($template = $this->get_section_parent($section->get_value('parent_template_id'))) {
         //	echo round(memory_get_usage()/1024,2)."K at point B\n";
         if (!($parents = $section->get_right_relationship('course_template_to_course_section'))) {
             return create_relationship($template->id(), $section->id(), relationship_id_of('course_template_to_course_section'), false, false);
         } else {
             if (is_array($parents)) {
                 $current_template = reset($parents);
                 //		echo round(memory_get_usage()/1024,2)."K at point C\n";
                 // verify that we have the correct parent, and fix if not.
                 if ($current_template->get_value('sourced_id') == $template->get_value('sourced_id')) {
                     return true;
                 } else {
                     //$this->errors[] = 'Incorrect template attached to '.$section->get_value('name');
                     echo 'Incorrect template attached to ' . $section->get_value('name');
                 }
             } else {
                 //$this->errors[] = 'Non-array '.$parents.' returned from get_right_relationship';
                 echo 'Non-array ' . $parents . ' returned from get_right_relationship';
             }
         }
     } else {
         //$this->errors[] = 'No template found for '.$section->get_value('name');
         echo 'No template found for ' . $section->get_value('name');
         return false;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:course_import.php

示例6: init

 function init($args = array())
 {
     parent::init($args);
     /*
     			$es = new entity_selector( $this->parent->site_id );
     			$es->add_type( id_of( 'policy_type' ) );
     			//$es->set_order( 'sortable.sort_order ASC' );
     			$es->set_order( 'entity.name ASC' );
     			$es->add_left_relationship_field( 'parent' , 'entity' , 'id' , 'parent_id' );
     			$es->add_right_relationship( $this->parent->cur_page->id(), relationship_id_of('page_to_policy') );
     
     			$this->values = $es->run_one();
     */
     //$this->pages->order_by = 'sortable.sort_order ASC';
     //Set up our AllPolicyNavigation to grab all the policies associated
     //with a given page and sort them by sort_order.
     //I am not really sure how necessary it is to use a mutiple_root_tree_viewer,
     //but it works.
     $this->pages = new AllPolicyNavigation();
     $this->pages->init($this->parent->site_id, id_of('policy_type'));
     $this->pages->es->set_order('sortable.sort_order ASC');
     $this->pages->es->add_left_relationship_field('policy_parent', 'entity', 'id', 'parent_id');
     $this->pages->es->add_right_relationship($this->parent->cur_page->id(), relationship_id_of('page_to_policy'));
     $this->pages->values = $this->pages->es->run_one();
     //$this->pages->request =& $this->request;
     //I don't think this kludge is required for this usage, so I am commenting it out
     //Just in case, though, I am leaving it in the code. JLO 03/10/04
     // small kludge - just give the tree view access to the site info.  used in the show_item function to show the root node of the navigation
     //if ( !empty ( $this->site_info ) )
     //	$this->pages->site_info = $this->site_info;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:policy_related_all.php

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

示例8: alter_es

		function alter_es() // {{{
		{
			if (!$this->params['limit_to_current_site'])
			{
				$alias = $this->es->add_right_relationship_field('owns', 'entity', 'name', 'site_name');
				$site_order_string = $alias['site_name']['table'] . '.' . $alias['site_name']['field'] . ' ASC';
				$this->es->set_order( $site_order_string . ', entity.last_modified DESC' );
			}
			else
			{
				$this->es->set_order( 'entity.last_modified DESC' );
			}
			if(!empty($this->params['audiences']))
			{
				$aud_ids = array();
				foreach($this->params['audiences'] as $audience)
				{
					$aud_id = id_of($audience);
					if($aud_id)
					{
						$aud_ids[] = $aud_id;
					}
					else
					{
						trigger_error($audience.' is not a unique name; skipping this audience');
					}
				}
				if(!empty($aud_ids))
				{
					$this->es->add_left_relationship($aud_ids, relationship_id_of('faq_to_audience'));
				}
			}
		} // }}}
开发者ID:natepixel,项目名称:reason_package,代码行数:33,代码来源:faqs.php

示例9: _rel_is_sortable

 protected function _rel_is_sortable()
 {
     if ($info = reason_get_allowable_relationship_info(relationship_id_of('event_to_image'))) {
         return $info['is_sortable'] == 'yes' ? true : false;
     }
     trigger_error('unable to find event_to_image allowable relationship');
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:7,代码来源:event_rel_sort.php

示例10: _get_es

 protected function _get_es()
 {
     $es = parent::_get_es();
     $es->set_site(null);
     $es->add_right_relationship($this->page_id, relationship_id_of('page_to_policy'));
     return $es;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:7,代码来源:policy_related.php

示例11: init

 function init($args = array())
 {
     parent::init($args);
     $site = new entity($this->site_id);
     if (!empty($this->params['sites'])) {
         $this->child_sites = array();
         foreach ($this->params['sites'] as $unique_name) {
             if ($id = id_of($unique_name)) {
                 $e = new entity($id);
                 if ($e->get_value('type') == id_of('site') && ($site->get_value('site_state') != 'Live' || $e->get_value('site_state') == 'Live')) {
                     $this->child_sites[$id] = $e;
                 }
             }
         }
     } else {
         $es = new entity_selector();
         $es->description = 'Getting child sites of this site';
         $es->add_type(id_of('site'));
         $es->add_left_relationship($this->site_id, relationship_id_of('parent_site'));
         $es->set_order('entity.name');
         if ($site->get_value('site_state') == 'Live') {
             $es->add_relation('site_state="Live"');
         }
         $this->child_sites = $es->run_one();
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:child_sites.php

示例12: alter_data

 function alter_data()
 {
     $this->set_display_name('name', 'Section Name');
     $this->remove_element('keywords');
     $this->add_relationship_element('publication', id_of('publication_type'), relationship_id_of('news_section_to_publication'), 'right', 'select');
     //$this->add_required('publication');
     $this->set_order(array('publication', 'name'));
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:8,代码来源:news_section.php

示例13: refine_es

 function refine_es($es)
 {
     $es->add_right_relationship($this->page_id, relationship_id_of('minisite_page_to_image'));
     $es->add_rel_sort_field($this->page_id, relationship_id_of('minisite_page_to_image'), 'rel_sort_order');
     // order first by rel_sort_order if that is not defined second criteria is dated.datetime ASC - this keeps pages that change to gallery pages reasonably predictable
     $es->set_order('rel_sort_order ASC, dated.datetime ASC');
     return $es;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:8,代码来源:gallery.php

示例14: load_by_type

 function load_by_type($type_id, $id, $user_id)
 {
     $this->_id = $id;
     $this->_original = new entity($this->_id);
     // load all fields used by this type
     $q = 'DESC entity';
     $r = db_query($q, 'Unable to get entity description');
     while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
         list($type, $args) = $this->plasmature_type_from_db_type($row['Field'], $row['Type']);
         $this->add_element($row['Field'], $type, $args);
     }
     // get tables associated with this type
     $es = new entity_selector();
     $es->description = 'disco reason: load_by_type: tables to type';
     $es->add_type(id_of('content_table'));
     $es->add_right_relationship($type_id, relationship_id_of('type_to_table'));
     $tables = $es->run_one();
     unset($es);
     // make an element for each field the type has
     foreach ($tables as $tid => $table) {
         // grab the type's entity tables and fields
         $es = new entity_selector();
         $es->description = 'disco reason 2: load_by_type: fields associated with table ' . $table->get_value('name');
         $es->add_type(id_of('field'));
         $es->add_left_relationship($tid, relationship_id_of('field_to_entity_table'));
         $fields = $es->run_one('', 'Live', 'field es');
         unset($es);
         foreach ($fields as $fid => $field) {
             $args = array();
             $type = '';
             // set the plasmature type if specified by the field, otherwise look up the default for the database type
             list($type, $args) = $this->plasmature_type_from_db_type($field->get_value('name'), $field->get_value('db_type'));
             if ($field->get_value('plasmature_type')) {
                 $type = $field->get_value('plasmature_type');
             }
             // hook for plasmature arguments here
             $this->add_element($field->get_value('name'), $type, $args, $field->get_value('db_type'));
         }
     }
     // load values
     $elements = $this->_original->get_values();
     foreach ($elements as $key => $val) {
         if (isset($val)) {
             $this->set_value($key, $val);
         }
     }
     $this->init();
     $this->change_element_type('type', 'hidden');
     $this->set_value('type', $type_id);
     $this->change_element_type('last_edited_by', 'hidden');
     $this->set_value('last_edited_by', $user_id);
     if (!reason_user_has_privs($user_id, 'edit_unique_names')) {
         $this->change_element_type('unique_name', 'hidden');
     } elseif ($this->get_value('unique_name')) {
         $this->change_element_type('unique_name', 'solidText');
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:57,代码来源:disco.php

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


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