/** * Save a note. * @param $args array * @param $request PKPRequest */ function saveNote($args, &$request) { $this->setupTemplate(); import('controllers.informationCenter.form.NewMonographNoteForm'); $notesForm = new NewMonographNoteForm($this->monograph->getId()); $notesForm->readInputData(); if ($notesForm->validate()) { $notesForm->execute(); $json = new JSON(true); // Save to event log $user =& $request->getUser(); $userId = $user->getId(); $this->_logEvent($request, MONOGRAPH_LOG_NOTE_POSTED); } else { // Return a JSON string indicating failure $json = new JSON(false); } return $json->getString(); }
/** * Save a note. * @param $args array * @param $request PKPRequest */ function saveNote($args, &$request) { // Fetch the monograph to display information about $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH); $this->setupTemplate(); import('controllers.informationCenter.form.NewMonographNoteForm'); $notesForm = new NewMonographNoteForm($monograph->getId()); $notesForm->readInputData(); if ($notesForm->validate()) { $notesForm->execute(); $json = new JSON('true'); // Save to event log $user =& $request->getUser(); $userId = $user->getId(); $this->_logEvent($monograph->getId(), MONOGRAPH_LOG_NOTE_POSTED, $userId); } else { // Return a JSON string indicating failure $json = new JSON('false'); } return $json->getString(); }