/** * 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; }
<?php $form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'tpermintaan-perusahaan-form', 'enableAjaxValidation' => false)); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <?php echo $form->hiddenField($model, 'id_perusahaan', array('value' => TPerusahaan::model()->getIdUser())); ?> <?php echo $form->textFieldGroup($model, 'pendidikan', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 20)))); ?> <?php echo $form->textFieldGroup($model, 'usia', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5')))); ?> <?php echo $form->textFieldGroup($model, 'kompetensi_keahlian', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 30)))); ?> <?php echo $form->textFieldGroup($model, 'gaji', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 15)))); ?>
public function getPermintaan() { $perusahaan = TPerusahaan::model()->findByAttributes(array('username' => Yii::app()->user->id)); $model = TPermintaanPerusahaan::model()->findByAttributes(array('id_perusahaan' => $perusahaan->id_perusahaan)); if ($model !== null) { return $model->id_permintaan; } else { return false; } }
<h2>Data Perusahaan</h2> <table border="1px"> <tr> <th>no</th> <th>id_perusahaan</th> <th>nm_perusahaan</th> <th>alamat_perusahaan</th> <th>jenis_usaha</th> <th>bidang</th> <th>nm_pemilik</th> <th>gambar</th> </tr> <?php $no = 1; $perusahaan = new TPerusahaan(); foreach (TPerusahaan::model()->findAllByAttributes(array('id_perusahaan' => $perusahaan->getIdUser())) as $data) { ?> <tr> <td><?php print $no; ?> </td> <td><?php print $data->id_perusahaan; ?> </td> <td><?php print $data->nm_perusahaan; ?> </td> <td><?php
public function actionGantipassword() { if (isset($_POST['password_baru'])) { $member = TPerusahaan::model()->findByAttributes(array('username' => Yii::app()->user->id)); $member->password = $_POST['password_baru']; $member->save(); } $this->render('gantipassword'); }
public function getNama() { $model = TPerusahaan::model()->findByPk($this->id_perusahaan); if ($model !== null) { return $model->nm_perusahaan; } else { return null; } }
public function getCountData() { return TPerusahaan::model()->countByAttributes(array('nm_perusahaan' => $this->id_konfirmasi)); }
<table class="table table-bordered table table-striped"> <tr> <th>Perusahaan</th> <th>Tanggapan</th> </tr> <?php $pesan = new TPesan(); $i = 1; foreach (TPesan::model()->findAllByAttributes(array('id_anggota' => $pesan->getIdUser())) as $pesan) { foreach (TPermintaanPerusahaan::model()->findAllByAttributes(array('id_permintaan' => $pesan->id_permintaan_perusahaan)) as $permintaan) { foreach (TPerusahaan::model()->findAllByAttributes(array('id_perusahaan' => $permintaan->id_perusahaan)) as $perusahaan) { if ($i++ == 11) { break; } ?> <tr> <td> <i class="glyphicon glyphicon-envelope"></i> <?php echo CHtml::link($perusahaan->nm_perusahaan, array('TPesan/view', 'id' => $pesan->id_pesan)); ?> </td> <td> <?php echo $pesan->konfirmasi; ?> </td> </tr> <?php } } } ?>
<table border="2" class=" table table-striped-bordered"> <tr> <td>No</td> <td>ID</td> <td>Nama Perusahaan</td> <td>alamat perusahaan</td> <td>Jenis Usaha</td> <td>Bidang</td> <td width="15%">Opsi</td> </tr> <?php if (isset($_GET['id'])) { $id = $_GET['id']; $no = 1; foreach (TPerusahaan::model()->findAllByAttributes(array('nm_perusahaan' => $id)) as $data) { ?> <tr> <td><?php print $no; ?> </td> <td><?php print $data->id_perusahaan; ?> </td> <td><?php print CHtml::link($data->nm_perusahaan, array('TPerusahaan/view', 'id' => $data->id_perusahaan)); ?> </td> <td><?php