Example #1
0
 function createComment($post_id, $owner_id)
 {
     // owner_id owner of post
     $model = new Comment_Model();
     $x = $model->createComment(Session::get('id'), $post_id, $_POST['comment_text']);
     if ($x == true) {
         $contNot = new Notification();
         $contNot->createNotification($owner_id, Session::get('id'), $post_id, "comment");
         echo 'Comment successfuly created';
         header("Location:" . URL . "/post/newsfeed");
     } else {
         echo 'error';
     }
     exit;
 }
Example #2
0
 function createLike($post_id, $owner_id)
 {
     //owner_id => owner of the post
     $model = new Like_Model();
     $contNot = new Notification();
     $contNot->createNotification($owner_id, Session::get('id'), $post_id, "like");
     $x = $model->createLike(Session::get('id'), $post_id);
     if ($x == true) {
         echo 'Like successfuly created';
         header("Location:" . URL . "/post/newsfeed");
     } else {
         echo 'error';
     }
     exit;
 }
Example #3
0
 /**
  * Save review form response.
  * @param $reviewId int
  * @param $reviewFormId int
  */
 function saveReviewFormResponse($reviewId, $reviewFormId)
 {
     if (!HookRegistry::call('ReviewerAction::saveReviewFormResponse', array($reviewId, $reviewFormId))) {
         import('submission.form.ReviewFormResponseForm');
         $reviewForm = new ReviewFormResponseForm($reviewId, $reviewFormId);
         $reviewForm->readInputData();
         if ($reviewForm->validate()) {
             $reviewForm->execute();
             // Send a notification to associated users
             import('notification.Notification');
             $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
             $reviewAssignment = $reviewAssignmentDao->getReviewAssignmentById($reviewId);
             $paperId = $reviewAssignment->getPaperId();
             $paperDao =& DAORegistry::getDAO('PaperDAO');
             $paper =& $paperDao->getPaper($paperId);
             $notificationUsers = $paper->getAssociatedUserIds();
             foreach ($notificationUsers as $userRole) {
                 $url = Request::url(null, null, $userRole['role'], 'submissionReview', $paper->getId(), null, 'peerReview');
                 Notification::createNotification($userRole['id'], "notification.type.reviewerFormComment", $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT);
             }
         } else {
             $reviewForm->display();
             return false;
         }
         return true;
     }
 }
Example #4
0
 function add($args)
 {
     $paperId = isset($args[0]) ? (int) $args[0] : 0;
     $galleyId = isset($args[1]) ? (int) $args[1] : 0;
     $parentId = isset($args[2]) ? (int) $args[2] : 0;
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $this->validate($paperId);
     $paper =& $this->paper;
     $parent =& $commentDao->getComment($parentId, $paperId);
     if (isset($parent) && $parent->getPaperId() != $paperId) {
         Request::redirect(null, null, null, 'view', array($paperId, $galleyId));
     }
     $this->setupTemplate($paper, $galleyId, $parent);
     // Bring in comment constants
     $commentDao =& DAORegistry::getDAO('CommentDAO');
     $enableComments = $conference->getSetting('enableComments');
     $commentsRequireRegistration = $conference->getSetting('commentsRequireRegistration');
     $commentsAllowAnonymous = $conference->getSetting('commentsAllowAnonymous');
     $closeCommentsDate = $schedConf->getSetting('closeCommentsDate');
     $commentsClosed = $schedConf->getSetting('closeComments') ? true : false && strtotime($closeCommentsDate < time());
     $enableComments = $enableComments && !$commentsClosed && $paper->getEnableComments();
     if (!$enableComments) {
         Request::redirect(null, null, 'index');
     }
     if ($commentsRequireRegistration && !Request::getUser()) {
         Validation::redirectLogin();
     }
     import('comment.form.CommentForm');
     $commentForm = new CommentForm(null, $paperId, $galleyId, isset($parent) ? $parentId : null);
     $commentForm->initData();
     if (isset($args[3]) && $args[3] == 'save') {
         $commentForm->readInputData();
         if ($commentForm->validate()) {
             $commentForm->execute();
             // Send a notification to associated users
             import('notification.Notification');
             $paperDAO =& DAORegistry::getDAO('PaperDAO');
             $paper =& $paperDAO->getPaper($paperId);
             $notificationUsers = $paper->getAssociatedUserIds();
             foreach ($notificationUsers as $userRole) {
                 $url = Request::url(null, null, null, 'view', array($paperId, $galleyId, $parentId));
                 Notification::createNotification($userRole['id'], "notification.type.userComment", $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_USER_COMMENT);
             }
             Request::redirect(null, null, null, 'view', array($paperId, $galleyId, $parentId), array('refresh' => 1));
         }
     }
     $commentForm->display();
 }
 /**
  * Save changes to a galley.
  * @param $args array ($paperId, $galleyId)
  */
 function saveGalley($args)
 {
     $paperId = (int) array_shift($args);
     $galleyId = (int) array_shift($args);
     $stage = (int) array_shift($args);
     $this->validate($paperId, TRACK_DIRECTOR_ACCESS_EDIT);
     $this->setupTemplate(true, $paperId, 'editing');
     $submission =& $this->submission;
     import('submission.form.PaperGalleyForm');
     $submitForm = new PaperGalleyForm($paperId, $galleyId, $stage);
     $submitForm->readInputData();
     if ($submitForm->validate()) {
         $submitForm->execute();
         // Send a notification to associated users
         import('notification.Notification');
         $paperDao =& DAORegistry::getDAO('PaperDAO');
         $paper =& $paperDao->getPaper($paperId);
         $notificationUsers = $paper->getAssociatedUserIds(true, false);
         foreach ($notificationUsers as $userRole) {
             $url = Request::url(null, null, $userRole['role'], 'submissionReview', $paper->getId(), null, 'layout');
             Notification::createNotification($userRole['id'], "notification.type.galleyModified", $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_GALLEY_MODIFIED);
         }
         if (Request::getUserVar('uploadImage')) {
             $submitForm->uploadImage();
             Request::redirect(null, null, null, 'editGalley', array($paperId, $galleyId, $stage));
         } else {
             if (($deleteImage = Request::getUserVar('deleteImage')) && count($deleteImage) == 1) {
                 list($imageId) = array_keys($deleteImage);
                 $submitForm->deleteImage($imageId);
                 Request::redirect(null, null, null, 'editGalley', array($paperId, $galleyId, $stage));
             }
         }
         Request::redirect(null, null, null, 'submissionReview', array($paperId, $stage));
     } else {
         $submitForm->display();
     }
 }
$notification = new Notification();
if (!$user->isLoggedIn()) {
    Redirect::to('index.php');
}
//check for admin
if ($user->hasPermission('admin')) {
    if (Input::exists()) {
        if (Token::check(Input::get('token'))) {
            $validate = new Validate();
            $validation = $validate->check($_POST, array('topic' => array('required' => true, 'max' => 255), 'detail' => array('required' => true)));
            if ($validation->passed()) {
                $topic = Input::get('topic');
                $detail = Input::get('detail');
                $datetime = date("d/m/y h:i:s");
                //create date time
                $notification->createNotification(array('topic' => $topic, 'detail' => $detail, 'datetime' => $datetime));
                if ($notification) {
                    //                echo "Successful";
                    Redirect::to("notif_main_forum.php");
                } else {
                    echo "ERROR";
                }
                //            echo $topic . '</ br>';
                //            echo $detail . '</ br>';
            } else {
                $errorMsg = "";
                foreach ($validation->errors() as $error) {
                    //                    echo $error , '</ br>';
                    $errorMsg .= $error;
                    $errorMsg .= "\n";
                }
Example #7
0
 /**
  * Save a submission step.
  * @param $args array first parameter is the step being saved
  */
 function saveSubmit($args)
 {
     $step = isset($args[0]) ? (int) $args[0] : 0;
     $paperId = Request::getUserVar('paperId');
     $this->validate($paperId, $step);
     $this->setupTemplate(true);
     $paper =& $this->paper;
     $formClass = "AuthorSubmitStep{$step}Form";
     import("author.form.submit.{$formClass}");
     $submitForm = new $formClass($paper);
     $submitForm->readInputData();
     if (!HookRegistry::call('SubmitHandler::saveSubmit', array($step, &$paper, &$submitForm))) {
         // Check for any special cases before trying to save
         switch ($step) {
             case 2:
                 if (Request::getUserVar('uploadSubmissionFile')) {
                     if (!$submitForm->uploadSubmissionFile('submissionFile')) {
                         $submitForm->addError('uploadSubmissionFile', Locale::translate('common.uploadFailed'));
                     }
                     $editData = true;
                 }
                 break;
             case 3:
                 if (Request::getUserVar('addAuthor')) {
                     // Add a sponsor
                     $editData = true;
                     $authors = $submitForm->getData('authors');
                     array_push($authors, array());
                     $submitForm->setData('authors', $authors);
                 } else {
                     if (($delAuthor = Request::getUserVar('delAuthor')) && count($delAuthor) == 1) {
                         // Delete an author
                         $editData = true;
                         list($delAuthor) = array_keys($delAuthor);
                         $delAuthor = (int) $delAuthor;
                         $authors = $submitForm->getData('authors');
                         if (isset($authors[$delAuthor]['authorId']) && !empty($authors[$delAuthor]['authorId'])) {
                             $deletedAuthors = explode(':', $submitForm->getData('deletedAuthors'));
                             array_push($deletedAuthors, $authors[$delAuthor]['authorId']);
                             $submitForm->setData('deletedAuthors', join(':', $deletedAuthors));
                         }
                         array_splice($authors, $delAuthor, 1);
                         $submitForm->setData('authors', $authors);
                         if ($submitForm->getData('primaryContact') == $delAuthor) {
                             $submitForm->setData('primaryContact', 0);
                         }
                     } else {
                         if (Request::getUserVar('moveAuthor')) {
                             // Move an author up/down
                             $editData = true;
                             $moveAuthorDir = Request::getUserVar('moveAuthorDir');
                             $moveAuthorDir = $moveAuthorDir == 'u' ? 'u' : 'd';
                             $moveAuthorIndex = (int) Request::getUserVar('moveAuthorIndex');
                             $authors = $submitForm->getData('authors');
                             if (!($moveAuthorDir == 'u' && $moveAuthorIndex <= 0 || $moveAuthorDir == 'd' && $moveAuthorIndex >= count($authors) - 1)) {
                                 $tmpAuthor = $authors[$moveAuthorIndex];
                                 $primaryContact = $submitForm->getData('primaryContact');
                                 if ($moveAuthorDir == 'u') {
                                     $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex - 1];
                                     $authors[$moveAuthorIndex - 1] = $tmpAuthor;
                                     if ($primaryContact == $moveAuthorIndex) {
                                         $submitForm->setData('primaryContact', $moveAuthorIndex - 1);
                                     } else {
                                         if ($primaryContact == $moveAuthorIndex - 1) {
                                             $submitForm->setData('primaryContact', $moveAuthorIndex);
                                         }
                                     }
                                 } else {
                                     $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex + 1];
                                     $authors[$moveAuthorIndex + 1] = $tmpAuthor;
                                     if ($primaryContact == $moveAuthorIndex) {
                                         $submitForm->setData('primaryContact', $moveAuthorIndex + 1);
                                     } else {
                                         if ($primaryContact == $moveAuthorIndex + 1) {
                                             $submitForm->setData('primaryContact', $moveAuthorIndex);
                                         }
                                     }
                                 }
                             }
                             $submitForm->setData('authors', $authors);
                         }
                     }
                 }
                 break;
             case 4:
                 if (Request::getUserVar('submitUploadSuppFile')) {
                     if ($suppFileId = SubmitHandler::submitUploadSuppFile()) {
                         Request::redirect(null, null, null, 'submitSuppFile', $suppFileId, array('paperId' => $paperId));
                     } else {
                         $submitForm->addError('uploadSubmissionFile', Locale::translate('common.uploadFailed'));
                     }
                 }
                 break;
         }
     }
     if (!isset($editData) && $submitForm->validate()) {
         $paperId = $submitForm->execute();
         $conference =& Request::getConference();
         $schedConf =& Request::getSchedConf();
         // For the "abstract only" or sequential review models, nothing else needs
         // to be collected beyond page 2.
         $reviewMode = $paper ? $paper->getReviewMode() : $schedConf->getSetting('reviewMode');
         if ($step == 3 && $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL && !$schedConf->getSetting('acceptSupplementaryReviewMaterials') || $step == 3 && $reviewMode == REVIEW_MODE_ABSTRACTS_ALONE && !$schedConf->getSetting('acceptSupplementaryReviewMaterials') || $step == 5) {
             // Send a notification to associated users
             import('notification.Notification');
             $roleDao =& DAORegistry::getDAO('RoleDAO');
             $notificationUsers = array();
             $conferenceManagers = $roleDao->getUsersByRoleId(ROLE_ID_CONFERENCE_MANAGER);
             $allUsers = $conferenceManagers->toArray();
             $directors = $roleDao->getUsersByRoleId(ROLE_ID_DIRECTOR);
             array_merge($allUsers, $directors->toArray());
             foreach ($allUsers as $user) {
                 $notificationUsers[] = array('id' => $user->getId());
             }
             foreach ($notificationUsers as $userRole) {
                 $url = Request::url(null, null, 'director', 'submission', $paperId);
                 Notification::createNotification($userRole['id'], "notification.type.paperSubmitted", $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_PAPER_SUBMITTED);
             }
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign_by_ref('conference', $conference);
             $templateMgr->assign('paperId', $paperId);
             $templateMgr->assign('helpTopicId', 'submission.index');
             $templateMgr->display('author/submit/complete.tpl');
         } elseif ($step == 3 && !$schedConf->getSetting('acceptSupplementaryReviewMaterials')) {
             Request::redirect(null, null, null, 'submit', 5, array('paperId' => $paperId));
         } elseif ($step == 1 && ($reviewMode == REVIEW_MODE_ABSTRACTS_ALONE || $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL)) {
             Request::redirect(null, null, null, 'submit', 3, array('paperId' => $paperId));
         } elseif ($step == 2 && $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL) {
             $nextStep = $schedConf->getSetting('acceptSupplementaryReviewMaterials') ? 4 : 5;
             Request::redirect(null, null, null, 'submit', $nextStep, array('paperId' => $paperId));
         } else {
             Request::redirect(null, null, null, 'submit', $step + 1, array('paperId' => $paperId));
         }
     } else {
         $submitForm->display();
     }
 }
Example #8
0
 /**
  * Save comment.
  * @param $commentId int
  */
 function saveComment($paper, &$comment, $emailComment)
 {
     if (!HookRegistry::call('Action::saveComment', array(&$paper, &$comment, &$emailComment))) {
         import("submission.form.comment.EditCommentForm");
         $commentForm = new EditCommentForm($paper, $comment);
         $commentForm->readInputData();
         if ($commentForm->validate()) {
             $commentForm->execute();
             // Send a notification to associated users
             import('notification.Notification');
             $notificationUsers = $paper->getAssociatedUserIds(true, false);
             foreach ($notificationUsers as $userRole) {
                 $url = Request::url(null, null, $userRole['role'], 'submissionReview', $paper->getId(), null, 'editorDecision');
                 Notification::createNotification($userRole['id'], "notification.type.submissionComment", $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_SUBMISSION_COMMENT);
             }
             if ($emailComment) {
                 $commentForm->email($commentForm->emailHelper());
             }
         } else {
             $commentForm->display();
         }
     }
 }
if (Input::exists()) {
    if (Token::check(Input::get('token'))) {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('username' => array('required' => true), 'msgID' => array('required' => true)));
        if ($validation->passed()) {
            //Redirect::to('payForOtherSuccess.php');
            ////Checking if username exists or not////
            //$userId = $user->data()->id;
            $username = Input::get('username');
            $msgCode = Input::get('msgID');
            if (!$username == null) {
                $user2 = new User();
                if ($user->find($username)) {
                    //get user id
                    $uID = $user2->data()->id;
                    $notify->createNotification(array('uID' => $uID, 'nCode' => $msgCode));
                } else {
                    //echo 'Not exists<br>';
                    echo '<script type="text/javascript">
                        alert("Username does not exists");
                    </script>';
                    //Redirect::to('payForOther.php');
                }
            }
            //echo 'checking completed<br>';
        } else {
            foreach ($validation->errors() as $error) {
                echo $error, '</ br>';
            }
        }
    }
Example #10
0
 /**
  * Save announcement. 
  */
 function execute()
 {
     parent::execute();
     $conference =& Request::getConference();
     $conferenceId = $conference->getId();
     // Send a notification to associated users
     import('notification.Notification');
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $notificationUsers = array();
     $allUsers = $roleDao->getUsersByConferenceId($conferenceId);
     while (!$allUsers->eof()) {
         $user =& $allUsers->next();
         $notificationUsers[] = array('id' => $user->getId());
         unset($user);
     }
     $schedConfId = $this->getData('schedConfId');
     if ($schedConfId == 0) {
         // Associated with the conference as a whole.
         $url = Request::url(null, 'index', 'announcement', 'view', array(1));
     } else {
         // Associated with a sched conf -- determine its path.
         $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
         $schedConf =& $schedConfDao->getSchedConf($schedConfId);
         $url = Request::url(null, $schedConf->getPath(), 'announcement', 'view', array(1));
     }
     foreach ($notificationUsers as $userRole) {
         Notification::createNotification($userRole['id'], "notification.type.newAnnouncement", null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT);
     }
     $notificationDao =& DAORegistry::getDAO('NotificationDAO');
     $notificationDao->sendToMailingList(Notification::createNotification(0, "notification.type.newAnnouncement", null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT));
 }
Example #11
0
 /**
  * Post director decision comment.
  * @param $paper int
  * @param $emailComment boolean
  */
 function postDirectorDecisionComment($paper, $emailComment)
 {
     if (HookRegistry::call('TrackDirectorAction::postDirectorDecisionComment', array(&$paper, &$emailComment))) {
         return;
     }
     import('submission.form.comment.DirectorDecisionCommentForm');
     $commentForm = new DirectorDecisionCommentForm($paper, Validation::isDirector() ? ROLE_ID_DIRECTOR : ROLE_ID_TRACK_DIRECTOR);
     $commentForm->readInputData();
     if ($commentForm->validate()) {
         $commentForm->execute();
         // Send a notification to associated users
         import('notification.Notification');
         $notificationUsers = $paper->getAssociatedUserIds(true, false);
         foreach ($notificationUsers as $userRole) {
             $url = Request::url(null, null, $userRole['role'], 'submissionReview', $paper->getId(), null, 'directorDecision');
             Notification::createNotification($userRole['id'], "notification.type.directorDecisionComment", $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT);
         }
         if ($emailComment) {
             $commentForm->email();
         }
     } else {
         $commentForm->display();
         return false;
     }
     return true;
 }