コード例 #1
0
 /**
  * Updates an existing Objeto model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $this->comprobarPermiso();
     $model = $this->findModel($id);
     echo $id;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         $objetos = new CategoriasObjetos();
         $categorias = $objetos->getCategorias();
         $ubicacion = new Ubicaciones();
         $ubicaciones = $ubicacion->getUbicaciones();
         $tc = new TipoCategorias();
         $tiposCategorias = $tc->getTipoCategorias();
         return $this->render('update', ['model' => $model, 'categorias' => $categorias, 'ubicaciones' => $ubicaciones, 'estados' => Objeto::$estados]);
     }
 }