當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。