Example #1
0
/**
 *  Show an HTML header + a BODY + The top menu bar
 *
 *  @param      string	$head    			Lines in the HEAD
 *  @param      string	$title   			Title of web page
 *  @param      string	$target  			Target to use in menu links
 * 	@param		int		$disablejs			Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax)
 * 	@param		int		$disablehead		Do not output head section
 * 	@param		array	$arrayofjs			Array of js files to add in header
 * 	@param		array	$arrayofcss			Array of css files to add in header
 *  @param		string	$morequerystring	Query string to add to the link "print" to get same parameters (use only if autodetect fails)
 *  @return		void
 */
function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '') {
    global $user, $conf, $langs, $db;
    global $dolibarr_main_authentication;
    global $hookmanager;

    // Instantiate hooks of thirdparty module only if not already define
    if (!is_object($hookmanager)) {
        include_once(DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php');
        $hookmanager = new HookManager($db);
    }
    $hookmanager->initHooks(array('toprightmenu'));

    $toprightmenu = '';

    $conf->top_menu = 'auguria_backoffice.php';

    // For backward compatibility with old modules
    //if (empty($conf->headerdone)) top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);

    if (!defined('NOHEADER'))
        print '<body class="ptrn_a grdnt_b mhover_c fullW">'; // fullW full size width
    else
        print '<body style="background: white;">'; // fullW full size width

    /*
     * Top menu
     */
    $top_menu = $conf->top_menu;

    // Load the top menu manager
    // Load the top menu manager (only if not already done)
    if (!class_exists('MenuTop')) {
        $top_menu = 'auguria_backoffice.php';
        include_once(DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $top_menu);
    }
    ?> <!-- Start top horizontal menu ' . $top_menu . ' -->
    <?php if (!defined('NOHEADER')) : ?>
        <header>
            <div class="container head_s_a">
                <div class="row sepH_b">
                    <div class="six columns">
                        <div class="row">
                            <div class="five phone-two columns">
                                <div id="logo"><?php
        $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);
        else
            $urllogo = 'logo.png';
        print '<a href="' . DOL_URL_ROOT . '/index.php?idmenu=menu:home"><img src="' . $urllogo . '" alt="' . $conf->global->MAIN_INFO_SOCIETE_NOM . '" title="' . $conf->global->MAIN_INFO_SOCIETE_NOM . '"/></a>';
        ?>
                                </div>
                            </div>
        <?php if (!defined('NOLOGIN')) : ?>
                                <div class = "seven phone-two columns">
                                    <form action = "search.php" id = "search_box" method = "post">
                                        <input name = "query" id = "query" type = "text" size = "40" placeholder = "Find&hellip;" autocomplete = "off" />
                                    </form>
                                </div>
                                <script>
                                    $(document).ready(function() {
                                        $('#query').sautocomplete('search/data.php', {
                                            delay		: 10,
                                            minChars	: 2,
                                            max			: 6,
                                            matchCase	: 1,
                                            width		: 212
                                        }).result(function(event, query_val) {
                                            $.fancybox({
                                                href	: 'search/search_result.php',
                                                ajax : {
                                                    type	: "POST",
                                                    data	: "search_item=" + query_val
                                                },
                                                'overlayOpacity'	: '0.2',
                                                'transitionIn'		: 'elastic',
                                                'transitionOut'		: 'fade',
                                                onComplete			: function() {
                                                    $('#query').blur();
                                                }
                                            });
                                        });
                                        $('#search_box').submit(function() {
                                            var query_val = $("#query").val();
                                            $.fancybox({
                                                href	: 'search/search_result.php',
                                                ajax : {
                                                    type	: "POST",
                                                    data	: "search_item=" + query_val
                                                },
                                                'overlayOpacity'	: '0.2',
                                                'transitionIn'		: 'elastic',
                                                'transitionOut'		: 'fade'
                                            });
                                            return false;
                                        });
                                    });
                                </script>
                            </div>
                        </div>
                        <div class = "six columns">
                            <div class = "user_box cf">
                                <div class = "user_avatar">
                                    <img src = "theme/pertho_sample/img/user_female.png" alt = "" />
                                </div>
                                <div class = "user_info user_sep">
                                    <p class = "sepH_a">
                                        <strong><?php echo $user->values->Firstname; ?> <?php echo $user->values->Lastname; ?></strong>
                                    </p>
                                    <span>
                                        <a href = "user/fiche.php?id=<?php echo $user->id; ?>" class = "sep">Settings</a>
                                        <a href = "user/logout.php">Log out</a>
                                    </span>
                                </div>
                                <div class = "ntf_bar user_sep">
                                    <a href = "#ntf_mail_panel" class = "ntf_item" style = "background-image: url(theme/pertho_sample/img/ico/icSw2/32-Mail.png)">
                                        <span class = "ntf_tip ntf_tip_red"><span>12</span></span>
                                    </a>
                                    <a href = "#ntf_tickets_panel" class = "ntf_item" style = "background-image: url(theme/pertho_sample/img/ico/icSw2/32-Day-Calendar.png)">
                                        <span class = "ntf_tip ntf_tip_red"><span>122</span></span>
                                    </a>
                                    <a href = "#ntf_comments_panel" class = "ntf_item" style = "background-image: url(theme/pertho_sample/img/ico/icSw2/32-Speech-Bubble.png)">
                                        <span class = "ntf_tip ntf_tip_blue"><span>8</span></span>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>


            <?php if (!defined('NOREQUIREMENU')) : ?>
                        <div class = "row">
                            <div class = "twelve columns">

                                <?php
                                // Show menu
                                $menutop = new MenuTop($db);
                                $menutop->atarget = $target;
                                $menutop->showmenu();   // This contains a \n
                                ?>
                            </div>
                        </div>
                        <script>
                            $(document).ready(function() {
                                if(!jQuery.browser.mobile) {
                                    //* main navigatin
                                    prth_main_nav.h_nav();
                                } else {
                                    //* mobile navigatin
                                    prth_main_nav.mobile_nav();
                                }
                            });
                        </script>
                        <!--End Menu-->
            <?php endif; ?>

                </div>

                <!--notifications content-->
                <div style = "display:none">
                    <div id = "ntf_tickets_panel" style = "display:none">
                        <p class = "sticky-title">New Tickets</p>
                        <ul class = "sticky-list">
                            <li>
                                <a href = "#">Admin should not break if URL&hellip;
                                </a>
                                <p><span class = "s_color small">updated 01.04.2012</span></p>
                            </li>
                            <li>
                                <a href = "#">Displaying submenus in custom&hellip;
                                </a>
                                <p><span class = "s_color small">updated 01.04.2012</span></p>
                            </li>
                            <li>
                                <a href = "#">Featured image on post types.</a>
                                <p><span class = "s_color small">updated 24.03.2012</span></p>
                            </li>
                            <li>
                                <a href = "#">Multiple feed fixes and&hellip;
                                </a>
                                <p><span class = "s_color small">updated 22.03.2012</span></p>
                            </li>
                            <li>
                                <a href = "#">Automatic line breaks in&hellip;
                                </a>
                                <p><span class = "s_color small">updated 18.03.2012</span></p>
                            </li>
                            <li>
                                <a href = "#">Wysiwyg bug with shortcodes.</a>
                                <p><span class = "s_color small">updated 08.10.2012</span></p>
                            </li>
                        </ul>
                        <a href = "#" class = "gh_button btn-small">Show all tickets</a>
                    </div>
                    <div id = "ntf_comments_panel" style = "display:none">
                        <p class = "sticky-title">New Comments</p>
                        <ul class = "sticky-list">
                            <li>
                                <a href = "#">Lorem ipsum dolor sit amet&hellip;
                                </a>
                                <p><span class = "s_color small">John Smith on Maiden Castle, Dorset (29.10.2012)</span></p>
                            </li>
                            <li>
                                <a href = "#">Lorem ipsum dolor sit&hellip;
                                </a>
                                <p><span class = "s_color small">John Smith on Draining and development & hellip;
                                        (29.10.2012)</span></p>
                            </li>
                        </ul>
                        <a href = "#" class = "gh_button btn-small">Show all comments</a>
                    </div>
                    <div id = "ntf_mail_panel" style = "display:none">
                        <p class = "sticky-title">New Messages</p>
                        <ul class = "sticky-list">
                            <li>
                                <a href = "#">Lorem ipsum dolor sit amet&hellip;
                                </a>
                                <p><span class = "s_color small">From John Smith (29.10.2012)</span></p>
                            </li>
                            <li>
                                <a href = "#">Lorem ipsum dolor sit&hellip;
                                </a>
                                <p><span class = "s_color small">From John Smith (28.10.2012)</span></p>
                            </li>
                        </ul>
                        <a href = "#" class = "gh_button btn-small">Show all messages</a>
                    </div>
                </div>
        <?php endif; ?>
        </header>
    <?php endif; ?>
    <!-- End top horizontal menu -->
    <?php
}
Example #2
0
/**
 *  Show an HTML header + a BODY + The top menu bar
 *  @param      head    		Lines in the HEAD
 *  @param      title   		Title of web page
 *  @param      target  		Target to use in menu links
 *	@param		disablejs		Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax)
 *	@param		disablehead		Do not output head section
 *	@param		arrayofjs		Array of js files to add in header
 *	@param		arrayofcss		Array of css files to add in header
 *  @param		morequerystring	Query string to add to the link "print" to get same parameters (use only if autodetect fails)
 */
function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '')
{
    global $user, $conf, $langs, $db, $dolibarr_main_authentication;
    $html = new Form($db);
    if (!$conf->top_menu) {
        $conf->top_menu = 'eldy_backoffice.php';
    }
    // For backward compatibility with old modules
    if (empty($conf->headerdone)) {
        top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
    }
    print '<body id="mainbody">';
    if ($conf->use_javascript_ajax) {
        if ($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) {
            print '<script type="text/javascript">
				jQuery(document).ready(function () {
					jQuery("body").layout( layoutSettings );
				});
				var layoutSettings = {
					name: "mainlayout",
					defaults: {
						useStateCookie: true,
						size: "auto",
						resizable: false,
						//paneClass: "none",
						//resizerClass: "resizer",
						//togglerClass: "toggler",
						//buttonClass: "button",
						//contentSelector: ".content",
						//contentIgnoreSelector: "span",
						togglerTip_open: "Close This Pane",
						togglerTip_closed: "Open This Pane",
						resizerTip:	"Resize This Pane"
					},
					west: {
						paneClass: "leftContent",
						spacing_closed:	14,
						togglerLength_closed: 14,
						togglerAlign_closed: "top",
						//togglerLength_open: 0,
						//	effect defaults - overridden on some panes
						//slideTrigger_open:	"mouseover",
						//initClosed:	true,
						fxName:	"drop",
						fxSpeed: "normal",
						fxSettings: { easing: "" }
					},
					north: {
						paneClass: "none",
						resizerClass: "none",
						togglerClass: "none",
						spacing_open: 0,
						togglerLength_open:	0,
						togglerLength_closed: -1,
						slidable: false,
						fxName:	"none"
					},
					center: {
						paneSelector: "#mainContent"
					}
				}
    		</script>';
        }
        if (!empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION)) {
            print "\n" . '<script type="text/javascript">
					jQuery(document).ready(function () {
						jQuery( ".vmenu" ).accordion({
							autoHeight: false,
							event: "mouseover",
							//collapsible: true,
							//active: 2,
							header: "> .blockvmenupair > .menu_titre"
						});
					});
					</script>';
        }
        // Wrapper to show tooltips
        print "\n" . '<script type="text/javascript">
                    jQuery(document).ready(function () {
                    	jQuery(function() {
                        	$(".classfortooltip").tipTip({maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
                        });
                    });
                </script>';
    }
    /*
     * Top menu
     */
    $top_menu = isset($conf->browser->phone) ? $conf->smart_menu : $conf->top_menu;
    if (GETPOST('menu')) {
        $top_menu = GETPOST('menu');
    }
    // menu=eldy_backoffice.php
    // Load the top menu manager
    $result = dol_include_once("/includes/menus/standard/" . $top_menu);
    if (!$result) {
        $top_menu = 'eldy_backoffice.php';
        include_once DOL_DOCUMENT_ROOT . "/includes/menus/standard/" . $top_menu;
    }
    print "\n" . '<!-- Start top horizontal menu ' . $top_menu . ' -->' . "\n";
    if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) {
        print '<div class="ui-layout-north"> <!-- Begin top layout -->' . "\n";
    }
    print '<div id="tmenu_tooltip" class="tmenu">' . "\n";
    // Show menu
    $menutop = new MenuTop($db);
    $menutop->atarget = $target;
    $menutop->showmenu();
    // This contains a \n
    print "</div>\n";
    // Link to login card
    $loginhtmltext = '';
    $logintext = '';
    if ($user->societe_id) {
        $thirdpartystatic = new Societe($db);
        $thirdpartystatic->fetch($user->societe_id);
        $companylink = ' (' . $thirdpartystatic->getNomUrl('', '') . ')';
        $company = ' (' . $langs->trans("Company") . ': ' . $thirdpartystatic->name . ')';
    }
    $logintext = '<div class="login"><a href="' . DOL_URL_ROOT . '/user/fiche.php?id=' . $user->id . '"';
    $logintext .= $menutop->atarget ? ' target="' . $menutop->atarget . '"' : '';
    $logintext .= '>' . $user->login . '</a>';
    if ($user->societe_id) {
        $logintext .= $companylink;
    }
    $logintext .= '</div>';
    $loginhtmltext .= '<u>' . $langs->trans("User") . '</u>';
    $loginhtmltext .= '<br><b>' . $langs->trans("Name") . '</b>: ' . $user->getFullName($langs);
    $loginhtmltext .= '<br><b>' . $langs->trans("Login") . '</b>: ' . $user->login;
    $loginhtmltext .= '<br><b>' . $langs->trans("Administrator") . '</b>: ' . yn($user->admin);
    $type = $user->societe_id ? $langs->trans("External") . $company : $langs->trans("Internal");
    $loginhtmltext .= '<br><b>' . $langs->trans("Type") . '</b>: ' . $type;
    $loginhtmltext .= '<br><b>' . $langs->trans("IPAddress") . '</b>: ' . $_SERVER["REMOTE_ADDR"];
    $loginhtmltext .= '<br>';
    $loginhtmltext .= '<br><u>' . $langs->trans("Connection") . '</u>';
    if ($conf->global->MAIN_MODULE_MULTICOMPANY) {
        $loginhtmltext .= '<br><b>' . $langs->trans("ConnectedOnMultiCompany") . '</b>: ' . $conf->entity . ' (user entity ' . $user->entity . ')';
    }
    $loginhtmltext .= '<br><b>' . $langs->trans("ConnectedSince") . '</b>: ' . dol_print_date($user->datelastlogin, "dayhour");
    $loginhtmltext .= '<br><b>' . $langs->trans("PreviousConnexion") . '</b>: ' . dol_print_date($user->datepreviouslogin, "dayhour");
    $loginhtmltext .= '<br><b>' . $langs->trans("AuthenticationMode") . '</b>: ' . $_SESSION["dol_authmode"];
    $loginhtmltext .= '<br><b>' . $langs->trans("CurrentTheme") . '</b>: ' . $conf->theme;
    $s = picto_from_langcode($langs->getDefaultLang());
    $loginhtmltext .= '<br><b>' . $langs->trans("CurrentUserLanguage") . '</b>: ' . ($s ? $s . ' ' : '') . $langs->getDefaultLang();
    $loginhtmltext .= '<br><b>' . $langs->trans("Browser") . '</b>: ' . $conf->browser->name . ' (' . $_SERVER['HTTP_USER_AGENT'] . ')';
    if (!empty($conf->browser->phone)) {
        $loginhtmltext .= '<br><b>' . $langs->trans("Phone") . '</b>: ' . $conf->browser->phone;
    }
    if (!empty($_SESSION["disablemodules"])) {
        $loginhtmltext .= '<br><b>' . $langs->trans("DisabledModules") . '</b>: <br>' . join(', ', explode(',', $_SESSION["disablemodules"]));
    }
    // Link info
    $logouthtmltext = '';
    $logouttext = '';
    $logouthtmltext = $langs->trans("Logout") . '<br>';
    //$logouthtmltext.="<br>";
    if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
        $logouttext .= '<a href="' . DOL_URL_ROOT . '/user/logout.php"';
        $logouttext .= $menutop->atarget ? ' target="' . $menutop->atarget . '"' : '';
        $logouttext .= '>';
        $logouttext .= '<img class="login" border="0" width="14" height="14" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/logout.png"';
        $logouttext .= ' alt="' . dol_escape_htmltag($langs->trans("Logout")) . '" title=""';
        $logouttext .= '>';
        $logouttext .= '</a>';
    } else {
        $logouttext .= '<img class="login" border="0" width="14" height="14" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/logout.png"';
        $logouttext .= ' alt="' . dol_escape_htmltag($langs->trans("Logout")) . '" title=""';
        $logouttext .= '>';
    }
    print '<div class="login_block">' . "\n";
    print '<table class="nobordernopadding" summary=""><tr>';
    print $html->textwithtooltip('', $loginhtmltext, 2, 1, $logintext, '', 1);
    // Select entity
    if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) {
        if ($user->admin && !$user->entity) {
            $res = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
            if ($res) {
                $mc = new ActionsMulticompany($db);
                $mc->showInfo($conf->entity);
            }
        }
    }
    print $html->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, '', 1);
    // Link to print main content area
    if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->browser->phone)) {
        $qs = $_SERVER["QUERY_STRING"] . ($_SERVER["QUERY_STRING"] ? '&' : '') . $morequerystring;
        $text = '<a href="' . $_SERVER["PHP_SELF"] . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">';
        $text .= '<img class="printer" border="0" width="14" height="14" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/printer.png"';
        $text .= ' title="" alt="">';
        $text .= '</a>';
        print $html->textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, '', 1);
    }
    print '</tr></table>' . "\n";
    print "</div>\n";
    if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) {
        print "</div><!-- End top layout -->\n";
    }
    print "<!-- End top horizontal menu -->\n";
    if (!$conf->use_javascript_ajax || !$conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) {
        print '<table width="100%" class="notopnoleftnoright" summary="leftmenutable" id="undertopmenu"><tr>';
    }
}