public function loadModel($id) { $m = FcsrCourrencySource::model(); // apply scope, if available $scopes = $m->scopes(); if (isset($scopes[$this->scope])) { $m->{$this->scope}(); } $model = $m->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('FcrnModule.crud_static', 'The requested page does not exist.')); } return $model; }
<?php $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t("FcrnModule.crud_static", "Load"), 'icon' => 'icon-plus', 'size' => 'large', 'type' => 'success', 'url' => array('create'))); ?> </div> <div class="btn-group"> <h1> <i class="icon-dollar"></i> <i class="icon-eur"></i> <?php echo Yii::t('FcrnModule.crud', 'Fcrt Currency Rates'); ?> </h1> </div> <div class="btn-group"> <?php // $this->widget("bootstrap.widgets.TbButton", array( // "label" => Yii::t("D2companyModule.crud_static", "Export"), // "url" => array("admin","export" => " xls"), // 'size'=>'large', // 'type'=>'success', // "visible" => Yii::app()->user->checkAccess("Company.*"), // //"htmlOptions"=>array("class"=>"export-button") // )); ?> </div> </div> </div> <?php $this->widget('TbGridView', array('id' => 'fcrt-currency-rate-grid', 'dataProvider' => $model->search(), 'template' => '{items}{pager}{summary}', 'filter' => $model, 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('name' => 'fcrt_fcsr_id', 'value' => 'CHtml::value($data,\'fcrtFcsr.fcsr_name\')', 'filter' => CHtml::listData(FcsrCourrencySource::model()->findAll(), 'fcsr_id', 'fcsr_name')), array('name' => 'fcrt_base_fcrn_id', 'value' => 'CHtml::value($data,\'fcrtBaseFcrn.fcrn_code\')', 'filter' => CHtml::listData(FcrnCurrency::model()->findAll(), 'fcrn_id', 'fcrn_code')), array('name' => 'fcrt_fcrn_id', 'value' => 'CHtml::value($data,\'fcrtFcrn.fcrn_code\')', 'filter' => CHtml::listData(FcrnCurrency::model()->findAll(), 'fcrn_id', 'fcrn_code')), 'fcrt_date', 'fcrt_rate')));
public function actionAdmin($fcrt_fcsr_id = FALSE, $fcrt_fcrn_id = FALSE) { //currency source $mFcsr = FcsrCourrencySource::model()->findAll(); if (!$fcrt_fcsr_id) { $fcrt_fcsr_id = $mFcsr[0]->fcsr_id; $fcrt_fcrn_id = $mFcsr[0]->fcsr_base_fcrn_id; $fcrt_date = date('Y.d.m'); } // if (isset($_POST['fcrt_date'])) { // $fcrt_date = $_POST['fcrt_date']; // } // if(!$fcrt_date){ // $fcrt_date = date("Y-m-d"); // } $model = new FcrtCurrencyRate('search'); $scopes = $model->scopes(); if (isset($scopes[$this->scope])) { $model->{$this->scope}(); } //get submited filter parmeters and add additional param $model->unsetAttributes(); $aAtributes = array(); if (isset($_GET['FcrtCurrencyRate'])) { $aAtributes = $_GET['FcrtCurrencyRate']; } $aAtributes['fcrt_fcsr_id'] = $fcrt_fcsr_id; $model->attributes = $aAtributes; $this->render('admin', array('model' => $model, 'fcrt_fcsr_id' => $fcrt_fcsr_id, 'fcrt_fcrn_id' => $fcrt_fcrn_id)); }