Ejemplo n.º 1
0
 function genMenu($config, $module = '')
 {
     //echo $module;
     //print_r($config->$module);
     $iconstyle = 'style="width: 40px; height: 40px; vertical-align: middle" ';
     //global $request;
     //$module = 'admin';
     /**  BEGIN GEN MAIN TAB **/
     $i = 0;
     foreach ($config as $module => $nav) {
         //	echo $controller;
         // print_r($nav);
         if (count($nav->sub) == 0) {
             if ($nav->nolink == 'true') {
                 $link = "";
             } else {
                 $link = "onclick=location.href='/{$module}/{$controller}'";
             }
             // echo $controller," ",(int)Sam_Acl::getInstance()->isAllowed($controller,'view'),"<br/>";
             // echo $resource;
             if ($link == '' or $this->isAllowAccess($module, $controller, 'view') == true) {
                 $text .= '<li $link class="">';
                 $text .= '<a href="#"><span ><img $iconstyle src="' . $nav->icon . '" /> ' . $nav->label . '</a>';
                 $text .= "</li>";
             }
         } else {
             //print_r($nav);
             //$text .= "<table class='statistics'  width='100%' border='0' cellspacing='0' cellpadding='0' class='welcome-menu'><tr></td>";
             if ($module == App_Env::getModuleName()) {
                 $text .= '<li class="expand">';
             } else {
                 $text .= '<li class="">';
             }
             $text .= '<a href="#"><img $iconstyle src="' . $nav->icon . '" /> ' . $nav->label . '<span class="num">' . count($nav->sub) . '</span></a>';
             $text .= '<ul class="acitem" >';
             $text .= $this->genSubMenu($nav, $module);
             $text .= "</ul>";
             $text .= "</li>";
             /*
             	
             		        $text .="<tr><th><img src='{$nav->icon}' /> {$this->view->translate($nav->label)} </th></tr>";
             		        $text .="<tr><td>";
             		        $text .="<ul class='welcome-menu' >";
             		
             		         $text .= $this->genSubMenu($nav,$module);
             		         $text .= "</ul>";
             		        $text .= "</td></tr>";*/
             // $text .= "</table>";
         }
         ++$i;
     }
     return $text;
 }
Ejemplo n.º 2
0
 public function mainNavigation2($beginModule = '')
 {
     //$this->view->headLink()->appendStylesheet('/css/express-table/style.css');
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $currentModule = $request->getModuleName();
     $currentControler = $request->getControllerName();
     $currentAction = $request->getActionName();
     $beginModule = $request->getModuleName();
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation-admin.xml', 'nav');
     $text = '';
     foreach ($config as $module => $data) {
         if ($module == $beginModule) {
             $navTexe .= '   
                         <li class="dropdown">
                         <a href="#" class="dropdown-toggle" data-toggle="dropdown">  ' . $data->label . ' <b class="caret"></b></a>
                         <ul class="dropdown-menu">';
             $navTexe .= $this->genMenu($config, $module);
             $newControllerUrl = $this->view->url('new-controller', 'controller-setting', 'appconfig', array('con' => App_Env::getControllerName(), "mdl" => App_Env::getModuleName(), 'act' => App_Env::getActionName()));
             $navTexe .= '<li class="divider"></li><li><a class="colorbox-iframe" href="' . $newControllerUrl . '"><i class="glyphicon glyphicon-plus-sign"></i> Add Controler</a></li> ' . '</ul></li>';
         }
     }
     if ($currentAction != 'index' and $currentAction != '') {
         $navTexe .= " <li> <a href='/{$currentModule}/{$currentControler}'> {$currentControler} </a> </li>";
         $currentAction = ucwords(str_replace("-", " ", $currentAction));
         $navTexe .= " <li class='active'> {$currentAction} </li>";
     } else {
         $navTexe .= " <li class='active'> {$currentControler} </li>";
     }
     /*
     		 $id = $request->getParam('id','');
     		 if($id != ''){
     		 	$model = $this->view->defaultmodel;
     		 	if($model Instanceof App_Model_Abstract){
     		 		$navTexe .= " of id : $id ($model)";
     		 	}else{
     		 		$navTexe .= " of id : $id ";
     		 	}
     		 	
     		 }*/
     return ' <ol class="breadcrumb">' . '<li><a href="/"> <i class="glyphicon glyphicon-home"></i> หนัาหลัก</a></li>' . $navTexe . '</ol>';
 }