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


PHP Pw::collectByKey方法代码示例

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


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

示例1: check

 public function check($permission)
 {
     if (!isset($permission['move']) || !$permission['move']) {
         return false;
     }
     if (!$this->srv->user->comparePermission(Pw::collectByKey($this->srv->data, 'created_userid'))) {
         return new PwError('permission.level.move', array('{grouptitle}' => $this->srv->user->getGroupInfo('name')));
     }
     if (isset($this->fid)) {
         Wind::import('SRV:forum.bo.PwForumBo');
         $this->forum = new PwForumBo($this->fid);
         if (!$this->forum->isForum()) {
             return new PwError('BBS:manage.error.move.targetforum');
         }
         if ($this->topictype && !$this->forum->forumset['topic_type']) {
             return new PwError('BBS:post.topictype.closed');
         }
         if ($this->forum->forumset['topic_type'] && $this->forum->forumset['force_topic_type'] && !$this->topictype) {
             $topicTypes = Wekit::load('SRV:forum.PwTopicType')->getTypesByFid($this->forum->fid);
             if ($topicTypes) {
                 return new PwError('BBS:post.topictype.empty');
             }
         }
     }
     return true;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:26,代码来源:PwThreadManageDoMove.php

示例2: check

 public function check($permission)
 {
     if (!isset($permission['lock']) || !$permission['lock']) {
         return false;
     }
     if (!$this->srv->user->comparePermission(Pw::collectByKey($this->srv->data, 'created_userid'))) {
         return new PwError('permission.level.lock', array('{grouptitle}' => $this->srv->user->getGroupInfo('name')));
     }
     return true;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:10,代码来源:PwThreadManageDoLock.php

示例3: check

 public function check($permission)
 {
     if (!isset($permission['topped']) || !$permission['topped']) {
         return false;
     }
     if (array_diff(Pw::collectByKey($this->srv->data, 'topped'), array('0'))) {
         $log = Wekit::load('log.PwLog')->fetchLogByTid(array_keys($this->srv->data), array('19', '20', '21'));
         if (!$this->srv->user->comparePermission(Pw::collectByKey($log, 'created_userid'))) {
             return new PwError('permission.level.topped', array('{grouptitle}' => $this->srv->user->getGroupInfo('name')));
         }
     }
     if ($this->topped) {
         if ($this->topped > $permission['topped_type']) {
             return new PwError('BBS:manage.error.topped.permission.' . $this->topped);
         }
     }
     return true;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:18,代码来源:PwThreadManageDoTopped.php

示例4: displayReplylist

 public function displayReplylist($replies, $contentLength = 140)
 {
     $users = Wekit::load('user.PwUser')->fetchUserByUid(array_unique(Pw::collectByKey($replies, 'created_userid')));
     foreach ($replies as $key => $value) {
         $value['content'] = WindSecurity::escapeHTML($value['content']);
         if (!empty($value['ifshield'])) {
             $value['content'] = '<div class="shield">此帖已被屏蔽</div>';
         } elseif ($users[$value['created_userid']]['groupid'] == '6') {
             $value['content'] = '用户被禁言,该主题自动屏蔽!';
         } elseif ($value['useubb']) {
             $ubb = new PwUbbCodeConvertThread();
             $value['reminds'] && $ubb->setRemindUser($value['reminds']);
             $value['content'] = PwSimpleUbbCode::convert($value['content'], $contentLength, $ubb);
         } else {
             $value['content'] = Pw::substrs($value['content'], $contentLength);
         }
         !$value['word_version'] && ($value['content'] = Wekit::load('SRV:word.srv.PwWordFilter')->replaceWord($value['content'], $value['word_version']));
         $replies[$key] = $value;
     }
     return $replies;
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:21,代码来源:PwThreadService.php

示例5: _getAutoData

 private function _getAutoData($param)
 {
     $model = $this->bo->getModel();
     if (!$model) {
         return false;
     }
     $cls = sprintf('PwDesign%sDataService', ucwords($model));
     $service = Wekit::load('design.srv.model.' . $model . '.' . $cls);
     $service->setModuleBo($this->bo);
     $PwDesignShield = Wekit::load('design.PwDesignShield');
     $limit = $param['limit'];
     $start = $param['start'];
     $times = 20;
     do {
         $data = $service->buildAutoData($param, $param['order'], $limit, $start);
         $count = count($data);
         if ($count < 1) {
             break;
         }
         $shield_num = 0;
         $fromids = Pw::collectByKey($data, 'standard_fromid');
         $shields = $PwDesignShield->fetchByFromidsAndApp($fromids, $model);
         $shieldids = $shields ? Pw::collectByKey($shields, 'from_id') : array();
         foreach ($data as $k => $v) {
             if (in_array($v['standard_fromid'], $shieldids) || $v['standard_title'] === '') {
                 $shield_num++;
                 continue;
             } else {
                 $v['from_type'] = 'auto';
                 $v['data_type'] = 1;
                 $this->_newAutoIds[$v['standard_fromid']] = $v;
             }
         }
         $start += $limit;
         if ($count < $limit) {
             break;
         }
         $limit = $shield_num;
     } while (--$times > 0 && $limit > 0);
     return true;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:41,代码来源:PwAutoData.php

示例6: fetchByPage

 /**
  * 获取用户权限列表
  *
  * @param int $page
  * @param int $perpage
  * @return array|PwError
  */
 public function fetchByPage($page, $perpage)
 {
     list($count, $list, $page) = $this->_loadAuthService()->findByPage($page, $perpage);
     $uids = Pw::collectByKey($list, 'uid');
     $users = $this->getAdminUserService()->getUserByUids($uids);
     foreach ($list as $key => $value) {
         if (isset($users[$value['uid']])) {
             $value['username'] = $users[$value['uid']]['username'];
         }
         $list[$key] = $value;
     }
     return array($count, $list, $page);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:20,代码来源:AdminAuthService.php

示例7: initData

 public function initData($threaddb)
 {
     $tids = Pw::collectByKey($threaddb, 'tid');
     $this->_data = Wekit::load('forum.PwThread')->fetchHit($tids);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:5,代码来源:PwThreadListDoHits.php

示例8: getChildForumByFid

 /**
  * 根据版块id获取子版块
  * 
  * @param int $fid
  * @return array
  */
 public function getChildForumByFid($fid)
 {
     $fid = intval($fid);
     if ($fid < 1) {
         return $this->buildResponse(FORUM_INVALID_PARAMS);
     }
     $forumService = $this->_getFroumService();
     $map = $forumService->getForumMap();
     $forumList = $forumService->getForumsByLevel($fid, $map);
     if ($forumList instanceof PwError) {
         return $this->buildResponse(-1, $forumList->getError());
     }
     $forums = $subForums = $secondSubForums = array();
     $count = 0;
     $fids = Pw::collectByKey($forumList, 'fid');
     $domains = $this->_getDomainDs()->fetchByTypeAndId('forum', $fids);
     foreach ($forumList as $v) {
         $v['domain'] = '';
         if (isset($domains[$v['fid']])) {
             $v['domain'] = $domains[$v['fid']]['domain'];
         }
         $statistics = $this->_getPwForum()->getForum($v['fid'], PwForum::FETCH_STATISTICS);
         if ($v['type'] == 'forum') {
             //TODO 用户版块访问权限
             $forums[$v['fid']] = array('fid' => $v['fid'], 'forumname' => strip_tags($v['name']), 'type' => $v['type'], 'todaypost' => $statistics['todayposts'], 'domain' => $v['domain']);
         } elseif ($v['type'] == 'sub') {
             $subForums[$v['parentid']][$v['fid']] = array('fid' => $v['fid'], 'forumname' => strip_tags($v['name']), 'type' => $v['type'], 'todaypost' => $statistics['todayposts'], 'domain' => $v['domain']);
         } elseif ($v['type'] == 'sub2') {
             $secondSubForums[$v['parentid']][$v['fid']] = array('fid' => $v['fid'], 'forumname' => strip_tags($v['name']), 'type' => $v['type'], 'todaypost' => $statistics['todayposts'], 'domain' => $v['domain']);
         }
         $count++;
     }
     $result = array();
     foreach ($forums as $k => $v) {
         $v['child'] = isset($subForums[$k]) ? $this->_fetchSubForum($subForums[$k], $secondSubForums) : array();
         $result[] = $v;
     }
     return $this->buildResponse(0, array('count' => $count, 'forums' => $result));
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:45,代码来源:ACloudVerCustomizedForum.php

示例9: comparePermission

 /**
  * 与指定用户比较权限等级
  *
  * @param array $uids 用户id序列
  * @return bool
  */
 public function comparePermission($uids)
 {
     is_array($uids) || ($uids = array($uids));
     $level = $this->getPermission('manage_level');
     $users = $this->_getUserDs()->fetchUserByUid($uids);
     if ($gids = array_diff(Pw::collectByKey($users, 'groupid'), array('0'))) {
         $array = $this->_getPermissionDs()->getPermissionByRkeyAndGids('manage_level', $gids);
         foreach ($array as $key => $value) {
             if ($value['rvalue'] && $level < $value['rvalue']) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:21,代码来源:PwUserBo.php


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