Exemple #1
0
 public function beforeSave()
 {
     if (!$this->isNewRecord) {
         $user = Personnel::model()->findByPk($this->personnel_id);
         if (!$this->isValidMd5($this->password)) {
             $this->password = md5($this->password);
         }
     } else {
         $this->password = md5($this->password);
     }
     return parent::beforeSave();
 }
 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $user = Personnel::model()->findByAttributes(array('username' => $this->username));
     if (!isset($user)) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif ($user->password !== md5($this->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->errorCode = self::ERROR_NONE;
         $this->_id = $user->personnel_id;
         $this->setState('backEnd', true);
     }
     return !$this->errorCode;
 }
Exemple #3
0
<li class="extra">
    <?php 
echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 100px;'));
?>
    <p> 
        <strong><?php 
echo $data->name;
?>
</strong>
        <label><?php 
echo $data->tel;
?>
</label>
        <b><a href="#show_detail_<?php 
echo $data->personnel_id;
?>
" rel='facebox'>Read More</a></b>
    </p>
    <div id="show_detail_<?php 
echo $data->personnel_id;
?>
" style='display: none;'>
        <?php 
echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 600px;'));
$model = Personnel::model()->findByPk($data->personnel_id);
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('name', 'position.name', 'tel', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, "/", false)))));
?>
    </div>
</li>

 public function loadModel($id)
 {
     $model = Personnel::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #5
0
 public static function personnel($criteria = array())
 {
     return CHtml::listData(Personnel::model()->findAll($criteria), 'personnel_id', 'positionANDname');
 }
Exemple #6
0
 public function getMemberBackend()
 {
     $_members = array();
     $member = Personnel::model()->findAll();
     foreach ($member as $value) {
         array_push($_members, $value->username);
     }
     return $_members;
 }
                            </a>
                            <!-- Thumb Image and Description -->
                            <img src="<?php 
    echo Yii::app()->params['pathUpload'] . $car->pic;
    ?>
" alt="ทะเบียน : <?php 
    echo $car->license_no;
    ?>
">
                        </li>
                        <?php 
}
?>

                    <?php 
$drivers = Personnel::model()->driver()->findAll();
foreach ($drivers as $driver) {
    ?>
                        <li class="item-thumbs span3 driver">
                            <!-- Fancybox - Gallery Enabled - Title - Full Image -->
                            <a class="hover-wrap fancybox" data-fancybox-group="gallery" title="พนักงานขับรถ" href="<?php 
    echo Yii::app()->params['pathUpload'] . $driver->pic;
    ?>
">
                                <span class="overlay-img"></span>
                                <span class="overlay-img-thumb font-icon-plus"></span>
                            </a>
                            <!-- Thumb Image and Description -->
                            <img src="<?php 
    echo Yii::app()->params['pathUpload'] . $driver->pic;
    ?>