diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-06-25 23:31:16 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-06-25 23:31:16 +0200 |
| commit | d58f7cf02dc0c5ce2df2f0db00361fe673074be8 (patch) | |
| tree | de5b7064e43255a471de4cb469a7db71bce3d328 /protected/modules/cms/components/MenuWidget.php | |
| parent | 82f5b7dc1890c03ebec349225e76ea0b22ec6c1d (diff) | |
Änderungen das alles tut, editor, cms
Diffstat (limited to 'protected/modules/cms/components/MenuWidget.php')
| -rw-r--r-- | protected/modules/cms/components/MenuWidget.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/protected/modules/cms/components/MenuWidget.php b/protected/modules/cms/components/MenuWidget.php new file mode 100644 index 0000000..d17f356 --- /dev/null +++ b/protected/modules/cms/components/MenuWidget.php @@ -0,0 +1,36 @@ +<?php +Yii::import('application.modules.cms.models.Sitecontent'); + +class MenuWidget extends CWidget +{ + public $point; + protected $menu; + + public function init() + { + if($this->point == 0) + throw new CException("Please provide a menu to render"); + + parent::init(); + $this->menu = Sitecontent::model()->findAll(array( + 'condition' => 'parent = :point', + 'params' => array(':point' => $this->point), + 'order' => 'position', + ) + ); + + $items = array(); + if($this->menu) + foreach($this->menu as $point) { + $items[] = array('label' => $point->title, + 'active' => stripos(Yii::app()->request->url, $point->title_url) !== false, + 'url' => array('/site/view', 'page' => $point->title_url)); + } + + $this->widget('zii.widgets.CMenu',array( + 'items'=>$items + )); + } + +} +?> |
