예제 #1
0
 /**
  * Save changes to a review form.
  */
 function updateReviewForm()
 {
     $this->validate();
     $reviewFormId = Request::getUserVar('reviewFormId') === null ? null : (int) Request::getUserVar('reviewFormId');
     $journal =& Request::getJournal();
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_JOURNAL, $journal->getId());
     if ($reviewFormId != null && (!isset($reviewForm) || $reviewForm->getCompleteCount() != 0 || $reviewForm->getIncompleteCount() != 0)) {
         Request::redirect(null, null, 'reviewForms');
     }
     $this->setupTemplate(true, $reviewForm);
     import('classes.manager.form.ReviewFormForm');
     $reviewFormForm = new ReviewFormForm($reviewFormId);
     $reviewFormForm->readInputData();
     if ($reviewFormForm->validate()) {
         $reviewFormForm->execute();
         Request::redirect(null, null, 'reviewForms');
     } else {
         $templateMgr =& TemplateManager::getManager();
         if ($reviewFormId == null) {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.create');
         } else {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.edit');
         }
         $reviewFormForm->display();
     }
 }
 /**
  * Update an existing review form.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON message
  */
 function updateReviewForm($args, $request)
 {
     // Identify the review form Id.
     $reviewFormId = (int) $request->getUserVar('reviewFormId');
     // Identify the context id.
     $context = $request->getContext();
     // Get review form object
     $reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm = $reviewFormDao->getById($reviewFormId, Application::getContextAssocType(), $context->getId());
     // Form handling.
     $reviewFormForm = new ReviewFormForm(!isset($reviewFormId) || empty($reviewFormId) ? null : $reviewFormId);
     $reviewFormForm->readInputData();
     if ($reviewFormForm->validate()) {
         $reviewFormForm->execute($request);
         // Create the notification.
         $notificationMgr = new NotificationManager();
         $user = $request->getUser();
         $notificationMgr->createTrivialNotification($user->getId());
         return DAO::getDataChangedEvent($reviewFormId);
     }
     return new JSONMessage(false);
 }
예제 #3
0
 /**
  * Save changes to a review form.
  */
 function updateReviewForm()
 {
     $this->validate();
     $this->setupTemplate(true, $reviewForm);
     $reviewFormId = Request::getUserVar('reviewFormId') === null ? null : (int) Request::getUserVar('reviewFormId');
     $conference =& Request::getConference();
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_CONFERENCE, $conference->getId());
     //if ($reviewFormId != null && (!isset($reviewForm) || $reviewForm->getIncompleteCount() != 0)) {
     if ($reviewFormId != null && !isset($reviewForm)) {
         $source = Request::getUserVar('source');
         if (!isset($source)) {
             Request::redirect(null, null, null, 'reviewForms');
         } else {
             $source = $source . '/' . $reviewFormId;
             PKPRequest::_checkThis()->url($source);
         }
     }
     import('manager.form.ReviewFormForm');
     $reviewFormForm = new ReviewFormForm($reviewFormId);
     $reviewFormForm->readInputData();
     if ($reviewFormForm->validate()) {
         $reviewFormId = $reviewFormForm->execute();
         //Request::redirect(null, null, null, 'reviewForms');
         $source = Request::getUserVar('source');
         if (!isset($source)) {
             Request::redirect(null, null, null, 'reviewForms');
         } else {
             $source = $source . '/' . $reviewFormId;
             header("Location: " . $source);
         }
     } else {
         $templateMgr =& TemplateManager::getManager();
         if ($reviewFormId == null) {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.create');
         } else {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.edit');
         }
         $reviewFormForm->display();
     }
 }
예제 #4
0
 /**
  * Save changes to a review form.
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function updateReviewForm($args, &$request)
 {
     $reviewFormId = Request::getUserVar('reviewFormId') === null ? null : (int) Request::getUserVar('reviewFormId');
     if ($reviewFormId === null) {
         $reviewForm = null;
     } else {
         $router =& $request->getRouter();
         $context =& $router->getContext($request);
         $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
         $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_PRESS, $context->getId());
     }
     $press =& Request::getPress();
     import('controllers.grid.settings.reviewForm.form.ReviewFormForm');
     $reviewFormForm = new ReviewFormForm($reviewFormId);
     $reviewFormForm->readInputData();
     if ($reviewFormForm->validate()) {
         $reviewFormForm->execute();
         $row =& $this->getRowInstance();
         $row->setGridId($this->getId());
         $row->setId($reviewFormForm->reviewForm->getId());
         $row->setData($reviewFormForm->reviewForm);
         $row->initialize($request);
         $json = new JSON(true, $this->_renderRowInternally($request, row));
     } else {
         $json = new JSON(false);
         $templateMgr =& TemplateManager::getManager();
         if ($reviewFormId == null) {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.create');
         } else {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.edit');
         }
         $reviewFormForm->display();
     }
     return $json->getString();
 }
예제 #5
0
 /**
  * Save changes to a review form.
  */
 function updateReviewForm($args, &$request)
 {
     $this->validate();
     $this->setupTemplate($request, true, $reviewForm);
     $reviewFormId = $request->getUserVar('reviewFormId') === null ? null : (int) $request->getUserVar('reviewFormId');
     $conference =& $request->getConference();
     $reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_CONFERENCE, $conference->getId());
     $completeCounts = $reviewFormDao->getUseCounts(ASSOC_TYPE_CONFERENCE, $conference->getId(), true);
     $incompleteCounts = $reviewFormDao->getUseCounts(ASSOC_TYPE_CONFERENCE, $conference->getId(), false);
     if ($reviewFormId != null && (!isset($reviewForm) || $completeCounts[$reviewFormId] != 0 || $incompleteCounts[$reviewFormId] != 0)) {
         $request->redirect(null, null, null, 'reviewForms');
     }
     import('classes.manager.form.ReviewFormForm');
     $reviewFormForm = new ReviewFormForm($reviewFormId);
     $reviewFormForm->readInputData();
     if ($reviewFormForm->validate()) {
         $reviewFormForm->execute();
         $request->redirect(null, null, null, 'reviewForms');
     } else {
         $templateMgr =& TemplateManager::getManager($request);
         if ($reviewFormId == null) {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.create');
         } else {
             $templateMgr->assign('pageTitle', 'manager.reviewForms.edit');
         }
         $reviewFormForm->display();
     }
 }