Exemplo n.º 1
0
 /**
  * Authenticates an administrator.
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $record = Quantrivien::model()->findByAttributes(array('email' => $this->username));
     if (!$record) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif ($record->password != Quantrivien::saltPassword($this->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->username = $record->ma_qtv;
         $this->setState('adminId', $record->ma_qtv);
         $this->setState('adminName', $record->ten_qtv);
         $this->errorCode = self::ERROR_NONE;
     }
     return $this->errorCode;
 }
Exemplo n.º 2
0
?>
        <?php 
echo $form->passwordField($model, 'confirmPassword', array('size' => 60, 'maxlength' => 80, 'class' => 'form-control'));
?>
        <?php 
echo $form->error($model, 'confirmPassword');
?>
    </div>
    <div class="clearfix"></div>

    <div class="col-md-6">
        <?php 
echo $form->labelEx($model, 'trang_thai');
?>
        <?php 
echo $form->dropDownList($model, 'trang_thai', Quantrivien::getTypeAdminStatus(), array('class' => 'form-control'));
?>
        <?php 
echo $form->error($model, 'trang_thai');
?>
    </div>
    <div class="clearfix"></div>
    <div class="col-md-6">
        <strong>Phân quyền quản trị:</strong><br/><br/>
        <?php 
$roles = Quyenquantri::getAllRole();
foreach ($roles as $role) {
    $find = false;
    foreach ($phanQuyen as $quyen) {
        if ($role->ma_quyen == $quyen->ma_quyen) {
            $find = true;
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Quantrivien the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Quantrivien::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }