/** * Save a note. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function saveNote($args, $request) { $this->setupTemplate($request); import('lib.pkp.controllers.informationCenter.form.NewFileNoteForm'); $notesForm = new NewFileNoteForm($this->submissionFile->getFileId()); $notesForm->readInputData(); if ($notesForm->validate()) { $notesForm->execute($request); // Save to event log $this->_logEvent($request, SUBMISSION_LOG_NOTE_POSTED); $user = $request->getUser(); NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.addedNote'))); return new JSONMessage(true); } else { // Return a JSON string indicating failure return new JSONMessage(false); } }
/** * Save a note. * @param $args array * @param $request PKPRequest */ function saveNote($args, &$request) { $this->setupTemplate(); import('controllers.informationCenter.form.NewFileNoteForm'); $notesForm = new NewFileNoteForm($this->monographFile->getFileId()); $notesForm->readInputData(); if ($notesForm->validate()) { $notesForm->execute(); $json = new JSON(true); // Save to event log $this->_logEvent($request, MONOGRAPH_LOG_NOTE_POSTED); } else { // Return a JSON string indicating failure $json = new JSON(false); } return $json->getString(); }