Пример #1
0
 public function index()
 {
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         $view = $this->getView();
         $model = $this->getModel();
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         } else {
             $view->setArg("searchFriendsList", NULL);
         }
         $userLogged = SessionUtils::getUserLogged();
         $userProfile = SessionUtils::getDashboardId() !== $userLogged->getUserId() ? SessionUtils::getDashboardId() : $userLogged->getUserId();
         $friendList = $model->getUserFriendsList($userProfile);
         $view->setArg('friendsList', $friendList);
         SessionUtils::setLastPageVisited(FRIENDS_CONTROLLER);
         $view->setArg(LAST_NAV_ITEM_SELECTED, 6);
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #2
0
 public function index($userId = NULL, $responseDTO = NULL)
 {
     try {
         $this->getNotifications();
         $view = $this->getView();
         $model = $this->getModel();
         SessionUtils::setDashboardId($userId);
         $this->getNotifications();
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         }
         $userList = $model->getUserList();
         $view->setArg('userList', $userList);
         SessionUtils::setLastPageVisited(USERLIST_CONTROLLER);
         SessionUtils::setNavigationSelectedItem(6);
         $view->loadPage();
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #3
0
 public function index()
 {
     //            $responseDTO = NULL) {
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         $view = $this->getView();
         $model = $this->getModel();
         $view->setArg(LAST_NAV_ITEM_SELECTED, 3);
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         }
         $userInfo = $model->getUserInfoModel(SessionUtils::getDashboardId());
         $view->setArg('userInfo', $userInfo);
         SessionUtils::setLastPageVisited(PROFILE_SETTINGS_CONTROLLER);
         $view->loadPage();
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #4
0
 function index()
 {
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         $userLogged = SessionUtils::getUserLogged();
         $view = $this->getView();
         $model = $this->getModel();
         $view->setArg(LAST_NAV_ITEM_SELECTED, 4);
         $view->setArg('userCanWrite', SessionUtils::userCanWrite());
         SessionUtils::setLastPageVisited(PROFILE_CONTROLLER);
         //            $view->uploadJS();
         if (SessionUtils::isAdmin()) {
             $this->loadProfile($view, $model);
         } else {
             if (!$view->getArg('userCanWrite')) {
                 $friendDao = new FriendsDAO();
                 $isFriendshipLoading = $friendDao->checkFriendship($userLogged->getUserId(), SessionUtils::getDashboardId());
                 if ($isFriendshipLoading === false) {
                     $view->setArg('friendship_loading', false);
                     $view->loadPage('ProfileNotVisible');
                 } else {
                     if (substr($isFriendshipLoading[0][FRIENDSSINCE], 0, 4) === "0000") {
                         $view->setArg('friendship_loading', true);
                         $view->loadPage('ProfileNotVisible');
                     } else {
                         $this->loadProfile($view, $model);
                     }
                 }
             } else {
                 $this->loadProfile($view, $model);
             }
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #5
0
 function index()
 {
     //$albumId=NULL,$photoId=NULL, $responseDTO = NULL
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         $view = $this->getView();
         $model = $this->getModel();
         $view->setArg(LAST_NAV_ITEM_SELECTED, 5);
         $view->uploadJS();
         SessionUtils::setLastPageVisited(PHOTO_CONTROLLER);
         $view->setArg('userCanWrite', SessionUtils::userCanWrite());
         $albumPhotoListDTO = $model->getAlbumPhotoListModel(SessionUtils::getAlbumId());
         $view->setArg('albumPhotoList', $albumPhotoListDTO);
         if (!is_null(SessionUtils::getPhotoId()) && !is_null(SessionUtils::getAlbumId())) {
             SessionUtils::setPhotoId(NULL);
             SessionUtils::setAlbumId(NULL);
         } else {
             if (!is_null(SessionUtils::getAlbumId())) {
                 if (!is_null(SessionUtils::getError())) {
                     $view->setResponse(SessionUtils::getError());
                     SessionUtils::setError(NULL);
                 }
                 //                    if (!$view->getArg('userCanWrite')) {
                 SessionUtils::setAlbumId(NULL);
                 //                    }
             }
         }
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #6
0
 function index()
 {
     try {
         $this->getNotifications();
         $userLogged = SessionUtils::getUserLogged();
         $view = $this->getView();
         $model = $this->getModel();
         SessionUtils::setDashboardId($userLogged->getUserId());
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         }
         SessionUtils::setLastPageVisited(HOME_CONTROLLER);
         $homePostList = $model->getHomePostsListModel($userLogged->getUserId());
         $view->setArg('homePostList', $homePostList);
         if (!is_null($homePostList)) {
             for ($i = 0; $i < sizeof($homePostList); $i++) {
                 $index = 'post' . $i;
                 $postId = $homePostList[$index]->getPostId();
                 $commentPostList = $model->getCommentPostList($postId);
                 $commentListIndex = 'commentPostList' . $postId;
                 $view->setArg($commentListIndex, $commentPostList);
             }
         }
         $userInfo = $model->getUserInfoModel(SessionUtils::getDashboardId());
         $view->setArg('userInfo', $userInfo);
         $view->setArg(LAST_NAV_ITEM_SELECTED, 0);
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #7
0
 function index()
 {
     try {
         $this->getNotifications();
         $this->setAllNotificationsAsRead();
         $view = $this->getView();
         $model = $this->getModel();
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         }
         $userNotificationList = $model->getUserNotification();
         $view->setArg('userNotificationList', $userNotificationList);
         SessionUtils::setLastPageVisited(NOTIFICATION_CONTROLLER);
         $view->setArg(LAST_NAV_ITEM_SELECTED, 2);
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #8
0
 public function index()
 {
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         SessionUtils::setLastPageVisited(ALBUM_CONTROLLER);
         $view = $this->getView();
         $model = $this->getModel();
         $view->uploadJS();
         $view->setArg('userCanWrite', SessionUtils::userCanWrite());
         $view->setArg('albumOwnerId', SessionUtils::getDashboardId());
         if (!is_null(SessionUtils::getAlbumId())) {
             $albumDTO = $model->getAlbumModel(SessionUtils::getAlbumId());
             $view->setArg("notificationAlbum", $albumDTO);
             SessionUtils::setAlbumId(NULL);
         } else {
             $userAlbums = $model->getUserAlbumsModel(SessionUtils::getDashboardId());
             $view->setArg('userAlbumList', $userAlbums);
             if (!is_null(SessionUtils::getError())) {
                 $view->setResponse(SessionUtils::getError());
                 $view->setFormData(SessionUtils::getFormValue(), ADD_ALBUM_FORM);
                 SessionUtils::setError(NULL);
                 SessionUtils::setFormValue(NULL);
             }
         }
         $view->setArg(LAST_NAV_ITEM_SELECTED, 5);
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }