/**
  * 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 CharacteristicPlatforms the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = CharacteristicPlatforms::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #2
0
 public function actionSelectdos1()
 {
     //$id_cri = $_POST['TestCase']['id_criteria'];
     $id_cha = $_POST['TestCase']['id_characteristic'];
     // $sql = 'SELECT id_platform FROM characteristic_platforms WHERE '.$id_cri.'=id_characteristic';
     //$list= Yii::app()->db->createCommand($sql)->queryAll();
     /*$rs=array();
       foreach($list as $item){
           //process each item here
           $rs[]=$item['id_platform'];
       }*/
     echo CHtml::tag('option', array('value' => ''), 'Select', TRUE);
     $lista = CharacteristicPlatforms::model()->findAll('id_characteristic  = :id_cha', array(':id_cha' => $id_cha));
     $lista = CHtml::listData($lista, 'id', 'name');
     //var_dump($lista);
     foreach ($lista as $valor => $name) {
         echo CHtml::tag('option', array('value' => $valor), CHtml::encode($name), true);
     }
 }