예제 #1
0
 /**
  * Updates an existing Kierunek model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id = null)
 {
     $forModal = new Kek();
     $searchModel = new KekSearch();
     $model = $searchModel->search(['kierunekStudiow' => $id]);
     if ($forModal->load(Yii::$app->request->post()) && $forModal->save()) {
         $forModal = new Kek();
     }
     return $this->render('update', ['model' => $model, 'id' => $id, 'forModal' => $forModal]);
 }
예제 #2
0
 public function actionIndex($kid = null)
 {
     //     	if(is_null($kid))
     //     	{
     //     		return $this->render('kierunki');
     //     	}
     //     	else
     //     	{
     $searchModel = new KekSearch();
     Yii::trace(Yii::$app->request->getQueryParams());
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     //     		}
 }
예제 #3
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();
      		}
      		
      	}*/
 }