<?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 loadModel($id)
 {
     $model = gPerson::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionSummary($pid)
 {
     $pdf = new leaveFormSum('P', 'mm', 'A4');
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', 12);
     $criteria = new CDbCriteria();
     $criteria->with = array('leaveAll');
     //$criteria->together=true;
     $criteria->condition = 'leaveAll.approved_id = 2 or leaveAll.approved_id = 9';
     $criteria->compare('t.id', (int) $pid);
     $models = gPerson::model()->find($criteria);
     $pdf->report($models);
     $pdf->Output();
 }
$this->menu = array(array('label' => 'Home', 'url' => array('/m1/gLeave')));
$this->menu1 = gLeave::getTopUpdated();
$this->menu2 = gLeave::getTopCreated();
$this->menu5 = array('Leave');
?>

<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'), 'active' => true), 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')))));
?>

<?php 
$this->widget('bootstrap.widgets.BootGridView', array('id' => 'g-person-grid', 'dataProvider' => gPerson::model()->listWaitingApproval(), 'columns' => array(array('header' => 'Name', 'type' => 'raw', 'value' => 'CHtml::link($data->vc_psnama,Yii::app()->createUrl("/m1/gLeave/view",array("id"=>$data->id)))'), array('header' => 'Unit', 'value' => 'isset($data->position->unit) ? $data->position->unit->name: ""'), 'position.c_departkr', 'leave.d_dari', 'leave.d_sampai', 'leave.n_jmlhari', 'leaveBalance.n_sisacuti', array('header' => 'Status', 'value' => '$data->leave->approved->name'), array('class' => 'bootstrap.widgets.BootButtonColumn', 'template' => '{update}{delete}', 'updateButtonUrl' => 'Yii::app()->createUrl("/m1/gLeave/update",array("id"=>$data->leave->id))', 'deleteButtonUrl' => 'Yii::app()->createUrl("/m1/gLeave/delete",array("id"=>$data->leave->id))'), array('class' => 'BootButtonColumn', 'template' => '{approved}', 'buttons' => array('approved' => array('label' => 'Approved', 'url' => 'Yii::app()->createUrl("/m1/gLeave/approved",array("id"=>$data->leave->id,"pid"=>$data->id))', 'visible' => '$data->leave->approved_id ==1', 'options' => array('ajax' => array('type' => 'GET', 'url' => "js:\$(this).attr('href')", 'success' => 'js:function(data){
														$.fn.yiiGridView.update("g-person-grid", {
														data: $(this).serialize()
													});
													}'), 'class' => 'btn btn-mini')))))));
<?php

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

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

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


<?php 
$this->widget('bootstrap.widgets.BootListView', array('dataProvider' => $dataProvider, 'itemView' => '/gPerson/_view'));
 public static function getTopUpdated()
 {
     $models = gPerson::model()->findAll(array('limit' => 10, 'order' => 'updated_date DESC'));
     $returnarray = array();
     foreach ($models as $model) {
         $_nama = strlen($model->vc_psnama) > 15 ? substr($model->vc_psnama, 0, 15) . "..." : $model->vc_psnama;
         $returnarray[] = array('id' => $model->id, 'label' => $_nama, 'icon' => 'list-alt', 'url' => array('/m1/gLeave/view', 'id' => $model->id));
     }
     return $returnarray;
 }
$this->menu1 = gLeave::getTopUpdated();
$this->menu2 = gLeave::getTopCreated();
$this->menu5 = array('Leave');
?>

<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'), 'active' => true), array('label' => 'Employee On Leave', 'url' => Yii::app()->createUrl('/m1/gLeave/onLeave')), array('label' => 'Recent Leave', 'url' => Yii::app()->createUrl('/m1/gLeave/recentLeave')))));
?>


<?php 
$this->widget('bootstrap.widgets.BootGridView', array('id' => 'g-person-grid', 'dataProvider' => gPerson::model()->onPending(), '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', array('header' => 'Status', 'value' => '$data->leave->approved->name'), array('class' => 'BootButtonColumn', 'template' => '{unblock}', 'buttons' => array('unblock' => array('label' => 'Unblock', 'url' => 'Yii::app()->createUrl("/m1/gLeave/unblock",array("id"=>$data->leave->id,"pid"=>$data->id))', 'visible' => '$data->leave->approved_id ==4', 'options' => array('ajax' => array('type' => 'GET', 'url' => "js:\$(this).attr('href')", 'success' => 'js:function(data){
														$.fn.yiiGridView.update("g-person-grid", {
														data: $(this).serialize()
});
}'), 'class' => 'btn btn-mini')))))));
<div class="row">
	<div class="span3 well">
		<?php 
if ($model->c_pathfoto == null || !is_file(Yii::app()->request->baseUrl . "/images/employee/" . $model->c_pathfoto)) {
    //echo CHtml::image(Yii::app()->request->baseUrl . "/images/nophoto.jpg", "No Photo", array("class"=>"span2"));
    $this->widget('ext.espaceholder.ESpaceHolder', array('size' => '140x200', 'text' => CHtml::encode($model->vc_psnama), 'htmlOptions' => array('title' => 'test image')));
} else {
    echo CHtml::image(Yii::app()->request->baseUrl . "/images/employee/" . $model->c_pathfoto, CHtml::encode($model->vc_psnama), array("class" => "span2"));
}
?>
	</div>
	<div class="span9">
		<?php 
$this->widget('bootstrap.widgets.BootDetailView', array('data' => $model, 'attributes' => array(array('header' => 'Personal Data'), 'c_hriskd', 'c_pskode', array('label' => 'Birth Place', 'value' => isset($model->birthplace) ? $model->birthplace->name : ""), 'd_pstgllhr', array('label' => 'Sex', 'value' => isset($model->sex) ? $model->sex->name : ""), array('label' => 'Religion', 'value' => $model->religion->name), array('label' => 'Marital Status', 'value' => $model->maritalstatus->name), array('label' => 'SF', 'value' => $model->sf->name), array('header' => 'Parents Data'), 'c_rfkwarga', 't_domalamat', 'vc_domkec', 'c_domcity', 'c_dompos', 'c_psktp', 'd_psktp', 't_psalamat', 'vc_pskec', 'c_rfcity', 'c_pskdpos', 'vc_psemail', 'vc_psemail2')));
?>

	</div>
</div>

<hr />

<div class="row-fluid">
	<div class="span12">
		<h3>Related Employee</h3>
		<?php 
$this->widget('bootstrap.widgets.BootGridView', array('id' => 'g-person-grid', 'dataProvider' => gPerson::model()->search(), 'template' => '{items}', 'columns' => array(array('header' => 'Name', 'type' => 'raw', 'value' => 'CHtml::link($data->vc_psnama,Yii::app()->createUrl("/m1/gPerson/view",array("id"=>$data->id)))'), 'c_hriskd', 'c_proyek', 'c_pt', 'c_direktorat', 'c_pskode')));
?>
	</div>
</div>