/** * Send the user email and close the modal * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function sendEmail($args, &$request) { // Identify the press $press =& $request->getPress(); // Identify the user Id $userId = $request->getUserVar('userId'); if ($userId !== null && !Validation::canAdminister($press->getId(), $userId)) { // We don't have administrative rights over this user. $json = new JSON('false', Locale::translate('grid.user.cannotAdminister')); } else { // Form handling import('controllers.grid.users.user.form.UserEmailForm'); $userEmailForm = new UserEmailForm($userId); $userEmailForm->readInputData(); if ($userEmailForm->validate()) { $userEmailForm->execute($args, $request); $json = new JSON('true'); } else { $json = new JSON('false', $userEmailForm->display($args, $request)); } } return $json->getString(); }
/** * Displays a modal to send an email message to the user. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function sendEmail($args, $request) { $reviewAssignment = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT); // Form handling. import('lib.pkp.controllers.grid.settings.user.form.UserEmailForm'); $userEmailForm = new UserEmailForm($reviewAssignment->getReviewerId()); $userEmailForm->initData($args, $request); return new JSONMessage(true, $userEmailForm->display($args, $request)); }
/** * Send the user email and close the modal. * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function sendEmail($args, $request) { $user = $request->getUser(); // Identify the user Id. $userId = $request->getUserVar('userId'); if ($userId !== null && !Validation::canAdminister($userId, $user->getId())) { // We don't have administrative rights over this user. $json = new JSONMessage(false, __('grid.user.cannotAdminister')); } else { // Form handling. import('lib.pkp.controllers.grid.settings.user.form.UserEmailForm'); $userEmailForm = new UserEmailForm($userId); $userEmailForm->readInputData(); if ($userEmailForm->validate()) { $userEmailForm->execute($args, $request); $json = new JSONMessage(true); } else { $json = new JSONMessage(false, $userEmailForm->display($args, $request)); } } return $json->getString(); }