| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- use Template\RenderableTemplate as RenderableTemplate;
- class Dashboard extends RenderableTemplate {
- public $content;
- public function render() {
- global $DROPDOWN, $SIDEBAR;
- if (is_ajax_request()) {
- if(is_file($this->getView()['location'])){
- $this->content = file_get_contents($this->getView()['location']);
- $this->implate();
- }else{
- $this->content = '';
- $this->implate();
- }
- return;
- }
- //global $DROPDOWN, $SIDEBAR;
- $head = '';
- $head .= '<script src="/plugins/jquery/jquery.min.js"></script>';
- $head .= '<script src="/plugins/mousetrap/mousetrap.min.js"></script>';
- $head .= '<script src="/plugins/jquery-mask-plugin/jquery.mask.min.js"></script>';
- $head .= '<link href="/plugins/bootstrap/bootstrap.min.css" rel="stylesheet" />';
- $head .= '<script src="/plugins/bootstrap/bootstrap.bundle.min.js"></script>';
- $head .= '<link href="/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />';
- $head .= '<link href="/plugins/normalize-css/normalize.css" rel="stylesheet">';
- $head .= '<link href="/dist/style.css" rel="stylesheet">';
- $head .= '<link href="/dist/themes/black_and_white.css" rel="stylesheet">';
- $head .= '<link href="/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">';
- $head .= '<script src="/plugins/metisMenu/metisMenu.min.js"></script>';
- $head .= '<link rel="stylesheet" href="/plugins/datatables/dataTables.css">';
- $head .= '<script src="/plugins/datatables/dataTables.js"></script>';
- $foot = '';
- $foot .= '<script src="/dist/script.js"></script>';
- $this->content = file_get_contents(__DIR__ . '/template.html');
- $this->content = str_replace("{{usermenu}}", "", $this->content);
- $this->content = str_replace("{{elements}}", $SIDEBAR->render(), $this->content);
- $header = '';
- //HACK
- foreach ($DROPDOWN as $item){
- $header .= "<a class='dropdown-item' href='".$item['route']."'>".$item['name']."</a>";
- }
- $this->content = str_replace("{{dropdown}}", $header, $this->content);
- $this->content = str_replace("{{head}}", $head, $this->content);
- if(isset($this->getView()['location']) && is_file($this->getView()['location'])){
- $this->content = str_replace('{{>content}}', $this->replaceSections(file_get_contents($this->getView()['location']), $this->_view['values']), $this->content);
- }else{
- $this->content = str_replace('{{>content}}', '', $this->content);
- }
- $this->content = str_replace("{{footer}}", $foot, $this->content);
- $this->implate();
- }
- }
|