Inheritance: extends Form
 /**
  * Save a query
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function updateQuery($args, $request)
 {
     $query = $this->getQuery();
     if (!$this->getAccessHelper()->getCanEdit($query->getId())) {
         return new JSONMessage(false);
     }
     import('lib.pkp.controllers.grid.queries.form.QueryForm');
     $queryForm = new QueryForm($request, $this->getAssocType(), $this->getAssocId(), $this->getStageId(), $query->getId());
     $queryForm->readInputData();
     if ($queryForm->validate()) {
         $queryForm->execute($request);
         return DAO::getDataChangedEvent($query->getId());
     }
     return new JSONMessage(true, $queryForm->fetch($request, array_merge($this->getRequestArgs(), array('queryId' => $query->getId()))));
 }
Esempio n. 2
0
 /**
  * Save a query
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function updateQuery($args, $request)
 {
     $query = $this->getQuery();
     if (!$this->getAccessHelper()->getCanEdit($query->getId())) {
         return new JSONMessage(false);
     }
     import('lib.pkp.controllers.grid.queries.form.QueryForm');
     $queryForm = new QueryForm($request, $this->getAssocType(), $this->getAssocId(), $this->getStageId(), $query->getId());
     $queryForm->readInputData();
     if ($queryForm->validate()) {
         $queryForm->execute($request);
         // Update submission notifications
         $notificationMgr = new NotificationManager();
         $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, NOTIFICATION_TYPE_AWAITING_COPYEDITS, NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER, NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS), null, ASSOC_TYPE_SUBMISSION, $this->getAssocId());
         return DAO::getDataChangedEvent($query->getId());
     }
     return new JSONMessage(true, $queryForm->fetch($request, array_merge($this->getRequestArgs(), array('queryId' => $query->getId()))));
 }
 /**
  * Save a query
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function updateQuery($args, $request)
 {
     $query = $this->getQuery();
     import('lib.pkp.controllers.grid.queries.form.QueryForm');
     $queryForm = new QueryForm($request, $this->getAssocType(), $this->getAssocId(), $this->getStageId(), $query->getId());
     $queryForm->readInputData();
     if ($queryForm->validate()) {
         $queryForm->execute($request);
         if (!isset($query)) {
             // New added query action notification content.
             $notificationContent = __('notification.addedQuery');
         } else {
             // Query edit action notification content.
             $notificationContent = __('notification.editedQuery');
         }
         // Create trivial notification.
         $currentUser = $request->getUser();
         $notificationMgr = new NotificationManager();
         $notificationMgr->createTrivialNotification($currentUser->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => $notificationContent));
         // Render the row into a JSON response
         return DAO::getDataChangedEvent($query->getId());
     } else {
         return new JSONMessage(true, $queryForm->fetch($request, array_merge($this->getRequestArgs(), array('queryId' => $query->getId()))));
     }
 }