Exemple #1
0
 public function run($language = null)
 {
     $this->verifyTable();
     /*
     * получаем все возможные сслыки по Иерархии
     * Пример: исходная ссылка "site/product/type/34"
     * Результат:   - site/product/type/34/*
                    - site/product/type/34
                    - site/product/type/*
                    - site/product/type
                    - site/product/*
                    - site/product
                    - site/*
                    - site
                    - /*
                    - /
     */
     $urls = $this->getUrls();
     foreach ($urls as $url) {
         $crt = new CDbCriteria();
         $crt->condition = "url = :param";
         $crt->params = array(":param" => $url);
         if ($language != null) {
             $crt->addCondition("language = '" . $language . "'", 'AND');
         }
         $urlF = YiiseoUrl::model()->find($crt);
         if ($urlF !== null) {
             $this->seoName($urlF->id);
         }
     }
     $propertyExist = YiiseoProperty::model()->findAll();
     if (count($propertyExist)) {
         $boolean = false;
         foreach ($urls as $url) {
             $crt = new CDbCriteria();
             $crt->condition = "url = :param";
             $crt->params = array(":param" => $url);
             if ($language != null) {
                 $crt->addCondition("language = '" . $language . "'", 'AND');
             }
             $urlF = YiiseoUrl::model()->find($crt);
             if ($urlF !== null) {
                 $boolean = $this->seoProperty($urlF->id);
             }
             if ($boolean) {
                 break;
             }
         }
     }
 }
Exemple #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = YiiseoUrl::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }