예제 #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
파일: 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;
 }