public function setAllNotificationsAsRead() { $userLogged = SessionUtils::getUserLogged(); if (SessionUtils::isAdmin()) { $query = "UPDATE sat_notify SET is_read = '1' WHERE subject_id = " . $userLogged->getUserId() . " AND context <> '" . REGISTRATION_FORM . "'"; } else { $query = "UPDATE sat_notify SET is_read = '1' WHERE subject_id = " . $userLogged->getUserId() . " AND context <> 'add_friend_' "; } try { $objectArray = $this->getDB()->execQuery($query, false); return $objectArray; } catch (PDOException $pdoe) { throw $pdoe; } catch (Exception $e) { throw $e; } }
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; } }
public function getFriendsList($userProfile) { if (!SessionUtils::isAdmin()) { $query = "select ut.*, pt.*, tmp.FRIENDSSINCE \n from sat_user ut, sat_photo pt, ( \n select FRIENDID as USERID,FRIENDSSINCE \n from sat_user_friends \n where USERID = {$userProfile} \n UNION \n select USERID, FRIENDSSINCE \n from sat_user_friends \n where FRIENDID = {$userProfile} \n ) tmp \n where ut.profilephoto = pt.photoid and tmp.USERID = ut.USERID"; } else { $query = "select distinct ut.*, pt.*, NULL AS FRIENDSSINCE from sat_user ut, sat_photo pt where ut.role <> 'ADMIN' and ut.profilephoto = pt.photoid "; } try { $this->userAutentication(); $objectArray = $this->getDB()->execQuery($query); if (is_null($objectArray)) { return NULL; } else { $objectListDTO = DataModelUtils::getObjectList(FRIENDSDTO, $objectArray); return $objectListDTO; } } catch (PDOException $pdoe) { throw $pdoe; } catch (Exception $e) { throw $e; } }
</div> <div class="errorDiv" id="add_photo_<?php echo $photoId; ?> _response" > <?php echo $this->getArg("add_photo_" . $photoId . "_response"); ?> </div> </div> </div> <?php } } else { if ($this->getArg('userCanWrite') && !SessionUtils::isAdmin()) { ?> <div id="no_photo" class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> Non è presente nessuna foto. aggiungila! </div> <?php } } ?> </div> </div> </div>
echo $commentText; ?> "</label> <div class="errorDiv" id ="delete_comment_<?php echo $commentId; ?> _response"> <?php echo $this->getArg("delete_comment_. {$commentId}._response"); ?> </div> </div> <div class="col-xs-12 col-sm-12 col-md-2 col-lg-2"> <?php if (SessionUtils::canDeletePost($userLogged->getUserId(), $authorId) || SessionUtils::canDeletePost($userLogged->getUserId(), $dashboardId) || SessionUtils::isAdmin()) { ?> <form id="deleteCommentForm<?php echo $commentId; ?> " name="deleteCommentForm<?php echo $commentId; ?> " action="deleteComment/<?php echo $commentId; ?> " method = "post" novalidate> <label for="delete_comment_<?php echo $commentId; ?> _submit" class="btn btn-danger btn-block glyphicon glyphicon-remove">
<img src="<?php echo URL . $friendProfilePhotoUrl; ?> " class="img-responsive friendPhoto photoImageSize" alt=""/> </div> <div id="friend<?php echo $friendId; ?> Action"> <?php if (!SessionUtils::isAdmin()) { ?> <?php if (is_null($friendsSince)) { ?> <form id="addFriendForm<?php echo $friendId; ?> " name="addFriendForm<?php echo $friendId; ?> " action="addFriend/<?php echo $friendId; ?> " method = "POST">
public static function canDeletePost($autorId, $dashboardid) { return $dashboardid == $autorId || SessionUtils::isAdmin(); }
<?php if (!(SessionUtils::isAdmin() && is_null(SessionUtils::getDashboardId()))) { ?> <div class="thumbnail"> <nav class="navbar"> <ul id="commonNavBarItem" class="nav nav-pills nav-stacked "> <?php $lastNavbarItemSelected = $this->getArg(LAST_NAV_ITEM_SELECTED); if ($lastNavbarItemSelected == 4) { ?> <li class="active"> <a href="<?php echo URL . PROFILE_CONTROLLER; ?> "> <span class="glyphicon glyphicon-send"></span> <span class="lateralNavBarItemName">Profile</span> </a> </li> <li> <a href="<?php echo URL . ALBUM_CONTROLLER; ?> "> <span class="glyphicon glyphicon-plane"></span> <span class="lateralNavBarItemName">Album</span> </a> </li>