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


PHP Rights::logic方法代码示例

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


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

示例1: insert

 public function insert($id = null, $type = 'all')
 {
     if ($id == null) {
         $this->name = uniqid();
         XDB::execute('INSERT INTO groups SET name = {?}', $this->name);
         $this->id = XDB::insertId();
     } else {
         $this->name = 'g_' . $id;
         XDB::execute('INSERT INTO groups SET gid = {?}, name= {?}', $id, $this->name);
         $this->id = $id;
     }
     /*
      * Create the castes
      */
     if ($type == 'user') {
         // A user group only needs an admin caste & a restricted caste.
         $this->addCaste(Rights::admin());
         $this->addCaste(Rights::restricted());
     } else {
         $admins = $this->addCaste(Rights::admin());
         $members = $this->addCaste(Rights::member());
         $logics = $this->addCaste(Rights::logic());
         $friends = $this->addCaste(Rights::friend());
         /*
          * Create the 'restricted' caste
          */
         $restricted = new UserFilter(new UFC_Caste(array($admins, $members, $logics)));
         $this->addCaste(Rights::restricted())->userfilter($restricted);
         /*
          * Create the 'everybody' caste
          * It's better not to refer to the restricted caste, as we don't know in what
          * order the bubbling is going to happen
          */
         $everybody = new UserFilter(new UFC_Caste(array($admins, $members, $logics, $friends)));
         $this->addCaste(Rights::everybody())->userfilter($everybody);
     }
 }
开发者ID:netixx,项目名称:frankiz,代码行数:37,代码来源:group.php

示例2: handler_group_ajax_users

 function handler_group_ajax_users($page)
 {
     $group = Json::i('gid');
     $limit = 25;
     $group = Group::fromId($group);
     $users = false;
     if ($group) {
         $users = array();
         $group->select(GroupSelect::castes());
         $order = new UFO_Name(UFO_Name::LASTNAME);
         $filters = new PFC_True();
         if (strlen(Json::t('promo')) > 0) {
             $filters = new UFC_Group(explode(';', Json::v('promo')));
         }
         $uf = new UserFilter(new PFC_And(new UFC_Caste($group->caste(Rights::admin())), $filters), $order);
         $admins = $uf->get(new PlLimit($limit, (Json::i('admin_page', 1) - 1) * $limit));
         $admins_total = $uf->getTotalCount();
         $uf = new UserFilter(new PFC_And(new UFC_Caste(array($group->caste(Rights::member()), $group->caste(Rights::logic()))), $filters), $order);
         $members = $uf->get(new PlLimit($limit, (Json::i('member_page', 1) - 1) * $limit));
         $members_total = $uf->getTotalCount();
         $uf = new UserFilter(new PFC_And(new UFC_Caste($group->caste(Rights::friend())), $filters), $order);
         $friends = $uf->get(new PlLimit($limit, (Json::i('friend_page', 1) - 1) * $limit));
         $friends_total = $uf->getTotalCount();
         $all = new Collection('User');
         $all->safeMerge(array($admins, $members, $friends));
         $all->select(UserSelect::base());
         $admins_export = $admins->export(User::EXPORT_MICRO, true);
         $members_export = $members->export(User::EXPORT_MICRO, true);
         $friends_export = $friends->export(User::EXPORT_MICRO, true);
         if ($all->count() > 0) {
             $iter = XDB::iterRow('SELECT  uid, comment
                                     FROM  users_comments
                                    WHERE  gid = {?} AND uid IN {?}', $group->id(), $all->ids());
             while (list($uid, $comment) = $iter->next()) {
                 if ($admins_export[$uid]) {
                     $admins_export[$uid]['comments'] = $comment;
                 }
                 if ($members_export[$uid]) {
                     $members_export[$uid]['comments'] = $comment;
                 }
                 if ($friends_export[$uid]) {
                     $friends_export[$uid]['comments'] = $comment;
                 }
             }
         }
         $users['admin'] = array('total' => $admins_total, 'users' => $admins_export);
         $users['member'] = array('total' => $members_total, 'users' => $members_export);
         $users['friend'] = array('total' => $friends_total, 'users' => $friends_export);
     }
     $page->jsonAssign('limit', $limit);
     $page->jsonAssign('users', $users);
     return PL_JSON;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:53,代码来源:groups.php


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