Пример #1
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;
     }
 }