Ejemplo n.º 1
0
 /**
  * Creates a new Registro model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Registro();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 /**
  * Renders the index view for the module
  * @return string
  */
 public function actionIndex()
 {
     $new = new Registro();
     $searchModel = new RegistroSearch();
     $dataProvider = $searchModel->searchActive(Yii::$app->request->queryParams);
     if ($new->load(Yii::$app->request->post())) {
         $new->save();
     }
     $cadenas = ArrayHelper::map(Cadena::find()->where(['status' => 'active'])->orderBy('titulo')->all(), 'id', 'titulo');
     $almacenes = ArrayHelper::map(Almacen::find()->where(['status' => 'active'])->orderBy('identificador')->all(), 'id', 'identificador');
     $categorias = ArrayHelper::map(Categoria::find()->where(['status' => 'active'])->orderBy('titulo')->all(), 'id', 'titulo');
     return $this->render('index', ['new' => $new, 'cadenas' => $cadenas, 'almacenes' => $almacenes, 'categorias' => $categorias, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }