diff options
155 files changed, 1619 insertions, 1610 deletions
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php index 6c49089b..115f75f0 100644 --- a/app/Controller/Analytic.php +++ b/app/Controller/Analytic.php @@ -21,7 +21,7 @@ class Analytic extends Base private function layout($template, array $params) { $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); - $params['analytic_content_for_layout'] = $this->template->load($template, $params); + $params['analytic_content_for_layout'] = $this->template->render($template, $params); return $this->template->layout('analytic/layout', $params); } diff --git a/app/Controller/App.php b/app/Controller/App.php index eb1d83af..56e81179 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -3,7 +3,6 @@ namespace Controller; use Model\SubTask as SubTaskModel; -use Helper; /** * Application controller @@ -192,7 +191,7 @@ class App extends Base $this->response->html('<p>'.t('Nothing to preview...').'</p>'); } else { - $this->response->html(Helper\markdown($payload['text'])); + $this->response->html($this->template->markdown($payload['text'])); } } diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 19eb7f12..18f21ee8 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -17,6 +17,8 @@ use Symfony\Component\EventDispatcher\Event; * @package controller * @author Frederic Guillot * + * @property \Core\Session $session + * @property \Core\Template $template * @property \Model\Acl $acl * @property \Model\Authentication $authentication * @property \Model\Action $action @@ -70,22 +72,6 @@ abstract class Base protected $response; /** - * Template instance - * - * @accesss protected - * @var \Core\Template - */ - protected $template; - - /** - * Session instance - * - * @accesss public - * @var \Core\Session - */ - protected $session; - - /** * Container instance * * @access private @@ -104,8 +90,6 @@ abstract class Base $this->container = $container; $this->request = new Request; $this->response = new Response; - $this->session = new Session; - $this->template = new Template; } /** @@ -265,7 +249,7 @@ abstract class Base $params['hide_remove_menu'] = true; } - $content = $this->template->load($template, $params); + $content = $this->template->render($template, $params); $params['task_content_for_layout'] = $content; $params['title'] = $params['task']['project_name'].' > '.$params['task']['title']; $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); @@ -283,7 +267,7 @@ abstract class Base */ protected function projectLayout($template, array $params) { - $content = $this->template->load($template, $params); + $content = $this->template->render($template, $params); $params['project_content_for_layout'] = $content; $params['title'] = $params['project']['name'] === $params['title'] ? $params['title'] : $params['project']['name'].' > '.$params['title']; $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 072acf26..2c10e105 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -39,7 +39,7 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $this->response->html($this->template->load('board/assignee', array( + $this->response->html($this->template->render('board/assignee', array( 'values' => $task, 'users_list' => $this->projectPermission->getMemberList($project['id']), 'project' => $project, @@ -78,7 +78,7 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $this->response->html($this->template->load('board/category', array( + $this->response->html($this->template->render('board/category', array( 'values' => $task, 'categories_list' => $this->category->getList($project['id']), 'project' => $project, @@ -360,7 +360,7 @@ class Board extends Base } $this->response->html( - $this->template->load('board/show', array( + $this->template->render('board/show', array( 'project' => $this->project->getById($project_id), 'swimlanes' => $this->board->getBoard($project_id), 'categories' => $this->category->getList($project_id, false), @@ -394,7 +394,7 @@ class Board extends Base } $this->response->html( - $this->template->load('board/show', array( + $this->template->render('board/show', array( 'project' => $this->project->getById($project_id), 'swimlanes' => $this->board->getBoard($project_id), 'categories' => $this->category->getList($project_id, false), @@ -412,7 +412,7 @@ class Board extends Base public function subtasks() { $task = $this->getTask(); - $this->response->html($this->template->load('board/subtasks', array( + $this->response->html($this->template->render('board/subtasks', array( 'subtasks' => $this->subTask->getAll($task['id']) ))); } @@ -427,7 +427,7 @@ class Board extends Base $task = $this->getTask(); $this->subTask->toggleStatus($this->request->getIntegerParam('subtask_id')); - $this->response->html($this->template->load('board/subtasks', array( + $this->response->html($this->template->render('board/subtasks', array( 'subtasks' => $this->subTask->getAll($task['id']) ))); } @@ -441,7 +441,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->load('board/files', array( + $this->response->html($this->template->render('board/files', array( 'files' => $this->file->getAll($task['id']) ))); } @@ -455,7 +455,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->load('board/comments', array( + $this->response->html($this->template->render('board/comments', array( 'comments' => $this->comment->getAll($task['id']) ))); } @@ -469,7 +469,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->load('board/description', array( + $this->response->html($this->template->render('board/description', array( 'task' => $task ))); } diff --git a/app/Controller/Config.php b/app/Controller/Config.php index 199259d7..4093b7a1 100644 --- a/app/Controller/Config.php +++ b/app/Controller/Config.php @@ -23,7 +23,7 @@ class Config extends Base $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); $params['values'] = $this->config->getAll(); $params['errors'] = array(); - $params['config_content_for_layout'] = $this->template->load($template, $params); + $params['config_content_for_layout'] = $this->template->render($template, $params); return $this->template->layout('config/layout', $params); } diff --git a/app/Controller/File.php b/app/Controller/File.php index ae44cac0..1585a701 100644 --- a/app/Controller/File.php +++ b/app/Controller/File.php @@ -75,7 +75,7 @@ class File extends Base $file = $this->file->getById($this->request->getIntegerParam('file_id')); if ($file['task_id'] == $task['id']) { - $this->response->html($this->template->load('file/open', array( + $this->response->html($this->template->render('file/open', array( 'file' => $file ))); } diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 5395a5a4..9037a91a 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -447,7 +447,7 @@ class Project extends Base $this->forbidden(true); } - $this->response->xml($this->template->load('project/feed', array( + $this->response->xml($this->template->render('project/feed', array( 'events' => $this->projectActivity->getProject($project['id']), 'project' => $project, ))); diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 33b4b039..284cbec0 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -89,7 +89,7 @@ class Task extends Base public function create(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $method = $this->request->isAjax() ? 'load' : 'layout'; + $method = $this->request->isAjax() ? 'render' : 'layout'; if (empty($values)) { @@ -179,7 +179,7 @@ class Task extends Base ); if ($ajax) { - $this->response->html($this->template->load('task/edit', $params)); + $this->response->html($this->template->render('task/edit', $params)); } else { $this->response->html($this->taskLayout('task/edit', $params)); @@ -410,7 +410,7 @@ class Task extends Base ); if ($ajax) { - $this->response->html($this->template->load('task/edit_description', $params)); + $this->response->html($this->template->render('task/edit_description', $params)); } else { $this->response->html($this->taskLayout('task/edit_description', $params)); diff --git a/app/Controller/User.php b/app/Controller/User.php index 93b5ca18..619bbc90 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -76,7 +76,7 @@ class User extends Base */ private function layout($template, array $params) { - $content = $this->template->load($template, $params); + $content = $this->template->render($template, $params); $params['user_content_for_layout'] = $content; $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); diff --git a/app/Core/Helper.php b/app/Core/Helper.php new file mode 100644 index 00000000..82dd6698 --- /dev/null +++ b/app/Core/Helper.php @@ -0,0 +1,642 @@ +<?php + +namespace Core; + +use Pimple\Container; +use Parsedown; + +/** + * Template helpers + * + * @package core + * @author Frederic Guillot + * + * @property \Core\Session $session + * @property \Model\Acl $acl + * @property \Model\User $user + */ +class Helper +{ + /** + * Container instance + * + * @access protected + * @var \Pimple\Container + */ + protected $container; + + /** + * Constructor + * + * @access public + * @param \Pimple\Container $container + */ + public function __construct(Container $container) + { + $this->container = $container; + } + + /** + * Load automatically models + * + * @access public + * @param string $name Model name + * @return mixed + */ + public function __get($name) + { + return $this->container[$name]; + } + + /** + * Return the user full name + * + * @param array $user User properties + * @return string + */ + public function getFullname(array $user = array()) + { + return $this->user->getFullname(empty($user) ? $_SESSION['user'] : $user); + } + + /** + * HTML escaping + * + * @param string $value Value to escape + * @return string + */ + public function e($value) + { + return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false); + } + + /** + * Add a Javascript asset + * + * @param string $filename Filename + * @return string + */ + public function js($filename) + { + return '<script type="text/javascript" src="'.$filename.'?'.filemtime($filename).'"></script>'; + } + + /** + * Add a stylesheet asset + * + * @param string $filename Filename + * @return string + */ + public function css($filename) + { + return '<link rel="stylesheet" href="'.$filename.'?'.filemtime($filename).'" media="screen">'; + } + + /** + * Display the form error class + * + * @param array $errors Error list + * @param string $name Field name + * @return string + */ + public function errorClass(array $errors, $name) + { + return ! isset($errors[$name]) ? '' : ' form-error'; + } + + /** + * Display a list of form errors + * + * @param array $errors List of errors + * @param string $name Field name + * @return string + */ + public function errorList(array $errors, $name) + { + $html = ''; + + if (isset($errors[$name])) { + + $html .= '<ul class="form-errors">'; + + foreach ($errors[$name] as $error) { + $html .= '<li>'.$this->e($error).'</li>'; + } + + $html .= '</ul>'; + } + + return $html; + } + + /** + * Get an escaped form value + * + * @param mixed $values Values + * @param string $name Field name + * @return string + */ + public function formValue($values, $name) + { + if (isset($values->$name)) { + return 'value="'.$this->e($values->$name).'"'; + } + + return isset($values[$name]) ? 'value="'.$this->e($values[$name]).'"' : ''; + } + + /** + * Hidden CSRF token field + * + * @return string + */ + public function formCsrf() + { + return '<input type="hidden" name="csrf_token" value="'.Security::getCSRFToken().'"/>'; + } + + /** + * Display a hidden form field + * + * @param string $name Field name + * @param array $values Form values + * @return string + */ + public function formHidden($name, array $values = array()) + { + return '<input type="hidden" name="'.$name.'" id="form-'.$name.'" '.$this->formValue($values, $name).'/>'; + } + + /** + * Display a select field + * + * @param string $name Field name + * @param array $options Options + * @param array $values Form values + * @param array $errors Form errors + * @param string $class CSS class + * @return string + */ + public function formSelect($name, array $options, array $values = array(), array $errors = array(), $class = '') + { + $html = '<select name="'.$name.'" id="form-'.$name.'" class="'.$class.'">'; + + foreach ($options as $id => $value) { + + $html .= '<option value="'.$this->e($id).'"'; + + if (isset($values->$name) && $id == $values->$name) $html .= ' selected="selected"'; + if (isset($values[$name]) && $id == $values[$name]) $html .= ' selected="selected"'; + + $html .= '>'.$this->e($value).'</option>'; + } + + $html .= '</select>'; + $html .= $this->errorList($errors, $name); + + return $html; + } + + /** + * Display a radio field group + * + * @param string $name Field name + * @param array $options Options + * @param array $values Form values + * @return string + */ + public function formRadios($name, array $options, array $values = array()) + { + $html = ''; + + foreach ($options as $value => $label) { + $html .= $this->formRadio($name, $label, $value, isset($values[$name]) && $values[$name] == $value); + } + + return $html; + } + + /** + * Display a radio field + * + * @param string $name Field name + * @param string $label Form label + * @param string $value Form value + * @param boolean $selected Field selected or not + * @param string $class CSS class + * @return string + */ + public function formRadio($name, $label, $value, $selected = false, $class = '') + { + return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.$this->e($value).'" '.($selected ? 'selected="selected"' : '').'>'.$this->e($label).'</label>'; + } + + /** + * Display a checkbox field + * + * @param string $name Field name + * @param string $label Form label + * @param string $value Form value + * @param boolean $checked Field selected or not + * @param string $class CSS class + * @return string + */ + public function formCheckbox($name, $label, $value, $checked = false, $class = '') + { + return '<label><input type="checkbox" name="'.$name.'" class="'.$class.'" value="'.$this->e($value).'" '.($checked ? 'checked="checked"' : '').'> '.$this->e($label).'</label>'; + } + + /** + * Display a form label + * + * @param string $name Field name + * @param string $label Form label + * @param array $attributes HTML attributes + * @return string + */ + public function formLabel($label, $name, array $attributes = array()) + { + return '<label for="form-'.$name.'" '.implode(' ', $attributes).'>'.$this->e($label).'</label>'; + } + + /** + * Display a textarea + * + * @param string $name Field name + * @param array $values Form values + * @param array $errors Form errors + * @param array $attributes HTML attributes + * @param string $class CSS class + * @return string + */ + public function formTextarea($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + $class .= $this->errorClass($errors, $name); + + $html = '<textarea name="'.$name.'" id="form-'.$name.'" class="'.$class.'" '; + $html .= implode(' ', $attributes).'>'; + $html .= isset($values->$name) ? $this->e($values->$name) : isset($values[$name]) ? $values[$name] : ''; + $html .= '</textarea>'; + $html .= $this->errorList($errors, $name); + + return $html; + } + + /** + * Display a input field + * + * @param string $type HMTL input tag type + * @param string $name Field name + * @param array $values Form values + * @param array $errors Form errors + * @param array $attributes HTML attributes + * @param string $class CSS class + * @return string + */ + public function formInput($type, $name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + $class .= $this->errorClass($errors, $name); + + $html = '<input type="'.$type.'" name="'.$name.'" id="form-'.$name.'" '.$this->formValue($values, $name).' class="'.$class.'" '; + $html .= implode(' ', $attributes).'/>'; + if (in_array('required', $attributes)) $html .= '<span class="form-required">*</span>'; + $html .= $this->errorList($errors, $name); + + return $html; + } + + /** + * Display a text field + * + * @param string $name Field name + * @param array $values Form values + * @param array $errors Form errors + * @param array $attributes HTML attributes + * @param string $class CSS class + * @return string + */ + public function formText($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->formInput('text', $name, $values, $errors, $attributes, $class); + } + + /** + * Display a password field + * + * @param string $name Field name + * @param array $values Form values + * @param array $errors Form errors + * @param array $attributes HTML attributes + * @param string $class CSS class + * @return string + */ + public function formPassword($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->formInput('password', $name, $values, $errors, $attributes, $class); + } + + /** + * Display an email field + * + * @param string $name Field name + * @param array $values Form values + * @param array $errors Form errors + * @param array $attributes HTML attributes + * @param string $class CSS class + * @return string + */ + public function formEmail($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->formInput('email', $name, $values, $errors, $attributes, $class); + } + + /** + * Display a number field + * + * @param string $name Field name + * @param array $values Form values + * @param array $errors Form errors + * @param array $attributes HTML attributes + * @param string $class CSS class + * @return string + */ + public function formNumber($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->formInput('number', $name, $values, $errors, $attributes, $class); + } + + /** + * Display a numeric field (allow decimal number) + * + * @param string $name Field name + * @param array $values Form values + * @param array $errors Form errors + * @param array $attributes HTML attributes + * @param string $class CSS class + * @return string + */ + public function formNumeric($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->formInput('text', $name, $values, $errors, $attributes, $class.' form-numeric'); + } + + /** + * Link + * + * a('link', 'task', 'show', array('task_id' => $task_id)) + * + * @param string $label Link label + * @param string $controller Controller name + * @param string $action Action name + * @param array $params Url parameters + * @param boolean $csrf Add a CSRF token + * @param string $class CSS class attribute + * @param boolean $new_tab Open the link in a new tab + * @return string + */ + public function a($label, $controller, $action, array $params = array(), $csrf = false, $class = '', $title = '', $new_tab = false) + { + return '<a href="'.$this->u($controller, $action, $params, $csrf).'" class="'.$class.'" title="'.$title.'" '.($new_tab ? 'target="_blank"' : '').'>'.$label.'</a>'; + } + + /** + * URL query string + * + * u('task', 'show', array('task_id' => $task_id)) + * + * @param string $controller Controller name + * @param string $action Action name + * @param array $params Url parameters + * @param boolean $csrf Add a CSRF token + * @return string + */ + public function u($controller, $action, array $params = array(), $csrf = false) + { + $html = '?controller='.$controller.'&action='.$action; + + if ($csrf) { + $params['csrf_token'] = Security::getCSRFToken(); + } + + foreach ($params as $key => $value) { + $html .= '&'.$key.'='.$value; + } + + return $html; + } + + /** + * Pagination links + * + * @param array $pagination Pagination information + * @return string + */ + public function paginate(array $pagination) + { + extract($pagination); + + if ($pagination['offset'] === 0 && ($total - $pagination['offset']) <= $limit) { + return ''; + } + + $html = '<div class="pagination">'; + $html .= '<span class="pagination-previous">'; + + if ($pagination['offset'] > 0) { + $offset = $pagination['offset'] - $limit; + $html .= $this->a('← '.t('Previous'), $controller, $action, $params + compact('offset', 'order', 'direction')); + } + else { + $html .= '← '.t('Previous'); + } + + $html .= '</span>'; + $html .= '<span class="pagination-next">'; + + if (($total - $pagination['offset']) > $limit) { + $offset = $pagination['offset'] + $limit; + $html .= $this->a(t('Next').' →', $controller, $action, $params + compact('offset', 'order', 'direction')); + } + else { + $html .= t('Next').' →'; + } + + $html .= '</span>'; + $html .= '</div>'; + + return $html; + } + + /** + * Column sorting (work with pagination) + * + * @param string $label Column title + * @param string $column SQL column name + * @param array $pagination Pagination information + * @return string + */ + public function order($label, $column, array $pagination) + { + extract($pagination); + + $prefix = ''; + + if ($order === $column) { + $prefix = $direction === 'DESC' ? '▼ ' : '▲ '; + $direction = $direction === 'DESC' ? 'ASC' : 'DESC'; + } + + $order = $column; + + return $prefix.$this->a($label, $controller, $action, $params + compact('offset', 'order', 'direction')); + } + + /** + * Markdown transformation + * + * @param string $text Markdown content + * @param array $link Link parameters for replacement + * @return string + */ + public function markdown($text, array $link = array('controller' => 'task', 'action' => 'show', 'params' => array())) + { + $html = Parsedown::instance() + ->setMarkupEscaped(true) # escapes markup (HTML) + ->text($text); + + // Replace task #123 by a link to the task + if (preg_match_all('!#(\d+)!i', $html, $matches, PREG_SET_ORDER)) { + + foreach ($matches as $match) { + + $html = str_replace( + $match[0], + $this->a($match[0], $link['controller'], $link['action'], $link['params'] + array('task_id' => $match[1])), + $html + ); + } + } + + return $html; + } + + /** + * Get the current URL without the querystring + * + * @return string + */ + public function getCurrentBaseUrl() + { + $url = Request::isHTTPS() ? 'https://' : 'http://'; + $url .= $_SERVER['SERVER_NAME']; + $url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT']; + $url .= dirname($_SERVER['PHP_SELF']) !== '/' ? dirname($_SERVER['PHP_SELF']).'/' : '/'; + + return $url; + } + + /** + * Dispplay the flash session message + * + * @param string $html HTML wrapper + * @return string + */ + public function flash($html) + { + return $this->flashMessage('flash_message', $html); + } + + /** + * Display the flash session error message + * + * @param string $html HTML wrapper + * @return string + */ + public function flashError($html) + { + return $this->flashMessage('flash_error_message', $html); + } + + /** + * Fetch and remove a flash session message + * + * @access private + * @param string $name Message name + * @param string $html HTML wrapper + * @return string + */ + private function flashMessage($name, $html) + { + $data = ''; + + if (isset($this->session[$name])) { + $data = sprintf($html, $this->e($this->session[$name])); + unset($this->session[$name]); + } + + return $data; + } + + /** + * Format a file size + * + * @param integer $size Size in bytes + * @param integer $precision Precision + * @return string + */ + public function formatBytes($size, $precision = 2) + { + $base = log($size) / log(1024); + $suffixes = array('', 'k', 'M', 'G', 'T'); + + return round(pow(1024, $base - floor($base)), $precision).$suffixes[(int)floor($base)]; + } + + /** + * Truncate a long text + * + * @param string $value Text + * @param integer $max_length Max Length + * @param string $end Text end + * @return string + */ + public function summary($value, $max_length = 85, $end = '[...]') + { + $length = strlen($value); + + if ($length > $max_length) { + return substr($value, 0, $max_length).' '.$end; + } + + return $value; + } + + /** + * Return true if needle is contained in the haystack + * + * @param string $haystack Haystack + * @param string $needle Needle + * @return boolean + */ + public function contains($haystack, $needle) + { + return strpos($haystack, $needle) !== false; + } + + /** + * Return a value from a dictionary + * + * @param mixed $id Key + * @param array $listing Dictionary + * @param string $default_value Value displayed when the key doesn't exists + * @return string + */ + public function inList($id, array $listing, $default_value = '?') + { + if (isset($listing[$id])) { + return $this->e($listing[$id]); + } + + return $default_value; + } +} diff --git a/app/Core/Session.php b/app/Core/Session.php index 3305eca3..0e5f7426 100644 --- a/app/Core/Session.php +++ b/app/Core/Session.php @@ -2,13 +2,15 @@ namespace Core; +use ArrayAccess; + /** * Session class * * @package core * @author Frederic Guillot */ -class Session +class Session implements ArrayAccess { /** * Sesion lifetime @@ -59,7 +61,7 @@ class Session ini_set('session.entropy_length', '32'); ini_set('session.hash_bits_per_character', 6); - // If session was autostarted with session.auto_start = 1 in php.ini destroy it + // If the session was autostarted with session.auto_start = 1 in php.ini destroy it if (isset($_SESSION)) { session_destroy(); } @@ -88,19 +90,17 @@ class Session $_SESSION = array(); // Destroy the session cookie - if (ini_get('session.use_cookies')) { - $params = session_get_cookie_params(); - - setcookie( - session_name(), - '', - time() - 42000, - $params['path'], - $params['domain'], - $params['secure'], - $params['httponly'] - ); - } + $params = session_get_cookie_params(); + + setcookie( + session_name(), + '', + time() - 42000, + $params['path'], + $params['domain'], + $params['secure'], + $params['httponly'] + ); // Destroy session data session_destroy(); @@ -127,4 +127,24 @@ class Session { $_SESSION['flash_error_message'] = $message; } + + public function offsetSet($offset, $value) + { + $_SESSION[$offset] = $value; + } + + public function offsetExists($offset) + { + return isset($_SESSION[$offset]); + } + + public function offsetUnset($offset) + { + unset($_SESSION[$offset]); + } + + public function offsetGet($offset) + { + return isset($_SESSION[$offset]) ? $_SESSION[$offset] : null; + } } diff --git a/app/Core/Template.php b/app/Core/Template.php index da61f579..9688c2a5 100644 --- a/app/Core/Template.php +++ b/app/Core/Template.php @@ -10,7 +10,7 @@ use LogicException; * @package core * @author Frederic Guillot */ -class Template +class Template extends Helper { /** * Template path @@ -20,18 +20,18 @@ class Template const PATH = 'app/Template/'; /** - * Load a template + * Render a template * * Example: * - * $template->load('template_name', ['bla' => 'value']); + * $template->render('template_name', ['bla' => 'value']); * * @access public * @params string $__template_name Template name * @params array $__template_args Key/Value map of template variables * @return string */ - public function load($__template_name, array $__template_args = array()) + public function render($__template_name, array $__template_args = array()) { $__template_file = self::PATH.$__template_name.'.php'; @@ -57,9 +57,9 @@ class Template */ public function layout($template_name, array $template_args = array(), $layout_name = 'layout') { - return $this->load( + return $this->render( $layout_name, - $template_args + array('content_for_layout' => $this->load($template_name, $template_args)) + $template_args + array('content_for_layout' => $this->render($template_name, $template_args)) ); } } diff --git a/app/Model/Acl.php b/app/Model/Acl.php index b8353b58..3f454885 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -42,6 +42,7 @@ class Acl extends Base 'category' => array('index', 'save', 'edit', 'update', 'confirm', 'remove'), 'action' => array('index', 'event', 'params', 'create', 'confirm', 'remove'), 'analytic' => array('tasks', 'users', 'cfd'), + 'swimlane' => array('index', 'save', 'change', 'edit', 'update', 'confirm', 'remove', 'disable', 'enable', 'moveup', 'movedown'), ); /** @@ -96,7 +97,7 @@ class Acl extends Base */ public function isAdminUser() { - return isset($_SESSION['user']['is_admin']) && $_SESSION['user']['is_admin'] === true; + return isset($this->session['user']['is_admin']) && $this->session['user']['is_admin'] === true; } /** @@ -107,7 +108,7 @@ class Acl extends Base */ public function isRegularUser() { - return isset($_SESSION['user']['is_admin']) && $_SESSION['user']['is_admin'] === false; + return isset($this->session['user']['is_admin']) && $this->session['user']['is_admin'] === false; } /** @@ -118,7 +119,18 @@ class Acl extends Base */ public function getUserId() { - return isset($_SESSION['user']['id']) ? (int) $_SESSION['user']['id'] : 0; + return isset($this->session['user']['id']) ? (int) $this->session['user']['id'] : 0; + } + + /** + * Check if the given user_id is the connected user + * + * @param integer $user_id User id + * @return boolean + */ + public function isCurrentUser($user_id) + { + return $this->acl->getUserId() == $user_id; } /** @@ -129,7 +141,7 @@ class Acl extends Base */ public function isLogged() { - return ! empty($_SESSION['user']); + return ! empty($this->session['user']); } /** @@ -142,10 +154,10 @@ class Acl extends Base public function isRememberMe($value = null) { if ($value !== null) { - $_SESSION['is_remember_me'] = $value; + $this->session['is_remember_me'] = $value; } - return empty($_SESSION['is_remember_me']) ? false : $_SESSION['is_remember_me']; + return empty($this->session['is_remember_me']) ? false : $this->session['is_remember_me']; } /** diff --git a/app/Model/Base.php b/app/Model/Base.php index ed96e5be..dfac12ae 100644 --- a/app/Model/Base.php +++ b/app/Model/Base.php @@ -10,6 +10,8 @@ use Pimple\Container; * @package model * @author Frederic Guillot * + * @property \Core\Session $session + * @property \Core\Template $template * @property \Model\Acl $acl * @property \Model\Action $action * @property \Model\Authentication $authentication diff --git a/app/Model/Config.php b/app/Model/Config.php index 16e9bf45..54d9d7cd 100644 --- a/app/Model/Config.php +++ b/app/Model/Config.php @@ -76,12 +76,13 @@ class Config extends Base return $value ?: $default_value; } - if (! isset($_SESSION['config'][$name])) { - $_SESSION['config'] = $this->getAll(); + // Cache config in session + if (! isset($this->session['config'][$name])) { + $this->session['config'] = $this->getAll(); } - if (! empty($_SESSION['config'][$name])) { - return $_SESSION['config'][$name]; + if (isset($this->session['config'][$name])) { + return $this->session['config'][$name]; } return $default_value; @@ -126,7 +127,7 @@ class Config extends Base */ public function reload() { - $_SESSION['config'] = $this->getAll(); + $this->session['config'] = $this->getAll(); $this->setupTranslations(); } diff --git a/app/Model/Notification.php b/app/Model/Notification.php index 0fa4c9da..99db78ad 100644 --- a/app/Model/Notification.php +++ b/app/Model/Notification.php @@ -3,7 +3,6 @@ namespace Model; use Core\Session; -use Core\Template; use Swift_Message; use Swift_Mailer; use Swift_TransportException; @@ -184,8 +183,10 @@ class Notification extends Base */ public function getMailContent($template, array $data) { - $tpl = new Template; - return $tpl->load('notification/'.$template, $data + array('application_url' => $this->config->get('application_url'))); + return $this->template->render( + 'notification/'.$template, + $data + array('application_url' => $this->config->get('application_url')) + ); } /** diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php index bc2948f0..87c9bb56 100644 --- a/app/Model/ProjectActivity.php +++ b/app/Model/ProjectActivity.php @@ -2,8 +2,6 @@ namespace Model; -use Core\Template; - /** * Project activity model * @@ -134,8 +132,10 @@ class ProjectActivity extends Base */ public function getContent(array $params) { - $tpl = new Template; - return $tpl->load('event/'.str_replace('.', '_', $params['event_name']), $params); + return $this->template->render( + 'event/'.str_replace('.', '_', $params['event_name']), + $params + ); } /** diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php index 3b42751a..bcb11eca 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermission.php @@ -264,6 +264,10 @@ class ProjectPermission extends Base */ public function adminAllowed($project_id, $user_id) { + if ($this->user->isAdmin($user_id)) { + return true; + } + if ($this->isUserAllowed($project_id, $user_id) && $this->project->isPrivate($project_id)) { return true; } diff --git a/app/Model/User.php b/app/Model/User.php index 8fdfa815..3754b918 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -29,6 +29,17 @@ class User extends Base const EVERYBODY_ID = -1; /** + * Return the full name + * + * @param array $user User properties + * @return string + */ + public function getFullname(array $user) + { + return $user['name'] ?: $user['username']; + } + + /** * Return true is the given user id is administrator * * @access public @@ -54,7 +65,7 @@ class User extends Base */ public function getFavoriteProjectId() { - return isset($_SESSION['user']['default_project_id']) ? $_SESSION['user']['default_project_id'] : 0; + return isset($this->session['user']['default_project_id']) ? $this->session['user']['default_project_id'] : 0; } /** @@ -65,7 +76,7 @@ class User extends Base */ public function getLastSeenProjectId() { - return empty($_SESSION['user']['last_show_project_id']) ? 0 : $_SESSION['user']['last_show_project_id']; + return empty($this->session['last_show_project_id']) ? 0 : $this->session['last_show_project_id']; } /** @@ -76,7 +87,7 @@ class User extends Base */ public function storeLastSeenProjectId($project_id) { - $_SESSION['user']['last_show_project_id'] = (int) $project_id; + $this->session['last_show_project_id'] = (int) $project_id; } /** @@ -276,7 +287,7 @@ class User extends Base $result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($values); // If the user is connected refresh his session - if (Session::isOpen() && $_SESSION['user']['id'] == $values['id']) { + if (Session::isOpen() && $this->acl->getUserId() == $values['id']) { $this->updateSession(); } @@ -326,7 +337,7 @@ class User extends Base public function updateSession(array $user = array()) { if (empty($user)) { - $user = $this->getById($_SESSION['user']['id']); + $user = $this->getById($this->acl->getUserId()); } if (isset($user['password'])) { @@ -338,7 +349,7 @@ class User extends Base $user['is_admin'] = (bool) $user['is_admin']; $user['is_ldap_user'] = (bool) $user['is_ldap_user']; - $_SESSION['user'] = $user; + $this->session['user'] = $user; } /** @@ -457,7 +468,7 @@ class User extends Base if ($v->execute()) { // Check password - if ($this->authentication->authenticate($_SESSION['user']['username'], $values['current_password'])) { + if ($this->authentication->authenticate($this->session['user']['username'], $values['current_password'])) { return array(true, array()); } else { diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php new file mode 100644 index 00000000..02e5004e --- /dev/null +++ b/app/ServiceProvider/ClassProvider.php @@ -0,0 +1,72 @@ +<?php + +namespace ServiceProvider; + +use Model\Config; +use Model\Project; +use Model\Webhook; +use Pimple\Container; +use Pimple\ServiceProviderInterface; + +class ClassProvider implements ServiceProviderInterface +{ + private $classes = array( + 'Model' => array( + 'Acl', + 'Action', + 'Authentication', + 'Board', + 'Category', + 'Color', + 'Comment', + 'Config', + 'DateParser', + 'File', + 'GithubWebhook', + 'LastLogin', + 'Notification', + 'Project', + 'ProjectActivity', + 'ProjectAnalytics', + 'ProjectDailySummary', + 'ProjectPaginator', + 'ProjectPermission', + 'SubTask', + 'SubtaskPaginator', + 'Swimlane', + 'Task', + 'TaskCreation', + 'TaskDuplication', + 'TaskExport', + 'TaskFinder', + 'TaskModification', + 'TaskPaginator', + 'TaskPermission', + 'TaskPosition', + 'TaskStatus', + 'TaskValidator', + 'TimeTracking', + 'User', + 'Webhook', + ), + 'Core' => array( + 'Template', + 'Session', + ), + ); + + public function register(Container $container) + { + foreach ($this->classes as $namespace => $classes) { + + foreach ($classes as $name) { + + $class = '\\'.$namespace.'\\'.$name; + + $container[lcfirst($name)] = function ($c) use ($class) { + return new $class($c); + }; + } + } + } +} diff --git a/app/ServiceProvider/ModelProvider.php b/app/ServiceProvider/ModelProvider.php deleted file mode 100644 index 1a940058..00000000 --- a/app/ServiceProvider/ModelProvider.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -namespace ServiceProvider; - -use Model\Config; -use Model\Project; -use Model\Webhook; -use Pimple\Container; -use Pimple\ServiceProviderInterface; - -class ModelProvider implements ServiceProviderInterface -{ - private $models = array( - 'Acl', - 'Action', - 'Authentication', - 'Board', - 'Category', - 'Color', - 'Comment', - 'Config', - 'DateParser', - 'File', - 'GithubWebhook', - 'LastLogin', - 'Notification', - 'Project', - 'ProjectActivity', - 'ProjectAnalytics', - 'ProjectDailySummary', - 'ProjectPaginator', - 'ProjectPermission', - 'SubTask', - 'SubtaskPaginator', - 'Swimlane', - 'Task', - 'TaskCreation', - 'TaskDuplication', - 'TaskExport', - 'TaskFinder', - 'TaskModification', - 'TaskPaginator', - 'TaskPermission', - 'TaskPosition', - 'TaskStatus', - 'TaskValidator', - 'TimeTracking', - 'User', - 'Webhook', - ); - - public function register(Container $container) - { - foreach ($this->models as $model) { - - $class = '\Model\\'.$model; - - $container[lcfirst($model)] = function ($c) use ($class) { - return new $class($c); - }; - } - } -} diff --git a/app/Template/action/event.php b/app/Template/action/event.php index 565e900c..67a65c19 100644 --- a/app/Template/action/event.php +++ b/app/Template/action/event.php @@ -3,15 +3,15 @@ </div> <h3><?= t('Choose an event') ?></h3> -<form method="post" action="<?= Helper\u('action', 'params', array('project_id' => $project['id'])) ?>"> +<form method="post" action="<?= $this->u('action', 'params', array('project_id' => $project['id'])) ?>"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_hidden('action_name', $values) ?> + <?= $this->formHidden('project_id', $values) ?> + <?= $this->formHidden('action_name', $values) ?> - <?= Helper\form_label(t('Event'), 'event_name') ?> - <?= Helper\form_select('event_name', $events, $values) ?><br/> + <?= $this->formLabel(t('Event'), 'event_name') ?> + <?= $this->formSelect('event_name', $events, $values) ?><br/> <div class="form-help"> <?= t('When the selected event occurs execute the corresponding action.') ?> @@ -20,6 +20,6 @@ <div class="form-actions"> <input type="submit" value="<?= t('Next step') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/action/index.php b/app/Template/action/index.php index 54f13691..e388fbc9 100644 --- a/app/Template/action/index.php +++ b/app/Template/action/index.php @@ -15,26 +15,26 @@ <?php foreach ($actions as $action): ?> <tr> - <td><?= Helper\in_list($action['event_name'], $available_events) ?></td> - <td><?= Helper\in_list($action['action_name'], $available_actions) ?></td> + <td><?= $this->inList($action['event_name'], $available_events) ?></td> + <td><?= $this->inList($action['action_name'], $available_actions) ?></td> <td> <ul> <?php foreach ($action['params'] as $param): ?> <li> - <?= Helper\in_list($param['name'], $available_params) ?> = + <?= $this->inList($param['name'], $available_params) ?> = <strong> - <?php if (Helper\contains($param['name'], 'column_id')): ?> - <?= Helper\in_list($param['value'], $columns_list) ?> - <?php elseif (Helper\contains($param['name'], 'user_id')): ?> - <?= Helper\in_list($param['value'], $users_list) ?> - <?php elseif (Helper\contains($param['name'], 'project_id')): ?> - <?= Helper\in_list($param['value'], $projects_list) ?> - <?php elseif (Helper\contains($param['name'], 'color_id')): ?> - <?= Helper\in_list($param['value'], $colors_list) ?> - <?php elseif (Helper\contains($param['name'], 'category_id')): ?> - <?= Helper\in_list($param['value'], $categories_list) ?> - <?php elseif (Helper\contains($param['name'], 'label')): ?> - <?= Helper\escape($param['value']) ?> + <?php if ($this->contains($param['name'], 'column_id')): ?> + <?= $this->inList($param['value'], $columns_list) ?> + <?php elseif ($this->contains($param['name'], 'user_id')): ?> + <?= $this->inList($param['value'], $users_list) ?> + <?php elseif ($this->contains($param['name'], 'project_id')): ?> + <?= $this->inList($param['value'], $projects_list) ?> + <?php elseif ($this->contains($param['name'], 'color_id')): ?> + <?= $this->inList($param['value'], $colors_list) ?> + <?php elseif ($this->contains($param['name'], 'category_id')): ?> + <?= $this->inList($param['value'], $categories_list) ?> + <?php elseif ($this->contains($param['name'], 'label')): ?> + <?= $this->e($param['value']) ?> <?php endif ?> </strong> </li> @@ -42,7 +42,7 @@ </ul> </td> <td> - <?= Helper\a(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id'])) ?> + <?= $this->a(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id'])) ?> </td> </tr> <?php endforeach ?> @@ -51,12 +51,12 @@ <?php endif ?> <h3><?= t('Add an action') ?></h3> -<form method="post" action="<?= Helper\u('action', 'event', array('project_id' => $project['id'])) ?>" class="listing"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> +<form method="post" action="<?= $this->u('action', 'event', array('project_id' => $project['id'])) ?>" class="listing"> + <?= $this->formCsrf() ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Action'), 'action_name') ?> - <?= Helper\form_select('action_name', $available_actions, $values) ?><br/> + <?= $this->formLabel(t('Action'), 'action_name') ?> + <?= $this->formSelect('action_name', $available_actions, $values) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Next step') ?>" class="btn btn-blue"/> diff --git a/app/Template/action/params.php b/app/Template/action/params.php index f221d92e..3a5ecb86 100644 --- a/app/Template/action/params.php +++ b/app/Template/action/params.php @@ -3,34 +3,34 @@ </div> <h3><?= t('Define action parameters') ?></h3> -<form method="post" action="<?= Helper\u('action', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('action', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_hidden('event_name', $values) ?> - <?= Helper\form_hidden('action_name', $values) ?> + <?= $this->formHidden('project_id', $values) ?> + <?= $this->formHidden('event_name', $values) ?> + <?= $this->formHidden('action_name', $values) ?> <?php foreach ($action_params as $param_name => $param_desc): ?> - <?php if (Helper\contains($param_name, 'column_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $columns_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'user_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $users_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'project_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $projects_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'color_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $colors_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'category_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $categories_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'label')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_text('params['.$param_name.']', $values) ?> + <?php if ($this->contains($param_name, 'column_id')): ?> + <?= $this->formLabel($param_desc, $param_name) ?> + <?= $this->formSelect('params['.$param_name.']', $columns_list, $values) ?><br/> + <?php elseif ($this->contains($param_name, 'user_id')): ?> + <?= $this->formLabel($param_desc, $param_name) ?> + <?= $this->formSelect('params['.$param_name.']', $users_list, $values) ?><br/> + <?php elseif ($this->contains($param_name, 'project_id')): ?> + <?= $this->formLabel($param_desc, $param_name) ?> + <?= $this->formSelect('params['.$param_name.']', $projects_list, $values) ?><br/> + <?php elseif ($this->contains($param_name, 'color_id')): ?> + <?= $this->formLabel($param_desc, $param_name) ?> + <?= $this->formSelect('params['.$param_name.']', $colors_list, $values) ?><br/> + <?php elseif ($this->contains($param_name, 'category_id')): ?> + <?= $this->formLabel($param_desc, $param_name) ?> + <?= $this->formSelect('params['.$param_name.']', $categories_list, $values) ?><br/> + <?php elseif ($this->contains($param_name, 'label')): ?> + <?= $this->formLabel($param_desc, $param_name) ?> + <?= $this->formText('params['.$param_name.']', $values) ?> <?php endif ?> <?php endforeach ?> @@ -38,6 +38,6 @@ <div class="form-actions"> <input type="submit" value="<?= t('Save this action') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/action/remove.php b/app/Template/action/remove.php index 131c2b54..672c08a7 100644 --- a/app/Template/action/remove.php +++ b/app/Template/action/remove.php @@ -4,12 +4,12 @@ <div class="confirm"> <p class="alert alert-info"> - <?= t('Do you really want to remove this action: "%s"?', Helper\in_list($action['event_name'], $available_events).'/'.Helper\in_list($action['action_name'], $available_actions)) ?> + <?= t('Do you really want to remove this action: "%s"?', $this->inList($action['event_name'], $available_events).'/'.$this->inList($action['action_name'], $available_actions)) ?> </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'action', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'action', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/analytic/cfd.php b/app/Template/analytic/cfd.php index d8dd5517..58115e77 100644 --- a/app/Template/analytic/cfd.php +++ b/app/Template/analytic/cfd.php @@ -6,24 +6,24 @@ <p class="alert"><?= t('Not enough data to show the graph.') ?></p> <?php else: ?> <section id="analytic-cfd"> - <div id="chart" data-url="<?= Helper\u('analytic', 'cfd', array('project_id' => $project['id'], 'from' => $values['from'], 'to' => $values['to'])) ?>"></div> + <div id="chart" data-url="<?= $this->u('analytic', 'cfd', array('project_id' => $project['id'], 'from' => $values['from'], 'to' => $values['to'])) ?>"></div> </section> <?php endif ?> <hr/> -<form method="post" class="form-inline" action="<?= Helper\u('analytic', 'cfd', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" class="form-inline" action="<?= $this->u('analytic', 'cfd', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> <div class="form-inline-group"> - <?= Helper\form_label(t('Start Date'), 'from') ?> - <?= Helper\form_text('from', $values, array(), array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->formLabel(t('Start Date'), 'from') ?> + <?= $this->formText('from', $values, array(), array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> </div> <div class="form-inline-group"> - <?= Helper\form_label(t('End Date'), 'to') ?> - <?= Helper\form_text('to', $values, array(), array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->formLabel(t('End Date'), 'to') ?> + <?= $this->formText('to', $values, array(), array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> </div> <div class="form-inline-group"> diff --git a/app/Template/analytic/layout.php b/app/Template/analytic/layout.php index 2dd7a4f5..f2506917 100644 --- a/app/Template/analytic/layout.php +++ b/app/Template/analytic/layout.php @@ -1,15 +1,15 @@ -<?= Helper\js('assets/js/d3.v3.4.8.min.js') ?> -<?= Helper\js('assets/js/dimple.v2.1.0.min.js') ?> +<?= $this->js('assets/js/d3.v3.4.8.min.js') ?> +<?= $this->js('assets/js/dimple.v2.1.0.min.js') ?> <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= Helper\a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> </ul> </div> <section class="sidebar-container" id="analytic-section"> - <?= Helper\template('analytic/sidebar', array('project' => $project)) ?> + <?= $this->render('analytic/sidebar', array('project' => $project)) ?> <div class="sidebar-content"> <?= $analytic_content_for_layout ?> diff --git a/app/Template/analytic/sidebar.php b/app/Template/analytic/sidebar.php index 9b2fd9f6..a7076db9 100644 --- a/app/Template/analytic/sidebar.php +++ b/app/Template/analytic/sidebar.php @@ -2,13 +2,13 @@ <h2><?= t('Reportings') ?></h2> <ul> <li> - <?= Helper\a(t('Task distribution'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Task distribution'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> </li> <li> - <?= Helper\a(t('User repartition'), 'analytic', 'users', array('project_id' => $project['id'])) ?> + <?= $this->a(t('User repartition'), 'analytic', 'users', array('project_id' => $project['id'])) ?> </li> <li> - <?= Helper\a(t('Cumulative flow diagram'), 'analytic', 'cfd', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Cumulative flow diagram'), 'analytic', 'cfd', array('project_id' => $project['id'])) ?> </li> </ul> </div>
\ No newline at end of file diff --git a/app/Template/analytic/tasks.php b/app/Template/analytic/tasks.php index b8b630f9..b1a08a23 100644 --- a/app/Template/analytic/tasks.php +++ b/app/Template/analytic/tasks.php @@ -7,7 +7,7 @@ <?php else: ?> <section id="analytic-task-repartition"> - <div id="chart" data-url="<?= Helper\u('analytic', 'tasks', array('project_id' => $project['id'])) ?>"></div> + <div id="chart" data-url="<?= $this->u('analytic', 'tasks', array('project_id' => $project['id'])) ?>"></div> <table> <tr> @@ -18,7 +18,7 @@ <?php foreach ($metrics as $metric): ?> <tr> <td> - <?= Helper\escape($metric['column_title']) ?> + <?= $this->e($metric['column_title']) ?> </td> <td> <?= $metric['nb_tasks'] ?> diff --git a/app/Template/analytic/users.php b/app/Template/analytic/users.php index 007f7bc6..97328c02 100644 --- a/app/Template/analytic/users.php +++ b/app/Template/analytic/users.php @@ -7,7 +7,7 @@ <?php else: ?> <section id="analytic-user-repartition"> - <div id="chart" data-url="<?= Helper\u('analytic', 'users', array('project_id' => $project['id'])) ?>"></div> + <div id="chart" data-url="<?= $this->u('analytic', 'users', array('project_id' => $project['id'])) ?>"></div> <table> <tr> @@ -18,7 +18,7 @@ <?php foreach ($metrics as $metric): ?> <tr> <td> - <?= Helper\escape($metric['user']) ?> + <?= $this->e($metric['user']) ?> </td> <td> <?= $metric['nb_tasks'] ?> diff --git a/app/Template/app/dashboard.php b/app/Template/app/dashboard.php index 22b77eaa..5064967b 100644 --- a/app/Template/app/dashboard.php +++ b/app/Template/app/dashboard.php @@ -1,26 +1,26 @@ <section id="main"> <div class="page-header"> <ul> - <?php if (Helper\is_admin()): ?> - <li><i class="fa fa-plus fa-fw"></i><?= Helper\a(t('New project'), 'project', 'create') ?></li> + <?php if ($this->acl->isAdminUser()): ?> + <li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New project'), 'project', 'create') ?></li> <?php endif ?> - <li><i class="fa fa-lock fa-fw"></i><?= Helper\a(t('New private project'), 'project', 'create', array('private' => 1)) ?></li> - <li><i class="fa fa-folder fa-fw"></i><?= Helper\a(t('Project management'), 'project', 'index') ?></li> - <?php if (Helper\is_admin()): ?> - <li><i class="fa fa-user fa-fw"></i><?= Helper\a(t('User management'), 'user', 'index') ?></li> - <li><i class="fa fa-cog fa-fw"></i><?= Helper\a(t('Settings'), 'config', 'index') ?></li> + <li><i class="fa fa-lock fa-fw"></i><?= $this->a(t('New private project'), 'project', 'create', array('private' => 1)) ?></li> + <li><i class="fa fa-folder fa-fw"></i><?= $this->a(t('Project management'), 'project', 'index') ?></li> + <?php if ($this->acl->isAdminUser()): ?> + <li><i class="fa fa-user fa-fw"></i><?= $this->a(t('User management'), 'user', 'index') ?></li> + <li><i class="fa fa-cog fa-fw"></i><?= $this->a(t('Settings'), 'config', 'index') ?></li> <?php endif ?> </ul> </div> <section id="dashboard"> <div class="dashboard-left-column"> - <?= Helper\Template('app/projects', array('projects' => $projects, 'pagination' => $project_pagination)) ?> - <?= Helper\Template('app/tasks', array('tasks' => $tasks, 'pagination' => $task_pagination)) ?> - <?= Helper\Template('app/subtasks', array('subtasks' => $subtasks, 'pagination' => $subtask_pagination)) ?> + <?= $this->render('app/projects', array('projects' => $projects, 'pagination' => $project_pagination)) ?> + <?= $this->render('app/tasks', array('tasks' => $tasks, 'pagination' => $task_pagination)) ?> + <?= $this->render('app/subtasks', array('subtasks' => $subtasks, 'pagination' => $subtask_pagination)) ?> </div> <div class="dashboard-right-column"> <h2><?= t('Activity stream') ?></h2> - <?= Helper\template('project/events', array('events' => $events)) ?> + <?= $this->render('project/events', array('events' => $events)) ?> </div> </section> </section>
\ No newline at end of file diff --git a/app/Template/app/projects.php b/app/Template/app/projects.php index 2c13a052..cb698c28 100644 --- a/app/Template/app/projects.php +++ b/app/Template/app/projects.php @@ -4,30 +4,30 @@ <?php else: ?> <table class="table-fixed"> <tr> - <th class="column-8"><?= Helper\order('Id', 'id', $pagination) ?></th> - <th class="column-20"><?= Helper\order(t('Project'), 'name', $pagination) ?></th> + <th class="column-8"><?= $this->order('Id', 'id', $pagination) ?></th> + <th class="column-20"><?= $this->order(t('Project'), 'name', $pagination) ?></th> <th><?= t('Columns') ?></th> </tr> <?php foreach ($projects as $project): ?> <tr> <td> - <?= Helper\a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?> + <?= $this->a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?> </td> <td> - <?php if (Helper\is_project_admin($project)): ?> - <?= Helper\a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?> + <?php if ($this->projectPermission->adminAllowed($project['id'], $this->acl->getUserId())): ?> + <?= $this->a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?> <?php endif ?> - <?= Helper\a(Helper\escape($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a($this->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> </td> <td class="dashboard-project-stats"> <?php foreach ($project['columns'] as $column): ?> <strong title="<?= t('Task count') ?>"><?= $column['nb_tasks'] ?></strong> - <span><?= Helper\escape($column['title']) ?></span> + <span><?= $this->e($column['title']) ?></span> <?php endforeach ?> </td> </tr> <?php endforeach ?> </table> - <?= Helper\paginate($pagination) ?> + <?= $this->paginate($pagination) ?> <?php endif ?>
\ No newline at end of file diff --git a/app/Template/app/subtasks.php b/app/Template/app/subtasks.php index fb451068..47d4782c 100644 --- a/app/Template/app/subtasks.php +++ b/app/Template/app/subtasks.php @@ -4,28 +4,28 @@ <?php else: ?> <table class="table-fixed"> <tr> - <th class="column-10"><?= Helper\order('Id', 'tasks.id', $pagination) ?></th> - <th class="column-20"><?= Helper\order(t('Project'), 'project_name', $pagination) ?></th> - <th class="column-15"><?= Helper\order(t('Status'), 'status', $pagination) ?></th> - <th><?= Helper\order(t('Subtask'), 'title', $pagination) ?></th> + <th class="column-10"><?= $this->order('Id', 'tasks.id', $pagination) ?></th> + <th class="column-20"><?= $this->order(t('Project'), 'project_name', $pagination) ?></th> + <th class="column-15"><?= $this->order(t('Status'), 'status', $pagination) ?></th> + <th><?= $this->order(t('Subtask'), 'title', $pagination) ?></th> </tr> <?php foreach ($subtasks as $subtask): ?> <tr> <td class="task-table task-<?= $subtask['color_id'] ?>"> - <?= Helper\a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?> + <?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?> </td> <td> - <?= Helper\a(Helper\escape($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> + <?= $this->a($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> </td> <td> - <?= Helper\escape($subtask['status_name']) ?> + <?= $this->e($subtask['status_name']) ?> </td> <td> - <?= Helper\a(Helper\escape($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?> + <?= $this->a($this->e($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?> </td> </tr> <?php endforeach ?> </table> - <?= Helper\paginate($pagination) ?> + <?= $this->paginate($pagination) ?> <?php endif ?>
\ No newline at end of file diff --git a/app/Template/app/tasks.php b/app/Template/app/tasks.php index d1e1ed4e..57f1714f 100644 --- a/app/Template/app/tasks.php +++ b/app/Template/app/tasks.php @@ -4,21 +4,21 @@ <?php else: ?> <table class="table-fixed"> <tr> - <th class="column-8"><?= Helper\order('Id', 'tasks.id', $pagination) ?></th> - <th class="column-20"><?= Helper\order(t('Project'), 'project_name', $pagination) ?></th> - <th><?= Helper\order(t('Task'), 'title', $pagination) ?></th> - <th class="column-20"><?= Helper\order(t('Due date'), 'date_due', $pagination) ?></th> + <th class="column-8"><?= $this->order('Id', 'tasks.id', $pagination) ?></th> + <th class="column-20"><?= $this->order(t('Project'), 'project_name', $pagination) ?></th> + <th><?= $this->order(t('Task'), 'title', $pagination) ?></th> + <th class="column-20"><?= $this->order(t('Due date'), 'date_due', $pagination) ?></th> </tr> <?php foreach ($tasks as $task): ?> <tr> <td class="task-table task-<?= $task['color_id'] ?>"> - <?= Helper\a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'])) ?> </td> <td> - <?= Helper\a(Helper\escape($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->a($this->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> </td> <td> - <?= Helper\a(Helper\escape($task['title']), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'])) ?> </td> <td> <?= dt('%B %e, %Y', $task['date_due']) ?> @@ -27,5 +27,5 @@ <?php endforeach ?> </table> - <?= Helper\paginate($pagination) ?> + <?= $this->paginate($pagination) ?> <?php endif ?>
\ No newline at end of file diff --git a/app/Template/board/assignee.php b/app/Template/board/assignee.php index 434daa51..1faf07f8 100644 --- a/app/Template/board/assignee.php +++ b/app/Template/board/assignee.php @@ -1,20 +1,20 @@ <section id="main"> <section> <h3><?= t('Change assignee for the task "%s"', $values['title']) ?></h3> - <form method="post" action="<?= Helper\u('board', 'updateAssignee', array('task_id' => $values['id'])) ?>"> + <form method="post" action="<?= $this->u('board', 'updateAssignee', array('task_id' => $values['id'])) ?>"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Assignee'), 'owner_id') ?> - <?= Helper\form_select('owner_id', $users_list, $values) ?><br/> + <?= $this->formLabel(t('Assignee'), 'owner_id') ?> + <?= $this->formSelect('owner_id', $users_list, $values) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $project['id'])) ?> </div> </form> </section> diff --git a/app/Template/board/category.php b/app/Template/board/category.php index 88d8e71c..3fc77632 100644 --- a/app/Template/board/category.php +++ b/app/Template/board/category.php @@ -1,20 +1,20 @@ <section id="main"> <section> <h3><?= t('Change category for the task "%s"', $values['title']) ?></h3> - <form method="post" action="<?= Helper\u('board', 'updateCategory', array('task_id' => $values['id'])) ?>"> + <form method="post" action="<?= $this->u('board', 'updateCategory', array('task_id' => $values['id'])) ?>"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Category'), 'category_id') ?> - <?= Helper\form_select('category_id', $categories_list, $values) ?><br/> + <?= $this->formLabel(t('Category'), 'category_id') ?> + <?= $this->formSelect('category_id', $categories_list, $values) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $project['id'])) ?> </div> </form> </section> diff --git a/app/Template/board/comments.php b/app/Template/board/comments.php index 83d6bd9a..5424df78 100644 --- a/app/Template/board/comments.php +++ b/app/Template/board/comments.php @@ -1,12 +1,12 @@ <section> <?php foreach ($comments as $comment): ?> <p class="comment-title"> - <span class="comment-username"><?= Helper\escape($comment['name'] ?: $comment['username']) ?></span> @ <span class="comment-date"><?= dt('%b %e, %Y, %k:%M %p', $comment['date']) ?></span> + <span class="comment-username"><?= $this->e($comment['name'] ?: $comment['username']) ?></span> @ <span class="comment-date"><?= dt('%b %e, %Y, %k:%M %p', $comment['date']) ?></span> </p> <div class="comment-inner"> <div class="markdown"> - <?= Helper\markdown($comment['comment']) ?> + <?= $this->markdown($comment['comment']) ?> </div> </div> <?php endforeach ?> diff --git a/app/Template/board/description.php b/app/Template/board/description.php index 85e042dd..b38f5bf4 100644 --- a/app/Template/board/description.php +++ b/app/Template/board/description.php @@ -1,5 +1,5 @@ <section class="tooltip-large"> <div class="markdown"> - <?= Helper\markdown($task['description']) ?> + <?= $this->markdown($task['description']) ?> </div> </section>
\ No newline at end of file diff --git a/app/Template/board/edit.php b/app/Template/board/edit.php index a44abcc8..65a8fb26 100644 --- a/app/Template/board/edit.php +++ b/app/Template/board/edit.php @@ -4,8 +4,8 @@ <section> <h3><?= t('Change columns') ?></h3> -<form method="post" action="<?= Helper\u('board', 'update', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> +<form method="post" action="<?= $this->u('board', 'update', array('project_id' => $project['id'])) ?>" autocomplete="off"> + <?= $this->formCsrf() ?> <?php $i = 0; ?> <table> <tr> @@ -16,23 +16,23 @@ </tr> <?php foreach ($columns as $column): ?> <tr> - <td><?= Helper\form_label('#'.++$i, 'title['.$column['id'].']', array('title="column_id='.$column['id'].'"')) ?></td> - <td><?= Helper\form_text('title['.$column['id'].']', $values, $errors, array('required')) ?></td> - <td><?= Helper\form_number('task_limit['.$column['id'].']', $values, $errors, array('placeholder="'.t('limit').'"')) ?></td> + <td><?= $this->formLabel('#'.++$i, 'title['.$column['id'].']', array('title="column_id='.$column['id'].'"')) ?></td> + <td><?= $this->formText('title['.$column['id'].']', $values, $errors, array('required')) ?></td> + <td><?= $this->formNumber('task_limit['.$column['id'].']', $values, $errors, array('placeholder="'.t('limit').'"')) ?></td> <td> <ul> <?php if ($column['position'] != 1): ?> <li> - <?= Helper\a(t('Move Up'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?> + <?= $this->a(t('Move Up'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?> </li> <?php endif ?> <?php if ($column['position'] != count($columns)): ?> <li> - <?= Helper\a(t('Move Down'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?> + <?= $this->a(t('Move Down'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?> </li> <?php endif ?> <li> - <?= Helper\a(t('Remove'), 'board', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?> + <?= $this->a(t('Remove'), 'board', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?> </li> </ul> </td> @@ -46,14 +46,14 @@ </form> <hr/> <h3><?= t('Add a new column') ?></h3> -<form method="post" action="<?= Helper\u('board', 'add', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('board', 'add', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Title'), 'title') ?> - <?= Helper\form_text('title', $values, $errors, array('required')) ?> + <?= $this->formLabel(t('Title'), 'title') ?> + <?= $this->formText('title', $values, $errors, array('required')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Add this column') ?>" class="btn btn-blue"/> diff --git a/app/Template/board/files.php b/app/Template/board/files.php index 66d5bff9..fee0b63b 100644 --- a/app/Template/board/files.php +++ b/app/Template/board/files.php @@ -2,8 +2,8 @@ <?php foreach ($files as $file): ?> <i class="fa fa-file-o fa-fw"></i> - <?= Helper\a( - Helper\escape($file['name']), + <?= $this->a( + $this->e($file['name']), 'file', 'download', array('file_id' => $file['id'], 'task_id' => $file['task_id']) diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php index a913f7be..1bce0029 100644 --- a/app/Template/board/filters.php +++ b/app/Template/board/filters.php @@ -2,34 +2,34 @@ <ul class="board-filters"> <li class="hide-tablet"> <?= t('Filter by user') ?> - <?= Helper\form_select('user_id', $users) ?> + <?= $this->formSelect('user_id', $users) ?> </li> <li class="hide-tablet"> <?= t('Filter by category') ?> - <?= Helper\form_select('category_id', $categories) ?> + <?= $this->formSelect('category_id', $categories) ?> </li> <li class="hide-tablet"> <a href="#" id="filter-due-date"><?= t('Filter by due date') ?></a> </li> <li> <i class="fa fa-search"></i> - <?= Helper\a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-check-square-o fa-fw"></i> - <?= Helper\a(t('Completed tasks'), 'project', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Completed tasks'), 'project', 'tasks', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-dashboard fa-fw"></i> - <?= Helper\a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-line-chart fa-fw"></i> - <?= Helper\a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> </li> - <?php if (Helper\is_admin()): ?> + <?php if ($this->projectPermission->adminAllowed($project['id'], $this->acl->getUserId())): ?> <li><i class="fa fa-cog fa-fw"></i> - <?= Helper\a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?> <?php endif ?> </ul> </div>
\ No newline at end of file diff --git a/app/Template/board/index.php b/app/Template/board/index.php index 53c662a0..78537085 100644 --- a/app/Template/board/index.php +++ b/app/Template/board/index.php @@ -1,12 +1,12 @@ <section id="main"> - <?= Helper\template('board/filters', array( + <?= $this->render('board/filters', array( 'categories' => $categories, 'users' => $users, 'project' => $project, )) ?> - <?= Helper\template('board/show', array( + <?= $this->render('board/show', array( 'project' => $project, 'swimlanes' => $swimlanes, 'categories' => $categories, diff --git a/app/Template/board/public.php b/app/Template/board/public.php index 0544f392..8eb6415d 100644 --- a/app/Template/board/public.php +++ b/app/Template/board/public.php @@ -1,6 +1,6 @@ <section id="main" class="public-board"> - <?= Helper\template('board/show', array( + <?= $this->render('board/show', array( 'project' => $project, 'swimlanes' => $swimlanes, 'categories' => $categories, diff --git a/app/Template/board/remove.php b/app/Template/board/remove.php index 4529063b..4b0370eb 100644 --- a/app/Template/board/remove.php +++ b/app/Template/board/remove.php @@ -9,7 +9,7 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'board', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= Helper\a(t('cancel'), 'board', 'edit', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Yes'), 'board', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->a(t('cancel'), 'board', 'edit', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/board/show.php b/app/Template/board/show.php index 7df19bc1..5fbb576c 100644 --- a/app/Template/board/show.php +++ b/app/Template/board/show.php @@ -5,8 +5,8 @@ <table id="board" data-project-id="<?= $project['id'] ?>" data-check-interval="<?= $board_private_refresh_interval ?>" - data-save-url="<?= Helper\u('board', 'save', array('project_id' => $project['id'])) ?>" - data-check-url="<?= Helper\u('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" + data-save-url="<?= $this->u('board', 'save', array('project_id' => $project['id'])) ?>" + data-check-url="<?= $this->u('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" > <?php endif ?> @@ -15,7 +15,7 @@ <p class="alert alert-error"><?= t('There is no column in your project!') ?></p> <?php break ?> <?php else: ?> - <?= Helper\template('board/swimlane', array( + <?= $this->render('board/swimlane', array( 'project' => $project, 'swimlane' => $swimlane, 'board_highlight_period' => $board_highlight_period, diff --git a/app/Template/board/subtasks.php b/app/Template/board/subtasks.php index 53330022..72e2b15c 100644 --- a/app/Template/board/subtasks.php +++ b/app/Template/board/subtasks.php @@ -1,13 +1,13 @@ <section id="tooltip-subtasks"> <?php foreach ($subtasks as $subtask): ?> - <?= Helper\a( - trim(Helper\template('subtask/icons', array('subtask' => $subtask))) . Helper\escape($subtask['title']), + <?= $this->a( + trim($this->render('subtask/icons', array('subtask' => $subtask))) . $this->e($subtask['title']), 'board', 'toggleSubtask', array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id']) ) ?> - <?= Helper\escape(empty($subtask['username']) ? '' : ' ['.Helper\get_username($subtask).']') ?> + <?= $this->e(empty($subtask['username']) ? '' : ' ['.$this->getFullname($subtask).']') ?> <br/> <?php endforeach ?> diff --git a/app/Template/board/swimlane.php b/app/Template/board/swimlane.php index e48eb6f1..5766141e 100644 --- a/app/Template/board/swimlane.php +++ b/app/Template/board/swimlane.php @@ -7,15 +7,15 @@ <th> <?php if (! $not_editable): ?> <div class="board-add-icon"> - <?= Helper\a('+', 'task', 'create', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'task-creation-popover', t('Add a new task')) ?> + <?= $this->a('+', 'task', 'create', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'task-creation-popover', t('Add a new task')) ?> </div> <?php endif ?> - <?= Helper\escape($column['title']) ?> + <?= $this->e($column['title']) ?> <?php if ($column['task_limit']): ?> <span title="<?= t('Task limit') ?>" class="task-limit"> - (<span id="task-number-column-<?= $column['id'] ?>"><?= $column['nb_tasks'] ?></span>/<?= Helper\escape($column['task_limit']) ?>) + (<span id="task-number-column-<?= $column['id'] ?>"><?= $column['nb_tasks'] ?></span>/<?= $this->e($column['task_limit']) ?>) </span> <?php else: ?> <span title="<?= t('Task count') ?>" class="task-count"> @@ -28,7 +28,7 @@ <tr> <?php if (! $hide_swimlane): ?> <th class="board-swimlane-title"> - <?= Helper\escape($swimlane['name']) ?> + <?= $this->e($swimlane['name']) ?> </th> <?php endif ?> @@ -46,7 +46,7 @@ <?php endif ?> <?php foreach ($column['tasks'] as $task): ?> - <?= Helper\template('board/task', array( + <?= $this->render('board/task', array( 'project' => $project, 'task' => $task, 'categories' => $categories, diff --git a/app/Template/board/task.php b/app/Template/board/task.php index d077c773..f9f03dc3 100644 --- a/app/Template/board/task.php +++ b/app/Template/board/task.php @@ -4,7 +4,7 @@ <div class="task-board task-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"> - <?= Helper\a('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + <?= $this->a('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> <?php if ($task['reference']): ?> <span class="task-board-reference" title="<?= t('Reference') ?>"> @@ -23,11 +23,11 @@ </span> <?php if ($task['score']): ?> - <span class="task-score"><?= Helper\escape($task['score']) ?></span> + <span class="task-score"><?= $this->e($task['score']) ?></span> <?php endif ?> <div class="task-board-title"> - <?= Helper\a(Helper\escape($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + <?= $this->a($this->e($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> </div> <?php else: ?> @@ -37,10 +37,10 @@ data-owner-id="<?= $task['owner_id'] ?>" data-category-id="<?= $task['category_id'] ?>" data-due-date="<?= $task['date_due'] ?>" - data-task-url="<?= Helper\u('task', 'show', array('task_id' => $task['id'])) ?>" + data-task-url="<?= $this->u('task', 'show', array('task_id' => $task['id'])) ?>" title="<?= t('View this task') ?>"> - <?= Helper\a('#'.$task['id'], 'task', 'edit', array('task_id' => $task['id']), false, 'task-edit-popover', t('Edit this task')) ?> + <?= $this->a('#'.$task['id'], 'task', 'edit', array('task_id' => $task['id']), false, 'task-edit-popover', t('Edit this task')) ?> <?php if ($task['reference']): ?> <span class="task-board-reference" title="<?= t('Reference') ?>"> @@ -51,9 +51,9 @@ - <span class="task-board-user"> - <?= Helper\a( + <?= $this->a( (! empty($task['owner_id']) ? t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) : t('Nobody assigned')) . - ( Helper\is_current_user($task['owner_id']) ? ' <i class="fa fa-star"></i>' : ''), + ( $this->acl->isCurrentUser($task['owner_id']) ? ' <i class="fa fa-star"></i>' : ''), 'board', 'changeAssignee', array('task_id' => $task['id']), @@ -64,11 +64,11 @@ </span> <?php if ($task['score']): ?> - <span class="task-score"><?= Helper\escape($task['score']) ?></span> + <span class="task-score"><?= $this->e($task['score']) ?></span> <?php endif ?> <div class="task-board-title"> - <?= Helper\a(Helper\escape($task['title']), 'task', 'show', array('task_id' => $task['id']), false, '', t('View this task')) ?> + <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id']), false, '', t('View this task')) ?> </div> <?php endif ?> @@ -77,8 +77,8 @@ <?php if ($task['category_id']): ?> <div class="task-board-category-container"> <span class="task-board-category"> - <?= Helper\a( - Helper\in_list($task['category_id'], $categories), + <?= $this->a( + $this->inList($task['category_id'], $categories), 'board', 'changeCategory', array('task_id' => $task['id']), @@ -103,19 +103,19 @@ <div class="task-board-icons"> <?php if (! empty($task['nb_subtasks'])): ?> - <span title="<?= t('Sub-Tasks') ?>" class="task-board-tooltip" data-href="<?= helper\u('board', 'subtasks', array('task_id' => $task['id'])) ?>"><?= $task['nb_completed_subtasks'].'/'.$task['nb_subtasks'] ?> <i class="fa fa-bars"></i></span> + <span title="<?= t('Sub-Tasks') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'subtasks', array('task_id' => $task['id'])) ?>"><?= $task['nb_completed_subtasks'].'/'.$task['nb_subtasks'] ?> <i class="fa fa-bars"></i></span> <?php endif ?> <?php if (! empty($task['nb_files'])): ?> - <span title="<?= t('Attachments') ?>" class="task-board-tooltip" data-href="<?= helper\u('board', 'attachments', array('task_id' => $task['id'])) ?>"><?= $task['nb_files'] ?> <i class="fa fa-paperclip"></i></span> + <span title="<?= t('Attachments') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'attachments', array('task_id' => $task['id'])) ?>"><?= $task['nb_files'] ?> <i class="fa fa-paperclip"></i></span> <?php endif ?> <?php if (! empty($task['nb_comments'])): ?> - <span title="<?= p($task['nb_comments'], t('%d comment', $task['nb_comments']), t('%d comments', $task['nb_comments'])) ?>" class="task-board-tooltip" data-href="<?= helper\u('board', 'comments', array('task_id' => $task['id'])) ?>"><?= $task['nb_comments'] ?> <i class="fa fa-comment-o"></i></span> + <span title="<?= p($task['nb_comments'], t('%d comment', $task['nb_comments']), t('%d comments', $task['nb_comments'])) ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'comments', array('task_id' => $task['id'])) ?>"><?= $task['nb_comments'] ?> <i class="fa fa-comment-o"></i></span> <?php endif ?> <?php if (! empty($task['description'])): ?> - <span title="<?= t('Description') ?>" class="task-board-tooltip" data-href="<?= helper\u('board', 'description', array('task_id' => $task['id'])) ?>"> + <span title="<?= t('Description') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'description', array('task_id' => $task['id'])) ?>"> <?php if (! isset($not_editable)): ?> <a class="task-description-popover" href="?controller=task&action=description&task_id=<?= $task['id'] ?>"><i class="fa fa-file-text-o" data-href="?controller=task&action=description&task_id=<?= $task['id'] ?>"></i></a> <?php else: ?> diff --git a/app/Template/category/edit.php b/app/Template/category/edit.php index 66cf429b..bec175d5 100644 --- a/app/Template/category/edit.php +++ b/app/Template/category/edit.php @@ -2,15 +2,15 @@ <h2><?= t('Category modification for the project "%s"', $project['name']) ?></h2> </div> -<form method="post" action="<?= Helper\u('category', 'update', array('project_id' => $project['id'], 'category_id' => $values['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('category', 'update', array('project_id' => $project['id'], 'category_id' => $values['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Category Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> + <?= $this->formLabel(t('Category Name'), 'name') ?> + <?= $this->formText('name', $values, $errors, array('autofocus required')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/category/index.php b/app/Template/category/index.php index bd275a67..f876275f 100644 --- a/app/Template/category/index.php +++ b/app/Template/category/index.php @@ -9,14 +9,14 @@ </tr> <?php foreach ($categories as $category_id => $category_name): ?> <tr> - <td><?= Helper\escape($category_name) ?></td> + <td><?= $this->e($category_name) ?></td> <td> <ul> <li> - <?= Helper\a(t('Edit'), 'category', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id)) ?> + <?= $this->a(t('Edit'), 'category', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id)) ?> </li> <li> - <?= Helper\a(t('Remove'), 'category', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id)) ?> + <?= $this->a(t('Remove'), 'category', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id)) ?> </li> </ul> </td> @@ -28,13 +28,13 @@ <div class="page-header"> <h2><?= t('Add a new category') ?></h2> </div> -<form method="post" action="<?= Helper\u('category', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('category', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formCsrf() ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Category Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> + <?= $this->formLabel(t('Category Name'), 'name') ?> + <?= $this->formText('name', $values, $errors, array('autofocus required')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/category/remove.php b/app/Template/category/remove.php index 39e5c1db..8875b232 100644 --- a/app/Template/category/remove.php +++ b/app/Template/category/remove.php @@ -9,9 +9,9 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'category', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'category', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'category', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('cancel'), 'category', 'index', array('project_id' => $project['id'])) ?> </div> </div> </section>
\ No newline at end of file diff --git a/app/Template/comment/create.php b/app/Template/comment/create.php index d72fa627..4110711e 100644 --- a/app/Template/comment/create.php +++ b/app/Template/comment/create.php @@ -2,10 +2,10 @@ <h2><?= t('Add a comment') ?></h2> </div> -<form method="post" action="<?= Helper\u('comment', 'save', array('task_id' => $task['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('task_id', $values) ?> - <?= Helper\form_hidden('user_id', $values) ?> +<form method="post" action="<?= $this->u('comment', 'save', array('task_id' => $task['id'])) ?>" autocomplete="off"> + <?= $this->formCsrf() ?> + <?= $this->formHidden('task_id', $values) ?> + <?= $this->formHidden('user_id', $values) ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -17,7 +17,7 @@ </li> </ul> <div class="write-area"> - <?= Helper\form_textarea('comment', $values, $errors, array(! isset($skip_cancel) ? 'autofocus' : '', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?> + <?= $this->formTextarea('comment', $values, $errors, array(! isset($skip_cancel) ? 'autofocus' : '', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?> </div> <div class="preview-area"> <div class="markdown"></div> @@ -30,7 +30,7 @@ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?php if (! isset($skip_cancel)): ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> <?php endif ?> </div> </form> diff --git a/app/Template/comment/edit.php b/app/Template/comment/edit.php index 386dd9b1..51c3ced8 100644 --- a/app/Template/comment/edit.php +++ b/app/Template/comment/edit.php @@ -2,11 +2,11 @@ <h2><?= t('Edit a comment') ?></h2> </div> -<form method="post" action="<?= Helper\u('comment', 'update', array('task_id' => $task['id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('comment', 'update', array('task_id' => $task['id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('task_id', $values) ?> + <?= $this->formCsrf() ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('task_id', $values) ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -18,7 +18,7 @@ </li> </ul> <div class="write-area"> - <?= Helper\form_textarea('comment', $values, $errors, array('autofocus', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?> + <?= $this->formTextarea('comment', $values, $errors, array('autofocus', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?> </div> <div class="preview-area"> <div class="markdown"></div> @@ -30,6 +30,6 @@ <div class="form-actions"> <input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </form> diff --git a/app/Template/comment/remove.php b/app/Template/comment/remove.php index 50382369..374d2c37 100644 --- a/app/Template/comment/remove.php +++ b/app/Template/comment/remove.php @@ -7,11 +7,11 @@ <?= t('Do you really want to remove this comment?') ?> </p> - <?= Helper\template('comment/show', array('comment' => $comment, 'task' => $task, 'preview' => true)) ?> + <?= $this->render('comment/show', array('comment' => $comment, 'task' => $task, 'preview' => true)) ?> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'comment', 'remove', array('task_id' => $task['id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'comment', 'remove', array('task_id' => $task['id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/comment/show.php b/app/Template/comment/show.php index 5e1e9337..2631975a 100644 --- a/app/Template/comment/show.php +++ b/app/Template/comment/show.php @@ -1,7 +1,7 @@ <div class="comment <?= isset($preview) ? 'comment-preview' : '' ?>" id="comment-<?= $comment['id'] ?>"> <p class="comment-title"> - <span class="comment-username"><?= Helper\escape($comment['name'] ?: $comment['username']) ?></span> @ <span class="comment-date"><?= dt('%B %e, %Y at %k:%M %p', $comment['date']) ?></span> + <span class="comment-username"><?= $this->e($comment['name'] ?: $comment['username']) ?></span> @ <span class="comment-date"><?= dt('%B %e, %Y at %k:%M %p', $comment['date']) ?></span> </p> <div class="comment-inner"> @@ -9,12 +9,12 @@ <?php if (! isset($preview)): ?> <ul class="comment-actions"> <li><a href="#comment-<?= $comment['id'] ?>"><?= t('link') ?></a></li> - <?php if ((! isset($not_editable) || ! $not_editable) && (Helper\is_admin() || Helper\is_current_user($comment['user_id']))): ?> + <?php if ((! isset($not_editable) || ! $not_editable) && ($this->acl->isAdminUser() || $this->acl->isCurrentUser($comment['user_id']))): ?> <li> - <?= Helper\a(t('remove'), 'comment', 'confirm', array('task_id' => $task['id'], 'comment_id' => $comment['id'])) ?> + <?= $this->a(t('remove'), 'comment', 'confirm', array('task_id' => $task['id'], 'comment_id' => $comment['id'])) ?> </li> <li> - <?= Helper\a(t('edit'), 'comment', 'edit', array('task_id' => $task['id'], 'comment_id' => $comment['id'])) ?> + <?= $this->a(t('edit'), 'comment', 'edit', array('task_id' => $task['id'], 'comment_id' => $comment['id'])) ?> </li> <?php endif ?> </ul> @@ -22,7 +22,7 @@ <div class="markdown"> <?php if (isset($is_public) && $is_public): ?> - <?= Helper\markdown( + <?= $this->markdown( $comment['comment'], array( 'controller' => 'task', @@ -33,7 +33,7 @@ ) ) ?> <?php else: ?> - <?= Helper\markdown($comment['comment']) ?> + <?= $this->markdown($comment['comment']) ?> <?php endif ?> </div> diff --git a/app/Template/config/about.php b/app/Template/config/about.php index 3f34f802..d96e6bdd 100644 --- a/app/Template/config/about.php +++ b/app/Template/config/about.php @@ -21,19 +21,19 @@ <ul> <li> <?= t('Database driver:') ?> - <strong><?= Helper\escape(DB_DRIVER) ?></strong> + <strong><?= $this->e(DB_DRIVER) ?></strong> </li> <?php if (DB_DRIVER === 'sqlite'): ?> <li> <?= t('Database size:') ?> - <strong><?= Helper\format_bytes($db_size) ?></strong> + <strong><?= $this->formatBytes($db_size) ?></strong> </li> <li> - <?= Helper\a(t('Download the database'), 'config', 'downloadDb', array(), true) ?> + <?= $this->a(t('Download the database'), 'config', 'downloadDb', array(), true) ?> <?= t('(Gzip compressed Sqlite file)') ?> </li> <li> - <?= Helper\a(t('Optimize the database'), 'config', 'optimizeDb', array(), true) ?> + <?= $this->a(t('Optimize the database'), 'config', 'optimizeDb', array(), true) ?> <?= t('(VACUUM command)') ?> </li> <?php endif ?> diff --git a/app/Template/config/api.php b/app/Template/config/api.php index 20a02340..0df90835 100644 --- a/app/Template/config/api.php +++ b/app/Template/config/api.php @@ -5,14 +5,14 @@ <ul> <li> <?= t('API token:') ?> - <strong><?= Helper\escape($values['api_token']) ?></strong> + <strong><?= $this->e($values['api_token']) ?></strong> </li> <li> <?= t('API endpoint:') ?> - <input type="text" class="auto-select" readonly="readonly" value="<?= Helper\get_current_base_url().'jsonrpc.php' ?>"> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().'jsonrpc.php' ?>"> </li> <li> - <?= Helper\a(t('Reset token'), 'config', 'token', array('type' => 'api'), true) ?> + <?= $this->a(t('Reset token'), 'config', 'token', array('type' => 'api'), true) ?> </li> </ul> </section>
\ No newline at end of file diff --git a/app/Template/config/application.php b/app/Template/config/application.php index c92975bc..26f3743e 100644 --- a/app/Template/config/application.php +++ b/app/Template/config/application.php @@ -2,22 +2,22 @@ <h2><?= t('Application settings') ?></h2> </div> <section> -<form method="post" action="<?= Helper\u('config', 'application') ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('config', 'application') ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_label(t('Application URL'), 'application_url') ?> - <?= Helper\form_text('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?><br/> + <?= $this->formLabel(t('Application URL'), 'application_url') ?> + <?= $this->formText('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?><br/> <p class="form-help"><?= t('Example: http://example.kanboard.net/ (used by email notifications)') ?></p> - <?= Helper\form_label(t('Language'), 'application_language') ?> - <?= Helper\form_select('application_language', $languages, $values, $errors) ?><br/> + <?= $this->formLabel(t('Language'), 'application_language') ?> + <?= $this->formSelect('application_language', $languages, $values, $errors) ?><br/> - <?= Helper\form_label(t('Timezone'), 'application_timezone') ?> - <?= Helper\form_select('application_timezone', $timezones, $values, $errors) ?><br/> + <?= $this->formLabel(t('Timezone'), 'application_timezone') ?> + <?= $this->formSelect('application_timezone', $timezones, $values, $errors) ?><br/> - <?= Helper\form_label(t('Date format'), 'application_date_format') ?> - <?= Helper\form_select('application_date_format', $date_formats, $values, $errors) ?><br/> + <?= $this->formLabel(t('Date format'), 'application_date_format') ?> + <?= $this->formSelect('application_date_format', $date_formats, $values, $errors) ?><br/> <p class="form-help"><?= t('ISO format is always accepted, example: "%s" and "%s"', date('Y-m-d'), date('Y_m_d')) ?></p> <div class="form-actions"> diff --git a/app/Template/config/board.php b/app/Template/config/board.php index f260d084..3bd4ecbd 100644 --- a/app/Template/config/board.php +++ b/app/Template/config/board.php @@ -2,24 +2,24 @@ <h2><?= t('Board settings') ?></h2> </div> <section> -<form method="post" action="<?= Helper\u('config', 'board') ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('config', 'board') ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_label(t('Task highlight period'), 'board_highlight_period') ?> - <?= Helper\form_number('board_highlight_period', $values, $errors) ?><br/> + <?= $this->formLabel(t('Task highlight period'), 'board_highlight_period') ?> + <?= $this->formNumber('board_highlight_period', $values, $errors) ?><br/> <p class="form-help"><?= t('Period (in second) to consider a task was modified recently (0 to disable, 2 days by default)') ?></p> - <?= Helper\form_label(t('Refresh interval for public board'), 'board_public_refresh_interval') ?> - <?= Helper\form_number('board_public_refresh_interval', $values, $errors) ?><br/> + <?= $this->formLabel(t('Refresh interval for public board'), 'board_public_refresh_interval') ?> + <?= $this->formNumber('board_public_refresh_interval', $values, $errors) ?><br/> <p class="form-help"><?= t('Frequency in second (60 seconds by default)') ?></p> - <?= Helper\form_label(t('Refresh interval for private board'), 'board_private_refresh_interval') ?> - <?= Helper\form_number('board_private_refresh_interval', $values, $errors) ?><br/> + <?= $this->formLabel(t('Refresh interval for private board'), 'board_private_refresh_interval') ?> + <?= $this->formNumber('board_private_refresh_interval', $values, $errors) ?><br/> <p class="form-help"><?= t('Frequency in second (0 to disable this feature, 10 seconds by default)') ?></p> - <?= Helper\form_label(t('Default columns for new projects (Comma-separated)'), 'board_columns') ?> - <?= Helper\form_text('board_columns', $values, $errors) ?><br/> + <?= $this->formLabel(t('Default columns for new projects (Comma-separated)'), 'board_columns') ?> + <?= $this->formText('board_columns', $values, $errors) ?><br/> <p class="form-help"><?= t('Default values are "%s"', $default_columns) ?></p> <div class="form-actions"> diff --git a/app/Template/config/layout.php b/app/Template/config/layout.php index e0ac2fa8..028f138c 100644 --- a/app/Template/config/layout.php +++ b/app/Template/config/layout.php @@ -1,7 +1,7 @@ <section id="main"> <section class="sidebar-container" id="config-section"> - <?= Helper\template('config/sidebar') ?> + <?= $this->render('config/sidebar') ?> <div class="sidebar-content"> <?= $config_content_for_layout ?> diff --git a/app/Template/config/sidebar.php b/app/Template/config/sidebar.php index 5870ca81..8e6fa379 100644 --- a/app/Template/config/sidebar.php +++ b/app/Template/config/sidebar.php @@ -2,19 +2,19 @@ <h2><?= t('Actions') ?></h2> <ul> <li> - <?= Helper\a(t('About'), 'config', 'index') ?> + <?= $this->a(t('About'), 'config', 'index') ?> </li> <li> - <?= Helper\a(t('Application settings'), 'config', 'application') ?> + <?= $this->a(t('Application settings'), 'config', 'application') ?> </li> <li> - <?= Helper\a(t('Board settings'), 'config', 'board') ?> + <?= $this->a(t('Board settings'), 'config', 'board') ?> </li> <li> - <?= Helper\a(t('Webhooks'), 'config', 'webhook') ?> + <?= $this->a(t('Webhooks'), 'config', 'webhook') ?> </li> <li> - <?= Helper\a(t('API'), 'config', 'api') ?> + <?= $this->a(t('API'), 'config', 'api') ?> </li> </ul> </div>
\ No newline at end of file diff --git a/app/Template/config/webhook.php b/app/Template/config/webhook.php index abd8da5f..d4f06d3f 100644 --- a/app/Template/config/webhook.php +++ b/app/Template/config/webhook.php @@ -2,15 +2,15 @@ <h2><?= t('Webhook settings') ?></h2> </div> <section> -<form method="post" action="<?= Helper\u('config', 'webhook') ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('config', 'webhook') ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_label(t('Webhook URL for task creation'), 'webhook_url_task_creation') ?> - <?= Helper\form_text('webhook_url_task_creation', $values, $errors) ?><br/> + <?= $this->formLabel(t('Webhook URL for task creation'), 'webhook_url_task_creation') ?> + <?= $this->formText('webhook_url_task_creation', $values, $errors) ?><br/> - <?= Helper\form_label(t('Webhook URL for task modification'), 'webhook_url_task_modification') ?> - <?= Helper\form_text('webhook_url_task_modification', $values, $errors) ?><br/> + <?= $this->formLabel(t('Webhook URL for task modification'), 'webhook_url_task_modification') ?> + <?= $this->formText('webhook_url_task_modification', $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> @@ -25,14 +25,14 @@ <ul> <li> <?= t('Webhook token:') ?> - <strong><?= Helper\escape($values['webhook_token']) ?></strong> + <strong><?= $this->e($values['webhook_token']) ?></strong> </li> <li> <?= t('URL for task creation:') ?> - <input type="text" class="auto-select" readonly="readonly" value="<?= Helper\get_current_base_url().Helper\u('webhook', 'task', array('token' => $values['webhook_token'])) ?>"> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'task', array('token' => $values['webhook_token'])) ?>"> </li> <li> - <?= Helper\a(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?> + <?= $this->a(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?> </li> </ul> </section>
\ No newline at end of file diff --git a/app/Template/event/comment_create.php b/app/Template/event/comment_create.php index d2f6f97b..ee985ed1 100644 --- a/app/Template/event/comment_create.php +++ b/app/Template/event/comment_create.php @@ -1,7 +1,7 @@ <p class="activity-title"> - <?= e('%s commented the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s commented the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <div class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em><br/> - <div class="markdown"><?= Helper\markdown($comment['comment']) ?></div> + <em><?= $this->e($task['title']) ?></em><br/> + <div class="markdown"><?= $this->markdown($comment['comment']) ?></div> </div>
\ No newline at end of file diff --git a/app/Template/event/comment_update.php b/app/Template/event/comment_update.php index c0b43622..93418159 100644 --- a/app/Template/event/comment_update.php +++ b/app/Template/event/comment_update.php @@ -1,6 +1,6 @@ <p class="activity-title"> - <?= e('%s updated a comment on the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s updated a comment on the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <div class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em><br/> + <em><?= $this->e($task['title']) ?></em><br/> </div>
\ No newline at end of file diff --git a/app/Template/event/subtask_create.php b/app/Template/event/subtask_create.php index 664e9da2..3572031f 100644 --- a/app/Template/event/subtask_create.php +++ b/app/Template/event/subtask_create.php @@ -1,12 +1,12 @@ <p class="activity-title"> - <?= e('%s created a subtask for the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s created a subtask for the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <div class="activity-description"> - <p><em><?= Helper\escape($task['title']) ?></em></p> + <p><em><?= $this->e($task['title']) ?></em></p> <ul> <li> - <?= Helper\escape($subtask['title']) ?> (<strong><?= Helper\escape($subtask['status_name']) ?></strong>) + <?= $this->e($subtask['title']) ?> (<strong><?= $this->e($subtask['status_name']) ?></strong>) </li> <li> <?php if ($subtask['username']): ?> diff --git a/app/Template/event/subtask_update.php b/app/Template/event/subtask_update.php index 96a589dd..0adc8ff5 100644 --- a/app/Template/event/subtask_update.php +++ b/app/Template/event/subtask_update.php @@ -1,12 +1,12 @@ <p class="activity-title"> - <?= e('%s updated a subtask for the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s updated a subtask for the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <div class="activity-description"> - <p><em><?= Helper\escape($task['title']) ?></em></p> + <p><em><?= $this->e($task['title']) ?></em></p> <ul> <li> - <?= Helper\escape($subtask['title']) ?> (<strong><?= Helper\escape($subtask['status_name']) ?></strong>) + <?= $this->e($subtask['title']) ?> (<strong><?= $this->e($subtask['status_name']) ?></strong>) </li> <li> <?php if ($subtask['username']): ?> diff --git a/app/Template/event/task_assignee_change.php b/app/Template/event/task_assignee_change.php index b346325e..e9815853 100644 --- a/app/Template/event/task_assignee_change.php +++ b/app/Template/event/task_assignee_change.php @@ -1,12 +1,12 @@ <p class="activity-title"> <?= e( '%s change the assignee of the task <a href="?controller=task&action=show&task_id=%d">#%d</a> to %s', - Helper\escape($author), + $this->e($author), $task_id, $task_id, - Helper\escape($task['assignee_name'] ?: $task['assignee_username']) + $this->e($task['assignee_name'] ?: $task['assignee_username']) ) ?> </p> <p class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em> + <em><?= $this->e($task['title']) ?></em> </p>
\ No newline at end of file diff --git a/app/Template/event/task_close.php b/app/Template/event/task_close.php index 48d25678..6ab476bd 100644 --- a/app/Template/event/task_close.php +++ b/app/Template/event/task_close.php @@ -1,6 +1,6 @@ <p class="activity-title"> - <?= e('%s closed the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s closed the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <p class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em> + <em><?= $this->e($task['title']) ?></em> </p>
\ No newline at end of file diff --git a/app/Template/event/task_create.php b/app/Template/event/task_create.php index 2515af05..36bd4713 100644 --- a/app/Template/event/task_create.php +++ b/app/Template/event/task_create.php @@ -1,6 +1,6 @@ <p class="activity-title"> - <?= e('%s created the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s created the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <p class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em> + <em><?= $this->e($task['title']) ?></em> </p>
\ No newline at end of file diff --git a/app/Template/event/task_move_column.php b/app/Template/event/task_move_column.php index f2aac8f7..9c5f54dd 100644 --- a/app/Template/event/task_move_column.php +++ b/app/Template/event/task_move_column.php @@ -1,6 +1,6 @@ <p class="activity-title"> - <?= e('%s moved the task <a href="?controller=task&action=show&task_id=%d">#%d</a> to the column "%s"', Helper\escape($author), $task_id, $task_id, Helper\escape($task['column_title'])) ?> + <?= e('%s moved the task <a href="?controller=task&action=show&task_id=%d">#%d</a> to the column "%s"', $this->e($author), $task_id, $task_id, $this->e($task['column_title'])) ?> </p> <p class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em> + <em><?= $this->e($task['title']) ?></em> </p>
\ No newline at end of file diff --git a/app/Template/event/task_move_position.php b/app/Template/event/task_move_position.php index 26cdeb13..86e09953 100644 --- a/app/Template/event/task_move_position.php +++ b/app/Template/event/task_move_position.php @@ -1,6 +1,6 @@ <p class="activity-title"> - <?= e('%s moved the task <a href="?controller=task&action=show&task_id=%d">#%d</a> to the position #%d in the column "%s"', Helper\escape($author), $task_id, $task_id, $task['position'], Helper\escape($task['column_title'])) ?> + <?= e('%s moved the task <a href="?controller=task&action=show&task_id=%d">#%d</a> to the position #%d in the column "%s"', $this->e($author), $task_id, $task_id, $task['position'], $this->e($task['column_title'])) ?> </p> <p class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em> + <em><?= $this->e($task['title']) ?></em> </p>
\ No newline at end of file diff --git a/app/Template/event/task_open.php b/app/Template/event/task_open.php index 9623be74..cdcb907c 100644 --- a/app/Template/event/task_open.php +++ b/app/Template/event/task_open.php @@ -1,6 +1,6 @@ <p class="activity-title"> - <?= e('%s open the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s open the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <p class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em> + <em><?= $this->e($task['title']) ?></em> </p>
\ No newline at end of file diff --git a/app/Template/event/task_update.php b/app/Template/event/task_update.php index a270b936..34b96257 100644 --- a/app/Template/event/task_update.php +++ b/app/Template/event/task_update.php @@ -1,6 +1,6 @@ <p class="activity-title"> - <?= e('%s updated the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', Helper\escape($author), $task_id, $task_id) ?> + <?= e('%s updated the task <a href="?controller=task&action=show&task_id=%d">#%d</a>', $this->e($author), $task_id, $task_id) ?> </p> <p class="activity-description"> - <em><?= Helper\escape($task['title']) ?></em> + <em><?= $this->e($task['title']) ?></em> </p>
\ No newline at end of file diff --git a/app/Template/file/new.php b/app/Template/file/new.php index 63c29f1d..861344b4 100644 --- a/app/Template/file/new.php +++ b/app/Template/file/new.php @@ -2,13 +2,13 @@ <h2><?= t('Attach a document') ?></h2> </div> -<form action="<?= Helper\u('file', 'save', array('task_id' => $task['id'])) ?>" method="post" enctype="multipart/form-data"> - <?= Helper\form_csrf() ?> +<form action="<?= $this->u('file', 'save', array('task_id' => $task['id'])) ?>" method="post" enctype="multipart/form-data"> + <?= $this->formCsrf() ?> <input type="file" name="files[]" multiple /> - <div class="form-help"><?= t('Maximum size: ') ?><?= is_integer($max_size) ? Helper\format_bytes($max_size) : $max_size ?></div> + <div class="form-help"><?= t('Maximum size: ') ?><?= is_integer($max_size) ? $this->formatBytes($max_size) : $max_size ?></div> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/file/open.php b/app/Template/file/open.php index 6106e6f8..9efd7780 100644 --- a/app/Template/file/open.php +++ b/app/Template/file/open.php @@ -1,6 +1,6 @@ <div class="page-header"> - <h2><?= Helper\escape($file['name']) ?></h2> + <h2><?= $this->e($file['name']) ?></h2> <div class="task-file-viewer"> - <img src="<?= Helper\u('file', 'image', array('file_id' => $file['id'], 'task_id' => $file['task_id'])) ?>" alt="<?= Helper\escape($file['name']) ?>"/> + <img src="<?= $this->u('file', 'image', array('file_id' => $file['id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/> </div> </div>
\ No newline at end of file diff --git a/app/Template/file/remove.php b/app/Template/file/remove.php index 4f655e5a..3e542c05 100644 --- a/app/Template/file/remove.php +++ b/app/Template/file/remove.php @@ -4,12 +4,12 @@ <div class="confirm"> <p class="alert alert-info"> - <?= t('Do you really want to remove this file: "%s"?', Helper\escape($file['name'])) ?> + <?= t('Do you really want to remove this file: "%s"?', $this->e($file['name'])) ?> </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'file', 'remove', array('task_id' => $task['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'file', 'remove', array('task_id' => $task['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/file/show.php b/app/Template/file/show.php index 92a7c100..4742db87 100644 --- a/app/Template/file/show.php +++ b/app/Template/file/show.php @@ -8,12 +8,12 @@ <ul class="task-show-files"> <?php foreach ($files as $file): ?> <li> - <?= Helper\a(Helper\escape($file['name']), 'file', 'download', array('task_id' => $task['id'], 'file_id' => $file['id'])) ?> + <?= $this->a($this->e($file['name']), 'file', 'download', array('task_id' => $task['id'], 'file_id' => $file['id'])) ?> <span class="task-show-file-actions"> <?php if ($file['is_image']): ?> - <?= Helper\a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'file_id' => $file['id']), false, 'file-popover') ?>, + <?= $this->a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'file_id' => $file['id']), false, 'file-popover') ?>, <?php endif ?> - <?= Helper\a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'file_id' => $file['id'])) ?> + <?= $this->a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'file_id' => $file['id'])) ?> </span> </li> <?php endforeach ?> diff --git a/app/Template/layout.php b/app/Template/layout.php index 7edd0051..3b642b48 100644 --- a/app/Template/layout.php +++ b/app/Template/layout.php @@ -11,10 +11,10 @@ <?php endif ?> <?php if (! isset($not_editable)): ?> - <?= Helper\js('assets/js/app.js') ?> + <?= $this->js('assets/js/app.js') ?> <?php endif ?> - <?= Helper\css('assets/css/app.css') ?> + <?= $this->css('assets/css/app.css') ?> <link rel="icon" type="image/png" href="assets/img/favicon.png"> <link rel="apple-touch-icon" href="assets/img/touch-icon-iphone.png"> @@ -22,36 +22,36 @@ <link rel="apple-touch-icon" sizes="114x114" href="assets/img/touch-icon-iphone-retina.png"> <link rel="apple-touch-icon" sizes="144x144" href="assets/img/touch-icon-ipad-retina.png"> - <title><?= isset($title) ? Helper\escape($title) : 'Kanboard' ?></title> + <title><?= isset($title) ? $this->e($title) : 'Kanboard' ?></title> </head> - <body data-status-url="<?= Helper\u('app', 'status') ?>" data-login-url="<?= Helper\u('user', 'login') ?>"> + <body data-status-url="<?= $this->u('app', 'status') ?>" data-login-url="<?= $this->u('user', 'login') ?>"> <?php if (isset($no_layout) && $no_layout): ?> <?= $content_for_layout ?> <?php else: ?> <header> <nav> - <h1><?= Helper\a('<i class="fa fa-home fa-fw"></i>', 'app', 'index', array(), false, 'home-link', t('Dashboard')).' '.Helper\summary(Helper\escape($title)) ?></h1> + <h1><?= $this->a('<i class="fa fa-home fa-fw"></i>', 'app', 'index', array(), false, 'home-link', t('Dashboard')).' '.$this->summary($this->e($title)) ?></h1> <ul> <?php if (isset($board_selector) && ! empty($board_selector)): ?> <li> - <select id="board-selector" data-placeholder="<?= t('Display another project') ?>" data-board-url="<?= Helper\u('board', 'show', array('project_id' => '%d')) ?>"> + <select id="board-selector" data-placeholder="<?= t('Display another project') ?>" data-board-url="<?= $this->u('board', 'show', array('project_id' => '%d')) ?>"> <option value=""></option> <?php foreach($board_selector as $board_id => $board_name): ?> - <option value="<?= $board_id ?>"><?= Helper\escape($board_name) ?></option> + <option value="<?= $board_id ?>"><?= $this->e($board_name) ?></option> <?php endforeach ?> </select> </li> <?php endif ?> <li> - <?= Helper\a(t('Logout'), 'user', 'logout', array(), true) ?> - <span class="username hide-tablet">(<?= Helper\a(Helper\escape(Helper\get_username()), 'user', 'show', array('user_id' => Helper\get_user_id())) ?>)</span> + <?= $this->a(t('Logout'), 'user', 'logout', array(), true) ?> + <span class="username hide-tablet">(<?= $this->a($this->e($this->getFullname()), 'user', 'show', array('user_id' => $this->acl->getUserId())) ?>)</span> </li> </ul> </nav> </header> <section class="page"> - <?= Helper\flash('<div class="alert alert-success alert-fade-out">%s</div>') ?> - <?= Helper\flash_error('<div class="alert alert-error">%s</div>') ?> + <?= $this->flash('<div class="alert alert-success alert-fade-out">%s</div>') ?> + <?= $this->flashError('<div class="alert alert-error">%s</div>') ?> <?= $content_for_layout ?> </section> <?php endif ?> diff --git a/app/Template/notification/comment_creation.php b/app/Template/notification/comment_creation.php index 52f82a92..b28e261a 100644 --- a/app/Template/notification/comment_creation.php +++ b/app/Template/notification/comment_creation.php @@ -1,7 +1,7 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <h3><?= t('New comment posted by %s', $comment['name'] ?: $comment['username']) ?></h3> -<?= Helper\markdown($comment['comment']) ?> +<?= $this->markdown($comment['comment']) ?> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/comment_update.php b/app/Template/notification/comment_update.php index 8f613eb2..88154f0b 100644 --- a/app/Template/notification/comment_update.php +++ b/app/Template/notification/comment_update.php @@ -1,7 +1,7 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <h3><?= t('Comment updated') ?></h3> -<?= Helper\markdown($comment['comment']) ?> +<?= $this->markdown($comment['comment']) ?> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/file_creation.php b/app/Template/notification/file_creation.php index aae6fee9..63f7d1b8 100644 --- a/app/Template/notification/file_creation.php +++ b/app/Template/notification/file_creation.php @@ -1,5 +1,5 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <p><?= t('New attachment added "%s"', $file['name']) ?></p> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/subtask_creation.php b/app/Template/notification/subtask_creation.php index b264ef49..e1c62b73 100644 --- a/app/Template/notification/subtask_creation.php +++ b/app/Template/notification/subtask_creation.php @@ -1,17 +1,17 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <h3><?= t('New sub-task') ?></h3> <ul> - <li><?= t('Title:') ?> <?= Helper\escape($subtask['title']) ?></li> - <li><?= t('Status:') ?> <?= Helper\escape($subtask['status_name']) ?></li> - <li><?= t('Assignee:') ?> <?= Helper\escape($subtask['name'] ?: $subtask['username'] ?: '?') ?></li> + <li><?= t('Title:') ?> <?= $this->e($subtask['title']) ?></li> + <li><?= t('Status:') ?> <?= $this->e($subtask['status_name']) ?></li> + <li><?= t('Assignee:') ?> <?= $this->e($subtask['name'] ?: $subtask['username'] ?: '?') ?></li> <li> <?= t('Time tracking:') ?> <?php if (! empty($subtask['time_estimated'])): ?> - <strong><?= Helper\escape($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?> + <strong><?= $this->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?> <?php endif ?> </li> </ul> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/subtask_update.php b/app/Template/notification/subtask_update.php index 08b7d97f..cfde9db6 100644 --- a/app/Template/notification/subtask_update.php +++ b/app/Template/notification/subtask_update.php @@ -1,21 +1,21 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <h3><?= t('Sub-task updated') ?></h3> <ul> - <li><?= t('Title:') ?> <?= Helper\escape($subtask['title']) ?></li> - <li><?= t('Status:') ?> <?= Helper\escape($subtask['status_name']) ?></li> - <li><?= t('Assignee:') ?> <?= Helper\escape($subtask['name'] ?: $subtask['username'] ?: '?') ?></li> + <li><?= t('Title:') ?> <?= $this->e($subtask['title']) ?></li> + <li><?= t('Status:') ?> <?= $this->e($subtask['status_name']) ?></li> + <li><?= t('Assignee:') ?> <?= $this->e($subtask['name'] ?: $subtask['username'] ?: '?') ?></li> <li> <?= t('Time tracking:') ?> <?php if (! empty($subtask['time_spent'])): ?> - <strong><?= Helper\escape($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?> + <strong><?= $this->e($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?> <?php endif ?> <?php if (! empty($subtask['time_estimated'])): ?> - <strong><?= Helper\escape($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?> + <strong><?= $this->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?> <?php endif ?> </li> </ul> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_assignee_change.php b/app/Template/notification/task_assignee_change.php index 14beef13..faab92f3 100644 --- a/app/Template/notification/task_assignee_change.php +++ b/app/Template/notification/task_assignee_change.php @@ -1,4 +1,4 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <ul> <li> @@ -14,7 +14,7 @@ <?php if (! empty($task['description'])): ?> <h2><?= t('Description') ?></h2> - <?= Helper\markdown($task['description']) ?: t('There is no description.') ?> + <?= $this->markdown($task['description']) ?: t('There is no description.') ?> <?php endif ?> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_close.php b/app/Template/notification/task_close.php index 1a5ec553..463223a0 100644 --- a/app/Template/notification/task_close.php +++ b/app/Template/notification/task_close.php @@ -1,5 +1,5 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <p><?= t('The task #%d have been closed.', $task['id']) ?></p> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_creation.php b/app/Template/notification/task_creation.php index 99ebcbe5..dfd3e591 100644 --- a/app/Template/notification/task_creation.php +++ b/app/Template/notification/task_creation.php @@ -1,4 +1,4 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <ul> <li> @@ -25,19 +25,19 @@ </li> <li> <?= t('Column on the board:') ?> - <strong><?= Helper\escape($task['column_title']) ?></strong> + <strong><?= $this->e($task['column_title']) ?></strong> </li> - <li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li> + <li><?= t('Task position:').' '.$this->e($task['position']) ?></li> <?php if ($task['category_name']): ?> <li> - <?= t('Category:') ?> <strong><?= Helper\escape($task['category_name']) ?></strong> + <?= t('Category:') ?> <strong><?= $this->e($task['category_name']) ?></strong> </li> <?php endif ?> </ul> <?php if (! empty($task['description'])): ?> <h2><?= t('Description') ?></h2> - <?= Helper\markdown($task['description']) ?> + <?= $this->markdown($task['description']) ?> <?php endif ?> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_due.php b/app/Template/notification/task_due.php index c7ea010f..066ada64 100644 --- a/app/Template/notification/task_due.php +++ b/app/Template/notification/task_due.php @@ -5,9 +5,9 @@ <li> (<strong>#<?= $task['id'] ?></strong>) <?php if ($application_url): ?> - <a href="<?= $application_url.'?controller=task&action=show&task_id='.$task['id'] ?>"><?= Helper\escape($task['title']) ?></a> + <a href="<?= $application_url.'?controller=task&action=show&task_id='.$task['id'] ?>"><?= $this->e($task['title']) ?></a> <?php else: ?> - <?= Helper\escape($task['title']) ?> + <?= $this->e($task['title']) ?> <?php endif ?> (<?= dt('%B %e, %Y', $task['date_due']) ?>) <?php if ($task['assignee_username']): ?> @@ -17,4 +17,4 @@ <?php endforeach ?> </ul> -<?= Helper\template('notification/footer', array('task' => $task)) ?> +<?= $this->render('notification/footer', array('task' => $task)) ?> diff --git a/app/Template/notification/task_move_column.php b/app/Template/notification/task_move_column.php index 36f4daed..88ab8ab5 100644 --- a/app/Template/notification/task_move_column.php +++ b/app/Template/notification/task_move_column.php @@ -1,11 +1,11 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <ul> <li> <?= t('Column on the board:') ?> - <strong><?= Helper\escape($task['column_title']) ?></strong> + <strong><?= $this->e($task['column_title']) ?></strong> </li> - <li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li> + <li><?= t('Task position:').' '.$this->e($task['position']) ?></li> </ul> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_move_position.php b/app/Template/notification/task_move_position.php index 36f4daed..88ab8ab5 100644 --- a/app/Template/notification/task_move_position.php +++ b/app/Template/notification/task_move_position.php @@ -1,11 +1,11 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <ul> <li> <?= t('Column on the board:') ?> - <strong><?= Helper\escape($task['column_title']) ?></strong> + <strong><?= $this->e($task['column_title']) ?></strong> </li> - <li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li> + <li><?= t('Task position:').' '.$this->e($task['position']) ?></li> </ul> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_open.php b/app/Template/notification/task_open.php index 6ee10242..cb02a79c 100644 --- a/app/Template/notification/task_open.php +++ b/app/Template/notification/task_open.php @@ -1,5 +1,5 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <p><?= t('The task #%d have been opened.', $task['id']) ?></p> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_update.php b/app/Template/notification/task_update.php index cbd6b2e1..71e949dd 100644 --- a/app/Template/notification/task_update.php +++ b/app/Template/notification/task_update.php @@ -1,4 +1,4 @@ -<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2> +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> <ul> <li> @@ -25,19 +25,19 @@ </li> <li> <?= t('Column on the board:') ?> - <strong><?= Helper\escape($task['column_title']) ?></strong> + <strong><?= $this->e($task['column_title']) ?></strong> </li> - <li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li> + <li><?= t('Task position:').' '.$this->e($task['position']) ?></li> <?php if ($task['category_name']): ?> <li> - <?= t('Category:') ?> <strong><?= Helper\escape($task['category_name']) ?></strong> + <?= t('Category:') ?> <strong><?= $this->e($task['category_name']) ?></strong> </li> <?php endif ?> </ul> <?php if (! empty($task['description'])): ?> <h2><?= t('Description') ?></h2> - <?= Helper\markdown($task['description']) ?: t('There is no description.') ?> + <?= $this->markdown($task['description']) ?: t('There is no description.') ?> <?php endif ?> -<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/project/activity.php b/app/Template/project/activity.php index 7cc69bfe..cb986658 100644 --- a/app/Template/project/activity.php +++ b/app/Template/project/activity.php @@ -1,15 +1,15 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= Helper\a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> - <li><i class="fa fa-search fa-fw"></i><?= Helper\a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?></li> - <li><i class="fa fa-check-square-o fa-fw"></i><?= Helper\a(t('Completed tasks'), 'project', 'tasks', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-search fa-fw"></i><?= $this->a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-check-square-o fa-fw"></i><?= $this->a(t('Completed tasks'), 'project', 'tasks', array('project_id' => $project['id'])) ?></li> <?php if ($project['is_public']): ?> - <li><i class="fa fa-rss-square fa-fw"></i><?= Helper\a(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-rss-square fa-fw"></i><?= $this->a(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></li> <?php endif ?> </ul> </div> <section> - <?= Helper\template('project/events', array('events' => $events)) ?> + <?= $this->render('project/events', array('events' => $events)) ?> </section> </section>
\ No newline at end of file diff --git a/app/Template/project/disable.php b/app/Template/project/disable.php index 7a729fa3..48a09a97 100644 --- a/app/Template/project/disable.php +++ b/app/Template/project/disable.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'project', 'disable', array('project_id' => $project['id'], 'disable' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= Helper\a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Yes'), 'project', 'disable', array('project_id' => $project['id'], 'disable' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/project/duplicate.php b/app/Template/project/duplicate.php index a926dcd1..fc704b1e 100644 --- a/app/Template/project/duplicate.php +++ b/app/Template/project/duplicate.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'project', 'duplicate', array('project_id' => $project['id'], 'duplicate' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= Helper\a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Yes'), 'project', 'duplicate', array('project_id' => $project['id'], 'duplicate' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/project/edit.php b/app/Template/project/edit.php index 8eb2110d..bb776a06 100644 --- a/app/Template/project/edit.php +++ b/app/Template/project/edit.php @@ -1,13 +1,13 @@ <div class="page-header"> <h2><?= t('Edit project') ?></h2> </div> -<form method="post" action="<?= Helper\u('project', 'update', array('project_id' => $values['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('project', 'update', array('project_id' => $values['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('id', $values) ?> + <?= $this->formCsrf() ?> + <?= $this->formHidden('id', $values) ?> - <?= Helper\form_label(t('Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('required')) ?> + <?= $this->formLabel(t('Name'), 'name') ?> + <?= $this->formText('name', $values, $errors, array('required')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/project/enable.php b/app/Template/project/enable.php index f2a1b0e7..b683ea7c 100644 --- a/app/Template/project/enable.php +++ b/app/Template/project/enable.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'project', 'enable', array('project_id' => $project['id'], 'enable' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= Helper\a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Yes'), 'project', 'enable', array('project_id' => $project['id'], 'enable' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/project/events.php b/app/Template/project/events.php index 1b606414..93bc6584 100644 --- a/app/Template/project/events.php +++ b/app/Template/project/events.php @@ -5,11 +5,11 @@ <?php foreach ($events as $event): ?> <div class="activity-event"> <p class="activity-datetime"> - <?php if (Helper\contains($event['event_name'], 'subtask')): ?> + <?php if ($this->contains($event['event_name'], 'subtask')): ?> <i class="fa fa-tasks"></i> - <?php elseif (Helper\contains($event['event_name'], 'task')): ?> + <?php elseif ($this->contains($event['event_name'], 'task')): ?> <i class="fa fa-newspaper-o"></i> - <?php elseif (Helper\contains($event['event_name'], 'comment')): ?> + <?php elseif ($this->contains($event['event_name'], 'comment')): ?> <i class="fa fa-comments-o"></i> <?php endif ?> <?= dt('%B %e, %Y at %k:%M %p', $event['date_creation']) ?> diff --git a/app/Template/project/export_daily_summary.php b/app/Template/project/export_daily_summary.php index 763cd81c..191d36b6 100644 --- a/app/Template/project/export_daily_summary.php +++ b/app/Template/project/export_daily_summary.php @@ -8,15 +8,15 @@ <form method="get" action="?" autocomplete="off"> - <?= Helper\form_hidden('controller', $values) ?> - <?= Helper\form_hidden('action', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('controller', $values) ?> + <?= $this->formHidden('action', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Start Date'), 'from') ?> - <?= Helper\form_text('from', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->formLabel(t('Start Date'), 'from') ?> + <?= $this->formText('from', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> - <?= Helper\form_label(t('End Date'), 'to') ?> - <?= Helper\form_text('to', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->formLabel(t('End Date'), 'to') ?> + <?= $this->formText('to', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> diff --git a/app/Template/project/export_tasks.php b/app/Template/project/export_tasks.php index 02eb389f..e502085c 100644 --- a/app/Template/project/export_tasks.php +++ b/app/Template/project/export_tasks.php @@ -6,15 +6,15 @@ <form method="get" action="?" autocomplete="off"> - <?= Helper\form_hidden('controller', $values) ?> - <?= Helper\form_hidden('action', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('controller', $values) ?> + <?= $this->formHidden('action', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Start Date'), 'from') ?> - <?= Helper\form_text('from', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->formLabel(t('Start Date'), 'from') ?> + <?= $this->formText('from', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> - <?= Helper\form_label(t('End Date'), 'to') ?> - <?= Helper\form_text('to', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->formLabel(t('End Date'), 'to') ?> + <?= $this->formText('to', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> diff --git a/app/Template/project/feed.php b/app/Template/project/feed.php index 9d10ecb1..14427af9 100644 --- a/app/Template/project/feed.php +++ b/app/Template/project/feed.php @@ -1,21 +1,21 @@ <?= '<?xml version="1.0" encoding="utf-8"?>' ?> <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"> <title><?= t('%s\'s activity', $project['name']) ?></title> - <link rel="alternate" type="text/html" href="<?= Helper\get_current_base_url() ?>"/> - <link rel="self" type="application/atom+xml" href="<?= Helper\get_current_base_url().Helper\u('project', 'feed', array('token' => $project['token'])) ?>"/> + <link rel="alternate" type="text/html" href="<?= $this->getCurrentBaseUrl() ?>"/> + <link rel="self" type="application/atom+xml" href="<?= $this->getCurrentBaseUrl().$this->u('project', 'feed', array('token' => $project['token'])) ?>"/> <updated><?= date(DATE_ATOM) ?></updated> - <id><?= Helper\get_current_base_url() ?></id> - <icon><?= Helper\get_current_base_url() ?>assets/img/favicon.png</icon> + <id><?= $this->getCurrentBaseUrl() ?></id> + <icon><?= $this->getCurrentBaseUrl() ?>assets/img/favicon.png</icon> <?php foreach ($events as $e): ?> <entry> <title type="text"><?= $e['event_title'] ?></title> - <link rel="alternate" href="<?= Helper\get_current_base_url().Helper\u('task', 'show', array('task_id' => $e['task_id'])) ?>"/> + <link rel="alternate" href="<?= $this->getCurrentBaseUrl().$this->u('task', 'show', array('task_id' => $e['task_id'])) ?>"/> <id><?= $e['id'].'-'.$e['event_name'].'-'.$e['task_id'].'-'.$e['date_creation'] ?></id> <published><?= date(DATE_ATOM, $e['date_creation']) ?></published> <updated><?= date(DATE_ATOM, $e['date_creation']) ?></updated> <author> - <name><?= Helper\escape($e['author']) ?></name> + <name><?= $this->e($e['author']) ?></name> </author> <content type="html"> <![CDATA[ diff --git a/app/Template/project/index.php b/app/Template/project/index.php index 6c04449e..4f07a83a 100644 --- a/app/Template/project/index.php +++ b/app/Template/project/index.php @@ -1,10 +1,10 @@ <section id="main"> <div class="page-header"> <ul> - <?php if (Helper\is_admin()): ?> - <li><i class="fa fa-plus fa-fw"></i><?= Helper\a(t('New project'), 'project', 'create') ?></li> + <?php if ($this->acl->isAdminUser()): ?> + <li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New project'), 'project', 'create') ?></li> <?php endif ?> - <li><i class="fa fa-lock fa-fw"></i><?= Helper\a(t('New private project'), 'project', 'create', array('private' => 1)) ?></li> + <li><i class="fa fa-lock fa-fw"></i><?= $this->a(t('New private project'), 'project', 'create', array('private' => 1)) ?></li> </ul> </div> <section> @@ -23,7 +23,7 @@ <?php if ($project['is_private']): ?> <i class="fa fa-lock fa-fw"></i> <?php endif ?> - <?= Helper\a(Helper\escape($project['name']), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a($this->e($project['name']), 'project', 'show', array('project_id' => $project['id'])) ?> </li> <?php endforeach ?> </ul> @@ -37,7 +37,7 @@ <?php if ($project['is_private']): ?> <i class="fa fa-lock"></i> <?php endif ?> - <?= Helper\a(Helper\escape($project['name']), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a($this->e($project['name']), 'project', 'show', array('project_id' => $project['id'])) ?> </li> <?php endforeach ?> </ul> diff --git a/app/Template/project/layout.php b/app/Template/project/layout.php index 19fe32b9..0db9f3e8 100644 --- a/app/Template/project/layout.php +++ b/app/Template/project/layout.php @@ -1,13 +1,13 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= Helper\a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> - <li><i class="fa fa-folder fa-fw"></i><?= Helper\a(t('All projects'), 'project', 'index') ?></li> + <li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-folder fa-fw"></i><?= $this->a(t('All projects'), 'project', 'index') ?></li> </ul> </div> <section class="sidebar-container" id="project-section"> - <?= Helper\template('project/sidebar', array('project' => $project, 'is_owner' => $is_owner)) ?> + <?= $this->render('project/sidebar', array('project' => $project, 'is_owner' => $is_owner)) ?> <div class="sidebar-content"> <?= $project_content_for_layout ?> diff --git a/app/Template/project/new.php b/app/Template/project/new.php index f3926a65..91db75e1 100644 --- a/app/Template/project/new.php +++ b/app/Template/project/new.php @@ -1,20 +1,20 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-folder fa-fw"></i><?= Helper\a(t('All projects'), 'project', 'index') ?></li> + <li><i class="fa fa-folder fa-fw"></i><?= $this->a(t('All projects'), 'project', 'index') ?></li> </ul> </div> <section> - <form method="post" action="<?= Helper\u('project', 'save') ?>" autocomplete="off"> + <form method="post" action="<?= $this->u('project', 'save') ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('is_private', $values) ?> - <?= Helper\form_label(t('Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('autofocus', 'required')) ?> + <?= $this->formCsrf() ?> + <?= $this->formHidden('is_private', $values) ?> + <?= $this->formLabel(t('Name'), 'name') ?> + <?= $this->formText('name', $values, $errors, array('autofocus', 'required')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - <?= t('or') ?> <?= Helper\a(t('cancel'), 'project', 'index') ?> + <?= t('or') ?> <?= $this->a(t('cancel'), 'project', 'index') ?> </div> </form> </section> diff --git a/app/Template/project/remove.php b/app/Template/project/remove.php index a98f94eb..0f6fec78 100644 --- a/app/Template/project/remove.php +++ b/app/Template/project/remove.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'project', 'remove', array('project_id' => $project['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= Helper\a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Yes'), 'project', 'remove', array('project_id' => $project['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/project/search.php b/app/Template/project/search.php index 3bad43e3..c8a3e410 100644 --- a/app/Template/project/search.php +++ b/app/Template/project/search.php @@ -1,24 +1,24 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= Helper\a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> - <li><i class="fa fa-check-square-o fa-fw"></i><?= Helper\a(t('Completed tasks'), 'project', 'tasks', array('project_id' => $project['id'])) ?></li> - <li><i class="fa fa-dashboard fa-fw"></i><?= Helper\a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-check-square-o fa-fw"></i><?= $this->a(t('Completed tasks'), 'project', 'tasks', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-dashboard fa-fw"></i><?= $this->a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?></li> </ul> </div> <section> <form method="get" action="?" autocomplete="off"> - <?= Helper\form_hidden('controller', $values) ?> - <?= Helper\form_hidden('action', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_text('search', $values, array(), array('autofocus', 'required', 'placeholder="'.t('Search').'"'), 'form-input-large') ?> + <?= $this->formHidden('controller', $values) ?> + <?= $this->formHidden('action', $values) ?> + <?= $this->formHidden('project_id', $values) ?> + <?= $this->formText('search', $values, array(), array('autofocus', 'required', 'placeholder="'.t('Search').'"'), 'form-input-large') ?> <input type="submit" value="<?= t('Search') ?>" class="btn btn-blue"/> </form> <?php if (empty($tasks) && ! empty($values['search'])): ?> <p class="alert"><?= t('Nothing found.') ?></p> <?php elseif (! empty($tasks)): ?> - <?= Helper\template('task/table', array( + <?= $this->render('task/table', array( 'tasks' => $tasks, 'categories' => $categories, 'columns' => $columns, diff --git a/app/Template/project/share.php b/app/Template/project/share.php index 10155492..7c490008 100644 --- a/app/Template/project/share.php +++ b/app/Template/project/share.php @@ -6,14 +6,14 @@ <div class="listing"> <ul class="no-bullet"> - <li><strong><i class="fa fa-share-alt"></i> <?= Helper\a(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></strong></li> - <li><strong><i class="fa fa-rss-square"></i> <?= Helper\a(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-share-alt"></i> <?= $this->a(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-rss-square"></i> <?= $this->a(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></strong></li> </ul> - <input type="text" class="auto-select" readonly="readonly" value="<?= Helper\get_current_base_url().Helper\u('board', 'readonly', array('token' => $project['token'])) ?>"/> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('board', 'readonly', array('token' => $project['token'])) ?>"/> </div> - <?= Helper\a(t('Disable public access'), 'project', 'share', array('project_id' => $project['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> + <?= $this->a(t('Disable public access'), 'project', 'share', array('project_id' => $project['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> <?php else: ?> - <?= Helper\a(t('Enable public access'), 'project', 'share', array('project_id' => $project['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?> + <?= $this->a(t('Enable public access'), 'project', 'share', array('project_id' => $project['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?> <?php endif ?> diff --git a/app/Template/project/show.php b/app/Template/project/show.php index bdb46ee3..22d710e6 100644 --- a/app/Template/project/show.php +++ b/app/Template/project/show.php @@ -9,8 +9,8 @@ <?php endif ?> <?php if ($project['is_public']): ?> - <li><i class="fa fa-share-alt"></i> <?= Helper\a(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li> - <li><i class="fa fa-rss-square"></i> <?= Helper\a(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-share-alt"></i> <?= $this->a(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-rss-square"></i> <?= $this->a(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></li> <?php else: ?> <li><?= t('Public access disabled') ?></li> <?php endif ?> @@ -22,11 +22,11 @@ <?php if ($stats['nb_tasks'] > 0): ?> <?php if ($stats['nb_active_tasks'] > 0): ?> - <li><?= Helper\a(t('%d tasks on the board', $stats['nb_active_tasks']), 'board', 'show', array('project_id' => $project['id'])) ?></li> + <li><?= $this->a(t('%d tasks on the board', $stats['nb_active_tasks']), 'board', 'show', array('project_id' => $project['id'])) ?></li> <?php endif ?> <?php if ($stats['nb_inactive_tasks'] > 0): ?> - <li><?= Helper\a(t('%d closed tasks', $stats['nb_inactive_tasks']), 'project', 'tasks', array('project_id' => $project['id'])) ?></li> + <li><?= $this->a(t('%d closed tasks', $stats['nb_inactive_tasks']), 'project', 'tasks', array('project_id' => $project['id'])) ?></li> <?php endif ?> <li><?= t('%d tasks in total', $stats['nb_tasks']) ?></li> @@ -47,20 +47,20 @@ </tr> <?php foreach ($stats['columns'] as $column): ?> <tr> - <td><?= Helper\escape($column['title']) ?></td> + <td><?= $this->e($column['title']) ?></td> <td><?= $column['task_limit'] ?: '∞' ?></td> <td><?= $column['nb_active_tasks'] ?></td> </tr> <?php endforeach ?> </table> -<?php if (Helper\is_admin()): ?> +<?php if ($this->acl->isAdminUser()): ?> <div class="page-header"> <h2><?= t('Integration') ?></h2> </div> <h3><i class="fa fa-github fa-fw"></i><?= t('Github webhook') ?></h3> -<input type="text" class="auto-select" readonly="readonly" value="<?= Helper\get_current_base_url().Helper\u('webhook', 'github', array('token' => $webhook_token, 'project_id' => $project['id'])) ?>"/><br/> +<input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'github', array('token' => $webhook_token, 'project_id' => $project['id'])) ?>"/><br/> <p class="form-help"><a href="http://kanboard.net/documentation/github-webhooks" target="_blank"><?= t('Help on Github webhook') ?></a></p> <?php endif ?> diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php index 5107451a..35019fdb 100644 --- a/app/Template/project/sidebar.php +++ b/app/Template/project/sidebar.php @@ -2,61 +2,61 @@ <h2><?= t('Actions') ?></h2> <ul> <li> - <?= Helper\a(t('Summary'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Summary'), 'project', 'show', array('project_id' => $project['id'])) ?> </li> - <?php if (Helper\is_admin() || $project['is_private']): ?> + <?php if ($this->acl->isAdminUser() || $project['is_private']): ?> <li> - <?= Helper\a(t('Public access'), 'project', 'share', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Public access'), 'project', 'share', array('project_id' => $project['id'])) ?> </li> <li> - <?= Helper\a(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?> </li> <?php endif ?> - <?php if (Helper\is_admin() || $is_owner || $project['is_private']): ?> + <?php if ($this->acl->isAdminUser() || $is_owner || $project['is_private']): ?> <li> - <?= Helper\a(t('Edit board'), 'board', 'edit', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Edit board'), 'board', 'edit', array('project_id' => $project['id'])) ?> </li> <li> - <?= Helper\a(t('Category management'), 'category', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Category management'), 'category', 'index', array('project_id' => $project['id'])) ?> </li> <li> - <?= Helper\a(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> </li> <?php if ($project['is_private'] == 0): ?> <li> - <?= Helper\a(t('User management'), 'project', 'users', array('project_id' => $project['id'])) ?> + <?= $this->a(t('User management'), 'project', 'users', array('project_id' => $project['id'])) ?> </li> <?php endif ?> <li> - <?= Helper\a(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?> </li> <?php endif ?> - <?php if (Helper\is_admin() || $project['is_private']): ?> + <?php if ($this->acl->isAdminUser() || $project['is_private']): ?> <li> - <?= Helper\a(t('Duplicate'), 'project', 'duplicate', array('project_id' => $project['id']), true) ?> + <?= $this->a(t('Duplicate'), 'project', 'duplicate', array('project_id' => $project['id']), true) ?> </li> <li> <?php if ($project['is_active']): ?> - <?= Helper\a(t('Disable'), 'project', 'disable', array('project_id' => $project['id']), true) ?> + <?= $this->a(t('Disable'), 'project', 'disable', array('project_id' => $project['id']), true) ?> <?php else: ?> - <?= Helper\a(t('Enable'), 'project', 'enable', array('project_id' => $project['id']), true) ?> + <?= $this->a(t('Enable'), 'project', 'enable', array('project_id' => $project['id']), true) ?> <?php endif ?> </li> <li> - <?= Helper\a(t('Remove'), 'project', 'remove', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Remove'), 'project', 'remove', array('project_id' => $project['id'])) ?> </li> <?php endif ?> </ul> - <?php if (Helper\is_admin() || $project['is_private']): ?> + <?php if ($this->acl->isAdminUser() || $project['is_private']): ?> <h2><?= t('Exports') ?></h2> <ul> <li> - <?= Helper\a(t('Tasks'), 'project', 'exportTasks', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Tasks'), 'project', 'exportTasks', array('project_id' => $project['id'])) ?> </li> <li> - <?= Helper\a(t('Daily project summary'), 'project', 'exportDailyProjectSummary', array('project_id' => $project['id'])) ?> + <?= $this->a(t('Daily project summary'), 'project', 'exportDailyProjectSummary', array('project_id' => $project['id'])) ?> </li> </ul> <?php endif ?> diff --git a/app/Template/project/tasks.php b/app/Template/project/tasks.php index 6fe20c38..6ca24acf 100644 --- a/app/Template/project/tasks.php +++ b/app/Template/project/tasks.php @@ -1,16 +1,16 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= Helper\a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> - <li><i class="fa fa-search fa-fw"></i><?= Helper\a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?></li> - <li><i class="fa fa-dashboard fa-fw"></i><?= Helper\a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-search fa-fw"></i><?= $this->a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?></li> + <li><i class="fa fa-dashboard fa-fw"></i><?= $this->a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?></li> </ul> </div> <section> <?php if (empty($tasks)): ?> <p class="alert"><?= t('No task') ?></p> <?php else: ?> - <?= Helper\template('task/table', array( + <?= $this->render('task/table', array( 'tasks' => $tasks, 'categories' => $categories, 'columns' => $columns, diff --git a/app/Template/project/users.php b/app/Template/project/users.php index 691fe9fd..ac27237c 100644 --- a/app/Template/project/users.php +++ b/app/Template/project/users.php @@ -14,17 +14,17 @@ <ul> <?php foreach ($users['allowed'] as $user_id => $username): ?> <li> - <strong><?= Helper\escape($username) ?></strong> + <strong><?= $this->e($username) ?></strong> <?php $is_owner = array_key_exists($user_id, $users['owners']); if ($is_owner): ?> [owner] <?php endif ?> <?php if ($project['is_private'] == 0): ?> <?php if ($is_owner): ?> - (<a href=<?= Helper\u('project', 'setOwner', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 0), true) ?> ><?= t('set user') ?></a> + (<a href=<?= $this->u('project', 'setOwner', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 0), true) ?> ><?= t('set user') ?></a> <?php else: ?> - (<a href=<?= Helper\u('project', 'setOwner', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 1), true) ?> ><?= t('set manager') ?></a> + (<a href=<?= $this->u('project', 'setOwner', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 1), true) ?> ><?= t('set manager') ?></a> <?php endif ?> or - <?= Helper\a(t('revoke'), 'project', 'revoke', array('project_id' => $project['id'], 'user_id' => $user_id), true) ?>) + <?= $this->a(t('revoke'), 'project', 'revoke', array('project_id' => $project['id'], 'user_id' => $user_id), true) ?>) <?php endif ?> </li> <?php endforeach ?> @@ -35,14 +35,14 @@ <?php if ($project['is_private'] == 0 && ! empty($users['not_allowed'])): ?> <hr/> - <form method="post" action="<?= Helper\u('project', 'allow', array('project_id' => $project['id'])) ?>" autocomplete="off"> + <form method="post" action="<?= $this->u('project', 'allow', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('project_id', array('project_id' => $project['id'])) ?> + <?= $this->formHidden('project_id', array('project_id' => $project['id'])) ?> - <?= Helper\form_label(t('User'), 'user_id') ?> - <?= Helper\form_select('user_id', $users['not_allowed']) ?><br/> + <?= $this->formLabel(t('User'), 'user_id') ?> + <?= $this->formSelect('user_id', $users['not_allowed']) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Allow this user') ?>" class="btn btn-blue"/> @@ -54,11 +54,11 @@ <?php if ($project['is_private'] == 0): ?> <hr/> -<form method="post" action="<?= Helper\u('project', 'allowEverybody', array('project_id' => $project['id'])) ?>"> - <?= Helper\form_csrf() ?> +<form method="post" action="<?= $this->u('project', 'allowEverybody', array('project_id' => $project['id'])) ?>"> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', array('id' => $project['id'])) ?> - <?= Helper\form_checkbox('is_everybody_allowed', t('Allow everybody to access to this project'), 1, $project['is_everybody_allowed']) ?> + <?= $this->formHidden('id', array('id' => $project['id'])) ?> + <?= $this->formCheckbox('is_everybody_allowed', t('Allow everybody to access to this project'), 1, $project['is_everybody_allowed']) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/subtask/create.php b/app/Template/subtask/create.php index 40a6da3d..ba550aea 100644 --- a/app/Template/subtask/create.php +++ b/app/Template/subtask/create.php @@ -2,26 +2,26 @@ <h2><?= t('Add a sub-task') ?></h2> </div> -<form method="post" action="<?= Helper\u('subtask', 'save', array('task_id' => $task['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('subtask', 'save', array('task_id' => $task['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('task_id', $values) ?> + <?= $this->formHidden('task_id', $values) ?> - <?= Helper\form_label(t('Title'), 'title') ?> - <?= Helper\form_text('title', $values, $errors, array('required autofocus')) ?><br/> + <?= $this->formLabel(t('Title'), 'title') ?> + <?= $this->formText('title', $values, $errors, array('required autofocus')) ?><br/> - <?= Helper\form_label(t('Assignee'), 'user_id') ?> - <?= Helper\form_select('user_id', $users_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Assignee'), 'user_id') ?> + <?= $this->formSelect('user_id', $users_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Original estimate'), 'time_estimated') ?> - <?= Helper\form_numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?> + <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> - <?= Helper\form_checkbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?> + <?= $this->formCheckbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </form> diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php index 88ea6175..76a04e45 100644 --- a/app/Template/subtask/edit.php +++ b/app/Template/subtask/edit.php @@ -2,31 +2,31 @@ <h2><?= t('Edit a sub-task') ?></h2> </div> -<form method="post" action="<?= Helper\u('subtask', 'update', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('subtask', 'update', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('task_id', $values) ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('task_id', $values) ?> - <?= Helper\form_label(t('Title'), 'title') ?> - <?= Helper\form_text('title', $values, $errors, array('required autofocus')) ?><br/> + <?= $this->formLabel(t('Title'), 'title') ?> + <?= $this->formText('title', $values, $errors, array('required autofocus')) ?><br/> - <?= Helper\form_label(t('Status'), 'status') ?> - <?= Helper\form_select('status', $status_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Status'), 'status') ?> + <?= $this->formSelect('status', $status_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Assignee'), 'user_id') ?> - <?= Helper\form_select('user_id', $users_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Assignee'), 'user_id') ?> + <?= $this->formSelect('user_id', $users_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Original estimate'), 'time_estimated') ?> - <?= Helper\form_numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?> + <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> - <?= Helper\form_label(t('Time spent'), 'time_spent') ?> - <?= Helper\form_numeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->formLabel(t('Time spent'), 'time_spent') ?> + <?= $this->formNumeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </form> diff --git a/app/Template/subtask/remove.php b/app/Template/subtask/remove.php index 74245a7a..3d57ec9d 100644 --- a/app/Template/subtask/remove.php +++ b/app/Template/subtask/remove.php @@ -7,11 +7,11 @@ <?= t('Do you really want to remove this sub-task?') ?> </p> - <p><strong><?= Helper\escape($subtask['title']) ?></strong></p> + <p><strong><?= $this->e($subtask['title']) ?></strong></p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php index 4d341f26..d0b3a606 100644 --- a/app/Template/subtask/show.php +++ b/app/Template/subtask/show.php @@ -17,34 +17,34 @@ </tr> <?php foreach ($subtasks as $subtask): ?> <tr> - <td><?= Helper\escape($subtask['title']) ?></td> + <td><?= $this->e($subtask['title']) ?></td> <td> <?php if (! isset($not_editable)): ?> - <?= Helper\a(trim(Helper\template('subtask/icons', array('subtask' => $subtask))) . Helper\escape($subtask['status_name']), + <?= $this->a(trim($this->render('subtask/icons', array('subtask' => $subtask))) . $this->e($subtask['status_name']), 'subtask', 'toggleStatus', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?> <?php else: ?> - <?= Helper\template('subtask/icons', array('subtask' => $subtask)) . Helper\escape($subtask['status_name']) ?> + <?= $this->render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['status_name']) ?> <?php endif ?> </td> <td> <?php if (! empty($subtask['username'])): ?> - <?= Helper\escape($subtask['name'] ?: $subtask['username']) ?> + <?= $this->e($subtask['name'] ?: $subtask['username']) ?> <?php endif ?> </td> <td> <?php if (! empty($subtask['time_spent'])): ?> - <strong><?= Helper\escape($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?> + <strong><?= $this->e($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?> <?php endif ?> <?php if (! empty($subtask['time_estimated'])): ?> - <strong><?= Helper\escape($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?> + <strong><?= $this->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?> <?php endif ?> </td> <?php if (! isset($not_editable)): ?> <td> - <?= Helper\a(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?> + <?= $this->a(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?> <?= t('or') ?> - <?= Helper\a(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?> + <?= $this->a(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?> </td> <?php endif ?> </tr> @@ -52,10 +52,10 @@ </table> <?php if (! isset($not_editable)): ?> - <form method="post" action="<?= Helper\u('subtask', 'save', array('task_id' => $task['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('task_id', array('task_id' => $task['id'])) ?> - <?= Helper\form_text('title', array(), array(), array('required', 'placeholder="'.t('Type here to create a new sub-task').'"')) ?> + <form method="post" action="<?= $this->u('subtask', 'save', array('task_id' => $task['id'])) ?>" autocomplete="off"> + <?= $this->formCsrf() ?> + <?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?> + <?= $this->formText('title', array(), array(), array('required', 'placeholder="'.t('Type here to create a new sub-task').'"')) ?> <input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/> </form> <?php endif ?> diff --git a/app/Template/swimlane/edit.php b/app/Template/swimlane/edit.php index fca555f7..ea842f31 100644 --- a/app/Template/swimlane/edit.php +++ b/app/Template/swimlane/edit.php @@ -2,15 +2,15 @@ <h2><?= t('Swimlane modification for the project "%s"', $project['name']) ?></h2> </div> -<form method="post" action="<?= Helper\u('swimlane', 'update', array('project_id' => $project['id'], 'swimlane_id' => $values['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('swimlane', 'update', array('project_id' => $project['id'], 'swimlane_id' => $values['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> + <?= $this->formLabel(t('Name'), 'name') ?> + <?= $this->formText('name', $values, $errors, array('autofocus required')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/swimlane/index.php b/app/Template/swimlane/index.php index ec822c15..2bcddf75 100644 --- a/app/Template/swimlane/index.php +++ b/app/Template/swimlane/index.php @@ -2,19 +2,19 @@ <div class="page-header"> <h2><?= t('Active swimlanes') ?></h2> </div> -<?= Helper\template('swimlane/table', array('swimlanes' => $active_swimlanes, 'project' => $project)) ?> +<?= $this->render('swimlane/table', array('swimlanes' => $active_swimlanes, 'project' => $project)) ?> <?php endif ?> <div class="page-header"> <h2><?= t('Add a new swimlane') ?></h2> </div> -<form method="post" action="<?= Helper\u('swimlane', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('swimlane', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formCsrf() ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> + <?= $this->formLabel(t('Name'), 'name') ?> + <?= $this->formText('name', $values, $errors, array('autofocus required')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> @@ -24,15 +24,15 @@ <div class="page-header"> <h2><?= t('Change default swimlane') ?></h2> </div> -<form method="post" action="<?= Helper\u('swimlane', 'change', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('swimlane', 'change', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('id', $default_swimlane) ?> + <?= $this->formCsrf() ?> + <?= $this->formHidden('id', $default_swimlane) ?> - <?= Helper\form_label(t('Rename'), 'default_swimlane') ?> - <?= Helper\form_text('default_swimlane', $default_swimlane, array(), array('autofocus required')) ?><br/> + <?= $this->formLabel(t('Rename'), 'default_swimlane') ?> + <?= $this->formText('default_swimlane', $default_swimlane, array(), array('autofocus required')) ?><br/> - <?= Helper\form_checkbox('show_default_swimlane', t('Show default swimlane'), 1, isset($default_swimlane['show_default_swimlane']) && $default_swimlane['show_default_swimlane'] == 1) ?> + <?= $this->formCheckbox('show_default_swimlane', t('Show default swimlane'), 1, isset($default_swimlane['show_default_swimlane']) && $default_swimlane['show_default_swimlane'] == 1) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> @@ -43,5 +43,5 @@ <div class="page-header"> <h2><?= t('Inactive swimlanes') ?></h2> </div> -<?= Helper\template('swimlane/table', array('swimlanes' => $inactive_swimlanes, 'project' => $project, 'hide_position' => true)) ?> +<?= $this->render('swimlane/table', array('swimlanes' => $inactive_swimlanes, 'project' => $project, 'hide_position' => true)) ?> <?php endif ?>
\ No newline at end of file diff --git a/app/Template/swimlane/remove.php b/app/Template/swimlane/remove.php index edf8803c..3268f51f 100644 --- a/app/Template/swimlane/remove.php +++ b/app/Template/swimlane/remove.php @@ -9,9 +9,9 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'swimlane', 'remove', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'swimlane', 'remove', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> + <?= $this->a(t('cancel'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> </div> </div> </section>
\ No newline at end of file diff --git a/app/Template/swimlane/table.php b/app/Template/swimlane/table.php index ac7ed835..32870ecc 100644 --- a/app/Template/swimlane/table.php +++ b/app/Template/swimlane/table.php @@ -11,31 +11,31 @@ <?php if (! isset($hide_position)): ?> <td>#<?= $swimlane['position'] ?></td> <?php endif ?> - <td><?= Helper\escape($swimlane['name']) ?></td> + <td><?= $this->e($swimlane['name']) ?></td> <td> <ul> <?php if ($swimlane['position'] != 0 && $swimlane['position'] != 1): ?> <li> - <?= Helper\a(t('Move Up'), 'swimlane', 'moveup', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->a(t('Move Up'), 'swimlane', 'moveup', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> </li> <?php endif ?> <?php if ($swimlane['position'] != 0 && $swimlane['position'] != count($swimlanes)): ?> <li> - <?= Helper\a(t('Move Down'), 'swimlane', 'movedown', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->a(t('Move Down'), 'swimlane', 'movedown', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> </li> <?php endif ?> <li> - <?= Helper\a(t('Rename'), 'swimlane', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?> + <?= $this->a(t('Rename'), 'swimlane', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?> </li> <li> <?php if ($swimlane['is_active']): ?> - <?= Helper\a(t('Disable'), 'swimlane', 'disable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->a(t('Disable'), 'swimlane', 'disable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php else: ?> - <?= Helper\a(t('Enable'), 'swimlane', 'enable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->a(t('Enable'), 'swimlane', 'enable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php endif ?> </li> <li> - <?= Helper\a(t('Remove'), 'swimlane', 'confirm', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?> + <?= $this->a(t('Remove'), 'swimlane', 'confirm', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?> </li> </ul> </td> diff --git a/app/Template/task/close.php b/app/Template/task/close.php index 062d0a88..76852862 100644 --- a/app/Template/task/close.php +++ b/app/Template/task/close.php @@ -4,12 +4,12 @@ <div class="confirm"> <p class="alert alert-info"> - <?= t('Do you really want to close this task: "%s"?', Helper\escape($task['title'])) ?> + <?= t('Do you really want to close this task: "%s"?', $this->e($task['title'])) ?> </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'task', 'close', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'task', 'close', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/task/comments.php b/app/Template/task/comments.php index 343e66c5..6f380567 100644 --- a/app/Template/task/comments.php +++ b/app/Template/task/comments.php @@ -5,7 +5,7 @@ </div> <?php foreach ($comments as $comment): ?> - <?= Helper\template('comment/show', array( + <?= $this->render('comment/show', array( 'comment' => $comment, 'task' => $task, 'project' => $project, @@ -15,10 +15,10 @@ <?php endforeach ?> <?php if (! isset($not_editable)): ?> - <?= Helper\template('comment/create', array( + <?= $this->render('comment/create', array( 'skip_cancel' => true, 'values' => array( - 'user_id' => Helper\get_user_id(), + 'user_id' => $this->acl->getUserId(), 'task_id' => $task['id'], ), 'errors' => array(), diff --git a/app/Template/task/details.php b/app/Template/task/details.php index b5111f78..50145da4 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -1,7 +1,7 @@ <div class="task-<?= $task['color_id'] ?> task-show-details"> - <h2><?= Helper\escape('#'.$task['id'].' '.$task['title']) ?></h2> + <h2><?= $this->e('#'.$task['id'].' '.$task['title']) ?></h2> <?php if ($task['score']): ?> - <span class="task-score"><?= Helper\escape($task['score']) ?></span> + <span class="task-score"><?= $this->e($task['score']) ?></span> <?php endif ?> <ul> <?php if ($task['reference']): ?> @@ -58,13 +58,13 @@ </li> <li> <?= t('Column on the board:') ?> - <strong><?= Helper\escape($task['column_title']) ?></strong> - (<?= Helper\escape($task['project_name']) ?>) + <strong><?= $this->e($task['column_title']) ?></strong> + (<?= $this->e($task['project_name']) ?>) </li> - <li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li> + <li><?= t('Task position:').' '.$this->e($task['position']) ?></li> <?php if ($task['category_name']): ?> <li> - <?= t('Category:') ?> <strong><?= Helper\escape($task['category_name']) ?></strong> + <?= t('Category:') ?> <strong><?= $this->e($task['category_name']) ?></strong> </li> <?php endif ?> <li> @@ -76,7 +76,7 @@ </li> <?php if ($project['is_public']): ?> <li> - <?= Helper\a(t('Public link'), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> + <?= $this->a(t('Public link'), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> </li> <?php endif ?> </ul> diff --git a/app/Template/task/duplicate.php b/app/Template/task/duplicate.php index 3d1829ed..c1aed6be 100644 --- a/app/Template/task/duplicate.php +++ b/app/Template/task/duplicate.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'task', 'duplicate', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'task', 'duplicate', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/task/duplicate_project.php b/app/Template/task/duplicate_project.php index 45081842..d69da9d5 100644 --- a/app/Template/task/duplicate_project.php +++ b/app/Template/task/duplicate_project.php @@ -6,18 +6,18 @@ <p class="alert"><?= t('No project') ?></p> <?php else: ?> - <form method="post" action="<?= Helper\u('task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <form method="post" action="<?= $this->u('task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_label(t('Project'), 'project_id') ?> - <?= Helper\form_select('project_id', $projects_list, $values, $errors) ?><br/> + <?= $this->formHidden('id', $values) ?> + <?= $this->formLabel(t('Project'), 'project_id') ?> + <?= $this->formSelect('project_id', $projects_list, $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </form> diff --git a/app/Template/task/edit.php b/app/Template/task/edit.php index 6f136cb9..ef1a9dfa 100644 --- a/app/Template/task/edit.php +++ b/app/Template/task/edit.php @@ -2,16 +2,16 @@ <h2><?= t('Edit a task') ?></h2> </div> <section id="task-section"> -<form method="post" action="<?= Helper\u('task', 'update', array('task_id' => $task['id'], 'ajax' => $ajax)) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('task', 'update', array('task_id' => $task['id'], 'ajax' => $ajax)) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> <div class="form-column"> - <?= Helper\form_label(t('Title'), 'title') ?> - <?= Helper\form_text('title', $values, $errors, array('required')) ?><br/> + <?= $this->formLabel(t('Title'), 'title') ?> + <?= $this->formText('title', $values, $errors, array('required')) ?><br/> - <?= Helper\form_label(t('Description'), 'description') ?> + <?= $this->formLabel(t('Description'), 'description') ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -23,7 +23,7 @@ </li> </ul> <div class="write-area"> - <?= Helper\form_textarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?> + <?= $this->formTextarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?> </div> <div class="preview-area"> <div class="markdown"></div> @@ -35,23 +35,23 @@ </div> <div class="form-column"> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('project_id', $values) ?> - <?= Helper\form_label(t('Assignee'), 'owner_id') ?> - <?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Assignee'), 'owner_id') ?> + <?= $this->formSelect('owner_id', $users_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Category'), 'category_id') ?> - <?= Helper\form_select('category_id', $categories_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Category'), 'category_id') ?> + <?= $this->formSelect('category_id', $categories_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Color'), 'color_id') ?> - <?= Helper\form_select('color_id', $colors_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Color'), 'color_id') ?> + <?= $this->formSelect('color_id', $colors_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Complexity'), 'score') ?> - <?= Helper\form_number('score', $values, $errors) ?><br/> + <?= $this->formLabel(t('Complexity'), 'score') ?> + <?= $this->formNumber('score', $values, $errors) ?><br/> - <?= Helper\form_label(t('Due Date'), 'date_due') ?> - <?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->formLabel(t('Due Date'), 'date_due') ?> + <?= $this->formText('date_due', $values, $errors, array('placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> </div> @@ -59,9 +59,9 @@ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <?php if ($ajax): ?> - <?= Helper\a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> <?php else: ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> <?php endif ?> </div> </form> diff --git a/app/Template/task/edit_description.php b/app/Template/task/edit_description.php index 9ec94d69..d53aff93 100644 --- a/app/Template/task/edit_description.php +++ b/app/Template/task/edit_description.php @@ -2,10 +2,10 @@ <h2><?= t('Edit the description') ?></h2> </div> -<form method="post" action="<?= Helper\u('task', 'description', array('task_id' => $task['id'], 'ajax' => $ajax)) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('task', 'description', array('task_id' => $task['id'], 'ajax' => $ajax)) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('id', $values) ?> + <?= $this->formCsrf() ?> + <?= $this->formHidden('id', $values) ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -17,7 +17,7 @@ </li> </ul> <div class="write-area"> - <?= Helper\form_textarea('description', $values, $errors, array('autofocus', 'placeholder="'.t('Leave a description').'"'), 'description-textarea') ?> + <?= $this->formTextarea('description', $values, $errors, array('autofocus', 'placeholder="'.t('Leave a description').'"'), 'description-textarea') ?> </div> <div class="preview-area"> <div class="markdown"></div> @@ -30,9 +30,9 @@ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <?php if ($ajax): ?> - <?= Helper\a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> <?php else: ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> <?php endif ?> </div> </form> diff --git a/app/Template/task/layout.php b/app/Template/task/layout.php index a73ce28f..776fdc78 100644 --- a/app/Template/task/layout.php +++ b/app/Template/task/layout.php @@ -1,12 +1,12 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= Helper\a(t('Back to the board'), 'board', 'show', array('project_id' => $task['project_id'])) ?></li> + <li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $task['project_id'])) ?></li> </ul> </div> <section class="sidebar-container" id="task-section"> - <?= Helper\template('task/sidebar', array('task' => $task, 'hide_remove_menu' => isset($hide_remove_menu))) ?> + <?= $this->render('task/sidebar', array('task' => $task, 'hide_remove_menu' => isset($hide_remove_menu))) ?> <div class="sidebar-content"> <?= $task_content_for_layout ?> diff --git a/app/Template/task/move_project.php b/app/Template/task/move_project.php index 1a355b02..15b295d7 100644 --- a/app/Template/task/move_project.php +++ b/app/Template/task/move_project.php @@ -6,18 +6,18 @@ <p class="alert"><?= t('No project') ?></p> <?php else: ?> - <form method="post" action="<?= Helper\u('task', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <form method="post" action="<?= $this->u('task', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_label(t('Project'), 'project_id') ?> - <?= Helper\form_select('project_id', $projects_list, $values, $errors) ?><br/> + <?= $this->formHidden('id', $values) ?> + <?= $this->formLabel(t('Project'), 'project_id') ?> + <?= $this->formSelect('project_id', $projects_list, $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </form> diff --git a/app/Template/task/new.php b/app/Template/task/new.php index 3e2576c5..6294968a 100644 --- a/app/Template/task/new.php +++ b/app/Template/task/new.php @@ -1,7 +1,7 @@ <?php if (! $ajax): ?> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= Helper\a(t('Back to the board'), 'board', 'show', array('project_id' => $values['project_id'])) ?></li> + <li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $values['project_id'])) ?></li> </ul> </div> <?php else: ?> @@ -11,15 +11,15 @@ <?php endif ?> <section id="task-section"> -<form method="post" action="<?= Helper\u('task', 'save', array('project_id' => $values['project_id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('task', 'save', array('project_id' => $values['project_id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> <div class="form-column"> - <?= Helper\form_label(t('Title'), 'title') ?> - <?= Helper\form_text('title', $values, $errors, array('autofocus', 'required'), 'form-input-large') ?><br/> + <?= $this->formLabel(t('Title'), 'title') ?> + <?= $this->formText('title', $values, $errors, array('autofocus', 'required'), 'form-input-large') ?><br/> - <?= Helper\form_label(t('Description'), 'description') ?> + <?= $this->formLabel(t('Description'), 'description') ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -31,7 +31,7 @@ </li> </ul> <div class="write-area"> - <?= Helper\form_textarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?> + <?= $this->formTextarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?> </div> <div class="preview-area"> <div class="markdown"></div> @@ -41,40 +41,40 @@ <div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div> <?php if (! isset($duplicate)): ?> - <?= Helper\form_checkbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1) ?> + <?= $this->formCheckbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1) ?> <?php endif ?> </div> <div class="form-column"> - <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_hidden('swimlane_id', $values) ?> + <?= $this->formHidden('project_id', $values) ?> + <?= $this->formHidden('swimlane_id', $values) ?> - <?= Helper\form_label(t('Assignee'), 'owner_id') ?> - <?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Assignee'), 'owner_id') ?> + <?= $this->formSelect('owner_id', $users_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Category'), 'category_id') ?> - <?= Helper\form_select('category_id', $categories_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Category'), 'category_id') ?> + <?= $this->formSelect('category_id', $categories_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Column'), 'column_id') ?> - <?= Helper\form_select('column_id', $columns_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Column'), 'column_id') ?> + <?= $this->formSelect('column_id', $columns_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Color'), 'color_id') ?> - <?= Helper\form_select('color_id', $colors_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Color'), 'color_id') ?> + <?= $this->formSelect('color_id', $colors_list, $values, $errors) ?><br/> - <?= Helper\form_label(t('Complexity'), 'score') ?> - <?= Helper\form_number('score', $values, $errors) ?><br/> + <?= $this->formLabel(t('Complexity'), 'score') ?> + <?= $this->formNumber('score', $values, $errors) ?><br/> - <?= Helper\form_label(t('Original estimate'), 'time_estimated') ?> - <?= Helper\form_numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?> + <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> - <?= Helper\form_label(t('Due Date'), 'date_due') ?> - <?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->formLabel(t('Due Date'), 'date_due') ?> + <?= $this->formText('date_due', $values, $errors, array('placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> </div> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - <?= t('or') ?> <?= Helper\a(t('cancel'), 'board', 'show', array('project_id' => $values['project_id'])) ?> + <?= t('or') ?> <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $values['project_id'])) ?> </div> </form> </section> diff --git a/app/Template/task/open.php b/app/Template/task/open.php index 5dec3b0e..438acb34 100644 --- a/app/Template/task/open.php +++ b/app/Template/task/open.php @@ -4,12 +4,12 @@ <div class="confirm"> <p class="alert alert-info"> - <?= t('Do you really want to open this task: "%s"?', Helper\escape($task['title'])) ?> + <?= t('Do you really want to open this task: "%s"?', $this->e($task['title'])) ?> </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'task', 'open', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'task', 'open', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/task/public.php b/app/Template/task/public.php index 371c063a..2d95e6db 100644 --- a/app/Template/task/public.php +++ b/app/Template/task/public.php @@ -1,22 +1,22 @@ <section id="main" class="public-task"> - <?= Helper\template('task/details', array('task' => $task, 'project' => $project)) ?> + <?= $this->render('task/details', array('task' => $task, 'project' => $project)) ?> - <p class="pull-right"><?= Helper\a(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?></p> + <p class="pull-right"><?= $this->a(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?></p> - <?= Helper\template('task/show_description', array( + <?= $this->render('task/show_description', array( 'task' => $task, 'project' => $project, 'is_public' => true )) ?> - <?= Helper\template('subtask/show', array( + <?= $this->render('subtask/show', array( 'task' => $task, 'subtasks' => $subtasks, 'not_editable' => true )) ?> - <?= Helper\template('task/comments', array( + <?= $this->render('task/comments', array( 'task' => $task, 'comments' => $comments, 'project' => $project, diff --git a/app/Template/task/remove.php b/app/Template/task/remove.php index 5d6095bc..59845c6a 100644 --- a/app/Template/task/remove.php +++ b/app/Template/task/remove.php @@ -4,12 +4,12 @@ <div class="confirm"> <p class="alert alert-info"> - <?= t('Do you really want to remove this task: "%s"?', Helper\escape($task['title'])) ?> + <?= t('Do you really want to remove this task: "%s"?', $this->e($task['title'])) ?> </p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'task', 'remove', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'task', 'remove', array('task_id' => $task['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/task/show.php b/app/Template/task/show.php index 2652291a..b98af52d 100644 --- a/app/Template/task/show.php +++ b/app/Template/task/show.php @@ -1,7 +1,7 @@ -<?= Helper\template('task/details', array('task' => $task, 'project' => $project)) ?> -<?= Helper\template('task/time', array('values' => $values, 'date_format' => $date_format, 'date_formats' => $date_formats)) ?> -<?= Helper\template('task/show_description', array('task' => $task)) ?> -<?= Helper\template('subtask/show', array('task' => $task, 'subtasks' => $subtasks)) ?> -<?= Helper\template('task/timesheet', array('timesheet' => $timesheet)) ?> -<?= Helper\template('file/show', array('task' => $task, 'files' => $files)) ?> -<?= Helper\template('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?>
\ No newline at end of file +<?= $this->render('task/details', array('task' => $task, 'project' => $project)) ?> +<?= $this->render('task/time', array('values' => $values, 'date_format' => $date_format, 'date_formats' => $date_formats)) ?> +<?= $this->render('task/show_description', array('task' => $task)) ?> +<?= $this->render('subtask/show', array('task' => $task, 'subtasks' => $subtasks)) ?> +<?= $this->render('task/timesheet', array('timesheet' => $timesheet)) ?> +<?= $this->render('file/show', array('task' => $task, 'files' => $files)) ?> +<?= $this->render('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?>
\ No newline at end of file diff --git a/app/Template/task/show_description.php b/app/Template/task/show_description.php index 25312149..9cd278e3 100644 --- a/app/Template/task/show_description.php +++ b/app/Template/task/show_description.php @@ -6,9 +6,9 @@ <article class="markdown task-show-description"> <?php if (! isset($is_public)): ?> - <?= Helper\markdown($task['description']) ?> + <?= $this->markdown($task['description']) ?> <?php else: ?> - <?= Helper\markdown( + <?= $this->markdown( $task['description'], array( 'controller' => 'task', diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index 25bddeab..1779255a 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -2,42 +2,42 @@ <h2><?= t('Actions') ?></h2> <ul> <li> - <?= Helper\a(t('Summary'), 'task', 'show', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Summary'), 'task', 'show', array('task_id' => $task['id'])) ?> </li> <li> - <?= Helper\a(t('Edit the task'), 'task', 'edit', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Edit the task'), 'task', 'edit', array('task_id' => $task['id'])) ?> </li> <li> - <?= Helper\a(t('Edit the description'), 'task', 'description', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Edit the description'), 'task', 'description', array('task_id' => $task['id'])) ?> </li> <li> - <?= Helper\a(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'])) ?> </li> <li> - <?= Helper\a(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'])) ?> </li> <li> - <?= Helper\a(t('Attach a document'), 'file', 'create', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Attach a document'), 'file', 'create', array('task_id' => $task['id'])) ?> </li> <li> - <?= Helper\a(t('Duplicate'), 'task', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->a(t('Duplicate'), 'task', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= Helper\a(t('Duplicate to another project'), 'task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->a(t('Duplicate to another project'), 'task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= Helper\a(t('Move to another project'), 'task', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->a(t('Move to another project'), 'task', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> <?php if ($task['is_active'] == 1): ?> - <?= Helper\a(t('Close this task'), 'task', 'close', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Close this task'), 'task', 'close', array('task_id' => $task['id'])) ?> <?php else: ?> - <?= Helper\a(t('Open this task'), 'task', 'open', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Open this task'), 'task', 'open', array('task_id' => $task['id'])) ?> <?php endif ?> </li> <?php if (! $hide_remove_menu): ?> <li> - <?= Helper\a(t('Remove'), 'task', 'remove', array('task_id' => $task['id'])) ?> + <?= $this->a(t('Remove'), 'task', 'remove', array('task_id' => $task['id'])) ?> </li> <?php endif ?> </ul> diff --git a/app/Template/task/table.php b/app/Template/task/table.php index 9f11ea85..dfde4561 100644 --- a/app/Template/task/table.php +++ b/app/Template/task/table.php @@ -1,32 +1,32 @@ <table class="table-fixed table-small"> <tr> - <th class="column-8"><?= Helper\order(t('Id'), 'tasks.id', $pagination) ?></th> - <th class="column-8"><?= Helper\order(t('Column'), 'tasks.column_id', $pagination) ?></th> - <th class="column-8"><?= Helper\order(t('Category'), 'tasks.category_id', $pagination) ?></th> - <th><?= Helper\order(t('Title'), 'tasks.title', $pagination) ?></th> - <th class="column-10"><?= Helper\order(t('Assignee'), 'users.username', $pagination) ?></th> - <th class="column-10"><?= Helper\order(t('Due date'), 'tasks.date_due', $pagination) ?></th> - <th class="column-10"><?= Helper\order(t('Date created'), 'tasks.date_creation', $pagination) ?></th> - <th class="column-10"><?= Helper\order(t('Date completed'), 'tasks.date_completed', $pagination) ?></th> - <th class="column-5"><?= Helper\order(t('Status'), 'tasks.is_active', $pagination) ?></th> + <th class="column-8"><?= $this->order(t('Id'), 'tasks.id', $pagination) ?></th> + <th class="column-8"><?= $this->order(t('Column'), 'tasks.column_id', $pagination) ?></th> + <th class="column-8"><?= $this->order(t('Category'), 'tasks.category_id', $pagination) ?></th> + <th><?= $this->order(t('Title'), 'tasks.title', $pagination) ?></th> + <th class="column-10"><?= $this->order(t('Assignee'), 'users.username', $pagination) ?></th> + <th class="column-10"><?= $this->order(t('Due date'), 'tasks.date_due', $pagination) ?></th> + <th class="column-10"><?= $this->order(t('Date created'), 'tasks.date_creation', $pagination) ?></th> + <th class="column-10"><?= $this->order(t('Date completed'), 'tasks.date_completed', $pagination) ?></th> + <th class="column-5"><?= $this->order(t('Status'), 'tasks.is_active', $pagination) ?></th> </tr> <?php foreach ($tasks as $task): ?> <tr> <td class="task-table task-<?= $task['color_id'] ?>"> - <?= Helper\a('#'.Helper\escape($task['id']), 'task', 'show', array('task_id' => $task['id']), false, '', t('View this task')) ?> + <?= $this->a('#'.$this->e($task['id']), 'task', 'show', array('task_id' => $task['id']), false, '', t('View this task')) ?> </td> <td> - <?= Helper\in_list($task['column_id'], $columns) ?> + <?= $this->inList($task['column_id'], $columns) ?> </td> <td> - <?= Helper\in_list($task['category_id'], $categories, '') ?> + <?= $this->inList($task['category_id'], $categories, '') ?> </td> <td> - <?= Helper\a(Helper\escape($task['title']), 'task', 'show', array('task_id' => $task['id']), false, '', t('View this task')) ?> + <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id']), false, '', t('View this task')) ?> </td> <td> <?php if ($task['assignee_username']): ?> - <?= Helper\escape($task['assignee_name'] ?: $task['assignee_username']) ?> + <?= $this->e($task['assignee_name'] ?: $task['assignee_username']) ?> <?php else: ?> <?= t('Unassigned') ?> <?php endif ?> @@ -53,4 +53,4 @@ <?php endforeach ?> </table> -<?= Helper\paginate($pagination) ?> +<?= $this->paginate($pagination) ?> diff --git a/app/Template/task/time.php b/app/Template/task/time.php index 11a76303..b00cbc14 100644 --- a/app/Template/task/time.php +++ b/app/Template/task/time.php @@ -1,15 +1,15 @@ -<form method="post" action="<?= Helper\u('task', 'time', array('task_id' => $values['id'])) ?>" class="form-inline task-time-form" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('id', $values) ?> +<form method="post" action="<?= $this->u('task', 'time', array('task_id' => $values['id'])) ?>" class="form-inline task-time-form" autocomplete="off"> + <?= $this->formCsrf() ?> + <?= $this->formHidden('id', $values) ?> - <?= Helper\form_label(t('Start date'), 'date_started') ?> - <?= Helper\form_text('date_started', $values, array(), array('placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->formLabel(t('Start date'), 'date_started') ?> + <?= $this->formText('date_started', $values, array(), array('placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> - <?= Helper\form_label(t('Time estimated'), 'time_estimated') ?> - <?= Helper\form_numeric('time_estimated', $values, array(), array('placeholder="'.t('hours').'"')) ?> + <?= $this->formLabel(t('Time estimated'), 'time_estimated') ?> + <?= $this->formNumeric('time_estimated', $values, array(), array('placeholder="'.t('hours').'"')) ?> - <?= Helper\form_label(t('Time spent'), 'time_spent') ?> - <?= Helper\form_numeric('time_spent', $values, array(), array('placeholder="'.t('hours').'"')) ?> + <?= $this->formLabel(t('Time spent'), 'time_spent') ?> + <?= $this->formNumeric('time_spent', $values, array(), array('placeholder="'.t('hours').'"')) ?> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> </form>
\ No newline at end of file diff --git a/app/Template/task/timesheet.php b/app/Template/task/timesheet.php index cd093657..fa76b84d 100644 --- a/app/Template/task/timesheet.php +++ b/app/Template/task/timesheet.php @@ -5,9 +5,9 @@ </div> <ul class="listing"> - <li><?= t('Estimate:') ?> <strong><?= Helper\escape($timesheet['time_estimated']) ?></strong> <?= t('hours') ?></li> - <li><?= t('Spent:') ?> <strong><?= Helper\escape($timesheet['time_spent']) ?></strong> <?= t('hours') ?></li> - <li><?= t('Remaining:') ?> <strong><?= Helper\escape($timesheet['time_remaining']) ?></strong> <?= t('hours') ?></li> + <li><?= t('Estimate:') ?> <strong><?= $this->e($timesheet['time_estimated']) ?></strong> <?= t('hours') ?></li> + <li><?= t('Spent:') ?> <strong><?= $this->e($timesheet['time_spent']) ?></strong> <?= t('hours') ?></li> + <li><?= t('Remaining:') ?> <strong><?= $this->e($timesheet['time_remaining']) ?></strong> <?= t('hours') ?></li> </ul> <?php endif ?>
\ No newline at end of file diff --git a/app/Template/user/edit.php b/app/Template/user/edit.php index bc942567..6766f952 100644 --- a/app/Template/user/edit.php +++ b/app/Template/user/edit.php @@ -1,32 +1,32 @@ <div class="page-header"> <h2><?= t('Edit user') ?></h2> </div> -<form method="post" action="<?= Helper\u('user', 'edit', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('user', 'edit', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('is_ldap_user', $values) ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formHidden('is_ldap_user', $values) ?> - <?= Helper\form_label(t('Username'), 'username') ?> - <?= Helper\form_text('username', $values, $errors, array('required', $values['is_ldap_user'] == 1 ? 'readonly' : '')) ?><br/> + <?= $this->formLabel(t('Username'), 'username') ?> + <?= $this->formText('username', $values, $errors, array('required', $values['is_ldap_user'] == 1 ? 'readonly' : '')) ?><br/> - <?= Helper\form_label(t('Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors) ?><br/> + <?= $this->formLabel(t('Name'), 'name') ?> + <?= $this->formText('name', $values, $errors) ?><br/> - <?= Helper\form_label(t('Email'), 'email') ?> - <?= Helper\form_email('email', $values, $errors) ?><br/> + <?= $this->formLabel(t('Email'), 'email') ?> + <?= $this->formEmail('email', $values, $errors) ?><br/> - <?= Helper\form_label(t('Default project'), 'default_project_id') ?> - <?= Helper\form_select('default_project_id', $projects, $values, $errors) ?><br/> + <?= $this->formLabel(t('Default project'), 'default_project_id') ?> + <?= $this->formSelect('default_project_id', $projects, $values, $errors) ?><br/> - <?php if (Helper\is_admin()): ?> - <?= Helper\form_checkbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?><br/> + <?php if ($this->acl->isAdminUser()): ?> + <?= $this->formCheckbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?><br/> <?php endif ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/user/external.php b/app/Template/user/external.php index 31ffcb75..6ee1e459 100644 --- a/app/Template/user/external.php +++ b/app/Template/user/external.php @@ -6,11 +6,11 @@ <h3><i class="fa fa-google"></i> <?= t('Google Account') ?></h3> <p class="listing"> - <?php if (Helper\is_current_user($user['id'])): ?> + <?php if ($this->acl->isCurrentUser($user['id'])): ?> <?php if (empty($user['google_id'])): ?> - <?= Helper\a(t('Link my Google Account'), 'user', 'google', array(), true) ?> + <?= $this->a(t('Link my Google Account'), 'user', 'google', array(), true) ?> <?php else: ?> - <?= Helper\a(t('Unlink my Google Account'), 'user', 'unlinkGoogle', array(), true) ?> + <?= $this->a(t('Unlink my Google Account'), 'user', 'unlinkGoogle', array(), true) ?> <?php endif ?> <?php else: ?> <?= empty($user['google_id']) ? t('No account linked.') : t('Account linked.') ?> @@ -22,11 +22,11 @@ <h3><i class="fa fa-github"></i> <?= t('Github Account') ?></h3> <p class="listing"> - <?php if (Helper\is_current_user($user['id'])): ?> + <?php if ($this->acl->isCurrentUser($user['id'])): ?> <?php if (empty($user['github_id'])): ?> - <?= Helper\a(t('Link my GitHub Account'), 'user', 'github', array(), true) ?> + <?= $this->a(t('Link my GitHub Account'), 'user', 'github', array(), true) ?> <?php else: ?> - <?= Helper\a(t('Unlink my GitHub Account'), 'user', 'unlinkGitHub', array(), true) ?> + <?= $this->a(t('Unlink my GitHub Account'), 'user', 'unlinkGitHub', array(), true) ?> <?php endif ?> <?php else: ?> <?= empty($user['github_id']) ? t('No account linked.') : t('Account linked.') ?> diff --git a/app/Template/user/index.php b/app/Template/user/index.php index 73612b0b..a6da9f65 100644 --- a/app/Template/user/index.php +++ b/app/Template/user/index.php @@ -1,8 +1,8 @@ <section id="main"> <div class="page-header"> - <?php if (Helper\is_admin()): ?> + <?php if ($this->acl->isAdminUser()): ?> <ul> - <li><i class="fa fa-plus fa-fw"></i><?= Helper\a(t('New user'), 'user', 'create') ?></li> + <li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New user'), 'user', 'create') ?></li> </ul> <?php endif ?> </div> @@ -12,35 +12,35 @@ <?php else: ?> <table> <tr> - <th><?= Helper\order(t('Id'), 'id', $pagination) ?></th> - <th><?= Helper\order(t('Username'), 'username', $pagination) ?></th> - <th><?= Helper\order(t('Name'), 'name', $pagination) ?></th> - <th><?= Helper\order(t('Email'), 'email', $pagination) ?></th> - <th><?= Helper\order(t('Administrator'), 'is_admin', $pagination) ?></th> - <th><?= Helper\order(t('Default project'), 'default_project_id', $pagination) ?></th> - <th><?= Helper\order(t('Notifications'), 'notifications_enabled', $pagination) ?></th> + <th><?= $this->order(t('Id'), 'id', $pagination) ?></th> + <th><?= $this->order(t('Username'), 'username', $pagination) ?></th> + <th><?= $this->order(t('Name'), 'name', $pagination) ?></th> + <th><?= $this->order(t('Email'), 'email', $pagination) ?></th> + <th><?= $this->order(t('Administrator'), 'is_admin', $pagination) ?></th> + <th><?= $this->order(t('Default project'), 'default_project_id', $pagination) ?></th> + <th><?= $this->order(t('Notifications'), 'notifications_enabled', $pagination) ?></th> <th><?= t('External accounts') ?></th> - <th><?= Helper\order(t('Account type'), 'is_ldap_user', $pagination) ?></th> + <th><?= $this->order(t('Account type'), 'is_ldap_user', $pagination) ?></th> </tr> <?php foreach ($users as $user): ?> <tr> <td> - <?= Helper\a('#'.$user['id'], 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->a('#'.$user['id'], 'user', 'show', array('user_id' => $user['id'])) ?> </td> <td> - <?= Helper\a(Helper\escape($user['username']), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->a($this->e($user['username']), 'user', 'show', array('user_id' => $user['id'])) ?> </td> <td> - <?= Helper\escape($user['name']) ?> + <?= $this->e($user['name']) ?> </td> <td> - <a href="mailto:<?= Helper\escape($user['email']) ?>"><?= Helper\escape($user['email']) ?></a> + <a href="mailto:<?= $this->e($user['email']) ?>"><?= $this->e($user['email']) ?></a> </td> <td> <?= $user['is_admin'] ? t('Yes') : t('No') ?> </td> <td> - <?= (isset($user['default_project_id']) && isset($projects[$user['default_project_id']])) ? Helper\escape($projects[$user['default_project_id']]) : t('None'); ?> + <?= (isset($user['default_project_id']) && isset($projects[$user['default_project_id']])) ? $this->e($projects[$user['default_project_id']]) : t('None'); ?> </td> <td> <?php if ($user['notifications_enabled'] == 1): ?> @@ -66,7 +66,7 @@ <?php endforeach ?> </table> - <?= Helper\paginate($pagination) ?> + <?= $this->paginate($pagination) ?> <?php endif ?> </section> </section> diff --git a/app/Template/user/last.php b/app/Template/user/last.php index 0b55b0d5..317334b8 100644 --- a/app/Template/user/last.php +++ b/app/Template/user/last.php @@ -15,9 +15,9 @@ <?php foreach($last_logins as $login): ?> <tr> <td><?= dt('%B %e, %Y at %k:%M %p', $login['date_creation']) ?></td> - <td><?= Helper\escape($login['auth_type']) ?></td> - <td><?= Helper\escape($login['ip']) ?></td> - <td><?= Helper\escape(Helper\summary($login['user_agent'])) ?></td> + <td><?= $this->e($login['auth_type']) ?></td> + <td><?= $this->e($login['ip']) ?></td> + <td><?= $this->e($this->summary($login['user_agent'])) ?></td> </tr> <?php endforeach ?> </table> diff --git a/app/Template/user/layout.php b/app/Template/user/layout.php index 0778b716..94610000 100644 --- a/app/Template/user/layout.php +++ b/app/Template/user/layout.php @@ -1,15 +1,15 @@ <section id="main"> <div class="page-header"> - <?php if (Helper\is_admin()): ?> + <?php if ($this->acl->isAdminUser()): ?> <ul> - <li><i class="fa fa-user fa-fw"></i><?= Helper\a(t('All users'), 'user', 'index') ?></li> - <li><i class="fa fa-plus fa-fw"></i><?= Helper\a(t('New user'), 'user', 'create') ?></li> + <li><i class="fa fa-user fa-fw"></i><?= $this->a(t('All users'), 'user', 'index') ?></li> + <li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New user'), 'user', 'create') ?></li> </ul> <?php endif ?> </div> <section class="sidebar-container" id="user-section"> - <?= Helper\template('user/sidebar', array('user' => $user)) ?> + <?= $this->render('user/sidebar', array('user' => $user)) ?> <div class="sidebar-content"> <?= $user_content_for_layout ?> diff --git a/app/Template/user/login.php b/app/Template/user/login.php index fea44a01..c2e3914e 100644 --- a/app/Template/user/login.php +++ b/app/Template/user/login.php @@ -1,27 +1,27 @@ <div class="form-login"> <?php if (isset($errors['login'])): ?> - <p class="alert alert-error"><?= Helper\escape($errors['login']) ?></p> + <p class="alert alert-error"><?= $this->e($errors['login']) ?></p> <?php endif ?> - <form method="post" action="<?= Helper\u('user', 'check', array('redirect_query' => urlencode($redirect_query))) ?>"> + <form method="post" action="<?= $this->u('user', 'check', array('redirect_query' => urlencode($redirect_query))) ?>"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_label(t('Username'), 'username') ?> - <?= Helper\form_text('username', $values, $errors, array('autofocus', 'required')) ?><br/> + <?= $this->formLabel(t('Username'), 'username') ?> + <?= $this->formText('username', $values, $errors, array('autofocus', 'required')) ?><br/> - <?= Helper\form_label(t('Password'), 'password') ?> - <?= Helper\form_password('password', $values, $errors, array('required')) ?> + <?= $this->formLabel(t('Password'), 'password') ?> + <?= $this->formPassword('password', $values, $errors, array('required')) ?> - <?= Helper\form_checkbox('remember_me', t('Remember Me'), 1) ?><br/> + <?= $this->formCheckbox('remember_me', t('Remember Me'), 1) ?><br/> <?php if (GOOGLE_AUTH): ?> - <?= Helper\a(t('Login with my Google Account'), 'user', 'google') ?> + <?= $this->a(t('Login with my Google Account'), 'user', 'google') ?> <?php endif ?> <?php if (GITHUB_AUTH): ?> - <?= Helper\a(t('Login with my GitHub Account'), 'user', 'gitHub') ?> + <?= $this->a(t('Login with my GitHub Account'), 'user', 'gitHub') ?> <?php endif ?> <div class="form-actions"> diff --git a/app/Template/user/new.php b/app/Template/user/new.php index af5824e0..a720d1a1 100644 --- a/app/Template/user/new.php +++ b/app/Template/user/new.php @@ -1,38 +1,38 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-user fa-fw"></i><?= Helper\a(t('All users'), 'user', 'index') ?></li> + <li><i class="fa fa-user fa-fw"></i><?= $this->a(t('All users'), 'user', 'index') ?></li> </ul> </div> <section> - <form method="post" action="<?= Helper\u('user', 'save') ?>" autocomplete="off"> + <form method="post" action="<?= $this->u('user', 'save') ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_label(t('Username'), 'username') ?> - <?= Helper\form_text('username', $values, $errors, array('autofocus', 'required')) ?><br/> + <?= $this->formLabel(t('Username'), 'username') ?> + <?= $this->formText('username', $values, $errors, array('autofocus', 'required')) ?><br/> - <?= Helper\form_label(t('Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors) ?><br/> + <?= $this->formLabel(t('Name'), 'name') ?> + <?= $this->formText('name', $values, $errors) ?><br/> - <?= Helper\form_label(t('Email'), 'email') ?> - <?= Helper\form_email('email', $values, $errors) ?><br/> + <?= $this->formLabel(t('Email'), 'email') ?> + <?= $this->formEmail('email', $values, $errors) ?><br/> - <?= Helper\form_label(t('Password'), 'password') ?> - <?= Helper\form_password('password', $values, $errors, array('required')) ?><br/> + <?= $this->formLabel(t('Password'), 'password') ?> + <?= $this->formPassword('password', $values, $errors, array('required')) ?><br/> - <?= Helper\form_label(t('Confirmation'), 'confirmation') ?> - <?= Helper\form_password('confirmation', $values, $errors, array('required')) ?><br/> + <?= $this->formLabel(t('Confirmation'), 'confirmation') ?> + <?= $this->formPassword('confirmation', $values, $errors, array('required')) ?><br/> - <?= Helper\form_label(t('Default project'), 'default_project_id') ?> - <?= Helper\form_select('default_project_id', $projects, $values, $errors) ?><br/> + <?= $this->formLabel(t('Default project'), 'default_project_id') ?> + <?= $this->formSelect('default_project_id', $projects, $values, $errors) ?><br/> - <?= Helper\form_checkbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?> + <?= $this->formCheckbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'user', 'index') ?> + <?= $this->a(t('cancel'), 'user', 'index') ?> </div> </form> </section> diff --git a/app/Template/user/notifications.php b/app/Template/user/notifications.php index 33da61fb..56c48f8f 100644 --- a/app/Template/user/notifications.php +++ b/app/Template/user/notifications.php @@ -2,18 +2,18 @@ <h2><?= t('Email notifications') ?></h2> </div> -<form method="post" action="<?= Helper\u('user', 'notifications', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('user', 'notifications', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> + <?= $this->formCsrf() ?> - <?= Helper\form_checkbox('notifications_enabled', t('Enable email notifications'), '1', $notifications['notifications_enabled'] == 1) ?><br/> + <?= $this->formCheckbox('notifications_enabled', t('Enable email notifications'), '1', $notifications['notifications_enabled'] == 1) ?><br/> <?php if (! empty($projects)): ?> <p><?= t('I want to receive notifications only for those projects:') ?><br/><br/></p> <div class="form-checkbox-group"> <?php foreach ($projects as $project_id => $project_name): ?> - <?= Helper\form_checkbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?><br/> + <?= $this->formCheckbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?><br/> <?php endforeach ?> </div> <?php endif ?> @@ -21,6 +21,6 @@ <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/user/password.php b/app/Template/user/password.php index 76e0ab15..14de0d42 100644 --- a/app/Template/user/password.php +++ b/app/Template/user/password.php @@ -2,25 +2,25 @@ <h2><?= t('Password modification') ?></h2> </div> -<form method="post" action="<?= Helper\u('user', 'password', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->u('user', 'password', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_csrf() ?> + <?= $this->formHidden('id', $values) ?> + <?= $this->formCsrf() ?> <div class="alert alert-error"> - <?= Helper\form_label(t('Current password for the user "%s"', Helper\get_username()), 'current_password') ?> - <?= Helper\form_password('current_password', $values, $errors) ?><br/> + <?= $this->formLabel(t('Current password for the user "%s"', $this->getFullname()), 'current_password') ?> + <?= $this->formPassword('current_password', $values, $errors) ?><br/> </div> - <?= Helper\form_label(t('New password for the user "%s"', Helper\get_username($user)), 'password') ?> - <?= Helper\form_password('password', $values, $errors) ?><br/> + <?= $this->formLabel(t('New password for the user "%s"', $this->getFullname($user)), 'password') ?> + <?= $this->formPassword('password', $values, $errors) ?><br/> - <?= Helper\form_label(t('Confirmation'), 'confirmation') ?> - <?= Helper\form_password('confirmation', $values, $errors) ?><br/> + <?= $this->formLabel(t('Confirmation'), 'confirmation') ?> + <?= $this->formPassword('confirmation', $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> </div> </form> diff --git a/app/Template/user/remove.php b/app/Template/user/remove.php index 5f58b631..e4b09cfa 100644 --- a/app/Template/user/remove.php +++ b/app/Template/user/remove.php @@ -6,8 +6,8 @@ <p class="alert alert-info"><?= t('Do you really want to remove this user: "%s"?', $user['name'] ?: $user['username']) ?></p> <div class="form-actions"> - <?= Helper\a(t('Yes'), 'user', 'remove', array('user_id' => $user['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->a(t('Yes'), 'user', 'remove', array('user_id' => $user['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/user/sessions.php b/app/Template/user/sessions.php index d05d5b6d..5a06057c 100644 --- a/app/Template/user/sessions.php +++ b/app/Template/user/sessions.php @@ -17,9 +17,9 @@ <tr> <td><?= dt('%B %e, %Y at %k:%M %p', $session['date_creation']) ?></td> <td><?= dt('%B %e, %Y at %k:%M %p', $session['expiration']) ?></td> - <td><?= Helper\escape($session['ip']) ?></td> - <td><?= Helper\escape(Helper\summary($session['user_agent'])) ?></td> - <td><?= Helper\a(t('Remove'), 'user', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?></td> + <td><?= $this->e($session['ip']) ?></td> + <td><?= $this->e($this->summary($session['user_agent'])) ?></td> + <td><?= $this->a(t('Remove'), 'user', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?></td> </tr> <?php endforeach ?> </table> diff --git a/app/Template/user/show.php b/app/Template/user/show.php index 1c843751..f65be260 100644 --- a/app/Template/user/show.php +++ b/app/Template/user/show.php @@ -2,10 +2,10 @@ <h2><?= t('Summary') ?></h2> </div> <ul class="listing"> - <li><?= t('Username:') ?> <strong><?= Helper\escape($user['username']) ?></strong></li> - <li><?= t('Name:') ?> <strong><?= Helper\escape($user['name']) ?></strong></li> - <li><?= t('Email:') ?> <strong><?= Helper\escape($user['email']) ?></strong></li> - <li><?= t('Default project:') ?> <strong><?= (isset($user['default_project_id']) && isset($projects[$user['default_project_id']])) ? Helper\escape($projects[$user['default_project_id']]) : t('None'); ?></strong></li> + <li><?= t('Username:') ?> <strong><?= $this->e($user['username']) ?></strong></li> + <li><?= t('Name:') ?> <strong><?= $this->e($user['name']) ?></strong></li> + <li><?= t('Email:') ?> <strong><?= $this->e($user['email']) ?></strong></li> + <li><?= t('Default project:') ?> <strong><?= (isset($user['default_project_id']) && isset($projects[$user['default_project_id']])) ? $this->e($projects[$user['default_project_id']]) : t('None'); ?></strong></li> <li><?= t('Notifications:') ?> <strong><?= $user['notifications_enabled'] == 1 ? t('Enabled') : t('Disabled') ?></strong></li> <li><?= t('Group:') ?> <strong><?= $user['is_admin'] ? t('Administrator') : t('Regular user') ?></strong></li> <li><?= t('Account type:') ?> <strong><?= $user['is_ldap_user'] ? t('Remote') : t('Local') ?></strong></li> diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php index 0a1a0764..5b7abc34 100644 --- a/app/Template/user/sidebar.php +++ b/app/Template/user/sidebar.php @@ -2,37 +2,37 @@ <h2><?= t('Actions') ?></h2> <ul> <li> - <?= Helper\a(t('Summary'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->a(t('Summary'), 'user', 'show', array('user_id' => $user['id'])) ?> </li> - <?php if (Helper\is_admin() || Helper\is_current_user($user['id'])): ?> + <?php if ($this->acl->isAdminUser() || $this->acl->isCurrentUser($user['id'])): ?> <li> - <?= Helper\a(t('Edit profile'), 'user', 'edit', array('user_id' => $user['id'])) ?> + <?= $this->a(t('Edit profile'), 'user', 'edit', array('user_id' => $user['id'])) ?> </li> <?php if ($user['is_ldap_user'] == 0): ?> <li> - <?= Helper\a(t('Change password'), 'user', 'password', array('user_id' => $user['id'])) ?> + <?= $this->a(t('Change password'), 'user', 'password', array('user_id' => $user['id'])) ?> </li> <?php endif ?> <li> - <?= Helper\a(t('Email notifications'), 'user', 'notifications', array('user_id' => $user['id'])) ?> + <?= $this->a(t('Email notifications'), 'user', 'notifications', array('user_id' => $user['id'])) ?> </li> <li> - <?= Helper\a(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?> + <?= $this->a(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?> </li> <li> - <?= Helper\a(t('Last logins'), 'user', 'last', array('user_id' => $user['id'])) ?> + <?= $this->a(t('Last logins'), 'user', 'last', array('user_id' => $user['id'])) ?> </li> <li> - <?= Helper\a(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?> + <?= $this->a(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?> </li> <?php endif ?> - <?php if (Helper\is_admin() && ! Helper\is_current_user($user['id'])): ?> + <?php if ($this->acl->isAdminUser() && ! $this->acl->isCurrentUser($user['id'])): ?> <li> - <?= Helper\a(t('Remove'), 'user', 'remove', array('user_id' => $user['id'])) ?> + <?= $this->a(t('Remove'), 'user', 'remove', array('user_id' => $user['id'])) ?> </li> <?php endif ?> </ul> diff --git a/app/common.php b/app/common.php index 12132189..bd336d92 100644 --- a/app/common.php +++ b/app/common.php @@ -12,6 +12,6 @@ require __DIR__.'/constants.php'; $container = new Pimple\Container; $container->register(new ServiceProvider\LoggingProvider); $container->register(new ServiceProvider\DatabaseProvider); -$container->register(new ServiceProvider\ModelProvider); +$container->register(new ServiceProvider\ClassProvider); $container->register(new ServiceProvider\EventDispatcherProvider); $container->register(new ServiceProvider\MailerProvider); diff --git a/app/helpers.php b/app/helpers.php deleted file mode 100644 index 01c45292..00000000 --- a/app/helpers.php +++ /dev/null @@ -1,675 +0,0 @@ -<?php - -namespace Helper; - -/** - * Template helpers - * - */ -use Core\Security; -use Core\Template; -use Core\Request; -use Parsedown; - -/** - * Append a CSRF token to a query string - * - * @return string - */ -function param_csrf() -{ - return '&csrf_token='.Security::getCSRFToken(); -} - -/** - * Add a Javascript asset - * - * @param string $filename Filename - * @return string - */ -function js($filename) -{ - return '<script type="text/javascript" src="'.$filename.'?'.filemtime($filename).'"></script>'; -} - -/** - * Add a stylesheet asset - * - * @param string $filename Filename - * @return string - */ -function css($filename) -{ - return '<link rel="stylesheet" href="'.$filename.'?'.filemtime($filename).'" media="screen">'; -} - -/** - * Load a template - * - * @param string $name Template name - * @param array $args Template parameters - * @return string - */ -function template($name, array $args = array()) -{ - $tpl = new Template; - return $tpl->load($name, $args); -} - -/** - * Check if the given user_id is the connected user - * - * @param integer $user_id User id - * @return boolean - */ -function is_current_user($user_id) -{ - return $_SESSION['user']['id'] == $user_id; -} - -/** - * Check if the current user is administrator - * - * @return boolean - */ -function is_admin() -{ - return $_SESSION['user']['is_admin'] == 1; -} - -/** - * Return true if the user can configure the project (project are previously filtered) - * - * @return boolean - */ -function is_project_admin(array $project) -{ - return is_admin() || $project['is_private'] == 1; -} - -/** - * Return the username - * - * @param array $user User properties (optional) - * @return string - */ -function get_username(array $user = array()) -{ - return ! empty($user) ? ($user['name'] ?: $user['username']) - : ($_SESSION['user']['name'] ?: $_SESSION['user']['username']); -} - -/** - * Get the current user id - * - * @return integer - */ -function get_user_id() -{ - return $_SESSION['user']['id']; -} - -/** - * Markdown transformation - * - * @param string $text Markdown content - * @param array $link Link parameters for replacement - * @return string - */ -function markdown($text, array $link = array('controller' => 'task', 'action' => 'show', 'params' => array())) -{ - $html = Parsedown::instance() - ->setMarkupEscaped(true) # escapes markup (HTML) - ->text($text); - - // Replace task #123 by a link to the task - $html = preg_replace_callback('!#(\d+)!i', function($matches) use ($link) { - return a( - $matches[0], - $link['controller'], - $link['action'], - $link['params'] + array('task_id' => $matches[1]) - ); - }, $html); - - return $html; -} - -/** - * Get the current URL without the querystring - * - * @return string - */ -function get_current_base_url() -{ - $url = Request::isHTTPS() ? 'https://' : 'http://'; - $url .= $_SERVER['SERVER_NAME']; - $url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT']; - $url .= dirname($_SERVER['PHP_SELF']) !== '/' ? dirname($_SERVER['PHP_SELF']).'/' : '/'; - - return $url; -} - -/** - * HTML escaping - * - * @param string $value Value to escape - * @return string - */ -function escape($value) -{ - return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false); -} - -/** - * Dispplay the flash session message - * - * @param string $html HTML wrapper - * @return string - */ -function flash($html) -{ - $data = ''; - - if (isset($_SESSION['flash_message'])) { - $data = sprintf($html, escape($_SESSION['flash_message'])); - unset($_SESSION['flash_message']); - } - - return $data; -} - -/** - * Display the flash session error message - * - * @param string $html HTML wrapper - * @return string - */ -function flash_error($html) -{ - $data = ''; - - if (isset($_SESSION['flash_error_message'])) { - $data = sprintf($html, escape($_SESSION['flash_error_message'])); - unset($_SESSION['flash_error_message']); - } - - return $data; -} - -/** - * Format a file size - * - * @param integer $size Size in bytes - * @param integer $precision Precision - * @return string - */ -function format_bytes($size, $precision = 2) -{ - $base = log($size) / log(1024); - $suffixes = array('', 'k', 'M', 'G', 'T'); - - return round(pow(1024, $base - floor($base)), $precision).$suffixes[(int)floor($base)]; -} - -/** - * Truncate a long text - * - * @param string $value Text - * @param integer $max_length Max Length - * @param string $end Text end - * @return string - */ -function summary($value, $max_length = 85, $end = '[...]') -{ - $length = strlen($value); - - if ($length > $max_length) { - return substr($value, 0, $max_length).' '.$end; - } - - return $value; -} - -/** - * Return true if needle is contained in the haystack - * - * @param string $haystack Haystack - * @param string $needle Needle - * @return boolean - */ -function contains($haystack, $needle) -{ - return strpos($haystack, $needle) !== false; -} - -/** - * Return a value from a dictionary - * - * @param mixed $id Key - * @param array $listing Dictionary - * @param string $default_value Value displayed when the key doesn't exists - * @return string - */ -function in_list($id, array $listing, $default_value = '?') -{ - if (isset($listing[$id])) { - return escape($listing[$id]); - } - - return $default_value; -} - -/** - * Display the form error class - * - * @param array $errors Error list - * @param string $name Field name - * @return string - */ -function error_class(array $errors, $name) -{ - return ! isset($errors[$name]) ? '' : ' form-error'; -} - -/** - * Display a list of form errors - * - * @param array $errors List of errors - * @param string $name Field name - * @return string - */ -function error_list(array $errors, $name) -{ - $html = ''; - - if (isset($errors[$name])) { - - $html .= '<ul class="form-errors">'; - - foreach ($errors[$name] as $error) { - $html .= '<li>'.escape($error).'</li>'; - } - - $html .= '</ul>'; - } - - return $html; -} - -/** - * Get an escaped form value - * - * @param mixed $values Values - * @param string $name Field name - * @return string - */ -function form_value($values, $name) -{ - if (isset($values->$name)) { - return 'value="'.escape($values->$name).'"'; - } - - return isset($values[$name]) ? 'value="'.escape($values[$name]).'"' : ''; -} - -/** - * Hidden CSRF token field - * - * @return string - */ -function form_csrf() -{ - return '<input type="hidden" name="csrf_token" value="'.Security::getCSRFToken().'"/>'; -} - -/** - * Display a hidden form field - * - * @param string $name Field name - * @param array $values Form values - * @return string - */ -function form_hidden($name, array $values = array()) -{ - return '<input type="hidden" name="'.$name.'" id="form-'.$name.'" '.form_value($values, $name).'/>'; -} - -/** - * Display a select field - * - * @param string $name Field name - * @param array $options Options - * @param array $values Form values - * @param array $errors Form errors - * @param string $class CSS class - * @return string - */ -function form_select($name, array $options, array $values = array(), array $errors = array(), $class = '') -{ - $html = '<select name="'.$name.'" id="form-'.$name.'" class="'.$class.'">'; - - foreach ($options as $id => $value) { - - $html .= '<option value="'.escape($id).'"'; - - if (isset($values->$name) && $id == $values->$name) $html .= ' selected="selected"'; - if (isset($values[$name]) && $id == $values[$name]) $html .= ' selected="selected"'; - - $html .= '>'.escape($value).'</option>'; - } - - $html .= '</select>'; - $html .= error_list($errors, $name); - - return $html; -} - -/** - * Display a radio field group - * - * @param string $name Field name - * @param array $options Options - * @param array $values Form values - * @return string - */ -function form_radios($name, array $options, array $values = array()) -{ - $html = ''; - - foreach ($options as $value => $label) { - $html .= form_radio($name, $label, $value, isset($values[$name]) && $values[$name] == $value); - } - - return $html; -} - -/** - * Display a radio field - * - * @param string $name Field name - * @param string $label Form label - * @param string $value Form value - * @param boolean $selected Field selected or not - * @param string $class CSS class - * @return string - */ -function form_radio($name, $label, $value, $selected = false, $class = '') -{ - return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($selected ? 'selected="selected"' : '').'>'.escape($label).'</label>'; -} - -/** - * Display a checkbox field - * - * @param string $name Field name - * @param string $label Form label - * @param string $value Form value - * @param boolean $checked Field selected or not - * @param string $class CSS class - * @return string - */ -function form_checkbox($name, $label, $value, $checked = false, $class = '') -{ - return '<label><input type="checkbox" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($checked ? 'checked="checked"' : '').'> '.escape($label).'</label>'; -} - -/** - * Display a form label - * - * @param string $name Field name - * @param string $label Form label - * @param array $attributes HTML attributes - * @return string - */ -function form_label($label, $name, array $attributes = array()) -{ - return '<label for="form-'.$name.'" '.implode(' ', $attributes).'>'.escape($label).'</label>'; -} - -/** - * Display a textarea - * - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_textarea($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - $class .= error_class($errors, $name); - - $html = '<textarea name="'.$name.'" id="form-'.$name.'" class="'.$class.'" '; - $html .= implode(' ', $attributes).'>'; - $html .= isset($values->$name) ? escape($values->$name) : isset($values[$name]) ? $values[$name] : ''; - $html .= '</textarea>'; - $html .= error_list($errors, $name); - - return $html; -} - -/** - * Display a input field - * - * @param string $type HMTL input tag type - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_input($type, $name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - $class .= error_class($errors, $name); - - $html = '<input type="'.$type.'" name="'.$name.'" id="form-'.$name.'" '.form_value($values, $name).' class="'.$class.'" '; - $html .= implode(' ', $attributes).'/>'; - if (in_array('required', $attributes)) $html .= '<span class="form-required">*</span>'; - $html .= error_list($errors, $name); - - return $html; -} - -/** - * Display a text field - * - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_text($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('text', $name, $values, $errors, $attributes, $class); -} - -/** - * Display a password field - * - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_password($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('password', $name, $values, $errors, $attributes, $class); -} - -/** - * Display an email field - * - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_email($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('email', $name, $values, $errors, $attributes, $class); -} - -/** - * Display a date field - * - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_date($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('date', $name, $values, $errors, $attributes, $class); -} - -/** - * Display a number field - * - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_number($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('number', $name, $values, $errors, $attributes, $class); -} - -/** - * Display a numeric field (allow decimal number) - * - * @param string $name Field name - * @param array $values Form values - * @param array $errors Form errors - * @param array $attributes HTML attributes - * @param string $class CSS class - * @return string - */ -function form_numeric($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') -{ - return form_input('text', $name, $values, $errors, $attributes, $class.' form-numeric'); -} - -/** - * Link - * - * a('link', 'task', 'show', array('task_id' => $task_id)) - * - * @param string $label Link label - * @param string $controller Controller name - * @param string $action Action name - * @param array $params Url parameters - * @param boolean $csrf Add a CSRF token - * @param string $class CSS class attribute - * @param boolean $new_tab Open the link in a new tab - * @return string - */ -function a($label, $controller, $action, array $params = array(), $csrf = false, $class = '', $title = '', $new_tab = false) -{ - return '<a href="'.u($controller, $action, $params, $csrf).'" class="'.$class.'" title="'.$title.'" '.($new_tab ? 'target="_blank"' : '').'>'.$label.'</a>'; -} - -/** - * URL query string - * - * u('task', 'show', array('task_id' => $task_id)) - * - * @param string $controller Controller name - * @param string $action Action name - * @param array $params Url parameters - * @param boolean $csrf Add a CSRF token - * @return string - */ -function u($controller, $action, array $params = array(), $csrf = false) -{ - $html = '?controller='.$controller.'&action='.$action; - - if ($csrf) { - $params['csrf_token'] = Security::getCSRFToken(); - } - - foreach ($params as $key => $value) { - $html .= '&'.$key.'='.$value; - } - - return $html; -} - -/** - * Pagination links - * - * @param array $pagination Pagination information - * @return string - */ -function paginate(array $pagination) -{ - extract($pagination); - - if ($pagination['offset'] === 0 && ($total - $pagination['offset']) <= $limit) { - return ''; - } - - $html = '<div class="pagination">'; - $html .= '<span class="pagination-previous">'; - - if ($pagination['offset'] > 0) { - $offset = $pagination['offset'] - $limit; - $html .= a('← '.t('Previous'), $controller, $action, $params + compact('offset', 'order', 'direction')); - } - else { - $html .= '← '.t('Previous'); - } - - $html .= '</span>'; - $html .= '<span class="pagination-next">'; - - if (($total - $pagination['offset']) > $limit) { - $offset = $pagination['offset'] + $limit; - $html .= a(t('Next').' →', $controller, $action, $params + compact('offset', 'order', 'direction')); - } - else { - $html .= t('Next').' →'; - } - - $html .= '</span>'; - $html .= '</div>'; - - return $html; -} - -/** - * Column sorting (work with pagination) - * - * @param string $label Column title - * @param string $column SQL column name - * @param array $pagination Pagination information - * @return string - */ -function order($label, $column, array $pagination) -{ - extract($pagination); - - $prefix = ''; - - if ($order === $column) { - $prefix = $direction === 'DESC' ? '▼ ' : '▲ '; - $direction = $direction === 'DESC' ? 'ASC' : 'DESC'; - } - - $order = $column; - - return $prefix.a($label, $controller, $action, $params + compact('offset', 'order', 'direction')); -} diff --git a/composer.json b/composer.json index aa37e165..710fb16f 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,6 @@ "autoload": { "psr-0": {"": "app/"}, "files": [ - "app/helpers.php", "app/functions.php" ] }, diff --git a/composer.lock b/composer.lock index 6a456880..7781803d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "eb21652f9ba05c40d2c904bbf9113c69", + "hash": "b36eeeb06a0ff9d55f2342792bd6e880", "packages": [ { "name": "erusev/parsedown", diff --git a/tests/units/Base.php b/tests/units/Base.php index 3e491969..b216aff4 100644 --- a/tests/units/Base.php +++ b/tests/units/Base.php @@ -28,7 +28,7 @@ abstract class Base extends PHPUnit_Framework_TestCase $this->container = new Pimple\Container; $this->container->register(new ServiceProvider\DatabaseProvider); - $this->container->register(new ServiceProvider\ModelProvider); + $this->container->register(new ServiceProvider\ClassProvider); $this->container['dispatcher'] = new TraceableEventDispatcher( new EventDispatcher, |