Inheritance: extends PKPStageParticipantNotifyForm
 /**
  * Fetches an email template's message body and returns it via AJAX.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function fetchTemplateBody($args, $request)
 {
     $templateId = $request->getUserVar('template');
     import('lib.pkp.classes.mail.SubmissionMailTemplate');
     $template = new SubmissionMailTemplate($this->getSubmission(), $templateId);
     if ($template) {
         $user = $request->getUser();
         $dispatcher = $request->getDispatcher();
         $context = $request->getContext();
         $template->assignParams(array('editorialContactSignature' => $user->getContactSignature(), 'signatureFullName' => $user->getFullname()));
         $template->replaceParams();
         import('controllers.grid.users.stageParticipant.form.StageParticipantNotifyForm');
         // exists in each app.
         $notifyForm = new StageParticipantNotifyForm($this->getSubmission()->getId(), ASSOC_TYPE_SUBMISSION, $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE));
         return new JSONMessage(true, array('body' => $template->getBody(), 'variables' => $notifyForm->getEmailVariableNames($templateId)));
     }
 }
 /**
  * @see Form::execute()
  * @param $request PKPRequest
  * @return array ($userGroupId, $userId)
  */
 function execute($request)
 {
     $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
     /* @var $stageAssignmentDao StageAssignmentDAO */
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     /* @var $userGroupDao UserGroupDAO */
     $submission = $this->getSubmission();
     $userGroupId = (int) $this->getData('userGroupId');
     $userId = (int) $this->getData('userId');
     // sanity check
     if ($userGroupDao->userGroupAssignedToStage($userGroupId, $this->getStageId())) {
         // insert the assignment
         $stageAssignment = $stageAssignmentDao->build($submission->getId(), $userGroupId, $userId);
     }
     parent::execute($request);
     return array($userGroupId, $userId, $stageAssignment->getId());
 }
 /**
  * Send a notification from the notify tab.
  * @param $args array
  * @param $request PKPRequest
  */
 function sendNotification($args, $request)
 {
     $this->setupTemplate($request);
     import('controllers.grid.users.stageParticipant.form.StageParticipantNotifyForm');
     // exists in each app.
     $notifyForm = new StageParticipantNotifyForm($this->getSubmission()->getId(), ASSOC_TYPE_SUBMISSION, $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE));
     $notifyForm->readInputData($request);
     if ($notifyForm->validate()) {
         $noteId = $notifyForm->execute($request);
         // Return a JSON string indicating success
         // (will clear the form on return)
         $json = new JSONMessage(true);
         $this->_logEventAndCreateNotification($request);
     } else {
         // Return a JSON string indicating failure
         $json = new JSONMessage(false);
     }
     return $json->getString();
 }