footer.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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="index.php?_route=UrlAction_Bocian&_task=about" title="O Bocianie">O Bocianie</a></li>
  13. <li><a href="index.php?_route=UrlAction_Bocian&_task=training" title="Szkolenia">Szkolenia</a></li>
  14. <li><a href="index.php?_route=UrlAction_Bocian&_task=offer" title="Szkolenia">Oferta</a></li>
  15. <li><a href="index.php?_route=UrlAction_Bocian&_task=helpForm" title="Pomoc">Pomoc</a></li>
  16. <li><a href="index.php?_route=ViewTableAjax&namespace=default_db/QUALITY_NOTICES#CREATE" title="Zgł. błędów." class="btn btn-success">Zgł. błędów.</a>
  17. </ul>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </footer>
  23. <script type="text/javascript">
  24. // TOP MENU (hamburger) //todo: odkomentować jeśli chcemy aby menu było pokazywane/ukrywane
  25. //if (document.getElementById("smad-page-home")) {
  26. toggledisplay('smad-menu-main', 'none')
  27. //}
  28. // show/hide menu
  29. function toggledisplay(elementID, style = 'none') {
  30. (function(node) {
  31. if (!node) return;
  32. node.style.display = (node.style.display === 'none' ? '' : 'none');
  33. })(document.getElementById(elementID));
  34. }
  35. // todo: do usuniecia
  36. 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';
  37. var responseUrl = getUrlParams(testUrl);
  38. // todo: przenieść do eventu który nasłuchuje zakonczenie wczytania tabeli
  39. setTimeout(searchColumnWithHref, 2000);
  40. /**
  41. * Funkcja przeszukuje td i pobiera dane na podstawie znalezionego adresu url
  42. */
  43. function searchColumnWithHref() {
  44. return false; // todo: usunc
  45. //todo: dostanie sie do tabeli jQuery('#BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA').on('TableAjax:render', function (event) { console.log(event) })
  46. console.log('START searchColumnWithHref');
  47. // todo: przeparsować adres url /
  48. $(".AjaxTableCont table tbody tr").each(function () {
  49. var tableRow = $(this);
  50. tableRow.find('td').each(function ( indexTd, valueTd ) {
  51. var valueUrl = $(this).find('href');
  52. // pobieramy url z linku a href
  53. var hrefFromTd = tableRow.find('td:eq('+indexTd+') a').attr('href');
  54. // pobieramy dane
  55. if ( hrefFromTd !== undefined ) {
  56. var responseData = getDataByUrl( hrefFromTd );
  57. }
  58. console.log('td tabeli', hrefFromTd, responseData);
  59. console.log('####################' );
  60. });
  61. });
  62. console.log('END searchColumnWithHref');
  63. }
  64. /**
  65. * Funkcja do pobrania danych - należy podać url
  66. */
  67. function getDataByUrl( paramUrl, urlNamespaceParams = [] ) {
  68. if ( !paramUrl ) {
  69. return;
  70. }
  71. // dodanie tego zapisu pozwala na zwrócenie danych w formacie JSON posortowanego
  72. var jsonFormatParam = '&_task=loadDataAjax&currSortCol=ID&currSortFlip=desc';
  73. window.fetch(paramUrl + jsonFormatParam, {
  74. credentials: 'same-origin'
  75. })
  76. .then(function parseJSON(response) {
  77. return response.json()
  78. })
  79. .then(function(data) {
  80. //todo: odebrane daneFVFF
  81. //data.body.items
  82. console.log(data);
  83. if (data.rows === null) {
  84. return;
  85. }
  86. return data.rowsdata.rows;
  87. console.log('request succeeded with JSON getDataByNamespaceAndPK', data.rows);
  88. }).catch(function(error) {
  89. console.log('request failed', error)
  90. });
  91. }
  92. /**
  93. * Funkcja do parsowania url (pobieramy dane na temat parametr=wartosc)
  94. * Wymagane aby w adresie znajdował sie "?"
  95. * 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"}
  96. */
  97. function getUrlParams(url) {
  98. var params = {};
  99. (url + '?').split('?')[1].split('&').forEach(function (pair) {
  100. pair = (pair + '=').split('=').map(decodeURIComponent);
  101. if (pair[0].length) {
  102. params[pair[0]] = pair[1];
  103. }
  104. });
  105. return params;
  106. }
  107. </script>