footer.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. if (!User::logged()) {
  3. return;
  4. }
  5. ?>
  6. <footer>
  7. <div id="smad-footer-section" class="container-fluid padding-0">
  8. <div class="container">
  9. <div class="row">
  10. <div class="col-lg-12">
  11. <ul class="menu-bottom">
  12. <li><a href="#" title="O Bocianie">O Bocianie</a></li>
  13. <li><a href="#" title="">Funkcje</a></li>
  14. <li><a href="#" title="Bezpieczeństwo">Bezpieczeństwo</a></li>
  15. <li><a href="#" title="">Kontakt</a></li>
  16. </ul>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </footer>
  22. <script type="text/javascript">
  23. // TOP MENU (hamburger)
  24. if (document.getElementById("smad-page-home")) {
  25. toggledisplay('smad-menu-main', 'none')
  26. }
  27. // show/hide menu
  28. function toggledisplay(elementID, style = 'none') {
  29. (function(style) {
  30. style.display = (style.display === 'none' ? '' : 'none');
  31. })(document.getElementById(elementID).style);
  32. }
  33. // todo: do usuniecia
  34. var testUrl = 'index.php?_route=ViewTableAjax&namespace=default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY&backRefNS=default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA&backRefPK=26&backRefField=default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY';
  35. var responseUrl = getUrlParams(testUrl);
  36. console.log(responseUrl);
  37. // todo: przenieść do eventu który nasłuchuje zakonczenie wczytania tabeli
  38. setTimeout(searchColumnWithHref, 2000);
  39. /**
  40. * Funkcja przeszukuje td i pobiera dane na podstawie znalezionego adresu url
  41. */
  42. function searchColumnWithHref() {
  43. console.log('START searchColumnWithHref');
  44. $("table tr").each(function () {
  45. var tableRow = $(this);
  46. tableRow.find('td').each(function ( indexTd, valueTd ) {
  47. var valueUrl = $(this).find('href');
  48. // pobieramy url z linku a href
  49. var hrefFromTd = tableRow.find('td:eq('+indexTd+') a').attr('href');
  50. // pobieramy dane
  51. if ( hrefFromTd !== undefined ) {
  52. var responseData = getDataByUrl( hrefFromTd );
  53. }
  54. console.log('td tabeli', hrefFromTd, responseData);
  55. console.log('####################' );
  56. });
  57. });
  58. console.log('END searchColumnWithHref');
  59. }
  60. /**
  61. * Funkcja do pobrania danych - należy podać url
  62. */
  63. function getDataByUrl( paramUrl, urlNamespaceParams = [] ) {
  64. if ( !paramUrl ) {
  65. return;
  66. }
  67. window.fetch(paramUrl, {
  68. credentials: 'same-origin'
  69. })
  70. .then(function parseJSON(response) {
  71. return response.json()
  72. })
  73. .then(function(data) {
  74. //todo: odebrane dane
  75. //data.body.items
  76. if (data.body.item === null) {
  77. return;
  78. }
  79. return data.body.items;
  80. console.log('request succeeded with JSON getDataByNamespaceAndPK', data.body.items);
  81. }).catch(function(error) {
  82. console.log('request failed', error)
  83. });
  84. }
  85. /**
  86. * Funkcja do parsowania url (pobieramy dane na temat parametr=wartosc)
  87. * Wymagane aby w adresie znajdował sie "?"
  88. * return json eg. {_route: "ViewTableAjax", namespace: "default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY", backRefNS: "default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA", backRefPK: "26", backRefField: "default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY"}
  89. */
  90. function getUrlParams(url) {
  91. var params = {};
  92. (url + '?').split('?')[1].split('&').forEach(function (pair) {
  93. pair = (pair + '=').split('=').map(decodeURIComponent);
  94. if (pair[0].length) {
  95. params[pair[0]] = pair[1];
  96. }
  97. });
  98. return params;
  99. }
  100. </script>