[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/action/admin/ -> admineditbloguseraction.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );    
   4      lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/view/admin/adminbloguserslistview.class.php" );    
   6      lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );    
   7      lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );        
   8  
   9      /**
  10       * \ingroup Action
  11       * @private
  12       */
  13      class AdminEditBlogUserAction extends AdminAction 
  14      {    
  15          /**
  16           * Constructor. If nothing else, it also has to call the constructor of the parent
  17           * class, BlogAction with the same parameters
  18           */
  19          function AdminEditBlogUserAction( $actionInfo, $request )
  20          {
  21              $this->AdminAction( $actionInfo, $request );
  22              
  23              // register one validator
  24              $this->registerFieldValidator( "userId", new IntegerValidator());
  25              // and the view we should show in case there is a validation error
  26              $errorView = new AdminBlogUsersListView( $this->_blogInfo );
  27              $errorView->setErrorMessage( $this->_locale->tr("error_invalid_user_id" ));            
  28              $this->setValidationErrorView( $errorView );
  29              
  30              $this->requirePermission( "update_blog_user");
  31          }
  32  
  33          /**
  34           * Carries out the specified action
  35           */
  36          function perform()
  37          {
  38              // fetch the data, we already know it's valid and that we can trust it!
  39              $userId = $this->_request->getValue( "userId" );
  40              
  41              // load the user
  42              $users = new Users();
  43              $userInfo = $users->getUserInfoFromId( $userId );
  44              if( !$userInfo ) {
  45                  $errorView = new AdminBlogUsersListView( $this->_blogInfo );
  46                  $errorView->setErrorMessage( $this->_locale->tr("error_invalid_user_id" ));
  47                  $this->setCommonData();
  48                  return( false );
  49              }
  50  
  51              // pass all the information to the view
  52              $this->_view = new AdminTemplatedView( $this->_blogInfo, "editbloguser" );
  53              $this->_view->setValue( "edituser", $userInfo );            
  54              $perms = new Permissions();
  55              $this->_view->setValue( "perms", $perms->getAllPermissions());            
  56              $this->setCommonData();
  57              
  58              return( true );
  59          }
  60      }
  61  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics