public function actionMulti($multi)
 {
     $this->pageTitle = 'Viele Angebote im ' . $this->pageTitle;
     foreach (array(' ', '+', ',') as $char) {
         if (strpos($multi, $char)) {
             $multi = explode($char, $multi);
             break;
         }
     }
     $criteria = new CDbCriteria();
     $criteria->order = "sort";
     $multiModels = array();
     foreach ($multi as $key) {
         $models = Categorypage::model()->findAllbyAttributes(array('categorykey' => $key), $criteria);
         if ($models != array()) {
             $multiModels[] = $models;
         }
     }
     $this->render('multi', array('multiModels' => $multiModels));
 }
Example #2
0
 public function actionGet()
 {
     if (!($model = $this->loadModel(true))) {
         $forwardArray = array();
         if (isset($forwardArray[$_GET['key']])) {
             $tmp = Page::model();
             $tmp->key = $forwardArray[$_GET['key']][0];
             $this->redirectModel($tmp, 301);
             return;
         }
         if ($model = Categorypage::model()->findbyAttributes(array('categorykey' => $_GET['key']))) {
             $this->forward('/page/categorypage/get', array('key' => $_GET['key']));
             return;
         }
         if (Yii::app()->params['enableTags'] && Page::model()->taggedWith($_GET['key'])->count()) {
             $this->forward('/page/page/tag', array('key' => $_GET['key']));
             return;
         }
         if (!Yii::app()->user->isGuest) {
             $this->bottomAdmin = CHtml::link('Seite anlegen', array('page/create', 'key' => $_GET['key']));
         }
         $this->render404();
         return;
     }
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/../../../assets');
     if ($model->key == 'mantrasingen') {
         Yii::app()->clientScript->registerCssFile($this->baseUrl . 'css/mantra.css');
         Yii::app()->clientScript->registerScriptFile($assets . '/flowplayer/flowplayer-3.2.12.min.js');
     }
     // TODO make this more generic so you can turn it on or off
     if ($model->key == 'weihnachtsseminar' || $model->key == 'gutscheinverkauf_weihnachten') {
         Yii::app()->clientScript->registerScriptFile($assets . '/jquery.snow.min.js');
         Yii::app()->clientScript->registerScript(__CLASS__ . 'weihnachtsseminar', '$.fn.snow({ maxSize: 50, newOn: 1000 });');
         Yii::app()->clientScript->registerCss(__CLASS__ . 'weihnachtsseminar', '#flake {color:#09f}');
         Yii::app()->clientScript->registerCoreScript('jquery');
     }
     if ($model->active) {
         if (ltrim($model->meta_title) != '') {
             $this->pageTitle = $model->meta_title . ' im ' . $this->pageTitle;
         }
         if (ltrim($model->meta_description) != '') {
             Yii::app()->clientScript->registerMetaTag($model->meta_description, 'description');
         }
         if (ltrim($model->meta_keyword) != '') {
             Yii::app()->clientScript->registerMetaTag($model->meta_keyword, 'keywords');
         }
     }
     if ($viewFile = $this->getViewFile($model->key) !== false) {
         $this->render($model->key);
     } else {
         $this->generateCanonicalUrl($model);
         $view = $model->active ? 'get' : 'get_inactive';
         $this->render($view, array('model' => $model));
     }
 }
Example #3
0
 public function getCategory()
 {
     static $cache = array();
     if (!isset($cache[$this->id])) {
         $model = Categorypage::model()->findByAttributes(array('pagekey' => $this->key));
         $cache[$this->id] = $model;
     }
     return $cache[$this->id];
 }