Dashboard.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. use Template\RenderableTemplate as RenderableTemplate;
  3. class Dashboard extends RenderableTemplate {
  4. public $content;
  5. public function render() {
  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/dist/css/bootstrap.min.css" rel="stylesheet" />';
  23. $head .= '<script src="/plugins/bootstrap/dist/js/bootstrap.min.js"></script>';
  24. $head .= '<link href="/plugins/fontawesome/css/all.css" rel="stylesheet" />';
  25. $head .= '<link href="/dist/style.css" rel="stylesheet">';
  26. $head .= '<link href="/dist/themes/black_and_white.css" rel="stylesheet">';
  27. $head .= '<link href="/plugins/metismenu/dist/metisMenu.min.css" rel="stylesheet">';
  28. $head .= '<script src="/plugins/metismenu/dist/metisMenu.min.js"></script>';
  29. //$head .= '<link rel="stylesheet" href="/plugins/datatables/dataTables.css">';
  30. //$head .= '<script src="/plugins/datatables/dataTables.js"></script>';
  31. //Bind input ranges to a span on label. Show percentage.
  32. $head .= '<script src="/plugins/sliderTelepatic/dist/sliderTelepatic.min.js"></script>';
  33. $head .= '<script src="/plugins/trumbowyg/dist/trumbowyg.min.js"></script>';
  34. $head .= '<link rel="stylesheet" href="/plugins/trumbowyg/dist/ui/trumbowyg.min.css">';
  35. $foot = '';
  36. $foot .= '<script src="/dist/script.js"></script>';
  37. $this->content = file_get_contents(__DIR__ . '/template.html');
  38. $this->content = str_replace("{{usermenu}}", "", $this->content);
  39. $this->content = str_replace("{{elements}}", $SIDEBAR->render(), $this->content);
  40. $header = '';
  41. //HACK
  42. foreach ($DROPDOWN as $item){
  43. $header .= "<a class='dropdown-item' href='".$item['route']."'>".$item['name']."</a>";
  44. }
  45. $this->content = str_replace("{{projects}}", $header, $this->content);
  46. $this->content = str_replace("{{head}}", $head, $this->content);
  47. if(is_file($this->getView()['location'])){
  48. $this->content = str_replace('{{>content}}', $this->replaceSections(file_get_contents($this->getView()['location']), $this->_view['values']), $this->content);
  49. }else{
  50. $this->content = str_replace('{{>content}}', '', $this->content);
  51. }
  52. $this->content = str_replace("{{footer}}", $foot, $this->content);
  53. $this->implate();
  54. }
  55. }