Пример #1
0
 function loadProfile($view, $model)
 {
     try {
         if (!is_null(SessionUtils::getAuthorId()) && !is_null(SessionUtils::getPost()) && !SessionUtils::isAdmin()) {
             $postDto = $model->getPostModel(SessionUtils::getPost());
             $view->setArg("notificationPost", $postDto);
             $commentPostList = $model->getCommentPostList(SessionUtils::getPost());
             $commentListIndex = 'notificationCommentList' . SessionUtils::getPost();
             $view->setArg($commentListIndex, $commentPostList);
             SessionUtils::setPost(NULL);
             SessionUtils::setAuthorId(NULL);
         } else {
             $userAlbumListDTO = $model->getUserAlbumList(SessionUtils::getDashboardId());
             $view->setArg('userAlbumList', $userAlbumListDTO);
             $postList = $model->getPostsListModel(SessionUtils::getDashboardId());
             $view->setArg('postList', $postList);
             if (!is_null($postList)) {
                 for ($i = 0; $i < sizeof($postList); $i++) {
                     $index = 'post' . $i;
                     $postId = $postList[$index]->getPostId();
                     $commentPostList = $model->getCommentPostList($postId);
                     $commentListIndex = 'commentPostList' . $postId;
                     $view->setArg($commentListIndex, $commentPostList);
                 }
             }
             if (!is_null(SessionUtils::getError())) {
                 $view->setResponse(SessionUtils::getError());
                 if (!is_null(SessionUtils::getFormValue())) {
                     $view->setFormData(SessionUtils::getFormValue(), WRITE_POST_FORM);
                 }
                 SessionUtils::setError(NULL);
                 SessionUtils::setFormValue(NULL);
             }
         }
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }