/** * Display the panel * * @return string the displayed HTML */ public function display() { if (!$this->id) { $this->id = uniqid(); } return \Hawk\View::make(\Hawk\Theme::getSelected()->getView('panel.tpl'), array('id' => $this->id, 'title' => $this->title, 'icon' => $this->icon, 'content' => $this->content, 'type' => $this->type ? $this->type : 'default')); }
/** * Display the button * * @return string The html result describing the button */ public function display() { if (!empty($this->params['href'])) { $this->params['data-href'] = $this->params['href']; unset($this->params['href']); } if (!empty($this->params['target'])) { $this->params['data-target'] = $this->params['target']; unset($this->params['target']); } if (empty($this->params['type'])) { $this->params['type'] = 'button'; } return \Hawk\View::make(\Hawk\Theme::getSelected()->getView('button.tpl'), array('class' => $this->class, 'icon' => $this->icon, 'label' => $this->label, 'param' => $this->params)); }
/** * Display the accordion * * @return string The displayed HTML */ public function display() { if (!$this->id) { $this->id = uniqid(); } foreach ($this->panels as $name => &$panel) { if (empty($panel['id'])) { $panel['id'] = uniqid(); } if (!isset($this->selected)) { $this->selected = $name; } } return \Hawk\View::make(\Hawk\Theme::getSelected()->getView('accordion.tpl'), array('id' => $this->id, 'panels' => $this->panels, 'selected' => $this->selected)); }
/** * Display the tabs * * @return string The displayed HTML */ public function display() { if (!$this->id) { $this->id = uniqid(); } foreach ($this->tabs as &$tab) { if (empty($tab['id'])) { $tab['id'] = uniqid(); } } if (!$this->selected) { $this->selected = array_keys($this->tabs)[0]; } return \Hawk\View::make(\Hawk\Theme::getSelected()->getView('tabs.tpl'), array('id' => $this->id, 'tabs' => $this->tabs, 'selected' => $this->selected)); }
/** * Import the file */ public function display() { if ($this->file[0] == '/') { // Absolute path $basedir = ROOT_DIR; $this->file = preg_replace('#^' . ROOT_DIR . '#', '', $this->file); } else { // Path relative to the view that included the file $basedir = dirname(realpath($this->viewFile)); } $data = $this->viewData; foreach (get_object_vars($this) as $key => $value) { if ($key !== 'file') { $data[$key] = $value; } } return \Hawk\View::make($basedir . '/' . $this->file, $data); }