Dashboard.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. use Template\RenderableTemplate as RenderableTemplate;
  3. class Dashboard extends RenderableTemplate {
  4. public $content;
  5. public function render($content = '') {
  6. global $DROPDOWN, $SIDEBAR;
  7. /*if (is_ajax_request()) {
  8. if(is_file($this->getView()['location'])){
  9. $this->content = file_get_contents($this->getView()['location']);
  10. $this->implate();
  11. }else{
  12. $this->content = '';
  13. $this->implate();
  14. }
  15. return;
  16. }*/
  17. //global $DROPDOWN, $SIDEBAR;
  18. $head = '';
  19. $head .= '<script src="/plugins/jquery/dist/jquery.min.js"></script>';
  20. $head .= '<script src="/plugins/mousetrap/mousetrap.min.js"></script>';
  21. $head .= '<script src="/plugins/jquery-mask-plugin/dist/jquery.mask.min.js"></script>';
  22. $head .= '<link href="/plugins/bootstrap/bootstrap.min.css" rel="stylesheet" />';
  23. $head .= '<script src="/plugins/bootstrap/bootstrap.bundle.min.js"></script>';
  24. $head .= '<script src="/plugins/remoteFill/remoteFill.js"></script>';
  25. // Trumbowyg WYSIWYG
  26. $head .= '<link href="/plugins/trumbowyg/ui/trumbowyg.min.css" rel="stylesheet" />';
  27. $head .= '<script src="/plugins/trumbowyg/trumbowyg.min.js"></script>';
  28. $head .= '<link href="/plugins/fontawesome/css/font-awesome.min.css" rel="stylesheet" />';
  29. $head .= '<link href="/dist/style.css" rel="stylesheet">';
  30. $head .= '<link href="/dist/themes/black_and_white.css" rel="stylesheet">';
  31. $head .= '<link href="/plugins/metismenu/dist/metisMenu.min.css" rel="stylesheet">';
  32. $head .= '<script src="/plugins/metismenu/dist/metisMenu.min.js"></script>';
  33. $head .= '<link href="https://unpkg.com/dropzone@5/dist/min/dropzone.min.css" rel="stylesheet">';
  34. $head .= '<script src="https://unpkg.com/dropzone@5/dist/min/dropzone.min.js"></script>';
  35. $head .= '<link rel="stylesheet" href="/plugins/datatables.net-dt/css/jquery.dataTables.min.css">';
  36. $head .= '<script src="/plugins/datatables.net/js/jquery.dataTables.min.js"></script>';
  37. $head .= '<script src="/plugins/bootstrapToastWrapper/dist/bootstrapToastWrapper.js"></script>';
  38. $head .= '<script src="/plugins/html5-qrcode/html5-qrcode.min.js"></script>';
  39. $head .= '<script src="https://cdn.datatables.net/1.11.4/js/dataTables.bootstrap5.min.js"></script>';
  40. $head .= '<link rel="stylesheet" href="https://cdn.datatables.net/1.11.4/css/dataTables.bootstrap5.min.css">';
  41. $head .= '<script src="/dist/libs.js" defer="true"></script>';
  42. $head .= '<script src="/dist/validation.js" defer="true"></script>';
  43. $foot = '';
  44. $foot .= '<script src="/dist/script.js" defer="true"></script>';
  45. $this->content = file_get_contents(__DIR__ . '/template.html');
  46. $this->content = str_replace("{{usermenu}}", "", $this->content);
  47. $this->content = str_replace("{{elements}}", $SIDEBAR->render(), $this->content);
  48. $header = '';
  49. //HACK
  50. foreach ($DROPDOWN as $item){
  51. $header .= "<a class='dropdown-item' href='".$item['route']."'>".$item['name']."</a>";
  52. }
  53. $this->content = str_replace("{{dropdown}}", $header, $this->content);
  54. $this->content = str_replace("{{head}}", $head, $this->content);
  55. $this->content = str_replace("{{footer}}", $foot, $this->content);
  56. $this->content = str_replace('{{content}}', $content, $this->content);
  57. return $this->content;
  58. }
  59. }