static function index() { $treeData = array(array('id' => 1, 'pid' => 0, 'name' => 'bee1', 'age' => '12', 'href' => 'javascript:;', 'html' => 'test1', 'icon' => 'fa fa-home'), array('id' => 2, 'pid' => 1, 'name' => 'bee2', 'age' => '13', 'href' => 'javascript:;', 'html' => 'test2', 'icon' => 'fa fa-home'), array('id' => 3, 'pid' => 2, 'name' => 'bee3', 'age' => '14', 'href' => 'javascript:;', 'html' => 'test3', 'icon' => 'fa fa-home'), array('id' => 4, 'pid' => 1, 'name' => 'bee4', 'age' => '15', 'href' => 'javascript:;', 'html' => 'test4', 'icon' => 'fa fa-home'), array('id' => 8, 'pid' => 2, 'name' => 'bee8', 'age' => '16', 'href' => 'javascript:;', 'html' => 'test5', 'icon' => 'fa fa-home'), array('id' => 6, 'pid' => 4, 'name' => 'bee6', 'age' => '17', 'href' => 'javascript:;', 'html' => 'test6', 'icon' => 'fa fa-home'), array('id' => 7, 'pid' => 1, 'name' => 'bee7', 'age' => '18', 'href' => 'javascript:;', 'html' => 'test7', 'icon' => 'fa fa-home')); Sys::S('core.Html5.Menu.LeftMenu'); $data = LeftMenu::getMenu($treeData, 'id', 'pid', 'href', 'html', 'icon'); View::assign('userinfo', $_SESSION['userinfo']); View::assign('leftMenu', $data); View::display(); }
static function getMenu($data, $k_id, $k_pid, $k_href, $k_html, $k_icon = 'k_icon') { Sys::S('Tree.Tree'); $data = Tree::getTreeData($data, $k_id, $k_pid); self::$k_id = $k_id; self::$k_pid = $k_pid; self::$k_href = $k_href; self::$k_html = $k_html; self::$k_icon = $k_icon; return self::decorateData($data); }
<li><a href="#"><i class="fa fa-user fa-fw"></i> User Profile</a> </li> <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a> </li> <li class="divider"></li> <li><a href="login.html"><i class="fa fa-sign-out fa-fw"></i> Logout</a> </li> </ul> <!-- /.dropdown-user --> </li> <!-- /.dropdown --> </ul> <!-- /.navbar-top-links --> <?php $leftMenu = new LeftMenu($_SESSION['menuArr']); $leftMenu->outputMenu(); ?> <!-- sidebar --> </nav> <main> <div id="page-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-lg-12 col-md-12 col-xs-12 col-sm-12"> <ol class="breadcrumb"> <li><a href="<?php echo ROOT_FILE; ?>
/** * 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. * @param integer $id the ID of the model to be loaded * @return LeftMenu the loaded model * @throws CHttpException */ public function loadModel($id) { $model = LeftMenu::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }