Excel Function

parent 55edb8da
......@@ -4,12 +4,11 @@
<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/views/site/login.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/themes/hebo/views/site/pages/elements.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/models/LoginForm.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/models/DJadwal.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/excel.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/MJadwalController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/mJadwal/_form.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/mJadwal/view.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/dJadwal/view.php</file>
</group>
</open-files>
</project-private>
......@@ -25,11 +25,11 @@ class MJadwalController extends Controller {
public function accessRules() {
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array('index', 'view', 'Matkul', 'Deskripsi', 'create2'),
'actions' => array('index', 'view', 'Matkul', 'Deskripsi'),
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('create', 'update', 'loadChildByAjax'),
'actions' => array('create', 'update', 'loadChildByAjax', 'create2', 'createjadwal', 'matkuljadwal', 'createexcel'),
'users' => array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
......@@ -50,7 +50,8 @@ class MJadwalController extends Controller {
$detail = new DJadwal('search');
$detail->unsetAttributes(); // clear any default values
if (isset($_GET['DJadwal']))
if (isset($_GET['DJadwal'
]))
$daftarhadir->attributes = $_GET['DJadwal'];
$model = $this->loadModel($id);
......@@ -60,6 +61,13 @@ class MJadwalController extends Controller {
));
}
public function actionCreate2() {
$kbk = RefKbk::model()->findAll();
$jumlah = count($kbk);
$this->render('create2', array('kbk' => $kbk, 'jumlah' => $jumlah));
}
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
......@@ -76,6 +84,7 @@ class MJadwalController extends Controller {
if ($model->save()) {
if (isset($_POST['DJadwal'])) {
for ($i = 0; $i < 8; $i++) {
if (!isset($_POST["formsesi$i"])) {
echo $i;
......@@ -140,6 +149,166 @@ class MJadwalController extends Controller {
));
}
public function actionCreateexcel() {
$model = new MJadwal;
$djadwal = new DJadwal;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['MJadwal'])) {
$model->attributes = $_POST['MJadwal'];
if ($model->save()) {
if (isset($_POST['DJadwal'])) {
for ($i = 0; $i < 8; $i++) {
if (!isset($_POST["formsesi$i"])) {
echo $i;
$detail = new DJadwal;
$detail->KODE_MK = $_POST['DJadwal'][$i]['KODE_MK'];
$detail->RUANGAN = $_POST['DJadwal'][$i]['RUANGAN'];
$detail->AKTIFITAS = $_POST['DJadwal'][$i]['AKTIFITAS'];
$detail->SESSION = $i + 1;
$detail->ID_JADWAL = $model->ID;
$detail->START_TIME = $this->start_time($i + 1);
$detail->END_TIME = $this->end_time($i + 1);
// MAHASISWA
$sql = "SELECT DISTINCT(nilai.NIM),nilai.`SEM` FROM nilai JOIN registrasi ON nilai.`NIM` = registrasi.`NIM` WHERE KODE_MK LIKE '$detail->KODE_MK' AND registrasi.`TA` = $model->TA AND registrasi.`KELAS` LIKE '$model->KELAS'";
$list = Yii::app()->db->createCommand($sql)->queryAll();
//PENGAJAR
$sql_pengajar = "SELECT * FROM pengajar WHERE TA LIKE '$model->TA' AND ID_KUR LIKE '$model->ID_KUR' AND KODE_MK LIKE '$detail->KODE_MK' ORDER BY ROLE ASC";
$list_pengajar = Yii::app()->db->createCommand($sql_pengajar)->queryAll();
$detail->PIC = $list_pengajar[0]['DOSEN_ID'];
if ($detail->validate()) {
$detail->save();
foreach ($list as $s) {
$daftarhadir = new BeritaAcaraDaftarHadir;
$daftarhadir->ID_DETAIL_JADWAL = $detail->ID;
$daftarhadir->NIM = $s['NIM'];
if ($daftarhadir->validate()) {
$daftarhadir->save();
} else {
echo CHtml::errorSummary($daftarhadir);
}
}
$kuliah = new BeritaAcaraKuliah;
$kuliah->ID_DETAIL_JADWAL = $detail->ID;
$kuliah->TIPE_KULIAH = 1;
if ($kuliah->validate()) {
$kuliah->save();
} else {
echo CHtml::errorSummary($kuliah);
}
} else {
echo CHtml::errorSummary($detail);
}
}
}
}
$this->redirect(array('view', 'id' => $model->ID));
} else {
echo CHtml::errorSummary($model);
}
}
$this->render('create', array(
'model' => $model,
'djadwal' => $djadwal
));
}
public function actionCreatejadwal($kbk) {
$model = new MJadwal;
$djadwal = new DJadwal;
$kbkmodel = RefKbk::model()->findByPk($kbk);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['MJadwal'])) {
$model->attributes = $_POST['MJadwal'];
if ($model->save()) {
if (isset($_POST['DJadwal'])) {
for ($i = 0; $i < 8; $i++) {
if (!isset($_POST["formsesi$i"])) {
echo $i;
$detail = new
DJadwal;
$detail->KODE_MK = $_POST['DJadwal'][$i]['KODE_MK'];
$detail->RUANGAN = $_POST['DJadwal'][$i]['RUANGAN'];
$detail->AKTIFITAS = $_POST['DJadwal'][$i]['AKTIFITAS'];
$detail->SESSION = $i + 1;
$detail->ID_JADWAL = $model->ID;
$detail->START_TIME = $this->start_time($i + 1);
$detail->END_TIME = $this->end_time($i + 1);
// MAHASISWA
$sql = "SELECT DISTINCT(nilai.NIM),nilai.`SEM` FROM nilai JOIN registrasi ON nilai.`NIM` = registrasi.`NIM` WHERE KODE_MK LIKE
'$detail->KODE_MK' AND registrasi.`TA` = $model->TA AND registrasi.`KELAS` LIKE '$model->KELAS'";
$list = Yii::app()->db->createCommand($sql)->queryAll();
//PENGAJAR
$sql_pengajar = "SELECT * FROM pengajar WHERE TA LIKE '$model->TA' AND ID_KUR LIKE '$model->ID_KUR' AND KODE_MK LIKE '$detail->KODE_MK' ORDER BY ROLE ASC";
$list_pengajar = Yii::app()->db->createCommand($sql_pengajar)->queryAll();
$detail->PIC = $list_pengajar[0]['DOSEN_ID'];
if ($detail->validate()) {
$detail->save();
foreach ($list as $s) {
$daftarhadir = new BeritaAcaraDaftarHadir;
$daftarhadir->ID_DETAIL_JADWAL = $detail->ID;
$daftarhadir->NIM = $s['NIM'];
if ($daftarhadir->validate()) {
$daftarhadir->save();
} else {
echo CHtml::errorSummary($daftarhadir);
}
}
$kuliah = new BeritaAcaraKuliah;
$kuliah->ID_DETAIL_JADWAL = $detail->ID;
$kuliah->TIPE_KULIAH = 1;
if ($kuliah->validate()) {
$kuliah->save();
} else {
echo CHtml::errorSummary($kuliah);
}
} else {
echo CHtml::errorSummary($detail);
}
}
}
}
$this->redirect(array('view', 'id' => $model->ID));
} else {
echo CHtml::errorSummary($model);
}
}
$this->render('createjadwal', array(
'model' => $model,
'djadwal' => $djadwal,
'kbk' => $kbkmodel
,
));
}
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
......@@ -167,7 +336,7 @@ class MJadwalController extends Controller {
/**
* 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
* @param int eger $id t he ID of the model to be deleted
*/
public function actionDelete($id) {
if (Yii::app()->request->isPostRequest) {
......@@ -176,7 +345,9 @@ class MJadwalController extends Controller {
// 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'));
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] :
array
('admin'));
} else
throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
}
......@@ -188,10 +359,12 @@ class MJadwalController extends Controller {
$model = new MJadwal('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['MJadwal']))
if (isset($_GET[
'MJadwal']))
$model->attributes = $_GET['MJadwal'];
$this->render('index', array(
$this->render('index', array
(
'model' => $model,
));
}
......@@ -200,13 +373,18 @@ class MJadwalController extends Controller {
* Manages all models.
*/
public function actionAdmin() {
$model = new MJadwal('search');
$model = new MJadwal
('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['MJadwal']))
$model->attributes = $_GET['MJadwal'];
$model->attributes = $_GET['MJadwal']
$this->render('admin', array(
'model' => $model,
;
$this->render('admin', array('model' => $model,
));
}
......@@ -227,9 +405,11 @@ class MJadwalController extends Controller {
* @param CModel the model to be validated
*/
protected function performAjaxValidation($model) {
if (isset($_POST['ajax']) && $_POST['ajax'] === 'mjadwal-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
if (isset($_POST[
'ajax']) && $_POST['ajax'] === 'mjadwal-form') {
echo CActiveForm::validate(
$model);
Yii:: app()->end();
}
}
......@@ -306,6 +486,26 @@ class MJadwalController extends Controller {
echo Chtml::tag('option', array('value' => 'Kosong'), CHtml::encode('Free'));
}
public function actionMatkuljadwal($kbk) {
$id_kur = (int) $_POST['MJadwal']['ID_KUR'];
$kuliah = CHtml::listData(Kurikulum::model()->findAll(array(
'condition' => "ID_KUR = '$id_kur' AND (KBK_ID LIKE '$kbk' OR KBK_ID LIKE 'all')",)), 'KODE_MK', 'KODE_MK');
// $kurikulum = Kurikulum::model()->findAllByAttributes(array('ID_KUR' => $id_kur));
// $data = Kurikulum::model()->findAll(
// "ID_KUR=:id ", array(':id' => (int) $_POST['MJadwal']['ID_KUR']));
// $return = CHtml::listData($kuliah, 'KODE_MK', 'KODE_MK');
foreach ($kuliah as $value => $KODE_MK) {
echo Chtml::tag('option', array('value' => $value), CHtml::encode($KODE_MK), true);
}
echo Chtml::tag('option', array('value' => 'Kosong'), CHtml::encode('Free'));
}
public function actionDeskripsi($id) {
$matkul = $_POST['DJadwal'][$id]['KODE_MK'];
......
......@@ -175,4 +175,19 @@ class DJadwal extends CActiveRecord {
));
}
public function getAktifitas($val) {
switch ($val) {
case "T":
return "Teori";
break;
case "P":
return "Praktikum";
break;
case "M":
return "Mandiri";
break;
}
}
}
<?php
/**
* This is the model class for table "ref_kbk".
*
* The followings are the available columns in table 'ref_kbk':
* @property string $KBK_ID
* @property string $KPT_ID
* @property string $JENJANG
* @property string $KBK_IND
* @property string $KBK_ING
* @property string $NAMA_KOPERTIS_IND
* @property string $NAMA_KOPERTIS_ING
* @property string $SHORT_DESC_IND
* @property string $SHORT_DESC_ING
* @property string $DESC_IND
* @property string $DESC_ING
* @property integer $STATUS
* @property string $LAST_UPDATE
* @property string $USER_ID
* @property string $WS
*/
class RefKbk extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return RefKbk the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'ref_kbk';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('JENJANG, LAST_UPDATE', 'required'),
array('STATUS', 'numerical', 'integerOnly'=>true),
array('KBK_ID, JENJANG', 'length', 'max'=>20),
array('KPT_ID', 'length', 'max'=>10),
array('KBK_IND, KBK_ING', 'length', 'max'=>100),
array('NAMA_KOPERTIS_IND, NAMA_KOPERTIS_ING, SHORT_DESC_IND, SHORT_DESC_ING', 'length', 'max'=>255),
array('USER_ID, WS', 'length', 'max'=>15),
array('DESC_IND, DESC_ING', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('KBK_ID, KPT_ID, JENJANG, KBK_IND, KBK_ING, NAMA_KOPERTIS_IND, NAMA_KOPERTIS_ING, SHORT_DESC_IND, SHORT_DESC_ING, DESC_IND, DESC_ING, STATUS, LAST_UPDATE, USER_ID, WS', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'KBK_ID' => 'Kbk',
'KPT_ID' => 'Kpt',
'JENJANG' => 'Jenjang',
'KBK_IND' => 'Kbk Ind',
'KBK_ING' => 'Kbk Ing',
'NAMA_KOPERTIS_IND' => 'Nama Kopertis Ind',
'NAMA_KOPERTIS_ING' => 'Nama Kopertis Ing',
'SHORT_DESC_IND' => 'Short Desc Ind',
'SHORT_DESC_ING' => 'Short Desc Ing',
'DESC_IND' => 'Desc Ind',
'DESC_ING' => 'Desc Ing',
'STATUS' => 'Status',
'LAST_UPDATE' => 'Last Update',
'USER_ID' => 'User',
'WS' => 'Ws',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('KBK_ID',$this->KBK_ID,true);
$criteria->compare('KPT_ID',$this->KPT_ID,true);
$criteria->compare('JENJANG',$this->JENJANG,true);
$criteria->compare('KBK_IND',$this->KBK_IND,true);
$criteria->compare('KBK_ING',$this->KBK_ING,true);
$criteria->compare('NAMA_KOPERTIS_IND',$this->NAMA_KOPERTIS_IND,true);
$criteria->compare('NAMA_KOPERTIS_ING',$this->NAMA_KOPERTIS_ING,true);
$criteria->compare('SHORT_DESC_IND',$this->SHORT_DESC_IND,true);
$criteria->compare('SHORT_DESC_ING',$this->SHORT_DESC_ING,true);
$criteria->compare('DESC_IND',$this->DESC_IND,true);
$criteria->compare('DESC_ING',$this->DESC_ING,true);
$criteria->compare('STATUS',$this->STATUS);
$criteria->compare('LAST_UPDATE',$this->LAST_UPDATE,true);
$criteria->compare('USER_ID',$this->USER_ID,true);
$criteria->compare('WS',$this->WS,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}
\ No newline at end of file
......@@ -14,24 +14,24 @@ $form = $this->beginWidget('booster.widgets.TbActiveForm', array(
<TR ALIGN="CENTER">
<TD ALIGN="CENTER"><CENTER>
<h3>Tahun Ajaran</h3></CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
<h3>Semester</h3></CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
<h3>Kode Mata Kuliah</h3></CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
<h3>Kelas</h3></CENTER>
<TD>
<TD>
</TR>
<TR ALIGN="CENTER">
<TR ALIGN="CENTER">
<TD ALIGN="CENTER">
<CENTER>
<CENTER>
<?php
$data = CHtml::listData(Jadwal::model()->findAll(), 'TA', 'TA');
echo $form->dropDownListGroup(
$data = CHtml::listData(Jadwal::model()->findAll(), 'TA', 'TA');
echo $form->dropDownListGroup(
$model, 'TA', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
......@@ -40,14 +40,14 @@ echo $form->dropDownListGroup(
'htmlOptions' => array(),
)
)
);
?>
);
?>
</CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
<?php
$data = CHtml::listData(BeritaAcaraKuliah::model()->findAll(), 'SEM', 'SEM');
echo $form->dropDownListGroup(
$data = CHtml::listData(BeritaAcaraKuliah::model()->findAll(), 'SEM', 'SEM');
echo $form->dropDownListGroup(
$model, 'SEM', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
......@@ -56,16 +56,16 @@ echo $form->dropDownListGroup(
'htmlOptions' => array(),
)
)
);
?>
);
?>
</CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
<?php //echo $form->textFieldGroup($model,'ID_KUR',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>
<?php
$data = CHtml::listData(Jadwal::model()->findAll(), 'KODE_MK', 'KODE_MK');
echo $form->dropDownListGroup(
<?php
$data = CHtml::listData(Jadwal::model()->findAll(), 'KODE_MK', 'KODE_MK');
echo $form->dropDownListGroup(
$model, 'KODE_MK', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
......@@ -74,15 +74,15 @@ echo $form->dropDownListGroup(
'htmlOptions' => array(),
)
)
);
?>
);
?>
</CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
</TD>
<TD ALIGN="CENTER"><CENTER>
<?php
$data = CHtml::listData(Jadwal::model()->findAll(), 'KELAS', 'KELAS');
echo $form->dropDownListGroup(
$data = CHtml::listData(Jadwal::model()->findAll(), 'KELAS', 'KELAS');
echo $form->dropDownListGroup(
$model, 'KELAS', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
......@@ -91,9 +91,9 @@ echo $form->dropDownListGroup(
'htmlOptions' => array(),
)
)
);
?>
<CENTER>
);
?>
<CENTER>
</TD>
</TR>
<TR >
......@@ -106,44 +106,44 @@ echo $form->dropDownListGroup(
'label' => $model->isNewRecord ? 'Search' : 'Save',
));
?>
</div>
</div>
</CENTER>
<TD>
</TR>
</TABLE>
</TABLE>
<?php //echo $form->datePickerGroup($model,'TANGGAL',array('widgetOptions'=>array('options'=>array(),'htmlOptions'=>array('class'=>'span5')), 'prepend'=>'<i class="glyphicon glyphicon-calendar"></i>', 'append'=>'Click on Month/Year to select a different Month/Year.')); ?>
<?php //echo $form->datePickerGroup($model,'TANGGAL',array('widgetOptions'=>array('options'=>array(),'htmlOptions'=>array('class'=>'span5')), 'prepend'=>'<i class="glyphicon glyphicon-calendar"></i>', 'append'=>'Click on Month/Year to select a different Month/Year.')); ?>
<?php //echo $form->textFieldGroup($model,'START_TIME',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>
<?php //echo $form->textFieldGroup($model,'START_TIME',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>
<?php //echo $form->textFieldGroup($model,'END_TIME',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>
<?php //echo $form->textFieldGroup($model,'END_TIME',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>
<?php //echo $form->textAreaGroup($model,'TOPIK', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'TOPIK', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textFieldGroup($model,'RUANGAN',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>100)))); ?>
<?php //echo $form->textFieldGroup($model,'RUANGAN',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>100)))); ?>
<?php //echo $form->textFieldGroup($model,'AKTIFITAS',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php //echo $form->textFieldGroup($model,'AKTIFITAS',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php //echo $form->textFieldGroup($model,'PIC',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>20)))); ?>
<?php //echo $form->textFieldGroup($model,'PIC',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>20)))); ?>
<?php //echo $form->dropDownListGroup($model,'TIPE_KULIAH', array('widgetOptions'=>array('data'=>array("Regular"=>"Regular","Pengganti"=>"Pengganti",), 'htmlOptions'=>array('class'=>'input-large')))); ?>
<?php //echo $form->dropDownListGroup($model,'TIPE_KULIAH', array('widgetOptions'=>array('data'=>array("Regular"=>"Regular","Pengganti"=>"Pengganti",), 'htmlOptions'=>array('class'=>'input-large')))); ?>
<?php //echo $form->textAreaGroup($model,'METODE', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'METODE', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'ALAT_BANTU', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'ALAT_BANTU', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'CATATAN', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'CATATAN', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textFieldGroup($model,'LAST_UPDATE',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>20)))); ?>
<?php //echo $form->textFieldGroup($model,'LAST_UPDATE',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>20)))); ?>
<?php //echo $form->textFieldGroup($model,'USER_ID',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php //echo $form->textFieldGroup($model,'USER_ID',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php //echo $form->textFieldGroup($model,'WS',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php //echo $form->textFieldGroup($model,'WS',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php $this->endWidget(); ?>
<?php $this->endWidget(); ?>
......@@ -10,16 +10,22 @@ $this->widget('booster.widgets.TbGridView', array(
'SESSION',
'START_TIME',
'END_TIME',
'KODE_MK',
array(
'header' => 'KODE_MK',
'type' => 'raw',
'value' => 'CHtml::link(CHtml::encode($data->KODE_MK), "https://akademik.del.ac.id/?menu=BrowseKuliah&submenu=detail&ID_KUR=".CHtml::encode($data->kodemk->ID_KUR)."&KODE_MK=".CHtml::encode($data->KODE_MK))',
),
array(
'header' => 'Mata Kuliah',
'value' => '$data->kodemk->NAMA_KUL_IND'
'type' => 'raw',
'value' => 'CHtml::link(CHtml::encode($data->kodemk->NAMA_KUL_IND), "https://akademik.del.ac.id/?menu=BrowseKuliah&submenu=detail&ID_KUR=".CHtml::encode($data->kodemk->ID_KUR)."&KODE_MK=".CHtml::encode($data->KODE_MK))',
),
'RUANGAN',
'AKTIFITAS',
array(
'header' => 'Pengajar',
'value' => '$data->pic->NAMA'
'type' => 'raw',
'value' => 'CHtml::link(CHtml::encode($data->pic->NAMA), "https://akademik.del.ac.id/?menu=BrowseProfileBrief&submenu=default&ID=".CHtml::encode($data->PIC))',
),
// array(
// 'header' => 'Aksi',
......@@ -87,7 +93,11 @@ $this->widget('booster.widgets.TbGridView', array(
'id' => 'berita-acara-daftar-hadir-grid',
'dataProvider' => $daftarhadir,
'columns' => array(
'NIM',
array(
'header' => 'NIM',
'type' => 'raw',
'value' => 'CHtml::link(CHtml::encode($data->NIM), "https://akademik.del.ac.id/?menu=BrowseDIM&submenu=detail&nim=".CHtml::encode($data->NIM))',
),
array(
'header' => 'Nama',
'name' => 'Nama',
......
......@@ -9,10 +9,7 @@ $form = $this->beginWidget('booster.widgets.TbActiveForm', array(
));
?>
<?php
$objPHPExcel = new PHPExcel();
echo $form->dropDownListGroup(
$model, 'WEEK', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
......@@ -107,6 +104,7 @@ echo $form->dropDownListGroup(
Sesi Kosong ? <input type="checkbox" name="formsesi<?php echo $i ?>" value="Yes" />
<BR>
<BR>
<?php
$kuliah = CHtml::listData(Kurikulum::model()->findAll(array(
'condition' => "ID_KUR = '$last'",)), 'KODE_MK', 'KODE_MK');
......
<?php
$sql_id_kur = "SELECT ID_KUR FROM kurikulum ORDER BY ID_KUR DESC LIMIT 1";
$last_id_kur = Yii::app()->db->createCommand($sql_id_kur)->queryAll();
$last = $last_id_kur[0]['ID_KUR'];
$form = $this->beginWidget('booster.widgets.TbActiveForm', array(
'id' => 'mjadwal-form',
'enableAjaxValidation' => false,
));
?>
<?php
echo $form->dropDownListGroup(
$model, 'WEEK', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'widgetOptions' => array(
'data' => array(
'Pilih Minggu', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'
),
'htmlOptions' => array(),
)
)
);
?>
<?php echo $form->datePickerGroup($model, 'TANGGAL', array('widgetOptions' => array('options' => array(), 'htmlOptions' => array('class' => 'span5')), 'prepend' => '<i class="glyphicon glyphicon-calendar"></i>', 'append' => 'Pilih Tanggal Jadwal.')); ?>
<?php
$ta = CHtml::listData(Registrasi::model()->findAll(
array('select' => 't.TA',
'order' => 'TA DESC',
'distinct' => true,)
), 'TA', 'TA');
echo $form->dropDownListGroup(
$model, 'TA', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'widgetOptions' => array(
'data' => $ta,
'htmlOptions' => array(
)
)
)
)
?>
<?php
$idkur = CHtml::listData(Registrasi::model()->findAll(
array('select' => 't.KELAS',
'condition' => "TA = 2013",
'order' => 'KELAS DESC',
'distinct' => true,)
), 'KELAS', 'KELAS');
echo $form->dropDownListGroup(
$model, 'KELAS', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'widgetOptions' => array(
'data' => $idkur,
'htmlOptions' => array(),
)
)
);
?>
<?php
$idkur = CHtml::listData(Kurikulum::model()->findAll(
array('select' => 't.ID_KUR',
'order' => 'ID_KUR DESC',
'distinct' => true,)
), 'ID_KUR', 'ID_KUR');
$a = 0;
$b = 1;
echo $form->dropDownListGroup(
$model, 'ID_KUR', array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'widgetOptions' => array(
'data' => $idkur,
'htmlOptions' => array(
'ajax' => array(
'type' => 'POST',
'url' => CController::createUrl('MJadwal/matkuljadwal&kbk=' . $kbk->KBK_ID),
'update' => '#DJadwal_0_KODE_MK,#DJadwal_1_KODE_MK,#DJadwal_2_KODE_MK,#DJadwal_3_KODE_MK,#DJadwal_4_KODE_MK,#DJadwal_5_KODE_MK,#DJadwal_6_KODE_MK,#DJadwal_7_KODE_MK'
),
),
)
)
);
?>
<BR><BR>
<?php for ($i = 0; $i < 8; $i++) { ?>
<div class="well">
<fieldset>
<legend>Sesi <?php echo $i + 1 ?>&nbsp;&nbsp;&nbsp;<small><?php echo sessionTime($i + 1); ?></SMALL></legend>
<?php // echo $form->textFieldGroup($djadwal, '[' . $i . ']SESSION', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'placeholder' => 'Sesi')))); ?>
Sesi Kosong ? <input type="checkbox" name="formsesi<?php echo $i ?>" value="Yes" />
<BR>
<BR>
<?php
$kuliah = CHtml::listData(Kurikulum::model()->findAll(array(
'condition' => "ID_KUR = '$last' AND (KBK_ID LIKE '$kbk->KBK_ID' OR KBK_ID LIKE 'all')",)), 'KODE_MK', 'KODE_MK');
echo $form->dropDownListGroup($djadwal, '[' . $i . ']KODE_MK', array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'widgetOptions' => array(
'data' => $kuliah,
'htmlOptions' => array(
'ajax' => array(
'type' => 'POST',
'url' => CController::createUrl('MJadwal/deskripsi&id=' . $i),
'update' => "#matkul$i"
)
),
)
)
);
?>
<div id="matkul<?php echo $i; ?>" class="alert alert-info"></div>
<?php
$data = CHtml::listData(Ruangan ::model()->findAll(), 'ID', 'SHORT_NAME');
echo $form->dropDownListGroup($djadwal, '[' . $i . ']RUANGAN', array('wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
'widgetOptions' => array(
'data' => $data,
'htmlOptions' => array(
),
)
)
);
?>
<?php echo $form->dropDownListGroup($djadwal, '[' . $i . ']AKTIFITAS', array('widgetOptions' => array('data' => array("Teori" => "Teori", "Praktikum" => "Praktikum", "Mandiri" => "Mandiri",), 'htmlOptions' => array('class' => 'input-large', 'placeholder' => 'Aktifitas')))); ?>
</fieldset>
</div>
<?php } ?>
<div class="form-actions">
<?php
$this->widget('booster.widgets.TbButton', array(
'buttonType' => 'submit',
'context' => 'primary',
'label' => $model->isNewRecord ? 'Buat Baru' : 'Save',
));
?>
</div>
<?php $this->endWidget(); ?>
<?php
function sessionTime($session) {
switch ($session) {
case 1:
return "08:00:00 - 09:00:00";
break;
case 2:
return "09:00:00 - 10:00:00";
break;
case 3:
return "10:00:00 - 11:00:00";
break;
case 4:
return "11:00:00 - 12:00:00";
break;
case 5:
return "13:00:00 - 14:00:00";
break;
case 6:
return "14:00:00 - 15:00:00";
break;
case 7:
return "15:00:00 - 16:00:00";
break;
case 8:
return "16:00:00 - 17:00:00";
break;
}
}
?>
<div class="page-header">
<h1>Buat Jadwal Baru<small> &nbsp;&nbsp;&nbsp;<?php echo "Satu Kelas Satu Hari Delapan Sesi" ?></small></h1>
</div>
<?php
for ($i = 0; $i < $jumlah; $i++) {
echo "<center>";
echo CHtml::button($kbk[$i]['JENJANG'] . " (" . $kbk[$i]['KBK_IND'] . ") ", array('submit' => array('MJadwal/createjadwal', 'kbk' => $kbk[$i]['KBK_ID']), 'class' => 'btn btn-large btn-info'));
echo "</center><br/>";
}
?>
\ No newline at end of file
<div class="page-header">
<h1>Buat Jadwal Baru<small> &nbsp;&nbsp;&nbsp;<?php echo "Satu Kelas Satu Hari Delapan Sesi" ?></small></h1>
</div>
<?php echo $this->renderPartial('_formJadwal', array('model' => $model, 'djadwal' => $djadwal, 'kbk' => $kbk)); ?>
\ No newline at end of file
......@@ -84,10 +84,17 @@ $this->widget('booster.widgets.TbGridView', array(
'SESSION',
'START_TIME',
'END_TIME',
'KODE_MK',
array(
'header' => 'KODE_MK',
'type' => 'raw',
// 'value' => 'CHtml::link($data->KODE_MK,\'https://akademik.del.ac.id/?menu=BrowseKuliah&submenu=detail&ID_KUR=$data->kodemk->ID_KUR&KODE_MK=$data->KODE_MK\')',
'value' => 'CHtml::link(CHtml::encode($data->KODE_MK), "https://akademik.del.ac.id/?menu=BrowseKuliah&submenu=detail&ID_KUR=".CHtml::encode($data->kodemk->ID_KUR)."&KODE_MK=".CHtml::encode($data->KODE_MK))',
),
array(
'header' => 'Mata Kuliah',
'value' => '$data->kodemk->NAMA_KUL_IND'
'type' => 'raw',
// 'value' => 'CHtml::link($data->KODE_MK,\'https://akademik.del.ac.id/?menu=BrowseKuliah&submenu=detail&ID_KUR=$data->kodemk->ID_KUR&KODE_MK=$data->KODE_MK\')',
'value' => 'CHtml::link(CHtml::encode($data->kodemk->NAMA_KUL_IND), "https://akademik.del.ac.id/?menu=BrowseKuliah&submenu=detail&ID_KUR=".CHtml::encode($data->kodemk->ID_KUR)."&KODE_MK=".CHtml::encode($data->KODE_MK))',
),
'RUANGAN',
'AKTIFITAS',
......
<?php
$file_path = dirname(__FILE__) . '\Jadwal2.xls';
//
//$file_path = dirname(__FILE__) . '\Jadual.xlsx';
//
//$sheet_array = Yii::app()->yexcel->readActiveSheet($file_path);
//
//echo "<table>";
//
//foreach ($sheet_array as $row) {
// echo "<tr>";
// foreach ($row as $column)
// echo "<td>$column.'BOS</td>";
// echo "</tr>";
//}
//
//echo "</table>";
//or
//echo first cell of excel file
$sheet_array = Yii::app()->yexcel->readActiveSheet($file_path);
$file = dirname(__FILE__) . '\Jadual.xlsx';
echo "<table>";
Yii::import('application.vendors.phpexcel.PHPExcel', true);
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
//$objReader->setReadDataOnly('true');
$objPHPExcel = $objReader->load($file); //$file --> your filepath and filename
//$objWorksheet = $objPHPExcel->getActiveSheet();
//$highestRow = $objWorksheet->getHighestRow(); // e.g. 10
//$highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F'
//$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5
//echo '<table>' . "\n";
//for ($row = 1; $row <= $highestRow; ++$row) {
// echo '<tr>' . "\n";
// for ($col = 0; $col <= $highestColumnIndex; ++$col) {
// echo '<td>' . $objWorksheet->getCellByColumnAndRow($col, $row)->getValue() . '</td>' . "\n";
// }
// echo '</tr>' . "\n";
//}
//echo '</table>' . "\n";
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
foreach ($sheet_array as $row) {
echo "<tr>";
echo "GAN";
foreach ($row as $column)
echo "<td>$column</td>";
echo "</tr>";
}
$worksheetTitle = $worksheet->getTitle();
if ($worksheetTitle == "31B") {
break;
}
echo "</table>";
//or
//echo first cell of excel file
echo $sheet_array[1]['A'];
$beritahadir = new BeritaAcaraDaftarHadir;
$highestRow = $worksheet->getHighestRow(); // e.g. 10
$highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
$nrColumns = ord($highestColumn) - 64;
echo "<br>The worksheet " . $worksheetTitle . " has ";
echo $nrColumns . ' columns (A-' . $highestColumn . ') ';
echo ' and ' . $highestRow . ' row.';
echo '<br>Data: <table border="1"><tr>';
for ($row = 1; $row <= $highestRow; ++$row) {
echo '<tr>';
for ($col = 0; $col < $highestColumnIndex; ++$col) {
$cell = $worksheet->getCellByColumnAndRow($col, $row);
$val = $cell->getValue();
$dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
// $masterjadwal = new MJadwal;
// $masterjadwal->KELAS = $worksheetTitle;
// $masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue();
// $masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue();
// $masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue();
if (PHPExcel_Shared_Date::isDateTime($worksheet->getCellByColumnAndRow($col, $row))) {
echo '<td>' . PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD") . '</td>';
$masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD");
//$masterjadwal->save();
$row = $row + 2;
$col = $col - 2;
echo '<tr></tr>';
} elseif ($dataType != "null" && $val != "Tanggal") {
echo '<td>' . $val . '</td>';
$detailjadwal = new DJadwal;
$detailjadwal->ID_JADWAL = $masterjadwal->ID;
if ($col == 0) {
$detailjadwal->SESSION = $val;
} elseif ($col == 1) {
$detailjadwal->KODE_MK = $val;
} elseif ($col == 2) {
$detailjadwal->RUANGAN = $val;
} else {
$detailjadwal->AKTIFITAS = $detailjadwal->getAktifitas($val);
}
$beritakuliah = new BeritaAcaraKuliah;
}
}
echo '</tr>';
}
echo '</table>';
}
?>
......@@ -40,7 +40,6 @@
array('label' => 'Logout (' . Yii::app()->user->name . ')<span class="caret"></span>', 'url' => '#', 'itemOptions', 'visible' => !Yii::app()->user->isGuest, 'itemOptions' => array('class' => 'dropdown', 'tabindex' => "-1"), 'linkOptions' => array('class' => 'dropdown-toggle', 'data-toggle' => "dropdown", "data-description" => "Change Password & Logout"),
'items' => array(
array('label' => 'Change Password', 'url' => array('/Account/Update2', 'id' => Yii::app()->user->id)),
array('label' => 'Logout', 'url' => array('Site/logout')),
//array('label' => 'Daftar Hadir', 'url' => array('BeritaAcaraDaftarHadir/searchBeritaAcaraDaftarHadir')),
)),
......
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