Example #1
0
 /**
  * Updates an existing Video model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param string $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $model->url = UrlHelp::translateUrl($model->url);
         if ($model->validate()) {
             $model->save();
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     return $this->render('update', ['model' => $model]);
 }
Example #2
0
 /**
  * Updates an existing Page model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param string $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $model->url = UrlHelp::translateUrl($model->url);
         if ($model->validate()) {
             $model->imageFile = UploadedFile::getInstance($model, 'imageFile');
             if ($model->imageFile) {
                 if ($imgName = $model->upload($model->url)) {
                     $model->img = $imgName;
                 }
             }
             $model->imageFile = null;
             $model->save();
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     return $this->render('update', ['model' => $model]);
 }
Example #3
0
 public static function getUrlImg($img)
 {
     return UrlHelp::baseAdmin() . 'images/item/' . $img;
 }
Example #4
0
 public static function getUrlImg($img)
 {
     return UrlHelp::baseAdmin() . 'images/encyclopedia/' . $img;
 }
Example #5
0
 public static function gerParams($page)
 {
     $r = [];
     $r['Operation']['name'] = self::getName($page);
     $r['Operation']['state'] = self::getAddress($page, 'addressRegion');
     $r['Operation']['city'] = self::getAddress($page, 'addressLocality');
     $r['Operation']['address'] = self::getAddress($page, 'streetAddress');
     $r['Operation']['phone'] = self::getPhone($page);
     $r['Operation']['site'] = self::getSite($page);
     $r['Operation']['postal'] = self::getAddress($page, 'postalCode');
     $r['Operation']['description'] = self::getDescription($page);
     $r['Operation']['url'] = UrlHelp::translateUrl($r['Operation']['name'] . ' ' . $r['Operation']['city'] . ' ' . $r['Operation']['state'] . ' ' . $r['Operation']['postal']);
     $r['categories'] = self::getCategoriesPage($page);
     return $r;
 }
Example #6
0
 public function actionImgdel($id)
 {
     $model = $this->findModel($id);
     Category::delImg($model->img);
     $model->img = null;
     $model->save();
     return $this->redirect(UrlHelp::toRoute(['category/update', 'id' => $model->id]));
 }