| | <?php |
| |
|
| | namespace Kanboard\Helper; |
| |
|
| | use Kanboard\Core\Base; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | class LayoutHelper extends Base |
| | { |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function app($template, array $params = array()) |
| | { |
| | $isAjax = $this->request->isAjax(); |
| | $params['is_ajax'] = $isAjax; |
| |
|
| | if ($isAjax) { |
| | return $this->template->render($template, $params); |
| | } |
| |
|
| | if (! isset($params['no_layout']) && ! isset($params['board_selector'])) { |
| | $params['board_selector'] = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); |
| |
|
| | if (isset($params['project']['id'])) { |
| | unset($params['board_selector'][$params['project']['id']]); |
| | } |
| |
|
| | $this->hook->reference('helper:layout:board-selector:list', $params['board_selector']); |
| | } |
| |
|
| | return $this->pageLayout($template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function user($template, array $params) |
| | { |
| | if (isset($params['user'])) { |
| | $params['title'] = '#'.$params['user']['id'].' '.($params['user']['name'] ?: $params['user']['username']); |
| | } |
| |
|
| | return $this->subLayout('user_view/layout', 'user_view/sidebar', $template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function task($template, array $params) |
| | { |
| | $params['page_title'] = $params['task']['project_name'].', #'.$params['task']['id'].' - '.$params['task']['title']; |
| | $params['title'] = $params['task']['project_name']; |
| | return $this->subLayout('task/layout', 'task/sidebar', $template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function project($template, array $params, $sidebar = 'project/sidebar') |
| | { |
| | if (empty($params['title'])) { |
| | $params['title'] = $params['project']['name']; |
| | } elseif ($params['project']['name'] !== $params['title']) { |
| | $params['title'] = $params['project']['name'].' > '.$params['title']; |
| | } |
| |
|
| | return $this->subLayout('project/layout', $sidebar, $template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function projectUser($template, array $params) |
| | { |
| | $params['filter'] = array('user_id' => $params['user_id']); |
| | return $this->subLayout('project_user_overview/layout', 'project_user_overview/sidebar', $template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function config($template, array $params) |
| | { |
| | if (! isset($params['values'])) { |
| | $params['values'] = $this->configModel->getAll(); |
| | } |
| |
|
| | if (! isset($params['errors'])) { |
| | $params['errors'] = array(); |
| | } |
| |
|
| | return $this->subLayout('config/layout', 'config/sidebar', $template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function plugin($template, array $params) |
| | { |
| | return $this->subLayout('plugin/layout', 'plugin/sidebar', $template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function dashboard($template, array $params) |
| | { |
| | return $this->subLayout('dashboard/layout', 'dashboard/sidebar', $template, $params); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function analytic($template, array $params) |
| | { |
| | if (isset($params['project']['name'])) { |
| | $params['title'] = $params['project']['name'].' > '.$params['title']; |
| | } |
| |
|
| | return $this->subLayout('analytic/layout', 'analytic/sidebar', $template, $params, true); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function pageLayout($template, array $params = array(), $layout = 'layout') |
| | { |
| | return $this->template->render( |
| | $layout, |
| | $params + array('content_for_layout' => $this->template->render($template, $params)) |
| | ); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function subLayout($sublayout, $sidebar, $template, array $params = array(), $ignoreAjax = false) |
| | { |
| | $isAjax = $this->request->isAjax(); |
| | $params['is_ajax'] = $isAjax; |
| | $content = $this->template->render($template, $params); |
| |
|
| | if (!$ignoreAjax && $isAjax) { |
| | return $content; |
| | } |
| |
|
| | $params['content_for_sublayout'] = $content; |
| | $params['sidebar_template'] = $sidebar; |
| |
|
| | return $this->app($sublayout, $params); |
| | } |
| | } |
| |
|