예제 #1
0
 /**
  * Creates a new EducationLevel model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Course();
     $fact_id = Yii::$app->getRequest()->getQueryParam('id');
     //ambil id dkat parameter
     /* print_r($fact_id);
        die();*/
     $data['university'] = "";
     $data['hasRecord'] = "";
     if (empty($fact_id)) {
         $data['university'] = University::find()->indexBy('uni_id')->asArray()->all();
         $data['hasRecord'] = 0;
     } else {
         $data['university'] = Institution::getUniFaculty($fact_id);
         $data['hasRecord'] = 1;
     }
     return $this->render('create', $data);
     /*if ($model->load(Yii::$app->request->post()) && $model->save()) {
           return $this->redirect(['view', 'id' => $model->course_id]);
       } else {
           return $this->render('create', [
               'model' => $model,
           ]);
       }*/
 }