/**
 * 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 loadModel($id)
 {
     $model = Nrk::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #2
0
 public function getNrkNumberOptions()
 {
     $models = Nrk::model()->findAll();
     $options = array();
     foreach ($models as $model) {
         $options[$model->contract_number] = "{$model->contract_number} | {$model->contract_date}";
     }
     return $options;
 }
 public function actionGetContractOptions()
 {
     $parentId = $_POST['nrk_register'];
     $model = Nrk::model()->findAllByAttributes(array('nrk' => $parentId));
     $option = array('0' => 'Please Select');
     //set null value
     $options = CHtml::listData($model, 'nrk_register', 'nrk_contract_number');
     //list data according to your db field
     $options = CMap::mergeArray($option, $options);
     echo json_encode($options);
 }
Example #4
0
<?php

$this->breadcrumbs = array('Nrk Details' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List NrkDetail', 'url' => array('index')), array('label' => 'Create NrkDetail', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('nrk-detail-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>


<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'nrk-detail-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), array('name' => 'nrk_register', 'value' => '$data->nrk_register', 'filter' => Nrk::model()->getNrkOptions()), array('name' => 'nrk_contract_number', 'value' => '$data->nrk_contract_number', 'filter' => Nrk::model()->getNrkNumberOptions()), array('name' => 'termin', 'value' => '$data->termin', 'filter' => VEnum::getEnumOptions(new NrkDetail(), "termin")), array("name" => "limit_per_termin", "value" => 'Yii::app()->format->number($data->limit_per_termin)', 'htmlOptions' => array('style' => 'text-align: right;'), 'headerHtmlOptions' => array('style' => 'text-align: right;'), 'filter' => FALSE), array('class' => 'bootstrap.widgets.TbButtonColumn'))));