Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CourseType::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ct_id' => $this->ct_id]);
     $query->andFilterWhere(['like', 'ct_desc', $this->ct_desc]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClssCt()
 {
     return $this->hasOne(CourseType::className(), ['ct_id' => 'clss_ct_id']);
 }
Esempio n. 3
0
 /**
  * Finds the CourseType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CourseType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CourseType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 4
0
<div class="course-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
// $form->field($model, 'crs_id')->textInput()
?>
  	
  	<?php 
if ($model->isNewRecord) {
    ?>
  	
         <?php 
    echo $form->field($model, 'crs_ct_id')->dropDownList(ArrayHelper::map(CourseType::find()->asArray()->all(), 'ct_id', 'ct_desc'), ['prompt' => '-Choose a Course Type-']);
    ?>
   
 
    <?php 
} else {
    ?>
    
           <?php 
    echo DetailView::widget(['model' => $model, 'attributes' => [['label' => 'Course Type', 'format' => 'text', 'value' => $model->crsCt->ct_desc]]]);
    ?>
    
    
    <?php 
}
?>