/** * 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 $id the ID of the model to be loaded * @return PayrollBasedAllowances the loaded model * @throws CHttpException */ public function loadModel($id) { $model = PayrollBasedAllowances::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $allowances = $model->payrollBasedAllowances; ?> <div class="custom-panel-heading"> <?php echo CHtml::link(at('Add Allowance'), array('create'), array('class' => 'btn btn-primary', 'id' => 'new-allowance')); ?> </div> <?php $this->widget('CGridView', array('id' => 'payroll-based-allowances-grid', 'itemsCssClass' => 'table datatable', 'dataProvider' => PayrollBasedAllowances::model()->searchAllowances($model->id), 'columns' => array(array('name' => 'id', 'header' => '#', 'htmlOptions' => array('style' => 'width:50px;')), array('name' => 'allowance_id', 'header' => at('Allowance'), 'value' => '$data->allowance->name'), array('name' => 'calc_type', 'header' => at('Type')), array('name' => 'formula', 'header' => at('Formula')), array('name' => 'values', 'header' => at('Values'), 'value' => 'formatCurrency($data->values)'), array('class' => 'CButtonColumn', 'htmlOptions' => array('style' => 'width: 70px')))));