本文整理汇总了PHP中entity::has_left_relation_with_entity方法的典型用法代码示例。如果您正苦于以下问题:PHP entity::has_left_relation_with_entity方法的具体用法?PHP entity::has_left_relation_with_entity怎么用?PHP entity::has_left_relation_with_entity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity
的用法示例。
在下文中一共展示了entity::has_left_relation_with_entity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Checks to make sure that the given news item is OK to display.
*
* This should return true if the entity looks OK to be shown and false if it does not.
*
* It also does some checks and may redirect to make URLs sane (IE link given with wrong section).
*
* @param entity $entity news_item_entity
* @return boolean True if OK
*/
function further_checks_on_entity( $entity )
{
if(empty($this->items[$entity->id()]))
{
if($entity->get_value('status') == 'pending' && !user_has_access_to_site($this->site_id)) return false;
$publication_check = ($entity->has_left_relation_with_entity($this->publication, 'news_to_publication'));
// check that issue id is present and validated if the publication has issue
if ($this->publication->get_value('has_issues') == 'yes')
{
$issue_check = (!empty($this->request['issue_id']) && ($this->request['issue_id'] == $this->issue_id));
}
else $issue_check = true;
if ($publication_check && $issue_check) return true;
else return false;
}
else
{
return true;
}
}
示例2: user_is_a
/**
* Determines if a given reason user has a given role
*
* Note: This function is fairly slow (requires a potentially poky db hit on every call). If you must use it, store its results rather than asking again. Better yet, use reason_user_has_privs().
*
* @deprecated Use reason_user_has_privs(), for performance reasons and to allow extensibility of user roles
* @param integer $user_id
* @param integer $role_id
*/
function user_is_a($user_id, $role_id)
{
$user = new entity($user_id);
if ($user->has_left_relation_with_entity(new entity($role_id), relationship_id_of('user_to_user_role'))) {
return true;
} else {
return false;
}
}
示例3: explode
settype($site_id, 'integer');
$type_id = $_REQUEST['type_id'];
settype($type_id, 'integer');
if(!empty($_REQUEST['show_fields']))
{
$showable_fields = explode(',',$_REQUEST['show_fields']);
}
$type = new entity($type_id);
$site = new entity($site_id);
$reason_user_entity = new entity($reason_user_id);
if( reason_user_has_privs( $reason_user_id, 'view_sensitive_data' ) || $site->has_left_relation_with_entity( $reason_user_entity, 'site_to_user'))
{
$es = new entity_selector( $site_id );
$es->add_type( $type_id );
if(!empty($_REQUEST['limit_field']) && !empty($_REQUEST['limit_value']) )
{
$limit_field = addslashes($_REQUEST['limit_field']);
$limit_value = addslashes($_REQUEST['limit_value']);
if(empty($_REQUEST['limit_type']) || $_REQUEST['limit_type'] != 'exact')
{
$relation = $limit_field.' LIKE "%'.$limit_value.'%"';
}
else
{