<?php

$this->breadcrumbs = array('G people');
$this->menu = array(array('label' => 'Home', 'url' => array('/m1/gLeave')));
$this->menu1 = gLeave::getTopUpdated();
$this->menu2 = gLeave::getTopCreated();
?>

<div class="pull-right">
	<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div>

<div class="page-header">
	<h1>
		<?php 
echo CHtml::image(Yii::app()->request->baseUrl . '/images/icon/user.png');
?>
		Leave
	</h1>
</div>

<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'pills', 'stacked' => false, 'items' => array(array('label' => 'Waiting for Approval', 'url' => Yii::app()->createUrl('/m1/gLeave')), array('label' => 'Pending State', 'url' => Yii::app()->createUrl('/m1/gLeave/onPending')), array('label' => 'Employee On Leave', 'url' => Yii::app()->createUrl('/m1/gLeave/onLeave')), array('label' => 'Recent Leave', 'url' => Yii::app()->createUrl('/m1/gLeave/recentLeave'), 'active' => true))));
?>

<?php 
$this->widget('bootstrap.widgets.BootGridView', array('id' => 'g-person-grid', 'dataProvider' => gPerson::model()->recentLeave(), 'template' => '{items}', 'columns' => array(array('header' => 'Name', 'type' => 'raw', 'value' => 'CHtml::link($data->vc_psnama,Yii::app()->createUrl("/m1/gLeave/view",array("id"=>$data->id)))'), 'position.unit.name', 'position.c_departkr', 'leave.d_dari', 'leave.d_sampai', 'leave.n_jmlhari', 'leaveBalance.n_sisacuti')));
 /**
  * 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 loadModelLeave($id)
 {
     $model = gLeave::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionPrint($id, $pid)
 {
     $pdf = new leaveForm('P', 'mm', 'A4');
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', 12);
     $model = gLeave::model()->findByPk((int) $id);
     $pdf->report($model);
     $pdf->Output();
 }
<div class="row-fluid">
	<div class="span12">
		<?php 
$this->widget('bootstrap.widgets.BootDetailView', array('data' => array('id' => 1, 'unit_joindate' => $model->d_joinunit, 'group_joindate' => $model->d_joingrp), 'attributes' => array(array('name' => 'unit_joindate', 'label' => 'Unit Join Date'), array('name' => 'group_joindate', 'label' => 'Group Join Date'))));
?>
	</div>
</div>

<?php 
$this->widget('bootstrap.widgets.BootGridView', array('id' => 'g-person-grid', 'dataProvider' => gLeave::model()->search($model->id), 'template' => '{items}', 'columns' => array('d_dari', 'd_sampai', 'n_jmlhari', 'd_h_masuk', 'r_cuti', 'n_cutiii', 'c_masal', 'c_pribadi', 'n_sisacuti', 'c_ganti', array('header' => 'State', 'value' => '$data->approved->name'), array('class' => 'BootButtonColumn', 'template' => '{print}', 'buttons' => array('print' => array('label' => 'Print', 'url' => 'Yii::app()->createUrl("/m1/gLeaveEss/print",array("id"=>$data->id,"pid"=>$data->person->id))', 'visible' => '$data->approved_id ==1', 'options' => array('class' => 'btn btn-mini', 'target' => '_blank')))), array('class' => 'BootButtonColumn', 'template' => '{summary}', 'buttons' => array('summary' => array('label' => 'Summary', 'url' => 'Yii::app()->createUrl("/m1/gLeaveEss/summary",array("pid"=>$data->person->id))', 'visible' => '$data->approved_id ==1', 'options' => array('class' => 'btn btn-mini', 'target' => '_blank')))))));