/**
  * 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();
 }
 /**
  * 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();
 }