Skip to content

Instantly share code, notes, and snippets.

@ruliarmando
Created June 10, 2014 11:09
Show Gist options
  • Save ruliarmando/8530f04e9653ed7d3185 to your computer and use it in GitHub Desktop.
Save ruliarmando/8530f04e9653ed7d3185 to your computer and use it in GitHub Desktop.
implement jappendo
// protected/controllers/MahasiswaController.php
public function actionAbsen(){
$dataProvider = new CActiveDataProvider('Kehadiran', array(
'criteria'=>array(
'condition'=>'nim='.Yii::app()->user->name,
'with'=>array('pertemuan'),
),
));
$this->render('absen', array(
'dataProvider'=>$dataProvider,
));
}
// protected/views/mahasiswa/absensi.php
<?php
$this->breadcrumbs=array(
'Pertemuan & Absensi',
);
$this->menu=array(
array('label'=>'Menu'),
array('label'=>'Daftar Absensi', 'url'=>array('daftar', 'id'=>Yii::app()->user->id), 'icon'=>'book'),
);
?>
<h1>Pertemuan & Absensi</h1>
<div class="well">
<?php if(Yii::app()->user->hasFlash('message')): ?>
<div class="alert alert-block">
<a class="close" data-dismiss="alert">×</a>
<h4 class="alert-heading">Pesan!</h4>
<?php echo Yii::app()->user->getFlash('message'); ?>
</div><br />
<?php endif; ?>
<?php echo CHtml::beginForm($this->createUrl('kehadiran/absen', array('id'=>Yii::app()->user->id)), 'post', array('class'=>'form-horizontal')); ?>
<div class="control-group">
<?php echo CHtml::label('Tanggal', 'tanggal', array('class'=>'control-label')); ?>
<div class="controls">
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'tanggal',
'options'=>array(
'showAnim'=>'fold',
'dateFormat' => 'yy-mm-dd',
),
));?>
</div>
</div>
<div class="control-group">
<?php echo CHtml::label('Pertemuan Ke', 'ke', array('class'=>'control-label'));?>
<?php
$ke = array();
for($i=1;$i<=16;$i++){
$ke[$i] = $i;
}
?>
<div class="controls">
<?php echo CHtml::dropDownList('ke','', $ke, array('prompt'=>'--pilih--')); ?>
</div>
</div>
<div class="control-group">
<?php echo CHtml::label('Batas Materi', 'batas', array('class'=>'control-label')); ?>
<div class="controls">
<?php echo CHtml::textField('batas'); ?>
</div>
</div>
<?php $this->widget('ext.appendo.JAppendo',array(
'id' => 'repeateEnum',
'model' => $kehadiran,
'viewName' => 'enumerations',
'labelDel' => 'Remove Row',
)); ?>
<div class="form-actions">
<?php echo CHtml::submitButton('Save', array('class'=>'btn btn-primary')); ?>
</div>
<?php echo CHtml::endForm(); ?>
</div>
// protected/extensions/appendo/views/enumerations.php
<table class="appendo-gii" id="<?php echo $id ?>" style="margin-bottom:10px;">
<thead>
<tr>
<th>NIM</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width:150px;"><?php echo CHtml::dropDownList('enum_nim[]','', Yii::app()->user->getState('list_nim'), array('style'=>'width:140px')); ?></td>
<td>
<?php echo CHtml::dropDownList('enum_status[]',"",
array(
"alpha"=>"Alpha",
"sakit"=>"Sakit",
),array('style'=>'width:100px', 'prompt'=>'--pilih--')
);
?>
</td>
</tr>
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment