PageRenderTime 52ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/p078_dealerd1/menu.php

https://bitbucket.org/rlm3/rlm3_staging
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
  1. <?php
  2. $canCleanFilters = class_exists('qsBar', false);
  3. $cleanFiltersUrl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?no_restore=1';
  4. $new = ITSystemNew::findActive();
  5. $__logged = cPeople::getLoggedUser();
  6. ?>
  7. <script type="text/javascript">
  8. (function() {
  9. function __loadScript(src, fn) {
  10. var script = document.createElement('script');
  11. script.setAttribute("type", "text/javascript");
  12. script.setAttribute("src", src);
  13. document.getElementsByTagName("head")[0].appendChild(script);
  14. var self = this;
  15. script.onload = function() {
  16. if (fn) {
  17. fn.call(self);
  18. }
  19. };
  20. }
  21. function __loadStyle(href, fn) {
  22. var stylesheet = document.createElement("link");
  23. stylesheet.setAttribute("rel", "stylesheet");
  24. stylesheet.setAttribute("type", "text/css");
  25. stylesheet.setAttribute("href", href);
  26. document.getElementsByTagName("head")[0].appendChild(stylesheet);
  27. var self = this;
  28. stylesheet.onload = function() {
  29. if (fn) {
  30. fn.call(self);
  31. }
  32. };
  33. }
  34. function __loadJQuery(fn) {
  35. __loadScript('/p093_includes/js/jquery.min.js', fn);
  36. }
  37. function __loadSpinner() {
  38. __loadScript('/p093_includes/js/spin.min.js');
  39. }
  40. function __loadJQueryUI(fn) {
  41. __loadStyle('/p093_includes/css/jquery-ui/jquery-ui.css', function() {
  42. __loadScript('/p093_includes/js/jquery-ui.min.js', fn);
  43. });
  44. }
  45. function __loadMain(fn) {
  46. __loadScript('/p093_includes/js/main.js', fn);
  47. }
  48. function __leftMenu() {
  49. window.jQuery && $(document).ready(function() {
  50. <?php if ($new): ?>
  51. var container = $('#system-news-content-container');
  52. var oneDay = 1000 * 60 * 60 * 24;
  53. var expires = new Date(new Date().getTime() + oneDay * 365);
  54. $('#system-news-title').click(function() {
  55. if (container.css('display') == 'block') {
  56. container.fadeOut();
  57. $(this).removeClass('contract-arrow').addClass('expand-arrow');
  58. document.cookie = 'hiddenSystemNewsContainer=1;expires=' + expires.toGMTString() + ';path=/';
  59. return;
  60. }
  61. container.fadeIn();
  62. $(this).removeClass('expand-arrow').addClass('contract-arrow');
  63. document.cookie = 'hiddenSystemNewsContainer=1;expires=' + new Date(new Date().getTime() - oneDay) + ';path=/';
  64. });
  65. <?php endif; ?>
  66. $('div.menu #menu-sms-ph-notif-link').click(function() {
  67. phSMSNotificationPopup = $.popup({
  68. url: '/p078_dealerd1/p101_NPS/ajax/Menu_PH_SMS_Notification.php?cPeople_ID=<?php echo $_SESSION['cPeople_ID']; ?>',
  69. title: 'SMS Notification for Phone Messages'
  70. });
  71. return false;
  72. });
  73. <?php if ($rolemgr->check('DL/SYS/Debug2') && !empty($_SESSION['roles'])): ?>
  74. $('#expand-contract-menu-rolecode-container').click(function() {
  75. if ($(this).hasClass('expand-arrow')) {
  76. $('.left-menu-container .role-codes-container').css('height', 'auto');
  77. $(this).removeClass('expand-arrow').addClass('contract-arrow');
  78. return;
  79. }
  80. $('.left-menu-container .role-codes-container').css('height', '110px');
  81. $(this).removeClass('contract-arrow').addClass('expand-arrow');
  82. });
  83. <?php endif; ?>
  84. });
  85. }
  86. if (!window.jQuery) {
  87. __loadJQuery(function() {
  88. __loadJQueryUI(function() {
  89. if (!window.mainJs) {
  90. __loadMain(__leftMenu);
  91. return;
  92. }
  93. __leftMenu();
  94. });
  95. });
  96. } else if (window.jQuery && !window.jQuery.ui) {
  97. __loadJQueryUI(function() {
  98. if (!window.mainJs) {
  99. __loadScript('/p093_includes/js/main.js', __leftMenu);
  100. return;
  101. }
  102. __leftMenu();
  103. });
  104. } else if (!window.mainJs) {
  105. __loadScript('/p093_includes/js/main.js', __leftMenu);
  106. } else {
  107. __leftMenu();
  108. }
  109. if (!window.Spinner) {
  110. __loadSpinner();
  111. }
  112. })();
  113. </script>
  114. <?php if ($new): ?>
  115. <div class="spacer-10"></div>
  116. <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>
  117. <div class="spacer-10"></div>
  118. <div id="system-news-content-container" style="display:<?php echo !empty($_COOKIE['hiddenSystemNewsContainer']) ? 'none': 'block' ?>">
  119. <?php if (empty($new->p143_IT_System_News_Subject) && empty($new->p143_IT_System_News_Desc)): ?>
  120. <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&nbsp;here</a></span>
  121. <?php else: ?>
  122. <span class="bold"><?php echo $new->p143_IT_System_News_Subject ?></span>
  123. <div class="spacer-5"></div>
  124. <span><?php echo $new->p143_IT_System_News_Desc ?></span>
  125. <?php endif ?>
  126. <div class="spacer-10"></div>
  127. <hr/>
  128. </div>
  129. <?php endif ?>
  130. <?php if (false && $Session->rolemgr->check('DL/SYS/Debug3')):?>
  131. <div class="debug-panel" id="debug-panel">
  132. <script type="text/javascript">
  133. function toggleDebugPanel() {
  134. var display = document.getElementById('debug-panel').style.display;
  135. if (display == 'none' || display == '') {
  136. display = 'block';
  137. } else {
  138. display = 'none';
  139. }
  140. document.getElementById('debug-panel').style.display = display;
  141. }
  142. </script>
  143. <div class="title"><a href="javascript:toggleDebugPanel()">Hide</a></div>
  144. <?php global $db?>
  145. <div class="content">
  146. <?php $mysqlDebug = $db->debugOut?>
  147. <?php if (!empty($mysqlDebug)):?>
  148. <div style="font-weight:bold;">MYSQL:</div>
  149. <div class="vSpacer10"></div>
  150. <div style="padding-left:20px"><?php echo $db->debugOut?></div>
  151. <div class="vSpacer20"></div>
  152. <?php endif?>
  153. <?php if (Debug::getInstance()->getPhpErrorCount() > 0):?>
  154. <div style="font-weight:bold;">PHP Errors:</div>
  155. <div class="vSpacer10"></div>
  156. <div style="padding-left:20px"><?php echo Debug::getInstance()->getDisplayPhpErrors()?></div>
  157. <?php endif?>
  158. </div>
  159. <div class="info">
  160. <dl>
  161. <dt><b>Mysql Queries:</b></dt>
  162. <dd><?php echo $db->queriesCount?></dd>
  163. <dt><b>Mysql Errors:</b></dt>
  164. <dd><?php echo $db->errorsCount?></dd>
  165. <dt><b>PHP Errors:</b></dt>
  166. <dd><?php echo Debug::getInstance()->getPhpErrorCount()?></dd>
  167. </dl>
  168. <div class="clear"></div>
  169. </div>
  170. <div class="resize"></div>
  171. </div>
  172. <?php endif?>
  173. <div class="menu">
  174. <div class="left-menu-container">
  175. <?php if ($rolemgr->check('DD/Menu/New')): ?>
  176. <?php $view->html->maybeLoadExtJSScoped(); ?>
  177. <?php $view->html->stylesheet('side-menu'); ?>
  178. <script type="text/javascript">
  179. <?php
  180. $sideMenuKey = 'jsonSideMenu_' . $_SESSION['cPeople_ID'];
  181. // if (empty($_SESSION[$sideMenuKey]))
  182. {
  183. $_SESSION[$sideMenuKey] = json_encode(PersonalMenuItem::contextSideMenuSource());
  184. }
  185. $json = $_SESSION[$sideMenuKey];
  186. if (empty($json))
  187. {
  188. $json = '{}';
  189. }
  190. ?>
  191. var sideMenuItems = <?php echo $json; ?>;
  192. </script>
  193. <script type="text/javascript" src="/p093_includes/js/p143_Side_Menu.js"></script>
  194. <ul class="left-menu">
  195. <?php if (!isset($_SESSION['cPeople_ID'])): ?>
  196. <li><a href="/p078_dealerd1/index.php">Login</a></li>
  197. <?php else: ?>
  198. <?php $homeMenu = $__logged->getHomeMenu(); ?>
  199. <?php if ($homeMenu && !empty($homeMenu->p143_Menu_Item_URL)): ?>
  200. <li><a href="<?php echo $homeMenu->p143_Menu_Item_URL; ?>">Home Menu</a></li>
  201. <?php endif ?>
  202. <li><a href="/p078_dealerd1/System_Menu.php">Grid Menu</a></li>
  203. <?php endif; ?>
  204. </ul>
  205. <div id="side-menu-container" class="x-reset"></div>
  206. <ul class="left-menu">
  207. <li><a href="<?php echo $cleanFiltersUrl; ?>" id="clean-filters">Clean filters</a></li>
  208. <?php if (isset($_SESSION['cPeople_ID'])):?>
  209. <li><a href="/p078_dealerd1/logout.php">Log Off</a></li>
  210. <?php endif ?>
  211. </ul>
  212. <div class="spacer-10"></div>
  213. <?php else: ?>
  214. <div class="spacer-10"></div>
  215. <ul class="left-menu">
  216. <?php if (!isset($_SESSION['cPeople_ID'])) { ?>
  217. <li><a href="/p078_dealerd1/index.php">Login</a></li>
  218. <?php } ?>
  219. <li><a href="<?php echo WIKI_ROOT; ?>">Wiki</a></li>
  220. <?php if (!$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
  221. <li><a href="/p078_dealerd1/welcome.php">Dealer Desktop</a></li>
  222. <?php endif ?>
  223. <?php if ($rolemgr->check('DL/SM')): ?>
  224. <li><a href="/p078_dealerd1/DealerPOS/Sales_POS/Sales_Status.php">Sales Status</a></li>
  225. <?php endif ?>
  226. <?php if ($rolemgr->check('Dashboard/Sales')):?>
  227. <li><a href="/p078_dealerd1/Dashboard1/Sales_Dashboard/index.php">Dashboard</a></li>
  228. <?php endif ?>
  229. <?php if ($rolemgr->check('Dashboard/Finance')):?>
  230. <li><a href="/p078_dealerd1/Dashboard1/Finance_Dashboard/Dash1.php">Finance Dashboard</a></li>
  231. <?php endif ?>
  232. <?php if ($__logged && !$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
  233. <li>
  234. <a href="/p078_dealerd1/M012_Tasks/Tasks2.php">Tasks</a>
  235. <?php $tasksCount = $__logged->getTasksCount(); ?>
  236. <?php if (!empty($tasksCount)): ?>
  237. <span class="count label"><a href="/p078_dealerd1/M012_Tasks/Tasks2.php"><?php echo $tasksCount; ?></a></span>
  238. <?php endif ?>
  239. <div class="clear"></div>
  240. </li>
  241. <li><a href="/p078_dealerd1/M012_Tasks/Tasks_Others_Status2.php">Tasks Others</a></li>
  242. <?php endif ?>
  243. <?php if ($Session->rolemgr->check('p108/FC')):?>
  244. <li><a href="/p078_dealerd1/p108_Lead_Management/FC/FC_Main.php">Floor Control</a></li>
  245. <?php endif?>
  246. <?php if ($rolemgr->check("DL") && !$rolemgr->check('Dashboard/Sales/Main_Menu')):?>
  247. <li><a href="/p078_dealerd1/p077_DealLog1/index.php">Deal Log</a></li>
  248. <?php endif?>
  249. <?php if (!$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
  250. <li><a href="/p078_dealerd1/p108_Lead_Management/p108_Menu.php">Lead Management</a></li>
  251. <?php endif ?>
  252. <?php if ($rolemgr->check('Dashboard/PD')):?>
  253. <li><a href="/p078_dealerd1/p077_DealLog1/PD_Main/PD_Dashboard.php">PD Dashboard</a></li>
  254. <?php endif ?>
  255. <?php if ($rolemgr->check('Dashboard/GM')):?>
  256. <li><a href="/p078_dealerd1/p077_DealLog1/GM_Main/GM_Dashboard/index.php">GM Dashboard</a></li>
  257. <?php endif ?>
  258. <?php if ($rolemgr->check("CC/NPS/Main") && !$rolemgr->check('Dashboard/Sales/Main_Menu')): ?>
  259. <li><a href="/p078_dealerd1/p101_NPS/NPS_Main.php">NPS</a></li>
  260. <?php endif ?>
  261. <li><a href="/p078_dealerd1/search.php">Search</a></li>
  262. <li><a href="/p100_phonebook/p100_Phonebook_Main.php">Phone Book</a></li>
  263. <?php if ($rolemgr->check('DL/SP')):?>
  264. <li><a href="/p078_dealerd1/thesmartway.php">The SMART Way</a></li>
  265. <?php endif?>
  266. <li><a href="<?php echo $cleanFiltersUrl?>" id="clearn-filters">Clean filters</a></li>
  267. <?php if (isset($_SESSION['cPeople_ID'])):?>
  268. <li><a href="/p078_dealerd1/logout.php">Log Off</a></li>
  269. <?php endif ?>
  270. </ul>
  271. <?php endif; ?>
  272. <div class="spacer-10"></div>
  273. <?php if ($Session->rolemgr->check('DL/SYS/Debug3')):?>
  274. <div class="left-float"><button type="button" onclick="window.location='/p078_dealerd1/index.php?debug=off'" class="small-button">Debug Off</button></div>
  275. <?php else:?>
  276. <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>
  277. <?php endif?>
  278. <div class="left-float ml-5">
  279. <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>
  280. </div>
  281. <div class="spacer-10"></div>
  282. <?php include_once('include/menu_fuel_card_balance.php'); ?>
  283. <?php if ($rolemgr->check('DL/SYS/Debug2') && !empty($_SESSION['roles'])): ?>
  284. <div class="role-codes-container" style="height: 110px;">
  285. <div class="expand-arrow cpointer" style="width: 138px;height: 24px;border:1px solid #eee" id="expand-contract-menu-rolecode-container" title="Role Codes">&nbsp;</div>
  286. <?php
  287. $ctr=0;
  288. foreach ($_SESSION['roles'] as $the_role=>$set) {
  289. $ctr++;
  290. if (!$the_role) continue;
  291. ?>
  292. <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>
  293. <?php
  294. }
  295. ?>
  296. </div>
  297. <div class="spacer-10"></div>
  298. <?php endif; ?>
  299. <?php if (isGranted('SYSTEM ADMIN/SwichUser')): ?>
  300. <?php require_once('include/menu/switch_user.php'); ?>
  301. <?php endif; ?>
  302. </div>
  303. </div>