Пример #1
0
 /**
  * Creates a new Przedmiot model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($step, $pid = null)
 {
     $forModal = null;
     switch ($step) {
         case '13':
             $model = new KierunekStudiow();
             $searchModel = new KierunekSearch();
             $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
             break;
         case '13a':
             $kierunek = KierunekStudiow::findOne($pid);
             $model = new Przedmiot();
             if ($model->load(Yii::$app->request->post()) && $model->save()) {
                 $step = '14';
                 return $this->redirect(['create', 'step' => $step, 'pid' => $model->id]);
             } else {
                 return $this->render('create', ['step' => $step, 'model' => $model, 'kierunek' => $kierunek]);
             }
             break;
         case '14':
             if (Yii::$app->request->isPost) {
                 foreach (Yii::$app->request->post()['KeksOdBabci'] as $kek) {
                     $model = new PrzedmiotKek();
                     $model->przedmiot_id = $pid;
                     $model->kek_id = $kek;
                     $model->save();
                 }
             }
             $searchModel = new KekSearch();
             $dataProvider = $searchModel->search(['przedmiotId' => $pid]);
             $model = new Kek();
             $przedmiot = Przedmiot::findOne($pid);
             return $this->render('create', ['model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'step' => $step, 'przedmiot' => $przedmiot, 'forModal' => $forModal]);
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['create', 'model' => $model]);
         $step = $step++;
     }
     return $this->render('create', ['model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'step' => $step, 'forModal' => $forModal]);
     //			return $this->redirect(['create', 'step'=>'14']);
     /*else{
      		if($step==4 && $forModal->load(Yii::$app->request->post()) && $forModal->save()){
      			$forModal = new CelKP();
      		}
      		
      	}*/
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getKierunekStudiow()
 {
     return $this->hasOne(KierunekStudiow::className(), ['id' => 'kierunekStudiow_id']);
 }