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


PHP entity::user_can_edit_relationship方法代码示例

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


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

示例1: array

 function get_main_links($second = false)
 {
     $links = array();
     $entity = new entity($this->id);
     $user = new entity($this->user_id);
     $links['Preview'] = array('title' => 'Preview', 'link' => $this->make_link(array('cur_module' => 'Preview')));
     $can_edit = $entity->get_value('state') == 'Pending' ? reason_user_has_privs($this->user_id, 'edit_pending') : reason_user_has_privs($this->user_id, 'edit');
     if ($can_edit && reason_site_can_edit_type($this->site_id, $this->type_id)) {
         $links['Edit'] = array('title' => 'Edit', 'link' => $this->make_link(array('cur_module' => 'Editor')), 'locked' => !$entity->user_can_edit($user, 'fields'));
         if ($second) {
             $rels = $second;
         } else {
             $rels = $this->get_rels();
         }
         foreach ($rels as $rel) {
             $ass_name = !empty($rel['display_name']) ? $rel['display_name'] : $rel['entity_name'];
             $index = $rel['id'];
             $links[$index] = array('title' => $ass_name, 'icon' => '<img src="' . reason_get_type_icon_url($rel['relationship_b']) . '" alt="" />', 'link' => $this->make_link(array('site_id' => $this->site_id, 'type_id' => $this->type_id, 'rel_id' => $rel['id'], 'id' => $this->id, 'user_id' => $this->user_id, 'cur_module' => 'Associator')), 'rel_info' => $rel, 'locked' => !$entity->user_can_edit_relationship($index, $user, 'right'));
         }
         if ($second) {
             $rels = $this->get_backward_rels('I AM A GOLDEN GOD!!!');
         } else {
             $rels = $this->get_backward_rels();
         }
         foreach ($rels as $rel) {
             $ass_name = !empty($rel['display_name_reverse_direction']) ? $rel['display_name_reverse_direction'] : $rel['entity_name'];
             $index = $rel['id'];
             $links[$index] = array('title' => $ass_name, 'icon' => '<img src="' . reason_get_type_icon_url($rel['relationship_a']) . '" alt="" />', 'link' => $this->make_link(array('site_id' => $this->site_id, 'type_id' => $this->type_id, 'rel_id' => $rel['id'], 'id' => $this->id, 'user_id' => $this->user_id, 'cur_module' => 'ReverseAssociator')), 'rel_info' => $rel, 'locked' => !$entity->user_can_edit_relationship($index, $user, 'left'));
         }
     }
     $links['Finish'] = array('title' => '<strong>Finish</strong>', 'link' => $this->make_link(array('cur_module' => 'Finish')));
     // if the entity is new, give the link to cancel its creation
     $e = new entity($this->id);
     if ($e->get_value('new') && $e->get_value('state') == 'Pending' && $can_edit && !$e->get_value('name') && $this->cur_module == 'Editor') {
         $links['Cancel'] = array('title' => 'Cancel', 'link' => $this->make_link(array('cur_module' => 'Cancel')));
     }
     // This is a hack because the 'new_entity' variable is getting passed around a little too promiscuously.  Really newness should be stored in the db with the entity and removed upon finish. MR 3/11/2004 */
     /*$e = new entity( $this->id );
     		$created = prettify_mysql_timestamp( $e->get_value('creation_date'), 'Y-m-d' );
     		$today = date('Y-m-d');
     		if( !empty( $this->request[ 'new_entity' ] ) && $created == $today )
     			$links[ 'Cancel' ] = array( 'title' => 'Cancel' ,
     										'link' => $this->make_link( array( 'cur_module' => 'Cancel' ) ) ); */
     return $links;
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:45,代码来源:admin_page.php

示例2: init

 function init()
 {
     if (!$this->should_run()) {
         trigger_error('Associator module needs an ID to run; none provided.');
         return;
     }
     reason_include_once('classes/filter.php');
     reason_include_once('content_listers/associate.php');
     include_once CARL_UTIL_INC . 'basic/misc.php';
     $this->head_items->add_javascript(JQUERY_URL, true);
     $this->head_items->add_stylesheet(REASON_ADMIN_CSS_DIRECTORY . 'assoc.css');
     $this->head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'table_update.js');
     $this->head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'associator.js');
     $this->get_associations();
     if (empty($this->associations[$this->admin_page->rel_id])) {
         trigger_error($this->admin_page->rel_id . ' is not a valid relationship type id');
         die;
     }
     $current_assoc = $this->associations[$this->admin_page->rel_id];
     $type = new entity($current_assoc['e_id']);
     // save the type entity in an object scope
     $this->rel_type = carl_clone($type);
     $this->admin_page->title = 'Selecting ' . $type->get_value('name');
     $entity = new entity($this->admin_page->id);
     $user = new entity($this->admin_page->user_id);
     if (!$entity->user_can_edit_relationship($this->admin_page->rel_id, $user, $this->_rel_direction)) {
         $this->_locked = true;
     } elseif ($entity->relationship_has_lock($this->admin_page->rel_id, $this->_rel_direction) && reason_user_has_privs($this->admin_page->user_id, 'manage_locks')) {
         $this->_show_lock_info = true;
     }
     $this->get_views($type->id());
     if (empty($this->views)) {
         //add generic lister if not already present
         $this->views = array();
     } else {
         reset($this->views);
         $c = current($this->views);
         if ($c) {
             $lister = $c->id();
             $this->admin_page->request['lister'] = $lister;
         } else {
             $lister = '';
         }
     }
     $lister = isset($lister) ? $lister : '';
     $this->get_viewer($this->admin_page->site_id, $type->id(), $lister);
     $this->filter = new filter();
     $this->filter->set_page($this->admin_page);
     $this->filter->grab_fields($this->viewer->filters);
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:50,代码来源:associator.php

示例3: User

 /**
  * check_permission uses the user manager class to validate that the site 
  * and user are valid, and that the user has access to the site
  *
  * @return boolean true if the user and site are valid, and the user has access to the site
  */
 function check_permission()
 {
     $user_manager = new User();
     if ($user_manager->set_site_id($this->site_id)) {
         if ($user_manager->is_site_user($this->user_netID)) {
             $user_id = get_user_id($this->user_netID);
             $e1 = new entity($this->entity_id);
             $e2 = new entity($this->left_entity_id);
             if ($e1->get_value('state') == 'Pending' || $e2->get_value('state') == 'Pending') {
                 $priv = 'edit_pending';
             } else {
                 $priv = 'edit';
             }
             if (reason_user_has_privs($user_id, $priv)) {
                 $user = new entity($user_id);
                 return $e2->user_can_edit_relationship($this->al_relationship_id, $user, 'right');
             }
         }
     }
     return false;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:27,代码来源:rel_sort.php


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