Database Multilevel With Bootstrap

Hello Yii members, I have the following issue, I’m trying to customize the display of an database driven multilevel menu with bootstrap but after struggling for several days I’ve given up.

All that I want is to have an nice style expanded 2 level menu, and only the second level menus to be active(to have links on them).

Database retrieval menus and submenus


private static function getMenuItems($modelRow) {

 

        if (!$modelRow)

            return;


        if (isset($modelRow->Childs)) {

            $chump = self::getMenuItems($modelRow->Childs);

	

            if ($chump != null)

                $res = array('label' => $modelRow->label, 'items' => $chump, 'url' => Yii::app()->createUrl('menu/index', array('id' => $modelRow->item_id)), 'itemOptions' =>   array('class' => 'accordion')); // retrieves the main level 1 menu which has submenus on it


            else

                $res = array('label' => $modelRow->label, 'url' => Yii::app()->createUrl('menu/index', array('id' => $modelRow->item_id)), 'itemOptions' =>   array('class' => 'accordion')); // retrieves the level 2 submenus


            return $res;


        } else {

            if (is_array($modelRow)) {

                $arr = array();

                foreach ($modelRow as $leaves) {

                    $arr[] = self::getMenuItems($leaves);

                }

                return $arr;

            } else {

                return array('label' => ($modelRow->label), 'url' => Yii::app()->createUrl('menu/index', array('id' => $modelRow->item_id)));

            }

        }

    }



The menu is displayed on the view with the following code:


<div class="col-md-3 column">

<?php $this->widget('bootstrap.widgets.TbMenu', array(

    'type'=>'tabs',

	'stacked'=>'true',

    'items'=>$this->getMenuTree()

 

)); ?>

</div>