Update Baru

parent 02ff3c17
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<<<<<<< HEAD
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/SiteController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/JadwalController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/login.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/mJadwal/index.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/beritaAcaraDaftarHadir/LaporanBeritaAcaraKuliah.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/models/Excel.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/beritaAcaraDaftarHadir/searchBeritaAcaraDaftarHadir.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/beritaAcaraDaftarHadir/SearcHDaftarHadir.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/dJadwal/index.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/upload.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/excelpath.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/DJadwalController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/DimController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/index.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/excel.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/BeritaAcaraDaftarHadirController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/KelasController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/BeritaAcaraKuliahController.php</file>
</group>
</open-files>
=======
>>>>>>> b42a32f429c96e698c247f20cdba2c19e6013c5c
</project-private>
......@@ -17,8 +17,7 @@ class BeritaAcaraDaftarHadirController extends Controller {
);
}
public function actionsearchGrafikBeritaAcaraDaftarHadir()
{
public function actionsearchGrafikBeritaAcaraDaftarHadir() {
$model = new BeritaAcaraDaftarHadir;
$djadwal = new DJadwal;
$mjadwal = new MJadwal;
......@@ -38,13 +37,13 @@ class BeritaAcaraDaftarHadirController extends Controller {
$id = $KODE_MK_form . "-" . $Kelas_form . "-" . $T_A;
$hasil = BeritaAcaraDaftarHadir::model()->findAllBySql(" SELECT * FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID` JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID`
WHERE mj.`TA`= '$T_A' AND dj.`KODE_MK` = '$KODE_MK_form' AND mj.`KELAS` = '$Kelas_form'");
if($NIM_form==NULL)
{
Yii::app()->user->setFlash('success', 'Anda belum memasukkan NIM');
}
else if($hasil==NULL){
Yii::app()->user->setFlash('failed', 'NIM : '.$NIM_form.' tidak terdapat dalam aplikasi');
}
// if($NIM_form==NULL)
// {
// Yii::app()->user->setFlash('success', 'Anda belum memasukkan NIM');
// }
// else if($hasil==NULL){
// Yii::app()->user->setFlash('failed', 'NIM : '.$NIM_form.' tidak terdapat dalam aplikasi');
// }
$hadir = Yii::app()->db->createCommand("SELECT COUNT(*) FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID` JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID`
WHERE mj.`TA`= '$T_A' AND dj.`KODE_MK` = '$KODE_MK_form' AND mj.`KELAS` = '$Kelas_form' AND STATUS LIKE 'H'")->queryAll();
......@@ -62,7 +61,7 @@ class BeritaAcaraDaftarHadirController extends Controller {
if ($hasil)
$tanggal = date('Y-m-d');
BeritaAcaraDaftarHadir::$tempID = $id;
$this->redirect(array('IndexGrafikData', 'id' => $id, 'tanggal'=>$tanggal));
$this->redirect(array('IndexGrafikData', 'id' => $id, 'tanggal' => $tanggal));
}
$this->render('SearcHDaftarHadir', array(
......@@ -72,12 +71,12 @@ class BeritaAcaraDaftarHadirController extends Controller {
));
}
public function actionIndexGrafikData($id, $tanggal) {
$this->render('IndexDataSearchGrafik', array(
'message' => $id, 'message2' =>$tanggal,
'message' => $id, 'message2' => $tanggal,
));
}
/**
* Specifies the access control rules.
* This method is used by the 'accessControl' filter.
......@@ -90,7 +89,7 @@ class BeritaAcaraDaftarHadirController extends Controller {
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('create', 'update','searchBeritaAcaraDaftarHadir','IndexData','CetakLaporan','searchGrafikBeritaAcaraDaftarHadir','IndexGrafikData','searchGrafikDaftarHadirMahasiswa','IndexGrafikDataMahasiswa'),
'actions' => array('create', 'update', 'searchBeritaAcaraDaftarHadir', 'IndexData', 'CetakLaporan', 'searchGrafikBeritaAcaraDaftarHadir', 'IndexGrafikData', 'searchGrafikDaftarHadirMahasiswa', 'IndexGrafikDataMahasiswa'),
'users' => array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
......@@ -98,7 +97,7 @@ class BeritaAcaraDaftarHadirController extends Controller {
'users' => array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
'users' => array('*'),
),
);
}
......@@ -270,7 +269,6 @@ class BeritaAcaraDaftarHadirController extends Controller {
));
}
/**
* Performs the AJAX validation.
* @param CModel the model to be validated
......@@ -288,9 +286,10 @@ class BeritaAcaraDaftarHadirController extends Controller {
$tanggal = $temp[0];
$waktu = $temp[1];
$ruangan = Ruangan::model()->findByAttributes(array('RFID' => $rfid));
echo $ruangan->SHORT_NAME;
$sql = "SELECT * FROM m_jadwal mj INNER JOIN d_jadwal dj ON mj.`ID`=dj.`ID_JADWAL`
WHERE ((dj.RUANGAN='$rfid' AND mj.TANGGAL ='$tanggal')
WHERE ((dj.RUANGAN='$ruangan->SHORT_NAME' AND mj.TANGGAL ='$tanggal')
AND ('$waktu' BETWEEN (SUBTIME(dj.`START_TIME`,'0:15:00')) AND (ADDTIME(dj.`END_TIME`,'0:15:00')))
AND mj.KELAS IN (SELECT KELAS FROM registrasi WHERE registrasi.`NIM`='$nim' ORDER BY SEM DESC))";
......@@ -320,12 +319,52 @@ AND mj.KELAS IN (SELECT KELAS FROM registrasi WHERE registrasi.`NIM`='$nim' ORDE
// ));
echo "Gagal";
}
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
public function actionValidatenew($rfid, $nim, $date, $time) {
$tanggal = $date;
$waktu = $time;
$ruangan = Ruangan::model()->findByAttributes(array('RFID' => $rfid));
echo $ruangan->SHORT_NAME;
$sql = "SELECT * FROM m_jadwal mj INNER JOIN d_jadwal dj ON mj.`ID`=dj.`ID_JADWAL`
WHERE ((dj.RUANGAN='$ruangan->SHORT_NAME' AND mj.TANGGAL ='$tanggal')
AND ('$waktu' BETWEEN (SUBTIME(dj.`START_TIME`,'0:15:00')) AND (ADDTIME(dj.`END_TIME`,'0:15:00')))
AND mj.KELAS IN (SELECT KELAS FROM registrasi WHERE registrasi.`NIM`='$nim' ORDER BY SEM DESC))";
$list = Yii::app()->db->createCommand($sql)->queryAll();
if ($list) {
foreach ($list as $l) {
$kehadiran = BeritaAcaraDaftarHadir::model()->findByAttributes(
array(
'ID_DETAIL_JADWAL' => $l['ID'],
'NIM' => $nim,
)
);
// $this->render('index', array(
// 'dataProvider' => $dataProvider,
if ($this->cekKehadiran($kehadiran->STATUS)) {
$kehadiran->STATUS = 'H';
$kehadiran->WAKTU_ABSEN = $waktu;
$kehadiran->save();
echo "Berhasil";
} else {
echo "Sudah Ter Absen" . "<BR>";
}
}
} else {
// var_dump($list);
// $this->render('admin', array(
// 'model' => $model,
// ));
echo "Gagal";
}
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
protected function cekKehadiran($status) {
......@@ -352,12 +391,10 @@ AND mj.KELAS IN (SELECT KELAS FROM registrasi WHERE registrasi.`NIM`='$nim' ORDE
$hasil = BeritaAcaraDaftarHadir::model()->findAllBySql(" SELECT * FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID` JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID`
WHERE dj.`KODE_MK` = '$KODE_MK_form' AND badh.`NIM` = '$NIM_form'");
if($NIM_form==NULL)
{
if ($NIM_form == NULL) {
Yii::app()->user->setFlash('success', 'Anda belum memasukkan NIM');
}
else if($hasil==NULL){
Yii::app()->user->setFlash('failed', 'NIM : '.$NIM_form.' tidak terdapat dalam aplikasi');
} else if ($hasil == NULL) {
Yii::app()->user->setFlash('failed', 'NIM : ' . $NIM_form . ' tidak terdapat dalam aplikasi');
}
//echo var_dump($hasil);
$hadir = Yii::app()->db->createCommand("SELECT COUNT(*) FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID` JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID`
......@@ -393,7 +430,6 @@ AND mj.KELAS IN (SELECT KELAS FROM registrasi WHERE registrasi.`NIM`='$nim' ORDE
//var_dump($lapet) ;
$this->render('IndexDataSearchGrafikMahasiswa', array(
'message' => $id, 'wew' => $lapet, 'wow' => $lapet2,
));
}
......
<?php
class DimController extends Controller
{
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public $layout='//layouts/column2';
/**
* @return array action filters
*/
public function filters()
{
return array(
'accessControl', // perform access control for CRUD operations
);
}
/**
* Specifies the access control rules.
* This method is used by the 'accessControl' filter.
* @return array access control rules
*/
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete'),
'users'=>array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new Dim;
class DimController extends Controller {
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public $layout = '//layouts/column2';
/**
* @return array action filters
*/
public function filters() {
return array(
'accessControl', // perform access control for CRUD operations
);
}
/**
* Specifies the access control rules.
* This method is used by the 'accessControl' filter.
* @return array access control rules
*/
public function accessRules() {
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array('index', 'view'),
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('create', 'update'),
'users' => array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions' => array('admin', 'delete'),
'users' => array('admin'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id) {
$this->render('view', array(
'model' => $this->loadModel($id),
));
}
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate() {
$model = new Dim;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Dim']))
{
$model->attributes=$_POST['Dim'];
if($model->save())
$this->redirect(array('view','id'=>$model->NIM));
}
$this->render('create',array(
'model'=>$model,
));
}
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model=$this->loadModel($id);
if (isset($_POST['Dim'])) {
$model->attributes = $_POST['Dim'];
if ($model->save())
$this->redirect(array('view', 'id' => $model->NIM));
}
$this->render('create', array(
'model' => $model,
));
}
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id) {
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Dim']))
{
$model->attributes=$_POST['Dim'];
if($model->save())
$this->redirect(array('view','id'=>$model->NIM));
}
$this->render('update',array(
'model'=>$model,
));
}
/**
* 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)
{
if(Yii::app()->request->isPostRequest)
{
if (isset($_POST['Dim'])) {
$model->attributes = $_POST['Dim'];
if ($model->save())
$this->redirect(array('view', 'id' => $model->NIM));
}
$this->render('update', array(
'model' => $model,
));
}
/**
* 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) {
if (Yii::app()->request->isPostRequest) {
// we only allow deletion via POST request
$this->loadModel($id)->delete();
$this->loadModel($id)->delete();
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Dim');
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
if (!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
} else
throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
}
/**
* Lists all models.
*/
public function actionIndex() {
$dataProvider = new CActiveDataProvider('Dim');
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
/**
* Manages all models.
*/
public function actionAdmin() {
$model = new Dim('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['Dim']))
$model->attributes = $_GET['Dim'];
$this->render('admin', array(
'model' => $model,
));
}
/**
* 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 = Dim::model()->findByPk($id);
if ($model === null)
throw new CHttpException(404, 'The requested page does not exist.');
return $model;
}
/**
* Performs the AJAX validation.
* @param CModel the model to be validated
*/
protected function performAjaxValidation($model) {
if (isset($_POST['ajax']) && $_POST['ajax'] === 'dim-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
/**
* Manages all models.
*/
public function actionAdmin()
{
$model=new Dim('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Dim']))
$model->attributes=$_GET['Dim'];
$this->render('admin',array(
'model'=>$model,
));
}
/**
* 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=Dim::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
/**
* Performs the AJAX validation.
* @param CModel the model to be validated
*/
protected function performAjaxValidation($model)
{
if(isset($_POST['ajax']) && $_POST['ajax']==='dim-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
}
......@@ -140,7 +140,7 @@ class SiteController extends Controller {
//PENGAJAR
$sql_pengajar = "SELECT * FROM pengajar WHERE TA LIKE '$masterjadwal->TA' AND ID_KUR LIKE '$masterjadwal->ID_KUR' AND KODE_MK LIKE '$detail->KODE_MK' ORDER BY ROLE ASC";
$list_pengajar = Yii::app()->db->createCommand($sql_pengajar)->queryAll();
echo "<BR>" . $sql_pengajar . "<BR>";
// echo "<BR>" . $sql_pengajar . "<BR>";
$detail->PIC = $list_pengajar[0]['DOSEN_ID'];
if ($detail->validate()) {
$detail->save();
......
......@@ -122,9 +122,9 @@ foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
$masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue();
$masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue();
$masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue();
echo $masterjadwal->KELAS . "<BR>";
//echo $masterjadwal->KELAS . "<BR>";
$masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($worksheet->getCellByColumnAndRow(1, $i)->getValue(), "YYYY-MM-DD");
echo $masterjadwal->TANGGAL;
//echo $masterjadwal->TANGGAL;
$masterjadwal->save();
for ($j = $i + 2; $j < $i + 10; $j++) {
......
......@@ -20,6 +20,7 @@
array('label' => 'Manage Jadwal <span class="caret"></span>', 'url' => '#', 'itemOptions' => array('class' => 'dropdown', 'tabindex' => "-1"), 'linkOptions' => array('class' => 'dropdown-toggle', 'data-toggle' => "dropdown", "data-description" => "Manage Jadwal disini!"),
'items' => array(
array('label' => 'Create Jadwal', 'url' => array('/MJadwal/create')),
array('label' => 'Upload Jadwal', 'url' => array('/site/upload')),
array('label' => 'Daftar Jadwal', 'url' => array('MJadwal/index')),
)),
array('label' => 'Laporan <span class="caret"></span>', 'url' => '#', 'itemOptions' => array('class' => 'dropdown', 'tabindex' => "-1"), 'linkOptions' => array('class' => 'dropdown-toggle', 'data-toggle' => "dropdown", "data-description" => "Absensi"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment