示例#1
0
 private function getFriendshipStatus()
 {
     if ($this->user['page'] === false) {
         $this->view->isFriend = application_frontend_friend_model::checkFriendship($this->user['myuid'], $this->user['uid']);
         $this->view->requestSend = application_frontend_friend_model::checkRequestSend($this->user['myuid'], $this->user['uid']);
     }
 }
示例#2
0
 private function getUserRelation($uid, $uidOfPage)
 {
     if (application_frontend_friend_model::checkFriendship($uid, $uidOfPage)) {
         $userRelation = 1;
     } elseif (application_frontend_friend_model::getAllMutualFriends($uid, $uidOfPage) !== NULL) {
         $userRelation = 2;
     } else {
         $userRelation = 3;
     }
     return $userRelation;
 }
示例#3
0
 private function getNotifications()
 {
     $this->view->notification['friendRequestCount'] = application_frontend_friend_model::getRequestCount($this->user['myuid']);
     $this->view->notification['eventInvitationCount'] = application_frontend_event_model::getInvitationCount($this->user['myuid']);
     $this->view->notification['eventCommentCount'] = application_frontend_event_model::getUnreadEventCommentCount($this->user['myuid']);
     $this->view->notification['privatemgsAllCount'] = application_frontend_privatemsg_model::getUnreadPrivatemsgCount($this->user['myuid']);
     $this->view->notification['requestEventInvitation'] = application_frontend_event_model::getRequestEventInvitationCount($this->user['myuid']);
     if ($this->view->notification['friendRequestCount'] > 0 || $this->view->notification['eventInvitationCount'] > 0 || $this->view->notification['privatemgsAllCount'] > 0 || $this->view->notification['eventCommentCount'] > 0 || $this->view->notification['requestEventInvitation'] > 0) {
         $this->view->notificationExist = true;
     }
 }
示例#4
0
 private function handleGET()
 {
     if (isset($_GET['action']) && !empty($_GET['action'])) {
         switch ($_GET['action']) {
             case 'invite':
                 $this->view->ueid = (int) $_GET['ueid'];
                 $this->friendArray = application_frontend_friend_model::getAllFriends($this->user['myuid']);
                 $this->joinedArray = $this->model->getJoinedFriends($this->view->ueid);
                 $this->invitedArray = $this->model->getInvitedFriends($this->user['myuid'], $this->view->ueid);
                 $this->friendArray = self::checkInvitedFriend($this->friendArray, $this->invitedArray, $this->joinedArray);
                 $this->view->friendInfoArray = application_frontend_friend_model::getFriendsInfo($this->friendArray);
                 return self::display('invite');
                 break;
             case 'view':
                 if (isset($_GET['confirm']) && !empty($_GET['confirm'])) {
                     $this->view->iid = (int) $_GET['confirm'];
                 }
                 if (isset($_GET['ueid']) && !empty($_GET['ueid'])) {
                     $this->view->ueid = (int) $_GET['ueid'];
                     $this->view->event = $this->model->getUserEvent($this->view->ueid);
                 } else {
                     $this->view->eid = (int) $_GET['eid'];
                     $this->view->ueid = $this->model->getUserAttendingId($this->user['myuid'], (int) $_GET['eid']);
                     if ($this->view->ueid !== NULL) {
                         $this->view->event = $this->model->getUserEvent($this->view->ueid);
                     } else {
                         $this->view->event = $this->model->getUserEventByEid((int) $_GET['eid']);
                         $this->view->ueidExist = false;
                     }
                 }
                 $this->view->attenders = $this->model->getAttenders((int) $_GET['eid']);
                 $this->view->joined = $this->model->checkEventAttendingStatus($this->user['myuid'], (int) $_GET['eid']);
                 $this->commentEvent = new application_frontend_comment_controller();
                 $this->view->commentEvent = $this->commentEvent->actionController();
                 return self::display('view');
                 break;
             case 'showInvitation':
                 $this->view->invitationList = $this->model->getInvitation($this->user['myuid']);
                 return self::display('showInvitation');
                 break;
             case 'inviteUser':
                 return self::display('inviteUser');
                 break;
             case 'viewUnreadComment':
                 $this->view->unreadComment = $this->model->getUnreadEventComment($this->user['myuid']);
                 return self::display('viewUnreadComment');
                 break;
             case 'eventInviteAutoComplete':
                 echo $this->model->getEventNameListAutoComplete($this->user['myuid'], $_GET['q']);
                 break;
             case 'create':
                 return self::display('create');
                 break;
             case 'edit':
                 $this->view->eid = (int) $_GET['eid'];
                 $this->view->event = $this->model->getEvent($this->view->eid);
                 return self::display('edit');
                 break;
             case 'delete':
                 $this->view->id = (int) $_GET['ueid'];
                 return self::display('delete');
                 break;
             case 'all':
                 $this->view->pastEventCreated = $this->model->getPastEventCreatedOfUser($this->user);
                 $this->view->futureEventCreated = $this->model->getFutureEventCreatedOfUser($this->user);
                 $this->view->pastEventAttending = $this->model->getPastEventAttendingOfUser($this->user);
                 $this->view->futureEventAttending = $this->model->getFutureEventAttendingOfUser($this->user);
                 return self::display('all');
                 break;
             case 'mutual':
                 $this->view->mutualEvents = $this->model->getMutualEvents($this->user['myuid'], $this->user['uid']);
                 return self::display('mutual');
                 break;
             case 'search':
                 return self::display('search');
                 break;
             case 'viewEventInvitationRequest':
                 $this->view->eventRequest = $this->model->getEventRequestInfo($this->user['myuid']);
                 return self::display('viewEventInvitationRequest');
             default:
                 parent::redirect('home');
         }
     }
 }
示例#5
0
 public function checkFriendEmailInvitation($uid)
 {
     if (isset($_SESSION['friendInvite']) && !empty($_SESSION['friendInvite'])) {
         $isNotFriend = application_frontend_friend_model::checkFriendship($_SESSION['friendInvite']['uid'], $uid);
         if ($isNotFriend == false && $uid != $_SESSION['friendInvite']['uid']) {
             application_frontend_friend_model::addFriend($_SESSION['friendInvite']['uid'], $uid);
             application_frontend_friend_model::addFriend($uid, $_SESSION['friendInvite']['uid']);
         }
         application_frontend_friend_model::deleteFriendInvitation($_SESSION['friendInvite']['email'], $_SESSION['friendInvite']['uid']);
         unset($_SESSION['friendInvite']);
     }
 }