Exemple #1
0
//$semester=Yii::app()->db->createCommand("select semester from semester_aktif where semester='".$smt."' limit 1;")->queryScalar();
?>
	<?php 
echo $form->hiddenField($model, 'semester', array('class' => 'span5', 'maxlength' => 1, 'value' => $smt));
?>

	<div class="form-actions">
		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'success', 'icon' => 'icon-plus icon-white', 'label' => $model->isNewRecord ? 'Tambah' : 'Save'));
?>
		
		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'reset', 'label' => 'Ulangi', 'icon' => 'icon-refresh icon-white', 'type' => 'success'));
?>
	</div>

<?php 
$this->endWidget();
?>


<!-- Menampilkan dialog/popup ketika button di atas di klik -->
<?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'mydialog', 'options' => array('title' => 'Klik tanda <code>+</code> untuk input data siswa', 'autoOpen' => false, 'modal' => true, 'width' => 640, 'height' => 480)));
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'penempatan-grid', 'dataProvider' => Penempatan::model()->search2(), 'type' => 'striped bordered condensed', 'columns' => array('nis', 'nis0.nama_lengkap', 'kelas', 'lokal', array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button(
		        "+"
		        , array(
				"class" => "btn submit"
		        , "id" => "get_link"
		        , "onClick" => "$(\\"#mydialog\\").dialog(\\"close\\");$(\\"#TrEkstra_nis \\").val(\\"". $data->nis."\\");"))'))));
$this->endWidget('zii.widgets.jui.CJuiDialog');
 /**
  * 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)
 {
     $model = Penempatan::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #3
0
 public function actionTemplate()
 {
     //Template excel untuk import xlsx to db
     $bulan = date('m');
     if ($bulan < 7) {
         $smt = 2;
         //jika th 2(1-6) maka tahun-1/tahun-2 2012/2013
         $th_ajar = date('Y') - 1 . '/' . date('Y');
     } elseif ($bulan < 13 && $bulan > 6) {
         $smt = 1;
         //jika th 1(7-12) maka tahun/tahun+1 2012/2013
         $th_ajar = date('Y') . '/' . (date('Y') + 1);
     }
     Yii::import('ext.phpexcel.Classes.PHPExcel', true);
     $objPHPExcel = new PHPExcel();
     $ocim = $objPHPExcel->setActiveSheetIndex();
     // Set document properties
     $objPHPExcel->getProperties()->setCreator(date('d-m-Y'))->setLastModifiedBy(date('d-m-Y'))->setTitle("Nur Rochim | ISIMS")->setSubject("Raport I-SIMS Penilaian")->setDescription("Raport I-SIMS Penilaian")->setKeywords("Raport I-SIMS Penilaian")->setCategory("Raport I-SIMS Penilaian");
     $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setAutoSize(true);
     $kelas = Yii::app()->db->createCommand("select kelas from jadwal where kode_guru='" . Yii::app()->user->id . "';")->queryScalar();
     $lokal = Yii::app()->db->createCommand("select lokal from jadwal where kode_guru='" . Yii::app()->user->id . "';")->queryScalar();
     $penempatan = Penempatan::model()->findAll(array('condition' => "kelas='" . $kelas . "' and lokal='" . $lokal . "' and th_ajar='" . $th_ajar . "'"));
     $tebal = array('font' => array('bold' => true));
     $ocim->setCellValue("A1", "NO")->setCellValue("B1", "NIS")->setCellValue("C1", "NAMA")->setCellValue("D1", "KELAS")->setCellValue("E1", "LOKAL")->setCellValue("F1", "KODE MAPEL")->setCellValue("G1", "NILAI")->setCellValue("H1", "NILAI UN")->setCellValue("I1", "NILAI UAS")->getStyle("A1:I1")->applyFromArray($tebal);
     $arraypen = array();
     foreach ($penempatan as $pen) {
         $arraypen[] = array('nis' => $pen->nis, 'nama_lengkap' => $pen->nis0->nama_lengkap, 'kelas' => $pen->kelas, 'lokal' => $pen->lokal);
     }
     foreach ($arraypen as $k => $u) {
         $ocim->setCellValue('A' . ($k + 2), $k + 1)->setCellValue('B' . ($k + 2), $u['nis'])->setCellValue('C' . ($k + 2), $u['nama_lengkap'])->setCellValue('D' . ($k + 2), $u['kelas'])->setCellValue('E' . ($k + 2), $u['lokal']);
     }
     //Berikan Border All
     $semua = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
     $ocim->getStyle('A1:I' . ($k + 2))->applyFromArray($semua);
     $objPHPExcel->setActiveSheetIndex(0);
     ob_end_clean();
     ob_start();
     // Redirect output to a client’s web browser (Excel2007)
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="isims"' . date("dmY-His") . '');
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
 }
Exemple #4
0
		<tr>
			<th>NIS</th>
			<th>NAMA</th>
			<th>NILAI AKHIR</th>
			<?php 
        $kelas = Yii::app()->db->createCommand("select kelas from jadwal where kode_guru='" . Yii::app()->user->id . "';")->queryScalar();
        if ($kelas == 6) {
            echo "<th>UJIAN NASIONAL</th>\n\t\t\t\t\t<th>UJIAN SEKOLAH</th>";
        }
        ?>
			<th>SIMPAN</th>
		</tr>
		</thead>
		<tbody>
		<?php 
        $siswa = Penempatan::model()->findAll(array('order' => 'nis ASC', 'condition' => "kelas='" . $pgi['kelas'] . "' and lokal='" . $pgi['lokal'] . "' and th_ajar='" . $th_ajar . "'"));
        /*$siswa=Penempatan::model()->with('nilais')->findAll(array(
        				'order'=>'nilais.nis ASC',
        				//'condition'=>"nilais.kelas='".$pgi['kelas']."' and nilais.lokal='".$pgi['lokal']."' and nilais.th_ajar='".$th_ajar."'",
        			));
        
        			$siswa=Penempatan::model()->with(array(
        				'nilais'=>array(
        						'select'=>'*',
        						'joinType'=>'LEFT JOIN',
        						'condition'=>"nilais.kelas=".$pgi['kelas']." and nilais.lokal='".$pgi['lokal']."'",
        				),
        			))->findAll();*/
        foreach ($siswa as $i => $ii) {
            ?>