本文整理汇总了PHP中id_of函数的典型用法代码示例。如果您正苦于以下问题:PHP id_of函数的具体用法?PHP id_of怎么用?PHP id_of使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了id_of函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_job
function run_job()
{
reason_include_once('minisite_templates/nav_classes/default.php');
$page_ids = $this->config('page_ids');
$id = reset($page_ids);
$page = new entity($id);
$site = $page->get_owner();
// lets make and get the page tree
$page_tree = new MinisiteNavigation();
$page_tree->order_by = 'sortable.sort_order';
$page_tree->init($site->id(), id_of('minisite_page'));
foreach ($page_ids as $page_id) {
$children = $page_tree->children($page_id);
$diff = array_diff($children, $page_ids);
// are we trying to move a page without its children?
if (!empty($diff)) {
$problem[] = 'Cannot move page id ' . $page_id . ' without also moving child pages with ids (' . implode(", ", $diff) . ')';
}
}
if (isset($problem)) {
$report = 'Blocking any further jobs. When moving pages you need to move entire branches';
$report .= '<ul>';
$report .= '<li>' . implode("</li><li>", $problem) . '</li>';
$report .= '</ul>';
$this->set_report($report);
$this->block_jobs();
return false;
} else {
$this->set_report('Verified that the page tree integrity is preserved with this move.');
}
return true;
}
示例2: show_feed_link
function show_feed_link()
{
$type = new entity(id_of('event_type'));
if ($type->get_value('feed_url_string')) {
echo '<div class="feedInfo"><a href="/' . REASON_GLOBAL_FEEDS_PATH . '/' . $type->get_value('feed_url_string') . '" title="RSS feed for this site\'s events">xml</a></div>';
}
}
示例3: _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 & 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;
}
示例4: get_site_type_entity
protected function get_site_type_entity()
{
if (!isset($this->site_type_entity)) {
$this->site_type_entity = new entity(id_of('site'));
}
return $this->site_type_entity;
}
示例5: get_pages_needing_change
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;
}
示例6: 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;
}
}
示例7: get_feature_type_entity
protected function get_feature_type_entity()
{
if (!isset($this->feature_type_entity)) {
$this->feature_type_entity = new entity(id_of('feature_type'));
}
return $this->feature_type_entity;
}
示例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'));
}
}
} // }}}
示例9: 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
}
示例10: 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;
}
示例11: run
/**
* Run the upgrader
* @return string HTML report
*/
public function run()
{
$run_message = '';
if (!reason_relationship_name_exists('news_to_media_work')) {
$news_to_media_work_definition = array('description' => 'News / Post shows Media Work', 'directionality' => 'bidirectional', 'connections' => 'many_to_many', 'required' => 'no', 'is_sortable' => 'yes', 'display_name' => 'Media', 'display_name_reverse_direction' => 'News / Posts');
if (create_allowable_relationship(id_of('news'), id_of('av'), 'news_to_media_work', $news_to_media_work_definition)) {
$run_message .= '<p>Added the news_to_media_work allowable relationship.</p>';
} else {
$run_message .= '<p>Failed to create the news_to_media_work allowable relationship. Try again. If you are not successful, you may wish to try to add this relationship type manually: In Master Admin, go to Allowable Relationship Manager, add a row, then create a relationship between News / Post and Media Work named news_to_media work. The other values are:</p>' . spray($news_to_media_work_definition);
}
}
if (!reason_relationship_name_exists('event_to_media_work')) {
$event_to_media_work_definition = array('description' => 'Event shows Media Work', 'directionality' => 'bidirectional', 'connections' => 'many_to_many', 'required' => 'no', 'is_sortable' => 'yes', 'display_name' => 'Media', 'display_name_reverse_direction' => 'Events');
if (create_allowable_relationship(id_of('event_type'), id_of('av'), 'event_to_media_work', $event_to_media_work_definition)) {
$run_message .= '<p>Added the event_to_media_work allowable relationship.</p>';
} else {
$run_message .= '<p>Failed to create the event_to_media_work allowable relationship. Try again. If you are not successful, you may wish to try to add this relationship type manually: In Master Admin, go to Allowable Relationship Manager, add a row, then create a relationship between Event and Media Work named event_to_media work. The other values are:</p>' . spray($event_to_media_work_definition);
}
}
if (!empty($run_message)) {
return $run_message;
} else {
return 'This update has already run.';
}
}
示例12: 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);
}
}
示例13: 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'));
}
示例14: get_social_account_type_entity
protected function get_social_account_type_entity()
{
if (!isset($this->social_account_type_entity)) {
$this->social_account_type_entity = new entity(id_of('social_account_type'));
}
return $this->social_account_type_entity;
}
示例15: thor_build_display_values
function thor_build_display_values()
{
$form = new entity($this->form_id);
$form->get_values();
if ($form->get_value('type') != id_of('form'))
{
trigger_error('the thor viewer was passed an invalid id ('.$form_id.') - it must be passed the ID of a reason form entity');
}
else
{
$form_xml_obj = new XMLParser($form->get_value('thor_content'));
$form_xml_obj->Parse();
$display_values = array();
foreach ($form_xml_obj->document->tagChildren as $k=>$v)
{
$tagname = is_object($v) ? $v->tagName : '';
if (method_exists($this, '_build_display_'.$tagname))
{
$build_function = '_build_display_'.$tagname;
$display_values = array_merge($display_values, $this->$build_function($v));
}
}
}
foreach ($this->extra_fields as $field_name)
{
$display_values[$field_name]['label'] = prettify_string($field_name);
$display_values[$field_name]['type'] = 'text';
}
$this->_display_values = (isset($display_values)) ? $display_values : array();
}