/** * Gets detail of some tempAgendas. */ private function getTempAgendas($agendaRapats) { foreach ($agendaRapats as $agendaRapat) { $agenda[] = TempAgenda::model()->findByAttributes(array('id_agenda' => $agendaRapat->id_agenda)); } return $agenda; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return TempAgenda the loaded model * @throws CHttpException */ public function loadModel($id) { $model = TempAgenda::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /* @var $this AgendaController */ /* @var $data Agenda */ ?> <div class="searchR"> <div class="searchResult"> <?php $tempAgenda = TempAgenda::model()->findByAttributes(array('id_agenda' => $data->id)); if ($tempAgenda) { $tamp = $tempAgenda->deadline; while ($tamp != null) { $i = 0; $content = ''; while ($i < 3) { $pos = strpos($tamp, '#'); $temp = substr($tamp, 0, $pos); $tamp = substr($tamp, $pos + 1, strlen($tamp) - $pos + 1); $content .= $temp . ' '; $i++; } } } $this->widget('bootstrap.widgets.TbDetailView', array('data' => $data, 'attributes' => array('id', array('name' => 'PIC', 'value' => $data->pIC->nama, 'filter' => false), 'topik', 'deskripsi', 'status', array('name' => 'Deadline', 'value' => $tempAgenda ? str_word_count($tempAgenda->deadline, 0, '#') != 0 ? $content : 'belum dibahas' : 'belum dibahas', 'filter' => false)))); ?> </div> </div>
public function actionEndMeeting($idRapat) { $rapat = Rapat::model()->findByPk($idRapat); $agendaRapats = $this->getAgendaRapat($idRapat); $agendaRapats = $this->getAgendas($agendaRapats); foreach ($agendaRapats as $agendaRapat) { $tempAgenda = TempAgenda::model()->findByAttributes(array('id_agenda' => $agendaRapat->id)); if (!$tempAgenda) { $realTemp = RealTemp::model()->findByPk($agendaRapat->id); $tempAgenda = new TempAgenda(); $tempAgenda->id_agenda = $agendaRapat->id; $tempAgenda->tanggal = $rapat->waktu_tanggal; $tempAgenda->topik = $agendaRapat->topik; $tempAgenda->catatan = $realTemp->catatan; $tempAgenda->keputusan = $realTemp->keputusan; $tempAgenda->deadline = $realTemp->deadline; $tempAgenda->save(); } } $this->redirect(array('site/meetingEnded', 'idRapat' => $rapat->id)); }