/**
  * Lists all models.
  */
 public function actionIndex()
 {
     $tahun = Kegiatan::model()->getAllYears();
     $model = Kegiatan::model()->findAll();
     $dataProvider = null;
     $puskaji = 0;
     $bidang = 0;
     $kategori = 0;
     $tahun_selected = 0;
     if (isset($_GET['yt0'])) {
         //$dataProvider = array('aaa' => 'aaaaa');
         $puskaji = $_GET['puskaji'];
         $bidang = $_GET['bidang'];
         $kategori = $_GET['kategori'];
         $tahun_selected = $_GET['tahun_selected'];
         if ($tahun_selected != '') {
             if ($kategori == '1') {
                 if ($bidang != '') {
                     $dataProvider = Kegiatan::model()->findAllByAttributes(array('id_bidang' => (int) $bidang));
                 } else {
                     if ($puskaji != '') {
                         $dataProvider = Kegiatan::model()->findAllByAttributes(array('puskaji' => (int) $puskaji));
                     } else {
                         $dataProvider = Kegiatan::model()->findAll();
                     }
                 }
             } else {
                 if ($kategori == '2') {
                     if ($bidang != '') {
                         $dataProvider = Kegiatan::model()->getDetailKegiatanByBidang($bidang);
                     } else {
                         if ($puskaji != '') {
                             $dataProvider = Kegiatan::model()->getDetailKegiatanByPuskaji($puskaji);
                         } else {
                             $dataProvider = DetailKegiatan::model()->findAll();
                         }
                     }
                 } else {
                     if ($kategori == '3') {
                         if ($bidang != '') {
                             $id_personil = Personil::model()->getPersonilByBidang($bidang);
                             $dataProvider = KegiatanPersonil::model()->countByBidang($bidang, $tahun_selected);
                         } else {
                             if ($puskaji != '') {
                                 $dataProvider = KegiatanPersonil::model()->countByPuskaji($puskaji, $tahun_selected);
                             } else {
                                 $dataProvider = KegiatanPersonil::model()->countAll($tahun_selected);
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->render('index', array('dataProvider' => $dataProvider, 'puskaji' => $puskaji, 'bidang' => $bidang, 'kategori' => $kategori, 'model' => $model, 'tahun' => $tahun, 'tahun_selected' => $tahun_selected));
 }
Exemple #2
0
    echo $tableid;
    echo "\" class=\"display compact cell-border nowrap\">\n    <colgroup>\n    <col class=\"odd\"></col>\n    <col class=\"even\"></col>\n    <col class=\"odd\"></col>\n    <col class=\"even\"></col>\n    <col class=\"odd\"></col>\n    <col class=\"even\"></col>\n    <col class=\"odd\"></col>\n    <col class=\"even\"></col>\n    </colgroup>\n    <thead>\n      <tr>\n        <th class=\"dt-head-center\" rowspan=\"3\">No.</th>\n        <th class=\"dt-head-center\" rowspan=\"3\">Nama Personil</th>\n        <th class=\"dt-head-center\" colspan=\"48\">Periode</th>";
    if (Yii::app()->user->getState('role') == Akun::ADMIN) {
        echo "<th class=\"dt-head-center\" rowspan=\"3\">Aksi</th>";
    }
    echo "\n      </tr>\n      <tr>\n        <th class=\"dt-head-center\" colspan=\"4\">Januari</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Februari</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Maret</th>\n        <th class=\"dt-head-center\" colspan=\"4\">April</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Mei</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Juni</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Juli</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Agustus</th>\n        <th class=\"dt-head-center\" colspan=\"4\">September</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Oktober</th>\n        <th class=\"dt-head-center\" colspan=\"4\">November</th>\n        <th class=\"dt-head-center\" colspan=\"4\">Desember</th>\n      </tr>\n\n      <tr>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n        <th>1</th>\n        <th>2</th>\n        <th>3</th>\n        <th>4</th>\n      </tr>\n    </thead>\n    <tfoot>\n      <tr>\n      </tr>\n    </tfoot>\n    <tbody>";
    $ii = 1;
    foreach ($dataProvider as $data) {
        echo "<tr id=\"\">";
        echo "<td>" . $ii++ . "</td>";
        echo "<td>" . $data['nama'] . "</td>";
        for ($a = 1; $a <= 12; $a++) {
            for ($b = 1; $b <= 4; $b++) {
                $val = "w" . $a . $b;
                if ($data[$val] != NULL) {
                    $detail = DetailKegiatan::model()->getKodeKegiatan($data[$val]);
                    $bgcolor = WarnaKegiatan::model()->findByPk($detail['kode']);
                    echo "<td bgcolor=\"#" . $bgcolor['kode'] . "\">" . chr(64 + $bgcolor['id']) . $detail['id_kegiatan'] . "</td>";
                } else {
                    echo "<td></td>";
                }
            }
        }
        if (Yii::app()->user->getState('role') == Akun::ADMIN) {
            echo "<td class=\"text-left\">" . CHtml::link('Tambah', array('DetailKegiatanPersonil/addKegiatan', 'id' => $data['id'], 'id_personil' => $data['id_personil'])) . " |" . CHtml::link('Hapus', array('DetailKegiatanPersonil/deleteKegiatan', 'id' => $data['id'])) . "</td>";
        }
        echo "</tr>";
    }
    echo "\n    </tbody>\n  </table>";
}
?>
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $model = $this->loadModel($id);
     $dataProvider = null;
     $puskaji = 0;
     $bidang = 0;
     $tahun_selected = 0;
     $tahun = Kegiatan::model()->getAllYears();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $detail_kegiatan = DetailKegiatan::model()->getDetailKegiatanByKegiatan($model->id);
         foreach ($detail_kegiatan as $detail) {
             $dk = DetailKegiatan::model()->findByPk($detail['id']);
             $dk->delete();
         }
         $model->delete();
         Yii::app()->user->setFlash('successDelete', "Berhasil menghapus kegiatan!");
         $this->render('index', array('puskaji' => $puskaji, 'bidang' => $bidang, 'tahun_selected' => $tahun_selected, 'tahun' => $tahun, 'dataProvider' => $dataProvider));
     }
 }
 /**
  * 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 DetailKegiatan the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = DetailKegiatan::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #5
0
?>
		<?php 
echo $form->error($model, 'kode_bidang');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'Nama Kegiatan');
?>
		<?php 
if ($bidang != '') {
    //$data = KabupatenController::getListKab($model->kode_prov);
    //echo var_dump($data);
    //die();
    echo CHtml::dropDownList('id_detail_kegiatan', 'id_detail_kegiatan', array(DetailKegiatan::getDetailKegiatanByBidang($bidang)), array('empty' => 'Pilih Detail Kegiatan'));
} else {
    echo CHtml::dropDownList('id_detail_kegiatan', 'id_detail_kegiatan', array(), array('empty' => 'Pilih Detail Kegiatan'));
}
?>
		<?php 
echo $form->error($model, 'id_personil');
?>
	</div>
	<div class="row buttons">
		<?php 
echo CHtml::submitButton('Tambah', array('class' => 'btn green', 'style' => 'margin-left:400px; margin-top:10px;'));
?>
	</div>

<?php 
 public function actionGetChart()
 {
     $bidang = $_POST['bidang'];
     $dataProvider = DetailKegiatan::model()->findAllByPk($bidang);
     $this->render('summary', array('dataProvider' => $dataProvider, 'isNew'));
 }
Exemple #7
0
		<?php 
$namapersonil = Personil::model()->findByPk($model->id_personil);
echo CHtml::textField('namapersonil', $namapersonil['nama'], array('disabled' => 'disabled', 'class' => 'no-margin'));
?>
		<?php 
echo $form->error($model, 'id_personil');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'Detail Kegiatan');
$dk = 0;
?>
		<?php 
echo CHtml::dropDownList('dk', $dk, DetailKegiatan::model()->getKegiatanById($model->id_personil), array('empty' => 'Pilih Detail Kegiatan'));
?>
		<?php 
echo $form->error($model, 'kode_bidang');
?>
	</div>

	<div class="row buttons">
		<?php 
echo CHtml::submitButton('Hapus', array('class' => 'btn green delete', 'confirm' => 'Anda yakin untuk menghapus kegiatan personil?'));
?>
	</div>

<?php 
$this->endWidget();
?>
 public function actionAddKegiatan($id, $id_personil)
 {
     if ($id != null) {
         $model = $this->loadModel($id);
     } else {
         $model = new KegiatanPersonil();
         $model->id_personil = $id_personil;
     }
     if (isset($_GET['yt0'])) {
         echo var_dump($model->id_personil);
         echo var_dump($_GET['id_detail_kegiatan']);
         $kegiatan = new KegiatanPersonil();
         $kegiatan->id_personil = $model->id_personil;
         $kegiatan->id_detail_kegiatan = $_GET['id_detail_kegiatan'];
         $dk = DetailKegiatan::model()->getIdKegiatan($_GET['id_detail_kegiatan']);
         $k = Kegiatan::model()->getTahunKegiatan($dk[0]['id_kegiatan']);
         $kegiatan->tahun = $k[0]['tahun'];
         if ($kegiatan->save()) {
             // create new detail_kegiatan_personil
             echo var_dump($id_personil);
             $detail = DetailKegiatan::model()->findByPk($_GET['id_detail_kegiatan']);
             if ($id != null) {
                 for ($a = 1; $a <= 12; $a++) {
                     for ($b = 1; $b <= 4; $b++) {
                         $val = "w" . $a . $b;
                         if ($detail->{$val} != NULL) {
                             $model->{$val} = $kegiatan->id_detail_kegiatan;
                         }
                     }
                 }
                 $model->save();
             } else {
                 $dkp = new DetailKegiatanPersonil();
                 $dkp->id_personil = $kegiatan->id_personil;
                 $dkp->tahun = $kegiatan->tahun;
                 for ($a = 1; $a <= 12; $a++) {
                     for ($b = 1; $b <= 4; $b++) {
                         $val = "w" . $a . $b;
                         if ($detail->{$val} != NULL) {
                             $dkp->{$val} = $kegiatan->id_detail_kegiatan;
                         }
                     }
                 }
                 $dkp->save();
             }
             $this->redirect(array('index', 'id' => $model->id));
         }
     }
     $this->render('tambahKegiatan', array('model' => $model));
 }