Dashboard.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. use Template\RenderableTemplate as RenderableTemplate;
  3. class Dashboard extends RenderableTemplate {
  4. public $content;
  5. public function render() {
  6. if (is_ajax_request()) {
  7. $this->content = file_get_contents($this->getView()['location']);
  8. $this->implate();
  9. return;
  10. }
  11. global $DROPDOWN, $SIDEBAR;
  12. $head = '';
  13. $head .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
  14. $head .= '<script src="/plugins/jquery/jquery.min.js"></script>';
  15. $head .= '<script src="/plugins/mousetrap/mousetrap.min.js"></script>';
  16. $head .= '<script src="/plugins/jquery-mask-plugin/jquery.mask.min.js"></script>';
  17. $head .= '<link href="/plugins/bootstrap/bootstrap.min.css" rel="stylesheet" />';
  18. $head .= '<script src="/plugins/bootstrap/bootstrap.min.js"></script>';
  19. $head .= '<link href="/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />';
  20. $head .= '<link href="/plugins/normalize-css/normalize.css" rel="stylesheet">';
  21. $head .= '<link href="/dist/style.css" rel="stylesheet">';
  22. $head .= '<link href="/dist/theme/black_and_white.css" rel="stylesheet">';
  23. $head .= '<link href="/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">';
  24. $head .= '<script src="/plugins/metisMenu/metisMenu.min.js"></script>';
  25. $head .= '<link href="/plugins/select2/select2.min.css" rel="stylesheet">';
  26. $head .= '<script src="/plugins/select2/select2.min.js"></script>';
  27. $head .= '<link rel="stylesheet" href="/plugins/datatables/dataTables.css">';
  28. $head .= '<script src="/plugins/datatables/dataTables.js"></script>';
  29. $head .= '<link rel="stylesheet" href="/plugins/trumbowyg/ui/trumbowyg.min.css">';
  30. $head .= '<script src="/plugins/trumbowyg/trumbowyg.min.js"></script>';
  31. $foot = '';
  32. $foot .= '<script src="/dist/script.js"></script>';
  33. $foot .= '<script src="/dist/exercicio_form.js"></script>';
  34. $this->content = file_get_contents(__DIR__ . '/template.html');
  35. $this->content = str_replace("{{usermenu}}", "", $this->content);
  36. $this->content = str_replace("{{elements}}", $SIDEBAR->render(), $this->content);
  37. $this->content = str_replace("{{head}}", $head, $this->content);
  38. if(is_file($this->getView()['location'])){
  39. $this->content = str_replace('{{>content}}', $this->replaceSections(file_get_contents($this->getView()['location']), $this->_view['values']), $this->content);
  40. }else{
  41. $this->content = str_replace('{{>content}}', '', $this->content);
  42. }
  43. $this->content = str_replace("{{footer}}", $foot, $this->content);
  44. $this->implate();
  45. }
  46. }