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; } }
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; } }
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; } }
public static function canDeletePhoto($autorId) { $userLogged = SessionUtils::getUserLogged(); return SessionUtils::userCanWrite() || $userLogged->getUserId() == $autorId; }
<aside class="col-sx-12 col-sm-12 col-md-2 col-md-2"> <?php require "Navigation.php"; ?> </aside> <div class="col-xs-12 col-sm-12 col-md-7 col-lg-7"> <?php $userInfo = $this->getArg('userInfo'); ?> <?php if (SessionUtils::userCanWrite()) { ?> <div class="thumbnail"> <div id="personalProfilePhotoDiv" class="row"> <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 "> <img class="img-responsive photoImageSize" alt="" id="profile_settings_profilephoto_photourl" src="<?php echo URL . $userInfo->getPersonId()->getProfilePhoto()->getPhotoUrl(); ?> "/> <div class="errorDiv" id ="profile_settings_profilephoto_response" > <?php echo $this->getArg("profile_settings_profilephoto_response"); ?> </div>