Esempio n. 1
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate()
 {
     if (!empty($_POST["ExBanner"])) {
         if ($this->id > 0) {
             $model = ExBanner::fetch($this->id);
         } else {
             $model = new ExBanner();
         }
         $message = "";
         // Сохрание полей
         $model->setAttributesFromArray($_POST["ExBanner"]);
         if ($model->save()) {
             $message = "Данные успешно сохраненны";
         } else {
             print_r($model->getErrors());
         }
         $this->render('edit', array('form' => $model, 'message' => $message));
     }
     //else $this->redirect( SiteHelper::createUrl("/console/banners") );
 }