示例#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]);
 }
示例#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]);
 }
示例#3
0
文件: Item.php 项目: comaw/hashtag
 public static function getUrlImg($img)
 {
     return UrlHelp::baseAdmin() . 'images/item/' . $img;
 }
示例#4
0
 public static function getUrlImg($img)
 {
     return UrlHelp::baseAdmin() . 'images/encyclopedia/' . $img;
 }
示例#5
0
文件: Operation.php 项目: comaw/pars
 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;
 }
示例#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]));
 }