/** * 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 PayrollAllowances the loaded model * @throws CHttpException */ public function loadModel($id) { $model = PayrollAllowances::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php echo CHtml::activeDropDownList($model, 'allowance_id', CHtml::listData(PayrollAllowances::model()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'class' => 'validate[required] form-control select')); ?> <?php echo CHtml::error($model, 'allowance_id'); ?> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'calc_type', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeDropDownList($model, 'calc_type', PayrollAllowances::model()->getAllowanceType(), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'class' => 'validate[required] form-control select')); ?> <?php echo CHtml::error($model, 'calc_type'); ?> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'formula', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeTextField($model, 'formula', array('size' => 60, 'maxlength' => 255, 'class' => 'validate[required] form-control')); ?>