/** * 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)); } }
<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