コード例 #1
0
ファイル: ArtikelController.php プロジェクト: budisyaa/SIPP
 public function actionCreate()
 {
     IsAuth::Admin();
     $model = new Artikel();
     if (isset($_POST['Artikel'])) {
         $model->attributes = $_POST['Artikel'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->ID_ARTIKEL));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Artikel();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Artikel'])) {
         $model->attributes = $_POST['Artikel'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id_artikel));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #3
0
 public function actionAArtikel($id)
 {
     $Artikel = new Artikel();
     $Views = View::model()->findAll();
     $katagorys = Katagory::model()->findAll('view_id_view =' . $id);
     if (isset($_POST['Artikel'])) {
         $Artikel->attributes = $_POST['Artikel'];
         $Artikel->png_artikel = Yii::app()->user->name;
         $kats = $_POST['a'];
         if ($Artikel->save()) {
             foreach ($kats as $kat) {
                 $hub = new KatagoryHasArtikel();
                 $hub->artikel_id_artikel = $Artikel->id_artikel;
                 $hub->katagory_id_katagory = (int) $kat;
                 $hub->save();
             }
         }
         $this->redirect(array('lartikel', 'fitback' => 4));
     }
     $this->render('aartikel', array('id' => $id, 'Artikel' => $Artikel, 'katagorys' => $katagorys, 'Views' => $Views));
 }