예제 #1
0
파일: groups.php 프로젝트: vazahat/dudex
 public function invite()
 {
     if (!OW::getRequest()->isAjax()) {
         throw new Redirect404Exception();
     }
     $userId = OW::getUser()->getId();
     if (empty($userId)) {
         throw new AuthenticateException();
     }
     $respoce = array();
     $userIds = json_decode($_POST['userIdList']);
     $groupId = $_POST['groupId'];
     $allIdList = json_decode($_POST['allIdList']);
     $group = $this->service->findGroupById($groupId);
     $count = 0;
     foreach ($userIds as $uid) {
         $this->service->inviteUser($group->id, $uid, $userId);
         $count++;
     }
     $respoce['messageType'] = 'info';
     $respoce['message'] = OW::getLanguage()->text('groups', 'users_invite_success_message', array('count' => $count));
     $respoce['allIdList'] = array_diff($allIdList, $userIds);
     exit(json_encode($respoce));
 }