public static function main($args)
 {
     $pancakeHouseMenu = new Menu("PANCAKE HOUSE MENU", "Breakfast");
     $dinerMenu = new Menu("DINER MENU", "Lunch");
     $cafeMenu = new Menu("CAFE MENU", "Dinner");
     $dessertMenu = new Menu("DESSERT MENU", "Dessert of course!");
     $coffeeMenu = new Menu("COFFEE MENU", "Stuff to go with your afternoon coffee");
     $allMenus = new Menu("ALL MENUS", "All menus combined");
     $allMenus->add($pancakeHouseMenu);
     $allMenus->add($dinerMenu);
     $allMenus->add($cafeMenu);
     $pancakeHouseMenu->add(new MenuItem("K&B's Pancake Breakfast", "Pancakes with scrambled eggs, and toast", TRUE, 2.99));
     $pancakeHouseMenu->add(new MenuItem("Regular Pancake Breakfast", "Pancakes with fried eggs, sausage", FALSE, 2.99));
     $pancakeHouseMenu->add(new MenuItem("Blueberry Pancakes", "Pancakes made with fresh blueberries, and blueberry syrup", TRUE, 3.49));
     $pancakeHouseMenu->add(new MenuItem("Waffles", "Waffles, with your choice of blueberries or strawberries", TRUE, 3.59));
     $dinerMenu->add(new MenuItem("Vegetarian BLT", "(Fakin') Bacon with lettuce & tomato on whole wheat", TRUE, 2.99));
     $dinerMenu->add(new MenuItem("BLT", "Bacon with lettuce & tomato on whole wheat", FALSE, 2.99));
     $dinerMenu->add(new MenuItem("Soup of the day", "A bowl of the soup of the day, with a side of potato salad", FALSE, 3.29));
     $dinerMenu->add(new MenuItem("Hotdog", "A hot dog, with saurkraut, relish, onions, topped with cheese", FALSE, 3.05));
     $dinerMenu->add(new MenuItem("Steamed Veggies and Brown Rice", "Steamed vegetables over brown rice", TRUE, 3.99));
     $dinerMenu->add(new MenuItem("Pasta", "Spaghetti with Marinara Sauce, and a slice of sourdough bread", TRUE, 3.89));
     $dinerMenu->add($dessertMenu);
     $dessertMenu->add(new MenuItem("Apple Pie", "Apple pie with a flakey crust, topped with vanilla icecream", TRUE, 1.59));
     $dessertMenu->add(new MenuItem("Cheesecake", "Creamy New York cheesecake, with a chocolate graham crust", TRUE, 1.99));
     $dessertMenu->add(new MenuItem("Sorbet", "A scoop of raspberry and a scoop of lime", TRUE, 1.89));
     $cafeMenu->add(new MenuItem("Veggie Burger and Air Fries", "Veggie burger on a whole wheat bun, lettuce, tomato, and fries", TRUE, 3.99));
     $cafeMenu->add(new MenuItem("Soup of the day", "A cup of the soup of the day, with a side salad", FALSE, 3.69));
     $cafeMenu->add(new MenuItem("Burrito", "A large burrito, with whole pinto beans, salsa, guacamole", TRUE, 4.29));
     $cafeMenu->add($coffeeMenu);
     $coffeeMenu->add(new MenuItem("Coffee Cake", "Crumbly cake topped with cinnamon and walnuts", TRUE, 1.59));
     $coffeeMenu->add(new MenuItem("Bagel", "Flavors include sesame, poppyseed, cinnamon raisin, pumpkin", FALSE, 0.6899999999999999));
     $coffeeMenu->add(new MenuItem("Biscotti", "Three almond or hazelnut biscotti cookies", TRUE, 0.89));
     $waitress = new Waitress($allMenus);
     $waitress->printMenu();
 }
예제 #2
0
 /**
  * Generates a menu layout based on the current action.
  * @param string $actionString A dotted-pair action string of the form
  *		"module.action" .
  * @return object MenuLayout
  * @static
  */
 static function generateMainMenu()
 {
     $harmoni = Harmoni::instance();
     list($module, $action) = explode(".", $harmoni->request->getRequestedModuleAction());
     $mainMenu = new Menu(new YLayout(), 1);
     // :: Home ::
     $mainMenu_item = new MenuItemLink(_("Home"), $harmoni->request->quickURL("home", "welcome"), $module == "home" && $action == "welcome" ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     // 		$mainMenu_item = new MenuItemLink(
     // 			_("Plugin Tests"),
     // 			$harmoni->request->quickURL("plugin_manager", "test"),
     // 			($module == "plugin_manager")?TRUE:FALSE,1);
     // 		$mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     $mainMenu_item = new MenuItemLink(_("Portal"), $harmoni->request->quickURL('portal', "list"), $module == "portal" && $action == 'list' ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     if (defined('DATAPORT_SEGUE1_URL') && defined('DATAPORT_SEGUE1_SECRET_KEY') && defined('DATAPORT_SEGUE1_SECRET_VALUE')) {
         $mainMenu_item = new MenuItemLink(_("Migrate Sites"), $harmoni->request->quickURL('dataport', "choose_site"), $module == "dataport" && $action == 'choose_site' ? TRUE : FALSE, 1);
         $mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     }
     $mainMenu_item8 = new MenuItemLink(_("User Tools"), $harmoni->request->quickURL("user", "main"), preg_match("/^user\$/", $module) ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item8, "100%", null, LEFT, CENTER);
     $mainMenu_item7 = new MenuItemLink(_("Admin Tools"), $harmoni->request->quickURL("admin", "main"), preg_match("/^admin\$/", $module) ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item7, "100%", null, LEFT, CENTER);
     return $mainMenu;
 }
예제 #3
0
파일: item.php 프로젝트: asbel/fleximenu
 /**
  * Creates a sub Item
  *
  * @param  string  $title
  * @param  string|array  $options
  * @return void
  */
 public function add($title, $options)
 {
     if (!is_array($options)) {
         $options = array('url' => $options);
     }
     $options['pid'] = $this->id;
     return $this->manager->add($title, $options);
 }
예제 #4
0
function llxHeader($head = '', $title='', $help_url='', $morehtml='')
{
	global $conf,$langs,$user;
	$langs->load("ftp");

	top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
	top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers

	$menu = new Menu();

	$MAXFTP=20;
	$i=1;
	while ($i <= $MAXFTP)
	{
		$paramkey='FTP_NAME_'.$i;
		//print $paramkey;
		if (! empty($conf->global->$paramkey))
		{
			$link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;

			$menu->add($link, dol_trunc($conf->global->$paramkey,24));
		}
		$i++;
	}


	left_menu($menu->liste, $help_url, $morehtml, '', 1);
	main_area();
}
예제 #5
0
 public static function menu()
 {
     \Menu::add(['index' => 0, 'icon-class' => 'fa fa-dashboard', 'name' => 'dashboard', 'label' => trans('backend/dashboard.dashboard'), 'url' => url('backend/c/dashboard')]);
     \Menu::add(['index' => 10, 'icon-class' => 'fa fa-cube', 'name' => 'article', 'label' => trans('backend/article.articles')]);
     \Menu::addChild(['index' => 10, 'group' => true, 'target' => 'article', 'name' => 'navigation', 'label' => trans('backend/general.navigation')]);
     \Menu::addChild(['index' => 10, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/general.show_all'), 'url' => url('backend/c/article')]);
     \Menu::addChild(['index' => 20, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/article.add'), 'url' => url('backend/c/article/a/add')]);
 }
예제 #6
0
/**
 * Replace the default llxHeader function
 * @param $head
 * @param $title
 * @param $help_url
 * @param $target
 * @param $disablejs
 * @param $disablehead
 * @param $arrayofjs
 * @param $arrayofcss
 */
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
{
	global $db, $user, $conf, $langs;

	top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
	top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers

	$menu = new Menu();

	// Entry for each bank account
	if ($user->rights->banque->lire)
	{
		$sql = "SELECT rowid, label, courant, rappro, courant";
		$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
		$sql.= " WHERE entity = ".$conf->entity;
		$sql.= " AND clos = 0";
        $sql.= " ORDER BY label";

		$resql = $db->query($sql);
		if ($resql)
		{
			$numr = $db->num_rows($resql);
			$i = 0;

			if ($numr > 0) 	$menu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);

			while ($i < $numr)
			{
				$objp = $db->fetch_object($resql);
				$menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
                if ($objp->rappro && $objp->courant != 2 && ! $objp->clos)  // If not cash account and not closed and can be reconciliate
                {
				    $menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
                }
				$i++;
			}
		}
		else dol_print_error($db);
		$db->free($resql);
	}

	left_menu('', $help_url, '', $menu->liste, 1);
    main_area();
}
예제 #7
0
파일: menu.php 프로젝트: Ryanker/open-eshop
 public function action_new()
 {
     $this->auto_render = FALSE;
     if (Menu::add(Core::post('title'), Core::post('url'), Core::post('target'), Core::post('icon'))) {
         Alert::set(Alert::SUCCESS, __('Menu created'));
     } else {
         Alert::set(Alert::ERROR, __('Menu not created'));
     }
     HTTP::redirect(Route::url('oc-panel', array('controller' => 'menu', 'action' => 'index')));
 }
예제 #8
0
파일: Object.php 프로젝트: brussens/cogear2
 /**
  * Вывод
  *
  * @return  string
  */
 public function render()
 {
     if (!$this->object()->options) {
         return '';
     }
     $menu = new Menu(array('name' => $this->object()->machine_name, 'template' => $this->object()->options->template, 'show_empty' => FALSE, 'render' => FALSE, 'multiple' => $this->object()->options->multiple, 'title' => $this->object()->options->title, 'titleActiveOnly' => TRUE, 'autoactive' => TRUE));
     if ($items = $this->getItems()) {
         foreach ($items as $item) {
             $menu->add(array('label' => $item->label, 'link' => $item->link, 'order' => $item->thread));
         }
     }
     $tpl = new Template('Menu/Db/templates/menu');
     $tpl->menu = $menu;
     $tpl->object = $this->object();
     return $tpl->render();
 }
예제 #9
0
 function admin_menu()
 {
     $return_string = '';
     $allowed_modules = 0;
     $menu = new Menu($this->connection, $this->path_information);
     foreach ($this->installed_modules as $modul) {
         if (in_array($modul['Name'], $this->allowed_modules)) {
             $return_string .= $menu->add($modul['Name'], $modul['LongName'], '/' . INSTALL_PATH . '/' . $modul['Icon']);
             $allowed_modules++;
         }
     }
     if ($allowed_modules == 0) {
         $return_string .= 'Ihre Zugangsberechtigung gilt nicht für diesen Bereich.';
     }
     $return_string .= $menu->menu_print();
     return Html::h('1', PROJECT_NAME . ' Verwaltungs Bereich') . 'Guten Tag, ' . $_SESSION['RheinaufCMS_User']['Name'] . '. ' . Html::a('/Admin?logout=' . $_SESSION['RheinaufCMS_User']['Name'], '(Abmelden)', array('style' => 'font-size:9px')) . Html::div($return_string, array('id' => 'admin'));
 }
예제 #10
0
 public function generateMenu()
 {
     $this->execQuery();
     $menu = new Menu();
     while ($row = $this->getRow()) {
         $url = $row['url'];
         if ($row['intern'] == 1 && session::isAdmin()) {
             if (strpos($url, "?") === false) {
                 $url .= "?";
             } else {
                 $url .= "&";
             }
             $url .= "akey=" . session::makeKey();
         }
         // Note that changing the standard naming will also remove any translations.
         $menu->add($url, Language::get($row['descr']));
     }
     return $menu;
 }
예제 #11
0
<?php

\Menu::add('admincp-menu', 'custom-page', ['link' => '', 'name' => 'Custom Pages']);
\Menu::add('sub-menu-custom-page', 'lists', ['link' => \URL::to('admincp/custom/pages/'), 'name' => 'Lists']);
\Menu::add('sub-menu-custom-page', 'add', ['link' => \URL::to('admincp/custom/pages/add'), 'name' => 'Add New Page']);
$customRepository = app('App\\Addons\\Custompage\\Classes\\CustomPageRepository');
foreach ($customRepository->getList(null, true) as $page) {
    app('menu')->add('site-menu', $page->slug, ['name' => $page->title, 'link' => \URL::to('_' . $page->slug), 'ajaxify' => true, 'icon' => '<i class="icon ion-clipboard"></i>']);
}
if (\Config::get('enable-recent-pages')) {
    app('widget')->add('custompage::side', ['user-home', 'user-search', 'user-discover', 'notifications', 'user-community', 'user-pages'], ['all' => true]);
}
예제 #12
0
<?php

header("Content-type: application/json;  charset=iso-8859-1", true);
require_once '../../lib/php/conn.php';
require_once '../../models/Menu.php';
$data = new Menu();
foreach ($_REQUEST as $key => $value) {
    $_REQUEST[$key] = utf8_decode($value);
}
if ($_REQUEST['acao'] == 1 && $_REQUEST['operacao'] == 2) {
    if ($data->add()) {
        echo json_encode(array('success' => 1));
    } else {
        echo json_encode(array('success' => 0));
    }
} elseif ($_REQUEST['acao'] == 2 && $_REQUEST['operacao'] == 2) {
    if ($data->edit()) {
        echo json_encode(array('success' => 1));
    } else {
        echo json_encode(array('success' => 0));
    }
} elseif ($_REQUEST['acao'] == 3 && $_REQUEST['operacao'] == 2) {
    if ($data->delete()) {
        echo json_encode(array('success' => 1));
    } else {
        echo json_encode(array('success' => 0));
    }
}
예제 #13
0
<?php

require_once '../autoload.php';
// $menu #1
$main = new Menu();
$main->add('<span class="glyphicon glyphicon-home"></span>', '');
$about = $main->add('about', 'about');
$about->add('Who we are?', 'who-we-are?');
$about->add('What we do?', 'what-we-do?');
$main->add('Services', 'services');
$main->add('Portfolio', 'portfolio');
$main->add('Contact', 'contact');
// menu #2
$user = new Menu();
$user->add('login', 'login');
$profile = $user->add('Profile', 'profile');
$profile->add('Account', 'account')->link->prepend('<span class="glyphicon glyphicon-user"></span> ');
$profile->add('Settings', 'settings')->link->prepend('<span class="glyphicon glyphicon-cog"></span> ');
?>
<html>
<head>
	<title>Bootstrap Navbar</title>
	<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
  <script type="text/javascript" src="js/bootstrap.min.js"></script>
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
</head>
<body>

<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
예제 #14
0
spl_autoload_extensions('.php');
//设置加载后缀名
function myAutoload($className)
{
    require_once $className . '.php';
    //直接根据类名跟文件关系包含文件
}
spl_autoload_register("myAutoload");
//注册自动加载函数
//测试代码开始
$pancakeHouseMenu = new Menu("PANCAKE HOUSE MENU", "早餐");
$dinerMenu = new Menu("DINER MENU", "午餐");
$cafeMenu = new Menu("CAFE MENU", "晚餐");
$dessertMenu = new Menu("DESSERT MENU", "甜点!");
$allMenus = new Menu("ALL MENUS", "All menus combined");
$allMenus->add($pancakeHouseMenu);
$allMenus->add($dinerMenu);
$allMenus->add($cafeMenu);
//早餐菜单项
$pancakeHouseMenu->add(new MenuItem("K&B's Pancake Breakfast", "Pancakes with scrambled eggs, and toast", true, 2.99));
$pancakeHouseMenu->add(new MenuItem("Regular Pancake Breakfast", "Pancakes with fried eggs,sausage", false, 2.99));
$pancakeHouseMenu->add(new MenuItem("Blueberry Pancakes", "Pancakes made with fresh blueberries", true, 3.49));
$pancakeHouseMenu->add(new MenuItem("Waffles", "Waffles, with your choice of blueberries or strawberries", true, 3.59));
//午餐菜单项
$dinerMenu->add(new MenuItem("Pasta", "Spaghetti with Marinara Sauce,and a slice of sourdough bread", true, 3.89));
$dinerMenu->add(new MenuItem("Vegetarian BLT", "(Fakin') Bacon with lettuce & tomato on whole wheat", true, 2.99));
$dinerMenu->add(new MenuItem("BLT", "Bacon with lettuce & tomato on whole wheat", false, 2.99));
$dinerMenu->add(new MenuItem("Soup of the day", "Soup of the day, with a side of potato salad", false, 3.29));
$dinerMenu->add(new MenuItem("Hotdog", "A hot dog,with saurkraut relish, onions, topped with cheese", false, 3.05));
$dinerMenu->add($dessertMenu);
//甜点
예제 #15
0
        }
    }
    Weapon::fire(array('plugin_after', 'plugin_' . md5($k) . '_after'));
}
Weapon::fire('plugins_after');
/**
 * Check the Plugin(s) Order
 * -------------------------
 */
// var_dump($plugins); exit;
/**
 * Loading Menu(s)
 * ---------------
 */
foreach (Get::state_menu() as $key => $value) {
    Menu::add($key, $value);
}
/**
 * Handle Shortcode(s) in Content
 * ------------------------------
 */
function do_shortcode($content)
{
    if (strpos($content, '{{') === false) {
        return $content;
    }
    foreach (Get::state_shortcode() as $key => $value) {
        $key = preg_quote($key, '#');
        // %[a,b,c]: option(s) ... accept `a`, `b`, or `c`
        if (strpos($key, '%\\[') !== false) {
            $key = preg_replace_callback('#%\\\\\\[(.*?)\\\\\\]#', function ($matches) {
예제 #16
0
 public function boot()
 {
     \Hook::listen('filter-text', function ($text) {
         $badwords = \Config::get('user-badwords');
         $replace = \Config::get('user-badwords-replace');
         $badwords = empty($badwords) ? [] : explode(',', $badwords);
         $words = join("|", array_filter(array_map('preg_quote', array_map('trim', $badwords))));
         foreach ($badwords as $badword) {
             $text = @preg_replace("/\\b({$words})\\b/uie", '"".str_repeat("$replace",strlen("$1")).""', $text);
         }
         return $text;
     });
     include app_path() . '/routes/admincp.php';
     if (\Config::get('system.installed')) {
         if (\Auth::check()) {
             //set user preferred language
             $lang = \Auth::user()->present()->privacy('lang', \Cache::get('active-language', 'en'));
             \App::setLocale($lang);
         }
         \App::setLocale(\Session::get('current-language', \Cache::get('active-language', 'en')));
         if (\Session::has('current-language') and \Auth::check()) {
             $lang = \Auth::user()->present()->privacy('lang', \Cache::get('active-language', 'en'));
             $sessionLang = \Session::get('current-language');
             if ($lang != $sessionLang) {
                 $this->app->make('App\\Repositories\\UserRepository')->savePrivacy(['lang' => $sessionLang]);
             }
         }
         //exit(\Config::get('app.locale'));
         $configurationRepository = $this->app->make('App\\Repositories\\ConfigurationRepository');
         $configurations = $configurationRepository->getNameLists();
         foreach ($configurations as $configuration) {
             if ($configuration != 'general') {
                 \Menu::add('admincp-configuration', $configuration, ['link' => \URL::to('admincp/configurations/' . $configuration), 'name' => ucwords($configuration) . '']);
             }
         }
     }
     \Menu::add('admincp-configuration', 'general', ['link' => \URL::to('admincp/configurations/general'), 'name' => 'General']);
     /**User menus***/
     \Menu::add('admincp-users', 'list', ['link' => \URL::route('admincp-user-list'), 'name' => 'Lists']);
     /**\Menu::add('admincp-users', 'add-user', [
            'link' => \URL::route('admincp-user-list'),
            'name' => 'Add user',
        ]);**/
     \Menu::add('admincp-users', 'unvalidated-list', ['link' => \URL::route('admincp-user-unvalidated-list'), 'name' => 'Unvalidated Members']);
     \Menu::add('admincp-users', 'custom-field', ['link' => \URL::route('admincp-user-custom-field'), 'name' => 'Custom Fields']);
     \Menu::add('admincp-users', 'ban-users', ['link' => \URL::route('admincp-ban-users'), 'name' => 'Banned Users']);
     \Menu::add('admincp-menu', 'language', ['link' => '', 'name' => 'Manage Translation']);
     \Menu::add('sub-menu-language', 'list', ['link' => \URL::to('admincp/languages'), 'name' => 'Languages']);
     \Menu::add('sub-menu-language', 'add-language', ['link' => \URL::to('admincp/languages/add'), 'name' => 'Add Languages']);
     //communities menu
     \Menu::add('admincp-menu', 'communities', ['link' => \URL::to('admincp/communities'), 'name' => 'Manage Communities']);
     //pages menu
     \Menu::add('admincp-menu', 'page', ['link' => '', 'name' => 'Manage Pages']);
     \Menu::add('sub-menu-page', 'pages', ['link' => \URL::to('admincp/pages'), 'name' => 'Pages']);
     \Menu::add('sub-menu-page', 'page-category', ['link' => \URL::to('admincp/pages/categories'), 'name' => 'Categories']);
     \Menu::add('sub-menu-page', 'page-create-category', ['link' => \URL::to('admincp/pages/create/category'), 'name' => 'Add Categories']);
     //Report menu
     \Menu::add('admincp-menu', 'report', ['link' => '', 'name' => 'Reports']);
     \Menu::add('sub-menu-report', 'report-post', ['link' => \URL::to('admincp/reports'), 'name' => 'Posts']);
     \Menu::add('sub-menu-report', 'report-profile', ['link' => \URL::to('admincp/reports?type=profile'), 'name' => 'Profile']);
     \Menu::add('sub-menu-report', 'report-community', ['link' => \URL::to('admincp/reports?type=community'), 'name' => 'Communities']);
     \Menu::add('sub-menu-report', 'report-page', ['link' => \URL::to('admincp/reports?type=page'), 'name' => 'Pages']);
     //Additional pages
     \Menu::add('admincp-menu', 'additional-page', ['link' => '', 'name' => 'Manage Additional Pages']);
     \Menu::add('sub-menu-additional-page', 'about-us', ['link' => \URL::to('admincp/additional-page?slug=about-us'), 'name' => 'About US']);
     \Menu::add('sub-menu-additional-page', 'terms-and-condition', ['link' => \URL::to('admincp/additional-page?slug=terms-and-condition'), 'name' => 'Terms and Condition']);
     \Menu::add('sub-menu-additional-page', 'disclaimer', ['link' => \URL::to('admincp/additional-page?slug=disclaimer'), 'name' => 'Disclaimer']);
     \Menu::add('sub-menu-additional-page', 'privacy-policy', ['link' => \URL::to('admincp/additional-page?slug=privacy-policy'), 'name' => 'Privacy Policy']);
     //Help system
     \Menu::add('admincp-menu', 'help', ['link' => '', 'name' => 'Manage Helps']);
     \Menu::add('sub-menu-help', 'lists', ['link' => \URL::to('admincp/helps/list'), 'name' => 'Lists']);
     \Menu::add('sub-menu-help', 'add', ['link' => \URL::to('admincp/helps/add'), 'name' => 'Add Help']);
     //Games system
     \Menu::add('admincp-menu', 'games', ['link' => '', 'name' => 'Manage Games']);
     \Menu::add('sub-menu-games', 'list', ['link' => \URL::to('admincp/games'), 'name' => 'Lists']);
     \Menu::add('sub-menu-games', 'add', ['link' => \URL::to('admincp/games/add'), 'name' => 'Add Games']);
     \Menu::add('sub-menu-games', 'categories', ['link' => \URL::to('admincp/games/categories'), 'name' => 'Categories']);
     \Menu::add('sub-menu-games', 'categories-add', ['link' => \URL::to('admincp/games/create/category'), 'name' => 'Add Categories']);
     \Menu::add('admincp-menu', 'ads', ['link' => \URL::to('admincp/ads'), 'name' => 'Manage Ads']);
     //newsletter admincpc management
     \Menu::add('admincp-menu', 'newsletter', ['link' => '', 'name' => 'NewsLetter']);
     \Menu::add('sub-menu-newsletter', 'list', ['link' => \URL::to('admincp/newsletter'), 'name' => 'Lists']);
     \Menu::add('sub-menu-newsletter', 'add', ['link' => \URL::to('admincp/newsletter/add'), 'name' => 'Add New']);
     //listing to new users
     $this->app['events']->listen('user.register', function ($user) {
         $users = \Config::get('users-autofollow');
         if (!empty($users)) {
             $users = explode(',', $users);
             foreach ($users as $thisUser) {
                 $thisUser = app('App\\Repositories\\UserRepository')->findByUsername($thisUser);
                 if ($thisUser) {
                     $connection = app('App\\Repositories\\ConnectionRepository');
                     $connection->add($user->id, $thisUser->id, 1);
                 }
             }
         }
         //communities
         $communities = \Config::get('community-autojoin');
         if (!empty($communities)) {
             $communities = explode(',', $communities);
             foreach ($communities as $slug) {
                 $communityRepo = app('App\\Repositories\\CommunityRepository');
                 $community = $communityRepo->get($slug);
                 if ($community) {
                     $communityRepo->join($community->id, $user->id);
                 }
             }
         }
         //for pages comming later
         $pages = \Config::get('pages-autolike');
         if (!empty($pages)) {
             $pages = explode(',', $pages);
             foreach ($pages as $slug) {
                 $pageRepository = app('App\\Repositories\\PageRepository');
                 $page = $pageRepository->get($slug);
                 if ($page) {
                     app('App\\Repositories\\LikeRepository')->add('page', $page->id, $user->id);
                 }
             }
         }
     });
 }
예제 #17
0
 if ($type === 'MENU') {
     $menus = array();
     if ($_menus = Mecha::A(Config::get('manager_menu'))) {
         $_menus = Mecha::eat($_menus)->order('ASC', 'stack', true, 10)->vomit();
         foreach ($_menus as $k => $v) {
             // < 1.1.3
             if (is_string($v)) {
                 $menus[$k] = $v;
             } else {
                 $stack = isset($v['stack']) ? $v['stack'] : 10;
                 $_k = (strpos($v['icon'], '<') === false ? Jot::icon($v['icon'], 'fw') : $v['icon']) . ' <span class="label">' . $k . '</span>' . (isset($v['count']) && ($v['count'] === '&infin;' || (double) $v['count'] > 0) ? ' <span class="counter">' . $v['count'] . '</span>' : "");
                 $menus[$_k] = isset($v['url']) ? $v['url'] : null;
             }
         }
     }
     Menu::add('manager', $menus);
     $html .= Menu::manager('ul', $T1);
 }
 if ($type === 'BAR') {
     $bars = array();
     if ($_bars = Mecha::A(Config::get('manager_bar'))) {
         $_bars = Mecha::eat($_bars)->order('ASC', 'stack', true, 10)->vomit();
         foreach ($_bars as $k => $v) {
             if (is_string($v)) {
                 $bar = $v;
             } else {
                 $t = ' data-tooltip="' . Text::parse(isset($v['description']) ? $v['description'] : $k, '->encoded_html') . '"';
                 if (isset($v['url'])) {
                     $url = Filter::colon('manager:url', Converter::url($v['url']));
                     $c = $config->url_current === $url ? ' ' . Widget::$config['classes']['current'] : "";
                     $bar = '<a class="item' . $c . '" href="' . $url . '"' . $t . '>';
예제 #18
0
<?php

\Menu::add('admincp-menu', 'custom-widgets', ['link' => '', 'name' => 'Manage Widgets']);
\Menu::add('sub-menu-custom-widgets', 'lists', ['link' => \URL::to('admincp/custom/widgets/'), 'name' => 'Lists']);
\Menu::add('sub-menu-custom-widgets', 'add-new', ['link' => \URL::to('admincp/custom/widgets/add'), 'name' => 'Add New Widget']);
$widgets = app('App\\Addons\\Customwidget\\Classes\\CustomWidgetRepository')->getList();
foreach ($widgets as $widget) {
    if ($widget->page == 'all') {
        app('widget')->add('customwidget::display', ['user-home', 'user-search', 'user-discover', 'notifications', 'user-community'], ['widget' => $widget]);
    } else {
        app('widget')->add('customwidget::display', [$widget->page], ['widget' => $widget]);
    }
}
 function test_menu_components()
 {
     $theme = new Theme("", "");
     $heading = new MenuItemHeading("hoho", 3);
     $this->assertIdentical($heading->getType(), MENU_ITEM_HEADING);
     $this->assertIdentical($heading->getDisplayName(), "hoho");
     //			$comp->render($theme);
     $comp = new MenuItemLink("Google", "http://www.google.com", true, 1, "_BLANK", "g", "Go to the Google search page");
     $this->assertIdentical($comp->getDisplayName(), "Google");
     $this->assertIdentical($comp->getURL(), "http://www.google.com");
     $this->assertTrue($comp->isSelected());
     $this->assertIdentical($comp->getTarget(), "_BLANK");
     $this->assertIdentical($comp->getAccessKey(), "g");
     $this->assertIdentical($comp->getToolTip(), "Go to the Google search page");
     $this->assertIdentical($comp->getType(), MENU_ITEM_LINK_SELECTED);
     $comp->setDisplayName("1");
     $comp->setURL("2");
     $comp->setSelected(false);
     $comp->setTarget("4");
     $comp->setAccessKey("5");
     $comp->setToolTip("6");
     $this->assertIdentical($comp->getDisplayName(), "1");
     $this->assertIdentical($comp->getURL(), "2");
     $this->assertFalse($comp->isSelected());
     $this->assertIdentical($comp->getTarget(), "4");
     $this->assertIdentical($comp->getAccessKey(), "5");
     $this->assertIdentical($comp->getToolTip(), "6");
     $this->assertIdentical($comp->getType(), MENU_ITEM_LINK_UNSELECTED);
     $comp = new MenuItemLink("Google", "http://www.google.com", true, 1, "_BLANK", "g", "Go to the Google search page");
     $comp->addAttribute("name", "haha");
     //			$comp->render($theme);
     $menuStyle = new StyleCollection("*.menu", "menu", "Menu Style", "Style for the menu.");
     $menuStyle->addSP(new BackgroundColorSP("#997755"));
     $menuStyle->addSP(new BorderSP("1px", "solid", "#FFFFFF"));
     $menu = new Menu(new XLayout(), 4, $menuStyle);
     $this->assertTrue(!isset($comp->_selectedId));
     $menu->add($comp, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 1);
     $this->assertIdentical($comp->isSelected(), true);
     $this->assertReference($menu->getSelected(), $comp);
     $comp1 = $comp;
     $menu->add($comp1, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 2);
     $this->assertIdentical($comp1->isSelected(), true);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertReference($menu->getSelected(), $comp1);
     $comp2 = $comp;
     $comp2->setSelected(false);
     $menu->add($comp2, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 2);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertIdentical($comp1->isSelected(), true);
     $this->assertIdentical($comp2->isSelected(), false);
     $this->assertReference($menu->getSelected(), $comp1);
     $menu->select(3);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertIdentical($comp1->isSelected(), false);
     $this->assertIdentical($comp2->isSelected(), true);
     $this->assertReference($menu->getSelected(), $comp2);
     $menu->add($heading, "100px", null, CENTER);
     echo "<style>";
     echo $menuStyle->getCSS();
     echo "</style>";
     $menu->render($theme);
 }
예제 #20
0
 function admin_menu()
 {
     $allowed_modules = 0;
     $menu = new Menu();
     if (is_array($this->allowed_modules)) {
         foreach ($this->installed_modules as $modul) {
             if (in_array($modul['sysID'], $this->allowed_modules)) {
                 $menu->add($modul['sysID'], $modul['Name'], $modul['Icon'], $modul['sysID'] == $this->modul);
                 $allowed_modules++;
             }
         }
     }
     if ($allowed_modules == 0) {
         $return_string .= 'Ihre Zugangsberechtigung gilt nicht für diesen Bereich.';
     }
     return $menu->menu_print();
 }
예제 #21
0
/**
 * Core function to output left menu eldy
 *
 * @param      db                  Database handler
 * @param      menu_array_before   Table of menu entries to show before entries of menu handler
 * @param      menu_array_after    Table of menu entries to show after entries of menu handler
 */
function print_left_eldy_menu($db, $menu_array_before, $menu_array_after)
{
    global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc;
    // Read mainmenu and leftmenu that define which menu to show
    if (isset($_GET["mainmenu"])) {
        // On sauve en session le menu principal choisi
        $mainmenu = $_GET["mainmenu"];
        $_SESSION["mainmenu"] = $mainmenu;
        $_SESSION["leftmenuopened"] = "";
    } else {
        // On va le chercher en session si non defini par le lien
        $mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : '';
    }
    if (isset($_GET["leftmenu"])) {
        // On sauve en session le menu principal choisi
        $leftmenu = $_GET["leftmenu"];
        $_SESSION["leftmenu"] = $leftmenu;
        if ($_SESSION["leftmenuopened"] == $leftmenu) {
            //$leftmenu="";
            $_SESSION["leftmenuopened"] = "";
        } else {
            $_SESSION["leftmenuopened"] = $leftmenu;
        }
    } else {
        // On va le chercher en session si non defini par le lien
        $leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : '';
    }
    $newmenu = new Menu();
    // Show logo company
    if (!empty($conf->global->MAIN_SHOW_LOGO)) {
        $mysoc->logo_mini = $conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
        if (!empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_mini)) {
            $urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file=' . urlencode('thumbs/' . $mysoc->logo_mini);
            print "\n" . '<!-- Show logo on menu -->' . "\n";
            print '<div class="blockvmenuimpair">' . "\n";
            print '<div class="menu_titre" id="menu_titre_logo"></div>';
            print '<div class="menu_top" id="menu_top_logo"></div>';
            print '<div class="menu_contenu" id="menu_contenu_logo">';
            print '<center><img title="' . $title . '" src="' . $urllogo . '"></center>' . "\n";
            print '</div>';
            print '<div class="menu_end" id="menu_end_logo"></div>';
            print '</div>' . "\n";
        }
    }
    /**
     * On definit newmenu en fonction de mainmenu et leftmenu
     * ------------------------------------------------------
     */
    if ($mainmenu) {
        /*
         * Menu HOME
         */
        if ($mainmenu == 'home') {
            $langs->load("users");
            if ($user->admin) {
                $langs->load("admin");
                $langs->load("help");
                $newmenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"));
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/modules.php", $langs->trans("Modules"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/menus.php", $langs->trans("Menus"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/ihm.php", $langs->trans("GUISetup"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/boxes.php", $langs->trans("Boxes"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/delais.php", $langs->trans("Alerts"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/proxy.php", $langs->trans("Security"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/limits.php", $langs->trans("MenuLimits"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/mails.php", $langs->trans("Emails"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/sms.php", $langs->trans("Sms"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/dict.php", $langs->trans("DictionnarySetup"), 1);
                }
                if ($leftmenu == "setup") {
                    $newmenu->add("/admin/const.php", $langs->trans("OtherSetup"), 1);
                }
                $newmenu->add("/admin/system/index.php?leftmenu=system", $langs->trans("SystemInfo"));
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/dolibarr.php", $langs->trans("Dolibarr"), 1);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/constall.php", $langs->trans("AllParameters"), 2);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/modules.php", $langs->trans("Modules"), 2);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/triggers.php", $langs->trans("Triggers"), 2);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/about.php", $langs->trans("About"), 2);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/os.php", $langs->trans("OS"), 1);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/web.php", $langs->trans("WebServer"), 1);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/phpinfo.php", $langs->trans("Php"), 1);
                }
                //if ($leftmenu=="system" && function_exists('xdebug_is_enabled')) $newmenu->add("/admin/system/xdebug.php", $langs->trans("XDebug"),1);
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/database.php", $langs->trans("Database"), 1);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/database-tables.php", $langs->trans("Tables"), 2);
                }
                if ($leftmenu == "system") {
                    $newmenu->add("/admin/system/database-tables-contraintes.php", $langs->trans("Constraints"), 2);
                }
                $newmenu->add("/admin/tools/index.php?leftmenu=admintools", $langs->trans("SystemTools"));
                if ($leftmenu == "admintools") {
                    $newmenu->add("/admin/tools/dolibarr_export.php", $langs->trans("Backup"), 1);
                }
                if ($leftmenu == "admintools") {
                    $newmenu->add("/admin/tools/dolibarr_import.php", $langs->trans("Restore"), 1);
                }
                if ($leftmenu == "admintools") {
                    $newmenu->add("/admin/tools/update.php", $langs->trans("MenuUpgrade"), 1);
                }
                if ($leftmenu == "admintools" && function_exists('eaccelerator_info')) {
                    $newmenu->add("/admin/tools/eaccelerator.php", $langs->trans("EAccelerator"), 1);
                }
                if ($leftmenu == "admintools") {
                    $newmenu->add("/admin/tools/listevents.php", $langs->trans("Audit"), 1);
                }
                if ($leftmenu == "admintools") {
                    $newmenu->add("/admin/tools/listsessions.php", $langs->trans("Sessions"), 1);
                }
                if ($leftmenu == "admintools") {
                    $newmenu->add("/admin/tools/purge.php", $langs->trans("Purge"), 1);
                }
                if ($leftmenu == "admintools") {
                    $newmenu->add("/support/index.php", $langs->trans("HelpCenter"), 1, 1, 'targethelp');
                }
            }
            $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"));
            if ($leftmenu == "users") {
                $newmenu->add("/user/index.php", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
            }
            if ($leftmenu == "users") {
                $newmenu->add("/user/fiche.php?action=create", $langs->trans("NewUser"), 2, $user->rights->user->user->creer || $user->admin);
            }
            if ($leftmenu == "users") {
                $newmenu->add("/user/group/index.php", $langs->trans("Groups"), 1, ($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin);
            }
            if ($leftmenu == "users") {
                $newmenu->add("/user/group/fiche.php?action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin);
            }
        }
        /*
         * Menu TIERS
         */
        if ($mainmenu == 'companies') {
            // Societes
            if ($conf->societe->enabled) {
                $langs->load("companies");
                $newmenu->add("/societe/societe.php", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire);
                if ($user->rights->societe->creer) {
                    $newmenu->add("/societe/soc.php?action=create", $langs->trans("MenuNewThirdParty"), 1);
                    if (!$conf->use_javascript_ajax) {
                        $newmenu->add("/societe/soc.php?action=create&amp;private=1", $langs->trans("MenuNewPrivateIndividual"), 1);
                    }
                }
                if (is_dir("societe/groupe")) {
                    $newmenu->add("/societe/groupe/index.php", $langs->trans("MenuSocGroup"), 1);
                }
            }
            // Prospects
            if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
                $langs->load("commercial");
                $newmenu->add("/comm/prospect/prospects.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire);
                if ($leftmenu == "prospects") {
                    $newmenu->add("/comm/prospect/prospects.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
                }
                if ($leftmenu == "prospects") {
                    $newmenu->add("/comm/prospect/prospects.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
                }
                if ($leftmenu == "prospects") {
                    $newmenu->add("/comm/prospect/prospects.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
                }
                if ($leftmenu == "prospects") {
                    $newmenu->add("/comm/prospect/prospects.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
                }
                if ($leftmenu == "prospects") {
                    $newmenu->add("/comm/prospect/prospects.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
                }
                $newmenu->add("/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
                //$newmenu->add("/contact/index.php?leftmenu=customers&amp;type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
            }
            // Clients
            if ($conf->societe->enabled) {
                $langs->load("commercial");
                $newmenu->add("/comm/clients.php?leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire);
                $newmenu->add("/societe/soc.php?leftmenu=customers&amp;action=create&amp;type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer);
                //$newmenu->add("/contact/index.php?leftmenu=customers&amp;type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
            }
            // Fournisseurs
            if ($conf->societe->enabled && $conf->fournisseur->enabled) {
                $langs->load("suppliers");
                $newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f", $langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
                }
                //$newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
                //$newmenu->add("/contact/index.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire);
            }
            // Contacts
            $newmenu->add("/contact/index.php?leftmenu=contacts", $langs->trans("ContactsAddresses"), 0, $user->rights->societe->contact->lire);
            $newmenu->add("/contact/fiche.php?leftmenu=contacts&amp;action=create", $langs->trans("NewContact"), 1, $user->rights->societe->contact->creer);
            $newmenu->add("/contact/index.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire);
            if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
                $newmenu->add("/contact/index.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire);
            }
            $newmenu->add("/contact/index.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire);
            if ($conf->fournisseur->enabled) {
                $newmenu->add("/contact/index.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire);
            }
            $newmenu->add("/contact/index.php?leftmenu=contacts&type=o", $langs->trans("Others"), 2, $user->rights->societe->contact->lire);
            //$newmenu->add("/contact/index.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire);
            // Categories
            if ($conf->categorie->enabled) {
                $langs->load("categories");
                // Categories prospects/customers
                $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/categories/fiche.php?action=create&amp;type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
                }
                // Categories suppliers
                if ($conf->fournisseur->enabled) {
                    $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire);
                    if ($user->societe_id == 0) {
                        $newmenu->add("/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
                    }
                }
                //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
            }
        }
        /*
         * Menu COMMERCIAL
         */
        if ($mainmenu == 'commercial') {
            $langs->load("companies");
            // Propal
            if (!empty($conf->propal->enabled)) {
                $langs->load("propal");
                $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Prop"), 0, $user->rights->propale->lire);
                $newmenu->add("/societe/societe.php?leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
                $newmenu->add("/comm/propal.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire);
                if ($leftmenu == "propals") {
                    $newmenu->add("/comm/propal.php?leftmenu=propals&viewstatut=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire);
                }
                if ($leftmenu == "propals") {
                    $newmenu->add("/comm/propal.php?leftmenu=propals&viewstatut=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire);
                }
                if ($leftmenu == "propals") {
                    $newmenu->add("/comm/propal.php?leftmenu=propals&viewstatut=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire);
                }
                if ($leftmenu == "propals") {
                    $newmenu->add("/comm/propal.php?leftmenu=propals&viewstatut=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire);
                }
                if ($leftmenu == "propals") {
                    $newmenu->add("/comm/propal.php?leftmenu=propals&viewstatut=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire);
                }
                //if ($leftmenu=="propals") $newmenu->add("/comm/propal.php?leftmenu=propals&viewstatut=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire);
                $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire);
            }
            // Customers orders
            if (!empty($conf->commande->enabled)) {
                $langs->load("orders");
                $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire);
                $newmenu->add("/societe/societe.php?leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer);
                $newmenu->add("/commande/liste.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire);
                if ($leftmenu == "orders") {
                    $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire);
                }
                if ($leftmenu == "orders") {
                    $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire);
                }
                if ($leftmenu == "orders") {
                    $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire);
                }
                if ($leftmenu == "orders") {
                    $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire);
                }
                if ($leftmenu == "orders") {
                    $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire);
                }
                if ($leftmenu == "orders") {
                    $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire);
                }
                $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire);
            }
            // Suppliers orders
            if (!empty($conf->fournisseur->enabled)) {
                $langs->load("orders");
                $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire);
                $newmenu->add("/societe/societe.php?leftmenu=orders_suppliers", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer);
                $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire);
                $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&amp;mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
            }
            // Contrat
            if (!empty($conf->contrat->enabled)) {
                $langs->load("contracts");
                $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("Contracts"), 0, $user->rights->contrat->lire);
                $newmenu->add("/societe/societe.php?leftmenu=contracts", $langs->trans("NewContract"), 1, $user->rights->contrat->creer);
                $newmenu->add("/contrat/liste.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire);
                $newmenu->add("/contrat/services.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
                if ($leftmenu == "contracts") {
                    $newmenu->add("/contrat/services.php?leftmenu=contracts&amp;mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
                }
                if ($leftmenu == "contracts") {
                    $newmenu->add("/contrat/services.php?leftmenu=contracts&amp;mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
                }
                if ($leftmenu == "contracts") {
                    $newmenu->add("/contrat/services.php?leftmenu=contracts&amp;mode=4&amp;filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
                }
                if ($leftmenu == "contracts") {
                    $newmenu->add("/contrat/services.php?leftmenu=contracts&amp;mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
                }
            }
            // Interventions
            if (!empty($conf->ficheinter->enabled)) {
                $langs->load("interventions");
                $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire);
                $newmenu->add("/fichinter/fiche.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer);
                $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire);
            }
        }
        /*
         * Menu COMPTA-FINANCIAL
         */
        if ($mainmenu == 'accountancy') {
            $langs->load("companies");
            // Customers invoices
            if ($conf->facture->enabled) {
                $langs->load("bills");
                $newmenu->add("/compta/facture.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/compta/clients.php?action=facturer&amp;leftmenu=customers_bills", $langs->trans("NewBill"), 1, $user->rights->facture->creer);
                }
                $newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills", $langs->trans("Repeatables"), 1, $user->rights->facture->lire);
                $newmenu->add("/compta/facture/impayees.php?leftmenu=customers_bills", $langs->trans("Unpaid"), 1, $user->rights->facture->lire);
                $newmenu->add("/compta/paiement/liste.php?leftmenu=customers_bills_payments", $langs->trans("Payments"), 1, $user->rights->facture->lire);
                if ($conf->global->BILL_ADD_PAYMENT_VALIDATION) {
                    $newmenu->add("/compta/paiement/avalider.php?leftmenu=customers_bills_payments", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire);
                }
                $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payments", $langs->trans("Reportings"), 2, $user->rights->facture->lire);
                $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"), 1, $user->rights->facture->lire);
            }
            // Suppliers
            if ($conf->societe->enabled && $conf->fournisseur->enabled) {
                if ($conf->facture->enabled) {
                    $langs->load("bills");
                    $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire);
                    if ($user->societe_id == 0) {
                        $newmenu->add("/fourn/facture/fiche.php?action=create", $langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer);
                    }
                    $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"), 1, $user->rights->fournisseur->facture->lire);
                    $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire);
                    $newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->facture->lire);
                }
            }
            // Orders
            if ($conf->commande->enabled) {
                $langs->load("orders");
                if ($conf->facture->enabled) {
                    $newmenu->add("/commande/liste.php?leftmenu=orders&amp;viewstatut=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
                }
                //                  if ($leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
            }
            // Donations
            if ($conf->don->enabled) {
                $langs->load("donations");
                $newmenu->add("/compta/dons/index.php?leftmenu=donations&amp;mainmenu=accountancy", $langs->trans("Donations"), 0, $user->rights->don->lire);
                if ($leftmenu == "donations") {
                    $newmenu->add("/compta/dons/fiche.php?action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer);
                }
                if ($leftmenu == "donations") {
                    $newmenu->add("/compta/dons/liste.php", $langs->trans("List"), 1, $user->rights->don->lire);
                }
                //if ($leftmenu=="donations") $newmenu->add("/compta/dons/stats.php",$langs->trans("Statistics"), 1, $user->rights->don->lire);
            }
            // Trips and expenses
            if ($conf->deplacement->enabled) {
                $langs->load("trips");
                $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire);
                if ($leftmenu == "tripsandexpenses") {
                    $newmenu->add("/compta/deplacement/fiche.php?action=create&amp;leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("New"), 1, $user->rights->deplacement->creer);
                }
                if ($leftmenu == "tripsandexpenses") {
                    $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire);
                }
                if ($leftmenu == "tripsandexpenses") {
                    $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire);
                }
            }
            // Taxes and social contributions
            if ($conf->tax->enabled) {
                $newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy", $langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire);
                if (preg_match('/^tax/i', $leftmenu)) {
                    $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire);
                }
                if (preg_match('/^tax/i', $leftmenu)) {
                    $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
                }
                if (preg_match('/^tax/i', $leftmenu)) {
                    $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
                }
                // VAT
                if ($conf->compta->tva) {
                    if (preg_match('/^tax/i', $leftmenu)) {
                        $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&amp;mainmenu=accountancy", $langs->trans("VAT"), 1, $user->rights->tax->charges->lire);
                    }
                    if (preg_match('/^tax/i', $leftmenu)) {
                        $newmenu->add("/compta/tva/fiche.php?leftmenu=tax_vat&action=create", $langs->trans("NewPayment"), 2, $user->rights->tax->charges->creer);
                    }
                    if (preg_match('/^tax/i', $leftmenu)) {
                        $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
                    }
                    if (preg_match('/^tax/i', $leftmenu)) {
                        $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
                    }
                    if (preg_match('/^tax/i', $leftmenu)) {
                        $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
                    }
                }
            }
            // Compta simple
            if ($conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION) {
                $newmenu->add("/compta/ventilation/index.php?leftmenu=ventil", $langs->trans("Dispatch"), 0, $user->rights->compta->ventilation->lire);
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/ventilation/liste.php", $langs->trans("ToDispatch"), 1, $user->rights->compta->ventilation->lire);
                }
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/ventilation/lignes.php", $langs->trans("Dispatched"), 1, $user->rights->compta->ventilation->lire);
                }
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/param/", $langs->trans("Setup"), 1, $user->rights->compta->ventilation->parametrer);
                }
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/param/comptes/fiche.php?action=create", $langs->trans("New"), 2, $user->rights->compta->ventilation->parametrer);
                }
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/param/comptes/liste.php", $langs->trans("List"), 2, $user->rights->compta->ventilation->parametrer);
                }
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/export/", $langs->trans("Export"), 1, $user->rights->compta->ventilation->lire);
                }
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/export/index.php?action=export", $langs->trans("New"), 2, $user->rights->compta->ventilation->lire);
                }
                if ($leftmenu == "ventil") {
                    $newmenu->add("/compta/export/liste.php", $langs->trans("List"), 2, $user->rights->compta->ventilation->lire);
                }
            }
            // Compta expert
            if ($conf->accounting->enabled) {
            }
            // Rapports
            if ($conf->comptabilite->enabled || $conf->accounting->enabled) {
                $langs->load("compta");
                // Bilan, resultats
                $newmenu->add("/compta/resultat/index.php?leftmenu=ca&amp;mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                if ($leftmenu == "ca") {
                    $newmenu->add("/compta/resultat/index.php?leftmenu=ca", $langs->trans("ReportInOut"), 1, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                }
                if ($leftmenu == "ca") {
                    $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=ca", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                }
                /* On verra ca avec module compabilite expert
                   if ($leftmenu=="ca") $newmenu->add("/compta/resultat/compteres.php?leftmenu=ca","Compte de resultat",2,$user->rights->compta->resultat->lire);
                   if ($leftmenu=="ca") $newmenu->add("/compta/resultat/bilan.php?leftmenu=ca","Bilan",2,$user->rights->compta->resultat->lire);
                   */
                if ($leftmenu == "ca") {
                    $newmenu->add("/compta/stats/index.php?leftmenu=ca", $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                }
                /*
                if ($leftmenu=="ca") $newmenu->add("/compta/stats/cumul.php?leftmenu=ca","Cumule",2,$user->rights->compta->resultat->lire);
                if ($conf->propal->enabled) {
                if ($leftmenu=="ca") $newmenu->add("/compta/stats/prev.php?leftmenu=ca","Previsionnel",2,$user->rights->compta->resultat->lire);
                if ($leftmenu=="ca") $newmenu->add("/compta/stats/comp.php?leftmenu=ca","Transforme",2,$user->rights->compta->resultat->lire);
                }
                */
                if ($leftmenu == "ca") {
                    $newmenu->add("/compta/stats/casoc.php?leftmenu=ca", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                }
                if ($leftmenu == "ca") {
                    $newmenu->add("/compta/stats/cabyuser.php?leftmenu=ca", $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                }
                // Journaux
                //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
                //journaux
                if ($leftmenu == "ca") {
                    $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=ca", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                }
                if ($leftmenu == "ca") {
                    $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=ca", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire);
                }
            }
        }
        /*
         * Menu BANK
         */
        if ($mainmenu == 'bank') {
            $langs->load("withdrawals");
            $langs->load("banks");
            $langs->load("bills");
            // Bank-Caisse
            if ($conf->banque->enabled) {
                $newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire);
                $newmenu->add("/compta/bank/fiche.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer);
                $newmenu->add("/compta/bank/categ.php", $langs->trans("Rubriques"), 1, $user->rights->banque->configurer);
                $newmenu->add("/compta/bank/search.php", $langs->trans("ListTransactions"), 1, $user->rights->banque->lire);
                $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->rights->banque->lire);
                $newmenu->add("/compta/bank/virement.php", $langs->trans("BankTransfers"), 1, $user->rights->banque->transfer);
            }
            // Prelevements
            if ($conf->prelevement->enabled) {
                $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&amp;mainmenu=bank", $langs->trans("StandingOrders"), 0, $user->rights->prelevement->bons->lire);
                //if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/demandes.php?status=0&amp;mainmenu=bank",$langs->trans("StandingOrderToProcess"),1,$user->rights->prelevement->bons->lire);
                if ($leftmenu == "withdraw") {
                    $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer);
                }
                if ($leftmenu == "withdraw") {
                    $newmenu->add("/compta/prelevement/bons.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire);
                }
                if ($leftmenu == "withdraw") {
                    $newmenu->add("/compta/prelevement/liste.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire);
                }
                if ($leftmenu == "withdraw") {
                    $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire);
                }
                if ($leftmenu == "withdraw") {
                    $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire);
                }
                //if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/config.php",$langs->trans("Setup"),1,$user->rights->prelevement->bons->configurer);
            }
            // Gestion cheques
            if ($conf->facture->enabled && $conf->banque->enabled) {
                $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&amp;mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque);
                $newmenu->add("/compta/paiement/cheque/fiche.php?leftmenu=checks&amp;action=new&amp;mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque);
                $newmenu->add("/compta/paiement/cheque/liste.php?leftmenu=checks&amp;mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->cheque);
            }
        }
        /*
         * Menu PRODUCTS-SERVICES
         */
        if ($mainmenu == 'products') {
            // Products
            if ($conf->product->enabled) {
                $newmenu->add("/product/index.php?leftmenu=product&amp;type=0", $langs->trans("Products"), 0, $user->rights->produit->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/product/fiche.php?leftmenu=product&amp;action=create&amp;type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer);
                    $newmenu->add("/product/liste.php?leftmenu=product&amp;type=0", $langs->trans("List"), 1, $user->rights->produit->lire);
                }
                if ($conf->propal->enabled) {
                    $newmenu->add("/product/popuprop.php?leftmenu=stats&amp;type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire);
                }
                if ($conf->stock->enabled) {
                    $newmenu->add("/product/reassort.php?type=0", $langs->trans("Stocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
                }
            }
            // Services
            if ($conf->service->enabled) {
                $newmenu->add("/product/index.php?leftmenu=service&amp;type=1", $langs->trans("Services"), 0, $user->rights->service->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/product/fiche.php?leftmenu=service&amp;action=create&amp;type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
                }
                $newmenu->add("/product/liste.php?leftmenu=service&amp;type=1", $langs->trans("List"), 1, $user->rights->service->lire);
                if ($conf->propal->enabled) {
                    $newmenu->add("/product/popuprop.php?leftmenu=stats&amp;type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire);
                }
            }
            // Categories
            if ($conf->categorie->enabled) {
                $langs->load("categories");
                $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/categories/fiche.php?action=create&amp;type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
                }
                //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
            }
            // Stocks
            if ($conf->stock->enabled) {
                $langs->load("stocks");
                $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Stocks"), 0, $user->rights->stock->lire);
                if ($leftmenu == "stock") {
                    $newmenu->add("/product/stock/fiche.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
                }
                if ($leftmenu == "stock") {
                    $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire);
                }
                if ($leftmenu == "stock") {
                    $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire);
                }
                if ($leftmenu == "stock") {
                    $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
                }
            }
            // Expeditions
            if ($conf->expedition->enabled) {
                $langs->load("sendings");
                $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire);
                if ($leftmenu == "sendings") {
                    $newmenu->add("/expedition/liste.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire);
                }
                if ($leftmenu == "sendings") {
                    $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire);
                }
            }
        }
        /*
         * Menu SUPPLIERS
         */
        if ($mainmenu == 'suppliers') {
            $langs->load("suppliers");
            if ($conf->societe->enabled && $conf->fournisseur->enabled) {
                $newmenu->add("/fourn/index.php?leftmenu=suppliers", $langs->trans("Suppliers"), 0, $user->rights->societe->lire && $user->rights->fournisseur->lire);
                // Security check
                if ($user->societe_id == 0) {
                    $newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f", $langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire);
                }
                $newmenu->add("/fourn/liste.php", $langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
                $newmenu->add("/contact/index.php?leftmenu=suppliers&amp;type=f", $langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire);
                $newmenu->add("/fourn/stats.php", $langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
            }
            if ($conf->facture->enabled) {
                $langs->load("bills");
                $newmenu->add("/fourn/facture/index.php", $langs->trans("Bills"), 0, $user->rights->fournisseur->facture->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/fourn/facture/fiche.php?action=create", $langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer);
                }
                $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire);
            }
            if ($conf->fournisseur->enabled) {
                $langs->load("orders");
                $newmenu->add("/fourn/commande/index.php?leftmenu=suppliers", $langs->trans("Orders"), 0, $user->rights->fournisseur->commande->lire);
                $newmenu->add("/societe/societe.php?leftmenu=supplier", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer);
                $newmenu->add("/fourn/commande/liste.php?leftmenu=suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire);
            }
            if ($conf->categorie->enabled) {
                $langs->load("categories");
                $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire);
                if ($user->societe_id == 0) {
                    $newmenu->add("/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
                }
                //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
            }
        }
        /*
         * Menu PROJECTS
         */
        if ($mainmenu == 'project') {
            if ($conf->projet->enabled) {
                $langs->load("projects");
                // Project affected to user
                $newmenu->add("/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
                $newmenu->add("/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
                $newmenu->add("/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
                // All project i have permission on
                $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
                $newmenu->add("/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
                $newmenu->add("/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
                // Project affected to user
                $newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
                $newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
                $newmenu->add("/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
                $newmenu->add("/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
                // All project i have permission on
                $newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
                $newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
                $newmenu->add("/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
                $newmenu->add("/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
            }
        }
        /*
         * Menu TOOLS
         */
        if ($mainmenu == 'tools') {
            if (!empty($conf->mailing->enabled)) {
                $langs->load("mails");
                $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire);
                $newmenu->add("/comm/mailing/fiche.php?leftmenu=mailing&amp;action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer);
                $newmenu->add("/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);
            }
            if (!empty($conf->export->enabled)) {
                $langs->load("exports");
                $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire);
                $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer);
                //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire);
            }
            if (!empty($conf->import->enabled)) {
                $langs->load("exports");
                $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run);
                $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run);
            }
            if (!empty($conf->domain->enabled)) {
                $langs->load("domains");
                $newmenu->add("/domain/index.php?leftmenu=export", $langs->trans("DomainNames"), 0, $user->rights->domain->read);
                $newmenu->add("/domain/fiche.php?action=create&leftmenu=export", $langs->trans("NewDomain"), 1, $user->rights->domain->create);
                $newmenu->add("/domain/index.php?leftmenu=export", $langs->trans("List"), 1, $user->rights->domain->read);
            }
            if (!empty($conf->submiteverywhere->enabled)) {
                $langs->load("submiteverywhere@submiteverywhere");
                $newmenu->add("/submiteverywhere/index.php?leftmenu=submiteverywhere", $langs->trans("News"), 0, $user->rights->submiteverywhere->read);
                $newmenu->add("/submiteverywhere/fiche.php?leftmenu=submiteverywhere&amp;action=create", $langs->trans("NewNews"), 1, $user->rights->submiteverywhere->create);
                $newmenu->add("/submiteverywhere/liste.php?leftmenu=submiteverywhere", $langs->trans("List"), 1, $user->rights->submiteverywhere->read);
            }
        }
        /*
         * Menu MEMBERS
         */
        if ($mainmenu == 'members') {
            if ($conf->adherent->enabled) {
                $langs->load("members");
                $langs->load("compta");
                $newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire);
                $newmenu->add("/adherents/fiche.php?leftmenu=members&amp;action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer);
                $newmenu->add("/adherents/liste.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire);
                $newmenu->add("/adherents/liste.php?leftmenu=members&amp;statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire);
                $newmenu->add("/adherents/liste.php?leftmenu=members&amp;statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire);
                $newmenu->add("/adherents/liste.php?leftmenu=members&amp;statut=1&amp;filter=uptodate", $langs->trans("MenuMembersUpToDate"), 2, $user->rights->adherent->lire);
                $newmenu->add("/adherents/liste.php?leftmenu=members&amp;statut=1&amp;filter=outofdate", $langs->trans("MenuMembersNotUpToDate"), 2, $user->rights->adherent->lire);
                $newmenu->add("/adherents/liste.php?leftmenu=members&amp;statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire);
                $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire);
                $newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire);
                $newmenu->add("/adherents/liste.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer);
                $newmenu->add("/adherents/cotisations.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire);
                if ($conf->categorie->enabled) {
                    $langs->load("categories");
                    $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=3", $langs->trans("Categories"), 0, $user->rights->categorie->lire);
                    if ($user->societe_id == 0) {
                        $newmenu->add("/categories/fiche.php?action=create&amp;type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
                    }
                    //if ($leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
                }
                $newmenu->add("/adherents/index.php?leftmenu=export&amp;mainmenu=members", $langs->trans("Exports"), 0, $user->rights->adherent->export);
                if ($conf->export->enabled && $leftmenu == "export") {
                    $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("Datas"), 1, $user->rights->adherent->export);
                }
                if ($leftmenu == "export") {
                    $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export);
                }
                if ($leftmenu == "export") {
                    $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export);
                }
                // Type
                $newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer);
                $newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members&amp;action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer);
                $newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer);
            }
        }
        // Affichage des menus personnalises
        require_once DOL_DOCUMENT_ROOT . "/core/class/menubase.class.php";
        $tabMenu = array();
        $menuArbo = new Menubase($db, 'eldy', 'left');
        $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, $user->societe_id ? 1 : 0, 'eldy', $tabMenu);
    }
    //var_dump($menu_array_before);exit;
    //var_dump($menu_array_after);exit;
    $menu_array = $newmenu->liste;
    if (is_array($menu_array_before)) {
        $menu_array = array_merge($menu_array_before, $menu_array);
    }
    if (is_array($menu_array_after)) {
        $menu_array = array_merge($menu_array, $menu_array_after);
    }
    //var_dump($menu_array);exit;
    // Show menu
    $alt = 0;
    if (is_array($menu_array)) {
        for ($i = 0; $i < sizeof($menu_array); $i++) {
            $alt++;
            if (empty($menu_array[$i]['level'])) {
                if ($alt % 2 == 0) {
                    print '<div class="blockvmenuimpair">' . "\n";
                } else {
                    print '<div class="blockvmenupair">' . "\n";
                }
            }
            // Place tabulation
            $tabstring = '';
            $tabul = $menu_array[$i]['level'] - 1;
            if ($tabul > 0) {
                for ($j = 0; $j < $tabul; $j++) {
                    $tabstring .= '&nbsp; &nbsp;';
                }
            }
            // For external modules
            $url = dol_buildpath($menu_array[$i]['url'], 1);
            // Menu niveau 0
            if ($menu_array[$i]['level'] == 0) {
                if ($menu_array[$i]['enabled']) {
                    print '<div class="menu_titre">' . $tabstring . '<a class="vmenu" href="' . $url . '"' . ($menu_array[$i]['target'] ? ' target="' . $menu_array[$i]['target'] . '"' : '') . '>' . $menu_array[$i]['titre'] . '</a></div>' . "\n";
                } else {
                    if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) {
                        print '<div class="menu_titre">' . $tabstring . '<font class="vmenudisabled">' . $menu_array[$i]['titre'] . '</font></div>' . "\n";
                    }
                }
                print '<div class="menu_top"></div>' . "\n";
            }
            // Menu niveau > 0
            if ($menu_array[$i]['level'] > 0) {
                if ($menu_array[$i]['enabled']) {
                    print '<div class="menu_contenu">' . $tabstring;
                    if ($menu_array[$i]['url']) {
                        print '<a class="vsmenu" href="' . $url . '"' . ($menu_array[$i]['target'] ? ' target="' . $menu_array[$i]['target'] . '"' : '') . '>';
                    }
                    print $menu_array[$i]['titre'];
                    if ($menu_array[$i]['url']) {
                        print '</a>';
                    }
                    // If title is not pure text and contains a table, no carriage return added
                    if (!strstr($menu_array[$i]['titre'], '<table')) {
                        print '<br>';
                    }
                    print '</div>' . "\n";
                } else {
                    if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) {
                        print '<div class="menu_contenu">' . $tabstring . '<font class="vsmenudisabled">' . $menu_array[$i]['titre'] . '</font><br></div>' . "\n";
                    }
                }
            }
            // If next is a new block or end
            if (empty($menu_array[$i + 1]['level'])) {
                print '<div class="menu_end"></div>' . "\n";
                print "</div>\n";
            }
        }
    }
    return sizeof($menu_array);
}
예제 #22
0
$page->title = "Menu Add";
$menu = new Menu();
$users = new Users();
$id = 0;
//get the user roles
$userroles = $users->getRoles();
$roles = [];
foreach ($userroles as $r) {
    $roles[$r['ID']] = $r['name'];
}
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
    case 'submit':
        if ($_POST["id"] == "") {
            $menu->add($_POST);
        } else {
            $ret = $menu->update($_POST);
        }
        header("Location:" . WWW_TOP . "/menu-list.php");
        break;
    case 'view':
    default:
        if (isset($_GET["id"])) {
            $page->title = "Menu Edit";
            $id = $_GET["id"];
            $menurow = $menu->getByID($id);
            $page->smarty->assign('menu', $menurow);
        }
        break;
}
예제 #23
0
    /**
     *    \brief      Show menu
     */
    function showmenu()
    {
        global $user,$conf,$langs,$dolibarr_main_db_name;
        $newmenu = new Menu();

        // Put here left menu entries
        // ***** START *****

        $langs->load("admin");  // Load translation file admin.lang
        $newmenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
        $newmenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
        $newmenu->add("/admin/modules.php", $langs->trans("Modules"),1);
        $newmenu->add("/admin/menus.php", $langs->trans("Menus"),1);
        $newmenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
        $newmenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
        $newmenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
        $newmenu->add("/admin/perms.php", $langs->trans("Security"),1);
        $newmenu->add("/admin/mails.php", $langs->trans("EMails"),1);
        $newmenu->add("/admin/limits.php", $langs->trans("Limits"),1);
        $newmenu->add("/admin/dict.php", $langs->trans("DictionnarySetup"),1);
        $newmenu->add("/admin/const.php", $langs->trans("OtherSetup"),1);

        // ***** END *****

        // do not change code after this

        // override menu_array by value array in $newmenu
        $this->menu_array=$newmenu->liste;

        $alt=0;
        for ($i = 0 ; $i < sizeof($this->menu_array) ; $i++)
        {
            $alt++;
            if (empty($this->menu_array[$i]['level']))
            {
                if (($alt%2==0))
                {
                    print '<div class="blockvmenuimpair">'."\n";
                }
                else
                {
                    print '<div class="blockvmenupair">'."\n";
                }
            }

            // Place tabulation
            $tabstring='';
            $tabul=($this->menu_array[$i]['level'] - 1);
            if ($tabul > 0)
            {
                for ($j=0; $j < $tabul; $j++)
                {
                    $tabstring.='&nbsp; &nbsp;';
                }
            }

            if ($this->menu_array[$i]['level'] == 0) {
                if ($this->menu_array[$i]['enabled'])
                {
                    print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'"'.($this->menu_array[$i]['target']?' target="'.$this->menu_array[$i]['target'].'"':'').'>'.$this->menu_array[$i]['titre'].'</a></div>'."\n";
                }
                else
                {
                    print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font></div>'."\n";
                }
                print '<div class="menu_top"></div>'."\n";
            }

            if ($this->menu_array[$i]['level'] > 0) {
                print '<div class="menu_contenu">';

                if ($this->menu_array[$i]['enabled'])
                    print $tabstring.'<a class="vsmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'">'.$this->menu_array[$i]['titre'].'</a><br>';
                else
                    print $tabstring.'<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';

                print '</div>'."\n";
            }

            // If next is a new block or end
            if (empty($this->menu_array[$i+1]['level']))
            {
                print '<div class="menu_end"></div>'."\n";
                print "</div>\n";
            }
        }
    }
예제 #24
0
파일: Gear.php 프로젝트: brussens/cogear2
 /**
  * Добавляем пункт меню на страниу админки «Внешний вид»
  *
  * @param Menu $menu
  */
 public function hookMenuAdminTheme($menu)
 {
     $menu->add(array('label' => t('Меню'), 'link' => l('/admin/theme/menu'), 'title' => FALSE));
 }
예제 #25
0
 public static function print_page($content)
 {
     $start_time = microtime(true);
     if (strlen(LINK_PATH) > 0) {
         $sitePathArray = explode("/", LINK_PATH);
         for ($i = 0; $i < count($sitePathArray); $i++) {
             $file = FILE_ROOT . implode("/", array_slice($sitePathArray, 0, $i + 1)) . "/sidebar.php";
             if (file_exists($file)) {
                 include $file;
                 MainTemplate::set_sidebar(sidebar());
                 MainTemplate::set_menu(menu());
             }
         }
         unset($sitePathArray, $i, $file);
     }
     $main_menu = new Menu();
     $main_menu->add_many(array("music", "Music Library", "music"), array("playlists", "Playlists", "th-list"), array("audiowalls", "Audiowalls", "th"), array("files", "Files", "folder-open"), array("showplans", "Show Planning", "tasks"));
     if (Session::is_admin()) {
         $main_menu->add("admin", "Admin", "cog");
     }
     $site_path_array = explode("/", LINK_PATH);
     $main_menu->set_active($site_path_array[0]);
     header("Content-Type: text/html; charset=utf-8");
     $return = "<!DOCTYPE html> \n<html> \n\t<head> \n\t\t<title>RaW Digiplay";
     if (Output::get_title() != 'Untitled Page') {
         $return .= " - " . Output::get_title();
     }
     $return .= "</title> \n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\t\t<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"" . LINK_ABS . "js/bootstrap.min.js\"></script>\n\t\t";
     if (isset($_REQUEST["theme"])) {
         $return .= "<link rel=\"stylesheet\" href=\"//netdna.bootstrapcdn.com/bootswatch/3.0.0/" . $_REQUEST["theme"] . "/bootstrap.min.css\">\n";
     } else {
         $return .= "<link rel=\"stylesheet\" href=\"" . LINK_ABS . "css/bootstrap.min.css\">\n";
     }
     if (count(Output::get_stylesheets()) > 0) {
         foreach (Output::get_stylesheets() as $src) {
             $return .= "<link href=\"" . $src . "\" rel=\"stylesheet\" type=\"text/css\">\n";
         }
     }
     if (count(Output::get_scripts()) > 0) {
         foreach (Output::get_scripts() as $src) {
             $return .= "<script src=\"" . $src . "\" type=\"text/javascript\"></script>\n";
         }
     }
     if (count(Output::get_feeds()) > 0) {
         foreach (Output::get_feeds() as $feed) {
             $return .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . $feed['title'] . "\" href=\"" . $feed['url'] . "\">\n";
         }
     }
     if (self::$barebones == false) {
         $return .= "\n\t\t\t<link rel=\"stylesheet\" href=\"" . LINK_ABS . "css/style.css\">\n\t\t\t<script src=\"" . LINK_ABS . "js/main.js\" type=\"text/javascript\"></script>\n\t\t\t";
     }
     $return .= "\t</head>\n\t<body" . (self::$body_class ? " class=\"" . self::$body_class . "\"" : "") . ">";
     if (self::$barebones == false) {
         $return .= "\n\t\t<div id=\"wrap\">\n\t\t\t<nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\n\t\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"navbar-header\">\n\t\t\t\t\t<button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-dps-collapse\">\n      \t\t\t\t\t\t<span class=\"sr-only\">Toggle navigation</span>\n      \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n      \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n      \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n    \t\t\t\t\t</button>\n\t    \t\t\t\t<a class=\"navbar-brand hidden-sm\" href=\"" . LINK_ABS . "\">Digiplay</a>\n\t\t\t\t\t<div class=\"navbar-spinner hidden\">\n\t\t\t\t\t\t<svg class=\"spinner\" width=\"25px\" height=\"25px\" viewBox=\"0 0 66 66\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t\t<circle class=\"path\" fill=\"none\" stroke-width=\"8\" stroke-linecap=\"round\" cx=\"33\" cy=\"33\" r=\"29\"></circle>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"navbar-collapse collapse navbar-dps-collapse\">" . $main_menu->output(LINK_ABS, 6, "nav navbar-nav");
         if (Session::is_user()) {
             $return .= "\n\t\t\t\t\t<ul class=\"nav search-pull-right hidden-sm\">\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<form class=\"navbar-form\" action=\"" . LINK_ABS . "music/search\" method=\"GET\" role=\"search\">\n\t\t\t\t\t\t\t\t<div class=\"form-group\">\n\t            \t\t\t\t\t<input type=\"text\" class=\"form-control search-query\" placeholder=\"Search Tracks\" name=\"q\" autocomplete=\"off\">\n\t            \t\t\t\t</div>\n\t            \t\t\t</form>\n\t            \t\t</li>\n\t            \t\t<li>\n\t\t          \t\t\t<ul id=\"quick-search\" class=\"dropdown-menu pull-right\"></ul>\n\t\t          \t\t</li>\n\t\t          \t</ul>\n\t\t          \t";
         }
         $return .= "\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</nav>\n\t\t\t" . (isset(self::$feature_html) ? "<div class=\"jumbotron" . (isset(self::$feature_image) ? " feature-image\" style=\"background-image: url('" . self::$feature_image . "')\"" : "\"") . "><div class=\"container\">" . self::$feature_html . "</div></div>" : "") . "<div class=\"container\">";
         if (Output::get_title() != 'Untitled Page') {
             $return .= "\n\t\t\t\t<div class=\"page-header\">\n\t\t\t\t\t<h2>" . Output::get_title();
             if (isset(self::$subtitle)) {
                 $return .= " <small>" . self::$subtitle . "</small>";
             }
             $return .= "</h2>\n\t\t\t\t</div>";
         }
         $return .= "\n\t\t\t\t<div class=\"row\">";
         if (isset(self::$sidebar) || isset(self::$menu)) {
             $return .= "\n\t\t\t\t<div class=\"col-md-3\">";
             if (isset(self::$menu)) {
                 $return .= self::$menu;
             }
             if (isset(self::$sidebar)) {
                 $return .= "\t\n\t\t\t\t\t<div class=\"panel panel-noborder visible-md visible-lg\">\n\t\t\t\t\t\t<div class=\"panel-body\">" . self::$sidebar . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>";
             }
             $return .= "\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-md-9\">";
         } else {
             $return .= "\n\t\t\t\t<div class=\"col-md-12\">";
         }
     }
     $return .= $content;
     if (self::$barebones == false) {
         $return .= "\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>";
         if (Session::is_user()) {
             $return .= Bootstrap::modal("logout-modal", "You'll lose any unsaved changes on this page.", "Log out?", "<a class=\"btn btn-primary\" href=\"" . LINK_ABS . "ajax/logout.php\">Yes, log out</a>");
         }
         $return .= "\n\t\t<div id=\"push\"></div>\n\t</div>\n\t\t<footer class=\"jumbotron\">\n\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<div class=\"col-sm-8\">\n\t\t\t\t\t\t<p class=\"text-muted credit\">";
         if (Session::is_user()) {
             $return .= "Logged in as " . Session::get_username() . ". <a href=\"#logout-modal\" data-toggle=\"modal\">Logout</a>. ";
         } else {
             $return .= "Not logged in. ";
         }
         $return .= "Copyright &copy; 2011-" . date("y") . " Radio Warwick\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t\t\t<a href=\"" . LINK_ABS . "\"><img src=\"" . LINK_ABS . "img/footer_logo.png\" alt=\"RaW 1251AM\" class=\"pull-right\"/></a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</footer>";
     }
     $return .= "\n\t<!-- Page generated in " . (microtime(true) - START_TIME) . " seconds. " . DigiplayDB::get_querycount() . " database queries ran in " . DigiplayDB::get_querytime() . " seconds. -->\n\t</body> \n</html>";
     return $return;
 }
예제 #26
0
    }
    public function setMenu($menu)
    {
        $this->_menu = $menu;
    }
    public function displayMenu()
    {
        $this->_menu->display();
    }
}
// 实例一下
// 创建menu
$subMenu1 = new Menu("sub menu1");
$subMenu2 = new Menu("sub menu2");
$subMenu3 = new Menu("sub menu3");
$item1 = new Item("163", "www.163.com");
$item2 = new Item("sina", "www.sina.com");
$subMenu1->add($item1);
$subMenu1->add($item2);
$item3 = new Item("baidu", "www.baidu.com");
$item4 = new Item("google", "www.google.com");
$subMenu2->add($item3);
$subMenu2->add($item4);
$allMenu = new Menu("All Menu");
$allMenu->add($subMenu1);
$allMenu->add($subMenu2);
$allMenu->add($subMenu3);
$objClient = new Client($allMenu);
$objClient->displayMenu();
$objClient->setMenu($subMenu2);
$objClient->displayMenu();
예제 #27
0
파일: proses.php 프로젝트: rad4n/erekutoro
<?php

session_start();
if (empty($_SESSION['namauser']) and empty($_SESSION['passuser'])) {
    header('location:../../404.php');
} else {
    include '../../../po-library/po-config.php';
    include '../../po-component/po-menumanager/includes/config.php';
    include '../../po-component/po-menumanager/includes/class.php';
    $mod = $_GET[mod];
    $act = $_GET[act];
    if ($mod == 'menu' and $act == 'add') {
        $instance = new Menu();
        $instance->add();
    } elseif ($mod == 'menu' and $act == 'edit') {
        $instance = new Menu();
        $instance->edit();
    } elseif ($mod == 'menu' and $act == 'save') {
        $instance = new Menu();
        $instance->save();
    } elseif ($mod == 'menu' and $act == 'save_position') {
        $instance = new Menu();
        $instance->save_position();
    } elseif ($mod == 'menu' and $act == 'delete') {
        $instance = new Menu();
        $instance->delete();
    } elseif ($mod == 'menu_group' and $act == 'add') {
        $instance = new Menu_group();
        $instance->add();
    } elseif ($mod == 'menu_group' and $act == 'edit') {
        $instance = new Menu_group();
예제 #28
0
<?php

Menu::add("Методички", "?c=showMetod&f=show", "files.png");
Menu::add("Задати питання", "", "edit-user - Copy.png", "modal", "#basicModal");
Menu::add("Нотатки", "?c=showStudDoc&f=showGroup", "browser.png");
Menu::add("Пройти тест", "?c=testing&f=show", "list-view.png");
print Menu::get();
?>
</div>
</div>
<div class="modal fade" id="basicModal" tabindex="-1" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header"><button class="close" type="button" data-dismiss="modal">x</button>
                <h4 class="modal-title" id="myModalLabel">Задати питання</h4>
            </div>
            <div class="modal-body">
                <div class="form-group''">
                    <form  enctype="multipart/form-data" role="form" method="post" id="form_id"  action="">
                        <div class="form-group">
                            <div class="panel-body">
                                <div class="col-xs-9 col-sm-10 col-md-10 col-lg-7"> <br/>
                                    <input type="hidden" id="name" name="name" value="<?php 
print SC::getSession('id');
?>
" /></br>
                                    <input type="text" id="email" name="email" placeholder="Email *" class="form-control" /></br>
                                    <textarea rows="4" cols="37" id="text" name="text" placeholder="Текст *"></textarea>

                                </div> <br /><br /><br>
                            </div>
예제 #29
0
<?php

\Menu::add('admincp-menu', 'online-members', ['link' => URL::to('admincp/online/members'), 'name' => 'Online Members']);
if (Config::get('onlinemember-seen-by-users', 1)) {
    app('menu')->add('site-menu', 'onlines', ['name' => trans('onlinemembers::global.online-members'), 'link' => \URL::to('onlines'), 'ajaxify' => true, 'icon' => '<i class="icon ion-android-social"></i>']);
}
예제 #30
0
            } catch (UnsupportOperationException $exception) {
            }
        }
    }
}
println(SEPARATE, '迭代器和组合模式', SEPARATE);
showImgs('9.png', '9_1_.png', '9_1_1_.png');
$pancakeHouseMenu = new Menu('Pancake House Menu', 'Breakfast');
#煎饼屋菜单
$dinerMenu = new Menu('Diner Menu', 'Lunch');
#餐厅菜单
$dessertMenu = new Menu('Dessert Menu', 'Dessert of Course!');
#甜品   餐厅子菜单
#根菜单组合
$allMenu = new Menu('All Menu', 'All Menu Combined');
$allMenu->add($pancakeHouseMenu);
$allMenu->add($dinerMenu);
$dessertMenu->add(new MenuItem('Apple Pie', 'Pie with Apple', 3.98, true));
#添加菜单项 苹果派
$dinerMenu->add(new MenuItem('steak', 'delicious steak', 60, false));
#添加菜单项 牛排
$dinerMenu->add($dessertMenu);
#添加子菜单
#打印所有菜单
$waitress = new Waitress($allMenu);
$waitress->printMenu();
println();
#打印出素食菜单
println('Vegetarian Menu:');
$waitress->printVegetarian();
println(SEPARATE, 'END', SEPARATE);