diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-05-24 16:02:25 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-05-24 16:02:25 -0400 |
commit | eeac2329baab1fdae7cbf6c707ed2ffd8beb4c1b (patch) | |
tree | 511c2fe47f8fbb1ea90e59e7a7a7f5e3530aa9ed /app/Model | |
parent | 65e9e5d1bed9f88ecfd43eb2c1e780a7c22c151f (diff) |
Helpers refactoring
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Base.php | 67 | ||||
-rw-r--r-- | app/Model/SubtaskForecast.php | 2 | ||||
-rw-r--r-- | app/Model/SubtaskTimeTracking.php | 2 | ||||
-rw-r--r-- | app/Model/TaskFilter.php | 2 | ||||
-rw-r--r-- | app/Model/UserSession.php | 11 |
5 files changed, 5 insertions, 79 deletions
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 |