コード例 #1
0
 public static function parse($file, $theme)
 {
     switch ($theme) {
         case 'theme1':
             ob_start();
             $callback = array('SystemPermission', 'checkPermission');
             $menu = TMenuBar::newFromXML('menu.xml', $callback);
             $menu->show();
             $menu_string = ob_get_clean();
             return $menu_string;
             break;
         case 'theme2':
             ob_start();
             $callback = array('SystemPermission', 'checkPermission');
             $xml = new SimpleXMLElement(file_get_contents('menu.xml'));
             $menu = new TMenu($xml, $callback, 1, 'nav collapse', '');
             $menu->class = 'nav';
             $menu->id = 'side-menu';
             $menu->show();
             $menu_string = ob_get_clean();
             return $menu_string;
             break;
         case 'theme3':
             ob_start();
             $callback = array('SystemPermission', 'checkPermission');
             $xml = new SimpleXMLElement(file_get_contents('menu.xml'));
             $menu = new TMenu($xml, $callback, 1, 'treeview-menu', 'treeview', '');
             $menu->class = 'sidebar-menu';
             $menu->id = 'side-menu';
             $menu->show();
             $menu_string = ob_get_clean();
             return $menu_string;
             break;
     }
 }
コード例 #2
0
ファイル: registration.class.php プロジェクト: romlg/cms36
 function show_menu()
 {
     $auth_obj =& Registry::get('TUserAuth');
     $profile = $auth_obj->getCurrentUserData();
     if ($profile) {
         $menu_obj = new TMenu();
         $params['_block']['params'] = array('return_parent' => true, 'levels' => 2, 'full' => true, 'start_uri' => '/cabinet/', 'types' => array('text', 'module'));
         $ret['authmenu'] = $menu_obj->show_menu($params['_block']['params']);
     } else {
         $ret = true;
     }
     return $ret;
 }
コード例 #3
0
ファイル: AdiantiMenuBuilder.php プロジェクト: kiibe/linkERP
 public static function parse($file, $theme)
 {
     switch ($theme) {
         case 'frontend':
             ob_start();
             $callback = array('SystemPermission', 'checkPermission');
             $xml = new SimpleXMLElement(file_get_contents($file));
             $menu = new TMenu($xml, $callback, 1, 'treeview-menu', 'treeview', '');
             $menu->class = 'sidebar-menu';
             $menu->id = 'side-menu';
             $menu->show();
             $menu_string = ob_get_clean();
             return $menu_string;
             break;
     }
 }
コード例 #4
0
 /**
  * Build a MenuBar from a XML file
  * @param $xml_file path for the file
  * @param $permission_callback check permission callback
  */
 public static function newFromXML($xml_file, $permission_callback = NULL)
 {
     if (file_exists($xml_file)) {
         $menu_string = file_get_contents($xml_file);
         if (utf8_encode(utf8_decode($menu_string)) == $menu_string) {
             $xml = new SimpleXMLElement($menu_string);
         } else {
             $xml = new SimpleXMLElement(utf8_encode($menu_string));
         }
         $menubar = new TMenuBar();
         foreach ($xml as $xmlElement) {
             $atts = $xmlElement->attributes();
             $label = (string) $atts['label'];
             $action = (string) $xmlElement->action;
             $icon = (string) $xmlElement->icon;
             $button_div = new TElement('div');
             $button_div->{'class'} = 'btn-group';
             $button = new TElement('button');
             $button->{'data-toggle'} = 'dropdown';
             $button->{'class'} = 'btn dropdown-toggle';
             $button->add($label);
             $span = new TElement('span');
             $span->{'class'} = 'caret';
             $span->add('');
             $button->add($span);
             $menu = new TMenu($xmlElement->menu->menuitem, $permission_callback);
             // check children count (permissions)
             if (count($menu->getMenuItems()) > 0) {
                 $button_div->add($button);
                 $button_div->add($menu);
                 $menubar->add($button_div);
             }
         }
         return $menubar;
     }
 }
コード例 #5
0
ファイル: announcement.class.php プロジェクト: romlg/cms36
 function showLeftMenu()
 {
     $auth_obj =& Registry::get('TUserAuth');
     $profile = $auth_obj->getCurrentUserData();
     $cabinet_id = (int) sql_getValue("SELECT id FROM `tree` WHERE page='cabinet'");
     $menu = new TMenu();
     $left_menu = $menu->menu($cabinet_id, 0, 2, 1, array('text', 'module'));
     $ret['profile'] = $profile;
     $ret['menu'] = $left_menu;
     return array('menu' => $ret);
 }
コード例 #6
0
ファイル: content.class.php プロジェクト: romlg/cms36
 /**
  * Формирование подменю текущей страницы
  *
  */
 function getContentMenu(&$params)
 {
     $menu = new TMenu();
     $page =& Registry::get('TPage');
     $list = array();
     $level = $page->content['level'];
     $pid = $page->content['id'];
     while (empty($list) && $pid != ROOT_ID) {
         $list = $menu->menu($pid, $pid, 1, 1, $params['types']);
         $pid = $page->pids[$level]['pid'];
         $level--;
     }
     return array('menu' => $list);
 }
コード例 #7
0
ファイル: index.php プロジェクト: jfrank1500/curso_php
<?php

require_once 'init.php';
$uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$template = 'theme1';
new TSession();
$menu_string = '';
if (TSession::getValue('logged')) {
    $content = file_get_contents("app/templates/{$template}/layout.html");
    ob_start();
    $callback = array('SystemPermission', 'checkPermission');
    $xml = new SimpleXMLElement(file_get_contents('menu.xml'));
    $menu = new TMenu($xml, $callback, 1, 'nav collapse', '');
    $menu->class = 'nav';
    $menu->id = 'side-menu';
    $menu->show();
    $menu_string = ob_get_clean();
} else {
    $content = file_get_contents("app/templates/{$template}/login.html");
}
$content = TApplicationTranslator::translateTemplate($content);
$content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$template}/libraries.html"), $content);
$content = str_replace('{URI}', $uri, $content);
$content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content);
$content = str_replace('{template}', $template, $content);
$content = str_replace('{MENU}', $menu_string, $content);
$content = str_replace('{username}', TSession::getValue('username'), $content);
$content = str_replace('{frontpage}', TSession::getValue('frontpage'), $content);
$css = TPage::getLoadedCSS();
$js = TPage::getLoadedJS();
$content = str_replace('{HEAD}', $css . $js, $content);