echo $form->labelEx($model, 'nama'); ?> <?php echo $form->textField($model, 'nama', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'nama'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'unsur_id'); ?> <?php echo $form->dropDownList($model, 'unsur_id', CHtml::listData(Unsur::model()->findAll(), 'id', 'unsurOption')); ?> <?php echo $form->error($model, 'unsur_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?>
protected function getRows() { $dupak = $_SESSION['Dupak']; $unsurs = Unsur::model()->findByDupak($dupak); $rows = array(); $nilaiIndex = 0; foreach ($unsurs as $unsur) { $row = new StdClass(); $row->label = $unsur->nama; $row->left = 1; $row->right = 7; $row->input = false; $rows[] = clone $row; foreach ($unsur->subUnsurs as $sub) { $row = new StdClass(); $row->label = $sub->nama; $row->left = 2; $row->right = 6; $row->input = false; $rows[] = clone $row; foreach ($sub->kegiatans as $kegiatan) { $row = new StdClass(); $row->label = $kegiatan->nama; $row->left = 3; $row->right = 5; $row->input = false; $rows[] = clone $row; foreach ($kegiatan->topButir as $butir) { $nilai = isset($_SESSION['Nilai'][$nilaiIndex]) ? $_SESSION['Nilai'][$nilaiIndex] : new Nilai(); $nilai->butir_kegiatan_id = $butir->id; $row = new StdClass(); $row->label = $butir->nama; $row->nilai = clone $nilai; $row->left = 4; $row->right = 4; $row->input = true; $rows[] = clone $row; $nilaiIndex++; foreach ($butir->childs as $child1) { $nilai = isset($_SESSION['Nilai'][$nilaiIndex]) ? $_SESSION['Nilai'][$nilaiIndex] : new Nilai(); $nilai->butir_kegiatan_id = $child1->id; $row = new StdClass(); $row->label = $child1->nama; $row->nilai = clone $nilai; $row->left = 5; $row->right = 3; $row->input = true; $rows[] = clone $row; $nilaiIndex++; foreach ($child1->childs as $child2) { $nilai = isset($_SESSION['Nilai'][$nilaiIndex]) ? $_SESSION['Nilai'][$nilaiIndex] : new Nilai(); $nilai->butir_kegiatan_id = $child2->id; $row = new StdClass(); $row->label = $child2->nama; $row->nilai = clone $nilai; $row->left = 6; $row->right = 2; $row->input = true; $rows[] = clone $row; $nilaiIndex++; foreach ($child2->childs as $child3) { $nilai = isset($_SESSION['Nilai'][$nilaiIndex]) ? $_SESSION['Nilai'][$nilaiIndex] : new Nilai(); $nilai->butir_kegiatan_id = $child3->id; $row = new StdClass(); $row->label = $child3->nama; $row->nilai = clone $nilai; $row->left = 7; $row->right = 1; $row->input = true; $rows[] = clone $row; $nilaiIndex++; } } } } } } } return $rows; }
/** * 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. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Unsur::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }