SE_Layout.php 1.8 KB

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