[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/demos/blog/protected/Pages/Admin/ -> UserMan.php (source)

   1  <?php
   2  /**
   3   * UserMan class file
   4   *
   5   * @author Qiang Xue <qiang.xue@gmail.com>
   6   * @link http://www.pradosoft.com/
   7   * @copyright Copyright &copy; 2006 PradoSoft
   8   * @license http://www.pradosoft.com/license/
   9   * @version $Id: UserMan.php 1397 2006-09-07 07:55:53Z wei $
  10   */
  11  
  12  /**
  13   * UserMan class
  14   *
  15   * @author Qiang Xue <qiang.xue@gmail.com>
  16   * @link http://www.pradosoft.com/
  17   * @copyright Copyright &copy; 2006 PradoSoft
  18   * @license http://www.pradosoft.com/license/
  19   */
  20  class UserMan extends BlogPage
  21  {
  22  	protected function bindData()
  23      {
  24          $author=$this->User->ID;
  25          $offset=$this->UserGrid->CurrentPageIndex*$this->UserGrid->PageSize;
  26          $limit=$this->UserGrid->PageSize;
  27          $this->UserGrid->DataSource=$this->DataAccess->queryUsers('','ORDER BY status DESC, name ASC',"LIMIT $offset,$limit");
  28          $this->UserGrid->VirtualItemCount=$this->DataAccess->queryUserCount('');
  29          $this->UserGrid->dataBind();
  30      }
  31  
  32  	public function onLoad($param)
  33      {
  34          parent::onLoad($param);
  35          if(!$this->IsPostBack)
  36              $this->bindData();
  37      }
  38  
  39  	public function changePage($sender,$param)
  40      {
  41          $this->UserGrid->CurrentPageIndex=$param->NewPageIndex;
  42          $this->bindData();
  43      }
  44  
  45  	public function pagerCreated($sender,$param)
  46      {
  47          $param->Pager->Controls->insertAt(0,'Page: ');
  48      }
  49  
  50  	public function editItem($sender,$param)
  51      {
  52          $this->UserGrid->EditItemIndex=$param->Item->ItemIndex;
  53          $this->bindData();
  54      }
  55  
  56  	public function saveItem($sender,$param)
  57      {
  58          $item=$param->Item;
  59          $userID=$this->UserGrid->DataKeys[$item->ItemIndex];
  60          $userRecord=$this->DataAccess->queryUserByID($userID);
  61          $userRecord->Role=TPropertyValue::ensureInteger($item->Cells[1]->UserRole->SelectedValue);
  62          $userRecord->Status=TPropertyValue::ensureInteger($item->Cells[2]->UserStatus->SelectedValue);
  63          $this->DataAccess->updateUser($userRecord);
  64          $this->UserGrid->EditItemIndex=-1;
  65          $this->bindData();
  66      }
  67  
  68  	public function cancelItem($sender,$param)
  69      {
  70          $this->UserGrid->EditItemIndex=-1;
  71          $this->bindData();
  72      }
  73  }
  74  
  75  ?>


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7