コード例 #1
0
 public function actionAdmin($id)
 {
     $model = new Menuitem('search');
     $model->unsetAttributes();
     // clear any default values
     // if search
     if (isset($_GET['Menuitem'])) {
         $model->attributes = $_GET['Menuitem'];
     }
     // select menu to edit
     if (isset($_POST['Selectmenu'])) {
         $this->redirect(array('admin', 'id' => $_POST['Selectmenu']['term_id']));
     }
     $ajaxUrl = $this->createUrl('createAjaxMenuitem');
     $menu = Menumanage::model()->findByPk((int) $id);
     if (empty($menu)) {
         $menu = Menumanage::model()->find();
         if ($menu === null) {
             Yii::app()->user->setFlash('info', 'Please the Create New Menu first');
             $this->redirect(array('menumanage/admin'));
         }
         $id = $menu->term_id;
     }
     $this->render('admin', array('model' => $model, 'ajaxUrl' => $ajaxUrl, 'id' => $id, 'menu' => $menu));
 }
コード例 #2
0
 protected function afterSave()
 {
     parent::afterSave();
     if ($this->isNewRecord) {
         $menu = Menumanage::model()->findByPk($this->term_id);
         $menu->saveCounters(array('count' => '1'), array('condition' => "term_id = :term_id"), array(':term_id' => $this->term_id));
     }
 }
コード例 #3
0
 public function run()
 {
     $model = Menumanage::model()->findByAttributes(array('slug' => $this->menusID));
     if ($model === null) {
         $model = array();
     } else {
         $ID = $model->term_id;
         $criteria = new CDbCriteria();
         $criteria->condition = "term_id={$ID} AND meta_parent=0 ORDER BY meta_sort ASC";
         $model = Menuitem::model()->findAll($criteria);
     }
     $this->render('menus', array('model' => $model));
 }
コード例 #4
0
<div class='well' style='padding-bottom:30px;'>
 <div class='pull-left' style='line-height: 30px;margin-right: 10px;'> Pilih menu untuk di edit </div>   
 <div class='pull-left'>
<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('enableAjaxValidation' => false));
$list = CHtml::listData(Menumanage::model()->findAll(array('order' => 'name ASC')), 'term_id', 'groups');
echo CHtml::dropDownList('Selectmenu[term_id]', '', $list, array('empty' => '----- Select -----'));
?>
 
<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'label' => 'Pilih', 'htmlOptions' => array('style' => 'margin-bottom: 10px;')));
?>
 
<?php 
$this->endWidget();
?>
 </div>
    
</div>