/**
  * Carga valores de un articulo de un propietario
  * @param $id_articulo
  * @return array|null|\yii\db\ActiveRecord
  */
 public function cargarArticulo()
 {
     if ($this->articulo === null) {
         $this->articulo = Articulos::findOne($this->idarticulo);
     }
     return $this->articulo;
 }
 /**
  * Carga valores de un articulo de un propietario
  * @param $id_articulo
  * @return array|null|\yii\db\ActiveRecord
  */
 public function cargarArticulo()
 {
     if ($this->articulo === null) {
         $this->articulo = Articulos::findOne($this->idarticulo);
         $this->nombre = $this->articulo->nombre;
         $this->descripcion = $this->articulo->descripcion;
         $this->estado = $this->articulo->estado;
         $this->categoria = $this->articulo->categoria;
         $this->precio = $this->articulo->precio;
         $this->transacciones = $this->articulo->transacciones != Articulos::NO_ESPECIFICADO ? explode(',', $this->articulo->transacciones) : Articulos::NO_ESPECIFICADO;
         $this->articulo->transacciones = $this->articulo->transacciones != Articulos::NO_ESPECIFICADO ? explode(',', $this->articulo->transacciones) : Articulos::NO_ESPECIFICADO;
     }
     return $this->articulo;
 }
Beispiel #3
0
 /**
  * VISTA DENUNCIA
  * @param $articulo
  * @return mixed
  */
 public function run($articulo)
 {
     $articulo = Articulos::findOne($articulo);
     $model = new Denuncias();
     //enviar denuncia
     if ($model->load(Yii::$app->request->post())) {
         $id_usuario = '';
         if (!Yii::$app->user->isGuest) {
             $id_usuario = Yii::$app->user->identity->getId();
         }
         $model->cargarValores($articulo->idarticulo, $articulo->usuario, $id_usuario);
         if ($model->crearDenuncia()) {
             return $this->controller->goHome();
         }
     }
     if (!empty($articulo)) {
         return $this->controller->render('denunciar', ['model' => $model, 'articulo' => $articulo]);
     }
     return $this->controller->goHome();
 }
Beispiel #4
0
 /**
  * Finds the Articulos model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Articulos the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModelArticulo($id)
 {
     if (($model = Articulos::findOne($id)) !== null) {
         return $model;
     }
 }
Beispiel #5
0
 public function actionDemo($id)
 {
     return Articulos::findOne($id);
 }
 /**
  * Finds the Usuarios model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Categorias the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Articulos::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }