readInputData() 공개 메소드

Assign form data to user-submitted data.
또한 보기: Form::readInputData()
public readInputData ( )
예제 #1
0
 /**
  * Enable/Disable an existing user
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function disableUser($args, &$request)
 {
     // Identify the press
     $press =& $request->getPress();
     // Identify the user Id
     $userId = $request->getUserVar('userId');
     // Are we enabling or disabling this user
     $enable = (bool) $request->getUserVar('enable');
     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.UserDisableForm');
         $userForm = new UserDisableForm($userId, $enable);
         $userForm->readInputData();
         if ($userForm->validate()) {
             $user =& $userForm->execute($args, $request);
             // Successful enable/disable of an existing user
             // Update grid row data
             $row =& $this->getRowInstance();
             $row->setGridId($this->getId());
             $row->setId($user->getId());
             $row->setData($user);
             $row->initialize($request);
             $json = new JSON('true', $this->_renderRowInternally($request, $row));
         } else {
             $json = new JSON('false', $userForm->display($args, $request));
         }
     }
     return $json->getString();
 }
예제 #2
0
 /**
  * Enable/Disable an existing user
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function disableUser($args, $request)
 {
     $user = $request->getUser();
     // Identify the user Id.
     $userId = $request->getUserVar('userId');
     // Are we enabling or disabling this user.
     $enable = (bool) $request->getUserVar('enable');
     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.UserDisableForm');
         $userForm = new UserDisableForm($userId, $enable);
         $userForm->readInputData();
         if ($userForm->validate()) {
             $user = $userForm->execute($args, $request);
             // Successful enable/disable of an existing user.
             // Update grid data.
             return DAO::getDataChangedEvent($userId);
         } else {
             $json = new JSONMessage(false, $userForm->display($args, $request));
         }
     }
     return $json->getString();
 }