/** * 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 actionKonfirmasi($id) { $perusahaan = new TPerusahaan(); foreach (TKonfirmasiPerusahaan::model()->findAllByAttributes(array('id_konfirmasi' => $_GET['id'])) as $data) { //$permintaan = TKonfirmasiPerusahaan::model()->findByAttributes(array('id_konfirmasi' => $_GET['id'])); $perusahaan->nm_perusahaan = $data->nm_perusahaan; $perusahaan->alamat_perusahaan = $data->alamat_perusahaan; $perusahaan->jenis_usaha = $data->jenis_usaha; $perusahaan->bidang = $data->bidang; $perusahaan->nm_pemilik = $data->nm_pemilik; $perusahaan->username = $data->username; $perusahaan->password = $data->password; $perusahaan->role = "perusahaan"; if ($perusahaan->save()) { $this->loadModel($id)->delete(); $this->redirect(array('admin')); } } }
public function actionIndex() { if (TPerusahaan::isPerusahaan()) { $this->redirect(array('TPerusahaan/profil')); } if (TAnggota::isAnggota()) { $this->redirect(array('TAnggota/profil')); } if (TAdmin::isAdmin()) { $this->redirect(array('TAdmin/profil')); } }
<?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)))); ?>
/** * Manages all models. */ public function actionAdmin() { $allt = new TAnggota('search'); $perusahaan = new TPerusahaan(); $model = new TPermintaanPerusahaan('search'); $model->unsetAttributes(); // clear any default values if (TAnggota::isAnggota()) { $allt->username = Yii::app()->user->id; if (isset($_GET['TPermintaanPerusahaan'])) { $model->attributes = $_GET['TPermintaanPerusahaan']; } $this->render('admin', array('model' => $model, 'allt' => $allt)); } elseif (TPerusahaan::isPerusahaan()) { $model->id_perusahaan = $perusahaan->getIdUser(); if (isset($_GET['TPermintaanPerusahaan'])) { $model->attributes = $_GET['TPermintaanPerusahaan']; } $this->render('admin', array('model' => $model)); } }
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'); }
<?php $this->breadcrumbs = array('Tpermintaan Perusahaans' => array('index'), 'Manage'); ?> <h1>Daftar Lowongan Aktif</h1> <?php if (TPerusahaan::isPerusahaan()) { $this->widget('booster.widgets.TbButton', array('buttonType' => 'link', 'label' => 'Tambah', 'icon' => 'plus', 'context' => 'primary', 'url' => array('TPermintaanPerusahaan/create'))); ?>   <?php } if (TPerusahaan::isPerusahaan()) { $this->widget('booster.widgets.TbGridView', array('id' => 'tpermintaan-perusahaan-grid', 'type' => 'striped bordered condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id_perusahaan', 'value' => '$data->getNama()', 'type' => 'raw', 'filter' => CHtml::listData(TPermintaanPerusahaan::model()->findAll(), 'id', 'nama')), 'pendidikan', 'usia', 'kompetensi_keahlian', 'gaji', 'informasi'))); ?> <?php } ?> <?php if (TAnggota::isAnggota()) { $this->widget('booster.widgets.TbGridView', array('id' => 'tpermintaan-perusahaan-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id_perusahaan', 'value' => '$data->getNama()', 'type' => 'raw', 'filter' => CHtml::listData(TPermintaanPerusahaan::model()->findAll(), 'id', 'nama')), 'pendidikan', 'usia', 'kompetensi_keahlian', 'gaji', 'informasi', array('type' => 'raw', 'header' => 'Opsi', 'name' => 'informasi', 'value' => 'CHtml::link("Kirim Permintaan",array("tPesan/pesanUser","id_anggota"=>$data->getIdUser(),"id_permintaan" =>$data->id_permintaan ))')))); ?> <?php }
/css/main.css"> <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?> /css/form.css"> <title><?php echo CHtml::encode($this->pageTitle); ?> </title> </head> <body> <?php $this->widget('booster.widgets.TbNavbar', array('brand' => '', 'fixed' => false, 'fluid' => true, 'items' => array(array('class' => 'booster.widgets.TbMenu', 'type' => 'navbar', 'items' => array(array('label' => 'Home', 'url' => array('site/index'), 'icon' => 'home'), array('label' => 'Daftar Pekerja', 'url' => array('TAnggota/create'), 'icon' => 'user', 'visible' => Yii::app()->user->isGuest), array('label' => 'Daftar Perusahaan', 'url' => array('TKonfirmasiPerusahaan/create'), 'icon' => 'list', 'visible' => Yii::app()->user->isGuest), array('label' => 'Dashboard', 'url' => array('/TAnggota/profil'), 'icon' => 'list', 'visible' => TAnggota::isAnggota()), array('label' => 'Dashboard', 'url' => array('/TPerusahaan/profil'), 'icon' => 'list', 'visible' => TPerusahaan::isPerusahaan()), array('label' => 'Dashboard', 'url' => array('/TAdmin/profil'), 'icon' => 'list', 'visible' => TAdmin::isAdmin()), array('label' => 'Logout (' . Yii::app()->user->id . ')', 'url' => array('/site/logout'), 'icon' => 'off', 'visible' => !Yii::app()->user->isGuest), array('label' => 'Sign In', 'url' => array('site/login'), 'icon' => 'off', 'linkOptions' => array('class' => 'pull-right'), 'visible' => Yii::app()->user->isGuest)))))); ?> <?php $this->widget('booster.widgets.TbCarousel', array('items' => array(array('image' => Yii::app()->request->baseUrl . '/images/14.jpg', 'label' => '', 'caption' => ''), array('image' => Yii::app()->request->baseUrl . '/images/12.jpg', 'label' => '', 'caption' => ''), array('image' => Yii::app()->request->baseUrl . '/images/13.jpg', 'label' => '', 'caption' => '')))); ?> <?php echo $content; ?> <div class="clear"></div> <div id="footer" > <div id="depan" class="width: 1000px;">
/** * Manages all models. */ public function actionAdmin() { $model = new TPesan('search'); $perusahaan = new TPerusahaan(); $model->unsetAttributes(); if (TAnggota::isAnggota()) { $model->id_anggota = $model->getIdUser(); if (isset($_GET['TPesan'])) { $model->attributes = $_GET['TPesan']; } $this->render('admin', array('model' => $model)); } elseif (TPerusahaan::isPerusahaan()) { $model->id_permintaan_perusahaan = $perusahaan->getPermintaan(); if (isset($_GET['TPesan'])) { $model->attributes = $_GET['TPesan']; } $this->render('admin', array('model' => $model)); } }
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