Example #1
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $menuItems = PageMenu::model()->visible()->findAll(array('order' => 'position'));
     if ($this->containerTagName) {
         echo CHtml::openTag($this->containerTagName, $this->containerHtmlOptions);
     }
     if ($this->enableSearch === true) {
         $this->printSearchForm();
     }
     if ($this->enableAdmin === true) {
         $this->printAdminButton();
     }
     echo CHtml::openTag($this->listTagName, array('class' => $this->listCssClass));
     foreach ($menuItems as $menu) {
         echo $this->getMenuTag($menu);
     }
     echo CHtml::closeTag($this->listTagName);
     if ($this->containerTagName) {
         echo CHtml::closeTag($this->containerTagName);
     }
 }
 /**
  * List models.
  * @param string topic menu slug
  */
 public function actionIndex($topic = null)
 {
     $this->layout = 'page';
     if ($topic) {
         $menuId = PageMenu::model()->getIdFromSlug($topic, $this->module->slugIdPrefix);
     } else {
         $menuId = PageMenu::model()->firstItemId;
     }
     if ($menuId === null) {
         $this->redirect(array('/site/index'));
     }
     $menu = PageMenu::model()->activeItem()->with('articles')->findbyPk($menuId);
     if ($menu === null) {
         $this->redirect(array('article/index'));
     }
     $this->render('index', array('menu' => $menu));
 }
Example #3
0
<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'article-form', 'enableAjaxValidation' => false));
?>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="simple">
		<?php 
echo $form->labelEx($model, 'menu_id');
?>
		<?php 
echo $form->DropDownList($model, 'menu_id', PageMenu::model()->activeItemOptions, array('prompt' => '', 'style' => 'width:250px'));
?>
	</div>

	<div class="simple">
		<?php 
echo $form->labelEx($model, 'title');
?>
		<?php 
echo $form->textField($model, 'title', array('style' => 'width:725px;'));
?>
	</div>

	<div class="simple">
		<?php 
echo $form->labelEx($model, 'content');
Example #4
0
<?php

$form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
?>

	<?php 
echo $form->DropDownList($model, 'menu_id', PageMenu::model()->activeItemOptions, array('submit' => Yii::app()->createUrl($this->route), 'prompt' => Yii::t('PageModule.ui', '-All Articles-'), 'style' => 'width:250px'));
?>

<?php 
$this->endWidget();
Example #5
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.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = PageMenu::model()->active()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }