UserRoleForm::display PHP Method

display() public method

Display the form.
public display ( $args, $request )
$args array
$request PKPRequest
    function display($args, $request)
    {
        $templateMgr = TemplateManager::getManager($request);
        $templateMgr->assign(array('userId' => $this->userId, 'userFullName' => $this->_userFullName));
        return $this->fetch($request);
    }

Usage Example

コード例 #1
0
 /**
  * Update an existing user
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function updateUser($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.UserForm');
         $userForm = new UserForm($userId);
         $userForm->readInputData();
         if ($userForm->validate()) {
             $user =& $userForm->execute($args, $request);
             // If this is a newly created user, show role management form
             if (!$userId) {
                 import('controllers.grid.users.user.form.UserRoleForm');
                 $userRoleForm = new UserRoleForm($user->getId());
                 $userRoleForm->initData($args, $request);
                 $json = new JSON('false', $userRoleForm->display($args, $request));
             } else {
                 // Successful edit of an existing user
                 // Prepare the 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();
 }
All Usage Examples Of UserRoleForm::display