public function ambilSemuaMataPelajaran() { $mataPelajarans = new ArrayObject(); $ps = $this->connection->prepare("SELECT * FROM mata_pelajaran"); $ps->execute(); $rs = $ps->fetchAll(); foreach ($rs as $s) { $mataPelajaran = new MataPelajaran(); $mataPelajaran->setIdMataPelajaran($s["id_mata_pelajaran"]); $mataPelajaran->setMataPelajaran($s["mata_pelajaran"]); $mataPelajarans->append($mataPelajaran); } return $mataPelajarans; }
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get', 'type' => 'horizontal', 'focus' => array($model, 'nis'))); ?> <?php echo $form->textFieldRow($model, 'nis', array('class' => 'span5', 'rel' => 'tooltip', 'data-placement' => 'right', 'title' => 'Langkah 1 Masukkan kata kunci. Hilangkan angka "0"')); ?> <?php $mapel = CHtml::listData(MataPelajaran::model()->findAll(array('order' => 'kode_mapel, mapel ASC', 'select' => 'kode_mapel, mapel', 'distinct' => true)), 'kode_mapel', 'mapel'); ?> <?php echo $form->dropDownListRow($model, 'kode_mapel', $mapel, array('class' => 'span5', 'empty' => '-- Pilih Mata Pelajaran --', 'rel' => 'tooltip', 'data-placement' => 'right', 'title' => 'Langkah 1 Pilih Mata Pelajar dan Hilangkan angka "0" pada nis')); ?> <?php //echo $form->textFieldRow($model,'kode_mapel',array('class'=>'span5','maxlength'=>6)); ?> <?php $kelas = CHtml::listData(Lokal::model()->findAll(array('order' => 'kelas ASC', 'select' => 'kelas', 'distinct' => true)), 'kelas', 'kelas'); ?> <?php echo $form->dropDownListRow($model, 'kelas', $kelas, array('class' => 'span5', 'empty' => '-- Pilih Kelas --', 'rel' => 'tooltip', 'data-placement' => 'right', 'title' => 'Langkah 1 Pilih kelas')); ?> <?php $lokal = CHtml::listData(Lokal::model()->findAll(array('order' => 'lokal ASC', 'select' => 'lokal', 'distinct' => true)), 'lokal', 'lokal'); ?> <?php
/** * 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 the ID of the model to be loaded */ public function loadModel($id, $id2) { $model = MataPelajaran::model()->findByAttributes(array('kode_mapel' => $id, 'kurikulum' => $id2)); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }