SE_Layout.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. class SE_Layout {
  3. public static function getTitle() {
  4. $title = 'SE';
  5. $host = $_SERVER['SERVER_NAME'];
  6. if (substr($host, 0, 5) == 'biuro') {
  7. $host = substr($host, 6);
  8. }
  9. $title = "{$host}-SE";
  10. return $title;
  11. }
  12. public static function gora() {
  13. Lib::loadClass('S');
  14. SE_Layout::loadTemplate('_layout_gora');
  15. }
  16. public static function dol() {
  17. $version = (file_exists(APP_PATH_ROOT . '/VERSION'))? file_get_contents(APP_PATH_ROOT . '/VERSION') : null;
  18. if ($version) {
  19. echo '<div style="border-top:1px solid #ddd;margin-top:10px;padding:0 30px;font-size:xx-small;color:#888;">version: '.$version.'</div>';
  20. }
  21. echo "\n</body></html>";
  22. }
  23. public static function menu() {
  24. if (!User::logged()) return;
  25. if (User::hasAccess('menu')) {
  26. Lib::loadClass('ProcesMenu');
  27. $procesMenu = ProcesMenu::getInstance();
  28. $procesMenu->show();
  29. if (!V::get('MENU_INIT', '', $_GET)) {
  30. Lib::loadClass('UserActivity');
  31. //echo UserActivity::showListInContainer();
  32. }
  33. }
  34. else {
  35. SE_Layout::loadTemplate('menuLevel6');
  36. }
  37. }
  38. public static function loadTemplate($tmplName, $data = array()) {
  39. if (is_array($data) && !empty($data)) {
  40. extract($data);
  41. }
  42. include APP_PATH_LIB . "/tmpl/{$tmplName}.php";
  43. }
  44. public static function hotKeyDBG($str) {
  45. if (User::hasAccess('dbg')) {
  46. echo '<span class="hidden-dbg">' . htmlspecialchars($str) . '</span>';
  47. }
  48. }
  49. public static function showMessagesForTable($tblName) {
  50. if (empty($tblName)) return;
  51. $msgsRoute = Router::getRoute('Msgs');
  52. $msgs = $msgsRoute->getActiveMessagesForTable($tblName);
  53. if (!empty($msgs)) {
  54. self::loadTemplate('msgsForTable', array('msgs' => $msgs));
  55. }
  56. }
  57. public static function alert($alertType, $msg) {
  58. ?>
  59. <div class="alert alert-<?php echo $alertType; ?>">
  60. <?php echo $msg; ?>
  61. </div>
  62. <?php
  63. }
  64. }