/**
  * 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 ReportTemplate the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ReportTemplate::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#2
0
            <?php 
if ($_GET['yt0'] == "load" && !empty($_GET['Challan']['load_temp_name'])) {
    $data = ReportTemplate::model()->findByPk($_GET['Challan']['load_temp_name']);
    $options = array();
    $d = explode(",", $data['fields']);
    foreach ($d as $i => $v) {
        $options[$v] = array("selected" => true);
    }
    // print_r($options);exit;
} elseif (!empty($_GET['Challan']['fields'])) {
    $options = array();
    foreach ($_GET['Challan']['fields'] as $i => $v) {
        $options[$v] = array("selected" => true);
    }
}
echo $form->dropDownList($model, 'load_temp_name', CHtml::listData(ReportTemplate::model()->findAllByAttributes(array('user_id' => Yii::app()->user->Id), array('order' => 'name ASC')), 'id', 'name'), array('options' => array($_GET['Challan']['load_temp_name'] => array('selected' => true))), array('empty' => 'Select Template', 'style' => 'float:left;'));
?>
 
            
            <span class="" style="margin-left:10px;">
                <?php 
echo TbHtml::submitButton('Load Template', array('value' => 'load', 'color' => TbHtml::BUTTON_COLOR_SUCCESS, 'style' => 'margin-bottom:10px;'));
?>
            </span>
            <span class="" style="margin-left:10px;">
                <?php 
echo CHtml::link(CHtml::button('Manage Template', array('class' => 'btn btn-info', 'disabled' => $mode, 'style' => 'margin-bottom:10px')), Yii::app()->createUrl('/reportTemplate/admin'));
?>
               
            </span>
        </div>