예제 #1
0
파일: groups.php 프로젝트: vazahat/dudex
 public function userList($params)
 {
     $groupId = (int) $params['groupId'];
     $groupDto = $this->service->findGroupById($groupId);
     if ($groupDto === null) {
         throw new Redirect404Exception();
     }
     if ($groupDto->whoCanView == GROUPS_BOL_Service::WCV_INVITE && !OW::getUser()->isAuthorized('groups')) {
         if (!OW::getUser()->isAuthenticated()) {
             $this->redirect(OW::getRouter()->urlForRoute('groups-private-group', array('groupId' => $groupDto->id)));
         }
         $invite = $this->service->findInvite($groupDto->id, OW::getUser()->getId());
         $user = $this->service->findUser($groupDto->id, OW::getUser()->getId());
         if ($groupDto->whoCanView == GROUPS_BOL_Service::WCV_INVITE && $invite === null && $user === null) {
             $this->redirect(OW::getRouter()->urlForRoute('groups-private-group', array('groupId' => $groupDto->id)));
         }
     }
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $perPage = 20;
     $first = ($page - 1) * $perPage;
     $count = $perPage;
     $dtoList = $this->service->findUserList($groupId, $first, $count);
     $listCount = $this->service->findUserListCount($groupId);
     $listCmp = new GROUPS_UserList($groupDto, $dtoList, $listCount, 20);
     $this->addComponent('listCmp', $listCmp);
     $this->addComponent('groupBriefInfo', new GROUPS_CMP_BriefInfo($groupId));
 }