/** * Save the 'add stage participant' form. * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function saveStageParticipant($args, &$request) { // Identify the submission Id $monographId = $request->getUserVar('monographId'); $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH); // Form handling import('controllers.grid.users.stageParticipant.form.StageParticipantForm'); $stageParticipantForm = new StageParticipantForm($monographId); $stageParticipantForm->readInputData(); if ($stageParticipantForm->validate()) { $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $data =& $signoffDao->getAllBySymbolic('SIGNOFF_STAGE', ASSOC_TYPE_MONOGRAPH, $monographId, null, $monograph->getCurrentStageId()); $this->setData($data); $this->initialize($request); // Pass to modal.js to reload the grid with the new content // FIXME: Calls to private methods of superclasses are not allowed! $gridBodyParts = $this->_renderGridBodyPartsInternally($request); if (count($gridBodyParts) == 0) { // The following should usually be returned from a // template also so we remain view agnostic. But as this // is easy to migrate and we want to avoid the additional // processing overhead, let's just return plain HTML. $renderedGridRows = '<tbody> </tbody>'; } else { assert(count($gridBodyParts) == 1); $renderedGridRows = $gridBodyParts[0]; } $json = new JSON('true', $renderedGridRows); } else { $json = new JSON('false', Locale::translate('editor.monograph.addUserError')); } return $json->getString(); }
/** * An action to manually add a new stage participant * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function addStageParticipant($args, &$request) { // Render the stage participant form. // FIXME: We only need a form class here to gain access to the // form vocab. Make the form vocab globally available and implement this // form as a simple template, see #6505. import('controllers.grid.users.stageParticipant.form.StageParticipantForm'); $stageParticipantForm = new StageParticipantForm($this->getMonograph(), $this->getStageId()); $json = new JSON(true, $stageParticipantForm->fetch($request)); return $json->getString(); }