Beispiel #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->layout = '//layouts/column1';
     //Action search dialog
     $model2 = new Penempatan('gurupiket');
     $model2->unsetAttributes();
     // clear any default values
     if (isset($_GET['Penempatan'])) {
         $model2->attributes = $_GET['Penempatan'];
     }
     //Action create
     $model = new Presensi();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Presensi'])) {
         $model->attributes = $_POST['Presensi'];
         try {
             if ($model->save()) {
                 if ($model->tanggal == date('Y-m-d')) {
                     $model->save();
                     Yii::app()->user->setFlash('success', 'Data <strong>berhasil</strong> disimpan.');
                     $this->redirect(array('index'));
                 } else {
                     Yii::app()->user->setFlash('error', '<strong>Input tanggal maksimal hari ini.</strong> Terima Kasih');
                     $model->addError(null, "Input tanggal maksimal hari ini. Terima Kasih");
                 }
             }
         } catch (CDbException $e) {
             Yii::app()->user->setFlash('warning', 'Maaf <strong>data sudah ada dalam database</strong>. Silahkan periksa kembali');
             //$model->addError(null, $e->getMessage());
             $model->addError(null, "Maaf <strong>data sudah ada dalam database</strong>. Silahkan periksa kembali");
         }
     }
     $this->render('create', array('model' => $model, 'model2' => $model2));
 }
 public function daftarPenempatanPost()
 {
     if (Request::ajax()) {
         $data = Input::all();
         $penempatan = new Penempatan();
         $penempatan->nama = strtoupper($data['input']);
         if ($penempatan->save()) {
             return 1;
         } else {
             return 0;
         }
     }
 }
 public function penempatan($id)
 {
     if (Request::ajax()) {
         $penempatan = Penempatan::find($id);
         $penempatan->delete();
         return $penempatan->nama;
     }
 }
Beispiel #4
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');
                            class="glyphicon glyphicon-remove"></i></a>
                </div>
            </div>
            <div class="box-content">
                <table class="table table-condensed">
                    <thead>
                    <tr>
                        <th>Bil</th>
                        <th>Bahagian</th>
                        <th class="center">Pilihan</th>
                    </tr>
                    </thead>
                    <tbody>

                    <?php 
$penempatan = Penempatan::orderBy('id', 'ASC')->get();
$bil = 0;
?>
                        @foreach($penempatan as $tempat)
                            <?php 
$bil++;
?>
                            <tr>
                            <td class='center' valign='middle'>{{ $bil }}</td>
                            <td class='center' valign='middle'>{{ $tempat->nama }}</td>
                            <td class='center'><a class='delete btn btn-danger' data-id="{{ $tempat->id  }}">
                                    <i class='glyphicon glyphicon-trash icon-white'></i>Delete</a>
                            </td>
                            </tr>

                        @endforeach
Beispiel #6
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');
 }
 /**
  * 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;
 }
Beispiel #8
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) {
            ?>