/**
  * 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()
 {
     $admin = TAdmin::model()->findByAttributes(array('username' => $this->username));
     $anggota = TAnggota::model()->findByAttributes(array('username' => $this->username));
     $perusahaan = TPerusahaan::model()->findByAttributes(array('username' => $this->username));
     if ($admin !== null) {
         if ($admin->password != $this->password) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             $this->errorCode = self::ERROR_NONE;
         }
     } else {
         if ($anggota !== null) {
             if ($anggota->password != $this->password) {
                 $this->errorCode = self::ERROR_PASSWORD_INVALID;
             } else {
                 $this->errorCode = self::ERROR_NONE;
             }
         } else {
             if ($perusahaan !== null) {
                 if ($perusahaan->password != $this->password) {
                     $this->errorCode = self::ERROR_PASSWORD_INVALID;
                 } else {
                     $this->errorCode = self::ERROR_NONE;
                 }
             }
         }
     }
     return !$this->errorCode;
 }
 public function getIdUser()
 {
     $model = TAnggota::model()->findByAttributes(array('username' => Yii::app()->user->id));
     if ($model !== null) {
         return $model->id_anggota;
     } else {
         return null;
     }
 }
Exemple #3
0
 public function getImage()
 {
     $model = TAnggota::model()->findByAttributes(array('username' => Yii::app()->user->id));
     return CHtml::image(Yii::app()->baseUrl . '/uploads/cv/gambar/' . $model->cv_lamaran_kerja, '', array('width' => '200px', 'style' => 'border-radius: 300px'));
 }
Exemple #4
0
    $this->widget('booster.widgets.TbMenu', array('type' => 'list', 'stacked' => true, 'items' => array(array('label' => 'Dashboard', 'icon' => 'user', 'url' => array('TAdmin/profil')), array('label' => 'Angota', 'url' => array('/TAnggota/admin'), 'icon' => 'book'), array('label' => 'Perusahaan', 'url' => array('/TPerusahaan/admin'), 'icon' => 'certificate'), array('label' => 'Peta', 'url' => array('peta/index'), 'icon' => 'map-marker'), array('label' => 'Ganti Password', 'url' => array('TAdmin/gantipassword'), 'icon' => 'cog'), array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => 'Logout (' . Yii::app()->user->id . ')', 'url' => array('/site/logout'), 'icon' => 'off', 'visible' => !Yii::app()->user->isGuest))));
    ?>
		<?php 
}
?>
				

		<?php 
if (TAnggota::isAnggota()) {
    $model = new TAnggota();
    print $model->getImage();
    ?>
			 <hr>
			<table style="font-size: 18px" width="100%">
			<?php 
    foreach (TAnggota::model()->findAllByAttributes(array('id_anggota' => $model->getIdUser())) as $data) {
        ?>
				<tr>
					<th><?php 
        echo $data->nm_anggota;
        ?>
</th>
				</tr>								
			<?php 
    }
    ?>
			</table>
			<hr>
			<?php 
    $this->widget('booster.widgets.TbMenu', array('type' => 'list', 'stacked' => true, 'items' => array(array('label' => 'Dashboard', 'icon' => 'user', 'url' => array('TAnggota/profil')), array('label' => 'Daftar Lowongan', 'icon' => 'list', 'url' => array('TPermintaanPerusahaan/admin')), array('label' => 'Tanggapan Lowongan', 'icon' => 'bullhorn', 'url' => array('TPesan/admin')), array('label' => 'Peta', 'icon' => 'map-marker', 'url' => array('bkd/kabkota')), '--------------', array('label' => 'Logout', 'icon' => 'off', 'url' => array('site/logout')))));
    ?>
Exemple #5
0
 public function getNamaAnggota()
 {
     $model = TAnggota::model()->findByPk($this->id_anggota);
     if ($model !== null) {
         return $model->nm_anggota;
     } else {
         return null;
     }
 }
 public function actionGantipassword()
 {
     if (isset($_POST['password_baru'])) {
         $member = TAnggota::model()->findByAttributes(array('username' => Yii::app()->user->id));
         $member->password = $_POST['password_baru'];
         $member->save();
     }
     $this->render('gantipassword');
 }