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