/p078_dealerd1/menu.php
PHP | 370 lines | 302 code | 67 blank | 1 comment | 61 complexity | 0dc82a431ebd1f1656afc99013d78cc2 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, GPL-2.0, BSD-3-Clause, GPL-3.0, LGPL-2.1
- <?php
- $canCleanFilters = class_exists('qsBar', false);
- $cleanFiltersUrl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?no_restore=1';
-
- $new = ITSystemNew::findActive();
-
- $__logged = cPeople::getLoggedUser();
- ?>
- <script type="text/javascript">
- (function() {
- function __loadScript(src, fn) {
- var script = document.createElement('script');
- script.setAttribute("type", "text/javascript");
- script.setAttribute("src", src);
- document.getElementsByTagName("head")[0].appendChild(script);
-
- var self = this;
- script.onload = function() {
- if (fn) {
- fn.call(self);
- }
- };
- }
-
- function __loadStyle(href, fn) {
- var stylesheet = document.createElement("link");
- stylesheet.setAttribute("rel", "stylesheet");
- stylesheet.setAttribute("type", "text/css");
- stylesheet.setAttribute("href", href);
- document.getElementsByTagName("head")[0].appendChild(stylesheet);
-
- var self = this;
- stylesheet.onload = function() {
- if (fn) {
- fn.call(self);
- }
- };
- }
-
- function __loadJQuery(fn) {
- __loadScript('/p093_includes/js/jquery.min.js', fn);
- }
-
- function __loadSpinner() {
- __loadScript('/p093_includes/js/spin.min.js');
- }
-
- function __loadJQueryUI(fn) {
- __loadStyle('/p093_includes/css/jquery-ui/jquery-ui.css', function() {
- __loadScript('/p093_includes/js/jquery-ui.min.js', fn);
- });
- }
-
- function __loadMain(fn) {
- __loadScript('/p093_includes/js/main.js', fn);
- }
-
- function __leftMenu() {
- window.jQuery && $(document).ready(function() {
- <?php if ($new): ?>
- var container = $('#system-news-content-container');
- var oneDay = 1000 * 60 * 60 * 24;
- var expires = new Date(new Date().getTime() + oneDay * 365);
-
- $('#system-news-title').click(function() {
- if (container.css('display') == 'block') {
- container.fadeOut();
- $(this).removeClass('contract-arrow').addClass('expand-arrow');
- document.cookie = 'hiddenSystemNewsContainer=1;expires=' + expires.toGMTString() + ';path=/';
- return;
- }
-
- container.fadeIn();
- $(this).removeClass('expand-arrow').addClass('contract-arrow');
- document.cookie = 'hiddenSystemNewsContainer=1;expires=' + new Date(new Date().getTime() - oneDay) + ';path=/';
- });
- <?php endif; ?>
-
- $('div.menu #menu-sms-ph-notif-link').click(function() {
- phSMSNotificationPopup = $.popup({
- url: '/p078_dealerd1/p101_NPS/ajax/Menu_PH_SMS_Notification.php?cPeople_ID=<?php echo $_SESSION['cPeople_ID']; ?>',
- title: 'SMS Notification for Phone Messages'
- });
-
- return false;
- });
-
- <?php if ($rolemgr->check('DL/SYS/Debug2') && !empty($_SESSION['roles'])): ?>
- $('#expand-contract-menu-rolecode-container').click(function() {
- if ($(this).hasClass('expand-arrow')) {
- $('.left-menu-container .role-codes-container').css('height', 'auto');
- $(this).removeClass('expand-arrow').addClass('contract-arrow');
- return;
- }
-
- $('.left-menu-container .role-codes-container').css('height', '110px');
- $(this).removeClass('contract-arrow').addClass('expand-arrow');
- });
- <?php endif; ?>
-
- });
- }
-
- if (!window.jQuery) {
- __loadJQuery(function() {
- __loadJQueryUI(function() {
- if (!window.mainJs) {
- __loadMain(__leftMenu);
- return;
- }
-
- __leftMenu();
-
- });
- });
- } else if (window.jQuery && !window.jQuery.ui) {
- __loadJQueryUI(function() {
- if (!window.mainJs) {
- __loadScript('/p093_includes/js/main.js', __leftMenu);
- return;
- }
-
- __leftMenu();
- });
- } else if (!window.mainJs) {
- __loadScript('/p093_includes/js/main.js', __leftMenu);
- } else {
- __leftMenu();
- }
-
- if (!window.Spinner) {
- __loadSpinner();
- }
- })();
- </script>
- <?php if ($new): ?>
- <div class="spacer-10"></div>
- <div class="bold red-text font-12 cpointer <?php echo !empty($_COOKIE['hiddenSystemNewsContainer']) ? 'expand-arrow': 'contract-arrow' ?>" style="background-position: center right" id="system-news-title">Systems News</div>
- <div class="spacer-10"></div>
- <div id="system-news-content-container" style="display:<?php echo !empty($_COOKIE['hiddenSystemNewsContainer']) ? 'none': 'block' ?>">
- <?php if (empty($new->p143_IT_System_News_Subject) && empty($new->p143_IT_System_News_Desc)): ?>
- <span>All Systems are currently reported operational, should you be experiencing a systems error <a href="/p078_dealerd1/p140_Support/p140_Support_Ticket_New.php">click here</a></span>
- <?php else: ?>
- <span class="bold"><?php echo $new->p143_IT_System_News_Subject ?></span>
- <div class="spacer-5"></div>
- <span><?php echo $new->p143_IT_System_News_Desc ?></span>
- <?php endif ?>
- <div class="spacer-10"></div>
- <hr/>
- </div>
- <?php endif ?>
-
- <?php if (false && $Session->rolemgr->check('DL/SYS/Debug3')):?>
- <div class="debug-panel" id="debug-panel">
- <script type="text/javascript">
- function toggleDebugPanel() {
- var display = document.getElementById('debug-panel').style.display;
- if (display == 'none' || display == '') {
- display = 'block';
- } else {
- display = 'none';
- }
-
- document.getElementById('debug-panel').style.display = display;
- }
- </script>
-
- <div class="title"><a href="javascript:toggleDebugPanel()">Hide</a></div>
- <?php global $db?>
-
- <div class="content">
- <?php $mysqlDebug = $db->debugOut?>
-
- <?php if (!empty($mysqlDebug)):?>
- <div style="font-weight:bold;">MYSQL:</div>
- <div class="vSpacer10"></div>
- <div style="padding-left:20px"><?php echo $db->debugOut?></div>
- <div class="vSpacer20"></div>
- <?php endif?>
-
- <?php if (Debug::getInstance()->getPhpErrorCount() > 0):?>
- <div style="font-weight:bold;">PHP Errors:</div>
- <div class="vSpacer10"></div>
- <div style="padding-left:20px"><?php echo Debug::getInstance()->getDisplayPhpErrors()?></div>
- <?php endif?>
- </div>
-
- <div class="info">
- <dl>
- <dt><b>Mysql Queries:</b></dt>
- <dd><?php echo $db->queriesCount?></dd>
-
- <dt><b>Mysql Errors:</b></dt>
- <dd><?php echo $db->errorsCount?></dd>
-
- <dt><b>PHP Errors:</b></dt>
- <dd><?php echo Debug::getInstance()->getPhpErrorCount()?></dd>
- </dl>
- <div class="clear"></div>
- </div>
-
- <div class="resize"></div>
- </div>
- <?php endif?>
-
- <div class="menu">
- <div class="left-menu-container">
- <?php if ($rolemgr->check('DD/Menu/New')): ?>
-
- <?php $view->html->maybeLoadExtJSScoped(); ?>
-
- <?php $view->html->stylesheet('side-menu'); ?>
- <script type="text/javascript">
- <?php
- $sideMenuKey = 'jsonSideMenu_' . $_SESSION['cPeople_ID'];
- // if (empty($_SESSION[$sideMenuKey]))
- {
- $_SESSION[$sideMenuKey] = json_encode(PersonalMenuItem::contextSideMenuSource());
- }
-
- $json = $_SESSION[$sideMenuKey];
-
- if (empty($json))
- {
- $json = '{}';
- }
-
- ?>
- var sideMenuItems = <?php echo $json; ?>;
- </script>
- <script type="text/javascript" src="/p093_includes/js/p143_Side_Menu.js"></script>
- <ul class="left-menu">
- <?php if (!isset($_SESSION['cPeople_ID'])): ?>
- <li><a href="/p078_dealerd1/index.php">Login</a></li>
- <?php else: ?>
- <?php $homeMenu = $__logged->getHomeMenu(); ?>
- <?php if ($homeMenu && !empty($homeMenu->p143_Menu_Item_URL)): ?>
- <li><a href="<?php echo $homeMenu->p143_Menu_Item_URL; ?>">Home Menu</a></li>
- <?php endif ?>
-
- <li><a href="/p078_dealerd1/System_Menu.php">Grid Menu</a></li>
- <?php endif; ?>
- </ul>
- <div id="side-menu-container" class="x-reset"></div>
- <ul class="left-menu">
- <li><a href="<?php echo $cleanFiltersUrl; ?>" id="clean-filters">Clean filters</a></li>
-
- <?php if (isset($_SESSION['cPeople_ID'])):?>
- <li><a href="/p078_dealerd1/logout.php">Log Off</a></li>
- <?php endif ?>
- </ul>
- <div class="spacer-10"></div>
- <?php else: ?>
-
- <div class="spacer-10"></div>
- <ul class="left-menu">
- <?php if (!isset($_SESSION['cPeople_ID'])) { ?>
- <li><a href="/p078_dealerd1/index.php">Login</a></li>
- <?php } ?>
-
- <li><a href="<?php echo WIKI_ROOT; ?>">Wiki</a></li>
-
- <?php if (!$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
- <li><a href="/p078_dealerd1/welcome.php">Dealer Desktop</a></li>
- <?php endif ?>
-
- <?php if ($rolemgr->check('DL/SM')): ?>
- <li><a href="/p078_dealerd1/DealerPOS/Sales_POS/Sales_Status.php">Sales Status</a></li>
- <?php endif ?>
-
- <?php if ($rolemgr->check('Dashboard/Sales')):?>
- <li><a href="/p078_dealerd1/Dashboard1/Sales_Dashboard/index.php">Dashboard</a></li>
- <?php endif ?>
-
- <?php if ($rolemgr->check('Dashboard/Finance')):?>
- <li><a href="/p078_dealerd1/Dashboard1/Finance_Dashboard/Dash1.php">Finance Dashboard</a></li>
- <?php endif ?>
-
- <?php if ($__logged && !$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
- <li>
- <a href="/p078_dealerd1/M012_Tasks/Tasks2.php">Tasks</a>
- <?php $tasksCount = $__logged->getTasksCount(); ?>
- <?php if (!empty($tasksCount)): ?>
- <span class="count label"><a href="/p078_dealerd1/M012_Tasks/Tasks2.php"><?php echo $tasksCount; ?></a></span>
- <?php endif ?>
- <div class="clear"></div>
- </li>
- <li><a href="/p078_dealerd1/M012_Tasks/Tasks_Others_Status2.php">Tasks Others</a></li>
- <?php endif ?>
-
- <?php if ($Session->rolemgr->check('p108/FC')):?>
- <li><a href="/p078_dealerd1/p108_Lead_Management/FC/FC_Main.php">Floor Control</a></li>
- <?php endif?>
-
- <?php if ($rolemgr->check("DL") && !$rolemgr->check('Dashboard/Sales/Main_Menu')):?>
- <li><a href="/p078_dealerd1/p077_DealLog1/index.php">Deal Log</a></li>
- <?php endif?>
-
- <?php if (!$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
- <li><a href="/p078_dealerd1/p108_Lead_Management/p108_Menu.php">Lead Management</a></li>
- <?php endif ?>
-
- <?php if ($rolemgr->check('Dashboard/PD')):?>
- <li><a href="/p078_dealerd1/p077_DealLog1/PD_Main/PD_Dashboard.php">PD Dashboard</a></li>
- <?php endif ?>
-
- <?php if ($rolemgr->check('Dashboard/GM')):?>
- <li><a href="/p078_dealerd1/p077_DealLog1/GM_Main/GM_Dashboard/index.php">GM Dashboard</a></li>
- <?php endif ?>
-
- <?php if ($rolemgr->check("CC/NPS/Main") && !$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
- <li><a href="/p078_dealerd1/p101_NPS/NPS_Main.php">NPS</a></li>
- <?php endif ?>
-
- <li><a href="/p078_dealerd1/search.php">Search</a></li>
- <li><a href="/p100_phonebook/p100_Phonebook_Main.php">Phone Book</a></li>
-
- <?php if ($rolemgr->check('DL/SP')):?>
- <li><a href="/p078_dealerd1/thesmartway.php">The SMART Way</a></li>
- <?php endif?>
-
- <li><a href="<?php echo $cleanFiltersUrl?>" id="clearn-filters">Clean filters</a></li>
-
- <?php if (isset($_SESSION['cPeople_ID'])):?>
- <li><a href="/p078_dealerd1/logout.php">Log Off</a></li>
- <?php endif ?>
- </ul>
-
- <?php endif; ?>
-
- <div class="spacer-10"></div>
- <?php if ($Session->rolemgr->check('DL/SYS/Debug3')):?>
- <div class="left-float"><button type="button" onclick="window.location='/p078_dealerd1/index.php?debug=off'" class="small-button">Debug Off</button></div>
- <?php else:?>
- <div class="left-float"><button class="small-button" type="button" onclick="if (confirm('Really turn on debug mode?')) window.location='/p078_dealerd1/index.php?debug=on'" class="small-button">Debug On</button></div>
- <?php endif?>
-
- <div class="left-float ml-5">
- <a href="#" id="menu-sms-ph-notif-link"><img src="/p093_includes/images/gear-32.png" alt="SMS Notification" title="SMS Notification for Phone Messages" width="32" height="32" /></a>
- </div>
-
- <div class="spacer-10"></div>
-
- <?php include_once('include/menu_fuel_card_balance.php'); ?>
-
- <?php if ($rolemgr->check('DL/SYS/Debug2') && !empty($_SESSION['roles'])): ?>
-
- <div class="role-codes-container" style="height: 110px;">
- <div class="expand-arrow cpointer" style="width: 138px;height: 24px;border:1px solid #eee" id="expand-contract-menu-rolecode-container" title="Role Codes"> </div>
-
- <?php
- $ctr=0;
- foreach ($_SESSION['roles'] as $the_role=>$set) {
- $ctr++;
- if (!$the_role) continue;
- ?>
-
- <div><input type="checkbox" onmouseup="window.location='/p078_dealerd1/index.php?role_change=1&role_list[<?php echo str_replace(" ",'QQQQ',$the_role); ?>]='+this.checked" style="width:16px;height:16px;" id="role_<?php echo $ctr; ?>" name="role_list[<?php echo str_replace(" ",'QQQQ',$the_role); ?>]"<?php if ($set) echo ' CHECKED'; ?> title="<?php echo $the_role; ?>" /><label title="<?php echo $the_role; ?>" for="role_<?php echo $ctr; ?>" onclick="return false"><?php echo $the_role; ?></label></div>
- <?php
- }
- ?>
- </div>
- <div class="spacer-10"></div>
- <?php endif; ?>
-
- <?php if (isGranted('SYSTEM ADMIN/SwichUser')): ?>
- <?php require_once('include/menu/switch_user.php'); ?>
- <?php endif; ?>
- </div>
- </div>