diff options
239 files changed, 2440 insertions, 2336 deletions
diff --git a/app/Action/Base.php b/app/Action/Base.php index 0d8bd565..f29e9323 100644 --- a/app/Action/Base.php +++ b/app/Action/Base.php @@ -10,17 +10,8 @@ use Pimple\Container; * * @package action * @author Frederic Guillot - * - * @property \Model\UserSession $userSession - * @property \Model\Comment $comment - * @property \Model\Task $task - * @property \Model\TaskCreation $taskCreation - * @property \Model\TaskModification $taskModification - * @property \Model\TaskDuplication $taskDuplication - * @property \Model\TaskFinder $taskFinder - * @property \Model\TaskStatus $taskStatus */ -abstract class Base +abstract class Base extends \Core\Base { /** * Flag for called listener @@ -136,18 +127,6 @@ abstract class Base } /** - * Load automatically models - * - * @access public - * @param string $name Model name - * @return mixed - */ - public function __get($name) - { - return $this->container[$name]; - } - - /** * Set an user defined parameter * * @access public diff --git a/app/Api/Base.php b/app/Api/Base.php index e9494b58..1b2258af 100644 --- a/app/Api/Base.php +++ b/app/Api/Base.php @@ -2,7 +2,6 @@ namespace Api; -use Pimple\Container; use JsonRPC\AuthenticationFailure; use Symfony\Component\EventDispatcher\Event; @@ -11,57 +10,10 @@ use Symfony\Component\EventDispatcher\Event; * * @package api * @author Frederic Guillot - * - * @property \Model\Board $board - * @property \Model\Config $config - * @property \Model\Comment $comment - * @property \Model\LastLogin $lastLogin - * @property \Model\Notification $notification - * @property \Model\Project $project - * @property \Model\ProjectPermission $projectPermission - * @property \Model\ProjectActivity $projectActivity - * @property \Model\ProjectAnalytic $projectAnalytic - * @property \Model\ProjectDailySummary $projectDailySummary - * @property \Model\Subtask $subtask - * @property \Model\Task $task - * @property \Model\TaskDuplication $taskDuplication - * @property \Model\TaskExport $taskExport - * @property \Model\TaskFinder $taskFinder */ -abstract class Base +abstract class Base extends \Core\Base { /** - * 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]; - } - - /** * Check api credentials * * @access public diff --git a/app/Auth/Base.php b/app/Auth/Base.php index e2209e1f..ebf6681b 100644 --- a/app/Auth/Base.php +++ b/app/Auth/Base.php @@ -9,14 +9,8 @@ use Pimple\Container; * * @package auth * @author Frederic Guillot - * - * @property \Core\Session $session - * @property \Model\Acl $acl - * @property \Model\LastLogin $lastLogin - * @property \Model\User $user - * @property \Model\UserSession $userSession */ -abstract class Base +abstract class Base extends \Core\Base { /** * Database instance @@ -27,14 +21,6 @@ abstract class Base protected $db; /** - * Container instance - * - * @access protected - * @var \Pimple\Container - */ - protected $container; - - /** * Constructor * * @access public @@ -45,16 +31,4 @@ abstract class Base $this->container = $container; $this->db = $this->container['db']; } - - /** - * Load automatically models - * - * @access public - * @param string $name Model name - * @return mixed - */ - public function __get($name) - { - return $this->container[$name]; - } } diff --git a/app/Controller/App.php b/app/Controller/App.php index e4a97f8e..8a97e8c7 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -90,7 +90,7 @@ class App extends Base $this->response->html('<p>'.t('Nothing to preview...').'</p>'); } - $this->response->html($this->template->markdown($payload['text'])); + $this->response->html($this->helper->text->markdown($payload['text'])); } /** diff --git a/app/Controller/Auth.php b/app/Controller/Auth.php index c1859304..24e6e242 100644 --- a/app/Controller/Auth.php +++ b/app/Controller/Auth.php @@ -18,7 +18,7 @@ class Auth extends Base public function login(array $values = array(), array $errors = array()) { if ($this->userSession->isLogged()) { - $this->response->redirect($this->helper->url('app', 'index')); + $this->response->redirect($this->helper->url->to('app', 'index')); } $this->response->html($this->template->layout('auth/index', array( @@ -47,7 +47,7 @@ class Auth extends Base $this->response->redirect('?'.urldecode($redirect_query)); } - $this->response->redirect($this->helper->url('app', 'index')); + $this->response->redirect($this->helper->url->to('app', 'index')); } $this->login($values, $errors); @@ -62,6 +62,6 @@ class Auth extends Base { $this->authentication->backend('rememberMe')->destroy($this->userSession->getId()); $this->session->close(); - $this->response->redirect($this->helper->url('auth', 'login')); + $this->response->redirect($this->helper->url->to('auth', 'login')); } } diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 30d0b4e4..19de6a93 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -16,67 +16,8 @@ use Symfony\Component\EventDispatcher\Event; * * @package controller * @author Frederic Guillot - * - * @property \Core\Helper $helper - * @property \Core\Session $session - * @property \Core\Template $template - * @property \Core\Paginator $paginator - * @property \Integration\GithubWebhook $githubWebhook - * @property \Integration\GitlabWebhook $gitlabWebhook - * @property \Integration\BitbucketWebhook $bitbucketWebhook - * @property \Integration\PostmarkWebhook $postmarkWebhook - * @property \Integration\SendgridWebhook $sendgridWebhook - * @property \Integration\MailgunWebhook $mailgunWebhook - * @property \Model\Acl $acl - * @property \Model\Authentication $authentication - * @property \Model\Action $action - * @property \Model\Board $board - * @property \Model\Category $category - * @property \Model\Color $color - * @property \Model\Comment $comment - * @property \Model\Config $config - * @property \Model\DateParser $dateParser - * @property \Model\File $file - * @property \Model\HourlyRate $hourlyRate - * @property \Model\LastLogin $lastLogin - * @property \Model\Notification $notification - * @property \Model\Project $project - * @property \Model\ProjectPermission $projectPermission - * @property \Model\ProjectDuplication $projectDuplication - * @property \Model\ProjectAnalytic $projectAnalytic - * @property \Model\ProjectActivity $projectActivity - * @property \Model\ProjectDailySummary $projectDailySummary - * @property \Model\ProjectIntegration $projectIntegration - * @property \Model\Subtask $subtask - * @property \Model\SubtaskForecast $subtaskForecast - * @property \Model\Swimlane $swimlane - * @property \Model\Task $task - * @property \Model\Link $link - * @property \Model\TaskCreation $taskCreation - * @property \Model\TaskModification $taskModification - * @property \Model\TaskDuplication $taskDuplication - * @property \Model\TaskHistory $taskHistory - * @property \Model\TaskExport $taskExport - * @property \Model\TaskFinder $taskFinder - * @property \Model\TaskFilter $taskFilter - * @property \Model\TaskPosition $taskPosition - * @property \Model\TaskPermission $taskPermission - * @property \Model\TaskStatus $taskStatus - * @property \Model\Timetable $timetable - * @property \Model\TimetableDay $timetableDay - * @property \Model\TimetableWeek $timetableWeek - * @property \Model\TimetableExtra $timetableExtra - * @property \Model\TimetableOff $timetableOff - * @property \Model\TaskValidator $taskValidator - * @property \Model\TaskLink $taskLink - * @property \Model\CommentHistory $commentHistory - * @property \Model\SubtaskHistory $subtaskHistory - * @property \Model\SubtaskTimeTracking $subtaskTimeTracking - * @property \Model\User $user - * @property \Model\UserSession $userSession - * @property \Model\Webhook $webhook */ -abstract class Base +abstract class Base extends \Core\Base { /** * Request instance @@ -95,14 +36,6 @@ abstract class Base protected $response; /** - * Container instance - * - * @access private - * @var \Pimple\Container - */ - private $container; - - /** * Constructor * * @access public @@ -134,18 +67,6 @@ abstract class Base } /** - * Load automatically models - * - * @access public - * @param string $name Model name - * @return mixed - */ - public function __get($name) - { - return $this->container[$name]; - } - - /** * Send HTTP headers * * @access private @@ -201,7 +122,7 @@ abstract class Base $this->response->text('Not Authorized', 401); } - $this->response->redirect($this->helper->url('auth', 'login', array('redirect_query' => urlencode($this->request->getQueryString())))); + $this->response->redirect($this->helper->url->to('auth', 'login', array('redirect_query' => urlencode($this->request->getQueryString())))); } } @@ -220,7 +141,7 @@ abstract class Base $this->response->text('Not Authorized', 401); } - $this->response->redirect($this->helper->url('twofactor', 'code')); + $this->response->redirect($this->helper->url->to('twofactor', 'code')); } } diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 07c99a96..2b633d82 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -295,7 +295,7 @@ class Board extends Base $this->session->flashError(t('Unable to update your task.')); } - $this->response->redirect($this->helper->url('board', 'show', array('project_id' => $values['project_id']))); + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id']))); } /** @@ -333,7 +333,7 @@ class Board extends Base $this->session->flashError(t('Unable to update your task.')); } - $this->response->redirect($this->helper->url('board', 'show', array('project_id' => $values['project_id']))); + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id']))); } /** diff --git a/app/Controller/Budget.php b/app/Controller/Budget.php index 2c56c79d..45dad7fb 100644 --- a/app/Controller/Budget.php +++ b/app/Controller/Budget.php @@ -88,7 +88,7 @@ class Budget extends Base if ($this->budget->create($values['project_id'], $values['amount'], $values['comment'], $values['date'])) { $this->session->flash(t('The budget line have been created successfully.')); - $this->response->redirect($this->helper->url('budget', 'create', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('budget', 'create', array('project_id' => $project['id']))); } else { $this->session->flashError(t('Unable to create the budget line.')); @@ -130,6 +130,6 @@ class Budget extends Base $this->session->flashError(t('Unable to remove this budget line.')); } - $this->response->redirect($this->helper->url('budget', 'create', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('budget', 'create', array('project_id' => $project['id']))); } } diff --git a/app/Controller/Column.php b/app/Controller/Column.php index 69ca5dd2..89c495a6 100644 --- a/app/Controller/Column.php +++ b/app/Controller/Column.php @@ -57,7 +57,7 @@ class Column extends Base if ($this->board->addColumn($project['id'], $data['title'], $data['task_limit'], $data['description'])) { $this->session->flash(t('Board updated successfully.')); - $this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); } else { $this->session->flashError(t('Unable to update this board.')); @@ -102,7 +102,7 @@ class Column extends Base if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->session->flash(t('Board updated successfully.')); - $this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); } else { $this->session->flashError(t('Unable to update this board.')); @@ -128,7 +128,7 @@ class Column extends Base $this->board->{'move'.$direction}($project['id'], $column_id); } - $this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); } /** @@ -165,6 +165,6 @@ class Column extends Base $this->session->flashError(t('Unable to remove this column.')); } - $this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); } } diff --git a/app/Controller/Currency.php b/app/Controller/Currency.php index fac34a30..10fb90da 100644 --- a/app/Controller/Currency.php +++ b/app/Controller/Currency.php @@ -57,7 +57,7 @@ class Currency extends Base if ($this->currency->create($values['currency'], $values['rate'])) { $this->session->flash(t('The currency rate have been added successfully.')); - $this->response->redirect($this->helper->url('currency', 'index')); + $this->response->redirect($this->helper->url->to('currency', 'index')); } else { $this->session->flashError(t('Unable to add this currency rate.')); @@ -84,6 +84,6 @@ class Currency extends Base $this->session->flashError(t('Unable to save your settings.')); } - $this->response->redirect($this->helper->url('currency', 'index')); + $this->response->redirect($this->helper->url->to('currency', 'index')); } } diff --git a/app/Controller/File.php b/app/Controller/File.php index 39032abc..f0367537 100644 --- a/app/Controller/File.php +++ b/app/Controller/File.php @@ -24,10 +24,10 @@ class File extends Base $this->session->flash(t('Screenshot uploaded successfully.')); if ($this->request->getStringParam('redirect') === 'board') { - $this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); } - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } $this->response->html($this->taskLayout('file/screenshot', array( @@ -64,7 +64,7 @@ class File extends Base $this->session->flashError(t('Unable to upload the file.')); } - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } /** @@ -83,7 +83,7 @@ class File extends Base $this->response->binary(file_get_contents($filename)); } - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } /** @@ -164,7 +164,7 @@ class File extends Base $this->session->flashError(t('Unable to remove this file.')); } - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } /** diff --git a/app/Controller/Hourlyrate.php b/app/Controller/Hourlyrate.php index 8d96e5ca..19650ede 100644 --- a/app/Controller/Hourlyrate.php +++ b/app/Controller/Hourlyrate.php @@ -42,7 +42,7 @@ class Hourlyrate extends User if ($this->hourlyRate->create($values['user_id'], $values['rate'], $values['currency'], $values['date_effective'])) { $this->session->flash(t('Hourly rate created successfully.')); - $this->response->redirect($this->helper->url('hourlyrate', 'index', array('user_id' => $values['user_id']))); + $this->response->redirect($this->helper->url->to('hourlyrate', 'index', array('user_id' => $values['user_id']))); } else { $this->session->flashError(t('Unable to save the hourly rate.')); @@ -84,6 +84,6 @@ class Hourlyrate extends User $this->session->flash(t('Unable to remove this rate.')); } - $this->response->redirect($this->helper->url('hourlyrate', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('hourlyrate', 'index', array('user_id' => $user['id']))); } } diff --git a/app/Controller/Link.php b/app/Controller/Link.php index 4a29a3e2..8eac8494 100644 --- a/app/Controller/Link.php +++ b/app/Controller/Link.php @@ -73,7 +73,7 @@ class Link extends Base if ($this->link->create($values['label'], $values['opposite_label'])) { $this->session->flash(t('Link added successfully.')); - $this->response->redirect($this->helper->url('link', 'index')); + $this->response->redirect($this->helper->url->to('link', 'index')); } else { $this->session->flashError(t('Unable to create your link.')); @@ -115,7 +115,7 @@ class Link extends Base if ($valid) { if ($this->link->update($values)) { $this->session->flash(t('Link updated successfully.')); - $this->response->redirect($this->helper->url('link', 'index')); + $this->response->redirect($this->helper->url->to('link', 'index')); } else { $this->session->flashError(t('Unable to update your link.')); @@ -157,6 +157,6 @@ class Link extends Base $this->session->flashError(t('Unable to remove this link.')); } - $this->response->redirect($this->helper->url('link', 'index')); + $this->response->redirect($this->helper->url->to('link', 'index')); } } diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index 5eff1575..5baa6004 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -252,11 +252,11 @@ class Subtask extends Base { switch ($redirect) { case 'board': - $this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); case 'dashboard': - $this->response->redirect($this->helper->url('app', 'index')); + $this->response->redirect($this->helper->url->to('app', 'index')); default: - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } } @@ -275,6 +275,6 @@ class Subtask extends Base $method = $direction === 'up' ? 'moveUp' : 'moveDown'; $this->subtask->$method($task_id, $subtask_id); - $this->response->redirect($this->helper->url('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id)).'#subtasks'); + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id)).'#subtasks'); } } diff --git a/app/Controller/Task.php b/app/Controller/Task.php index c2e66245..dc83f7b1 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -288,10 +288,10 @@ class Task extends Base } if ($redirect === 'board') { - $this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); } - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } if ($this->request->isAjax()) { diff --git a/app/Controller/Tasklink.php b/app/Controller/Tasklink.php index eccf149f..dd076802 100644 --- a/app/Controller/Tasklink.php +++ b/app/Controller/Tasklink.php @@ -77,10 +77,10 @@ class Tasklink extends Base $this->session->flash(t('Link added successfully.')); if ($ajax) { - $this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); } - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); } $errors = array('title' => array(t('The exact same link already exists'))); @@ -132,7 +132,7 @@ class Tasklink extends Base if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) { $this->session->flash(t('Link updated successfully.')); - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); } $this->session->flashError(t('Unable to update your link.')); @@ -174,6 +174,6 @@ class Tasklink extends Base $this->session->flashError(t('Unable to remove this link.')); } - $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); } } diff --git a/app/Controller/Timetableday.php b/app/Controller/Timetableday.php index eea44ae1..c8f7ac8a 100644 --- a/app/Controller/Timetableday.php +++ b/app/Controller/Timetableday.php @@ -41,7 +41,7 @@ class Timetableday extends User if ($this->timetableDay->create($values['user_id'], $values['start'], $values['end'])) { $this->session->flash(t('Time slot created successfully.')); - $this->response->redirect($this->helper->url('timetableday', 'index', array('user_id' => $values['user_id']))); + $this->response->redirect($this->helper->url->to('timetableday', 'index', array('user_id' => $values['user_id']))); } else { $this->session->flashError(t('Unable to save this time slot.')); @@ -83,6 +83,6 @@ class Timetableday extends User $this->session->flash(t('Unable to remove this time slot.')); } - $this->response->redirect($this->helper->url('timetableday', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('timetableday', 'index', array('user_id' => $user['id']))); } } diff --git a/app/Controller/Timetableoff.php b/app/Controller/Timetableoff.php index 19a6fab1..585014a3 100644 --- a/app/Controller/Timetableoff.php +++ b/app/Controller/Timetableoff.php @@ -60,7 +60,7 @@ class Timetableoff extends User $values['comment'])) { $this->session->flash(t('Time slot created successfully.')); - $this->response->redirect($this->helper->url($this->controller_url, 'index', array('user_id' => $values['user_id']))); + $this->response->redirect($this->helper->url->to($this->controller_url, 'index', array('user_id' => $values['user_id']))); } else { $this->session->flashError(t('Unable to save this time slot.')); @@ -102,6 +102,6 @@ class Timetableoff extends User $this->session->flash(t('Unable to remove this time slot.')); } - $this->response->redirect($this->helper->url($this->controller_url, 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to($this->controller_url, 'index', array('user_id' => $user['id']))); } } diff --git a/app/Controller/Timetableweek.php b/app/Controller/Timetableweek.php index 829f4402..b8ce00e7 100644 --- a/app/Controller/Timetableweek.php +++ b/app/Controller/Timetableweek.php @@ -52,7 +52,7 @@ class Timetableweek extends User if ($this->timetableWeek->create($values['user_id'], $values['day'], $values['start'], $values['end'])) { $this->session->flash(t('Time slot created successfully.')); - $this->response->redirect($this->helper->url('timetableweek', 'index', array('user_id' => $values['user_id']))); + $this->response->redirect($this->helper->url->to('timetableweek', 'index', array('user_id' => $values['user_id']))); } else { $this->session->flashError(t('Unable to save this time slot.')); @@ -94,6 +94,6 @@ class Timetableweek extends User $this->session->flash(t('Unable to remove this time slot.')); } - $this->response->redirect($this->helper->url('timetableweek', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('timetableweek', 'index', array('user_id' => $user['id']))); } } diff --git a/app/Controller/Twofactor.php b/app/Controller/Twofactor.php index c21729ba..a8b0351f 100644 --- a/app/Controller/Twofactor.php +++ b/app/Controller/Twofactor.php @@ -76,7 +76,7 @@ class Twofactor extends User $_SESSION['user']['twofactor_activated'] = false; $this->session->flash(t('User updated successfully.')); - $this->response->redirect($this->helper->url('twofactor', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id']))); } /** @@ -99,7 +99,7 @@ class Twofactor extends User $this->session->flashError(t('The two factor authentication code is not valid.')); } - $this->response->redirect($this->helper->url('twofactor', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id']))); } /** @@ -118,11 +118,11 @@ class Twofactor extends User if (! empty($values['code']) && $otp->checkTotp(Base32::decode($user['twofactor_secret']), $values['code'])) { $this->session['2fa_validated'] = true; $this->session->flash(t('The two factor authentication code is valid.')); - $this->response->redirect($this->helper->url('app', 'index')); + $this->response->redirect($this->helper->url->to('app', 'index')); } else { $this->session->flashError(t('The two factor authentication code is not valid.')); - $this->response->redirect($this->helper->url('twofactor', 'code')); + $this->response->redirect($this->helper->url->to('twofactor', 'code')); } } @@ -157,7 +157,7 @@ class Twofactor extends User 'twofactor_secret' => '', )); - $this->response->redirect($this->helper->url('user', 'show', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('user', 'show', array('user_id' => $user['id']))); } $this->response->html($this->layout('twofactor/disable', array( diff --git a/app/Controller/User.php b/app/Controller/User.php index c8496418..b049c926 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -268,7 +268,7 @@ class User extends Base $this->session->flashError(t('Unable to update this user.')); } - $this->response->redirect($this->helper->url('user', 'share', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('user', 'share', array('user_id' => $user['id']))); } $this->response->html($this->layout('user/share', array( diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index 667c5087..c79b4ed6 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -96,7 +96,7 @@ class Webhook extends Base $this->bitbucketWebhook->setProjectId($this->request->getIntegerParam('project_id')); - $result = $this->bitbucketWebhook->parsePayload(json_decode(@$_POST['payload'], true)); + $result = $this->bitbucketWebhook->parsePayload(json_decode(@$_POST['payload'], true) ?: array()); echo $result ? 'PARSED' : 'IGNORED'; } diff --git a/app/Core/Base.php b/app/Core/Base.php new file mode 100644 index 00000000..cb8e4487 --- /dev/null +++ b/app/Core/Base.php @@ -0,0 +1,110 @@ +<?php + +namespace Core; + +use Pimple\Container; + +/** + * Base class + * + * @package core + * @author Frederic Guillot + * + * @property \Core\Helper $helper + * @property \Core\HttpClient $httpClient + * @property \Core\Paginator $paginator + * @property \Core\Request $request + * @property \Core\Session $session + * @property \Core\Template $template + * @property \Integration\BitbucketWebhook $bitbucketWebhook + * @property \Integration\GithubWebhook $githubWebhook + * @property \Integration\GitlabWebhook $gitlabWebhook + * @property \Integration\HipchatWebhook $hipchatWebhook + * @property \Integration\Jabber $jabber + * @property \Integration\MailgunWebhook $mailgunWebhook + * @property \Integration\PostmarkWebhook $postmarkWebhook + * @property \Integration\SendgridWebhook $sendgridWebhook + * @property \Integration\SlackWebhook $slackWebhook + * @property \Model\Acl $acl + * @property \Model\Action $action + * @property \Model\Authentication $authentication + * @property \Model\Board $board + * @property \Model\Budget $budget + * @property \Model\Category $category + * @property \Model\Color $color + * @property \Model\Comment $comment + * @property \Model\Config $config + * @property \Model\Currency $currency + * @property \Model\DateParser $dateParser + * @property \Model\File $file + * @property \Model\HourlyRate $hourlyRate + * @property \Model\LastLogin $lastLogin + * @property \Model\Link $link + * @property \Model\Notification $notification + * @property \Model\Project $project + * @property \Model\ProjectActivity $projectActivity + * @property \Model\ProjectAnalytic $projectAnalytic + * @property \Model\ProjectDuplication $projectDuplication + * @property \Model\ProjectDailySummary $projectDailySummary + * @property \Model\ProjectIntegration $projectIntegration + * @property \Model\ProjectPermission $projectPermission + * @property \Model\Subtask $subtask + * @property \Model\SubtaskExport $subtaskExport + * @property \Model\SubtaskForecast $subtaskForecast + * @property \Model\SubtaskTimeTracking $subtaskTimeTracking + * @property \Model\Swimlane $swimlane + * @property \Model\Task $task + * @property \Model\TaskCreation $taskCreation + * @property \Model\TaskDuplication $taskDuplication + * @property \Model\TaskExport $taskExport + * @property \Model\TaskFinder $taskFinder + * @property \Model\TaskFilter $taskFilter + * @property \Model\TaskLink $taskLink + * @property \Model\TaskModification $taskModification + * @property \Model\TaskPermission $taskPermission + * @property \Model\TaskPosition $taskPosition + * @property \Model\TaskStatus $taskStatus + * @property \Model\TaskValidator $taskValidator + * @property \Model\Timetable $timetable + * @property \Model\TimetableDay $timetableDay + * @property \Model\TimetableExtra $timetableExtra + * @property \Model\TimetableOff $timetableOff + * @property \Model\TimetableWeek $timetableWeek + * @property \Model\Transition $transition + * @property \Model\User $user + * @property \Model\UserSession $userSession + * @property \Model\Webhook $webhook + */ +abstract class Base +{ + /** + * 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]; + } +} diff --git a/app/Core/FileCache.php b/app/Core/FileCache.php deleted file mode 100644 index 2037f271..00000000 --- a/app/Core/FileCache.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -namespace Core; - -class FileCache extends Cache -{ - const CACHE_FOLDER = 'data/cache/'; - - public function init() - { - if (! is_dir(self::CACHE_FOLDER)) { - mkdir(self::CACHE_FOLDER); - } - } - - public function set($key, $value) - { - file_put_contents(self::CACHE_FOLDER.$key, json_encode($value)); - } - - public function get($key) - { - if (file_exists(self::CACHE_FOLDER.$key)) { - return json_decode(file_get_contents(self::CACHE_FOLDER.$key), true); - } - - return null; - } - - public function flush() - { - foreach (glob(self::CACHE_FOLDER.'*') as $filename) { - @unlink($filename); - } - } - - public function remove($key) - { - @unlink(self::CACHE_FOLDER.$key); - } -} diff --git a/app/Core/Helper.php b/app/Core/Helper.php index 12557e45..53084a7e 100644 --- a/app/Core/Helper.php +++ b/app/Core/Helper.php @@ -2,105 +2,49 @@ namespace Core; -use Pimple\Container; - /** - * Template helpers + * Helper base class * * @package core * @author Frederic Guillot * - * @property \Core\Session $session - * @property \Model\Acl $acl - * @property \Model\Config $config - * @property \Model\User $user - * @property \Model\UserSession $userSession + * @property \Helper\App $app + * @property \Helper\Asset $asset + * @property \Helper\Datetime $datetime + * @property \Helper\File $file + * @property \Helper\Form $form + * @property \Helper\Subtask $subtask + * @property \Helper\Task $task + * @property \Helper\Text $text + * @property \Helper\Url $url + * @property \Helper\User $user */ -class Helper +class Helper extends Base { /** - * Container instance - * - * @access protected - * @var \Pimple\Container - */ - protected $container; - - /** - * Constructor + * Helper instances * - * @access public - * @param \Pimple\Container $container + * @static + * @access private + * @var array */ - public function __construct(Container $container) - { - $this->container = $container; - } + private static $helpers = array(); /** - * Load automatically models + * Load automatically helpers * * @access public - * @param string $name Model name + * @param string $name Helper name * @return mixed */ public function __get($name) { - return $this->container[$name]; - } - - /** - * Get the age of an item in quasi human readable format. - * It's in this format: <1h , NNh, NNd - * - * @access public - * @param integer $timestamp Unix timestamp of the artifact for which age will be calculated - * @param integer $now Compare with this timestamp (Default value is the current unix timestamp) - * @return string - */ - public function getTaskAge($timestamp, $now = null) - { - if ($now === null) { - $now = time(); - } - - $diff = $now - $timestamp; - - if ($diff < 3600) { - return t('<1h'); - } - else if ($diff < 86400) { - return t('%dh', $diff / 3600); + if (! isset(self::$helpers[$name])) { + $class = '\Helper\\'.ucfirst($name); + self::$helpers[$name] = new $class($this->container); } - return t('%dd', ($now - $timestamp) / 86400); - } - - /** - * Proxy cache helper for acl::isManagerActionAllowed() - * - * @access public - * @param integer $project_id - * @return boolean - */ - public function isManager($project_id) - { - if ($this->userSession->isAdmin()) { - return true; - } - - return $this->container['memoryCache']->proxy('acl', 'isManagerActionAllowed', $project_id); - } - - /** - * 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); + return self::$helpers[$name]; } /** @@ -113,688 +57,4 @@ class Helper { 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 - * @param boolean $is_file Add file timestamp - * @param string $media Media - * @return string - */ - public function css($filename, $is_file = true, $media = 'screen') - { - return '<link rel="stylesheet" href="'.$filename.($is_file ? '?'.filemtime($filename) : '').'" media="'.$media.'">'; - } - - /** - * 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(), array $attributes = array(), $class = '') - { - $html = '<select name="'.$name.'" id="form-'.$name.'" class="'.$class.'" '.implode(' ', $attributes).'>'; - - 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 ? 'checked="checked"' : '').'> '.$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>'; - } - - /** - * Generate controller/action url for templates - * - * 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) - { - $values = array( - 'controller' => $controller, - 'action' => $action, - ); - - if ($csrf) { - $params['csrf_token'] = Security::getCSRFToken(); - } - - $values += $params; - - return '?'.http_build_query($values, '', '&'); - } - - /** - * Generate controller/action url - * - * l('task', 'show', array('task_id' => $task_id)) - * - * @param string $controller Controller name - * @param string $action Action name - * @param array $params Url parameters - * @return string - */ - public function url($controller, $action, array $params = array()) - { - $values = array( - 'controller' => $controller, - 'action' => $action, - ); - - $values += $params; - - return '?'.http_build_query($values); - } - - /** - * Markdown transformation - * - * @param string $text Markdown content - * @param array $link Link parameters for replacement - * @return string - */ - public function markdown($text, array $link = array()) - { - $parser = new Markdown($link, $this); - $parser->setMarkupEscaped(MARKDOWN_ESCAPE_HTML); - return $parser->text($text); - } - - /** - * Get the current URL without the querystring - * - * @return string - */ - public function getCurrentBaseUrl() - { - $application_url = $this->config->get('application_url'); - - if (! empty($application_url)) { - return $application_url; - } - - $self = str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])); - - $url = Request::isHTTPS() ? 'https://' : 'http://'; - $url .= $_SERVER['SERVER_NAME']; - $url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT']; - $url .= $self !== '/' ? $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; - } - - /** - * Get javascript language code - * - * @access public - * @return string - */ - public function jsLang() - { - return $this->config->getJsLanguageCode(); - } - - /** - * Get current timezone - * - * @access public - * @return string - */ - public function getTimezone() - { - return $this->config->getCurrentTimezone(); - } - - /** - * Get the link to toggle subtask status - * - * @access public - * @param array $subtask - * @param string $redirect - * @return string - */ - public function toggleSubtaskStatus(array $subtask, $redirect) - { - if ($subtask['status'] == 0 && isset($this->session['has_subtask_inprogress']) && $this->session['has_subtask_inprogress'] === true) { - - return $this->a( - trim($this->render('subtask/icons', array('subtask' => $subtask))) . $this->e($subtask['title']), - 'subtask', - 'subtaskRestriction', - array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'redirect' => $redirect), - false, - 'popover task-board-popover' - ); - } - - return $this->a( - trim($this->render('subtask/icons', array('subtask' => $subtask))) . $this->e($subtask['title']), - 'subtask', - 'toggleStatus', - array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'redirect' => $redirect) - ); - } - - /** - * Get all hours for day - * - * @access public - * @return array - */ - public function getDayHours() - { - $values = array(); - - foreach (range(0, 23) as $hour) { - foreach (array(0, 30) as $minute) { - $time = sprintf('%02d:%02d', $hour, $minute); - $values[$time] = $time; - } - } - - return $values; - } - - /** - * Get all days of a week - * - * @access public - * @return array - */ - public function getWeekDays() - { - $values = array(); - - foreach (range(1, 7) as $day) { - $values[$day] = $this->getWeekDay($day); - } - - return $values; - } - - /** - * Get the localized day name from the day number - * - * @access public - * @param integer $day Day number - * @return string - */ - public function getWeekDay($day) - { - return dt('%A', strtotime('next Monday +'.($day - 1).' days')); - } - - /** - * Get file icon - * - * @access public - * @param string $filename Filename - * @return string Font-Awesome-Icon-Name - */ - public function getFileIcon($filename){ - - $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - - switch ($extension) { - case 'jpeg': - case 'jpg': - case 'png': - case 'gif': - return 'fa-file-image-o'; - case 'xls': - case 'xlsx': - return 'fa-file-excel-o'; - case 'doc': - case 'docx': - return 'fa-file-word-o'; - case 'ppt': - case 'pptx': - return 'fa-file-powerpoint-o'; - case 'zip': - case 'rar': - return 'fa-file-archive-o'; - case 'mp3': - return 'fa-audio-o'; - case 'avi': - return 'fa-video-o'; - case 'php': - case 'html': - case 'css': - return 'fa-code-o'; - case 'pdf': - return 'fa-file-pdf-o'; - } - - return 'fa-file-o'; - } - - /** - * Display gravatar image - * - * @access public - * @param string $email - * @param string $alt - * @return string - */ - public function avatar($email, $alt = '') - { - if (! empty($email) && $this->config->get('integration_gravatar') == 1) { - return '<img class="avatar" src="https://www.gravatar.com/avatar/'.md5(strtolower($email)).'?s=25" alt="'.$this->e($alt).'" title="'.$this->e($alt).'">'; - } - - return ''; - } } diff --git a/app/Core/Markdown.php b/app/Core/Markdown.php index 3dd98617..fa4e8080 100644 --- a/app/Core/Markdown.php +++ b/app/Core/Markdown.php @@ -3,6 +3,7 @@ namespace Core; use Parsedown; +use Helper\Url; /** * Specific Markdown rules for Kanboard @@ -15,8 +16,8 @@ class Markdown extends Parsedown { private $link; private $helper; - - public function __construct($link, Helper $helper) + + public function __construct($link, Url $helper) { $this->link = $link; $this->helper = $helper; @@ -29,9 +30,12 @@ class Markdown extends Parsedown // Replace task #123 by a link to the task if (! empty($this->link) && preg_match('!#(\d+)!i', $Excerpt['text'], $matches)) { - $url = $this->helper->u($this->link['controller'], - $this->link['action'], - $this->link['params'] + array('task_id' => $matches[1])); + $url = $this->helper->href( + $this->link['controller'], + $this->link['action'], + $this->link['params'] + array('task_id' => $matches[1]) + ); + return array( 'extent' => strlen($matches[0]), 'element' => array( diff --git a/app/Core/Paginator.php b/app/Core/Paginator.php index 4d4364dd..12cc05a1 100644 --- a/app/Core/Paginator.php +++ b/app/Core/Paginator.php @@ -349,7 +349,7 @@ class Paginator $html = '<span class="pagination-previous">'; if ($this->offset > 0) { - $html .= $this->container['helper']->a( + $html .= $this->container['helper']->url->link( '← '.t('Previous'), $this->controller, $this->action, @@ -376,7 +376,7 @@ class Paginator $html = '<span class="pagination-next">'; if (($this->total - $this->offset) > $this->limit) { - $html .= $this->container['helper']->a( + $html .= $this->container['helper']->url->link( t('Next').' →', $this->controller, $this->action, @@ -451,7 +451,7 @@ class Paginator $direction = $this->direction === 'DESC' ? 'ASC' : 'DESC'; } - return $prefix.$this->container['helper']->a( + return $prefix.$this->container['helper']->url->link( $label, $this->controller, $this->action, diff --git a/app/Helper/App.php b/app/Helper/App.php new file mode 100644 index 00000000..8f591143 --- /dev/null +++ b/app/Helper/App.php @@ -0,0 +1,56 @@ +<?php + +namespace Helper; + +/** + * Application helpers + * + * @package helper + * @author Frederic Guillot + */ +class App extends \Core\Base +{ + /** + * Get javascript language code + * + * @access public + * @return string + */ + public function jsLang() + { + return $this->config->getJsLanguageCode(); + } + + /** + * Get current timezone + * + * @access public + * @return string + */ + public function getTimezone() + { + return $this->config->getCurrentTimezone(); + } + + /** + * Get session flash message + * + * @access public + * @return string + */ + public function flashMessage() + { + $html = ''; + + if (isset($this->session['flash_message'])) { + $html = '<div class="alert alert-success alert-fade-out">'.$this->helper->e($this->session['flash_message']).'</div>'; + unset($this->session['flash_message']); + } + else if (isset($this->session['flash_error_message'])) { + $html = '<div class="alert alert-error">'.$this->helper->e($this->session['flash_error_message']).'</div>'; + unset($this->session['flash_error_message']); + } + + return $html; + } +} diff --git a/app/Helper/Asset.php b/app/Helper/Asset.php new file mode 100644 index 00000000..fe285081 --- /dev/null +++ b/app/Helper/Asset.php @@ -0,0 +1,51 @@ +<?php + +namespace Helper; + +/** + * Assets helpers + * + * @package helper + * @author Frederic Guillot + */ +class Asset extends \Core\Base +{ + /** + * 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 + * @param boolean $is_file Add file timestamp + * @param string $media Media + * @return string + */ + public function css($filename, $is_file = true, $media = 'screen') + { + return '<link rel="stylesheet" href="'.$filename.($is_file ? '?'.filemtime($filename) : '').'" media="'.$media.'">'; + } + + /** + * Get custom css + * + * @access public + * @return string + */ + public function customCss() + { + if ($this->config->get('application_stylesheet')) { + return '<style>'.$this->config->get('application_stylesheet').'</style>'; + } + + return ''; + } +} diff --git a/app/Helper/Datetime.php b/app/Helper/Datetime.php new file mode 100644 index 00000000..3a9c4c48 --- /dev/null +++ b/app/Helper/Datetime.php @@ -0,0 +1,61 @@ +<?php + +namespace Helper; + +/** + * DateTime helpers + * + * @package helper + * @author Frederic Guillot + */ +class Datetime extends \Core\Base +{ + /** + * Get all hours for day + * + * @access public + * @return array + */ + public function getDayHours() + { + $values = array(); + + foreach (range(0, 23) as $hour) { + foreach (array(0, 30) as $minute) { + $time = sprintf('%02d:%02d', $hour, $minute); + $values[$time] = $time; + } + } + + return $values; + } + + /** + * Get all days of a week + * + * @access public + * @return array + */ + public function getWeekDays() + { + $values = array(); + + foreach (range(1, 7) as $day) { + $values[$day] = $this->getWeekDay($day); + } + + return $values; + } + + /** + * Get the localized day name from the day number + * + * @access public + * @param integer $day Day number + * @return string + */ + public function getWeekDay($day) + { + return dt('%A', strtotime('next Monday +'.($day - 1).' days')); + } +} diff --git a/app/Helper/File.php b/app/Helper/File.php new file mode 100644 index 00000000..a35e4283 --- /dev/null +++ b/app/Helper/File.php @@ -0,0 +1,56 @@ +<?php + +namespace Helper; + +/** + * File helpers + * + * @package helper + * @author Frederic Guillot + */ +class File extends \Core\Base +{ + /** + * Get file icon + * + * @access public + * @param string $filename Filename + * @return string Font-Awesome-Icon-Name + */ + public function icon($filename){ + + $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); + + switch ($extension) { + case 'jpeg': + case 'jpg': + case 'png': + case 'gif': + return 'fa-file-image-o'; + case 'xls': + case 'xlsx': + return 'fa-file-excel-o'; + case 'doc': + case 'docx': + return 'fa-file-word-o'; + case 'ppt': + case 'pptx': + return 'fa-file-powerpoint-o'; + case 'zip': + case 'rar': + return 'fa-file-archive-o'; + case 'mp3': + return 'fa-audio-o'; + case 'avi': + return 'fa-video-o'; + case 'php': + case 'html': + case 'css': + return 'fa-code-o'; + case 'pdf': + return 'fa-file-pdf-o'; + } + + return 'fa-file-o'; + } +} diff --git a/app/Helper/Form.php b/app/Helper/Form.php new file mode 100644 index 00000000..83e3b113 --- /dev/null +++ b/app/Helper/Form.php @@ -0,0 +1,323 @@ +<?php + +namespace Helper; + +use Core\Security; + +/** + * Form helpers + * + * @package helper + * @author Frederic Guillot + */ +class Form extends \Core\Base +{ + /** + * Hidden CSRF token field + * + * @access public + * @return string + */ + public function csrf() + { + return '<input type="hidden" name="csrf_token" value="'.Security::getCSRFToken().'"/>'; + } + + /** + * Display a hidden form field + * + * @access public + * @param string $name Field name + * @param array $values Form values + * @return string + */ + public function hidden($name, array $values = array()) + { + return '<input type="hidden" name="'.$name.'" id="form-'.$name.'" '.$this->formValue($values, $name).'/>'; + } + + /** + * Display a select field + * + * @access public + * @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 select($name, array $options, array $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + $html = '<select name="'.$name.'" id="form-'.$name.'" class="'.$class.'" '.implode(' ', $attributes).'>'; + + foreach ($options as $id => $value) { + + $html .= '<option value="'.$this->helper->e($id).'"'; + + if (isset($values->$name) && $id == $values->$name) $html .= ' selected="selected"'; + if (isset($values[$name]) && $id == $values[$name]) $html .= ' selected="selected"'; + + $html .= '>'.$this->helper->e($value).'</option>'; + } + + $html .= '</select>'; + $html .= $this->errorList($errors, $name); + + return $html; + } + + /** + * Display a radio field group + * + * @access public + * @param string $name Field name + * @param array $options Options + * @param array $values Form values + * @return string + */ + public function radios($name, array $options, array $values = array()) + { + $html = ''; + + foreach ($options as $value => $label) { + $html .= $this->radio($name, $label, $value, isset($values[$name]) && $values[$name] == $value); + } + + return $html; + } + + /** + * Display a radio field + * + * @access public + * @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 radio($name, $label, $value, $selected = false, $class = '') + { + return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.$this->helper->e($value).'" '.($selected ? 'checked="checked"' : '').'> '.$this->helper->e($label).'</label>'; + } + + /** + * Display a checkbox field + * + * @access public + * @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 checkbox($name, $label, $value, $checked = false, $class = '') + { + return '<label><input type="checkbox" name="'.$name.'" class="'.$class.'" value="'.$this->helper->e($value).'" '.($checked ? 'checked="checked"' : '').'> '.$this->helper->e($label).'</label>'; + } + + /** + * Display a form label + * + * @access public + * @param string $name Field name + * @param string $label Form label + * @param array $attributes HTML attributes + * @return string + */ + public function label($label, $name, array $attributes = array()) + { + return '<label for="form-'.$name.'" '.implode(' ', $attributes).'>'.$this->helper->e($label).'</label>'; + } + + /** + * Display a textarea + * + * @access public + * @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 textarea($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->helper->e($values->$name) : isset($values[$name]) ? $values[$name] : ''; + $html .= '</textarea>'; + $html .= $this->errorList($errors, $name); + + return $html; + } + + /** + * Display a input field + * + * @access public + * @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 input($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 + * + * @access public + * @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 text($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->input('text', $name, $values, $errors, $attributes, $class); + } + + /** + * Display a password field + * + * @access public + * @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 password($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->input('password', $name, $values, $errors, $attributes, $class); + } + + /** + * Display an email field + * + * @access public + * @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 email($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->input('email', $name, $values, $errors, $attributes, $class); + } + + /** + * Display a number field + * + * @access public + * @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 number($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->input('number', $name, $values, $errors, $attributes, $class); + } + + /** + * Display a numeric field (allow decimal number) + * + * @access public + * @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 numeric($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') + { + return $this->input('text', $name, $values, $errors, $attributes, $class.' form-numeric'); + } + + /** + * Display the form error class + * + * @access private + * @param array $errors Error list + * @param string $name Field name + * @return string + */ + private function errorClass(array $errors, $name) + { + return ! isset($errors[$name]) ? '' : ' form-error'; + } + + /** + * Display a list of form errors + * + * @access private + * @param array $errors List of errors + * @param string $name Field name + * @return string + */ + private function errorList(array $errors, $name) + { + $html = ''; + + if (isset($errors[$name])) { + + $html .= '<ul class="form-errors">'; + + foreach ($errors[$name] as $error) { + $html .= '<li>'.$this->helper->e($error).'</li>'; + } + + $html .= '</ul>'; + } + + return $html; + } + + /** + * Get an escaped form value + * + * @access private + * @param mixed $values Values + * @param string $name Field name + * @return string + */ + private function formValue($values, $name) + { + if (isset($values->$name)) { + return 'value="'.$this->helper->e($values->$name).'"'; + } + + return isset($values[$name]) ? 'value="'.$this->helper->e($values[$name]).'"' : ''; + } +} diff --git a/app/Helper/Subtask.php b/app/Helper/Subtask.php new file mode 100644 index 00000000..6348ebd1 --- /dev/null +++ b/app/Helper/Subtask.php @@ -0,0 +1,42 @@ +<?php + +namespace Helper; + +/** + * Subtask helpers + * + * @package helper + * @author Frederic Guillot + */ +class Subtask extends \Core\Base +{ + /** + * Get the link to toggle subtask status + * + * @access public + * @param array $subtask + * @param string $redirect + * @return string + */ + public function toggleStatus(array $subtask, $redirect) + { + if ($subtask['status'] == 0 && isset($this->session['has_subtask_inprogress']) && $this->session['has_subtask_inprogress'] === true) { + + return $this->helper->url->link( + trim($this->template->render('subtask/icons', array('subtask' => $subtask))) . $this->helper->e($subtask['title']), + 'subtask', + 'subtaskRestriction', + array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'redirect' => $redirect), + false, + 'popover task-board-popover' + ); + } + + return $this->helper->url->link( + trim($this->template->render('subtask/icons', array('subtask' => $subtask))) . $this->helper->e($subtask['title']), + 'subtask', + 'toggleStatus', + array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'redirect' => $redirect) + ); + } +} diff --git a/app/Helper/Task.php b/app/Helper/Task.php new file mode 100644 index 00000000..b3931cdb --- /dev/null +++ b/app/Helper/Task.php @@ -0,0 +1,59 @@ +<?php + +namespace Helper; + +/** + * Task helpers + * + * @package helper + * @author Frederic Guillot + */ +class Task extends \Core\Base +{ + /** + * Get the age of an item in quasi human readable format. + * It's in this format: <1h , NNh, NNd + * + * @access public + * @param integer $timestamp Unix timestamp of the artifact for which age will be calculated + * @param integer $now Compare with this timestamp (Default value is the current unix timestamp) + * @return string + */ + public function age($timestamp, $now = null) + { + if ($now === null) { + $now = time(); + } + + $diff = $now - $timestamp; + + if ($diff < 3600) { + return t('<1h'); + } + else if ($diff < 86400) { + return t('%dh', $diff / 3600); + } + + return t('%dd', ($now - $timestamp) / 86400); + } + + public function recurrenceTriggers() + { + return $this->task->getRecurrenceTriggerList(); + } + + public function recurrenceTimeframes() + { + return $this->task->getRecurrenceTimeframeList(); + } + + public function recurrenceBasedates() + { + return $this->task->getRecurrenceBasedateList(); + } + + public function canRemove(array $task) + { + return $this->taskPermission->canRemoveTask($task); + } +} diff --git a/app/Helper/Text.php b/app/Helper/Text.php new file mode 100644 index 00000000..cfb557b1 --- /dev/null +++ b/app/Helper/Text.php @@ -0,0 +1,91 @@ +<?php + +namespace Helper; + +use Core\Markdown; + +/** + * Text helpers + * + * @package helper + * @author Frederic Guillot + */ +class Text extends \Core\Base +{ + /** + * Markdown transformation + * + * @param string $text Markdown content + * @param array $link Link parameters for replacement + * @return string + */ + public function markdown($text, array $link = array()) + { + $parser = new Markdown($link, $this->helper->url); + $parser->setMarkupEscaped(MARKDOWN_ESCAPE_HTML); + return $parser->text($text); + } + + /** + * Format a file size + * + * @param integer $size Size in bytes + * @param integer $precision Precision + * @return string + */ + public function 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 + */ + public function truncate($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 in($id, array $listing, $default_value = '?') + { + if (isset($listing[$id])) { + return $this->helper->e($listing[$id]); + } + + return $default_value; + } +} diff --git a/app/Helper/Url.php b/app/Helper/Url.php new file mode 100644 index 00000000..9bb38e59 --- /dev/null +++ b/app/Helper/Url.php @@ -0,0 +1,115 @@ +<?php + +namespace Helper; + +use Core\Request; +use Core\Security; + +/** + * Url helpers + * + * @package helper + * @author Frederic Guillot + */ +class Url extends \Core\Base +{ + /** + * HTML Link tag + * + * @access public + * @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 link($label, $controller, $action, array $params = array(), $csrf = false, $class = '', $title = '', $new_tab = false) + { + return '<a href="'.$this->href($controller, $action, $params, $csrf).'" class="'.$class.'" title="'.$title.'" '.($new_tab ? 'target="_blank"' : '').'>'.$label.'</a>'; + } + + /** + * Hyperlink + * + * @access public + * @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 href($controller, $action, array $params = array(), $csrf = false) + { + $values = array( + 'controller' => $controller, + 'action' => $action, + ); + + if ($csrf) { + $params['csrf_token'] = Security::getCSRFToken(); + } + + $values += $params; + + return '?'.http_build_query($values, '', '&'); + } + + /** + * Generate controller/action url + * + * @access public + * @param string $controller Controller name + * @param string $action Action name + * @param array $params Url parameters + * @return string + */ + public function to($controller, $action, array $params = array()) + { + $values = array( + 'controller' => $controller, + 'action' => $action, + ); + + $values += $params; + + return '?'.http_build_query($values, '', '&'); + } + + /** + * Get application base url + * + * @access public + * @return string + */ + public function base() + { + $application_url = $this->config->get('application_url'); + + if (! empty($application_url)) { + return $application_url; + } + + return $this->server(); + } + + /** + * Get current server base url + * + * @access public + * @return string + */ + public function server() + { + $self = str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])); + + $url = Request::isHTTPS() ? 'https://' : 'http://'; + $url .= $_SERVER['SERVER_NAME']; + $url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT']; + $url .= $self !== '/' ? $self.'/' : '/'; + + return $url; + } +} diff --git a/app/Helper/User.php b/app/Helper/User.php new file mode 100644 index 00000000..00018857 --- /dev/null +++ b/app/Helper/User.php @@ -0,0 +1,93 @@ +<?php + +namespace Helper; + +/** + * User helpers + * + * @package helper + * @author Frederic Guillot + */ +class User extends \Core\Base +{ + /** + * Get user profile + * + * @access public + * @return string + */ + public function getProfileLink() + { + return $this->helper->url->link( + $this->helper->e($this->getFullname()), + 'user', + 'show', + array('user_id' => $this->userSession->getId()) + ); + } + /** + * 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->userSession->getId() == $user_id; + } + + /** + * Return if the logged user is admin + * + * @access public + * @return boolean + */ + public function isAdmin() + { + return $this->userSession->isAdmin(); + } + + /** + * Proxy cache helper for acl::isManagerActionAllowed() + * + * @access public + * @param integer $project_id + * @return boolean + */ + public function isManager($project_id) + { + if ($this->userSession->isAdmin()) { + return true; + } + + return $this->memoryCache->proxy('acl', 'isManagerActionAllowed', $project_id); + } + + /** + * 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); + } + + /** + * Display gravatar image + * + * @access public + * @param string $email + * @param string $alt + * @return string + */ + public function avatar($email, $alt = '') + { + if (! empty($email) && $this->config->get('integration_gravatar') == 1) { + return '<img class="avatar" src="https://www.gravatar.com/avatar/'.md5(strtolower($email)).'?s=25" alt="'.$this->helper->e($alt).'" title="'.$this->helper->e($alt).'">'; + } + + return ''; + } +} diff --git a/app/Integration/Base.php b/app/Integration/Base.php deleted file mode 100644 index dbb0349a..00000000 --- a/app/Integration/Base.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -namespace Integration; - -use Pimple\Container; - -/** - * Base class - * - * @package integration - * @author Frederic Guillot - * - * @property \Model\ProjectActivity $projectActivity - * @property \Model\ProjectIntegration $projectIntegration - * @property \Model\ProjectPermission $projectPermission - * @property \Model\Task $task - * @property \Model\TaskFinder $taskFinder - * @property \Model\User $user - * @property \Model\Project $project - */ -abstract class Base -{ - /** - * 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 class from the container - * - * @access public - * @param string $name - * @return mixed - */ - public function __get($name) - { - return $this->container[$name]; - } -} diff --git a/app/Integration/BitbucketWebhook.php b/app/Integration/BitbucketWebhook.php index 7ff8087e..75fc1c81 100644 --- a/app/Integration/BitbucketWebhook.php +++ b/app/Integration/BitbucketWebhook.php @@ -11,7 +11,7 @@ use Model\Task; * @package integration * @author Frederic Guillot */ -class BitbucketWebhook extends Base +class BitbucketWebhook extends \Core\Base { /** * Events diff --git a/app/Integration/GithubWebhook.php b/app/Integration/GithubWebhook.php index 0070c309..d95eba78 100644 --- a/app/Integration/GithubWebhook.php +++ b/app/Integration/GithubWebhook.php @@ -11,7 +11,7 @@ use Model\Task; * @package integration * @author Frederic Guillot */ -class GithubWebhook extends Base +class GithubWebhook extends \Core\Base { /** * Events diff --git a/app/Integration/GitlabWebhook.php b/app/Integration/GitlabWebhook.php index e30a0b50..8a11f5c6 100644 --- a/app/Integration/GitlabWebhook.php +++ b/app/Integration/GitlabWebhook.php @@ -12,7 +12,7 @@ use Model\Task; * @package integration * @author Frederic Guillot */ -class GitlabWebhook extends Base +class GitlabWebhook extends \Core\Base { /** * Events diff --git a/app/Integration/HipchatWebhook.php b/app/Integration/HipchatWebhook.php index 03b85232..59190959 100644 --- a/app/Integration/HipchatWebhook.php +++ b/app/Integration/HipchatWebhook.php @@ -8,7 +8,7 @@ namespace Integration; * @package integration * @author Frederic Guillot */ -class HipchatWebhook extends Base +class HipchatWebhook extends \Core\Base { /** * Return true if Hipchat is enabled for this project or globally diff --git a/app/Integration/Jabber.php b/app/Integration/Jabber.php index d6917186..c956cc47 100644 --- a/app/Integration/Jabber.php +++ b/app/Integration/Jabber.php @@ -14,7 +14,7 @@ use Fabiang\Xmpp\Protocol\Presence; * @package integration * @author Frederic Guillot */ -class Jabber extends Base +class Jabber extends \Core\Base { /** * Return true if Jabber is enabled for this project or globally @@ -82,7 +82,7 @@ class Jabber extends Base if ($this->config->get('application_url')) { $payload .= ' '.$this->config->get('application_url'); - $payload .= $this->helper->url('task', 'show', array('task_id' => $task_id, 'project_id' => $project_id)); + $payload .= $this->helper->url->to('task', 'show', array('task_id' => $task_id, 'project_id' => $project_id)); } $this->sendMessage($project_id, $payload); diff --git a/app/Integration/MailgunWebhook.php b/app/Integration/MailgunWebhook.php index 8e542513..50d96a4a 100644 --- a/app/Integration/MailgunWebhook.php +++ b/app/Integration/MailgunWebhook.php @@ -11,7 +11,7 @@ use Core\Tool; * @package integration * @author Frederic Guillot */ -class MailgunWebhook extends Base +class MailgunWebhook extends \Core\Base { /** * Parse incoming email diff --git a/app/Integration/PostmarkWebhook.php b/app/Integration/PostmarkWebhook.php index 642955df..9051e5f7 100644 --- a/app/Integration/PostmarkWebhook.php +++ b/app/Integration/PostmarkWebhook.php @@ -10,7 +10,7 @@ use HTML_To_Markdown; * @package integration * @author Frederic Guillot */ -class PostmarkWebhook extends Base +class PostmarkWebhook extends \Core\Base { /** * Parse incoming email diff --git a/app/Integration/SendgridWebhook.php b/app/Integration/SendgridWebhook.php index 142ed49f..9125f00b 100644 --- a/app/Integration/SendgridWebhook.php +++ b/app/Integration/SendgridWebhook.php @@ -11,7 +11,7 @@ use Core\Tool; * @package integration * @author Frederic Guillot */ -class SendgridWebhook extends Base +class SendgridWebhook extends \Core\Base { /** * Parse incoming email diff --git a/app/Integration/SlackWebhook.php b/app/Integration/SlackWebhook.php index b64096fb..4d2ae3a3 100644 --- a/app/Integration/SlackWebhook.php +++ b/app/Integration/SlackWebhook.php @@ -8,7 +8,7 @@ namespace Integration; * @package integration * @author Frederic Guillot */ -class SlackWebhook extends Base +class SlackWebhook extends \Core\Base { /** * Return true if Slack is enabled for this project or globally diff --git a/app/Model/Base.php b/app/Model/Base.php index dd902bb3..03d0f8f0 100644 --- a/app/Model/Base.php +++ b/app/Model/Base.php @@ -9,51 +9,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 - * @property \Model\Board $board - * @property \Model\Budget $budget - * @property \Model\Category $category - * @property \Model\Comment $comment - * @property \Model\CommentHistory $commentHistory - * @property \Model\Color $color - * @property \Model\Config $config - * @property \Model\DateParser $dateParser - * @property \Model\File $file - * @property \Model\Helper $helper - * @property \Model\LastLogin $lastLogin - * @property \Model\Link $link - * @property \Model\Notification $notification - * @property \Model\Project $project - * @property \Model\ProjectDuplication $projectDuplication - * @property \Model\ProjectPermission $projectPermission - * @property \Model\Subtask $subtask - * @property \Model\SubtaskHistory $subtaskHistory - * @property \Model\Swimlane $swimlane - * @property \Model\Task $task - * @property \Model\TaskCreation $taskCreation - * @property \Model\TaskDuplication $taskDuplication - * @property \Model\TaskExport $taskExport - * @property \Model\TaskFinder $taskFinder - * @property \Model\TaskHistory $taskHistory - * @property \Model\TaskLink $taskLink - * @property \Model\TaskPosition $taskPosition - * @property \Model\TaskValidator $taskValidator - * @property \Model\Timetable $timetable - * @property \Model\TimetableDay $timetableDay - * @property \Model\TimetableExtra $timetableExtra - * @property \Model\TimetableOff $timetableOff - * @property \Model\TimetableWeek $timetableWeek - * @property \Model\SubtaskTimeTracking $subtaskTimeTracking - * @property \Model\User $user - * @property \Model\UserSession $userSession - * @property \Model\Webhook $webhook */ -abstract class Base +abstract class Base extends \Core\Base { /** * Database instance @@ -64,14 +21,6 @@ abstract class Base protected $db; /** - * Container instance - * - * @access protected - * @var \Pimple\Container - */ - protected $container; - - /** * Constructor * * @access public @@ -84,18 +33,6 @@ abstract class Base } /** - * Load automatically models - * - * @access public - * @param string $name Model name - * @return mixed - */ - public function __get($name) - { - return $this->container[$name]; - } - - /** * Save a record in the database * * @access public @@ -203,7 +140,7 @@ abstract class Base 'backgroundColor' => $this->color->getBackgroundColor($task['color_id']), 'borderColor' => $this->color->getBorderColor($task['color_id']), 'textColor' => 'black', - 'url' => $this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + 'url' => $this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), ); } } diff --git a/app/Model/SubtaskForecast.php b/app/Model/SubtaskForecast.php index 0cb3175d..263aa27a 100644 --- a/app/Model/SubtaskForecast.php +++ b/app/Model/SubtaskForecast.php @@ -96,7 +96,7 @@ class SubtaskForecast extends Base 'id' => $subtasks[$offset]['id'].'-'.$subtasks[$offset]['task_id'].'-'.$offset, 'subtask_id' => $subtasks[$offset]['id'], 'title' => t('#%d', $subtasks[$offset]['task_id']).' '.$subtasks[$offset]['title'], - 'url' => $this->helper->url('task', 'show', array('task_id' => $subtasks[$offset]['task_id'], 'project_id' => $subtasks[$offset]['project_id'])), + 'url' => $this->helper->url->to('task', 'show', array('task_id' => $subtasks[$offset]['task_id'], 'project_id' => $subtasks[$offset]['project_id'])), 'editable' => false, 'start' => date('Y-m-d\TH:i:s', $start), ); diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php index 6d4a3467..d4edf660 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTracking.php @@ -196,7 +196,7 @@ class SubtaskTimeTracking extends Base 'backgroundColor' => $this->color->getBackgroundColor($row['color_id']), 'borderColor' => $this->color->getBorderColor($row['color_id']), 'textColor' => 'black', - 'url' => $this->helper->url('task', 'show', array('task_id' => $row['task_id'], 'project_id' => $row['project_id'])), + 'url' => $this->helper->url->to('task', 'show', array('task_id' => $row['task_id'], 'project_id' => $row['project_id'])), 'editable' => false, ); } diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index c4c56800..1fdf0a50 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -450,7 +450,7 @@ class TaskFilter extends Base $vEvent->setModified($dateModif); $vEvent->setUseTimezone(true); $vEvent->setSummary(t('#%d', $task['id']).' '.$task['title']); - $vEvent->setUrl($this->helper->getCurrentBaseUrl().$this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $vEvent->setUrl($this->helper->url->base().$this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); if (! empty($task['creator_id'])) { $vEvent->setOrganizer('MAILTO:'.($task['creator_email'] ?: $task['creator_username'].'@kanboard.local')); diff --git a/app/Model/UserSession.php b/app/Model/UserSession.php index efb02722..6703a1bc 100644 --- a/app/Model/UserSession.php +++ b/app/Model/UserSession.php @@ -86,17 +86,6 @@ class UserSession extends Base } /** - * 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->getId() == $user_id; - } - - /** * Check is the user is connected * * @access public diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php index c016b7eb..ced7c7c6 100644 --- a/app/ServiceProvider/ClassProvider.php +++ b/app/ServiceProvider/ClassProvider.php @@ -55,9 +55,9 @@ class ClassProvider implements ServiceProviderInterface 'TaskValidator', 'Timetable', 'TimetableDay', + 'TimetableExtra', 'TimetableWeek', 'TimetableOff', - 'TimetableExtra', 'Transition', 'User', 'UserSession', @@ -65,23 +65,22 @@ class ClassProvider implements ServiceProviderInterface ), 'Core' => array( 'Helper', - 'Template', - 'Session', + 'HttpClient', 'MemoryCache', - 'FileCache', 'Request', - 'HttpClient', + 'Session', + 'Template', ), 'Integration' => array( - 'GitlabWebhook', - 'GithubWebhook', 'BitbucketWebhook', + 'GithubWebhook', + 'GitlabWebhook', 'HipchatWebhook', + 'Jabber', 'MailgunWebhook', + 'PostmarkWebhook', 'SendgridWebhook', 'SlackWebhook', - 'PostmarkWebhook', - 'Jabber', ) ); diff --git a/app/Subscriber/AuthSubscriber.php b/app/Subscriber/AuthSubscriber.php index 161a7afd..b814057f 100644 --- a/app/Subscriber/AuthSubscriber.php +++ b/app/Subscriber/AuthSubscriber.php @@ -6,7 +6,7 @@ use Core\Request; use Event\AuthEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class AuthSubscriber extends Base implements EventSubscriberInterface +class AuthSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/Base.php b/app/Subscriber/Base.php deleted file mode 100644 index 10040626..00000000 --- a/app/Subscriber/Base.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -namespace Subscriber; - -use Pimple\Container; - -/** - * Base subscriber class - * - * @package subscriber - * @author Frederic Guillot - * - * @property \Integration\SlackWebhook $slackWebhook - * @property \Integration\HipchatWebhook $hipchatWebhook - * @property \Model\Board $board - * @property \Model\Config $config - * @property \Model\Comment $comment - * @property \Model\LastLogin $lastLogin - * @property \Model\Notification $notification - * @property \Model\Project $project - * @property \Model\ProjectPermission $projectPermission - * @property \Model\ProjectActivity $projectActivity - * @property \Model\ProjectAnalytic $projectAnalytic - * @property \Model\ProjectDailySummary $projectDailySummary - * @property \Model\Subtask $subtask - * @property \Model\Task $task - * @property \Model\TaskDuplication $taskDuplication - * @property \Model\TaskExport $taskExport - * @property \Model\TaskFinder $taskFinder - * @property \Model\SubtaskTimeTracking $subtaskTimeTracking - * @property \Model\UserSession $userSession - * @property \Model\Webhook $webhook - */ -abstract class Base -{ - /** - * 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]; - } -} diff --git a/app/Subscriber/BootstrapSubscriber.php b/app/Subscriber/BootstrapSubscriber.php index 35d0eff9..793ba3e7 100644 --- a/app/Subscriber/BootstrapSubscriber.php +++ b/app/Subscriber/BootstrapSubscriber.php @@ -4,7 +4,7 @@ namespace Subscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class BootstrapSubscriber extends Base implements EventSubscriberInterface +class BootstrapSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php index 09ca7625..92d46754 100644 --- a/app/Subscriber/NotificationSubscriber.php +++ b/app/Subscriber/NotificationSubscriber.php @@ -9,7 +9,7 @@ use Model\Subtask; use Model\File; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class NotificationSubscriber extends Base implements EventSubscriberInterface +class NotificationSubscriber extends \Core\Base implements EventSubscriberInterface { private $templates = array( Task::EVENT_CREATE => 'task_creation', diff --git a/app/Subscriber/ProjectActivitySubscriber.php b/app/Subscriber/ProjectActivitySubscriber.php index 8988d6c1..31f771f8 100644 --- a/app/Subscriber/ProjectActivitySubscriber.php +++ b/app/Subscriber/ProjectActivitySubscriber.php @@ -8,7 +8,7 @@ use Model\Comment; use Model\Subtask; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class ProjectActivitySubscriber extends Base implements EventSubscriberInterface +class ProjectActivitySubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/ProjectDailySummarySubscriber.php b/app/Subscriber/ProjectDailySummarySubscriber.php index f865c036..9e4f15b0 100644 --- a/app/Subscriber/ProjectDailySummarySubscriber.php +++ b/app/Subscriber/ProjectDailySummarySubscriber.php @@ -6,7 +6,7 @@ use Event\TaskEvent; use Model\Task; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class ProjectDailySummarySubscriber extends Base implements EventSubscriberInterface +class ProjectDailySummarySubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/ProjectModificationDateSubscriber.php b/app/Subscriber/ProjectModificationDateSubscriber.php index 4c5380ff..2c01173b 100644 --- a/app/Subscriber/ProjectModificationDateSubscriber.php +++ b/app/Subscriber/ProjectModificationDateSubscriber.php @@ -6,7 +6,7 @@ use Event\GenericEvent; use Model\Task; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class ProjectModificationDateSubscriber extends Base implements EventSubscriberInterface +class ProjectModificationDateSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/RecurringTaskSubscriber.php b/app/Subscriber/RecurringTaskSubscriber.php index 87418814..68d704f0 100644 --- a/app/Subscriber/RecurringTaskSubscriber.php +++ b/app/Subscriber/RecurringTaskSubscriber.php @@ -6,7 +6,7 @@ use Event\TaskEvent; use Model\Task; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class RecurringTaskSubscriber extends Base implements EventSubscriberInterface +class RecurringTaskSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/SubtaskTimesheetSubscriber.php b/app/Subscriber/SubtaskTimesheetSubscriber.php index acae9a4b..fdaf442f 100644 --- a/app/Subscriber/SubtaskTimesheetSubscriber.php +++ b/app/Subscriber/SubtaskTimesheetSubscriber.php @@ -6,7 +6,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Model\Subtask; use Event\SubtaskEvent; -class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterface +class SubtaskTimesheetSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/TaskMovedDateSubscriber.php b/app/Subscriber/TaskMovedDateSubscriber.php index 0e36acfa..eb04d62c 100644 --- a/app/Subscriber/TaskMovedDateSubscriber.php +++ b/app/Subscriber/TaskMovedDateSubscriber.php @@ -6,7 +6,7 @@ use Event\TaskEvent; use Model\Task; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class TaskMovedDateSubscriber extends Base implements EventSubscriberInterface +class TaskMovedDateSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/TransitionSubscriber.php b/app/Subscriber/TransitionSubscriber.php index 347dd37d..5804dab7 100644 --- a/app/Subscriber/TransitionSubscriber.php +++ b/app/Subscriber/TransitionSubscriber.php @@ -6,7 +6,7 @@ use Event\TaskEvent; use Model\Task; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class TransitionSubscriber extends Base implements EventSubscriberInterface +class TransitionSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Subscriber/WebhookSubscriber.php b/app/Subscriber/WebhookSubscriber.php index e28675bd..5176a7ff 100644 --- a/app/Subscriber/WebhookSubscriber.php +++ b/app/Subscriber/WebhookSubscriber.php @@ -11,7 +11,7 @@ use Model\File; use Model\Subtask; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class WebhookSubscriber extends Base implements EventSubscriberInterface +class WebhookSubscriber extends \Core\Base implements EventSubscriberInterface { public static function getSubscribedEvents() { diff --git a/app/Template/action/event.php b/app/Template/action/event.php index 67a65c19..7f968a97 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="<?= $this->u('action', 'params', array('project_id' => $project['id'])) ?>"> +<form method="post" action="<?= $this->url->href('action', 'params', array('project_id' => $project['id'])) ?>"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('project_id', $values) ?> - <?= $this->formHidden('action_name', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> + <?= $this->form->hidden('action_name', $values) ?> - <?= $this->formLabel(t('Event'), 'event_name') ?> - <?= $this->formSelect('event_name', $events, $values) ?><br/> + <?= $this->form->label(t('Event'), 'event_name') ?> + <?= $this->form->select('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') ?> - <?= $this->a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(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 e388fbc9..9e98554c 100644 --- a/app/Template/action/index.php +++ b/app/Template/action/index.php @@ -15,25 +15,25 @@ <?php foreach ($actions as $action): ?> <tr> - <td><?= $this->inList($action['event_name'], $available_events) ?></td> - <td><?= $this->inList($action['action_name'], $available_actions) ?></td> + <td><?= $this->text->in($action['event_name'], $available_events) ?></td> + <td><?= $this->text->in($action['action_name'], $available_actions) ?></td> <td> <ul> <?php foreach ($action['params'] as $param): ?> <li> - <?= $this->inList($param['name'], $available_params) ?> = + <?= $this->text->in($param['name'], $available_params) ?> = <strong> - <?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')): ?> + <?php if ($this->text->contains($param['name'], 'column_id')): ?> + <?= $this->text->in($param['value'], $columns_list) ?> + <?php elseif ($this->text->contains($param['name'], 'user_id')): ?> + <?= $this->text->in($param['value'], $users_list) ?> + <?php elseif ($this->text->contains($param['name'], 'project_id')): ?> + <?= $this->text->in($param['value'], $projects_list) ?> + <?php elseif ($this->text->contains($param['name'], 'color_id')): ?> + <?= $this->text->in($param['value'], $colors_list) ?> + <?php elseif ($this->text->contains($param['name'], 'category_id')): ?> + <?= $this->text->in($param['value'], $categories_list) ?> + <?php elseif ($this->text->contains($param['name'], 'label')): ?> <?= $this->e($param['value']) ?> <?php endif ?> </strong> @@ -42,7 +42,7 @@ </ul> </td> <td> - <?= $this->a(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id'])) ?> + <?= $this->url->link(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="<?= $this->u('action', 'event', array('project_id' => $project['id'])) ?>" class="listing"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('project_id', $values) ?> +<form method="post" action="<?= $this->url->href('action', 'event', array('project_id' => $project['id'])) ?>" class="listing"> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Action'), 'action_name') ?> - <?= $this->formSelect('action_name', $available_actions, $values) ?><br/> + <?= $this->form->label(t('Action'), 'action_name') ?> + <?= $this->form->select('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 3a5ecb86..685cbcc5 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="<?= $this->u('action', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('action', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('project_id', $values) ?> - <?= $this->formHidden('event_name', $values) ?> - <?= $this->formHidden('action_name', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> + <?= $this->form->hidden('event_name', $values) ?> + <?= $this->form->hidden('action_name', $values) ?> <?php foreach ($action_params as $param_name => $param_desc): ?> - <?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 if ($this->text->contains($param_name, 'column_id')): ?> + <?= $this->form->label($param_desc, $param_name) ?> + <?= $this->form->select('params['.$param_name.']', $columns_list, $values) ?><br/> + <?php elseif ($this->text->contains($param_name, 'user_id')): ?> + <?= $this->form->label($param_desc, $param_name) ?> + <?= $this->form->select('params['.$param_name.']', $users_list, $values) ?><br/> + <?php elseif ($this->text->contains($param_name, 'project_id')): ?> + <?= $this->form->label($param_desc, $param_name) ?> + <?= $this->form->select('params['.$param_name.']', $projects_list, $values) ?><br/> + <?php elseif ($this->text->contains($param_name, 'color_id')): ?> + <?= $this->form->label($param_desc, $param_name) ?> + <?= $this->form->select('params['.$param_name.']', $colors_list, $values) ?><br/> + <?php elseif ($this->text->contains($param_name, 'category_id')): ?> + <?= $this->form->label($param_desc, $param_name) ?> + <?= $this->form->select('params['.$param_name.']', $categories_list, $values) ?><br/> + <?php elseif ($this->text->contains($param_name, 'label')): ?> + <?= $this->form->label($param_desc, $param_name) ?> + <?= $this->form->text('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') ?> - <?= $this->a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(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 672c08a7..c8d4dfe4 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"?', $this->inList($action['event_name'], $available_events).'/'.$this->inList($action['action_name'], $available_actions)) ?> + <?= t('Do you really want to remove this action: "%s"?', $this->text->in($action['event_name'], $available_events).'/'.$this->text->in($action['action_name'], $available_actions)) ?> </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'action', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'action', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/analytic/burndown.php b/app/Template/analytic/burndown.php index 5ebe1032..839573be 100644 --- a/app/Template/analytic/burndown.php +++ b/app/Template/analytic/burndown.php @@ -6,24 +6,24 @@ <p class="alert"><?= t('Not enough data to show the graph.') ?></p> <?php else: ?> <section id="analytic-burndown"> - <div id="chart" data-url="<?= $this->u('analytic', 'burndown', array('project_id' => $project['id'], 'from' => $values['from'], 'to' => $values['to'])) ?>"></div> + <div id="chart" data-url="<?= $this->url->href('analytic', 'burndown', array('project_id' => $project['id'], 'from' => $values['from'], 'to' => $values['to'])) ?>"></div> </section> <?php endif ?> <hr/> -<form method="post" class="form-inline" action="<?= $this->u('analytic', 'burndown', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" class="form-inline" action="<?= $this->url->href('analytic', 'burndown', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> <div class="form-inline-group"> - <?= $this->formLabel(t('Start Date'), 'from') ?> - <?= $this->formText('from', $values, array(), array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('Start Date'), 'from') ?> + <?= $this->form->text('from', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?> </div> <div class="form-inline-group"> - <?= $this->formLabel(t('End Date'), 'to') ?> - <?= $this->formText('to', $values, array(), array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('End Date'), 'to') ?> + <?= $this->form->text('to', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?> </div> <div class="form-inline-group"> diff --git a/app/Template/analytic/cfd.php b/app/Template/analytic/cfd.php index 58115e77..26696b31 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="<?= $this->u('analytic', 'cfd', array('project_id' => $project['id'], 'from' => $values['from'], 'to' => $values['to'])) ?>"></div> + <div id="chart" data-url="<?= $this->url->href('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="<?= $this->u('analytic', 'cfd', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" class="form-inline" action="<?= $this->url->href('analytic', 'cfd', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> <div class="form-inline-group"> - <?= $this->formLabel(t('Start Date'), 'from') ?> - <?= $this->formText('from', $values, array(), array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('Start Date'), 'from') ?> + <?= $this->form->text('from', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?> </div> <div class="form-inline-group"> - <?= $this->formLabel(t('End Date'), 'to') ?> - <?= $this->formText('to', $values, array(), array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('End Date'), 'to') ?> + <?= $this->form->text('to', $values, array(), array('required', 'placeholder="'.$this->text->in($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 c6e3a962..c3a36bdf 100644 --- a/app/Template/analytic/layout.php +++ b/app/Template/analytic/layout.php @@ -1,10 +1,10 @@ -<?= $this->js('assets/js/vendor/d3.v3.4.8.min.js') ?> -<?= $this->js('assets/js/vendor/dimple.v2.1.2.min.js') ?> +<?= $this->asset->js('assets/js/vendor/d3.v3.4.8.min.js') ?> +<?= $this->asset->js('assets/js/vendor/dimple.v2.1.2.min.js') ?> <section id="main"> <div class="page-header"> <ul> - <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-table fa-fw"></i><?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li> </ul> </div> <section class="sidebar-container" id="analytic-section"> diff --git a/app/Template/analytic/sidebar.php b/app/Template/analytic/sidebar.php index f3515281..2d1a7c96 100644 --- a/app/Template/analytic/sidebar.php +++ b/app/Template/analytic/sidebar.php @@ -2,16 +2,16 @@ <h2><?= t('Reportings') ?></h2> <ul> <li> - <?= $this->a(t('Task distribution'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Task distribution'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('User repartition'), 'analytic', 'users', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('User repartition'), 'analytic', 'users', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Cumulative flow diagram'), 'analytic', 'cfd', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Cumulative flow diagram'), 'analytic', 'cfd', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Burndown chart'), 'analytic', 'burndown', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Burndown chart'), 'analytic', 'burndown', 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 b1a08a23..faa4bacc 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="<?= $this->u('analytic', 'tasks', array('project_id' => $project['id'])) ?>"></div> + <div id="chart" data-url="<?= $this->url->href('analytic', 'tasks', array('project_id' => $project['id'])) ?>"></div> <table> <tr> diff --git a/app/Template/analytic/users.php b/app/Template/analytic/users.php index 97328c02..982ef206 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="<?= $this->u('analytic', 'users', array('project_id' => $project['id'])) ?>"></div> + <div id="chart" data-url="<?= $this->url->href('analytic', 'users', array('project_id' => $project['id'])) ?>"></div> <table> <tr> diff --git a/app/Template/app/dashboard.php b/app/Template/app/dashboard.php index a832345b..faf49ef5 100644 --- a/app/Template/app/dashboard.php +++ b/app/Template/app/dashboard.php @@ -1,14 +1,14 @@ <section id="main"> <div class="page-header page-header-mobile"> <ul> - <?php if ($this->userSession->isAdmin()): ?> - <li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New project'), 'project', 'create') ?></li> + <?php if ($this->user->isAdmin()): ?> + <li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New project'), 'project', 'create') ?></li> <?php endif ?> - <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->userSession->isAdmin()): ?> - <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> + <li><i class="fa fa-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'project', 'create', array('private' => 1)) ?></li> + <li><i class="fa fa-folder fa-fw"></i><?= $this->url->link(t('Project management'), 'project', 'index') ?></li> + <?php if ($this->user->isAdmin()): ?> + <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('User management'), 'user', 'index') ?></li> + <li><i class="fa fa-cog fa-fw"></i><?= $this->url->link(t('Settings'), 'config', 'index') ?></li> <?php endif ?> <li> <span class="dropdown"> @@ -45,9 +45,9 @@ <div class="dashboard-right-column"> <div id="dashboard-calendar"> <div id="user-calendar" - data-check-url="<?= $this->u('calendar', 'user') ?>" + data-check-url="<?= $this->url->href('calendar', 'user') ?>" data-user-id="<?= $user_id ?>" - data-save-url="<?= $this->u('calendar', 'save') ?>" + data-save-url="<?= $this->url->href('calendar', 'save') ?>" > </div> </div> diff --git a/app/Template/app/projects.php b/app/Template/app/projects.php index b2744644..90e6e67d 100644 --- a/app/Template/app/projects.php +++ b/app/Template/app/projects.php @@ -11,18 +11,18 @@ <?php foreach ($paginator->getCollection() as $project): ?> <tr> <td> - <?= $this->a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?> + <?= $this->url->link('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?> </td> <td> - <?php if ($this->isManager($project['id'])): ?> - <?= $this->a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?> + <?php if ($this->user->isManager($project['id'])): ?> + <?= $this->url->link('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?> <?php endif ?> - <?= $this->a('<i class="fa fa-calendar"></i>', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?> + <?= $this->url->link('<i class="fa fa-calendar"></i>', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?> - <?= $this->a($this->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link($this->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> <?php if (! empty($project['description'])): ?> - <span class="column-tooltip" title='<?= $this->e($this->markdown($project['description'])) ?>'> + <span class="column-tooltip" title='<?= $this->e($this->text->markdown($project['description'])) ?>'> <i class="fa fa-info-circle"></i> </span> <?php endif ?> diff --git a/app/Template/app/subtasks.php b/app/Template/app/subtasks.php index 487b66fc..5afb71b0 100644 --- a/app/Template/app/subtasks.php +++ b/app/Template/app/subtasks.php @@ -13,16 +13,16 @@ <?php foreach ($paginator->getCollection() as $subtask): ?> <tr> <td class="task-table color-<?= $subtask['color_id'] ?>"> - <?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> + <?= $this->url->link('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> </td> <td> - <?= $this->a($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> + <?= $this->url->link($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> </td> <td> - <?= $this->a($this->e($subtask['task_name']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> + <?= $this->url->link($this->e($subtask['task_name']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> </td> <td> - <?= $this->toggleSubtaskStatus($subtask, 'dashboard') ?> + <?= $this->subtask->toggleStatus($subtask, 'dashboard') ?> </td> <td> <?php if (! empty($subtask['time_spent'])): ?> diff --git a/app/Template/app/tasks.php b/app/Template/app/tasks.php index 9987ff48..f05c63ef 100644 --- a/app/Template/app/tasks.php +++ b/app/Template/app/tasks.php @@ -13,13 +13,13 @@ <?php foreach ($paginator->getCollection() as $task): ?> <tr> <td class="task-table color-<?= $task['color_id'] ?>"> - <?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </td> <td> - <?= $this->a($this->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link($this->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> </td> <td> - <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </td> <td> <?php if (! empty($task['time_spent'])): ?> diff --git a/app/Template/auth/index.php b/app/Template/auth/index.php index b35b1253..8801a512 100644 --- a/app/Template/auth/index.php +++ b/app/Template/auth/index.php @@ -4,24 +4,24 @@ <p class="alert alert-error"><?= $this->e($errors['login']) ?></p> <?php endif ?> - <form method="post" action="<?= $this->u('auth', 'check', array('redirect_query' => $redirect_query)) ?>"> + <form method="post" action="<?= $this->url->href('auth', 'check', array('redirect_query' => $redirect_query)) ?>"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Username'), 'username') ?> - <?= $this->formText('username', $values, $errors, array('autofocus', 'required')) ?><br/> + <?= $this->form->label(t('Username'), 'username') ?> + <?= $this->form->text('username', $values, $errors, array('autofocus', 'required')) ?><br/> - <?= $this->formLabel(t('Password'), 'password') ?> - <?= $this->formPassword('password', $values, $errors, array('required')) ?> + <?= $this->form->label(t('Password'), 'password') ?> + <?= $this->form->password('password', $values, $errors, array('required')) ?> - <?= $this->formCheckbox('remember_me', t('Remember Me'), 1) ?><br/> + <?= $this->form->checkbox('remember_me', t('Remember Me'), 1) ?><br/> <?php if (GOOGLE_AUTH): ?> - <?= $this->a(t('Login with my Google Account'), 'user', 'google') ?> + <?= $this->url->link(t('Login with my Google Account'), 'user', 'google') ?> <?php endif ?> <?php if (GITHUB_AUTH): ?> - <?= $this->a(t('Login with my GitHub Account'), 'user', 'gitHub') ?> + <?= $this->url->link(t('Login with my GitHub Account'), 'user', 'gitHub') ?> <?php endif ?> <div class="form-actions"> diff --git a/app/Template/board/assignee.php b/app/Template/board/assignee.php index 453b3f2d..4af19cf7 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="<?= $this->u('board', 'updateAssignee', array('task_id' => $values['id'], 'project_id' => $values['project_id'])) ?>"> + <form method="post" action="<?= $this->url->href('board', 'updateAssignee', array('task_id' => $values['id'], 'project_id' => $values['project_id'])) ?>"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Assignee'), 'owner_id') ?> - <?= $this->formSelect('owner_id', $users_list, $values, array(), array('autofocus')) ?><br/> + <?= $this->form->label(t('Assignee'), 'owner_id') ?> + <?= $this->form->select('owner_id', $users_list, $values, array(), array('autofocus')) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> </section> diff --git a/app/Template/board/category.php b/app/Template/board/category.php index ee01ec5f..b38758d3 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="<?= $this->u('board', 'updateCategory', array('task_id' => $values['id'], 'project_id' => $values['project_id'])) ?>"> + <form method="post" action="<?= $this->url->href('board', 'updateCategory', array('task_id' => $values['id'], 'project_id' => $values['project_id'])) ?>"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Category'), 'category_id') ?> - <?= $this->formSelect('category_id', $categories_list, $values) ?><br/> + <?= $this->form->label(t('Category'), 'category_id') ?> + <?= $this->form->select('category_id', $categories_list, $values) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> </section> diff --git a/app/Template/board/comments.php b/app/Template/board/comments.php index 5424df78..75816af6 100644 --- a/app/Template/board/comments.php +++ b/app/Template/board/comments.php @@ -6,7 +6,7 @@ <div class="comment-inner"> <div class="markdown"> - <?= $this->markdown($comment['comment']) ?> + <?= $this->text->markdown($comment['comment']) ?> </div> </div> <?php endforeach ?> diff --git a/app/Template/board/description.php b/app/Template/board/description.php index b38f5bf4..7e0e3430 100644 --- a/app/Template/board/description.php +++ b/app/Template/board/description.php @@ -1,5 +1,5 @@ <section class="tooltip-large"> <div class="markdown"> - <?= $this->markdown($task['description']) ?> + <?= $this->text->markdown($task['description']) ?> </div> </section>
\ No newline at end of file diff --git a/app/Template/board/files.php b/app/Template/board/files.php index 851a118d..81136659 100644 --- a/app/Template/board/files.php +++ b/app/Template/board/files.php @@ -8,8 +8,8 @@ <?= $this->e($file['name']) ?> </td> <td> - <i class="fa fa-download"></i> <?= $this->a(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> - <i class="fa fa-eye"></i> <?= $this->a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + <i class="fa fa-download"></i> <?= $this->url->link(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <i class="fa fa-eye"></i> <?= $this->url->link(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> </td> </tr> <?php endforeach ?> @@ -18,11 +18,11 @@ <?php foreach ($files as $file): ?> <tr> <td> - <i class="fa <?= $this->getFileIcon($file['name']) ?> fa-fw"></i> + <i class="fa <?= $this->file->icon($file['name']) ?> fa-fw"></i> <?= $this->e($file['name']) ?> </td> <td> - <i class="fa fa-download"></i> <?= $this->a(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <i class="fa fa-download"></i> <?= $this->url->link(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> </td> </tr> <?php endforeach ?> diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php index 147295b2..0617fb47 100644 --- a/app/Template/board/filters.php +++ b/app/Template/board/filters.php @@ -23,37 +23,37 @@ </li> <li> <i class="fa fa-search fa-fw"></i> - <?= $this->a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-calendar fa-fw"></i> - <?= $this->a(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> </li> <?php if ($project['is_public']): ?> <li> - <i class="fa fa-share-alt fa-fw"></i> <?= $this->a(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?> + <i class="fa fa-share-alt fa-fw"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?> </li> <?php endif ?> - <?php if ($this->acl->isManagerActionAllowed($project['id'])): ?> + <?php if ($this->user->isManager($project['id'])): ?> <li> <i class="fa fa-line-chart fa-fw"></i> - <?= $this->a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-pie-chart fa-fw"></i> - <?= $this->a(t('Budget'), 'budget', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Budget'), 'budget', 'index', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-cog fa-fw"></i> - <?= $this->a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?> </li> <?php endif ?> </ul> @@ -61,10 +61,10 @@ </span> </li> <li> - <?= $this->formSelect('user_id', $users, array(), array(), array('data-placeholder="'.t('Filter by user').'"', 'data-notfound="'.t('No results match:').'"'), 'apply-filters chosen-select') ?> + <?= $this->form->select('user_id', $users, array(), array(), array('data-placeholder="'.t('Filter by user').'"', 'data-notfound="'.t('No results match:').'"'), 'apply-filters chosen-select') ?> </li> <li> - <?= $this->formSelect('category_id', $categories, array(), array(), array('data-placeholder="'.t('Filter by category').'"', 'data-notfound="'.t('No results match:').'"'), 'apply-filters chosen-select') ?> + <?= $this->form->select('category_id', $categories, array(), array(), array('data-placeholder="'.t('Filter by category').'"', 'data-notfound="'.t('No results match:').'"'), 'apply-filters chosen-select') ?> </li> <li> <select id="more-filters" multiple data-placeholder="<?= t('More filters') ?>" data-notfound="<?= t('No results match:') ?>" class="apply-filters hide-mobile"> diff --git a/app/Template/board/show.php b/app/Template/board/show.php index 8ee7861b..3b10d82c 100644 --- a/app/Template/board/show.php +++ b/app/Template/board/show.php @@ -6,9 +6,9 @@ class="board-project-<?= $project['id'] ?>" data-project-id="<?= $project['id'] ?>" data-check-interval="<?= $board_private_refresh_interval ?>" - 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())) ?>" - data-task-creation-url="<?= $this->u('task', 'create', array('project_id' => $project['id'])) ?>" + data-save-url="<?= $this->url->href('board', 'save', array('project_id' => $project['id'])) ?>" + data-check-url="<?= $this->url->href('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" + data-task-creation-url="<?= $this->url->href('task', 'create', array('project_id' => $project['id'])) ?>" > <?php endif ?> diff --git a/app/Template/board/subtasks.php b/app/Template/board/subtasks.php index 18f7f9da..950da925 100644 --- a/app/Template/board/subtasks.php +++ b/app/Template/board/subtasks.php @@ -1,7 +1,7 @@ <section id="tooltip-subtasks"> <?php foreach ($subtasks as $subtask): ?> - <?= $this->toggleSubtaskStatus($subtask, 'board') ?> - <?= $this->e(empty($subtask['username']) ? '' : ' ['.$this->getFullname($subtask).']') ?> + <?= $this->subtask->toggleStatus($subtask, 'board') ?> + <?= $this->e(empty($subtask['username']) ? '' : ' ['.$this->user->getFullname($subtask).']') ?> <br/> <?php endforeach ?> </section> diff --git a/app/Template/board/swimlane.php b/app/Template/board/swimlane.php index c7bd8b5b..a7741f8d 100644 --- a/app/Template/board/swimlane.php +++ b/app/Template/board/swimlane.php @@ -21,14 +21,14 @@ <th class="board-column"> <?php if (! $not_editable): ?> <div class="board-add-icon"> - <?= $this->a('+', 'task', 'create', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'task-board-popover', t('Add a new task')) ?> + <?= $this->url->link('+', 'task', 'create', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'task-board-popover', t('Add a new task')) ?> </div> <?php endif ?> <?= $this->e($column['title']) ?> <?php if (! $not_editable && ! empty($column['description'])): ?> - <span class="column-tooltip pull-right" title='<?= $this->e($this->markdown($column['description'])) ?>'> + <span class="column-tooltip pull-right" title='<?= $this->e($this->text->markdown($column['description'])) ?>'> <i class="fa fa-info-circle"></i> </span> <?php endif ?> diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index 0ea0f5fa..5945d5af 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -2,16 +2,16 @@ <div class="task-board-category-container"> <span class="task-board-category"> <?php if ($not_editable): ?> - <?= $this->inList($task['category_id'], $categories_listing) ?> + <?= $this->text->in($task['category_id'], $categories_listing) ?> <?php else: ?> - <?= $this->a( - $this->inList($task['category_id'], $categories_listing), + <?= $this->url->link( + $this->text->in($task['category_id'], $categories_listing), 'board', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover' . (isset($categories_description[$task['category_id']]) ? ' column-tooltip' : ''), - isset($categories_description[$task['category_id']]) ? $this->markdown($categories_description[$task['category_id']]) : t('Change category') + isset($categories_description[$task['category_id']]) ? $this->text->markdown($categories_description[$task['category_id']]) : t('Change category') ) ?> <?php endif ?> </span> @@ -26,31 +26,31 @@ <?php endif ?> <?php if ($task['recurrence_status'] == \Model\Task::RECURRING_STATUS_PENDING): ?> - <span title="<?= t('Recurrence') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90"></i></span> + <span title="<?= t('Recurrence') ?>" class="task-board-tooltip" data-href="<?= $this->url->href('board', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90"></i></span> <?php endif ?> <?php if ($task['recurrence_status'] == \Model\Task::RECURRING_STATUS_PROCESSED): ?> - <span title="<?= t('Recurrence') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90 fa-inverse"></i></span> + <span title="<?= t('Recurrence') ?>" class="task-board-tooltip" data-href="<?= $this->url->href('board', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90 fa-inverse"></i></span> <?php endif ?> <?php if (! empty($task['nb_links'])): ?> - <span title="<?= t('Links') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-code-fork"></i> <?= $task['nb_links'] ?></span> + <span title="<?= t('Links') ?>" class="task-board-tooltip" data-href="<?= $this->url->href('board', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-code-fork"></i> <?= $task['nb_links'] ?></span> <?php endif ?> <?php if (! empty($task['nb_subtasks'])): ?> - <span title="<?= t('Sub-Tasks') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'subtasks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-bars"></i> <?= round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?></span> + <span title="<?= t('Sub-Tasks') ?>" class="task-board-tooltip" data-href="<?= $this->url->href('board', 'subtasks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-bars"></i> <?= round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?></span> <?php endif ?> <?php if (! empty($task['nb_files'])): ?> - <span title="<?= t('Attachments') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-paperclip"></i> <?= $task['nb_files'] ?></span> + <span title="<?= t('Attachments') ?>" class="task-board-tooltip" data-href="<?= $this->url->href('board', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-paperclip"></i> <?= $task['nb_files'] ?></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="<?= $this->u('board', 'comments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-comment-o"></i> <?= $task['nb_comments'] ?></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->url->href('board', 'comments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-comment-o"></i> <?= $task['nb_comments'] ?></span> <?php endif ?> <?php if (! empty($task['description'])): ?> - <span title="<?= t('Description') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + <span title="<?= t('Description') ?>" class="task-board-tooltip" data-href="<?= $this->url->href('board', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> <i class="fa fa-file-text-o"></i> </span> <?php endif ?> diff --git a/app/Template/board/task_menu.php b/app/Template/board/task_menu.php index 04b03385..97c0f8dc 100644 --- a/app/Template/board/task_menu.php +++ b/app/Template/board/task_menu.php @@ -2,15 +2,15 @@ <span> <a href="#" class="dropdown-menu"><?= '#'.$task['id'] ?></a> <ul> - <li><i class="fa fa-user"></i> <?= $this->a(t('Change assignee'), 'board', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-tag"></i> <?= $this->a(t('Change category'), 'board', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-align-left"></i> <?= $this->a(t('Change description'), 'task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-pencil-square-o"></i> <?= $this->a(t('Edit this task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-comment-o"></i> <?= $this->a(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-code-fork"></i> <?= $this->a(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-camera"></i> <?= $this->a(t('Add a screenshot'), 'board', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-refresh fa-rotate-90"></i> <?= $this->a(t('Edit recurrence'), 'task', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> - <li><i class="fa fa-close"></i> <?= $this->a(t('Close this task'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'task-board-popover') ?></li> + <li><i class="fa fa-user"></i> <?= $this->url->link(t('Change assignee'), 'board', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-tag"></i> <?= $this->url->link(t('Change category'), 'board', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-align-left"></i> <?= $this->url->link(t('Change description'), 'task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-pencil-square-o"></i> <?= $this->url->link(t('Edit this task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-comment-o"></i> <?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-code-fork"></i> <?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-camera"></i> <?= $this->url->link(t('Add a screenshot'), 'board', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-refresh fa-rotate-90"></i> <?= $this->url->link(t('Edit recurrence'), 'task', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li> + <li><i class="fa fa-close"></i> <?= $this->url->link(t('Close this task'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'task-board-popover') ?></li> </ul> </span> </span> diff --git a/app/Template/board/task_private.php b/app/Template/board/task_private.php index d82b96e8..088f47bc 100644 --- a/app/Template/board/task_private.php +++ b/app/Template/board/task_private.php @@ -3,12 +3,12 @@ data-owner-id="<?= $task['owner_id'] ?>" data-category-id="<?= $task['category_id'] ?>" data-due-date="<?= $task['date_due'] ?>" - data-task-url="<?= $this->u('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + data-task-url="<?= $this->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> <?= $this->render('board/task_menu', array('task' => $task)) ?> <div class="task-board-collapsed" style="display: none"> - <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title') ?> + <?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title') ?> </div> <div class="task-board-expanded"> @@ -19,8 +19,8 @@ </span> <?php endif ?> - <span class="task-board-user <?= $this->userSession->isCurrentUser($task['owner_id']) ? 'task-board-current-user' : '' ?>"> - <?= $this->a( + <span class="task-board-user <?= $this->user->isCurrentUser($task['owner_id']) ? 'task-board-current-user' : '' ?>"> + <?= $this->url->link( (! empty($task['owner_id']) ? ($task['assignee_name'] ?: $task['assignee_username']) : t('Nobody assigned')), 'board', 'changeAssignee', @@ -32,12 +32,12 @@ </span> <div class="task-board-days"> - <span title="<?= t('Task age in days')?>" class="task-days-age"><?= $this->getTaskAge($task['date_creation']) ?></span> - <span title="<?= t('Days in this column')?>" class="task-days-incolumn"><?= $this->getTaskAge($task['date_moved']) ?></span> + <span title="<?= t('Task age in days')?>" class="task-days-age"><?= $this->task->age($task['date_creation']) ?></span> + <span title="<?= t('Days in this column')?>" class="task-days-incolumn"><?= $this->task->age($task['date_moved']) ?></span> </div> <div class="task-board-title"> - <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </div> <?= $this->render('board/task_footer', array( diff --git a/app/Template/board/task_public.php b/app/Template/board/task_public.php index 1ab2b3aa..9ac6e570 100644 --- a/app/Template/board/task_public.php +++ b/app/Template/board/task_public.php @@ -1,6 +1,6 @@ <div class="task-board color-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"> - <?= $this->a('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + <?= $this->url->link('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> <?php if ($task['reference']): ?> <span class="task-board-reference" title="<?= t('Reference') ?>"> @@ -19,7 +19,7 @@ </span> <div class="task-board-title"> - <?= $this->a($this->e($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + <?= $this->url->link($this->e($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> </div> <?= $this->render('board/task_footer', array( diff --git a/app/Template/board/tasklinks.php b/app/Template/board/tasklinks.php index f934cff9..25aa91aa 100644 --- a/app/Template/board/tasklinks.php +++ b/app/Template/board/tasklinks.php @@ -3,7 +3,7 @@ <?php foreach($links as $link): ?> <li> <strong><?= t($link['label']) ?></strong> - <?= $this->a( + <?= $this->url->link( $this->e('#'.$link['task_id'].' - '.$link['title']), 'task', 'show', array('task_id' => $link['task_id'], 'project_id' => $link['project_id']), false, diff --git a/app/Template/budget/breakdown.php b/app/Template/budget/breakdown.php index 51044c46..3275a66a 100644 --- a/app/Template/budget/breakdown.php +++ b/app/Template/budget/breakdown.php @@ -1,8 +1,8 @@ <div class="page-header"> <h2><?= t('Budget') ?></h2> <ul> - <li><?= $this->a(t('Budget lines'), 'budget', 'create', array('project_id' => $project['id'])) ?></li> - <li><?= $this->a(t('Cost breakdown'), 'budget', 'breakdown', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(t('Budget lines'), 'budget', 'create', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(t('Cost breakdown'), 'budget', 'breakdown', array('project_id' => $project['id'])) ?></li> </ul> </div> @@ -20,9 +20,9 @@ </tr> <?php foreach ($paginator->getCollection() as $record): ?> <tr> - <td><?= $this->a($this->e($record['task_title']), 'task', 'show', array('project_id' => $project['id'], 'task_id' => $record['task_id'])) ?></td> - <td><?= $this->a($this->e($record['subtask_title']), 'task', 'show', array('project_id' => $project['id'], 'task_id' => $record['task_id'])) ?></td> - <td><?= $this->a($this->e($record['name'] ?: $record['username']), 'user', 'show', array('user_id' => $record['user_id'])) ?></td> + <td><?= $this->url->link($this->e($record['task_title']), 'task', 'show', array('project_id' => $project['id'], 'task_id' => $record['task_id'])) ?></td> + <td><?= $this->url->link($this->e($record['subtask_title']), 'task', 'show', array('project_id' => $project['id'], 'task_id' => $record['task_id'])) ?></td> + <td><?= $this->url->link($this->e($record['name'] ?: $record['username']), 'user', 'show', array('user_id' => $record['user_id'])) ?></td> <td><?= n($record['cost']) ?></td> <td><?= n($record['time_spent']).' '.t('hours') ?></td> <td><?= dt('%B %e, %Y', $record['start']) ?></td> diff --git a/app/Template/budget/create.php b/app/Template/budget/create.php index 5b2976f4..d64bbc48 100644 --- a/app/Template/budget/create.php +++ b/app/Template/budget/create.php @@ -1,8 +1,8 @@ <div class="page-header"> <h2><?= t('Budget') ?></h2> <ul> - <li><?= $this->a(t('Budget lines'), 'budget', 'create', array('project_id' => $project['id'])) ?></li> - <li><?= $this->a(t('Cost breakdown'), 'budget', 'breakdown', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(t('Budget lines'), 'budget', 'create', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(t('Cost breakdown'), 'budget', 'breakdown', array('project_id' => $project['id'])) ?></li> </ul> </div> @@ -20,7 +20,7 @@ <td><?= dt('%B %e, %Y', strtotime($line['date'])) ?></td> <td><?= $this->e($line['comment']) ?></td> <td> - <?= $this->a(t('Remove'), 'budget', 'confirm', array('project_id' => $project['id'], 'budget_id' => $line['id'])) ?> + <?= $this->url->link(t('Remove'), 'budget', 'confirm', array('project_id' => $project['id'], 'budget_id' => $line['id'])) ?> </td> </tr> <?php endforeach ?> @@ -29,21 +29,21 @@ <h3><?= t('New budget line') ?></h3> <?php endif ?> -<form method="post" action="<?= $this->u('budget', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('budget', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Amount'), 'amount') ?> - <?= $this->formText('amount', $values, $errors, array('required'), 'form-numeric') ?> + <?= $this->form->label(t('Amount'), 'amount') ?> + <?= $this->form->text('amount', $values, $errors, array('required'), 'form-numeric') ?> - <?= $this->formLabel(t('Date'), 'date') ?> - <?= $this->formText('date', $values, $errors, array('required'), 'form-date') ?> + <?= $this->form->label(t('Date'), 'date') ?> + <?= $this->form->text('date', $values, $errors, array('required'), 'form-date') ?> - <?= $this->formLabel(t('Comment'), 'comment') ?> - <?= $this->formText('comment', $values, $errors) ?> + <?= $this->form->label(t('Comment'), 'comment') ?> + <?= $this->form->text('comment', $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/budget/index.php b/app/Template/budget/index.php index 01525829..d9fefc67 100644 --- a/app/Template/budget/index.php +++ b/app/Template/budget/index.php @@ -1,11 +1,11 @@ -<?= $this->js('assets/js/vendor/d3.v3.4.8.min.js') ?> -<?= $this->js('assets/js/vendor/dimple.v2.1.2.min.js') ?> +<?= $this->asset->js('assets/js/vendor/d3.v3.4.8.min.js') ?> +<?= $this->asset->js('assets/js/vendor/dimple.v2.1.2.min.js') ?> <div class="page-header"> <h2><?= t('Budget') ?></h2> <ul> - <li><?= $this->a(t('Budget lines'), 'budget', 'create', array('project_id' => $project['id'])) ?></li> - <li><?= $this->a(t('Cost breakdown'), 'budget', 'breakdown', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(t('Budget lines'), 'budget', 'create', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(t('Cost breakdown'), 'budget', 'breakdown', array('project_id' => $project['id'])) ?></li> </ul> </div> diff --git a/app/Template/budget/remove.php b/app/Template/budget/remove.php index 97f9c3dc..a5b906a1 100644 --- a/app/Template/budget/remove.php +++ b/app/Template/budget/remove.php @@ -6,8 +6,8 @@ <p class="alert alert-info"><?= t('Do you really want to remove this budget line?') ?></p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'budget', 'remove', array('project_id' => $project['id'], 'budget_id' => $budget_id), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'budget', 'remove', array('project_id' => $project['id'], 'budget_id' => $budget_id), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'budget', 'create', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('cancel'), 'budget', 'create', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/calendar/show.php b/app/Template/calendar/show.php index 9e96d29e..3fe97b65 100644 --- a/app/Template/calendar/show.php +++ b/app/Template/calendar/show.php @@ -3,19 +3,19 @@ <ul> <li> <i class="fa fa-table fa-fw"></i> - <?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?> </li> </ul> </div> @@ -34,8 +34,8 @@ <div class="sidebar-content"> <div id="calendar" data-project-id="<?= $project['id'] ?>" - data-save-url="<?= $this->u('calendar', 'save') ?>" - data-check-url="<?= $this->u('calendar', 'project', array('project_id' => $project['id'])) ?>" + data-save-url="<?= $this->url->href('calendar', 'save') ?>" + data-check-url="<?= $this->url->href('calendar', 'project', array('project_id' => $project['id'])) ?>" data-check-interval="<?= $check_interval ?>" > </div> diff --git a/app/Template/calendar/sidebar.php b/app/Template/calendar/sidebar.php index b074ed91..6c4fb5b0 100644 --- a/app/Template/calendar/sidebar.php +++ b/app/Template/calendar/sidebar.php @@ -4,37 +4,37 @@ <?= t('Filter by user') ?> </li> <li> - <?= $this->formSelect('owner_id', $users_list, array(), array(), array(), 'calendar-filter') ?> + <?= $this->form->select('owner_id', $users_list, array(), array(), array(), 'calendar-filter') ?> </li> <li> <?= t('Filter by category') ?> </li> <li> - <?= $this->formSelect('category_id', $categories_list, array(), array(), array(), 'calendar-filter') ?> + <?= $this->form->select('category_id', $categories_list, array(), array(), array(), 'calendar-filter') ?> </li> <li> <?= t('Filter by column') ?> </li> <li> - <?= $this->formSelect('column_id', $columns_list, array(), array(), array(), 'calendar-filter') ?> + <?= $this->form->select('column_id', $columns_list, array(), array(), array(), 'calendar-filter') ?> </li> <li> <?= t('Filter by swimlane') ?> </li> <li> - <?= $this->formSelect('swimlane_id', $swimlanes_list, array(), array(), array(), 'calendar-filter') ?> + <?= $this->form->select('swimlane_id', $swimlanes_list, array(), array(), array(), 'calendar-filter') ?> </li> <li> <?= t('Filter by color') ?> </li> <li> - <?= $this->formSelect('color_id', $colors_list, array(), array(), array(), 'calendar-filter') ?> + <?= $this->form->select('color_id', $colors_list, array(), array(), array(), 'calendar-filter') ?> </li> <li> <?= t('Filter by status') ?> </li> <li> - <?= $this->formSelect('is_active', $status_list, array(), array(), array(), 'calendar-filter') ?> + <?= $this->form->select('is_active', $status_list, array(), array(), array(), 'calendar-filter') ?> </li> </ul> </div> diff --git a/app/Template/category/edit.php b/app/Template/category/edit.php index 0d4b0f6f..7d40fe65 100644 --- a/app/Template/category/edit.php +++ b/app/Template/category/edit.php @@ -2,21 +2,21 @@ <h2><?= t('Category modification for the project "%s"', $project['name']) ?></h2> </div> -<form method="post" action="<?= $this->u('category', 'update', array('project_id' => $project['id'], 'category_id' => $values['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('category', 'update', array('project_id' => $project['id'], 'category_id' => $values['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Category Name'), 'name') ?> - <?= $this->formText('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->label(t('Category Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> - <?= $this->formLabel(t('Description'), 'description') ?> + <?= $this->form->label(t('Description'), 'description') ?> <div class="form-tabs"> <div class="write-area"> - <?= $this->formTextarea('description', $values, $errors) ?> + <?= $this->form->textarea('description', $values, $errors) ?> </div> <div class="preview-area"> <div class="markdown"></div> diff --git a/app/Template/category/index.php b/app/Template/category/index.php index d5b50af4..dba537d0 100644 --- a/app/Template/category/index.php +++ b/app/Template/category/index.php @@ -13,10 +13,10 @@ <td> <ul> <li> - <?= $this->a(t('Edit'), 'category', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id)) ?> + <?= $this->url->link(t('Edit'), 'category', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id)) ?> </li> <li> - <?= $this->a(t('Remove'), 'category', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id)) ?> + <?= $this->url->link(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="<?= $this->u('category', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('category', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Category Name'), 'name') ?> - <?= $this->formText('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->label(t('Category Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> <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 8875b232..ce589785 100644 --- a/app/Template/category/remove.php +++ b/app/Template/category/remove.php @@ -9,9 +9,9 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'category', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'category', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'category', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('cancel'), 'category', 'index', array('project_id' => $project['id'])) ?> </div> </div> </section>
\ No newline at end of file diff --git a/app/Template/column/edit.php b/app/Template/column/edit.php index 7e16c326..4d9848a9 100644 --- a/app/Template/column/edit.php +++ b/app/Template/column/edit.php @@ -2,25 +2,25 @@ <h2><?= t('Edit column "%s"', $column['title']) ?></h2> </div> -<form method="post" action="<?= $this->u('column', 'update', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('column', 'update', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Title'), 'title') ?> - <?= $this->formText('title', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->label(t('Title'), 'title') ?> + <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> - <?= $this->formLabel(t('Task limit'), 'task_limit') ?> - <?= $this->formNumber('task_limit', $values, $errors) ?> + <?= $this->form->label(t('Task limit'), 'task_limit') ?> + <?= $this->form->number('task_limit', $values, $errors) ?> - <?= $this->formLabel(t('Description'), 'description') ?> + <?= $this->form->label(t('Description'), 'description') ?> <div class="form-tabs"> <div class="write-area"> - <?= $this->formTextarea('description', $values, $errors) ?> + <?= $this->form->textarea('description', $values, $errors) ?> </div> <div class="preview-area"> <div class="markdown"></div> diff --git a/app/Template/column/index.php b/app/Template/column/index.php index e5772923..18e7f284 100644 --- a/app/Template/column/index.php +++ b/app/Template/column/index.php @@ -18,7 +18,7 @@ <tr> <td class="column-60"><?= $this->e($column['title']) ?> <?php if (! empty($column['description'])): ?> - <span class="column-tooltip" title='<?= $this->e($this->markdown($column['description'])) ?>'> + <span class="column-tooltip" title='<?= $this->e($this->text->markdown($column['description'])) ?>'> <i class="fa fa-info-circle"></i> </span> <?php endif ?> @@ -27,20 +27,20 @@ <td class="column-30"> <ul> <li> - <?= $this->a(t('Edit'), 'column', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?> + <?= $this->url->link(t('Edit'), 'column', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?> </li> <?php if ($column['position'] != $first_position): ?> <li> - <?= $this->a(t('Move Up'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?> + <?= $this->url->link(t('Move Up'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?> </li> <?php endif ?> <?php if ($column['position'] != $last_position): ?> <li> - <?= $this->a(t('Move Down'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?> + <?= $this->url->link(t('Move Down'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?> </li> <?php endif ?> <li> - <?= $this->a(t('Remove'), 'column', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?> + <?= $this->url->link(t('Remove'), 'column', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?> </li> </ul> </td> @@ -51,23 +51,23 @@ <?php endif ?> <h3><?= t('Add a new column') ?></h3> -<form method="post" action="<?= $this->u('column', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('column', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Title'), 'title') ?> - <?= $this->formText('title', $values, $errors, array('required', 'maxlength="50"')) ?> + <?= $this->form->label(t('Title'), 'title') ?> + <?= $this->form->text('title', $values, $errors, array('required', 'maxlength="50"')) ?> - <?= $this->formLabel(t('Task limit'), 'task_limit') ?> - <?= $this->formNumber('task_limit', $values, $errors) ?> + <?= $this->form->label(t('Task limit'), 'task_limit') ?> + <?= $this->form->number('task_limit', $values, $errors) ?> - <?= $this->formLabel(t('Description'), 'description') ?> + <?= $this->form->label(t('Description'), 'description') ?> <div class="form-tabs"> <div class="write-area"> - <?= $this->formTextarea('description', $values, $errors) ?> + <?= $this->form->textarea('description', $values, $errors) ?> </div> <div class="preview-area"> <div class="markdown"></div> diff --git a/app/Template/column/remove.php b/app/Template/column/remove.php index 3dcbd62f..28d0928f 100644 --- a/app/Template/column/remove.php +++ b/app/Template/column/remove.php @@ -9,7 +9,7 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'column', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= $this->a(t('cancel'), 'column', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Yes'), 'column', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'column', 'index', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/comment/create.php b/app/Template/comment/create.php index 5bd8debc..8c66d9a4 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="<?= $this->u('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" autocomplete="off" class="form-comment"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('task_id', $values) ?> - <?= $this->formHidden('user_id', $values) ?> +<form method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" autocomplete="off" class="form-comment"> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('task_id', $values) ?> + <?= $this->form->hidden('user_id', $values) ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -17,7 +17,7 @@ </li> </ul> <div class="write-area"> - <?= $this->formTextarea('comment', $values, $errors, array(! isset($skip_cancel) ? 'autofocus' : '', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?> + <?= $this->form->textarea('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> @@ -31,9 +31,9 @@ <?php if (! isset($skip_cancel)): ?> <?= t('or') ?> <?php if (isset($ajax)): ?> - <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> <?php else: ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> <?php endif ?> <?php endif ?> </div> diff --git a/app/Template/comment/edit.php b/app/Template/comment/edit.php index 2785fe62..d67aa387 100644 --- a/app/Template/comment/edit.php +++ b/app/Template/comment/edit.php @@ -2,12 +2,12 @@ <h2><?= t('Edit a comment') ?></h2> </div> -<form method="post" action="<?= $this->u('comment', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('comment', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('task_id', $values) ?> - <?= $this->formHidden('user_id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('task_id', $values) ?> + <?= $this->form->hidden('user_id', $values) ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -19,7 +19,7 @@ </li> </ul> <div class="write-area"> - <?= $this->formTextarea('comment', $values, $errors, array('autofocus', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?> + <?= $this->form->textarea('comment', $values, $errors, array('autofocus', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?> </div> <div class="preview-area"> <div class="markdown"></div> @@ -31,6 +31,6 @@ <div class="form-actions"> <input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </form> diff --git a/app/Template/comment/remove.php b/app/Template/comment/remove.php index 2338a03d..afc3346f 100644 --- a/app/Template/comment/remove.php +++ b/app/Template/comment/remove.php @@ -10,8 +10,8 @@ <?= $this->render('comment/show', array('comment' => $comment, 'task' => $task, 'preview' => true)) ?> <div class="form-actions"> - <?= $this->a(t('Yes'), 'comment', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'comment', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/comment/show.php b/app/Template/comment/show.php index 98c29441..35394ccb 100644 --- a/app/Template/comment/show.php +++ b/app/Template/comment/show.php @@ -2,7 +2,7 @@ <p class="comment-title"> <?php if (! empty($comment['email'])): ?> - <?= $this->avatar($comment['email'], $comment['name'] ?: $comment['username']) ?> + <?= $this->user->avatar($comment['email'], $comment['name'] ?: $comment['username']) ?> <?php endif ?> <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> @@ -11,12 +11,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) && ($this->userSession->isAdmin() || $this->userSession->isCurrentUser($comment['user_id']))): ?> + <?php if ((! isset($not_editable) || ! $not_editable) && ($this->user->isAdmin() || $this->user->isCurrentUser($comment['user_id']))): ?> <li> - <?= $this->a(t('remove'), 'comment', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?> + <?= $this->url->link(t('remove'), 'comment', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?> </li> <li> - <?= $this->a(t('edit'), 'comment', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?> + <?= $this->url->link(t('edit'), 'comment', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?> </li> <?php endif ?> </ul> @@ -24,7 +24,7 @@ <div class="markdown"> <?php if (isset($is_public) && $is_public): ?> - <?= $this->markdown( + <?= $this->text->markdown( $comment['comment'], array( 'controller' => 'task', @@ -35,7 +35,7 @@ ) ) ?> <?php else: ?> - <?= $this->markdown( + <?= $this->text->markdown( $comment['comment'], array( 'controller' => 'task', diff --git a/app/Template/config/about.php b/app/Template/config/about.php index b6ed43e5..a7098c1b 100644 --- a/app/Template/config/about.php +++ b/app/Template/config/about.php @@ -25,14 +25,14 @@ <?php if (DB_DRIVER === 'sqlite'): ?> <li> <?= t('Database size:') ?> - <strong><?= $this->formatBytes($db_size) ?></strong> + <strong><?= $this->text->bytes($db_size) ?></strong> </li> <li> - <?= $this->a(t('Download the database'), 'config', 'downloadDb', array(), true) ?> + <?= $this->url->link(t('Download the database'), 'config', 'downloadDb', array(), true) ?> <?= t('(Gzip compressed Sqlite file)') ?> </li> <li> - <?= $this->a(t('Optimize the database'), 'config', 'optimizeDb', array(), true) ?> + <?= $this->url->link(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 0df90835..489f1968 100644 --- a/app/Template/config/api.php +++ b/app/Template/config/api.php @@ -9,10 +9,10 @@ </li> <li> <?= t('API endpoint:') ?> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().'jsonrpc.php' ?>"> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().'jsonrpc.php' ?>"> </li> <li> - <?= $this->a(t('Reset token'), 'config', 'token', array('type' => 'api'), true) ?> + <?= $this->url->link(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 f6c9db94..7d4c811d 100644 --- a/app/Template/config/application.php +++ b/app/Template/config/application.php @@ -2,26 +2,26 @@ <h2><?= t('Application settings') ?></h2> </div> <section> -<form method="post" action="<?= $this->u('config', 'application') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('config', 'application') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Application URL'), 'application_url') ?> - <?= $this->formText('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?><br/> + <?= $this->form->label(t('Application URL'), 'application_url') ?> + <?= $this->form->text('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> - <?= $this->formLabel(t('Language'), 'application_language') ?> - <?= $this->formSelect('application_language', $languages, $values, $errors) ?><br/> + <?= $this->form->label(t('Language'), 'application_language') ?> + <?= $this->form->select('application_language', $languages, $values, $errors) ?><br/> - <?= $this->formLabel(t('Timezone'), 'application_timezone') ?> - <?= $this->formSelect('application_timezone', $timezones, $values, $errors) ?><br/> + <?= $this->form->label(t('Timezone'), 'application_timezone') ?> + <?= $this->form->select('application_timezone', $timezones, $values, $errors) ?><br/> - <?= $this->formLabel(t('Date format'), 'application_date_format') ?> - <?= $this->formSelect('application_date_format', $date_formats, $values, $errors) ?><br/> + <?= $this->form->label(t('Date format'), 'application_date_format') ?> + <?= $this->form->select('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> - <?= $this->formLabel(t('Custom Stylesheet'), 'application_stylesheet') ?> - <?= $this->formTextarea('application_stylesheet', $values, $errors) ?><br/> + <?= $this->form->label(t('Custom Stylesheet'), 'application_stylesheet') ?> + <?= $this->form->textarea('application_stylesheet', $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/config/board.php b/app/Template/config/board.php index c55003de..19a4bcd7 100644 --- a/app/Template/config/board.php +++ b/app/Template/config/board.php @@ -2,20 +2,20 @@ <h2><?= t('Board settings') ?></h2> </div> <section> -<form method="post" action="<?= $this->u('config', 'board') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('config', 'board') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Task highlight period'), 'board_highlight_period') ?> - <?= $this->formNumber('board_highlight_period', $values, $errors) ?><br/> + <?= $this->form->label(t('Task highlight period'), 'board_highlight_period') ?> + <?= $this->form->number('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> - <?= $this->formLabel(t('Refresh interval for public board'), 'board_public_refresh_interval') ?> - <?= $this->formNumber('board_public_refresh_interval', $values, $errors) ?><br/> + <?= $this->form->label(t('Refresh interval for public board'), 'board_public_refresh_interval') ?> + <?= $this->form->number('board_public_refresh_interval', $values, $errors) ?><br/> <p class="form-help"><?= t('Frequency in second (60 seconds by default)') ?></p> - <?= $this->formLabel(t('Refresh interval for private board'), 'board_private_refresh_interval') ?> - <?= $this->formNumber('board_private_refresh_interval', $values, $errors) ?><br/> + <?= $this->form->label(t('Refresh interval for private board'), 'board_private_refresh_interval') ?> + <?= $this->form->number('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> <div class="form-actions"> diff --git a/app/Template/config/calendar.php b/app/Template/config/calendar.php index 300d3419..1cc985c8 100644 --- a/app/Template/config/calendar.php +++ b/app/Template/config/calendar.php @@ -2,13 +2,13 @@ <h2><?= t('Calendar settings') ?></h2> </div> <section> -<form method="post" action="<?= $this->u('config', 'calendar') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('config', 'calendar') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> <h3><?= t('Project calendar view') ?></h3> <div class="listing"> - <?= $this->formRadios('calendar_project_tasks', array( + <?= $this->form->radios('calendar_project_tasks', array( 'date_creation' => t('Show tasks based on the creation date'), 'date_started' => t('Show tasks based on the start date'), ), $values) ?> @@ -16,14 +16,14 @@ <h3><?= t('User calendar view') ?></h3> <div class="listing"> - <?= $this->formRadios('calendar_user_tasks', array( + <?= $this->form->radios('calendar_user_tasks', array( 'date_creation' => t('Show tasks based on the creation date'), 'date_started' => t('Show tasks based on the start date'), ), $values) ?> <h4><?= t('Subtasks time tracking') ?></h4> - <?= $this->formCheckbox('calendar_user_subtasks_time_tracking', t('Show subtasks based on the time tracking'), 1, $values['calendar_user_subtasks_time_tracking'] == 1) ?> - <?= $this->formCheckbox('calendar_user_subtasks_forecast', t('Show subtask estimates (forecast of future work)'), 1, $values['calendar_user_subtasks_forecast'] == 1) ?> + <?= $this->form->checkbox('calendar_user_subtasks_time_tracking', t('Show subtasks based on the time tracking'), 1, $values['calendar_user_subtasks_time_tracking'] == 1) ?> + <?= $this->form->checkbox('calendar_user_subtasks_forecast', t('Show subtask estimates (forecast of future work)'), 1, $values['calendar_user_subtasks_forecast'] == 1) ?> </div> <div class="form-actions"> diff --git a/app/Template/config/integrations.php b/app/Template/config/integrations.php index f9e7f537..a1299806 100644 --- a/app/Template/config/integrations.php +++ b/app/Template/config/integrations.php @@ -2,81 +2,81 @@ <h2><?= t('Integration with third-party services') ?></h2> </div> -<form method="post" action="<?= $this->u('config', 'integrations') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('config', 'integrations') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> <h3><img src="assets/img/mailgun-icon.png"/> <?= t('Mailgun (incoming emails)') ?></h3> <div class="listing"> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'mailgun', array('token' => $values['webhook_token'])) ?>"/><br/> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().$this->url->href('webhook', 'mailgun', array('token' => $values['webhook_token'])) ?>"/><br/> <p class="form-help"><a href="http://kanboard.net/documentation/mailgun" target="_blank"><?= t('Help on Mailgun integration') ?></a></p> </div> <h3><img src="assets/img/sendgrid-icon.png"/> <?= t('Sendgrid (incoming emails)') ?></h3> <div class="listing"> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'sendgrid', array('token' => $values['webhook_token'])) ?>"/><br/> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().$this->url->href('webhook', 'sendgrid', array('token' => $values['webhook_token'])) ?>"/><br/> <p class="form-help"><a href="http://kanboard.net/documentation/sendgrid" target="_blank"><?= t('Help on Sendgrid integration') ?></a></p> </div> <h3><img src="assets/img/postmark-icon.png"/> <?= t('Postmark (incoming emails)') ?></h3> <div class="listing"> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'postmark', array('token' => $values['webhook_token'])) ?>"/><br/> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().$this->url->href('webhook', 'postmark', array('token' => $values['webhook_token'])) ?>"/><br/> <p class="form-help"><a href="http://kanboard.net/documentation/postmark" target="_blank"><?= t('Help on Postmark integration') ?></a></p> </div> <h3><img src="assets/img/gravatar-icon.png"/> <?= t('Gravatar') ?></h3> <div class="listing"> - <?= $this->formCheckbox('integration_gravatar', t('Enable Gravatar images'), 1, $values['integration_gravatar'] == 1) ?> + <?= $this->form->checkbox('integration_gravatar', t('Enable Gravatar images'), 1, $values['integration_gravatar'] == 1) ?> </div> <h3><img src="assets/img/jabber-icon.png"/> <?= t('Jabber (XMPP)') ?></h3> <div class="listing"> - <?= $this->formCheckbox('integration_jabber', t('Send notifications to Jabber'), 1, $values['integration_jabber'] == 1) ?> + <?= $this->form->checkbox('integration_jabber', t('Send notifications to Jabber'), 1, $values['integration_jabber'] == 1) ?> - <?= $this->formLabel(t('XMPP server address'), 'integration_jabber_server') ?> - <?= $this->formText('integration_jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?> + <?= $this->form->label(t('XMPP server address'), 'integration_jabber_server') ?> + <?= $this->form->text('integration_jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?> <p class="form-help"><?= t('The server address must use this format: "tcp://hostname:5222"') ?></p> - <?= $this->formLabel(t('Jabber domain'), 'integration_jabber_domain') ?> - <?= $this->formText('integration_jabber_domain', $values, $errors, array('placeholder="example.com"')) ?> + <?= $this->form->label(t('Jabber domain'), 'integration_jabber_domain') ?> + <?= $this->form->text('integration_jabber_domain', $values, $errors, array('placeholder="example.com"')) ?> - <?= $this->formLabel(t('Username'), 'integration_jabber_username') ?> - <?= $this->formText('integration_jabber_username', $values, $errors) ?> + <?= $this->form->label(t('Username'), 'integration_jabber_username') ?> + <?= $this->form->text('integration_jabber_username', $values, $errors) ?> - <?= $this->formLabel(t('Password'), 'integration_jabber_password') ?> - <?= $this->formPassword('integration_jabber_password', $values, $errors) ?> + <?= $this->form->label(t('Password'), 'integration_jabber_password') ?> + <?= $this->form->password('integration_jabber_password', $values, $errors) ?> - <?= $this->formLabel(t('Jabber nickname'), 'integration_jabber_nickname') ?> - <?= $this->formText('integration_jabber_nickname', $values, $errors) ?> + <?= $this->form->label(t('Jabber nickname'), 'integration_jabber_nickname') ?> + <?= $this->form->text('integration_jabber_nickname', $values, $errors) ?> - <?= $this->formLabel(t('Multi-user chat room'), 'integration_jabber_room') ?> - <?= $this->formText('integration_jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?> + <?= $this->form->label(t('Multi-user chat room'), 'integration_jabber_room') ?> + <?= $this->form->text('integration_jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?> <p class="form-help"><a href="http://kanboard.net/documentation/jabber" target="_blank"><?= t('Help on Jabber integration') ?></a></p> </div> <h3><img src="assets/img/hipchat-icon.png"/> <?= t('Hipchat') ?></h3> <div class="listing"> - <?= $this->formCheckbox('integration_hipchat', t('Send notifications to Hipchat'), 1, $values['integration_hipchat'] == 1) ?> + <?= $this->form->checkbox('integration_hipchat', t('Send notifications to Hipchat'), 1, $values['integration_hipchat'] == 1) ?> - <?= $this->formLabel(t('API URL'), 'integration_hipchat_api_url') ?> - <?= $this->formText('integration_hipchat_api_url', $values, $errors) ?> + <?= $this->form->label(t('API URL'), 'integration_hipchat_api_url') ?> + <?= $this->form->text('integration_hipchat_api_url', $values, $errors) ?> - <?= $this->formLabel(t('Room API ID or name'), 'integration_hipchat_room_id') ?> - <?= $this->formText('integration_hipchat_room_id', $values, $errors) ?> + <?= $this->form->label(t('Room API ID or name'), 'integration_hipchat_room_id') ?> + <?= $this->form->text('integration_hipchat_room_id', $values, $errors) ?> - <?= $this->formLabel(t('Room notification token'), 'integration_hipchat_room_token') ?> - <?= $this->formText('integration_hipchat_room_token', $values, $errors) ?> + <?= $this->form->label(t('Room notification token'), 'integration_hipchat_room_token') ?> + <?= $this->form->text('integration_hipchat_room_token', $values, $errors) ?> <p class="form-help"><a href="http://kanboard.net/documentation/hipchat" target="_blank"><?= t('Help on Hipchat integration') ?></a></p> </div> <h3><i class="fa fa-slack fa-fw"></i> <?= t('Slack') ?></h3> <div class="listing"> - <?= $this->formCheckbox('integration_slack_webhook', t('Send notifications to a Slack channel'), 1, $values['integration_slack_webhook'] == 1) ?> + <?= $this->form->checkbox('integration_slack_webhook', t('Send notifications to a Slack channel'), 1, $values['integration_slack_webhook'] == 1) ?> - <?= $this->formLabel(t('Webhook URL'), 'integration_slack_webhook_url') ?> - <?= $this->formText('integration_slack_webhook_url', $values, $errors) ?> + <?= $this->form->label(t('Webhook URL'), 'integration_slack_webhook_url') ?> + <?= $this->form->text('integration_slack_webhook_url', $values, $errors) ?> <p class="form-help"><a href="http://kanboard.net/documentation/slack" target="_blank"><?= t('Help on Slack integration') ?></a></p> </div> diff --git a/app/Template/config/project.php b/app/Template/config/project.php index b559d632..90dd9c8e 100644 --- a/app/Template/config/project.php +++ b/app/Template/config/project.php @@ -2,20 +2,20 @@ <h2><?= t('Project settings') ?></h2> </div> <section> -<form method="post" action="<?= $this->u('config', 'project') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('config', 'project') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Default columns for new projects (Comma-separated)'), 'board_columns') ?> - <?= $this->formText('board_columns', $values, $errors) ?><br/> + <?= $this->form->label(t('Default columns for new projects (Comma-separated)'), 'board_columns') ?> + <?= $this->form->text('board_columns', $values, $errors) ?><br/> <p class="form-help"><?= t('Default values are "%s"', $default_columns) ?></p> - <?= $this->formLabel(t('Default categories for new projects (Comma-separated)'), 'project_categories') ?> - <?= $this->formText('project_categories', $values, $errors) ?><br/> + <?= $this->form->label(t('Default categories for new projects (Comma-separated)'), 'project_categories') ?> + <?= $this->form->text('project_categories', $values, $errors) ?><br/> <p class="form-help"><?= t('Example: "Bug, Feature Request, Improvement"') ?></p> - <?= $this->formCheckbox('subtask_restriction', t('Allow only one subtask in progress at the same time for a user'), 1, $values['subtask_restriction'] == 1) ?> - <?= $this->formCheckbox('subtask_time_tracking', t('Enable time tracking for subtasks'), 1, $values['subtask_time_tracking'] == 1) ?> + <?= $this->form->checkbox('subtask_restriction', t('Allow only one subtask in progress at the same time for a user'), 1, $values['subtask_restriction'] == 1) ?> + <?= $this->form->checkbox('subtask_time_tracking', t('Enable time tracking for subtasks'), 1, $values['subtask_time_tracking'] == 1) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/config/sidebar.php b/app/Template/config/sidebar.php index 4bae9e2e..7f946dee 100644 --- a/app/Template/config/sidebar.php +++ b/app/Template/config/sidebar.php @@ -2,34 +2,34 @@ <h2><?= t('Actions') ?></h2> <ul> <li> - <?= $this->a(t('About'), 'config', 'index') ?> + <?= $this->url->link(t('About'), 'config', 'index') ?> </li> <li> - <?= $this->a(t('Application settings'), 'config', 'application') ?> + <?= $this->url->link(t('Application settings'), 'config', 'application') ?> </li> <li> - <?= $this->a(t('Project settings'), 'config', 'project') ?> + <?= $this->url->link(t('Project settings'), 'config', 'project') ?> </li> <li> - <?= $this->a(t('Board settings'), 'config', 'board') ?> + <?= $this->url->link(t('Board settings'), 'config', 'board') ?> </li> <li> - <?= $this->a(t('Calendar settings'), 'config', 'calendar') ?> + <?= $this->url->link(t('Calendar settings'), 'config', 'calendar') ?> </li> <li> - <?= $this->a(t('Link settings'), 'link', 'index') ?> + <?= $this->url->link(t('Link settings'), 'link', 'index') ?> </li> <li> - <?= $this->a(t('Currency rates'), 'currency', 'index') ?> + <?= $this->url->link(t('Currency rates'), 'currency', 'index') ?> </li> <li> - <?= $this->a(t('Integrations'), 'config', 'integrations') ?> + <?= $this->url->link(t('Integrations'), 'config', 'integrations') ?> </li> <li> - <?= $this->a(t('Webhooks'), 'config', 'webhook') ?> + <?= $this->url->link(t('Webhooks'), 'config', 'webhook') ?> </li> <li> - <?= $this->a(t('API'), 'config', 'api') ?> + <?= $this->url->link(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 06f7870b..73ca3598 100644 --- a/app/Template/config/webhook.php +++ b/app/Template/config/webhook.php @@ -2,12 +2,12 @@ <h2><?= t('Webhook settings') ?></h2> </div> <section> -<form method="post" action="<?= $this->u('config', 'webhook') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('config', 'webhook') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Webhook URL'), 'webhook_url') ?> - <?= $this->formText('webhook_url', $values, $errors) ?> + <?= $this->form->label(t('Webhook URL'), 'webhook_url') ?> + <?= $this->form->text('webhook_url', $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> @@ -26,10 +26,10 @@ </li> <li> <?= t('URL for task creation:') ?> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'task', array('token' => $values['webhook_token'])) ?>"> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().$this->url->href('webhook', 'task', array('token' => $values['webhook_token'])) ?>"> </li> <li> - <?= $this->a(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?> + <?= $this->url->link(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?> </li> </ul> </section>
\ No newline at end of file diff --git a/app/Template/currency/index.php b/app/Template/currency/index.php index 7839a142..f72c5700 100644 --- a/app/Template/currency/index.php +++ b/app/Template/currency/index.php @@ -24,12 +24,12 @@ <hr/> <h3><?= t('Change reference currency') ?></h3> <?php endif ?> -<form method="post" action="<?= $this->u('currency', 'reference') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('currency', 'reference') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Reference currency'), 'application_currency') ?> - <?= $this->formSelect('application_currency', $currencies, $config_values, $errors) ?><br/> + <?= $this->form->label(t('Reference currency'), 'application_currency') ?> + <?= $this->form->select('application_currency', $currencies, $config_values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> @@ -38,15 +38,15 @@ <hr/> <h3><?= t('Add a new currency rate') ?></h3> -<form method="post" action="<?= $this->u('currency', 'create') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('currency', 'create') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Currency'), 'currency') ?> - <?= $this->formSelect('currency', $currencies, $values, $errors) ?><br/> + <?= $this->form->label(t('Currency'), 'currency') ?> + <?= $this->form->select('currency', $currencies, $values, $errors) ?><br/> - <?= $this->formLabel(t('Rate'), 'rate') ?> - <?= $this->formText('rate', $values, $errors, array(), 'form-numeric') ?><br/> + <?= $this->form->label(t('Rate'), 'rate') ?> + <?= $this->form->text('rate', $values, $errors, array(), 'form-numeric') ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/event/comment_create.php b/app/Template/event/comment_create.php index 79238aba..462f15ca 100644 --- a/app/Template/event/comment_create.php +++ b/app/Template/event/comment_create.php @@ -1,12 +1,12 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s commented the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <div class="activity-description"> <em><?= $this->e($task['title']) ?></em><br/> - <div class="markdown"><?= $this->markdown($comment['comment']) ?></div> + <div class="markdown"><?= $this->text->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 5d22a2ce..0cb10bf6 100644 --- a/app/Template/event/comment_update.php +++ b/app/Template/event/comment_update.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s updated a comment on the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <div class="activity-description"> diff --git a/app/Template/event/events.php b/app/Template/event/events.php index 93bc6584..2dc79871 100644 --- a/app/Template/event/events.php +++ b/app/Template/event/events.php @@ -5,11 +5,11 @@ <?php foreach ($events as $event): ?> <div class="activity-event"> <p class="activity-datetime"> - <?php if ($this->contains($event['event_name'], 'subtask')): ?> + <?php if ($this->text->contains($event['event_name'], 'subtask')): ?> <i class="fa fa-tasks"></i> - <?php elseif ($this->contains($event['event_name'], 'task')): ?> + <?php elseif ($this->text->contains($event['event_name'], 'task')): ?> <i class="fa fa-newspaper-o"></i> - <?php elseif ($this->contains($event['event_name'], 'comment')): ?> + <?php elseif ($this->text->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/event/subtask_create.php b/app/Template/event/subtask_create.php index 4f33069a..ca23aa9c 100644 --- a/app/Template/event/subtask_create.php +++ b/app/Template/event/subtask_create.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s created a subtask for the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <div class="activity-description"> diff --git a/app/Template/event/subtask_update.php b/app/Template/event/subtask_update.php index 19fe2e56..11a778de 100644 --- a/app/Template/event/subtask_update.php +++ b/app/Template/event/subtask_update.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s updated a subtask for the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <div class="activity-description"> diff --git a/app/Template/event/task_assignee_change.php b/app/Template/event/task_assignee_change.php index 38e2bca7..cdec8743 100644 --- a/app/Template/event/task_assignee_change.php +++ b/app/Template/event/task_assignee_change.php @@ -1,4 +1,4 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?php $assignee = $task['assignee_name'] ?: $task['assignee_username'] ?> @@ -6,11 +6,11 @@ <?php if (! empty($assignee)): ?> <?= e('%s changed the assignee of the task %s to %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), $this->e($assignee) ) ?> <?php else: ?> - <?= e('%s remove the assignee of the task %s', $this->e($author), $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))) ?> + <?= e('%s remove the assignee of the task %s', $this->e($author), $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))) ?> <?php endif ?> </p> <p class="activity-description"> diff --git a/app/Template/event/task_close.php b/app/Template/event/task_close.php index afedbef3..3d8670a6 100644 --- a/app/Template/event/task_close.php +++ b/app/Template/event/task_close.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s closed the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <p class="activity-description"> diff --git a/app/Template/event/task_create.php b/app/Template/event/task_create.php index 4b920234..773f401c 100644 --- a/app/Template/event/task_create.php +++ b/app/Template/event/task_create.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s created the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <p class="activity-description"> diff --git a/app/Template/event/task_move_column.php b/app/Template/event/task_move_column.php index e97a3ab7..ca482e46 100644 --- a/app/Template/event/task_move_column.php +++ b/app/Template/event/task_move_column.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s moved the task %s to the column "%s"', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), $this->e($task['column_title']) ) ?> </p> diff --git a/app/Template/event/task_move_position.php b/app/Template/event/task_move_position.php index 2ed4ffe8..dcdd3e1b 100644 --- a/app/Template/event/task_move_position.php +++ b/app/Template/event/task_move_position.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s moved the task %s to the position #%d in the column "%s"', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), $task['position'], $this->e($task['column_title']) ) ?> diff --git a/app/Template/event/task_open.php b/app/Template/event/task_open.php index 9a408449..11fec64b 100644 --- a/app/Template/event/task_open.php +++ b/app/Template/event/task_open.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s opened the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <p class="activity-description"> diff --git a/app/Template/event/task_update.php b/app/Template/event/task_update.php index 0f81870b..7d036d43 100644 --- a/app/Template/event/task_update.php +++ b/app/Template/event/task_update.php @@ -1,9 +1,9 @@ -<?= $this->avatar($email, $author) ?> +<?= $this->user->avatar($email, $author) ?> <p class="activity-title"> <?= e('%s updated the task %s', $this->e($author), - $this->a(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> </p> <p class="activity-description"> diff --git a/app/Template/export/subtasks.php b/app/Template/export/subtasks.php index aa999a56..d22b96a4 100644 --- a/app/Template/export/subtasks.php +++ b/app/Template/export/subtasks.php @@ -6,15 +6,15 @@ <form method="get" action="?" autocomplete="off"> - <?= $this->formHidden('controller', $values) ?> - <?= $this->formHidden('action', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('controller', $values) ?> + <?= $this->form->hidden('action', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Start Date'), 'from') ?> - <?= $this->formText('from', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->form->label(t('Start Date'), 'from') ?> + <?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?><br/> - <?= $this->formLabel(t('End Date'), 'to') ?> - <?= $this->formText('to', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('End Date'), 'to') ?> + <?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($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/export/summary.php b/app/Template/export/summary.php index 191d36b6..ffbd6ac2 100644 --- a/app/Template/export/summary.php +++ b/app/Template/export/summary.php @@ -8,15 +8,15 @@ <form method="get" action="?" autocomplete="off"> - <?= $this->formHidden('controller', $values) ?> - <?= $this->formHidden('action', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('controller', $values) ?> + <?= $this->form->hidden('action', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Start Date'), 'from') ?> - <?= $this->formText('from', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->form->label(t('Start Date'), 'from') ?> + <?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?><br/> - <?= $this->formLabel(t('End Date'), 'to') ?> - <?= $this->formText('to', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('End Date'), 'to') ?> + <?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($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/export/tasks.php b/app/Template/export/tasks.php index e502085c..5c5e2172 100644 --- a/app/Template/export/tasks.php +++ b/app/Template/export/tasks.php @@ -6,15 +6,15 @@ <form method="get" action="?" autocomplete="off"> - <?= $this->formHidden('controller', $values) ?> - <?= $this->formHidden('action', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('controller', $values) ?> + <?= $this->form->hidden('action', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Start Date'), 'from') ?> - <?= $this->formText('from', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->form->label(t('Start Date'), 'from') ?> + <?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?><br/> - <?= $this->formLabel(t('End Date'), 'to') ?> - <?= $this->formText('to', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('End Date'), 'to') ?> + <?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($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/export/transitions.php b/app/Template/export/transitions.php index 7cd190e0..bf6ef249 100644 --- a/app/Template/export/transitions.php +++ b/app/Template/export/transitions.php @@ -8,15 +8,15 @@ <form method="get" action="?" autocomplete="off"> - <?= $this->formHidden('controller', $values) ?> - <?= $this->formHidden('action', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('controller', $values) ?> + <?= $this->form->hidden('action', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Start Date'), 'from') ?> - <?= $this->formText('from', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?><br/> + <?= $this->form->label(t('Start Date'), 'from') ?> + <?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?><br/> - <?= $this->formLabel(t('End Date'), 'to') ?> - <?= $this->formText('to', $values, $errors, array('required', 'placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('End Date'), 'to') ?> + <?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($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/file/new.php b/app/Template/file/new.php index 4f0c233b..a1a59eae 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="<?= $this->u('file', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" enctype="multipart/form-data"> - <?= $this->formCsrf() ?> +<form action="<?= $this->url->href('file', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" enctype="multipart/form-data"> + <?= $this->form->csrf() ?> <input type="file" name="files[]" multiple /> - <div class="form-help"><?= t('Maximum size: ') ?><?= is_integer($max_size) ? $this->formatBytes($max_size) : $max_size ?></div> + <div class="form-help"><?= t('Maximum size: ') ?><?= is_integer($max_size) ? $this->text->bytes($max_size) : $max_size ?></div> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/file/open.php b/app/Template/file/open.php index 70e0f8aa..3df012b6 100644 --- a/app/Template/file/open.php +++ b/app/Template/file/open.php @@ -1,6 +1,6 @@ <div class="page-header"> <h2><?= $this->e($file['name']) ?></h2> <div class="task-file-viewer"> - <img src="<?= $this->u('file', 'image', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/> + <img src="<?= $this->url->href('file', 'image', array('file_id' => $file['id'], 'project_id' => $task['project_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 04ec30d5..37f648eb 100644 --- a/app/Template/file/remove.php +++ b/app/Template/file/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'file', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'file', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/file/screenshot.php b/app/Template/file/screenshot.php index 299bf615..89d9324c 100644 --- a/app/Template/file/screenshot.php +++ b/app/Template/file/screenshot.php @@ -6,12 +6,12 @@ <p id="screenshot-inner"><?= t('Take a screenshot and press CTRL+V or ⌘+V to paste here.') ?></p> </div> -<form action="<?= $this->u('file', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => $redirect)) ?>" method="post"> +<form action="<?= $this->url->href('file', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => $redirect)) ?>" method="post"> <input type="hidden" name="screenshot"/> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/file/show.php b/app/Template/file/show.php index 3ce7f9f4..7d5dc96f 100644 --- a/app/Template/file/show.php +++ b/app/Template/file/show.php @@ -11,19 +11,19 @@ <li> <?php if (function_exists('imagecreatetruecolor')): ?> <div class="img_container"> - <img src="<?= $this->u('file', 'thumbnail', array('width' => 250, 'height' => 100, 'file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/> + <img src="<?= $this->url->href('file', 'thumbnail', array('width' => 250, 'height' => 100, 'file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/> </div> <?php endif ?> <p> <?= $this->e($file['name']) ?> - <span class="column-tooltip" title='<?= t('uploaded by: %s', $file['user_name'] ?: $file['username']).'<br>'.t('uploaded on: %s', dt('%B %e, %Y at %k:%M %p', $file['date'])).'<br>'.t('size: %s', $this->formatBytes($file['size'])) ?>'> + <span class="column-tooltip" title='<?= t('uploaded by: %s', $file['user_name'] ?: $file['username']).'<br>'.t('uploaded on: %s', dt('%B %e, %Y at %k:%M %p', $file['date'])).'<br>'.t('size: %s', $this->text->bytes($file['size'])) ?>'> <i class="fa fa-info-circle"></i> </span> </p> <span class="task-show-file-actions task-show-image-actions"> - <i class="fa fa-eye"></i> <?= $this->a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> - <i class="fa fa-trash"></i> <?= $this->a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> - <i class="fa fa-download"></i> <?= $this->a(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <i class="fa fa-eye"></i> <?= $this->url->link(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + <i class="fa fa-trash"></i> <?= $this->url->link(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <i class="fa fa-download"></i> <?= $this->url->link(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> </span> </li> <?php endforeach ?> @@ -35,17 +35,17 @@ <table class="task-show-file-table"> <?php foreach ($files as $file): ?> <tr> - <td><i class="fa <?= $this->getFileIcon($file['name']) ?> fa-fw"></i></td> + <td><i class="fa <?= $this->file->icon($file['name']) ?> fa-fw"></i></td> <td> <?= $this->e($file['name']) ?> - <span class="column-tooltip" title='<?= t('uploaded by: %s', $file['user_name'] ?: $file['username']).'<br>'.t('uploaded on: %s', dt('%B %e, %Y at %k:%M %p', $file['date'])).'<br>'.t('size: %s', $this->formatBytes($file['size'])) ?>'> + <span class="column-tooltip" title='<?= t('uploaded by: %s', $file['user_name'] ?: $file['username']).'<br>'.t('uploaded on: %s', dt('%B %e, %Y at %k:%M %p', $file['date'])).'<br>'.t('size: %s', $this->text->bytes($file['size'])) ?>'> <i class="fa fa-info-circle"></i> </span> </td> <td> <span class="task-show-file-actions"> - <i class="fa fa-trash"></i> <?= $this->a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> - <i class="fa fa-download"></i> <?= $this->a(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <i class="fa fa-trash"></i> <?= $this->url->link(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <i class="fa fa-download"></i> <?= $this->url->link(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> </span> </td> </tr> diff --git a/app/Template/hourlyrate/index.php b/app/Template/hourlyrate/index.php index 9d0b77c8..af305d07 100644 --- a/app/Template/hourlyrate/index.php +++ b/app/Template/hourlyrate/index.php @@ -17,7 +17,7 @@ <td><?= $rate['currency'] ?></td> <td><?= dt('%b %e, %Y', $rate['date_effective']) ?></td> <td> - <?= $this->a(t('Remove'), 'hourlyrate', 'confirm', array('user_id' => $user['id'], 'rate_id' => $rate['id'])) ?> + <?= $this->url->link(t('Remove'), 'hourlyrate', 'confirm', array('user_id' => $user['id'], 'rate_id' => $rate['id'])) ?> </td> </tr> <?php endforeach ?> @@ -26,19 +26,19 @@ <h3><?= t('Add new rate') ?></h3> <?php endif ?> -<form method="post" action="<?= $this->u('hourlyrate', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('hourlyrate', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formHidden('user_id', $values) ?> - <?= $this->formCsrf() ?> + <?= $this->form->hidden('user_id', $values) ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Hourly rate'), 'rate') ?> - <?= $this->formText('rate', $values, $errors, array('required'), 'form-numeric') ?> + <?= $this->form->label(t('Hourly rate'), 'rate') ?> + <?= $this->form->text('rate', $values, $errors, array('required'), 'form-numeric') ?> - <?= $this->formLabel(t('Currency'), 'currency') ?> - <?= $this->formSelect('currency', $currencies_list, $values, $errors, array('required')) ?> + <?= $this->form->label(t('Currency'), 'currency') ?> + <?= $this->form->select('currency', $currencies_list, $values, $errors, array('required')) ?> - <?= $this->formLabel(t('Effective date'), 'date_effective') ?> - <?= $this->formText('date_effective', $values, $errors, array('required'), 'form-date') ?> + <?= $this->form->label(t('Effective date'), 'date_effective') ?> + <?= $this->form->text('date_effective', $values, $errors, array('required'), 'form-date') ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/hourlyrate/remove.php b/app/Template/hourlyrate/remove.php index 7f22728e..121436e4 100644 --- a/app/Template/hourlyrate/remove.php +++ b/app/Template/hourlyrate/remove.php @@ -6,8 +6,8 @@ <p class="alert alert-info"><?= t('Do you really want to remove this hourly rate?') ?></p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'hourlyrate', 'remove', array('user_id' => $user['id'], 'rate_id' => $rate_id), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'hourlyrate', 'remove', array('user_id' => $user['id'], 'rate_id' => $rate_id), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'hourlyrate', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('cancel'), 'hourlyrate', 'index', array('user_id' => $user['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/layout.php b/app/Template/layout.php index 7baecde9..cf74c8ab 100644 --- a/app/Template/layout.php +++ b/app/Template/layout.php @@ -11,16 +11,13 @@ <?php endif ?> <?php if (! isset($not_editable)): ?> - <?= $this->js('assets/js/app.js') ?> + <?= $this->asset->js('assets/js/app.js') ?> <?php endif ?> - <?= $this->css($this->u('app', 'colors'), false, 'all') ?> - <?= $this->css('assets/css/app.css') ?> - <?= $this->css('assets/css/print.css', true, 'print') ?> - - <?php if ($this->config->get('application_stylesheet')): ?> - <style><?= $this->config->get('application_stylesheet') ?></style> - <?php endif ?> + <?= $this->asset->css($this->url->href('app', 'colors'), false, 'all') ?> + <?= $this->asset->css('assets/css/app.css') ?> + <?= $this->asset->css('assets/css/print.css', true, 'print') ?> + <?= $this->asset->customCss() ?> <link rel="icon" type="image/png" href="assets/img/favicon.png"> <link rel="apple-touch-icon" href="assets/img/touch-icon-iphone.png"> @@ -30,19 +27,19 @@ <title><?= isset($title) ? $this->e($title) : 'Kanboard' ?></title> </head> - <body data-status-url="<?= $this->u('app', 'status') ?>" - data-login-url="<?= $this->u('auth', 'login') ?>" - data-timezone="<?= $this->getTimezone() ?>" - data-js-lang="<?= $this->jsLang() ?>"> + <body data-status-url="<?= $this->url->href('app', 'status') ?>" + data-login-url="<?= $this->url->href('auth', 'login') ?>" + data-timezone="<?= $this->app->getTimezone() ?>" + data-js-lang="<?= $this->app->jsLang() ?>"> <?php if (isset($no_layout) && $no_layout): ?> <?= $content_for_layout ?> <?php else: ?> <header> <nav> - <h1><?= $this->a('K<span>B</span>', 'app', 'index', array(), false, 'logo', t('Dashboard')).' '.$this->summary($this->e($title)) ?> + <h1><?= $this->url->link('K<span>B</span>', 'app', 'index', array(), false, 'logo', t('Dashboard')).' '.$this->text->truncate($this->e($title)) ?> <?php if (! empty($description)): ?> - <span class="column-tooltip" title='<?= $this->e($this->markdown($description)) ?>'> + <span class="column-tooltip" title='<?= $this->e($this->text->markdown($description)) ?>'> <i class="fa fa-info-circle"></i> </span> <?php endif ?> @@ -50,7 +47,7 @@ <ul> <?php if (isset($board_selector) && ! empty($board_selector)): ?> <li> - <select id="board-selector" data-notfound="<?= t('No results match:') ?>" data-placeholder="<?= t('Display another project') ?>" data-board-url="<?= $this->u('board', 'show', array('project_id' => 'PROJECT_ID')) ?>"> + <select id="board-selector" data-notfound="<?= t('No results match:') ?>" data-placeholder="<?= t('Display another project') ?>" data-board-url="<?= $this->url->href('board', 'show', array('project_id' => 'PROJECT_ID')) ?>"> <option value=""></option> <?php foreach($board_selector as $board_id => $board_name): ?> <option value="<?= $board_id ?>"><?= $this->e($board_name) ?></option> @@ -59,15 +56,14 @@ </li> <?php endif ?> <li> - <?= $this->a(t('Logout'), 'auth', 'logout') ?> - <span class="username hide-tablet">(<?= $this->a($this->e($this->getFullname()), 'user', 'show', array('user_id' => $this->userSession->getId())) ?>)</span> + <?= $this->url->link(t('Logout'), 'auth', 'logout') ?> + <span class="username hide-tablet">(<?= $this->user->getProfileLink() ?>)</span> </li> </ul> </nav> </header> <section class="page"> - <?= $this->flash('<div class="alert alert-success alert-fade-out">%s</div>') ?> - <?= $this->flashError('<div class="alert alert-error">%s</div>') ?> + <?= $this->app->flashMessage() ?> <?= $content_for_layout ?> </section> <?php endif ?> diff --git a/app/Template/link/create.php b/app/Template/link/create.php index 12589574..2b4ac62c 100644 --- a/app/Template/link/create.php +++ b/app/Template/link/create.php @@ -2,15 +2,15 @@ <h2><?= t('Add a new link') ?></h2> </div> -<form action="<?= $this->u('link', 'save') ?>" method="post" autocomplete="off"> +<form action="<?= $this->url->href('link', 'save') ?>" method="post" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Label'), 'label') ?> - <?= $this->formText('label', $values, $errors, array('required')) ?> + <?= $this->form->label(t('Label'), 'label') ?> + <?= $this->form->text('label', $values, $errors, array('required')) ?> - <?= $this->formLabel(t('Opposite label'), 'opposite_label') ?> - <?= $this->formText('opposite_label', $values, $errors) ?> + <?= $this->form->label(t('Opposite label'), 'opposite_label') ?> + <?= $this->form->text('opposite_label', $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/link/edit.php b/app/Template/link/edit.php index d9ce280c..516de464 100644 --- a/app/Template/link/edit.php +++ b/app/Template/link/edit.php @@ -2,20 +2,20 @@ <h2><?= t('Link modification') ?></h2> </div> -<form action="<?= $this->u('link', 'update', array('link_id' => $link['id'])) ?>" method="post" autocomplete="off"> +<form action="<?= $this->url->href('link', 'update', array('link_id' => $link['id'])) ?>" method="post" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('id', $values) ?> - <?= $this->formLabel(t('Label'), 'label') ?> - <?= $this->formText('label', $values, $errors, array('required')) ?> + <?= $this->form->label(t('Label'), 'label') ?> + <?= $this->form->text('label', $values, $errors, array('required')) ?> - <?= $this->formLabel(t('Opposite label'), 'opposite_id') ?> - <?= $this->formSelect('opposite_id', $labels, $values, $errors) ?> + <?= $this->form->label(t('Opposite label'), 'opposite_id') ?> + <?= $this->form->select('opposite_id', $labels, $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'link', 'index') ?> + <?= $this->url->link(t('cancel'), 'link', 'index') ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/link/index.php b/app/Template/link/index.php index 90d1c357..1475bd50 100644 --- a/app/Template/link/index.php +++ b/app/Template/link/index.php @@ -18,9 +18,9 @@ </td> <td> <ul> - <?= $this->a(t('Edit'), 'link', 'edit', array('link_id' => $link['id'])) ?> + <?= $this->url->link(t('Edit'), 'link', 'edit', array('link_id' => $link['id'])) ?> <?= t('or') ?> - <?= $this->a(t('Remove'), 'link', 'confirm', array('link_id' => $link['id'])) ?> + <?= $this->url->link(t('Remove'), 'link', 'confirm', array('link_id' => $link['id'])) ?> </ul> </td> </tr> diff --git a/app/Template/link/remove.php b/app/Template/link/remove.php index a802feb0..12ca14bb 100644 --- a/app/Template/link/remove.php +++ b/app/Template/link/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'link', 'remove', array('link_id' => $link['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'link', 'remove', array('link_id' => $link['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'link', 'index') ?> + <?= $this->url->link(t('cancel'), 'link', 'index') ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/notification/comment_creation.php b/app/Template/notification/comment_creation.php index b28e261a..747c4f43 100644 --- a/app/Template/notification/comment_creation.php +++ b/app/Template/notification/comment_creation.php @@ -2,6 +2,6 @@ <h3><?= t('New comment posted by %s', $comment['name'] ?: $comment['username']) ?></h3> -<?= $this->markdown($comment['comment']) ?> +<?= $this->text->markdown($comment['comment']) ?> <?= $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 88154f0b..a15e5d6d 100644 --- a/app/Template/notification/comment_update.php +++ b/app/Template/notification/comment_update.php @@ -2,6 +2,6 @@ <h3><?= t('Comment updated') ?></h3> -<?= $this->markdown($comment['comment']) ?> +<?= $this->text->markdown($comment['comment']) ?> <?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/footer.php b/app/Template/notification/footer.php index 4de1487e..7041c43b 100644 --- a/app/Template/notification/footer.php +++ b/app/Template/notification/footer.php @@ -2,5 +2,5 @@ Kanboard <?php if (isset($application_url) && ! empty($application_url)): ?> - - <a href="<?= $application_url.$this->u('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= t('view the task on Kanboard') ?></a>. + - <a href="<?= $application_url.$this->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= t('view the task on Kanboard') ?></a>. <?php endif ?> diff --git a/app/Template/notification/task_assignee_change.php b/app/Template/notification/task_assignee_change.php index faab92f3..c9729ac9 100644 --- a/app/Template/notification/task_assignee_change.php +++ b/app/Template/notification/task_assignee_change.php @@ -14,7 +14,7 @@ <?php if (! empty($task['description'])): ?> <h2><?= t('Description') ?></h2> - <?= $this->markdown($task['description']) ?: t('There is no description.') ?> + <?= $this->text->markdown($task['description']) ?: t('There is no description.') ?> <?php endif ?> <?= $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 dfd3e591..0905d3f5 100644 --- a/app/Template/notification/task_creation.php +++ b/app/Template/notification/task_creation.php @@ -37,7 +37,7 @@ <?php if (! empty($task['description'])): ?> <h2><?= t('Description') ?></h2> - <?= $this->markdown($task['description']) ?> + <?= $this->text->markdown($task['description']) ?> <?php endif ?> <?= $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 72c8de1b..7482424a 100644 --- a/app/Template/notification/task_due.php +++ b/app/Template/notification/task_due.php @@ -5,7 +5,7 @@ <li> (<strong>#<?= $task['id'] ?></strong>) <?php if ($application_url): ?> - <a href="<?= $application_url.$this->u('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $this->e($task['title']) ?></a> + <a href="<?= $application_url.$this->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $this->e($task['title']) ?></a> <?php else: ?> <?= $this->e($task['title']) ?> <?php endif ?> diff --git a/app/Template/notification/task_update.php b/app/Template/notification/task_update.php index 71e949dd..ffea49cd 100644 --- a/app/Template/notification/task_update.php +++ b/app/Template/notification/task_update.php @@ -37,7 +37,7 @@ <?php if (! empty($task['description'])): ?> <h2><?= t('Description') ?></h2> - <?= $this->markdown($task['description']) ?: t('There is no description.') ?> + <?= $this->text->markdown($task['description']) ?: t('There is no description.') ?> <?php endif ?> <?= $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 7da6be5c..1c5dcb75 100644 --- a/app/Template/project/activity.php +++ b/app/Template/project/activity.php @@ -3,22 +3,22 @@ <ul> <li> <i class="fa fa-table fa-fw"></i> - <?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-calendar fa-fw"></i> - <?= $this->a(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Calendar'), 'calendar', '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'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(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><?= $this->a(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-rss-square fa-fw"></i><?= $this->url->link(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></li> <?php endif ?> </ul> </div> diff --git a/app/Template/project/disable.php b/app/Template/project/disable.php index 48a09a97..ddfcdca2 100644 --- a/app/Template/project/disable.php +++ b/app/Template/project/disable.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= $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'])) ?> + <?= $this->url->link(t('Yes'), 'project', 'disable', array('project_id' => $project['id'], 'disable' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->url->link(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 7e7fd85e..8967c306 100644 --- a/app/Template/project/duplicate.php +++ b/app/Template/project/duplicate.php @@ -6,18 +6,18 @@ <p class="alert alert-info"> <?= t('Which parts of the project do you want to duplicate?') ?> </p> - <form method="post" action="<?= $this->u('project', 'duplicate', array('project_id' => $project['id'], 'duplicate' => 'yes')) ?>" autocomplete="off"> + <form method="post" action="<?= $this->url->href('project', 'duplicate', array('project_id' => $project['id'], 'duplicate' => 'yes')) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formCheckbox('category', t('Categories'), 1, true) ?> - <?= $this->formCheckbox('action', t('Actions'), 1, true) ?> - <?= $this->formCheckbox('swimlane', t('Swimlanes'), 1, false) ?> - <?= $this->formCheckbox('task', t('Tasks'), 1, false) ?> + <?= $this->form->checkbox('category', t('Categories'), 1, true) ?> + <?= $this->form->checkbox('action', t('Actions'), 1, true) ?> + <?= $this->form->checkbox('swimlane', t('Swimlanes'), 1, false) ?> + <?= $this->form->checkbox('task', t('Tasks'), 1, false) ?> <div class="form-actions"> <input type="submit" value="<?= t('Duplicate') ?>" class="btn btn-red"/> - <?= t('or') ?> <?= $this->a(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> </div> </form> </div>
\ No newline at end of file diff --git a/app/Template/project/edit.php b/app/Template/project/edit.php index 8b94e378..794267f4 100644 --- a/app/Template/project/edit.php +++ b/app/Template/project/edit.php @@ -1,28 +1,28 @@ <div class="page-header"> <h2><?= t('Edit project') ?></h2> </div> -<form method="post" action="<?= $this->u('project', 'update', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('project', 'update', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('id', $values) ?> - <?= $this->formLabel(t('Name'), 'name') ?> - <?= $this->formText('name', $values, $errors, array('required', 'maxlength="50"')) ?> + <?= $this->form->label(t('Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors, array('required', 'maxlength="50"')) ?> - <?= $this->formLabel(t('Identifier'), 'identifier') ?> - <?= $this->formText('identifier', $values, $errors, array('maxlength="50"')) ?> + <?= $this->form->label(t('Identifier'), 'identifier') ?> + <?= $this->form->text('identifier', $values, $errors, array('maxlength="50"')) ?> <p class="form-help"><?= t('The project identifier is an optional alphanumeric code used to identify your project.') ?></p> - <?php if ($this->userSession->isAdmin()): ?> - <?= $this->formCheckbox('is_private', t('Private project'), 1, $project['is_private'] == 1) ?> + <?php if ($this->user->isAdmin()): ?> + <?= $this->form->checkbox('is_private', t('Private project'), 1, $project['is_private'] == 1) ?> <?php endif ?> - <?= $this->formLabel(t('Description'), 'description') ?> + <?= $this->form->label(t('Description'), 'description') ?> <div class="form-tabs"> <div class="write-area"> - <?= $this->formTextarea('description', $values, $errors) ?> + <?= $this->form->textarea('description', $values, $errors) ?> </div> <div class="preview-area"> <div class="markdown"></div> diff --git a/app/Template/project/enable.php b/app/Template/project/enable.php index b683ea7c..c10d2f12 100644 --- a/app/Template/project/enable.php +++ b/app/Template/project/enable.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= $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'])) ?> + <?= $this->url->link(t('Yes'), 'project', 'enable', array('project_id' => $project['id'], 'enable' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/project/feed.php b/app/Template/project/feed.php index 14427af9..2062e801 100644 --- a/app/Template/project/feed.php +++ b/app/Template/project/feed.php @@ -1,16 +1,16 @@ <?= '<?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="<?= $this->getCurrentBaseUrl() ?>"/> - <link rel="self" type="application/atom+xml" href="<?= $this->getCurrentBaseUrl().$this->u('project', 'feed', array('token' => $project['token'])) ?>"/> + <link rel="alternate" type="text/html" href="<?= $this->url->base() ?>"/> + <link rel="self" type="application/atom+xml" href="<?= $this->url->base().$this->url->href('project', 'feed', array('token' => $project['token'])) ?>"/> <updated><?= date(DATE_ATOM) ?></updated> - <id><?= $this->getCurrentBaseUrl() ?></id> - <icon><?= $this->getCurrentBaseUrl() ?>assets/img/favicon.png</icon> + <id><?= $this->url->base() ?></id> + <icon><?= $this->url->base() ?>assets/img/favicon.png</icon> <?php foreach ($events as $e): ?> <entry> <title type="text"><?= $e['event_title'] ?></title> - <link rel="alternate" href="<?= $this->getCurrentBaseUrl().$this->u('task', 'show', array('task_id' => $e['task_id'])) ?>"/> + <link rel="alternate" href="<?= $this->url->base().$this->url->href('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> diff --git a/app/Template/project/index.php b/app/Template/project/index.php index 8d2bc30b..1080968e 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 ($this->userSession->isAdmin()): ?> - <li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New project'), 'project', 'create') ?></li> + <?php if ($this->user->isAdmin()): ?> + <li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New project'), 'project', 'create') ?></li> <?php endif ?> - <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-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'project', 'create', array('private' => 1)) ?></li> </ul> </div> <section> @@ -22,7 +22,7 @@ <?php foreach ($paginator->getCollection() as $project): ?> <tr> <td> - <?= $this->a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?> + <?= $this->url->link('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?> </td> <td> <?php if ($project['is_active']): ?> @@ -35,7 +35,7 @@ <?= $this->e($project['identifier']) ?> </td> <td> - <?= $this->a('<i class="fa fa-table"></i>', 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> + <?= $this->url->link('<i class="fa fa-table"></i>', 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> <?php if ($project['is_public']): ?> <i class="fa fa-share-alt fa-fw"></i> @@ -44,9 +44,9 @@ <i class="fa fa-lock fa-fw"></i> <?php endif ?> - <?= $this->a($this->e($project['name']), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link($this->e($project['name']), 'project', 'show', array('project_id' => $project['id'])) ?> <?php if (! empty($project['description'])): ?> - <span class="column-tooltip" title='<?= $this->e($this->markdown($project['description'])) ?>'> + <span class="column-tooltip" title='<?= $this->e($this->text->markdown($project['description'])) ?>'> <i class="fa fa-info-circle"></i> </span> <?php endif ?> diff --git a/app/Template/project/integrations.php b/app/Template/project/integrations.php index d4fab23b..698e438c 100644 --- a/app/Template/project/integrations.php +++ b/app/Template/project/integrations.php @@ -2,53 +2,53 @@ <h2><?= t('Integration with third-party services') ?></h2> </div> -<form method="post" action="<?= $this->u('project', 'integration', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> +<form method="post" action="<?= $this->url->href('project', 'integration', array('project_id' => $project['id'])) ?>" autocomplete="off"> + <?= $this->form->csrf() ?> <h3><i class="fa fa-github fa-fw"></i> <?= t('Github webhooks') ?></h3> <div class="listing"> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'github', array('token' => $webhook_token, 'project_id' => $project['id'])) ?>"/><br/> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().$this->url->href('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 webhooks') ?></a></p> </div> <h3><img src="assets/img/gitlab-icon.png"/> <?= t('Gitlab webhooks') ?></h3> <div class="listing"> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'gitlab', array('token' => $webhook_token, 'project_id' => $project['id'])) ?>"/><br/> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().$this->url->href('webhook', 'gitlab', array('token' => $webhook_token, 'project_id' => $project['id'])) ?>"/><br/> <p class="form-help"><a href="http://kanboard.net/documentation/gitlab-webhooks" target="_blank"><?= t('Help on Gitlab webhooks') ?></a></p> </div> <h3><i class="fa fa-bitbucket fa-fw"></i> <?= t('Bitbucket webhooks') ?></h3> <div class="listing"> - <input type="text" class="auto-select" readonly="readonly" value="<?= $this->getCurrentBaseUrl().$this->u('webhook', 'bitbucket', array('token' => $webhook_token, 'project_id' => $project['id'])) ?>"/><br/> + <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().$this->url->href('webhook', 'bitbucket', array('token' => $webhook_token, 'project_id' => $project['id'])) ?>"/><br/> <p class="form-help"><a href="http://kanboard.net/documentation/bitbucket-webhooks" target="_blank"><?= t('Help on Bitbucket webhooks') ?></a></p> </div> <h3><img src="assets/img/jabber-icon.png"/> <?= t('Jabber (XMPP)') ?></h3> <div class="listing"> - <?= $this->formCheckbox('jabber', t('Send notifications to Jabber'), 1, isset($values['jabber']) && $values['jabber'] == 1) ?> + <?= $this->form->checkbox('jabber', t('Send notifications to Jabber'), 1, isset($values['jabber']) && $values['jabber'] == 1) ?> - <?= $this->formLabel(t('XMPP server address'), 'jabber_server') ?> - <?= $this->formText('jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?> + <?= $this->form->label(t('XMPP server address'), 'jabber_server') ?> + <?= $this->form->text('jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?> <p class="form-help"><?= t('The server address must use this format: "tcp://hostname:5222"') ?></p> - <?= $this->formLabel(t('Jabber domain'), 'jabber_domain') ?> - <?= $this->formText('jabber_domain', $values, $errors, array('placeholder="example.com"')) ?> + <?= $this->form->label(t('Jabber domain'), 'jabber_domain') ?> + <?= $this->form->text('jabber_domain', $values, $errors, array('placeholder="example.com"')) ?> - <?= $this->formLabel(t('Username'), 'jabber_username') ?> - <?= $this->formText('jabber_username', $values, $errors) ?> + <?= $this->form->label(t('Username'), 'jabber_username') ?> + <?= $this->form->text('jabber_username', $values, $errors) ?> - <?= $this->formLabel(t('Password'), 'jabber_password') ?> - <?= $this->formPassword('jabber_password', $values, $errors) ?> + <?= $this->form->label(t('Password'), 'jabber_password') ?> + <?= $this->form->password('jabber_password', $values, $errors) ?> - <?= $this->formLabel(t('Jabber nickname'), 'jabber_nickname') ?> - <?= $this->formText('jabber_nickname', $values, $errors) ?> + <?= $this->form->label(t('Jabber nickname'), 'jabber_nickname') ?> + <?= $this->form->text('jabber_nickname', $values, $errors) ?> - <?= $this->formLabel(t('Multi-user chat room'), 'jabber_room') ?> - <?= $this->formText('jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?> + <?= $this->form->label(t('Multi-user chat room'), 'jabber_room') ?> + <?= $this->form->text('jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?> <p class="form-help"><a href="http://kanboard.net/documentation/jabber" target="_blank"><?= t('Help on Jabber integration') ?></a></p> @@ -60,16 +60,16 @@ <h3><img src="assets/img/hipchat-icon.png"/> <?= t('Hipchat') ?></h3> <div class="listing"> - <?= $this->formCheckbox('hipchat', t('Send notifications to Hipchat'), 1, isset($values['hipchat']) && $values['hipchat'] == 1) ?> + <?= $this->form->checkbox('hipchat', t('Send notifications to Hipchat'), 1, isset($values['hipchat']) && $values['hipchat'] == 1) ?> - <?= $this->formLabel(t('API URL'), 'hipchat_api_url') ?> - <?= $this->formText('hipchat_api_url', $values, $errors) ?> + <?= $this->form->label(t('API URL'), 'hipchat_api_url') ?> + <?= $this->form->text('hipchat_api_url', $values, $errors) ?> - <?= $this->formLabel(t('Room API ID or name'), 'hipchat_room_id') ?> - <?= $this->formText('hipchat_room_id', $values, $errors) ?> + <?= $this->form->label(t('Room API ID or name'), 'hipchat_room_id') ?> + <?= $this->form->text('hipchat_room_id', $values, $errors) ?> - <?= $this->formLabel(t('Room notification token'), 'hipchat_room_token') ?> - <?= $this->formText('hipchat_room_token', $values, $errors) ?> + <?= $this->form->label(t('Room notification token'), 'hipchat_room_token') ?> + <?= $this->form->text('hipchat_room_token', $values, $errors) ?> <p class="form-help"><a href="http://kanboard.net/documentation/hipchat" target="_blank"><?= t('Help on Hipchat integration') ?></a></p> @@ -81,10 +81,10 @@ <h3><i class="fa fa-slack fa-fw"></i> <?= t('Slack') ?></h3> <div class="listing"> - <?= $this->formCheckbox('slack', t('Send notifications to a Slack channel'), 1, isset($values['slack']) && $values['slack'] == 1) ?> + <?= $this->form->checkbox('slack', t('Send notifications to a Slack channel'), 1, isset($values['slack']) && $values['slack'] == 1) ?> - <?= $this->formLabel(t('Webhook URL'), 'slack_webhook_url') ?> - <?= $this->formText('slack_webhook_url', $values, $errors) ?> + <?= $this->form->label(t('Webhook URL'), 'slack_webhook_url') ?> + <?= $this->form->text('slack_webhook_url', $values, $errors) ?> <p class="form-help"><a href="http://kanboard.net/documentation/slack" target="_blank"><?= t('Help on Slack integration') ?></a></p> diff --git a/app/Template/project/layout.php b/app/Template/project/layout.php index 8cd1fd3c..f5409500 100644 --- a/app/Template/project/layout.php +++ b/app/Template/project/layout.php @@ -3,11 +3,11 @@ <ul> <li> <i class="fa fa-table fa-fw"></i> - <?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(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') ?> + <?= $this->url->link(t('All projects'), 'project', 'index') ?> </li> </ul> </div> diff --git a/app/Template/project/new.php b/app/Template/project/new.php index b68258b4..25b70ac2 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><?= $this->a(t('All projects'), 'project', 'index') ?></li> + <li><i class="fa fa-folder fa-fw"></i><?= $this->url->link(t('All projects'), 'project', 'index') ?></li> </ul> </div> <section> - <form method="post" action="<?= $this->u('project', 'save') ?>" autocomplete="off"> + <form method="post" action="<?= $this->url->href('project', 'save') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('is_private', $values) ?> - <?= $this->formLabel(t('Name'), 'name') ?> - <?= $this->formText('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('is_private', $values) ?> + <?= $this->form->label(t('Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - <?= t('or') ?> <?= $this->a(t('cancel'), 'project', 'index') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'project', 'index') ?> </div> </form> </section> diff --git a/app/Template/project/remove.php b/app/Template/project/remove.php index 0f6fec78..fa43fc78 100644 --- a/app/Template/project/remove.php +++ b/app/Template/project/remove.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= $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'])) ?> + <?= $this->url->link(t('Yes'), 'project', 'remove', array('project_id' => $project['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->url->link(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 47ba0f77..a8e387c6 100644 --- a/app/Template/project/search.php +++ b/app/Template/project/search.php @@ -3,28 +3,28 @@ <ul> <li> <i class="fa fa-table fa-fw"></i> - <?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-calendar fa-fw"></i> - <?= $this->a(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Calendar'), 'calendar', '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'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?> </li> </ul> </div> <section> <form method="get" action="?" autocomplete="off"> - <?= $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') ?> + <?= $this->form->hidden('controller', $values) ?> + <?= $this->form->hidden('action', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> + <?= $this->form->text('search', $values, array(), array('autofocus', 'required', 'placeholder="'.t('Search').'"'), 'form-input-large') ?> <input type="submit" value="<?= t('Search') ?>" class="btn btn-blue"/> </form> diff --git a/app/Template/project/share.php b/app/Template/project/share.php index 07f29fdc..a9146599 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> <?= $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> - <li><strong><i class="fa fa-calendar"></i> <?= $this->a(t('iCal feed'), 'ical', 'project', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'project', 'feed', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'project', array('token' => $project['token']), false, '', '', true) ?></strong></li> </ul> </div> - <?= $this->a(t('Disable public access'), 'project', 'share', array('project_id' => $project['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Disable public access'), 'project', 'share', array('project_id' => $project['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> <?php else: ?> - <?= $this->a(t('Enable public access'), 'project', 'share', array('project_id' => $project['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?> + <?= $this->url->link(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 9c6cd1a8..9ffbd5bc 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> <?= $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> + <li><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-rss-square"></i> <?= $this->url->link(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><?= $this->a(t('%d tasks on the board', $stats['nb_active_tasks']), 'board', 'show', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(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><?= $this->a(t('%d closed tasks', $stats['nb_inactive_tasks']), 'project', 'tasks', array('project_id' => $project['id'])) ?></li> + <li><?= $this->url->link(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> @@ -50,7 +50,7 @@ <td> <?= $this->e($column['title']) ?> <?php if (! empty($column['description'])): ?> - <span class="column-tooltip" title='<?= $this->e($this->markdown($column['description'])) ?>'> + <span class="column-tooltip" title='<?= $this->e($this->text->markdown($column['description'])) ?>'> <i class="fa fa-info-circle"></i> </span> <?php endif ?> @@ -67,6 +67,6 @@ </div> <article class="markdown"> - <?= $this->markdown($project['description']) ?> + <?= $this->text->markdown($project['description']) ?> </article> <?php endif ?> diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php index 31e3ff04..5c7ea715 100644 --- a/app/Template/project/sidebar.php +++ b/app/Template/project/sidebar.php @@ -2,71 +2,71 @@ <h2><?= t('Actions') ?></h2> <ul> <li> - <?= $this->a(t('Summary'), 'project', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Summary'), 'project', 'show', array('project_id' => $project['id'])) ?> </li> - <?php if ($this->isManager($project['id'])): ?> + <?php if ($this->user->isManager($project['id'])): ?> <li> - <?= $this->a(t('Public access'), 'project', 'share', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Public access'), 'project', 'share', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Integrations'), 'project', 'integration', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Integrations'), 'project', 'integration', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Edit board'), 'column', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Edit board'), 'column', 'index', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Category management'), 'category', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Category management'), 'category', 'index', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> </li> - <?php if ($this->userSession->isAdmin() || $project['is_private'] == 0): ?> + <?php if ($this->user->isAdmin() || $project['is_private'] == 0): ?> <li> - <?= $this->a(t('User management'), 'project', 'users', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('User management'), 'project', 'users', array('project_id' => $project['id'])) ?> </li> <?php endif ?> <li> - <?= $this->a(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Duplicate'), 'project', 'duplicate', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Duplicate'), 'project', 'duplicate', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Budget'), 'budget', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Budget'), 'budget', 'index', array('project_id' => $project['id'])) ?> </li> <li> <?php if ($project['is_active']): ?> - <?= $this->a(t('Disable'), 'project', 'disable', array('project_id' => $project['id']), true) ?> + <?= $this->url->link(t('Disable'), 'project', 'disable', array('project_id' => $project['id']), true) ?> <?php else: ?> - <?= $this->a(t('Enable'), 'project', 'enable', array('project_id' => $project['id']), true) ?> + <?= $this->url->link(t('Enable'), 'project', 'enable', array('project_id' => $project['id']), true) ?> <?php endif ?> </li> - <?php if ($this->userSession->isAdmin()): ?> + <?php if ($this->user->isAdmin()): ?> <li> - <?= $this->a(t('Remove'), 'project', 'remove', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Remove'), 'project', 'remove', array('project_id' => $project['id'])) ?> </li> <?php endif ?> <?php endif ?> </ul> - <?php if ($this->acl->isManagerActionAllowed($project['id'])): ?> + <?php if ($this->user->isManager($project['id'])): ?> <h2><?= t('Exports') ?></h2> <ul> <li> - <?= $this->a(t('Tasks'), 'export', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Tasks'), 'export', 'tasks', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Subtasks'), 'export', 'subtasks', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Subtasks'), 'export', 'subtasks', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Task transitions'), 'export', 'transitions', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Task transitions'), 'export', 'transitions', array('project_id' => $project['id'])) ?> </li> <li> - <?= $this->a(t('Daily project summary'), 'export', 'summary', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Daily project summary'), 'export', 'summary', array('project_id' => $project['id'])) ?> </li> </ul> <?php endif ?> diff --git a/app/Template/project/tasks.php b/app/Template/project/tasks.php index b22746f9..06f28061 100644 --- a/app/Template/project/tasks.php +++ b/app/Template/project/tasks.php @@ -3,19 +3,19 @@ <ul> <li> <i class="fa fa-table fa-fw"></i> - <?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-calendar fa-fw"></i> - <?= $this->a(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Calendar'), 'calendar', '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'])) ?> + <?= $this->url->link(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'])) ?> + <?= $this->url->link(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?> </li> </ul> </div> diff --git a/app/Template/project/users.php b/app/Template/project/users.php index 18147340..d725a9e8 100644 --- a/app/Template/project/users.php +++ b/app/Template/project/users.php @@ -24,12 +24,12 @@ <?php if ($project['is_private'] == 0): ?> <td> <ul> - <li><?= $this->a(t('Revoke'), 'project', 'revoke', array('project_id' => $project['id'], 'user_id' => $user_id), true) ?></li> + <li><?= $this->url->link(t('Revoke'), 'project', 'revoke', array('project_id' => $project['id'], 'user_id' => $user_id), true) ?></li> <li> <?php if (isset($users['managers'][$user_id])): ?> - <?= $this->a(t('Set project member'), 'project', 'role', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 0), true) ?> + <?= $this->url->link(t('Set project member'), 'project', 'role', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 0), true) ?> <?php else: ?> - <?= $this->a(t('Set project manager'), 'project', 'role', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 1), true) ?> + <?= $this->url->link(t('Set project manager'), 'project', 'role', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 1), true) ?> <?php endif ?> </li> </ul> @@ -42,14 +42,14 @@ <?php if ($project['is_private'] == 0 && ! empty($users['not_allowed'])): ?> <hr/> - <form method="post" action="<?= $this->u('project', 'allow', array('project_id' => $project['id'])) ?>" autocomplete="off"> + <form method="post" action="<?= $this->url->href('project', 'allow', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('project_id', array('project_id' => $project['id'])) ?> + <?= $this->form->hidden('project_id', array('project_id' => $project['id'])) ?> - <?= $this->formLabel(t('User'), 'user_id') ?> - <?= $this->formSelect('user_id', $users['not_allowed'], array(), array(), array('data-notfound="'.t('No results match:').'"'), 'chosen-select') ?><br/> + <?= $this->form->label(t('User'), 'user_id') ?> + <?= $this->form->select('user_id', $users['not_allowed'], array(), array(), array('data-notfound="'.t('No results match:').'"'), 'chosen-select') ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Allow this user') ?>" class="btn btn-blue"/> @@ -61,11 +61,11 @@ <?php if ($project['is_private'] == 0): ?> <hr/> -<form method="post" action="<?= $this->u('project', 'allowEverybody', array('project_id' => $project['id'])) ?>"> - <?= $this->formCsrf() ?> +<form method="post" action="<?= $this->url->href('project', 'allowEverybody', array('project_id' => $project['id'])) ?>"> + <?= $this->form->csrf() ?> - <?= $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']) ?> + <?= $this->form->hidden('id', array('id' => $project['id'])) ?> + <?= $this->form->checkbox('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 8c5aae11..82e378f5 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="<?= $this->u('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('task_id', $values) ?> + <?= $this->form->hidden('task_id', $values) ?> - <?= $this->formLabel(t('Title'), 'title') ?> - <?= $this->formText('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/> + <?= $this->form->label(t('Title'), 'title') ?> + <?= $this->form->text('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/> - <?= $this->formLabel(t('Assignee'), 'user_id') ?> - <?= $this->formSelect('user_id', $users_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Assignee'), 'user_id') ?> + <?= $this->form->select('user_id', $users_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?> - <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->form->label(t('Original estimate'), 'time_estimated') ?> + <?= $this->form->numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> - <?= $this->formCheckbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?> + <?= $this->form->checkbox('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') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </form> diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php index 3058ff44..2e583069 100644 --- a/app/Template/subtask/edit.php +++ b/app/Template/subtask/edit.php @@ -2,28 +2,28 @@ <h2><?= t('Edit a sub-task') ?></h2> </div> -<form method="post" action="<?= $this->u('subtask', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('subtask', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('task_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('task_id', $values) ?> - <?= $this->formLabel(t('Title'), 'title') ?> - <?= $this->formText('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/> + <?= $this->form->label(t('Title'), 'title') ?> + <?= $this->form->text('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/> - <?= $this->formLabel(t('Assignee'), 'user_id') ?> - <?= $this->formSelect('user_id', $users_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Assignee'), 'user_id') ?> + <?= $this->form->select('user_id', $users_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?> - <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->form->label(t('Original estimate'), 'time_estimated') ?> + <?= $this->form->numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> - <?= $this->formLabel(t('Time spent'), 'time_spent') ?> - <?= $this->formNumeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->form->label(t('Time spent'), 'time_spent') ?> + <?= $this->form->numeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </form> diff --git a/app/Template/subtask/remove.php b/app/Template/subtask/remove.php index c623791d..65ade31d 100644 --- a/app/Template/subtask/remove.php +++ b/app/Template/subtask/remove.php @@ -10,8 +10,8 @@ <p><strong><?= $this->e($subtask['title']) ?></strong></p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/subtask/restriction_change_status.php b/app/Template/subtask/restriction_change_status.php index 99e022f8..88e91d82 100644 --- a/app/Template/subtask/restriction_change_status.php +++ b/app/Template/subtask/restriction_change_status.php @@ -2,14 +2,14 @@ <h2><?= t('You already have one subtask in progress') ?></h2> </div> - <form action="<?= $this->u('subtask', 'changeRestrictionStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post"> + <form action="<?= $this->url->href('subtask', 'changeRestrictionStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('redirect', array('redirect' => $redirect)) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('redirect', array('redirect' => $redirect)) ?> <p><?= t('Select the new status of the subtask: "%s"', $subtask_inprogress['title']) ?></p> - <?= $this->formRadios('status', $status_list) ?> - <?= $this->formHidden('id', $subtask_inprogress) ?> + <?= $this->form->radios('status', $status_list) ?> + <?= $this->form->hidden('id', $subtask_inprogress) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-red"/> diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php index e5368265..c9690f08 100644 --- a/app/Template/subtask/show.php +++ b/app/Template/subtask/show.php @@ -22,14 +22,14 @@ <tr> <td> <?php if (! isset($not_editable)): ?> - <?= $this->toggleSubtaskStatus($subtask, 'task') ?> + <?= $this->subtask->toggleStatus($subtask, 'task') ?> <?php else: ?> <?= $this->render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['title']) ?> <?php endif ?> </td> <td> <?php if (! empty($subtask['username'])): ?> - <?= $this->a($this->e($subtask['name'] ?: $subtask['username']), 'user', 'show', array('user_id' => $subtask['user_id'])) ?> + <?= $this->url->link($this->e($subtask['name'] ?: $subtask['username']), 'user', 'show', array('user_id' => $subtask['user_id'])) ?> <?php endif ?> </td> <td> @@ -46,19 +46,19 @@ <ul> <?php if ($subtask['position'] != $first_position): ?> <li> - <?= $this->a(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up'), true) ?> + <?= $this->url->link(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up'), true) ?> </li> <?php endif ?> <?php if ($subtask['position'] != $last_position): ?> <li> - <?= $this->a(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?> + <?= $this->url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?> </li> <?php endif ?> <li> - <?= $this->a(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?> + <?= $this->url->link(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?> </li> <li> - <?= $this->a(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?> + <?= $this->url->link(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?> </li> </ul> </td> @@ -68,10 +68,10 @@ </table> <?php if (! isset($not_editable)): ?> - <form method="post" action="<?= $this->u('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_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').'"')) ?> + <form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?> + <?= $this->form->text('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 f39b6fde..cc98b584 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="<?= $this->u('swimlane', 'update', array('project_id' => $project['id'], 'swimlane_id' => $values['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('swimlane', 'update', array('project_id' => $project['id'], 'swimlane_id' => $values['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Name'), 'name') ?> - <?= $this->formText('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->label(t('Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> <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 3482a56c..daee6af5 100644 --- a/app/Template/swimlane/index.php +++ b/app/Template/swimlane/index.php @@ -8,13 +8,13 @@ <div class="page-header"> <h2><?= t('Add a new swimlane') ?></h2> </div> -<form method="post" action="<?= $this->u('swimlane', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('swimlane', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Name'), 'name') ?> - <?= $this->formText('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->label(t('Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> <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="<?= $this->u('swimlane', 'change', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('swimlane', 'change', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('id', $default_swimlane) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('id', $default_swimlane) ?> - <?= $this->formLabel(t('Rename'), 'default_swimlane') ?> - <?= $this->formText('default_swimlane', $default_swimlane, array(), array('autofocus', 'required', 'maxlength="50"')) ?><br/> + <?= $this->form->label(t('Rename'), 'default_swimlane') ?> + <?= $this->form->text('default_swimlane', $default_swimlane, array(), array('autofocus', 'required', 'maxlength="50"')) ?><br/> - <?= $this->formCheckbox('show_default_swimlane', t('Show default swimlane'), 1, isset($default_swimlane['show_default_swimlane']) && $default_swimlane['show_default_swimlane'] == 1) ?> + <?= $this->form->checkbox('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"/> diff --git a/app/Template/swimlane/remove.php b/app/Template/swimlane/remove.php index 3268f51f..1d7c2b7a 100644 --- a/app/Template/swimlane/remove.php +++ b/app/Template/swimlane/remove.php @@ -9,9 +9,9 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'swimlane', 'remove', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'swimlane', 'remove', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(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 cf22e31b..f38572a3 100644 --- a/app/Template/swimlane/table.php +++ b/app/Template/swimlane/table.php @@ -16,26 +16,26 @@ <ul> <?php if ($swimlane['position'] != 0 && $swimlane['position'] != 1): ?> <li> - <?= $this->a(t('Move Up'), 'swimlane', 'moveup', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->url->link(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> - <?= $this->a(t('Move Down'), 'swimlane', 'movedown', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->url->link(t('Move Down'), 'swimlane', 'movedown', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> </li> <?php endif ?> <li> - <?= $this->a(t('Rename'), 'swimlane', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?> + <?= $this->url->link(t('Rename'), 'swimlane', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?> </li> <li> <?php if ($swimlane['is_active']): ?> - <?= $this->a(t('Disable'), 'swimlane', 'disable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->url->link(t('Disable'), 'swimlane', 'disable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php else: ?> - <?= $this->a(t('Enable'), 'swimlane', 'enable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->url->link(t('Enable'), 'swimlane', 'enable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php endif ?> </li> <li> - <?= $this->a(t('Remove'), 'swimlane', 'confirm', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?> + <?= $this->url->link(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 a0a95787..79150333 100644 --- a/app/Template/task/close.php +++ b/app/Template/task/close.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => $redirect), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => $redirect), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/task/details.php b/app/Template/task/details.php index c70945bc..f688585a 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -77,7 +77,7 @@ </li> <?php if ($project['is_public']): ?> <li> - <?= $this->a(t('Public link'), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> + <?= $this->url->link(t('Public link'), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> </li> <?php endif ?> diff --git a/app/Template/task/duplicate.php b/app/Template/task/duplicate.php index cc7e0870..e74d2906 100644 --- a/app/Template/task/duplicate.php +++ b/app/Template/task/duplicate.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'task', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'task', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_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 e227e046..9a8e3c4a 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="<?= $this->u('task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <form method="post" action="<?= $this->url->href('task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formLabel(t('Project'), 'project_id') ?> - <?= $this->formSelect('project_id', $projects_list, $values, $errors) ?><br/> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->label(t('Project'), 'project_id') ?> + <?= $this->form->select('project_id', $projects_list, $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </form> diff --git a/app/Template/task/edit.php b/app/Template/task/edit.php index f9ac2b20..2900b739 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="<?= $this->u('task', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('task', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> <div class="form-column"> - <?= $this->formLabel(t('Title'), 'title') ?> - <?= $this->formText('title', $values, $errors, array('required', 'maxlength="200"')) ?><br/> + <?= $this->form->label(t('Title'), 'title') ?> + <?= $this->form->text('title', $values, $errors, array('required', 'maxlength="200"')) ?><br/> - <?= $this->formLabel(t('Description'), 'description') ?> + <?= $this->form->label(t('Description'), 'description') ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -23,7 +23,7 @@ </li> </ul> <div class="write-area"> - <?= $this->formTextarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?> + <?= $this->form->textarea('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"> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Assignee'), 'owner_id') ?> - <?= $this->formSelect('owner_id', $users_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Assignee'), 'owner_id') ?> + <?= $this->form->select('owner_id', $users_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Category'), 'category_id') ?> - <?= $this->formSelect('category_id', $categories_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Category'), 'category_id') ?> + <?= $this->form->select('category_id', $categories_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Color'), 'color_id') ?> - <?= $this->formSelect('color_id', $colors_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Color'), 'color_id') ?> + <?= $this->form->select('color_id', $colors_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Complexity'), 'score') ?> - <?= $this->formNumber('score', $values, $errors) ?><br/> + <?= $this->form->label(t('Complexity'), 'score') ?> + <?= $this->form->number('score', $values, $errors) ?><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/> + <?= $this->form->label(t('Due Date'), 'date_due') ?> + <?= $this->form->text('date_due', $values, $errors, array('placeholder="'.$this->text->in($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): ?> - <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id']), false, 'close-popover') ?> <?php else: ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> <?php endif ?> </div> </form> diff --git a/app/Template/task/edit_description.php b/app/Template/task/edit_description.php index 2af26ef4..84f0cebd 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="<?= $this->u('task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('id', $values) ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -17,7 +17,7 @@ </li> </ul> <div class="write-area"> - <?= $this->formTextarea('description', $values, $errors, array('autofocus', 'placeholder="'.t('Leave a description').'"'), 'description-textarea') ?> + <?= $this->form->textarea('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): ?> - <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> <?php else: ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> <?php endif ?> </div> </form> diff --git a/app/Template/task/edit_recurrence.php b/app/Template/task/edit_recurrence.php index 76894bd4..c261e368 100644 --- a/app/Template/task/edit_recurrence.php +++ b/app/Template/task/edit_recurrence.php @@ -15,36 +15,36 @@ <?php if ($task['recurrence_status'] != \Model\Task::RECURRING_STATUS_PROCESSED): ?> - <form method="post" action="<?= $this->u('task', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" autocomplete="off"> + <form method="post" action="<?= $this->url->href('task', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Generate recurrent task'), 'recurrence_status') ?> - <?= $this->formSelect('recurrence_status', $recurrence_status_list, $values, $errors) ?> + <?= $this->form->label(t('Generate recurrent task'), 'recurrence_status') ?> + <?= $this->form->select('recurrence_status', $recurrence_status_list, $values, $errors) ?> - <?= $this->formLabel(t('Trigger to generate recurrent task'), 'recurrence_trigger') ?> - <?= $this->formSelect('recurrence_trigger', $recurrence_trigger_list, $values, $errors) ?> + <?= $this->form->label(t('Trigger to generate recurrent task'), 'recurrence_trigger') ?> + <?= $this->form->select('recurrence_trigger', $recurrence_trigger_list, $values, $errors) ?> - <?= $this->formLabel(t('Factor to calculate new due date'), 'recurrence_factor') ?> - <?= $this->formNumber('recurrence_factor', $values, $errors) ?> + <?= $this->form->label(t('Factor to calculate new due date'), 'recurrence_factor') ?> + <?= $this->form->number('recurrence_factor', $values, $errors) ?> - <?= $this->formLabel(t('Timeframe to calculate new due date'), 'recurrence_timeframe') ?> - <?= $this->formSelect('recurrence_timeframe', $recurrence_timeframe_list, $values, $errors) ?> + <?= $this->form->label(t('Timeframe to calculate new due date'), 'recurrence_timeframe') ?> + <?= $this->form->select('recurrence_timeframe', $recurrence_timeframe_list, $values, $errors) ?> - <?= $this->formLabel(t('Base date to calculate new due date'), 'recurrence_basedate') ?> - <?= $this->formSelect('recurrence_basedate', $recurrence_basedate_list, $values, $errors) ?> + <?= $this->form->label(t('Base date to calculate new due date'), 'recurrence_basedate') ?> + <?= $this->form->select('recurrence_basedate', $recurrence_basedate_list, $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <?php if ($ajax): ?> - <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?> <?php else: ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> <?php endif ?> </div> </form> diff --git a/app/Template/task/layout.php b/app/Template/task/layout.php index dd59a9fc..18ddea36 100644 --- a/app/Template/task/layout.php +++ b/app/Template/task/layout.php @@ -3,11 +3,11 @@ <ul> <li> <i class="fa fa-table fa-fw"></i> - <?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $task['project_id'])) ?> </li> <li> <i class="fa fa-calendar fa-fw"></i> - <?= $this->a(t('Calendar'), 'calendar', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $task['project_id'])) ?> </li> </ul> </div> diff --git a/app/Template/task/move_project.php b/app/Template/task/move_project.php index ccc67851..b0b33f81 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="<?= $this->u('task', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <form method="post" action="<?= $this->url->href('task', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formLabel(t('Project'), 'project_id') ?> - <?= $this->formSelect('project_id', $projects_list, $values, $errors) ?><br/> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->label(t('Project'), 'project_id') ?> + <?= $this->form->select('project_id', $projects_list, $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </form> diff --git a/app/Template/task/new.php b/app/Template/task/new.php index 37294c89..bd00d347 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><?= $this->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->url->link(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="<?= $this->u('task', 'save', array('project_id' => $values['project_id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('task', 'save', array('project_id' => $values['project_id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> <div class="form-column"> - <?= $this->formLabel(t('Title'), 'title') ?> - <?= $this->formText('title', $values, $errors, array('autofocus', 'required', 'maxlength="200"'), 'form-input-large') ?><br/> + <?= $this->form->label(t('Title'), 'title') ?> + <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="200"'), 'form-input-large') ?><br/> - <?= $this->formLabel(t('Description'), 'description') ?> + <?= $this->form->label(t('Description'), 'description') ?> <div class="form-tabs"> <ul class="form-tabs-nav"> @@ -31,7 +31,7 @@ </li> </ul> <div class="write-area"> - <?= $this->formTextarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?> + <?= $this->form->textarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?> </div> <div class="preview-area"> <div class="markdown"></div> @@ -41,44 +41,44 @@ <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)): ?> - <?= $this->formCheckbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1) ?> + <?= $this->form->checkbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1) ?> <?php endif ?> </div> <div class="form-column"> - <?= $this->formHidden('project_id', $values) ?> + <?= $this->form->hidden('project_id', $values) ?> - <?= $this->formLabel(t('Assignee'), 'owner_id') ?> - <?= $this->formSelect('owner_id', $users_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Assignee'), 'owner_id') ?> + <?= $this->form->select('owner_id', $users_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Category'), 'category_id') ?> - <?= $this->formSelect('category_id', $categories_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Category'), 'category_id') ?> + <?= $this->form->select('category_id', $categories_list, $values, $errors) ?><br/> <?php if (! (count($swimlanes_list) === 1 && key($swimlanes_list) === 0)): ?> - <?= $this->formLabel(t('Swimlane'), 'swimlane_id') ?> - <?= $this->formSelect('swimlane_id', $swimlanes_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Swimlane'), 'swimlane_id') ?> + <?= $this->form->select('swimlane_id', $swimlanes_list, $values, $errors) ?><br/> <?php endif ?> - <?= $this->formLabel(t('Column'), 'column_id') ?> - <?= $this->formSelect('column_id', $columns_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Column'), 'column_id') ?> + <?= $this->form->select('column_id', $columns_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Color'), 'color_id') ?> - <?= $this->formSelect('color_id', $colors_list, $values, $errors) ?><br/> + <?= $this->form->label(t('Color'), 'color_id') ?> + <?= $this->form->select('color_id', $colors_list, $values, $errors) ?><br/> - <?= $this->formLabel(t('Complexity'), 'score') ?> - <?= $this->formNumber('score', $values, $errors) ?><br/> + <?= $this->form->label(t('Complexity'), 'score') ?> + <?= $this->form->number('score', $values, $errors) ?><br/> - <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?> - <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/> + <?= $this->form->label(t('Original estimate'), 'time_estimated') ?> + <?= $this->form->numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><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/> + <?= $this->form->label(t('Due Date'), 'date_due') ?> + <?= $this->form->text('date_due', $values, $errors, array('placeholder="'.$this->text->in($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') ?> <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> </div> </form> </section> diff --git a/app/Template/task/open.php b/app/Template/task/open.php index 1fcdcd80..fbcc1111 100644 --- a/app/Template/task/open.php +++ b/app/Template/task/open.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'task', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'task', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/task/public.php b/app/Template/task/public.php index 9f32f669..73116de9 100644 --- a/app/Template/task/public.php +++ b/app/Template/task/public.php @@ -2,7 +2,7 @@ <?= $this->render('task/details', array('task' => $task, 'project' => $project, 'not_editable' => true)) ?> - <p class="pull-right"><?= $this->a(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?></p> + <p class="pull-right"><?= $this->url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?></p> <?= $this->render('task/show_description', array( 'task' => $task, diff --git a/app/Template/task/recurring_info.php b/app/Template/task/recurring_info.php index 897f6207..ad64ae19 100644 --- a/app/Template/task/recurring_info.php +++ b/app/Template/task/recurring_info.php @@ -24,13 +24,13 @@ <?php if ($task['recurrence_parent']): ?> <li> <?= t('This task has been created by: ') ?> - <?= $this->a('#'.$task['recurrence_parent'], 'task', 'show', array('task_id' => $task['recurrence_parent'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link('#'.$task['recurrence_parent'], 'task', 'show', array('task_id' => $task['recurrence_parent'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> <?php if ($task['recurrence_child']): ?> <li> <?= t('This task has created this child task: ') ?> - <?= $this->a('#'.$task['recurrence_child'], 'task', 'show', array('task_id' => $task['recurrence_child'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link('#'.$task['recurrence_child'], 'task', 'show', array('task_id' => $task['recurrence_child'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> <?php endif ?> diff --git a/app/Template/task/remove.php b/app/Template/task/remove.php index c1eea5a0..2f6edc22 100644 --- a/app/Template/task/remove.php +++ b/app/Template/task/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/task/show.php b/app/Template/task/show.php index 5aa352a6..54c124f6 100644 --- a/app/Template/task/show.php +++ b/app/Template/task/show.php @@ -1,9 +1,9 @@ <?= $this->render('task/details', array( 'task' => $task, 'project' => $project, - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + 'recurrence_trigger_list' => $this->task->recurrenceTriggers(), + 'recurrence_timeframe_list' => $this->task->recurrenceTimeframes(), + 'recurrence_basedate_list' => $this->task->recurrenceBasedates(), )) ?> <?= $this->render('task/time', array('task' => $task, 'values' => $values, 'date_format' => $date_format, 'date_formats' => $date_formats)) ?> diff --git a/app/Template/task/show_description.php b/app/Template/task/show_description.php index 3807ddd2..f823e7d6 100644 --- a/app/Template/task/show_description.php +++ b/app/Template/task/show_description.php @@ -6,7 +6,7 @@ <article class="markdown task-show-description"> <?php if (! isset($is_public)): ?> - <?= $this->markdown( + <?= $this->text->markdown( $task['description'], array( 'controller' => 'task', @@ -17,7 +17,7 @@ ) ) ?> <?php else: ?> - <?= $this->markdown( + <?= $this->text->markdown( $task['description'], array( 'controller' => 'task', diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index 7c82700a..bb137ac9 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -2,65 +2,65 @@ <h2><?= t('Information') ?></h2> <ul> <li> - <?= $this->a(t('Summary'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Summary'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Activity stream'), 'task', 'activites', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Activity stream'), 'task', 'activites', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Transitions'), 'task', 'transitions', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Transitions'), 'task', 'transitions', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <?php if ($task['time_estimated'] > 0 || $task['time_spent'] > 0): ?> <li> - <?= $this->a(t('Time tracking'), 'task', 'timesheet', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Time tracking'), 'task', 'timesheet', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> </ul> <h2><?= t('Actions') ?></h2> <ul> <li> - <?= $this->a(t('Edit the task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Edit the task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Edit the description'), 'task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Edit the description'), 'task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Edit recurrence'), 'task', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Edit recurrence'), 'task', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Attach a document'), 'file', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Attach a document'), 'file', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Add a screenshot'), 'file', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Add a screenshot'), 'file', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Duplicate'), 'task', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Duplicate'), 'task', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Duplicate to another project'), 'task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Duplicate to another project'), 'task', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <li> - <?= $this->a(t('Move to another project'), 'task', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(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): ?> - <?= $this->a(t('Close this task'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Close this task'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> <?php else: ?> - <?= $this->a(t('Open this task'), 'task', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Open this task'), 'task', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> <?php endif ?> </li> - <?php if ($this->taskPermission->canRemoveTask($task)): ?> + <?php if ($this->task->canRemove($task)): ?> <li> - <?= $this->a(t('Remove'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Remove'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> </ul> diff --git a/app/Template/task/table.php b/app/Template/task/table.php index 4ccf83b9..d06bc7b7 100644 --- a/app/Template/task/table.php +++ b/app/Template/task/table.php @@ -13,16 +13,16 @@ <?php foreach ($paginator->getCollection() as $task): ?> <tr> <td class="task-table color-<?= $task['color_id'] ?>"> - <?= $this->a('#'.$this->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $this->url->link('#'.$this->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </td> <td> - <?= $this->inList($task['column_id'], $columns) ?> + <?= $this->text->in($task['column_id'], $columns) ?> </td> <td> - <?= $this->inList($task['category_id'], $categories, '') ?> + <?= $this->text->in($task['category_id'], $categories, '') ?> </td> <td> - <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </td> <td> <?php if ($task['assignee_username']): ?> diff --git a/app/Template/task/time.php b/app/Template/task/time.php index 4aeddc70..6682a08d 100644 --- a/app/Template/task/time.php +++ b/app/Template/task/time.php @@ -1,15 +1,15 @@ -<form method="post" action="<?= $this->u('task', 'time', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" class="form-inline task-time-form" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('id', $values) ?> +<form method="post" action="<?= $this->url->href('task', 'time', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" class="form-inline task-time-form" autocomplete="off"> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('id', $values) ?> - <?= $this->formLabel(t('Start date'), 'date_started') ?> - <?= $this->formText('date_started', $values, array(), array('placeholder="'.$this->inList($date_format, $date_formats).'"'), 'form-date') ?> + <?= $this->form->label(t('Start date'), 'date_started') ?> + <?= $this->form->text('date_started', $values, array(), array('placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?> - <?= $this->formLabel(t('Time estimated'), 'time_estimated') ?> - <?= $this->formNumeric('time_estimated', $values, array(), array('placeholder="'.t('hours').'"')) ?> + <?= $this->form->label(t('Time estimated'), 'time_estimated') ?> + <?= $this->form->numeric('time_estimated', $values, array(), array('placeholder="'.t('hours').'"')) ?> - <?= $this->formLabel(t('Time spent'), 'time_spent') ?> - <?= $this->formNumeric('time_spent', $values, array(), array('placeholder="'.t('hours').'"')) ?> + <?= $this->form->label(t('Time spent'), 'time_spent') ?> + <?= $this->form->numeric('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/time_tracking.php b/app/Template/task/time_tracking.php index 55d33e5e..441cb585 100644 --- a/app/Template/task/time_tracking.php +++ b/app/Template/task/time_tracking.php @@ -14,7 +14,7 @@ </tr> <?php foreach ($subtask_paginator->getCollection() as $record): ?> <tr> - <td><?= $this->a($this->e($record['user_fullname'] ?: $record['username']), 'user', 'show', array('user_id' => $record['user_id'])) ?></td> + <td><?= $this->url->link($this->e($record['user_fullname'] ?: $record['username']), 'user', 'show', array('user_id' => $record['user_id'])) ?></td> <td><?= t($record['subtask_title']) ?></td> <td><?= dt('%B %e, %Y at %k:%M %p', $record['start']) ?></td> <td><?= dt('%B %e, %Y at %k:%M %p', $record['end']) ?></td> diff --git a/app/Template/task/transitions.php b/app/Template/task/transitions.php index 2f45eb39..6455fd66 100644 --- a/app/Template/task/transitions.php +++ b/app/Template/task/transitions.php @@ -18,7 +18,7 @@ <td><?= dt('%B %e, %Y at %k:%M %p', $transition['date']) ?></td> <td><?= $this->e($transition['src_column']) ?></td> <td><?= $this->e($transition['dst_column']) ?></td> - <td><?= $this->a($this->e($transition['name'] ?: $transition['username']), 'user', 'show', array('user_id' => $transition['user_id'])) ?></td> + <td><?= $this->url->link($this->e($transition['name'] ?: $transition['username']), 'user', 'show', array('user_id' => $transition['user_id'])) ?></td> <td><?= n(round($transition['time_spent'] / 3600, 2)).' '.t('hours') ?></td> </tr> <?php endforeach ?> diff --git a/app/Template/tasklink/create.php b/app/Template/tasklink/create.php index 3394271a..749f2968 100644 --- a/app/Template/tasklink/create.php +++ b/app/Template/tasklink/create.php @@ -2,17 +2,17 @@ <h2><?= t('Add a new link') ?></h2> </div> -<form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" method="post" autocomplete="off"> +<form action="<?= $this->url->href('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" method="post" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?> - <?= $this->formHidden('opposite_task_id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?> + <?= $this->form->hidden('opposite_task_id', $values) ?> - <?= $this->formLabel(t('Label'), 'link_id') ?> - <?= $this->formSelect('link_id', $labels, $values, $errors) ?> + <?= $this->form->label(t('Label'), 'link_id') ?> + <?= $this->form->select('link_id', $labels, $values, $errors) ?> - <?= $this->formLabel(t('Task'), 'title') ?> - <?= $this->formText( + <?= $this->form->label(t('Task'), 'title') ?> + <?= $this->form->text( 'title', $values, $errors, @@ -21,7 +21,7 @@ 'placeholder="'.t('Start to type task title...').'"', 'title="'.t('Start to type task title...').'"', 'data-dst-field="opposite_task_id"', - 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', + 'data-search-url="'.$this->url->href('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', ), 'task-autocomplete') ?> @@ -29,9 +29,9 @@ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <?php if (isset($ajax)): ?> - <?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id']), false, 'close-popover') ?> <?php else: ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> <?php endif ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/tasklink/edit.php b/app/Template/tasklink/edit.php index 37c3cb14..73b43277 100644 --- a/app/Template/tasklink/edit.php +++ b/app/Template/tasklink/edit.php @@ -2,18 +2,18 @@ <h2><?= t('Edit link') ?></h2> </div> -<form action="<?= $this->u('tasklink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'link_id' => $task_link['id'])) ?>" method="post" autocomplete="off"> +<form action="<?= $this->url->href('tasklink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'link_id' => $task_link['id'])) ?>" method="post" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('task_id', $values) ?> - <?= $this->formHidden('opposite_task_id', $values) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('task_id', $values) ?> + <?= $this->form->hidden('opposite_task_id', $values) ?> - <?= $this->formLabel(t('Label'), 'link_id') ?> - <?= $this->formSelect('link_id', $labels, $values, $errors) ?> + <?= $this->form->label(t('Label'), 'link_id') ?> + <?= $this->form->select('link_id', $labels, $values, $errors) ?> - <?= $this->formLabel(t('Task'), 'title') ?> - <?= $this->formText( + <?= $this->form->label(t('Task'), 'title') ?> + <?= $this->form->text( 'title', $values, $errors, @@ -22,13 +22,13 @@ 'placeholder="'.t('Start to type task title...').'"', 'title="'.t('Start to type task title...').'"', 'data-dst-field="opposite_task_id"', - 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', + 'data-search-url="'.$this->url->href('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', ), 'task-autocomplete') ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/tasklink/remove.php b/app/Template/tasklink/remove.php index 9322ec24..262fb488 100644 --- a/app/Template/tasklink/remove.php +++ b/app/Template/tasklink/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'tasklink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'tasklink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/tasklink/show.php b/app/Template/tasklink/show.php index d4a3939b..7125b11d 100644 --- a/app/Template/tasklink/show.php +++ b/app/Template/tasklink/show.php @@ -23,7 +23,7 @@ <td> <?php if (! isset($not_editable)): ?> - <?= $this->a( + <?= $this->url->link( $this->e('#'.$link['task_id'].' '.$link['title']), 'task', 'show', @@ -32,7 +32,7 @@ $link['is_active'] ? '' : 'task-link-closed' ) ?> <?php else: ?> - <?= $this->a( + <?= $this->url->link( $this->e('#'.$link['task_id'].' '.$link['title']), 'task', 'readonly', @@ -56,7 +56,7 @@ <td> <?php if (! empty($link['task_assignee_username'])): ?> <?php if (! isset($not_editable)): ?> - <?= $this->a($this->e($link['task_assignee_name'] ?: $link['task_assignee_username']), 'user', 'show', array('user_id' => $link['task_assignee_id'])) ?> + <?= $this->url->link($this->e($link['task_assignee_name'] ?: $link['task_assignee_username']), 'user', 'show', array('user_id' => $link['task_assignee_id'])) ?> <?php else: ?> <?= $this->e($link['task_assignee_name'] ?: $link['task_assignee_username']) ?> <?php endif ?> @@ -65,8 +65,8 @@ <?php if (! isset($not_editable)): ?> <td> <ul> - <li><?= $this->a(t('Edit'), 'tasklink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li> - <li><?= $this->a(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li> + <li><?= $this->url->link(t('Edit'), 'tasklink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li> + <li><?= $this->url->link(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li> </ul> </td> <?php endif ?> @@ -76,15 +76,15 @@ </table> <?php if (! isset($not_editable) && isset($link_label_list)): ?> - <form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> + <form action="<?= $this->url->href('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?> - <?= $this->formHidden('opposite_task_id', array()) ?> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?> + <?= $this->form->hidden('opposite_task_id', array()) ?> - <?= $this->formSelect('link_id', $link_label_list, array(), array()) ?> + <?= $this->form->select('link_id', $link_label_list, array(), array()) ?> - <?= $this->formText( + <?= $this->form->text( 'title', array(), array(), @@ -93,7 +93,7 @@ 'placeholder="'.t('Start to type task title...').'"', 'title="'.t('Start to type task title...').'"', 'data-dst-field="opposite_task_id"', - 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', + 'data-search-url="'.$this->url->href('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', ), 'task-autocomplete') ?> diff --git a/app/Template/timetable/index.php b/app/Template/timetable/index.php index 27cbe39c..7a63a2ec 100644 --- a/app/Template/timetable/index.php +++ b/app/Template/timetable/index.php @@ -1,24 +1,24 @@ <div class="page-header"> <h2><?= t('Timetable') ?></h2> <ul> - <li><?= $this->a(t('Day timetable'), 'timetableday', 'index', array('user_id' => $user['id'])) ?></li> - <li><?= $this->a(t('Week timetable'), 'timetableweek', 'index', array('user_id' => $user['id'])) ?></li> - <li><?= $this->a(t('Time off timetable'), 'timetableoff', 'index', array('user_id' => $user['id'])) ?></li> - <li><?= $this->a(t('Overtime timetable'), 'timetableextra', 'index', array('user_id' => $user['id'])) ?></li> + <li><?= $this->url->link(t('Day timetable'), 'timetableday', 'index', array('user_id' => $user['id'])) ?></li> + <li><?= $this->url->link(t('Week timetable'), 'timetableweek', 'index', array('user_id' => $user['id'])) ?></li> + <li><?= $this->url->link(t('Time off timetable'), 'timetableoff', 'index', array('user_id' => $user['id'])) ?></li> + <li><?= $this->url->link(t('Overtime timetable'), 'timetableextra', 'index', array('user_id' => $user['id'])) ?></li> </ul> </div> <form method="get" action="?" autocomplete="off" class="form-inline"> - <?= $this->formHidden('controller', $values) ?> - <?= $this->formHidden('action', $values) ?> - <?= $this->formHidden('user_id', $values) ?> + <?= $this->form->hidden('controller', $values) ?> + <?= $this->form->hidden('action', $values) ?> + <?= $this->form->hidden('user_id', $values) ?> - <?= $this->formLabel(t('From'), 'from') ?> - <?= $this->formText('from', $values, array(), array(), 'form-date') ?> + <?= $this->form->label(t('From'), 'from') ?> + <?= $this->form->text('from', $values, array(), array(), 'form-date') ?> - <?= $this->formLabel(t('To'), 'to') ?> - <?= $this->formText('to', $values, array(), array(), 'form-date') ?> + <?= $this->form->label(t('To'), 'to') ?> + <?= $this->form->text('to', $values, array(), array(), 'form-date') ?> <input type="submit" value="<?= t('Execute') ?>" class="btn btn-blue"/> </form> diff --git a/app/Template/timetable_day/index.php b/app/Template/timetable_day/index.php index 50aca602..d2877816 100644 --- a/app/Template/timetable_day/index.php +++ b/app/Template/timetable_day/index.php @@ -15,7 +15,7 @@ <td><?= $slot['start'] ?></td> <td><?= $slot['end'] ?></td> <td> - <?= $this->a(t('Remove'), 'timetableday', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> + <?= $this->url->link(t('Remove'), 'timetableday', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> </td> </tr> <?php endforeach ?> @@ -24,16 +24,16 @@ <h3><?= t('Add new time slot') ?></h3> <?php endif ?> -<form method="post" action="<?= $this->u('timetableday', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('timetableday', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formHidden('user_id', $values) ?> - <?= $this->formCsrf() ?> + <?= $this->form->hidden('user_id', $values) ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Start time'), 'start') ?> - <?= $this->formSelect('start', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('Start time'), 'start') ?> + <?= $this->form->select('start', $this->datetime->getDayHours(), $values, $errors) ?> - <?= $this->formLabel(t('End time'), 'end') ?> - <?= $this->formSelect('end', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('End time'), 'end') ?> + <?= $this->form->select('end', $this->datetime->getDayHours(), $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/timetable_day/remove.php b/app/Template/timetable_day/remove.php index b3ee8775..1b33b266 100644 --- a/app/Template/timetable_day/remove.php +++ b/app/Template/timetable_day/remove.php @@ -6,8 +6,8 @@ <p class="alert alert-info"><?= t('Do you really want to remove this time slot?') ?></p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'timetableday', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'timetableday', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'timetableday', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('cancel'), 'timetableday', 'index', array('user_id' => $user['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/timetable_extra/index.php b/app/Template/timetable_extra/index.php index a0a55bec..d3224ae6 100644 --- a/app/Template/timetable_extra/index.php +++ b/app/Template/timetable_extra/index.php @@ -21,7 +21,7 @@ <td><?= $slot['end'] ?></td> <td><?= $this->e($slot['comment']) ?></td> <td> - <?= $this->a(t('Remove'), 'timetableextra', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> + <?= $this->url->link(t('Remove'), 'timetableextra', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> </td> </tr> <?php endforeach ?> @@ -31,24 +31,24 @@ <?php endif ?> -<form method="post" action="<?= $this->u('timetableextra', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('timetableextra', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formHidden('user_id', $values) ?> - <?= $this->formCsrf() ?> + <?= $this->form->hidden('user_id', $values) ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Day'), 'date') ?> - <?= $this->formText('date', $values, $errors, array('required'), 'form-date') ?> + <?= $this->form->label(t('Day'), 'date') ?> + <?= $this->form->text('date', $values, $errors, array('required'), 'form-date') ?> - <?= $this->formCheckbox('all_day', t('All day'), 1) ?> + <?= $this->form->checkbox('all_day', t('All day'), 1) ?> - <?= $this->formLabel(t('Start time'), 'start') ?> - <?= $this->formSelect('start', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('Start time'), 'start') ?> + <?= $this->form->select('start', $this->datetime->getDayHours(), $values, $errors) ?> - <?= $this->formLabel(t('End time'), 'end') ?> - <?= $this->formSelect('end', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('End time'), 'end') ?> + <?= $this->form->select('end', $this->datetime->getDayHours(), $values, $errors) ?> - <?= $this->formLabel(t('Comment'), 'comment') ?> - <?= $this->formText('comment', $values, $errors) ?> + <?= $this->form->label(t('Comment'), 'comment') ?> + <?= $this->form->text('comment', $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/timetable_extra/remove.php b/app/Template/timetable_extra/remove.php index d8dc5b3b..fc907438 100644 --- a/app/Template/timetable_extra/remove.php +++ b/app/Template/timetable_extra/remove.php @@ -6,8 +6,8 @@ <p class="alert alert-info"><?= t('Do you really want to remove this time slot?') ?></p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'timetableextra', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'timetableextra', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'timetableextra', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('cancel'), 'timetableextra', 'index', array('user_id' => $user['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/timetable_off/index.php b/app/Template/timetable_off/index.php index f35d331e..75e02dbd 100644 --- a/app/Template/timetable_off/index.php +++ b/app/Template/timetable_off/index.php @@ -21,7 +21,7 @@ <td><?= $slot['end'] ?></td> <td><?= $this->e($slot['comment']) ?></td> <td> - <?= $this->a(t('Remove'), 'timetableoff', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> + <?= $this->url->link(t('Remove'), 'timetableoff', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> </td> </tr> <?php endforeach ?> @@ -31,24 +31,24 @@ <?php endif ?> -<form method="post" action="<?= $this->u('timetableoff', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('timetableoff', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formHidden('user_id', $values) ?> - <?= $this->formCsrf() ?> + <?= $this->form->hidden('user_id', $values) ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Day'), 'date') ?> - <?= $this->formText('date', $values, $errors, array('required'), 'form-date') ?> + <?= $this->form->label(t('Day'), 'date') ?> + <?= $this->form->text('date', $values, $errors, array('required'), 'form-date') ?> - <?= $this->formCheckbox('all_day', t('All day'), 1) ?> + <?= $this->form->checkbox('all_day', t('All day'), 1) ?> - <?= $this->formLabel(t('Start time'), 'start') ?> - <?= $this->formSelect('start', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('Start time'), 'start') ?> + <?= $this->form->select('start', $this->datetime->getDayHours(), $values, $errors) ?> - <?= $this->formLabel(t('End time'), 'end') ?> - <?= $this->formSelect('end', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('End time'), 'end') ?> + <?= $this->form->select('end', $this->datetime->getDayHours(), $values, $errors) ?> - <?= $this->formLabel(t('Comment'), 'comment') ?> - <?= $this->formText('comment', $values, $errors) ?> + <?= $this->form->label(t('Comment'), 'comment') ?> + <?= $this->form->text('comment', $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/timetable_off/remove.php b/app/Template/timetable_off/remove.php index 64863781..621e191c 100644 --- a/app/Template/timetable_off/remove.php +++ b/app/Template/timetable_off/remove.php @@ -6,8 +6,8 @@ <p class="alert alert-info"><?= t('Do you really want to remove this time slot?') ?></p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'timetableoff', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'timetableoff', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'timetableoff', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('cancel'), 'timetableoff', 'index', array('user_id' => $user['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/timetable_week/index.php b/app/Template/timetable_week/index.php index 8fb51909..552e9302 100644 --- a/app/Template/timetable_week/index.php +++ b/app/Template/timetable_week/index.php @@ -13,11 +13,11 @@ </tr> <?php foreach ($timetable as $slot): ?> <tr> - <td><?= $this->getWeekDay($slot['day']) ?></td> + <td><?= $this->datetime->getWeekDay($slot['day']) ?></td> <td><?= $slot['start'] ?></td> <td><?= $slot['end'] ?></td> <td> - <?= $this->a(t('Remove'), 'timetableweek', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> + <?= $this->url->link(t('Remove'), 'timetableweek', 'confirm', array('user_id' => $user['id'], 'slot_id' => $slot['id'])) ?> </td> </tr> <?php endforeach ?> @@ -26,19 +26,19 @@ <h3><?= t('Add new time slot') ?></h3> <?php endif ?> -<form method="post" action="<?= $this->u('timetableweek', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('timetableweek', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formHidden('user_id', $values) ?> - <?= $this->formCsrf() ?> + <?= $this->form->hidden('user_id', $values) ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Day'), 'day') ?> - <?= $this->formSelect('day', $this->getWeekDays(), $values, $errors) ?> + <?= $this->form->label(t('Day'), 'day') ?> + <?= $this->form->select('day', $this->datetime->getWeekDays(), $values, $errors) ?> - <?= $this->formLabel(t('Start time'), 'start') ?> - <?= $this->formSelect('start', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('Start time'), 'start') ?> + <?= $this->form->select('start', $this->datetime->getDayHours(), $values, $errors) ?> - <?= $this->formLabel(t('End time'), 'end') ?> - <?= $this->formSelect('end', $this->getDayHours(), $values, $errors) ?> + <?= $this->form->label(t('End time'), 'end') ?> + <?= $this->form->select('end', $this->datetime->getDayHours(), $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/timetable_week/remove.php b/app/Template/timetable_week/remove.php index f8eb2bbe..f5a10199 100644 --- a/app/Template/timetable_week/remove.php +++ b/app/Template/timetable_week/remove.php @@ -6,8 +6,8 @@ <p class="alert alert-info"><?= t('Do you really want to remove this time slot?') ?></p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'timetableweek', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'timetableweek', 'remove', array('user_id' => $user['id'], 'slot_id' => $slot_id), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'timetableweek', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('cancel'), 'timetableweek', 'index', array('user_id' => $user['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/twofactor/check.php b/app/Template/twofactor/check.php index c29c0129..0e29d526 100644 --- a/app/Template/twofactor/check.php +++ b/app/Template/twofactor/check.php @@ -1,8 +1,8 @@ -<form method="post" action="<?= $this->u('twofactor', 'check', array('user_id' => $this->userSession->getId())) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('twofactor', 'check', array('user_id' => $this->userSession->getId())) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formLabel(t('Code'), 'code') ?> - <?= $this->formText('code', array(), array(), array('placeholder="123456"', 'autofocus'), 'form-numeric') ?> + <?= $this->form->csrf() ?> + <?= $this->form->label(t('Code'), 'code') ?> + <?= $this->form->text('code', array(), array(), array('placeholder="123456"', 'autofocus'), 'form-numeric') ?> <div class="form-actions"> <input type="submit" value="<?= t('Check my code') ?>" class="btn btn-blue"/> diff --git a/app/Template/twofactor/disable.php b/app/Template/twofactor/disable.php index 6909b446..36be4ef9 100644 --- a/app/Template/twofactor/disable.php +++ b/app/Template/twofactor/disable.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= $this->a(t('Yes'), 'twofactor', 'disable', array('user_id' => $user['id'], 'disable' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Yes'), 'twofactor', 'disable', array('user_id' => $user['id'], 'disable' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> </div> </div>
\ No newline at end of file diff --git a/app/Template/twofactor/index.php b/app/Template/twofactor/index.php index 28e93f14..36b92653 100644 --- a/app/Template/twofactor/index.php +++ b/app/Template/twofactor/index.php @@ -2,10 +2,10 @@ <h2><?= t('Two factor authentication') ?></h2> </div> -<form method="post" action="<?= $this->u('twofactor', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('twofactor', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formCheckbox('twofactor_activated', t('Enable/disable two factor authentication'), 1, isset($user['twofactor_activated']) && $user['twofactor_activated'] == 1) ?> + <?= $this->form->csrf() ?> + <?= $this->form->checkbox('twofactor_activated', t('Enable/disable two factor authentication'), 1, isset($user['twofactor_activated']) && $user['twofactor_activated'] == 1) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> @@ -24,11 +24,11 @@ </div> <h3><?= t('Test your device') ?></h3> -<form method="post" action="<?= $this->u('twofactor', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('twofactor', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> - <?= $this->formLabel(t('Code'), 'code') ?> - <?= $this->formText('code', array(), array(), array('placeholder="123456"'), 'form-numeric') ?> + <?= $this->form->csrf() ?> + <?= $this->form->label(t('Code'), 'code') ?> + <?= $this->form->text('code', array(), array(), array('placeholder="123456"'), 'form-numeric') ?> <div class="form-actions"> <input type="submit" value="<?= t('Check my code') ?>" class="btn btn-blue"/> diff --git a/app/Template/user/calendar.php b/app/Template/user/calendar.php index 6708c5c3..7ec12496 100644 --- a/app/Template/user/calendar.php +++ b/app/Template/user/calendar.php @@ -1,6 +1,6 @@ <div id="user-calendar" - data-check-url="<?= $this->u('calendar', 'user') ?>" + data-check-url="<?= $this->url->href('calendar', 'user') ?>" data-user-id="<?= $user['id'] ?>" - data-save-url="<?= $this->u('calendar', 'save') ?>" + data-save-url="<?= $this->url->href('calendar', 'save') ?>" > </div>
\ No newline at end of file diff --git a/app/Template/user/edit.php b/app/Template/user/edit.php index bd1c4889..e29dcfca 100644 --- a/app/Template/user/edit.php +++ b/app/Template/user/edit.php @@ -1,42 +1,42 @@ <div class="page-header"> <h2><?= t('Edit user') ?></h2> </div> -<form method="post" action="<?= $this->u('user', 'edit', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('user', 'edit', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formHidden('id', $values) ?> - <?= $this->formHidden('is_ldap_user', $values) ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->hidden('is_ldap_user', $values) ?> - <?= $this->formLabel(t('Username'), 'username') ?> - <?= $this->formText('username', $values, $errors, array('required', $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?><br/> + <?= $this->form->label(t('Username'), 'username') ?> + <?= $this->form->text('username', $values, $errors, array('required', $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?><br/> - <?= $this->formLabel(t('Name'), 'name') ?> - <?= $this->formText('name', $values, $errors) ?><br/> + <?= $this->form->label(t('Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors) ?><br/> - <?= $this->formLabel(t('Email'), 'email') ?> - <?= $this->formEmail('email', $values, $errors) ?><br/> + <?= $this->form->label(t('Email'), 'email') ?> + <?= $this->form->email('email', $values, $errors) ?><br/> - <?= $this->formLabel(t('Default project'), 'default_project_id') ?> - <?= $this->formSelect('default_project_id', $projects, $values, $errors) ?><br/> + <?= $this->form->label(t('Default project'), 'default_project_id') ?> + <?= $this->form->select('default_project_id', $projects, $values, $errors) ?><br/> - <?= $this->formLabel(t('Timezone'), 'timezone') ?> - <?= $this->formSelect('timezone', $timezones, $values, $errors) ?><br/> + <?= $this->form->label(t('Timezone'), 'timezone') ?> + <?= $this->form->select('timezone', $timezones, $values, $errors) ?><br/> - <?= $this->formLabel(t('Language'), 'language') ?> - <?= $this->formSelect('language', $languages, $values, $errors) ?><br/> + <?= $this->form->label(t('Language'), 'language') ?> + <?= $this->form->select('language', $languages, $values, $errors) ?><br/> <div class="alert alert-error"> - <?= $this->formCheckbox('disable_login_form', t('Disable login form'), 1, isset($values['disable_login_form']) && $values['disable_login_form'] == 1) ?><br/> + <?= $this->form->checkbox('disable_login_form', t('Disable login form'), 1, isset($values['disable_login_form']) && $values['disable_login_form'] == 1) ?><br/> - <?php if ($this->userSession->isAdmin()): ?> - <?= $this->formCheckbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1) ?><br/> + <?php if ($this->user->isAdmin()): ?> + <?= $this->form->checkbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1) ?><br/> <?php endif ?> </div> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link(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 b4cea156..df85ace7 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 ($this->userSession->isCurrentUser($user['id'])): ?> + <?php if ($this->user->isCurrentUser($user['id'])): ?> <?php if (empty($user['google_id'])): ?> - <?= $this->a(t('Link my Google Account'), 'user', 'google', array(), true) ?> + <?= $this->url->link(t('Link my Google Account'), 'user', 'google', array(), true) ?> <?php else: ?> - <?= $this->a(t('Unlink my Google Account'), 'user', 'unlinkGoogle', array(), true) ?> + <?= $this->url->link(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 ($this->userSession->isCurrentUser($user['id'])): ?> + <?php if ($this->user->isCurrentUser($user['id'])): ?> <?php if (empty($user['github_id'])): ?> - <?= $this->a(t('Link my GitHub Account'), 'user', 'github', array(), true) ?> + <?= $this->url->link(t('Link my GitHub Account'), 'user', 'github', array(), true) ?> <?php else: ?> - <?= $this->a(t('Unlink my GitHub Account'), 'user', 'unlinkGitHub', array(), true) ?> + <?= $this->url->link(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 d6b0fecf..6b4396b2 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 ($this->userSession->isAdmin()): ?> + <?php if ($this->user->isAdmin()): ?> <ul> - <li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New user'), 'user', 'create') ?></li> + <li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New user'), 'user', 'create') ?></li> </ul> <?php endif ?> </div> @@ -26,10 +26,10 @@ <?php foreach ($paginator->getCollection() as $user): ?> <tr> <td> - <?= $this->a('#'.$user['id'], 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link('#'.$user['id'], 'user', 'show', array('user_id' => $user['id'])) ?> </td> <td> - <?= $this->a($this->e($user['username']), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link($this->e($user['username']), 'user', 'show', array('user_id' => $user['id'])) ?> </td> <td> <?= $this->e($user['name']) ?> diff --git a/app/Template/user/last.php b/app/Template/user/last.php index 317334b8..ab25f79b 100644 --- a/app/Template/user/last.php +++ b/app/Template/user/last.php @@ -17,7 +17,7 @@ <td><?= dt('%B %e, %Y at %k:%M %p', $login['date_creation']) ?></td> <td><?= $this->e($login['auth_type']) ?></td> <td><?= $this->e($login['ip']) ?></td> - <td><?= $this->e($this->summary($login['user_agent'])) ?></td> + <td><?= $this->e($this->text->truncate($login['user_agent'])) ?></td> </tr> <?php endforeach ?> </table> diff --git a/app/Template/user/layout.php b/app/Template/user/layout.php index a5a78a3f..e60ab77d 100644 --- a/app/Template/user/layout.php +++ b/app/Template/user/layout.php @@ -1,9 +1,9 @@ <section id="main"> <div class="page-header"> - <?php if ($this->userSession->isAdmin()): ?> + <?php if ($this->user->isAdmin()): ?> <ul> - <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> + <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('All users'), 'user', 'index') ?></li> + <li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New user'), 'user', 'create') ?></li> </ul> <?php endif ?> </div> diff --git a/app/Template/user/new.php b/app/Template/user/new.php index e56f38b1..ba7a3881 100644 --- a/app/Template/user/new.php +++ b/app/Template/user/new.php @@ -1,44 +1,44 @@ <section id="main"> <div class="page-header"> <ul> - <li><i class="fa fa-user fa-fw"></i><?= $this->a(t('All users'), 'user', 'index') ?></li> + <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('All users'), 'user', 'index') ?></li> </ul> </div> <section> - <form method="post" action="<?= $this->u('user', 'save') ?>" autocomplete="off"> + <form method="post" action="<?= $this->url->href('user', 'save') ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formLabel(t('Username'), 'username') ?> - <?= $this->formText('username', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?><br/> + <?= $this->form->label(t('Username'), 'username') ?> + <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?><br/> - <?= $this->formLabel(t('Name'), 'name') ?> - <?= $this->formText('name', $values, $errors) ?><br/> + <?= $this->form->label(t('Name'), 'name') ?> + <?= $this->form->text('name', $values, $errors) ?><br/> - <?= $this->formLabel(t('Email'), 'email') ?> - <?= $this->formEmail('email', $values, $errors) ?><br/> + <?= $this->form->label(t('Email'), 'email') ?> + <?= $this->form->email('email', $values, $errors) ?><br/> - <?= $this->formLabel(t('Password'), 'password') ?> - <?= $this->formPassword('password', $values, $errors, array('required')) ?><br/> + <?= $this->form->label(t('Password'), 'password') ?> + <?= $this->form->password('password', $values, $errors, array('required')) ?><br/> - <?= $this->formLabel(t('Confirmation'), 'confirmation') ?> - <?= $this->formPassword('confirmation', $values, $errors, array('required')) ?><br/> + <?= $this->form->label(t('Confirmation'), 'confirmation') ?> + <?= $this->form->password('confirmation', $values, $errors, array('required')) ?><br/> - <?= $this->formLabel(t('Default project'), 'default_project_id') ?> - <?= $this->formSelect('default_project_id', $projects, $values, $errors) ?><br/> + <?= $this->form->label(t('Default project'), 'default_project_id') ?> + <?= $this->form->select('default_project_id', $projects, $values, $errors) ?><br/> - <?= $this->formLabel(t('Timezone'), 'timezone') ?> - <?= $this->formSelect('timezone', $timezones, $values, $errors) ?><br/> + <?= $this->form->label(t('Timezone'), 'timezone') ?> + <?= $this->form->select('timezone', $timezones, $values, $errors) ?><br/> - <?= $this->formLabel(t('Language'), 'language') ?> - <?= $this->formSelect('language', $languages, $values, $errors) ?><br/> + <?= $this->form->label(t('Language'), 'language') ?> + <?= $this->form->select('language', $languages, $values, $errors) ?><br/> - <?= $this->formCheckbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?> + <?= $this->form->checkbox('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') ?> - <?= $this->a(t('cancel'), 'user', 'index') ?> + <?= $this->url->link(t('cancel'), 'user', 'index') ?> </div> </form> </section> diff --git a/app/Template/user/notifications.php b/app/Template/user/notifications.php index 56c48f8f..df5cbb9b 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="<?= $this->u('user', 'notifications', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('user', 'notifications', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formCsrf() ?> + <?= $this->form->csrf() ?> - <?= $this->formCheckbox('notifications_enabled', t('Enable email notifications'), '1', $notifications['notifications_enabled'] == 1) ?><br/> + <?= $this->form->checkbox('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): ?> - <?= $this->formCheckbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?><br/> + <?= $this->form->checkbox('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') ?> - <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link(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 14de0d42..3ef28d33 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="<?= $this->u('user', 'password', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('user', 'password', array('user_id' => $user['id'])) ?>" autocomplete="off"> - <?= $this->formHidden('id', $values) ?> - <?= $this->formCsrf() ?> + <?= $this->form->hidden('id', $values) ?> + <?= $this->form->csrf() ?> <div class="alert alert-error"> - <?= $this->formLabel(t('Current password for the user "%s"', $this->getFullname()), 'current_password') ?> - <?= $this->formPassword('current_password', $values, $errors) ?><br/> + <?= $this->form->label(t('Current password for the user "%s"', $this->user->getFullname()), 'current_password') ?> + <?= $this->form->password('current_password', $values, $errors) ?><br/> </div> - <?= $this->formLabel(t('New password for the user "%s"', $this->getFullname($user)), 'password') ?> - <?= $this->formPassword('password', $values, $errors) ?><br/> + <?= $this->form->label(t('New password for the user "%s"', $this->user->getFullname($user)), 'password') ?> + <?= $this->form->password('password', $values, $errors) ?><br/> - <?= $this->formLabel(t('Confirmation'), 'confirmation') ?> - <?= $this->formPassword('confirmation', $values, $errors) ?><br/> + <?= $this->form->label(t('Confirmation'), 'confirmation') ?> + <?= $this->form->password('confirmation', $values, $errors) ?><br/> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> - <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link(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 e4b09cfa..810a3a3f 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"> - <?= $this->a(t('Yes'), 'user', 'remove', array('user_id' => $user['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'user', 'remove', array('user_id' => $user['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link(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 5a06057c..a7504a7a 100644 --- a/app/Template/user/sessions.php +++ b/app/Template/user/sessions.php @@ -18,8 +18,8 @@ <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><?= $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> + <td><?= $this->e($this->text->truncate($session['user_agent'])) ?></td> + <td><?= $this->url->link(t('Remove'), 'user', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?></td> </tr> <?php endforeach ?> </table> diff --git a/app/Template/user/share.php b/app/Template/user/share.php index 55d06897..8f333a6b 100644 --- a/app/Template/user/share.php +++ b/app/Template/user/share.php @@ -6,12 +6,12 @@ <div class="listing"> <ul class="no-bullet"> - <li><strong><i class="fa fa-calendar"></i> <?= $this->a(t('iCal feed'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> </ul> </div> - <?= $this->a(t('Disable public access'), 'user', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Disable public access'), 'user', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> <?php else: ?> - <?= $this->a(t('Enable public access'), 'user', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?> + <?= $this->url->link(t('Enable public access'), 'user', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?> <?php endif ?> diff --git a/app/Template/user/show.php b/app/Template/user/show.php index 1be39cc3..5442e2e7 100644 --- a/app/Template/user/show.php +++ b/app/Template/user/show.php @@ -21,8 +21,8 @@ </div> <ul class="listing"> <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('Timezone:') ?> <strong><?= $this->inList($user['timezone'], $timezones) ?></strong></li> - <li><?= t('Language:') ?> <strong><?= $this->inList($user['language'], $languages) ?></strong></li> + <li><?= t('Timezone:') ?> <strong><?= $this->text->in($user['timezone'], $timezones) ?></strong></li> + <li><?= t('Language:') ?> <strong><?= $this->text->in($user['language'], $languages) ?></strong></li> <li><?= t('Notifications:') ?> <strong><?= $user['notifications_enabled'] == 1 ? t('Enabled') : t('Disabled') ?></strong></li> </ul> @@ -33,7 +33,7 @@ <div class="listing"> <ul class="no-bullet"> - <li><strong><i class="fa fa-calendar"></i> <?= $this->a(t('iCal feed'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> </ul> </div> <?php endif ?> diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php index 8c7e3cf8..2c8e909a 100644 --- a/app/Template/user/sidebar.php +++ b/app/Template/user/sidebar.php @@ -2,75 +2,75 @@ <h2><?= t('Information') ?></h2> <ul> <li> - <?= $this->a(t('Summary'), 'user', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Summary'), 'user', 'show', array('user_id' => $user['id'])) ?> </li> - <?php if ($this->userSession->isAdmin()): ?> + <?php if ($this->user->isAdmin()): ?> <li> - <?= $this->a(t('User dashboard'), 'app', 'dashboard', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('User dashboard'), 'app', 'dashboard', array('user_id' => $user['id'])) ?> </li> <li> - <?= $this->a(t('User calendar'), 'user', 'calendar', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('User calendar'), 'user', 'calendar', array('user_id' => $user['id'])) ?> </li> <?php endif ?> - <?php if ($this->userSession->isAdmin() || $this->userSession->isCurrentUser($user['id'])): ?> + <?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?> <li> - <?= $this->a(t('Time tracking'), 'user', 'timesheet', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Time tracking'), 'user', 'timesheet', array('user_id' => $user['id'])) ?> </li> <li> - <?= $this->a(t('Last logins'), 'user', 'last', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Last logins'), 'user', 'last', array('user_id' => $user['id'])) ?> </li> <li> - <?= $this->a(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?> </li> <?php endif ?> </ul> <h2><?= t('Actions') ?></h2> <ul> - <?php if ($this->userSession->isAdmin() || $this->userSession->isCurrentUser($user['id'])): ?> + <?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?> <li> - <?= $this->a(t('Edit profile'), 'user', 'edit', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Edit profile'), 'user', 'edit', array('user_id' => $user['id'])) ?> </li> <?php if ($user['is_ldap_user'] == 0): ?> <li> - <?= $this->a(t('Change password'), 'user', 'password', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Change password'), 'user', 'password', array('user_id' => $user['id'])) ?> </li> <?php endif ?> - <?php if ($this->userSession->isCurrentUser($user['id'])): ?> + <?php if ($this->user->isCurrentUser($user['id'])): ?> <li> - <?= $this->a(t('Two factor authentication'), 'twofactor', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Two factor authentication'), 'twofactor', 'index', array('user_id' => $user['id'])) ?> </li> - <?php elseif ($this->userSession->isAdmin() && $user['twofactor_activated'] == 1): ?> + <?php elseif ($this->user->isAdmin() && $user['twofactor_activated'] == 1): ?> <li> - <?= $this->a(t('Two factor authentication'), 'twofactor', 'disable', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Two factor authentication'), 'twofactor', 'disable', array('user_id' => $user['id'])) ?> </li> <?php endif ?> <li> - <?= $this->a(t('Public access'), 'user', 'share', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Public access'), 'user', 'share', array('user_id' => $user['id'])) ?> </li> <li> - <?= $this->a(t('Email notifications'), 'user', 'notifications', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Email notifications'), 'user', 'notifications', array('user_id' => $user['id'])) ?> </li> <li> - <?= $this->a(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?> </li> <?php endif ?> - <?php if ($this->userSession->isAdmin()): ?> + <?php if ($this->user->isAdmin()): ?> <li> - <?= $this->a(t('Hourly rates'), 'hourlyrate', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Hourly rates'), 'hourlyrate', 'index', array('user_id' => $user['id'])) ?> </li> <li> - <?= $this->a(t('Manage timetable'), 'timetable', 'index', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Manage timetable'), 'timetable', 'index', array('user_id' => $user['id'])) ?> </li> <?php endif ?> - <?php if ($this->userSession->isAdmin() && ! $this->userSession->isCurrentUser($user['id'])): ?> + <?php if ($this->user->isAdmin() && ! $this->user->isCurrentUser($user['id'])): ?> <li> - <?= $this->a(t('Remove'), 'user', 'remove', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Remove'), 'user', 'remove', array('user_id' => $user['id'])) ?> </li> <?php endif ?> </ul> diff --git a/app/Template/user/timesheet.php b/app/Template/user/timesheet.php index 3ae84df0..5c0d3af8 100644 --- a/app/Template/user/timesheet.php +++ b/app/Template/user/timesheet.php @@ -16,8 +16,8 @@ </tr> <?php foreach ($subtask_paginator->getCollection() as $record): ?> <tr> - <td><?= $this->a($this->e($record['task_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> - <td><?= $this->a($this->e($record['subtask_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> + <td><?= $this->url->link($this->e($record['task_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> + <td><?= $this->url->link($this->e($record['subtask_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> <td><?= dt('%B %e, %Y at %k:%M %p', $record['start']) ?></td> <td><?= dt('%B %e, %Y at %k:%M %p', $record['end']) ?></td> <td><?= n($record['time_spent']).' '.t('hours') ?></td> diff --git a/tests/units/AppHelperTest.php b/tests/units/AppHelperTest.php new file mode 100644 index 00000000..ad4bc151 --- /dev/null +++ b/tests/units/AppHelperTest.php @@ -0,0 +1,38 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Core\Session; +use Helper\App; +use Model\Config; + +class AppHelperTest extends Base +{ + public function testJsLang() + { + $h = new App($this->container); + $this->assertEquals('en', $h->jsLang()); + } + + public function testTimezone() + { + $h = new App($this->container); + $this->assertEquals('UTC', $h->getTimezone()); + } + + public function testFlashMessage() + { + $h = new App($this->container); + $s = new Session; + + $this->assertEmpty($h->flashMessage()); + $s->flash('test & test'); + $this->assertEquals('<div class="alert alert-success alert-fade-out">test & test</div>', $h->flashMessage()); + $this->assertEmpty($h->flashMessage()); + + $this->assertEmpty($h->flashMessage()); + $s->flashError('test & test'); + $this->assertEquals('<div class="alert alert-error">test & test</div>', $h->flashMessage()); + $this->assertEmpty($h->flashMessage()); + } +} diff --git a/tests/units/AssetHelperTest.php b/tests/units/AssetHelperTest.php new file mode 100644 index 00000000..1143ce1f --- /dev/null +++ b/tests/units/AssetHelperTest.php @@ -0,0 +1,21 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Helper\Asset; +use Model\Config; + +class AssetHelperTest extends Base +{ + public function testCustomCss() + { + $h = new Asset($this->container); + $c = new Config($this->container); + + $this->assertEmpty($h->customCss()); + + $this->assertTrue($c->save(array('application_stylesheet' => 'p { color: red }'))); + + $this->assertEquals('<style>p { color: red }</style>', $h->customCss()); + } +} diff --git a/tests/units/DatetimeHelperTest.php b/tests/units/DatetimeHelperTest.php new file mode 100644 index 00000000..2746beed --- /dev/null +++ b/tests/units/DatetimeHelperTest.php @@ -0,0 +1,44 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Helper\Datetime; + +class DatetimeHelperTest extends Base +{ + public function testGetDayHours() + { + $h = new Datetime($this->container); + + $slots = $h->getDayHours(); + + $this->assertNotEmpty($slots); + $this->assertCount(48, $slots); + $this->assertArrayHasKey('00:00', $slots); + $this->assertArrayHasKey('00:30', $slots); + $this->assertArrayHasKey('01:00', $slots); + $this->assertArrayHasKey('01:30', $slots); + $this->assertArrayHasKey('23:30', $slots); + $this->assertArrayNotHasKey('24:00', $slots); + } + + public function testGetWeekDays() + { + $h = new Datetime($this->container); + + $slots = $h->getWeekDays(); + + $this->assertNotEmpty($slots); + $this->assertCount(7, $slots); + $this->assertContains('Monday', $slots); + $this->assertContains('Sunday', $slots); + } + + public function testGetWeekDay() + { + $h = new Datetime($this->container); + + $this->assertEquals('Monday', $h->getWeekDay(1)); + $this->assertEquals('Sunday', $h->getWeekDay(7)); + } +} diff --git a/tests/units/FileHelperText.php b/tests/units/FileHelperText.php new file mode 100644 index 00000000..ce04fdbd --- /dev/null +++ b/tests/units/FileHelperText.php @@ -0,0 +1,15 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Helper\File; + +class FileHelperTest extends Base +{ + public function testIcon() + { + $h = new File($this->container); + $this->assertEquals('fa-file-image-o', $h->icon('test.png')); + $this->assertEquals('fa-file-o', $h->icon('test')); + } +} diff --git a/tests/units/HelperTest.php b/tests/units/TextHelperTest.php index 57d1940a..20b89fa8 100644 --- a/tests/units/HelperTest.php +++ b/tests/units/TextHelperTest.php @@ -2,14 +2,13 @@ require_once __DIR__.'/Base.php'; -use Core\Helper; -use Model\Config; +use Helper\Text; -class HelperTest extends Base +class TextHelperTest extends Base { public function testMarkdown() { - $h = new Helper($this->container); + $h = new Text($this->container); $this->assertEquals('<p>Test</p>', $h->markdown('Test')); @@ -32,19 +31,34 @@ class HelperTest extends Base ); } - public function testGetCurrentBaseUrl() + public function testFormatBytes() { - $h = new Helper($this->container); + $h = new Text($this->container); - $_SERVER['PHP_SELF'] = '/'; - $_SERVER['SERVER_NAME'] = 'localhost'; - $_SERVER['SERVER_PORT'] = 1234; + $this->assertEquals('1k', $h->bytes(1024)); + $this->assertEquals('33.71k', $h->bytes(34520)); + } - $this->assertEquals('http://localhost:1234/', $h->getCurrentBaseUrl()); + public function testTruncate() + { + $h = new Text($this->container); - $c = new Config($this->container); - $c->save(array('application_url' => 'https://mykanboard/')); - $this->assertEquals('https://mykanboard/', $c->get('application_url')); - $this->assertEquals('https://mykanboard/', $h->getCurrentBaseUrl()); + $this->assertEquals('abc', $h->truncate('abc')); + $this->assertEquals(str_repeat('a', 85).' [...]', $h->truncate(str_repeat('a', 200))); + } + + public function testContains() + { + $h = new Text($this->container); + + $this->assertTrue($h->contains('abc', 'b')); + $this->assertFalse($h->contains('abc', 'd')); + } + + public function testInList() + { + $h = new Text($this->container); + $this->assertEquals('?', $h->in('a', array('b' => 'c'))); + $this->assertEquals('c', $h->in('b', array('b' => 'c'))); } } diff --git a/tests/units/UrlHelperTest.php b/tests/units/UrlHelperTest.php new file mode 100644 index 00000000..d70842aa --- /dev/null +++ b/tests/units/UrlHelperTest.php @@ -0,0 +1,64 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Helper\Url; +use Model\Config; + +class UrlHelperTest extends Base +{ + public function testLink() + { + $h = new Url($this->container); + $this->assertEquals( + '<a href="?controller=a&action=b&d=e" class="f" title="g" target="_blank">label</a>', + $h->link('label', 'a', 'b', array('d' => 'e'), false, 'f', 'g', true) + ); + } + + public function testHref() + { + $h = new Url($this->container); + $this->assertEquals( + '?controller=a&action=b&d=e', + $h->href('a', 'b', array('d' => 'e')) + ); + } + + public function testTo() + { + $h = new Url($this->container); + $this->assertEquals( + '?controller=a&action=b&d=e', + $h->to('a', 'b', array('d' => 'e')) + ); + } + + public function testServer() + { + $h = new Url($this->container); + + $_SERVER['PHP_SELF'] = '/'; + $_SERVER['SERVER_NAME'] = 'localhost'; + $_SERVER['SERVER_PORT'] = 1234; + + $this->assertEquals('http://localhost:1234/', $h->server()); + } + + public function testBase() + { + $h = new Url($this->container); + + $_SERVER['PHP_SELF'] = '/'; + $_SERVER['SERVER_NAME'] = 'localhost'; + $_SERVER['SERVER_PORT'] = 1234; + + $this->assertEquals('http://localhost:1234/', $h->base()); + + $c = new Config($this->container); + $c->save(array('application_url' => 'https://mykanboard/')); + + $this->assertEquals('https://mykanboard/', $c->get('application_url')); + $this->assertEquals('https://mykanboard/', $h->base()); + } +} |