/** * 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')))))));