diff options
Diffstat (limited to 'app')
297 files changed, 1893 insertions, 1903 deletions
diff --git a/app/Action/CommentCreation.php b/app/Action/CommentCreation.php index b91e39e2..60ca24f7 100644 --- a/app/Action/CommentCreation.php +++ b/app/Action/CommentCreation.php @@ -65,11 +65,11 @@ class CommentCreation extends Base */ public function doAction(array $data) { - return (bool) $this->comment->create(array( + return (bool) $this->commentModel->create(array( 'reference' => isset($data['reference']) ? $data['reference'] : '', 'comment' => $data['comment'], 'task_id' => $data['task_id'], - 'user_id' => isset($data['user_id']) && $this->projectPermission->isAssignable($this->getProjectId(), $data['user_id']) ? $data['user_id'] : 0, + 'user_id' => isset($data['user_id']) && $this->projectPermissionModel->isAssignable($this->getProjectId(), $data['user_id']) ? $data['user_id'] : 0, )); } diff --git a/app/Action/CommentCreationMoveTaskColumn.php b/app/Action/CommentCreationMoveTaskColumn.php index 11224d67..1b16f481 100644 --- a/app/Action/CommentCreationMoveTaskColumn.php +++ b/app/Action/CommentCreationMoveTaskColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Add a comment of the triggering event to the task description. @@ -32,7 +32,7 @@ class CommentCreationMoveTaskColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -71,9 +71,9 @@ class CommentCreationMoveTaskColumn extends Base return false; } - $column = $this->column->getById($data['column_id']); + $column = $this->columnModel->getById($data['column_id']); - return (bool) $this->comment->create(array( + return (bool) $this->commentModel->create(array( 'comment' => t('Moved to column %s', $column['title']), 'task_id' => $data['task_id'], 'user_id' => $this->userSession->getId(), diff --git a/app/Action/TaskAssignCategoryColor.php b/app/Action/TaskAssignCategoryColor.php index f5085cb0..fc486870 100644 --- a/app/Action/TaskAssignCategoryColor.php +++ b/app/Action/TaskAssignCategoryColor.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Set a category automatically according to the color @@ -32,7 +32,7 @@ class TaskAssignCategoryColor extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, + TaskModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignCategoryColor extends Base 'category_id' => $this->getParam('category_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignCategoryLabel.php b/app/Action/TaskAssignCategoryLabel.php index 95fa116e..48299010 100644 --- a/app/Action/TaskAssignCategoryLabel.php +++ b/app/Action/TaskAssignCategoryLabel.php @@ -74,7 +74,7 @@ class TaskAssignCategoryLabel extends Base 'category_id' => $this->getParam('category_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignCategoryLink.php b/app/Action/TaskAssignCategoryLink.php index b39e41b4..6937edd1 100644 --- a/app/Action/TaskAssignCategoryLink.php +++ b/app/Action/TaskAssignCategoryLink.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\TaskLink; +use Kanboard\Model\TaskLinkModel; /** * Set a category automatically according to a task link @@ -33,7 +33,7 @@ class TaskAssignCategoryLink extends Base public function getCompatibleEvents() { return array( - TaskLink::EVENT_CREATE_UPDATE, + TaskLinkModel::EVENT_CREATE_UPDATE, ); } @@ -79,7 +79,7 @@ class TaskAssignCategoryLink extends Base 'category_id' => $this->getParam('category_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** @@ -92,7 +92,7 @@ class TaskAssignCategoryLink extends Base public function hasRequiredCondition(array $data) { if ($data['link_id'] == $this->getParam('link_id')) { - $task = $this->taskFinder->getById($data['task_id']); + $task = $this->taskFinderModel->getById($data['task_id']); return empty($task['category_id']); } diff --git a/app/Action/TaskAssignColorCategory.php b/app/Action/TaskAssignColorCategory.php index 139c24cb..284b8f40 100644 --- a/app/Action/TaskAssignColorCategory.php +++ b/app/Action/TaskAssignColorCategory.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a specific category @@ -32,7 +32,7 @@ class TaskAssignColorCategory extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, + TaskModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignColorCategory extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorColumn.php b/app/Action/TaskAssignColorColumn.php index 92412739..57fd6f44 100644 --- a/app/Action/TaskAssignColorColumn.php +++ b/app/Action/TaskAssignColorColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a task @@ -32,8 +32,8 @@ class TaskAssignColorColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE, - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CREATE, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -79,7 +79,7 @@ class TaskAssignColorColumn extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorLink.php b/app/Action/TaskAssignColorLink.php index 12ceabb3..9ab5458b 100644 --- a/app/Action/TaskAssignColorLink.php +++ b/app/Action/TaskAssignColorLink.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\TaskLink; +use Kanboard\Model\TaskLinkModel; /** * Assign a color to a specific task link @@ -32,7 +32,7 @@ class TaskAssignColorLink extends Base public function getCompatibleEvents() { return array( - TaskLink::EVENT_CREATE_UPDATE, + TaskLinkModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignColorLink extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorPriority.php b/app/Action/TaskAssignColorPriority.php index 2e24f9ef..eae1b771 100644 --- a/app/Action/TaskAssignColorPriority.php +++ b/app/Action/TaskAssignColorPriority.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a priority @@ -32,7 +32,7 @@ class TaskAssignColorPriority extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, + TaskModel::EVENT_CREATE_UPDATE, ); } @@ -78,7 +78,7 @@ class TaskAssignColorPriority extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignColorUser.php b/app/Action/TaskAssignColorUser.php index 6ec8ce95..4bcf7a5c 100644 --- a/app/Action/TaskAssignColorUser.php +++ b/app/Action/TaskAssignColorUser.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a color to a specific user @@ -32,8 +32,8 @@ class TaskAssignColorUser extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE, - Task::EVENT_ASSIGNEE_CHANGE, + TaskModel::EVENT_CREATE, + TaskModel::EVENT_ASSIGNEE_CHANGE, ); } @@ -79,7 +79,7 @@ class TaskAssignColorUser extends Base 'color_id' => $this->getParam('color_id'), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Action/TaskAssignCurrentUser.php b/app/Action/TaskAssignCurrentUser.php index 192a120c..997aa98f 100644 --- a/app/Action/TaskAssignCurrentUser.php +++ b/app/Action/TaskAssignCurrentUser.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a task to the logged user @@ -32,7 +32,7 @@ class TaskAssignCurrentUser extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE, + TaskModel::EVENT_CREATE, ); } @@ -78,7 +78,7 @@ class TaskAssignCurrentUser extends Base 'owner_id' => $this->userSession->getId(), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignCurrentUserColumn.php b/app/Action/TaskAssignCurrentUserColumn.php index 05d08dd3..bc28a90b 100644 --- a/app/Action/TaskAssignCurrentUserColumn.php +++ b/app/Action/TaskAssignCurrentUserColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a task to the logged user on column change @@ -32,7 +32,7 @@ class TaskAssignCurrentUserColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -81,7 +81,7 @@ class TaskAssignCurrentUserColumn extends Base 'owner_id' => $this->userSession->getId(), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignSpecificUser.php b/app/Action/TaskAssignSpecificUser.php index 2dc3e966..50a2b2ae 100644 --- a/app/Action/TaskAssignSpecificUser.php +++ b/app/Action/TaskAssignSpecificUser.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Assign a task to a specific user @@ -32,8 +32,8 @@ class TaskAssignSpecificUser extends Base public function getCompatibleEvents() { return array( - Task::EVENT_CREATE_UPDATE, - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CREATE_UPDATE, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -79,7 +79,7 @@ class TaskAssignSpecificUser extends Base 'owner_id' => $this->getParam('user_id'), ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** diff --git a/app/Action/TaskAssignUser.php b/app/Action/TaskAssignUser.php index da54d186..9ea22986 100644 --- a/app/Action/TaskAssignUser.php +++ b/app/Action/TaskAssignUser.php @@ -71,7 +71,7 @@ class TaskAssignUser extends Base 'owner_id' => $data['owner_id'], ); - return $this->taskModification->update($values); + return $this->taskModificationModel->update($values); } /** @@ -83,6 +83,6 @@ class TaskAssignUser extends Base */ public function hasRequiredCondition(array $data) { - return $this->projectPermission->isAssignable($this->getProjectId(), $data['owner_id']); + return $this->projectPermissionModel->isAssignable($this->getProjectId(), $data['owner_id']); } } diff --git a/app/Action/TaskClose.php b/app/Action/TaskClose.php index cf91e83e..91e8cf43 100644 --- a/app/Action/TaskClose.php +++ b/app/Action/TaskClose.php @@ -63,7 +63,7 @@ class TaskClose extends Base */ public function doAction(array $data) { - return $this->taskStatus->close($data['task_id']); + return $this->taskStatusModel->close($data['task_id']); } /** diff --git a/app/Action/TaskCloseColumn.php b/app/Action/TaskCloseColumn.php index 09af3b96..1edce8fa 100644 --- a/app/Action/TaskCloseColumn.php +++ b/app/Action/TaskCloseColumn.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Close automatically a task in a specific column @@ -32,7 +32,7 @@ class TaskCloseColumn extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -67,7 +67,7 @@ class TaskCloseColumn extends Base */ public function doAction(array $data) { - return $this->taskStatus->close($data['task_id']); + return $this->taskStatusModel->close($data['task_id']); } /** diff --git a/app/Action/TaskCloseNoActivity.php b/app/Action/TaskCloseNoActivity.php index 59f7f56a..5a10510f 100644 --- a/app/Action/TaskCloseNoActivity.php +++ b/app/Action/TaskCloseNoActivity.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Close automatically a task after when inactive @@ -31,7 +31,7 @@ class TaskCloseNoActivity extends Base */ public function getCompatibleEvents() { - return array(Task::EVENT_DAILY_CRONJOB); + return array(TaskModel::EVENT_DAILY_CRONJOB); } /** @@ -74,7 +74,7 @@ class TaskCloseNoActivity extends Base $duration = time() - $task['date_modification']; if ($duration > $max) { - $results[] = $this->taskStatus->close($task['id']); + $results[] = $this->taskStatusModel->close($task['id']); } } diff --git a/app/Action/TaskCreation.php b/app/Action/TaskCreation.php index 290c31e1..e9e5c5f3 100644 --- a/app/Action/TaskCreation.php +++ b/app/Action/TaskCreation.php @@ -66,7 +66,7 @@ class TaskCreation extends Base */ public function doAction(array $data) { - return (bool) $this->taskCreation->create(array( + return (bool) $this->taskCreationModel->create(array( 'project_id' => $data['project_id'], 'title' => $data['title'], 'reference' => $data['reference'], diff --git a/app/Action/TaskDuplicateAnotherProject.php b/app/Action/TaskDuplicateAnotherProject.php index 5f05136e..93fae5cc 100644 --- a/app/Action/TaskDuplicateAnotherProject.php +++ b/app/Action/TaskDuplicateAnotherProject.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Duplicate a task to another project @@ -32,8 +32,8 @@ class TaskDuplicateAnotherProject extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, - Task::EVENT_CLOSE, + TaskModel::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CLOSE, ); } @@ -74,8 +74,8 @@ class TaskDuplicateAnotherProject extends Base */ public function doAction(array $data) { - $destination_column_id = $this->column->getFirstColumnId($this->getParam('project_id')); - return (bool) $this->taskDuplication->duplicateToProject($data['task_id'], $this->getParam('project_id'), null, $destination_column_id); + $destination_column_id = $this->columnModel->getFirstColumnId($this->getParam('project_id')); + return (bool) $this->taskDuplicationModel->duplicateToProject($data['task_id'], $this->getParam('project_id'), null, $destination_column_id); } /** diff --git a/app/Action/TaskEmail.php b/app/Action/TaskEmail.php index 4e0e06a6..7f9ba416 100644 --- a/app/Action/TaskEmail.php +++ b/app/Action/TaskEmail.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Email a task to someone @@ -32,8 +32,8 @@ class TaskEmail extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, - Task::EVENT_CLOSE, + TaskModel::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CLOSE, ); } @@ -75,16 +75,16 @@ class TaskEmail extends Base */ public function doAction(array $data) { - $user = $this->user->getById($this->getParam('user_id')); + $user = $this->userModel->getById($this->getParam('user_id')); if (! empty($user['email'])) { - $task = $this->taskFinder->getDetails($data['task_id']); + $task = $this->taskFinderModel->getDetails($data['task_id']); $this->emailClient->send( $user['email'], $user['name'] ?: $user['username'], $this->getParam('subject'), - $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->config->get('application_url'))) + $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->configModel->get('application_url'))) ); return true; diff --git a/app/Action/TaskEmailNoActivity.php b/app/Action/TaskEmailNoActivity.php index c5d7a797..c60702fb 100644 --- a/app/Action/TaskEmailNoActivity.php +++ b/app/Action/TaskEmailNoActivity.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Email a task with no activity @@ -32,7 +32,7 @@ class TaskEmailNoActivity extends Base public function getCompatibleEvents() { return array( - Task::EVENT_DAILY_CRONJOB, + TaskModel::EVENT_DAILY_CRONJOB, ); } @@ -85,7 +85,7 @@ class TaskEmailNoActivity extends Base { $results = array(); $max = $this->getParam('duration') * 86400; - $user = $this->user->getById($this->getParam('user_id')); + $user = $this->userModel->getById($this->getParam('user_id')); if (! empty($user['email'])) { foreach ($data['tasks'] as $task) { @@ -110,13 +110,13 @@ class TaskEmailNoActivity extends Base */ private function sendEmail($task_id, array $user) { - $task = $this->taskFinder->getDetails($task_id); + $task = $this->taskFinderModel->getDetails($task_id); $this->emailClient->send( $user['email'], $user['name'] ?: $user['username'], $this->getParam('subject'), - $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->config->get('application_url'))) + $this->template->render('notification/task_create', array('task' => $task, 'application_url' => $this->configModel->get('application_url'))) ); return true; diff --git a/app/Action/TaskMoveAnotherProject.php b/app/Action/TaskMoveAnotherProject.php index fdff0d8c..73ad4b69 100644 --- a/app/Action/TaskMoveAnotherProject.php +++ b/app/Action/TaskMoveAnotherProject.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another project @@ -32,8 +32,8 @@ class TaskMoveAnotherProject extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, - Task::EVENT_CLOSE, + TaskModel::EVENT_MOVE_COLUMN, + TaskModel::EVENT_CLOSE, ); } @@ -75,7 +75,7 @@ class TaskMoveAnotherProject extends Base */ public function doAction(array $data) { - return $this->taskDuplication->moveToProject($data['task_id'], $this->getParam('project_id')); + return $this->taskDuplicationModel->moveToProject($data['task_id'], $this->getParam('project_id')); } /** diff --git a/app/Action/TaskMoveColumnAssigned.php b/app/Action/TaskMoveColumnAssigned.php index 1b23a591..7e3db9c5 100644 --- a/app/Action/TaskMoveColumnAssigned.php +++ b/app/Action/TaskMoveColumnAssigned.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another column when an assignee is set @@ -32,8 +32,8 @@ class TaskMoveColumnAssigned extends Base public function getCompatibleEvents() { return array( - Task::EVENT_ASSIGNEE_CHANGE, - Task::EVENT_UPDATE, + TaskModel::EVENT_ASSIGNEE_CHANGE, + TaskModel::EVENT_UPDATE, ); } @@ -75,9 +75,9 @@ class TaskMoveColumnAssigned extends Base */ public function doAction(array $data) { - $original_task = $this->taskFinder->getById($data['task_id']); + $original_task = $this->taskFinderModel->getById($data['task_id']); - return $this->taskPosition->movePosition( + return $this->taskPositionModel->movePosition( $data['project_id'], $data['task_id'], $this->getParam('dest_column_id'), diff --git a/app/Action/TaskMoveColumnCategoryChange.php b/app/Action/TaskMoveColumnCategoryChange.php index 0f591eda..e4f88760 100644 --- a/app/Action/TaskMoveColumnCategoryChange.php +++ b/app/Action/TaskMoveColumnCategoryChange.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another column when the category is changed @@ -32,7 +32,7 @@ class TaskMoveColumnCategoryChange extends Base public function getCompatibleEvents() { return array( - Task::EVENT_UPDATE, + TaskModel::EVENT_UPDATE, ); } @@ -74,9 +74,9 @@ class TaskMoveColumnCategoryChange extends Base */ public function doAction(array $data) { - $original_task = $this->taskFinder->getById($data['task_id']); + $original_task = $this->taskFinderModel->getById($data['task_id']); - return $this->taskPosition->movePosition( + return $this->taskPositionModel->movePosition( $data['project_id'], $data['task_id'], $this->getParam('dest_column_id'), diff --git a/app/Action/TaskMoveColumnUnAssigned.php b/app/Action/TaskMoveColumnUnAssigned.php index 99ef9351..c3ae9e1d 100644 --- a/app/Action/TaskMoveColumnUnAssigned.php +++ b/app/Action/TaskMoveColumnUnAssigned.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Move a task to another column when an assignee is cleared @@ -32,8 +32,8 @@ class TaskMoveColumnUnAssigned extends Base public function getCompatibleEvents() { return array( - Task::EVENT_ASSIGNEE_CHANGE, - Task::EVENT_UPDATE, + TaskModel::EVENT_ASSIGNEE_CHANGE, + TaskModel::EVENT_UPDATE, ); } @@ -75,9 +75,9 @@ class TaskMoveColumnUnAssigned extends Base */ public function doAction(array $data) { - $original_task = $this->taskFinder->getById($data['task_id']); + $original_task = $this->taskFinderModel->getById($data['task_id']); - return $this->taskPosition->movePosition( + return $this->taskPositionModel->movePosition( $data['project_id'], $data['task_id'], $this->getParam('dest_column_id'), diff --git a/app/Action/TaskOpen.php b/app/Action/TaskOpen.php index ec0f96f7..8e847b8e 100644 --- a/app/Action/TaskOpen.php +++ b/app/Action/TaskOpen.php @@ -63,7 +63,7 @@ class TaskOpen extends Base */ public function doAction(array $data) { - return $this->taskStatus->open($data['task_id']); + return $this->taskStatusModel->open($data['task_id']); } /** diff --git a/app/Action/TaskUpdateStartDate.php b/app/Action/TaskUpdateStartDate.php index e5cea01b..e5410a87 100644 --- a/app/Action/TaskUpdateStartDate.php +++ b/app/Action/TaskUpdateStartDate.php @@ -2,7 +2,7 @@ namespace Kanboard\Action; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Set the start date of task @@ -32,7 +32,7 @@ class TaskUpdateStartDate extends Base public function getCompatibleEvents() { return array( - Task::EVENT_MOVE_COLUMN, + TaskModel::EVENT_MOVE_COLUMN, ); } @@ -77,7 +77,7 @@ class TaskUpdateStartDate extends Base 'date_started' => time(), ); - return $this->taskModification->update($values, false); + return $this->taskModificationModel->update($values, false); } /** diff --git a/app/Analytic/AverageLeadCycleTimeAnalytic.php b/app/Analytic/AverageLeadCycleTimeAnalytic.php index 62c83559..d6cd1f86 100644 --- a/app/Analytic/AverageLeadCycleTimeAnalytic.php +++ b/app/Analytic/AverageLeadCycleTimeAnalytic.php @@ -3,7 +3,7 @@ namespace Kanboard\Analytic; use Kanboard\Core\Base; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Average Lead and Cycle Time @@ -106,7 +106,7 @@ class AverageLeadCycleTimeAnalytic extends Base private function getTasks($project_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns('date_completed', 'date_creation', 'date_started') ->eq('project_id', $project_id) ->desc('id') diff --git a/app/Analytic/AverageTimeSpentColumnAnalytic.php b/app/Analytic/AverageTimeSpentColumnAnalytic.php index 11078323..3556fb9d 100644 --- a/app/Analytic/AverageTimeSpentColumnAnalytic.php +++ b/app/Analytic/AverageTimeSpentColumnAnalytic.php @@ -3,7 +3,7 @@ namespace Kanboard\Analytic; use Kanboard\Core\Base; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Average Time Spent by Column @@ -40,7 +40,7 @@ class AverageTimeSpentColumnAnalytic extends Base private function initialize($project_id) { $stats = array(); - $columns = $this->column->getList($project_id); + $columns = $this->columnModel->getList($project_id); foreach ($columns as $column_id => $column_title) { $stats[$column_id] = array( @@ -110,7 +110,7 @@ class AverageTimeSpentColumnAnalytic extends Base */ private function getTaskTimeByColumns(array &$task) { - $columns = $this->transition->getTimeSpentByTask($task['id']); + $columns = $this->transitionModel->getTimeSpentByTask($task['id']); if (! isset($columns[$task['column_id']])) { $columns[$task['column_id']] = 0; @@ -144,7 +144,7 @@ class AverageTimeSpentColumnAnalytic extends Base private function getTasks($project_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns('id', 'date_completed', 'date_moved', 'column_id') ->eq('project_id', $project_id) ->desc('id') diff --git a/app/Analytic/EstimatedTimeComparisonAnalytic.php b/app/Analytic/EstimatedTimeComparisonAnalytic.php index 490bcd50..d9aea32d 100644 --- a/app/Analytic/EstimatedTimeComparisonAnalytic.php +++ b/app/Analytic/EstimatedTimeComparisonAnalytic.php @@ -3,7 +3,7 @@ namespace Kanboard\Analytic; use Kanboard\Core\Base; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Estimated/Spent Time Comparison @@ -22,7 +22,7 @@ class EstimatedTimeComparisonAnalytic extends Base */ public function build($project_id) { - $rows = $this->db->table(Task::TABLE) + $rows = $this->db->table(TaskModel::TABLE) ->columns('SUM(time_estimated) AS time_estimated', 'SUM(time_spent) AS time_spent', 'is_active') ->eq('project_id', $project_id) ->groupBy('is_active') @@ -40,7 +40,7 @@ class EstimatedTimeComparisonAnalytic extends Base ); foreach ($rows as $row) { - $key = $row['is_active'] == Task::STATUS_OPEN ? 'open' : 'closed'; + $key = $row['is_active'] == TaskModel::STATUS_OPEN ? 'open' : 'closed'; $metrics[$key]['time_spent'] = $row['time_spent']; $metrics[$key]['time_estimated'] = $row['time_estimated']; } diff --git a/app/Analytic/TaskDistributionAnalytic.php b/app/Analytic/TaskDistributionAnalytic.php index 838652e3..447d88a1 100644 --- a/app/Analytic/TaskDistributionAnalytic.php +++ b/app/Analytic/TaskDistributionAnalytic.php @@ -23,10 +23,10 @@ class TaskDistributionAnalytic extends Base { $metrics = array(); $total = 0; - $columns = $this->column->getAll($project_id); + $columns = $this->columnModel->getAll($project_id); foreach ($columns as $column) { - $nb_tasks = $this->taskFinder->countByColumnId($project_id, $column['id']); + $nb_tasks = $this->taskFinderModel->countByColumnId($project_id, $column['id']); $total += $nb_tasks; $metrics[] = array( diff --git a/app/Analytic/UserDistributionAnalytic.php b/app/Analytic/UserDistributionAnalytic.php index e1815f9c..421d4242 100644 --- a/app/Analytic/UserDistributionAnalytic.php +++ b/app/Analytic/UserDistributionAnalytic.php @@ -23,8 +23,8 @@ class UserDistributionAnalytic extends Base { $metrics = array(); $total = 0; - $tasks = $this->taskFinder->getAll($project_id); - $users = $this->projectUserRole->getAssignableUsersList($project_id); + $tasks = $this->taskFinderModel->getAll($project_id); + $users = $this->projectUserRoleModel->getAssignableUsersList($project_id); foreach ($tasks as $task) { $user = isset($users[$task['owner_id']]) ? $users[$task['owner_id']] : $users[0]; diff --git a/app/Api/ActionApi.php b/app/Api/ActionApi.php index 0647f9e8..116742d8 100644 --- a/app/Api/ActionApi.php +++ b/app/Api/ActionApi.php @@ -29,12 +29,12 @@ class ActionApi extends Base public function removeAction($action_id) { - return $this->action->remove($action_id); + return $this->actionModel->remove($action_id); } public function getActions($project_id) { - return $this->action->getAllByProject($project_id); + return $this->actionModel->getAllByProject($project_id); } public function createAction($project_id, $event_name, $action_name, array $params) @@ -82,6 +82,6 @@ class ActionApi extends Base } } - return $this->action->create($values); + return $this->actionModel->create($values); } } diff --git a/app/Api/AppApi.php b/app/Api/AppApi.php index 865ba21a..637de5c5 100644 --- a/app/Api/AppApi.php +++ b/app/Api/AppApi.php @@ -14,7 +14,7 @@ class AppApi extends Base { public function getTimezone() { - return $this->timezone->getCurrentTimezone(); + return $this->timezoneModel->getCurrentTimezone(); } public function getVersion() @@ -24,17 +24,17 @@ class AppApi extends Base public function getDefaultTaskColor() { - return $this->color->getDefaultColor(); + return $this->colorModel->getDefaultColor(); } public function getDefaultTaskColors() { - return $this->color->getDefaultColors(); + return $this->colorModel->getDefaultColors(); } public function getColorList() { - return $this->color->getList(); + return $this->colorModel->getList(); } public function getApplicationRoles() diff --git a/app/Api/AuthApi.php b/app/Api/AuthApi.php index a9ad5baf..1cbce5ae 100644 --- a/app/Api/AuthApi.php +++ b/app/Api/AuthApi.php @@ -28,7 +28,7 @@ class AuthApi extends BaseApi if ($this->isUserAuthenticated($username, $password)) { $this->checkProcedurePermission(true, $method); - $this->userSession->initialize($this->user->getByUsername($username)); + $this->userSession->initialize($this->userModel->getByUsername($username)); } elseif ($this->isAppAuthenticated($username, $password)) { $this->checkProcedurePermission(false, $method); } else { @@ -48,7 +48,7 @@ class AuthApi extends BaseApi private function isUserAuthenticated($username, $password) { return $username !== 'jsonrpc' && - ! $this->userLocking->isLocked($username) && + ! $this->userLockingModel->isLocked($username) && $this->authenticationManager->passwordAuthentication($username, $password); } @@ -77,6 +77,6 @@ class AuthApi extends BaseApi return API_AUTHENTICATION_TOKEN; } - return $this->config->get('api_token'); + return $this->configModel->get('api_token'); } } diff --git a/app/Api/BaseApi.php b/app/Api/BaseApi.php index b70356cf..ae41e5b5 100644 --- a/app/Api/BaseApi.php +++ b/app/Api/BaseApi.php @@ -60,7 +60,7 @@ abstract class BaseApi extends Base public function checkProjectPermission($project_id) { - if ($this->userSession->isLogged() && ! $this->projectPermission->isUserAllowed($project_id, $this->userSession->getId())) { + if ($this->userSession->isLogged() && ! $this->projectPermissionModel->isUserAllowed($project_id, $this->userSession->getId())) { throw new AccessDeniedException('Permission denied'); } } @@ -68,7 +68,7 @@ abstract class BaseApi extends Base public function checkTaskPermission($task_id) { if ($this->userSession->isLogged()) { - $this->checkProjectPermission($this->taskFinder->getProjectId($task_id)); + $this->checkProjectPermission($this->taskFinderModel->getProjectId($task_id)); } } @@ -76,7 +76,7 @@ abstract class BaseApi extends Base { if (! empty($task)) { $task['url'] = $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true); - $task['color'] = $this->color->getColorProperties($task['color_id']); + $task['color'] = $this->colorModel->getColorProperties($task['color_id']); } return $task; diff --git a/app/Api/BoardApi.php b/app/Api/BoardApi.php index c7d93aa0..aa5942af 100644 --- a/app/Api/BoardApi.php +++ b/app/Api/BoardApi.php @@ -13,6 +13,6 @@ class BoardApi extends BaseApi public function getBoard($project_id) { $this->checkProjectPermission($project_id); - return $this->board->getBoard($project_id); + return $this->boardModel->getBoard($project_id); } } diff --git a/app/Api/CategoryApi.php b/app/Api/CategoryApi.php index 7c5d3bfb..c56cfb35 100644 --- a/app/Api/CategoryApi.php +++ b/app/Api/CategoryApi.php @@ -14,17 +14,17 @@ class CategoryApi extends Base { public function getCategory($category_id) { - return $this->category->getById($category_id); + return $this->categoryModel->getById($category_id); } public function getAllCategories($project_id) { - return $this->category->getAll($project_id); + return $this->categoryModel->getAll($project_id); } public function removeCategory($category_id) { - return $this->category->remove($category_id); + return $this->categoryModel->remove($category_id); } public function createCategory($project_id, $name) @@ -35,7 +35,7 @@ class CategoryApi extends Base ); list($valid, ) = $this->categoryValidator->validateCreation($values); - return $valid ? $this->category->create($values) : false; + return $valid ? $this->categoryModel->create($values) : false; } public function updateCategory($id, $name) @@ -46,6 +46,6 @@ class CategoryApi extends Base ); list($valid, ) = $this->categoryValidator->validateModification($values); - return $valid && $this->category->update($values); + return $valid && $this->categoryModel->update($values); } } diff --git a/app/Api/ColumnApi.php b/app/Api/ColumnApi.php index 45ce521d..aa4026f6 100644 --- a/app/Api/ColumnApi.php +++ b/app/Api/ColumnApi.php @@ -12,31 +12,31 @@ class ColumnApi extends BaseApi { public function getColumns($project_id) { - return $this->column->getAll($project_id); + return $this->columnModel->getAll($project_id); } public function getColumn($column_id) { - return $this->column->getById($column_id); + return $this->columnModel->getById($column_id); } public function updateColumn($column_id, $title, $task_limit = 0, $description = '') { - return $this->column->update($column_id, $title, $task_limit, $description); + return $this->columnModel->update($column_id, $title, $task_limit, $description); } public function addColumn($project_id, $title, $task_limit = 0, $description = '') { - return $this->column->create($project_id, $title, $task_limit, $description); + return $this->columnModel->create($project_id, $title, $task_limit, $description); } public function removeColumn($column_id) { - return $this->column->remove($column_id); + return $this->columnModel->remove($column_id); } public function changeColumnPosition($project_id, $column_id, $position) { - return $this->column->changePosition($project_id, $column_id, $position); + return $this->columnModel->changePosition($project_id, $column_id, $position); } } diff --git a/app/Api/CommentApi.php b/app/Api/CommentApi.php index f16b0f7f..8358efee 100644 --- a/app/Api/CommentApi.php +++ b/app/Api/CommentApi.php @@ -14,17 +14,17 @@ class CommentApi extends Base { public function getComment($comment_id) { - return $this->comment->getById($comment_id); + return $this->commentModel->getById($comment_id); } public function getAllComments($task_id) { - return $this->comment->getAll($task_id); + return $this->commentModel->getAll($task_id); } public function removeComment($comment_id) { - return $this->comment->remove($comment_id); + return $this->commentModel->remove($comment_id); } public function createComment($task_id, $user_id, $content, $reference = '') @@ -38,7 +38,7 @@ class CommentApi extends Base list($valid, ) = $this->commentValidator->validateCreation($values); - return $valid ? $this->comment->create($values) : false; + return $valid ? $this->commentModel->create($values) : false; } public function updateComment($id, $content) @@ -49,6 +49,6 @@ class CommentApi extends Base ); list($valid, ) = $this->commentValidator->validateModification($values); - return $valid && $this->comment->update($values); + return $valid && $this->commentModel->update($values); } } diff --git a/app/Api/FileApi.php b/app/Api/FileApi.php index cc2e3986..1ed3aeb9 100644 --- a/app/Api/FileApi.php +++ b/app/Api/FileApi.php @@ -14,18 +14,18 @@ class FileApi extends BaseApi { public function getTaskFile($file_id) { - return $this->taskFile->getById($file_id); + return $this->taskFileModel->getById($file_id); } public function getAllTaskFiles($task_id) { - return $this->taskFile->getAll($task_id); + return $this->taskFileModel->getAll($task_id); } public function downloadTaskFile($file_id) { try { - $file = $this->taskFile->getById($file_id); + $file = $this->taskFileModel->getById($file_id); if (! empty($file)) { return base64_encode($this->objectStorage->get($file['path'])); @@ -40,7 +40,7 @@ class FileApi extends BaseApi public function createTaskFile($project_id, $task_id, $filename, $blob) { try { - return $this->taskFile->uploadContent($task_id, $filename, $blob); + return $this->taskFileModel->uploadContent($task_id, $filename, $blob); } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); return false; @@ -49,12 +49,12 @@ class FileApi extends BaseApi public function removeTaskFile($file_id) { - return $this->taskFile->remove($file_id); + return $this->taskFileModel->remove($file_id); } public function removeAllTaskFiles($task_id) { - return $this->taskFile->removeAll($task_id); + return $this->taskFileModel->removeAll($task_id); } // Deprecated procedures diff --git a/app/Api/GroupApi.php b/app/Api/GroupApi.php index f1841fa3..1701edc3 100644 --- a/app/Api/GroupApi.php +++ b/app/Api/GroupApi.php @@ -14,7 +14,7 @@ class GroupApi extends Base { public function createGroup($name, $external_id = '') { - return $this->group->create($name, $external_id); + return $this->groupModel->create($name, $external_id); } public function updateGroup($group_id, $name = null, $external_id = null) @@ -31,21 +31,21 @@ class GroupApi extends Base } } - return $this->group->update($values); + return $this->groupModel->update($values); } public function removeGroup($group_id) { - return $this->group->remove($group_id); + return $this->groupModel->remove($group_id); } public function getGroup($group_id) { - return $this->group->getById($group_id); + return $this->groupModel->getById($group_id); } public function getAllGroups() { - return $this->group->getAll(); + return $this->groupModel->getAll(); } } diff --git a/app/Api/GroupMemberApi.php b/app/Api/GroupMemberApi.php index f5171e23..e09f6975 100644 --- a/app/Api/GroupMemberApi.php +++ b/app/Api/GroupMemberApi.php @@ -14,26 +14,26 @@ class GroupMemberApi extends Base { public function getMemberGroups($user_id) { - return $this->groupMember->getGroups($user_id); + return $this->groupMemberModel->getGroups($user_id); } public function getGroupMembers($group_id) { - return $this->groupMember->getMembers($group_id); + return $this->groupMemberModel->getMembers($group_id); } public function addGroupMember($group_id, $user_id) { - return $this->groupMember->addUser($group_id, $user_id); + return $this->groupMemberModel->addUser($group_id, $user_id); } public function removeGroupMember($group_id, $user_id) { - return $this->groupMember->removeUser($group_id, $user_id); + return $this->groupMemberModel->removeUser($group_id, $user_id); } public function isGroupMember($group_id, $user_id) { - return $this->groupMember->isMember($group_id, $user_id); + return $this->groupMemberModel->isMember($group_id, $user_id); } } diff --git a/app/Api/LinkApi.php b/app/Api/LinkApi.php index a76cb802..d8e525e4 100644 --- a/app/Api/LinkApi.php +++ b/app/Api/LinkApi.php @@ -21,7 +21,7 @@ class LinkApi extends Base */ public function getLinkById($link_id) { - return $this->link->getById($link_id); + return $this->linkModel->getById($link_id); } /** @@ -33,7 +33,7 @@ class LinkApi extends Base */ public function getLinkByLabel($label) { - return $this->link->getByLabel($label); + return $this->linkModel->getByLabel($label); } /** @@ -45,7 +45,7 @@ class LinkApi extends Base */ public function getOppositeLinkId($link_id) { - return $this->link->getOppositeLinkId($link_id); + return $this->linkModel->getOppositeLinkId($link_id); } /** @@ -56,7 +56,7 @@ class LinkApi extends Base */ public function getAllLinks() { - return $this->link->getAll(); + return $this->linkModel->getAll(); } /** @@ -75,7 +75,7 @@ class LinkApi extends Base ); list($valid, ) = $this->linkValidator->validateCreation($values); - return $valid ? $this->link->create($label, $opposite_label) : false; + return $valid ? $this->linkModel->create($label, $opposite_label) : false; } /** @@ -96,7 +96,7 @@ class LinkApi extends Base ); list($valid, ) = $this->linkValidator->validateModification($values); - return $valid && $this->link->update($values); + return $valid && $this->linkModel->update($values); } /** @@ -108,6 +108,6 @@ class LinkApi extends Base */ public function removeLink($link_id) { - return $this->link->remove($link_id); + return $this->linkModel->remove($link_id); } } diff --git a/app/Api/MeApi.php b/app/Api/MeApi.php index 7d46a962..497749b6 100644 --- a/app/Api/MeApi.php +++ b/app/Api/MeApi.php @@ -2,7 +2,7 @@ namespace Kanboard\Api; -use Kanboard\Model\Subtask as SubtaskModel; +use Kanboard\Model\SubtaskModel; /** * Me API controller @@ -20,25 +20,25 @@ class MeApi extends BaseApi public function getMyDashboard() { $user_id = $this->userSession->getId(); - $projects = $this->project->getQueryColumnStats($this->projectPermission->getActiveProjectIds($user_id))->findAll(); - $tasks = $this->taskFinder->getUserQuery($user_id)->findAll(); + $projects = $this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id))->findAll(); + $tasks = $this->taskFinderModel->getUserQuery($user_id)->findAll(); return array( 'projects' => $this->formatProjects($projects), 'tasks' => $this->formatTasks($tasks), - 'subtasks' => $this->subtask->getUserQuery($user_id, array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))->findAll(), + 'subtasks' => $this->subtaskModel->getUserQuery($user_id, array(SubtaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))->findAll(), ); } public function getMyActivityStream() { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); return $this->helper->projectActivity->getProjectsEvents($project_ids, 100); } public function createMyPrivateProject($name, $description = null) { - if ($this->config->get('disable_private_project', 0) == 1) { + if ($this->configModel->get('disable_private_project', 0) == 1) { return false; } @@ -49,23 +49,23 @@ class MeApi extends BaseApi ); list($valid, ) = $this->projectValidator->validateCreation($values); - return $valid ? $this->project->create($values, $this->userSession->getId(), true) : false; + return $valid ? $this->projectModel->create($values, $this->userSession->getId(), true) : false; } public function getMyProjectsList() { - return $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + return $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); } public function getMyOverdueTasks() { - return $this->taskFinder->getOverdueTasksByUser($this->userSession->getId()); + return $this->taskFinderModel->getOverdueTasksByUser($this->userSession->getId()); } public function getMyProjects() { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); - $projects = $this->project->getAllByIds($project_ids); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); + $projects = $this->projectModel->getAllByIds($project_ids); return $this->formatProjects($projects); } diff --git a/app/Api/ProjectApi.php b/app/Api/ProjectApi.php index 70cd8d16..29a9cd79 100644 --- a/app/Api/ProjectApi.php +++ b/app/Api/ProjectApi.php @@ -13,42 +13,42 @@ class ProjectApi extends BaseApi public function getProjectById($project_id) { $this->checkProjectPermission($project_id); - return $this->formatProject($this->project->getById($project_id)); + return $this->formatProject($this->projectModel->getById($project_id)); } public function getProjectByName($name) { - return $this->formatProject($this->project->getByName($name)); + return $this->formatProject($this->projectModel->getByName($name)); } public function getAllProjects() { - return $this->formatProjects($this->project->getAll()); + return $this->formatProjects($this->projectModel->getAll()); } public function removeProject($project_id) { - return $this->project->remove($project_id); + return $this->projectModel->remove($project_id); } public function enableProject($project_id) { - return $this->project->enable($project_id); + return $this->projectModel->enable($project_id); } public function disableProject($project_id) { - return $this->project->disable($project_id); + return $this->projectModel->disable($project_id); } public function enableProjectPublicAccess($project_id) { - return $this->project->enablePublicAccess($project_id); + return $this->projectModel->enablePublicAccess($project_id); } public function disableProjectPublicAccess($project_id) { - return $this->project->disablePublicAccess($project_id); + return $this->projectModel->disablePublicAccess($project_id); } public function getProjectActivities(array $project_ids) @@ -70,7 +70,7 @@ class ProjectApi extends BaseApi ); list($valid, ) = $this->projectValidator->validateCreation($values); - return $valid ? $this->project->create($values) : false; + return $valid ? $this->projectModel->create($values) : false; } public function updateProject($id, $name, $description = null) @@ -82,6 +82,6 @@ class ProjectApi extends BaseApi ); list($valid, ) = $this->projectValidator->validateModification($values); - return $valid && $this->project->update($values); + return $valid && $this->projectModel->update($values); } } diff --git a/app/Api/ProjectPermissionApi.php b/app/Api/ProjectPermissionApi.php index 10ee3852..703cd0f3 100644 --- a/app/Api/ProjectPermissionApi.php +++ b/app/Api/ProjectPermissionApi.php @@ -15,42 +15,42 @@ class ProjectPermissionApi extends Base { public function getProjectUsers($project_id) { - return $this->projectUserRole->getAllUsers($project_id); + return $this->projectUserRoleModel->getAllUsers($project_id); } public function getAssignableUsers($project_id, $prepend_unassigned = false) { - return $this->projectUserRole->getAssignableUsersList($project_id, $prepend_unassigned); + return $this->projectUserRoleModel->getAssignableUsersList($project_id, $prepend_unassigned); } public function addProjectUser($project_id, $user_id, $role = Role::PROJECT_MEMBER) { - return $this->projectUserRole->addUser($project_id, $user_id, $role); + return $this->projectUserRoleModel->addUser($project_id, $user_id, $role); } public function addProjectGroup($project_id, $group_id, $role = Role::PROJECT_MEMBER) { - return $this->projectGroupRole->addGroup($project_id, $group_id, $role); + return $this->projectGroupRoleModel->addGroup($project_id, $group_id, $role); } public function removeProjectUser($project_id, $user_id) { - return $this->projectUserRole->removeUser($project_id, $user_id); + return $this->projectUserRoleModel->removeUser($project_id, $user_id); } public function removeProjectGroup($project_id, $group_id) { - return $this->projectGroupRole->removeGroup($project_id, $group_id); + return $this->projectGroupRoleModel->removeGroup($project_id, $group_id); } public function changeProjectUserRole($project_id, $user_id, $role) { - return $this->projectUserRole->changeUserRole($project_id, $user_id, $role); + return $this->projectUserRoleModel->changeUserRole($project_id, $user_id, $role); } public function changeProjectGroupRole($project_id, $group_id, $role) { - return $this->projectGroupRole->changeGroupRole($project_id, $group_id, $role); + return $this->projectGroupRoleModel->changeGroupRole($project_id, $group_id, $role); } // Deprecated diff --git a/app/Api/SubtaskApi.php b/app/Api/SubtaskApi.php index 305f9ae7..5764ff7d 100644 --- a/app/Api/SubtaskApi.php +++ b/app/Api/SubtaskApi.php @@ -14,17 +14,17 @@ class SubtaskApi extends Base { public function getSubtask($subtask_id) { - return $this->subtask->getById($subtask_id); + return $this->subtaskModel->getById($subtask_id); } public function getAllSubtasks($task_id) { - return $this->subtask->getAll($task_id); + return $this->subtaskModel->getAll($task_id); } public function removeSubtask($subtask_id) { - return $this->subtask->remove($subtask_id); + return $this->subtaskModel->remove($subtask_id); } public function createSubtask($task_id, $title, $user_id = 0, $time_estimated = 0, $time_spent = 0, $status = 0) @@ -39,7 +39,7 @@ class SubtaskApi extends Base ); list($valid, ) = $this->subtaskValidator->validateCreation($values); - return $valid ? $this->subtask->create($values) : false; + return $valid ? $this->subtaskModel->create($values) : false; } public function updateSubtask($id, $task_id, $title = null, $user_id = null, $time_estimated = null, $time_spent = null, $status = null) @@ -61,6 +61,6 @@ class SubtaskApi extends Base } list($valid, ) = $this->subtaskValidator->validateApiModification($values); - return $valid && $this->subtask->update($values); + return $valid && $this->subtaskModel->update($values); } } diff --git a/app/Api/SwimlaneApi.php b/app/Api/SwimlaneApi.php index f179e11b..c3c56a71 100644 --- a/app/Api/SwimlaneApi.php +++ b/app/Api/SwimlaneApi.php @@ -14,37 +14,37 @@ class SwimlaneApi extends Base { public function getActiveSwimlanes($project_id) { - return $this->swimlane->getSwimlanes($project_id); + return $this->swimlaneModel->getSwimlanes($project_id); } public function getAllSwimlanes($project_id) { - return $this->swimlane->getAll($project_id); + return $this->swimlaneModel->getAll($project_id); } public function getSwimlaneById($swimlane_id) { - return $this->swimlane->getById($swimlane_id); + return $this->swimlaneModel->getById($swimlane_id); } public function getSwimlaneByName($project_id, $name) { - return $this->swimlane->getByName($project_id, $name); + return $this->swimlaneModel->getByName($project_id, $name); } public function getSwimlane($swimlane_id) { - return $this->swimlane->getById($swimlane_id); + return $this->swimlaneModel->getById($swimlane_id); } public function getDefaultSwimlane($project_id) { - return $this->swimlane->getDefault($project_id); + return $this->swimlaneModel->getDefault($project_id); } public function addSwimlane($project_id, $name, $description = '') { - return $this->swimlane->create(array('project_id' => $project_id, 'name' => $name, 'description' => $description)); + return $this->swimlaneModel->create(array('project_id' => $project_id, 'name' => $name, 'description' => $description)); } public function updateSwimlane($swimlane_id, $name, $description = null) @@ -55,26 +55,26 @@ class SwimlaneApi extends Base $values['description'] = $description; } - return $this->swimlane->update($values); + return $this->swimlaneModel->update($values); } public function removeSwimlane($project_id, $swimlane_id) { - return $this->swimlane->remove($project_id, $swimlane_id); + return $this->swimlaneModel->remove($project_id, $swimlane_id); } public function disableSwimlane($project_id, $swimlane_id) { - return $this->swimlane->disable($project_id, $swimlane_id); + return $this->swimlaneModel->disable($project_id, $swimlane_id); } public function enableSwimlane($project_id, $swimlane_id) { - return $this->swimlane->enable($project_id, $swimlane_id); + return $this->swimlaneModel->enable($project_id, $swimlane_id); } public function changeSwimlanePosition($project_id, $swimlane_id, $position) { - return $this->swimlane->changePosition($project_id, $swimlane_id, $position); + return $this->swimlaneModel->changePosition($project_id, $swimlane_id, $position); } } diff --git a/app/Api/TaskApi.php b/app/Api/TaskApi.php index 4d745fa6..ddb3ac54 100644 --- a/app/Api/TaskApi.php +++ b/app/Api/TaskApi.php @@ -3,7 +3,7 @@ namespace Kanboard\Api; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Task API controller @@ -22,63 +22,63 @@ class TaskApi extends BaseApi public function getTask($task_id) { $this->checkTaskPermission($task_id); - return $this->formatTask($this->taskFinder->getById($task_id)); + return $this->formatTask($this->taskFinderModel->getById($task_id)); } public function getTaskByReference($project_id, $reference) { $this->checkProjectPermission($project_id); - return $this->formatTask($this->taskFinder->getByReference($project_id, $reference)); + return $this->formatTask($this->taskFinderModel->getByReference($project_id, $reference)); } public function getAllTasks($project_id, $status_id = TaskModel::STATUS_OPEN) { $this->checkProjectPermission($project_id); - return $this->formatTasks($this->taskFinder->getAll($project_id, $status_id)); + return $this->formatTasks($this->taskFinderModel->getAll($project_id, $status_id)); } public function getOverdueTasks() { - return $this->taskFinder->getOverdueTasks(); + return $this->taskFinderModel->getOverdueTasks(); } public function getOverdueTasksByProject($project_id) { $this->checkProjectPermission($project_id); - return $this->taskFinder->getOverdueTasksByProject($project_id); + return $this->taskFinderModel->getOverdueTasksByProject($project_id); } public function openTask($task_id) { $this->checkTaskPermission($task_id); - return $this->taskStatus->open($task_id); + return $this->taskStatusModel->open($task_id); } public function closeTask($task_id) { $this->checkTaskPermission($task_id); - return $this->taskStatus->close($task_id); + return $this->taskStatusModel->close($task_id); } public function removeTask($task_id) { - return $this->task->remove($task_id); + return $this->taskModel->remove($task_id); } public function moveTaskPosition($project_id, $task_id, $column_id, $position, $swimlane_id = 0) { $this->checkProjectPermission($project_id); - return $this->taskPosition->movePosition($project_id, $task_id, $column_id, $position, $swimlane_id); + return $this->taskPositionModel->movePosition($project_id, $task_id, $column_id, $position, $swimlane_id); } public function moveTaskToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null) { - return $this->taskDuplication->moveToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); + return $this->taskDuplicationModel->moveToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); } public function duplicateTaskToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null) { - return $this->taskDuplication->duplicateToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); + return $this->taskDuplicationModel->duplicateToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id); } public function createTask($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0, @@ -88,7 +88,7 @@ class TaskApi extends BaseApi { $this->checkProjectPermission($project_id); - if ($owner_id !== 0 && ! $this->projectPermission->isAssignable($project_id, $owner_id)) { + if ($owner_id !== 0 && ! $this->projectPermissionModel->isAssignable($project_id, $owner_id)) { return false; } @@ -119,7 +119,7 @@ class TaskApi extends BaseApi list($valid, ) = $this->taskValidator->validateCreation($values); - return $valid ? $this->taskCreation->create($values) : false; + return $valid ? $this->taskCreationModel->create($values) : false; } public function updateTask($id, $title = null, $color_id = null, $owner_id = null, @@ -129,13 +129,13 @@ class TaskApi extends BaseApi { $this->checkTaskPermission($id); - $project_id = $this->taskFinder->getProjectId($id); + $project_id = $this->taskFinderModel->getProjectId($id); if ($project_id === 0) { return false; } - if ($owner_id !== null && $owner_id != 0 && ! $this->projectPermission->isAssignable($project_id, $owner_id)) { + if ($owner_id !== null && $owner_id != 0 && ! $this->projectPermissionModel->isAssignable($project_id, $owner_id)) { return false; } @@ -164,6 +164,6 @@ class TaskApi extends BaseApi } list($valid) = $this->taskValidator->validateApiModification($values); - return $valid && $this->taskModification->update($values); + return $valid && $this->taskModificationModel->update($values); } } diff --git a/app/Api/TaskLinkApi.php b/app/Api/TaskLinkApi.php index 8c02c524..bb809133 100644 --- a/app/Api/TaskLinkApi.php +++ b/app/Api/TaskLinkApi.php @@ -21,7 +21,7 @@ class TaskLinkApi extends Base */ public function getTaskLinkById($task_link_id) { - return $this->taskLink->getById($task_link_id); + return $this->taskLinkModel->getById($task_link_id); } /** @@ -33,7 +33,7 @@ class TaskLinkApi extends Base */ public function getAllTaskLinks($task_id) { - return $this->taskLink->getAll($task_id); + return $this->taskLinkModel->getAll($task_id); } /** @@ -47,7 +47,7 @@ class TaskLinkApi extends Base */ public function createTaskLink($task_id, $opposite_task_id, $link_id) { - return $this->taskLink->create($task_id, $opposite_task_id, $link_id); + return $this->taskLinkModel->create($task_id, $opposite_task_id, $link_id); } /** @@ -62,7 +62,7 @@ class TaskLinkApi extends Base */ public function updateTaskLink($task_link_id, $task_id, $opposite_task_id, $link_id) { - return $this->taskLink->update($task_link_id, $task_id, $opposite_task_id, $link_id); + return $this->taskLinkModel->update($task_link_id, $task_id, $opposite_task_id, $link_id); } /** @@ -74,6 +74,6 @@ class TaskLinkApi extends Base */ public function removeTaskLink($task_link_id) { - return $this->taskLink->remove($task_link_id); + return $this->taskLinkModel->remove($task_link_id); } } diff --git a/app/Api/UserApi.php b/app/Api/UserApi.php index 9786e6cf..88d75527 100644 --- a/app/Api/UserApi.php +++ b/app/Api/UserApi.php @@ -19,37 +19,37 @@ class UserApi extends Base { public function getUser($user_id) { - return $this->user->getById($user_id); + return $this->userModel->getById($user_id); } public function getUserByName($username) { - return $this->user->getByUsername($username); + return $this->userModel->getByUsername($username); } public function getAllUsers() { - return $this->user->getAll(); + return $this->userModel->getAll(); } public function removeUser($user_id) { - return $this->user->remove($user_id); + return $this->userModel->remove($user_id); } public function disableUser($user_id) { - return $this->user->disable($user_id); + return $this->userModel->disable($user_id); } public function enableUser($user_id) { - return $this->user->enable($user_id); + return $this->userModel->enable($user_id); } public function isActiveUser($user_id) { - return $this->user->isActive($user_id); + return $this->userModel->isActive($user_id); } public function createUser($username, $password, $name = '', $email = '', $role = Role::APP_USER) @@ -64,7 +64,7 @@ class UserApi extends Base ); list($valid, ) = $this->userValidator->validateCreation($values); - return $valid ? $this->user->create($values) : false; + return $valid ? $this->userModel->create($values) : false; } /** @@ -108,7 +108,7 @@ class UserApi extends Base 'is_ldap_user' => 1, ); - return $this->user->create($values); + return $this->userModel->create($values); } catch (LdapException $e) { $this->logger->error($e->getMessage()); @@ -133,6 +133,6 @@ class UserApi extends Base } list($valid, ) = $this->userValidator->validateApiModification($values); - return $valid && $this->user->update($values); + return $valid && $this->userModel->update($values); } } diff --git a/app/Auth/DatabaseAuth.php b/app/Auth/DatabaseAuth.php index c13af687..ecb42c17 100644 --- a/app/Auth/DatabaseAuth.php +++ b/app/Auth/DatabaseAuth.php @@ -5,7 +5,7 @@ namespace Kanboard\Auth; use Kanboard\Core\Base; use Kanboard\Core\Security\PasswordAuthenticationProviderInterface; use Kanboard\Core\Security\SessionCheckProviderInterface; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; use Kanboard\User\DatabaseUserProvider; /** @@ -60,7 +60,7 @@ class DatabaseAuth extends Base implements PasswordAuthenticationProviderInterfa public function authenticate() { $user = $this->db - ->table(User::TABLE) + ->table(UserModel::TABLE) ->columns('id', 'password') ->eq('username', $this->username) ->eq('disable_login_form', 0) @@ -84,7 +84,7 @@ class DatabaseAuth extends Base implements PasswordAuthenticationProviderInterfa */ public function isValidSession() { - return $this->user->isActive($this->userSession->getId()); + return $this->userModel->isActive($this->userSession->getId()); } /** diff --git a/app/Auth/RememberMeAuth.php b/app/Auth/RememberMeAuth.php index 509a511d..5d0a8b2e 100644 --- a/app/Auth/RememberMeAuth.php +++ b/app/Auth/RememberMeAuth.php @@ -44,16 +44,16 @@ class RememberMeAuth extends Base implements PreAuthenticationProviderInterface $credentials = $this->rememberMeCookie->read(); if ($credentials !== false) { - $session = $this->rememberMeSession->find($credentials['token'], $credentials['sequence']); + $session = $this->rememberMeSessionModel->find($credentials['token'], $credentials['sequence']); if (! empty($session)) { $this->rememberMeCookie->write( $session['token'], - $this->rememberMeSession->updateSequence($session['token']), + $this->rememberMeSessionModel->updateSequence($session['token']), $session['expiration'] ); - $this->userInfo = $this->user->getById($session['user_id']); + $this->userInfo = $this->userModel->getById($session['user_id']); return true; } diff --git a/app/Console/BaseCommand.php b/app/Console/BaseCommand.php index ca566266..d6806d93 100644 --- a/app/Console/BaseCommand.php +++ b/app/Console/BaseCommand.php @@ -11,24 +11,24 @@ use Symfony\Component\Console\Command\Command; * @package console * @author Frederic Guillot * - * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator - * @property \Kanboard\Export\SubtaskExport $subtaskExport - * @property \Kanboard\Export\TaskExport $taskExport - * @property \Kanboard\Export\TransitionExport $transitionExport - * @property \Kanboard\Model\Notification $notification - * @property \Kanboard\Model\Project $project - * @property \Kanboard\Model\ProjectPermission $projectPermission - * @property \Kanboard\Model\ProjectDailyColumnStats $projectDailyColumnStats - * @property \Kanboard\Model\ProjectDailyStats $projectDailyStats - * @property \Kanboard\Model\Task $task - * @property \Kanboard\Model\TaskFinder $taskFinder - * @property \Kanboard\Model\User $user - * @property \Kanboard\Model\UserNotification $userNotification - * @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter - * @property \Kanboard\Model\ProjectUserRole $projectUserRole - * @property \Kanboard\Core\Plugin\Loader $pluginLoader - * @property \Kanboard\Core\Http\Client $httpClient - * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher + * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator + * @property \Kanboard\Export\SubtaskExport $subtaskExport + * @property \Kanboard\Export\TaskExport $taskExport + * @property \Kanboard\Export\TransitionExport $transitionExport + * @property \Kanboard\Model\NotificationModel $notificationModel + * @property \Kanboard\Model\ProjectModel $projectModel + * @property \Kanboard\Model\ProjectPermissionModel $projectPermissionModel + * @property \Kanboard\Model\ProjectDailyColumnStatsModel $projectDailyColumnStatsModel + * @property \Kanboard\Model\ProjectDailyStatsModel $projectDailyStatsModel + * @property \Kanboard\Model\TaskModel $taskModel + * @property \Kanboard\Model\TaskFinderModel $taskFinderModel + * @property \Kanboard\Model\UserModel $userModel + * @property \Kanboard\Model\UserNotificationModel $userNotificationModel + * @property \Kanboard\Model\UserNotificationFilterModel $userNotificationFilterModel + * @property \Kanboard\Model\ProjectUserRoleModel $projectUserRoleModel + * @property \Kanboard\Core\Plugin\Loader $pluginLoader + * @property \Kanboard\Core\Http\Client $httpClient + * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher */ abstract class BaseCommand extends Command { diff --git a/app/Console/ProjectDailyColumnStatsExportCommand.php b/app/Console/ProjectDailyColumnStatsExportCommand.php index ced1a374..1e8af727 100644 --- a/app/Console/ProjectDailyColumnStatsExportCommand.php +++ b/app/Console/ProjectDailyColumnStatsExportCommand.php @@ -21,7 +21,7 @@ class ProjectDailyColumnStatsExportCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { - $data = $this->projectDailyColumnStats->getAggregatedMetrics( + $data = $this->projectDailyColumnStatsModel->getAggregatedMetrics( $input->getArgument('project_id'), $input->getArgument('start_date'), $input->getArgument('end_date') diff --git a/app/Console/ProjectDailyStatsCalculationCommand.php b/app/Console/ProjectDailyStatsCalculationCommand.php index 5b898f02..8dde8a79 100644 --- a/app/Console/ProjectDailyStatsCalculationCommand.php +++ b/app/Console/ProjectDailyStatsCalculationCommand.php @@ -2,7 +2,7 @@ namespace Kanboard\Console; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -17,12 +17,12 @@ class ProjectDailyStatsCalculationCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { - $projects = $this->project->getAllByStatus(Project::ACTIVE); + $projects = $this->projectModel->getAllByStatus(ProjectModel::ACTIVE); foreach ($projects as $project) { $output->writeln('Run calculation for '.$project['name']); - $this->projectDailyColumnStats->updateTotals($project['id'], date('Y-m-d')); - $this->projectDailyStats->updateTotals($project['id'], date('Y-m-d')); + $this->projectDailyColumnStatsModel->updateTotals($project['id'], date('Y-m-d')); + $this->projectDailyStatsModel->updateTotals($project['id'], date('Y-m-d')); } } } diff --git a/app/Console/ResetPasswordCommand.php b/app/Console/ResetPasswordCommand.php index 93dc3761..b483f902 100644 --- a/app/Console/ResetPasswordCommand.php +++ b/app/Console/ResetPasswordCommand.php @@ -60,14 +60,14 @@ class ResetPasswordCommand extends BaseCommand private function resetPassword(OutputInterface $output, $username, $password) { - $userId = $this->user->getIdByUsername($username); + $userId = $this->userModel->getIdByUsername($username); if (empty($userId)) { $output->writeln('<error>User not found</error>'); return false; } - if (!$this->user->update(array('id' => $userId, 'password' => $password))) { + if (!$this->userModel->update(array('id' => $userId, 'password' => $password))) { $output->writeln('<error>Unable to update password</error>'); return false; } diff --git a/app/Console/ResetTwoFactorCommand.php b/app/Console/ResetTwoFactorCommand.php index 3bf01e81..a64206b6 100644 --- a/app/Console/ResetTwoFactorCommand.php +++ b/app/Console/ResetTwoFactorCommand.php @@ -19,14 +19,14 @@ class ResetTwoFactorCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { $username = $input->getArgument('username'); - $userId = $this->user->getIdByUsername($username); + $userId = $this->userModel->getIdByUsername($username); if (empty($userId)) { $output->writeln('<error>User not found</error>'); return false; } - if (!$this->user->update(array('id' => $userId, 'twofactor_activated' => 0, 'twofactor_secret' => ''))) { + if (!$this->userModel->update(array('id' => $userId, 'twofactor_activated' => 0, 'twofactor_secret' => ''))) { $output->writeln('<error>Unable to update user profile</error>'); return false; } diff --git a/app/Console/TaskOverdueNotificationCommand.php b/app/Console/TaskOverdueNotificationCommand.php index 7e8484c8..225a6a1a 100644 --- a/app/Console/TaskOverdueNotificationCommand.php +++ b/app/Console/TaskOverdueNotificationCommand.php @@ -2,7 +2,7 @@ namespace Kanboard\Console; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Kanboard\Core\Security\Role; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; @@ -65,10 +65,10 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendGroupOverdueTaskNotifications() { - $tasks = $this->taskFinder->getOverdueTasks(); + $tasks = $this->taskFinderModel->getOverdueTasks(); foreach ($this->groupByColumn($tasks, 'owner_id') as $user_tasks) { - $users = $this->userNotification->getUsersWithNotificationEnabled($user_tasks[0]['project_id']); + $users = $this->userNotificationModel->getUsersWithNotificationEnabled($user_tasks[0]['project_id']); foreach ($users as $user) { $this->sendUserOverdueTaskNotifications($user, $user_tasks); @@ -85,14 +85,14 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendOverdueTaskNotificationsToManagers() { - $tasks = $this->taskFinder->getOverdueTasks(); + $tasks = $this->taskFinderModel->getOverdueTasks(); foreach ($this->groupByColumn($tasks, 'project_id') as $project_id => $project_tasks) { - $users = $this->userNotification->getUsersWithNotificationEnabled($project_id); + $users = $this->userNotificationModel->getUsersWithNotificationEnabled($project_id); $managers = array(); foreach ($users as $user) { - $role = $this->projectUserRole->getUserRole($project_id, $user['id']); + $role = $this->projectUserRoleModel->getUserRole($project_id, $user['id']); if($role == Role::PROJECT_MANAGER) { $managers[] = $user; } @@ -113,10 +113,10 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendOverdueTaskNotifications() { - $tasks = $this->taskFinder->getOverdueTasks(); + $tasks = $this->taskFinderModel->getOverdueTasks(); foreach ($this->groupByColumn($tasks, 'project_id') as $project_id => $project_tasks) { - $users = $this->userNotification->getUsersWithNotificationEnabled($project_id); + $users = $this->userNotificationModel->getUsersWithNotificationEnabled($project_id); foreach ($users as $user) { $this->sendUserOverdueTaskNotifications($user, $project_tasks); @@ -139,16 +139,16 @@ class TaskOverdueNotificationCommand extends BaseCommand $project_names = array(); foreach ($tasks as $task) { - if ($this->userNotificationFilter->shouldReceiveNotification($user, array('task' => $task))) { + if ($this->userNotificationFilterModel->shouldReceiveNotification($user, array('task' => $task))) { $user_tasks[] = $task; $project_names[$task['project_id']] = $task['project_name']; } } if (! empty($user_tasks)) { - $this->userNotification->sendUserNotification( + $this->userNotificationModel->sendUserNotification( $user, - Task::EVENT_OVERDUE, + TaskModel::EVENT_OVERDUE, array('tasks' => $user_tasks, 'project_name' => implode(", ", $project_names)) ); } @@ -163,9 +163,9 @@ class TaskOverdueNotificationCommand extends BaseCommand */ public function sendUserOverdueTaskNotificationsToManagers(array $manager, array $tasks) { - $this->userNotification->sendUserNotification( + $this->userNotificationModel->sendUserNotification( $manager, - Task::EVENT_OVERDUE, + TaskModel::EVENT_OVERDUE, array('tasks' => $tasks, 'project_name' => $tasks[0]['project_name']) ); } diff --git a/app/Console/TaskTriggerCommand.php b/app/Console/TaskTriggerCommand.php index 9e9554f9..a1f4dccf 100644 --- a/app/Console/TaskTriggerCommand.php +++ b/app/Console/TaskTriggerCommand.php @@ -4,7 +4,7 @@ namespace Kanboard\Console; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Kanboard\Event\TaskListEvent; class TaskTriggerCommand extends BaseCommand @@ -19,7 +19,7 @@ class TaskTriggerCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { foreach ($this->getProjectIds() as $project_id) { - $tasks = $this->taskFinder->getAll($project_id); + $tasks = $this->taskFinderModel->getAll($project_id); $nb_tasks = count($tasks); if ($nb_tasks > 0) { @@ -31,7 +31,7 @@ class TaskTriggerCommand extends BaseCommand private function getProjectIds() { - $listeners = $this->dispatcher->getListeners(Task::EVENT_DAILY_CRONJOB); + $listeners = $this->dispatcher->getListeners(TaskModel::EVENT_DAILY_CRONJOB); $project_ids = array(); foreach ($listeners as $listener) { @@ -46,6 +46,6 @@ class TaskTriggerCommand extends BaseCommand $event = new TaskListEvent(array('project_id' => $project_id)); $event->setTasks($tasks); - $this->dispatcher->dispatch(Task::EVENT_DAILY_CRONJOB, $event); + $this->dispatcher->dispatch(TaskModel::EVENT_DAILY_CRONJOB, $event); } } diff --git a/app/Controller/ActionController.php b/app/Controller/ActionController.php index 51090d22..097640f6 100644 --- a/app/Controller/ActionController.php +++ b/app/Controller/ActionController.php @@ -18,7 +18,7 @@ class ActionController extends BaseController public function index() { $project = $this->getProject(); - $actions = $this->action->getAllByProject($project['id']); + $actions = $this->actionModel->getAllByProject($project['id']); $this->response->html($this->helper->layout->project('action/index', array( 'values' => array('project_id' => $project['id']), @@ -27,12 +27,12 @@ class ActionController extends BaseController 'available_actions' => $this->actionManager->getAvailableActions(), 'available_events' => $this->eventManager->getAll(), 'available_params' => $this->actionManager->getAvailableParameters($actions), - 'columns_list' => $this->column->getList($project['id']), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), - 'projects_list' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), - 'links_list' => $this->link->getList(0, false), + 'columns_list' => $this->columnModel->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), + 'projects_list' => $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), + 'links_list' => $this->linkModel->getList(0, false), 'title' => t('Automatic actions') ))); } @@ -47,7 +47,7 @@ class ActionController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( - 'action' => $this->action->getById($this->request->getIntegerParam('action_id')), + 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getAll(), 'available_actions' => $this->actionManager->getAvailableActions(), 'project' => $project, @@ -64,9 +64,9 @@ class ActionController extends BaseController { $this->checkCSRFParam(); $project = $this->getProject(); - $action = $this->action->getById($this->request->getIntegerParam('action_id')); + $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); - if (! empty($action) && $this->action->remove($action['id'])) { + if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Action removed successfully.')); } else { $this->flash->failure(t('Unable to remove this action.')); diff --git a/app/Controller/ActionCreationController.php b/app/Controller/ActionCreationController.php index e055f11b..e984f8d4 100644 --- a/app/Controller/ActionCreationController.php +++ b/app/Controller/ActionCreationController.php @@ -69,19 +69,19 @@ class ActionCreationController extends BaseController $this->doCreation($project, $values + array('params' => array())); } - $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$project['id']]); $this->response->html($this->template->render('action_creation/params', array( 'values' => $values, 'action_params' => $action_params, - 'columns_list' => $this->column->getList($project['id']), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), + 'columns_list' => $this->columnModel->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'projects_list' => $projects_list, - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), - 'links_list' => $this->link->getList(0, false), - 'priorities_list' => $this->project->getPriorities($project), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), + 'links_list' => $this->linkModel->getList(0, false), + 'priorities_list' => $this->projectModel->getPriorities($project), 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), @@ -110,7 +110,7 @@ class ActionCreationController extends BaseController list($valid, ) = $this->actionValidator->validateCreation($values); if ($valid) { - if ($this->action->create($values) !== false) { + if ($this->actionModel->create($values) !== false) { $this->flash->success(t('Your automatic action have been created successfully.')); } else { $this->flash->failure(t('Unable to create your automatic action.')); diff --git a/app/Controller/ActivityController.php b/app/Controller/ActivityController.php index a8fc1b39..9f9841af 100644 --- a/app/Controller/ActivityController.php +++ b/app/Controller/ActivityController.php @@ -38,7 +38,7 @@ class ActivityController extends BaseController $this->response->html($this->helper->layout->task('activity/task', array( 'title' => $task['title'], 'task' => $task, - 'project' => $this->project->getById($task['project_id']), + 'project' => $this->projectModel->getById($task['project_id']), 'events' => $this->helper->projectActivity->getTaskEvents($task['id']), ))); } diff --git a/app/Controller/AnalyticController.php b/app/Controller/AnalyticController.php index 99d34c66..cf3ba034 100644 --- a/app/Controller/AnalyticController.php +++ b/app/Controller/AnalyticController.php @@ -3,7 +3,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Project Analytic Controller @@ -30,8 +30,8 @@ class AnalyticController extends BaseController ), 'project' => $project, 'average' => $this->averageLeadCycleTimeAnalytic->build($project['id']), - 'metrics' => $this->projectDailyStats->getRawMetrics($project['id'], $from, $to), - 'date_format' => $this->config->get('application_date_format'), + 'metrics' => $this->projectDailyStatsModel->getRawMetrics($project['id'], $from, $to), + 'date_format' => $this->configModel->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'title' => t('Lead and Cycle time for "%s"', $project['name']), ))); @@ -145,7 +145,7 @@ class AnalyticController extends BaseController $project = $this->getProject(); list($from, $to) = $this->getDates(); - $display_graph = $this->projectDailyColumnStats->countDays($project['id'], $from, $to) >= 2; + $display_graph = $this->projectDailyColumnStatsModel->countDays($project['id'], $from, $to) >= 2; $this->response->html($this->helper->layout->analytic($template, array( 'values' => array( @@ -153,9 +153,9 @@ class AnalyticController extends BaseController 'to' => $to, ), 'display_graph' => $display_graph, - 'metrics' => $display_graph ? $this->projectDailyColumnStats->getAggregatedMetrics($project['id'], $from, $to, $column) : array(), + 'metrics' => $display_graph ? $this->projectDailyColumnStatsModel->getAggregatedMetrics($project['id'], $from, $to, $column) : array(), 'project' => $project, - 'date_format' => $this->config->get('application_date_format'), + 'date_format' => $this->configModel->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'title' => t($title, $project['name']), ))); diff --git a/app/Controller/AuthController.php b/app/Controller/AuthController.php index 598b3ff8..dc46070c 100644 --- a/app/Controller/AuthController.php +++ b/app/Controller/AuthController.php @@ -23,7 +23,7 @@ class AuthController extends BaseController $this->response->redirect($this->helper->url->to('DashboardController', 'show')); } else { $this->response->html($this->helper->layout->app('auth/index', array( - 'captcha' => ! empty($values['username']) && $this->userLocking->hasCaptcha($values['username']), + 'captcha' => ! empty($values['username']) && $this->userLockingModel->hasCaptcha($values['username']), 'errors' => $errors, 'values' => $values, 'no_layout' => true, diff --git a/app/Controller/AvatarFileController.php b/app/Controller/AvatarFileController.php index 0e2ed1bb..6879c577 100644 --- a/app/Controller/AvatarFileController.php +++ b/app/Controller/AvatarFileController.php @@ -32,7 +32,7 @@ class AvatarFileController extends BaseController { $user = $this->getUser(); - if (! $this->avatarFile->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) { + if (! $this->avatarFileModel->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) { $this->flash->failure(t('Unable to upload the file.')); } @@ -46,7 +46,7 @@ class AvatarFileController extends BaseController { $this->checkCSRFParam(); $user = $this->getUser(); - $this->avatarFile->remove($user['id']); + $this->avatarFileModel->remove($user['id']); $this->userSession->refresh($user['id']); $this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id']))); } @@ -58,7 +58,7 @@ class AvatarFileController extends BaseController { $user_id = $this->request->getIntegerParam('user_id'); $size = $this->request->getStringParam('size', 48); - $filename = $this->avatarFile->getFilename($user_id); + $filename = $this->avatarFileModel->getFilename($user_id); $etag = md5($filename.$size); $this->response->withCache(365 * 86400, $etag); diff --git a/app/Controller/BaseController.php b/app/Controller/BaseController.php index ad02f708..36871bb4 100644 --- a/app/Controller/BaseController.php +++ b/app/Controller/BaseController.php @@ -33,7 +33,7 @@ abstract class BaseController extends Base */ protected function checkWebhookToken() { - if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) { + if ($this->configModel->get('webhook_token') !== $this->request->getStringParam('token')) { $this->response->text('Not Authorized', 401); } } @@ -49,7 +49,7 @@ abstract class BaseController extends Base protected function getTask() { $project_id = $this->request->getIntegerParam('project_id'); - $task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id')); + $task = $this->taskFinderModel->getDetails($this->request->getIntegerParam('task_id')); if (empty($task)) { throw new PageNotFoundException(); @@ -78,7 +78,7 @@ abstract class BaseController extends Base if ($task_id > 0) { $model = 'taskFile'; - $project_id = $this->taskFinder->getProjectId($task_id); + $project_id = $this->taskFinderModel->getProjectId($task_id); if ($project_id !== $this->request->getIntegerParam('project_id')) { throw new AccessForbiddenException(); @@ -106,7 +106,7 @@ abstract class BaseController extends Base protected function getProject($project_id = 0) { $project_id = $this->request->getIntegerParam('project_id', $project_id); - $project = $this->project->getByIdWithOwner($project_id); + $project = $this->projectModel->getByIdWithOwner($project_id); if (empty($project)) { throw new PageNotFoundException(); @@ -125,7 +125,7 @@ abstract class BaseController extends Base */ protected function getUser() { - $user = $this->user->getById($this->request->getIntegerParam('user_id', $this->userSession->getId())); + $user = $this->userModel->getById($this->request->getIntegerParam('user_id', $this->userSession->getId())); if (empty($user)) { throw new PageNotFoundException(); @@ -147,7 +147,7 @@ abstract class BaseController extends Base */ protected function getSubtask() { - $subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id')); + $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); diff --git a/app/Controller/BoardAjaxController.php b/app/Controller/BoardAjaxController.php index d4714699..24914671 100644 --- a/app/Controller/BoardAjaxController.php +++ b/app/Controller/BoardAjaxController.php @@ -28,7 +28,7 @@ class BoardAjaxController extends BaseController $values = $this->request->getJson(); - $result =$this->taskPosition->movePosition( + $result =$this->taskPositionModel->movePosition( $project_id, $values['task_id'], $values['column_id'], @@ -55,7 +55,7 @@ class BoardAjaxController extends BaseController if (! $project_id || ! $this->request->isAjax()) { throw new AccessForbiddenException(); - } elseif (! $this->project->isModifiedSince($project_id, $timestamp)) { + } elseif (! $this->projectModel->isModifiedSince($project_id, $timestamp)) { $this->response->status(304); } else { $this->response->html($this->renderBoard($project_id)); @@ -129,9 +129,9 @@ class BoardAjaxController extends BaseController protected function renderBoard($project_id) { return $this->template->render('board/table_container', array( - 'project' => $this->project->getById($project_id), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'project' => $this->projectModel->getById($project_id), + 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->configModel->get('board_highlight_period'), 'swimlanes' => $this->taskLexer ->build($this->userSession->getFilters($project_id)) ->format(BoardFormatter::getInstance($this->container)->setProjectId($project_id)) diff --git a/app/Controller/BoardPopoverController.php b/app/Controller/BoardPopoverController.php index 2c2e5dc6..a0f5ae12 100644 --- a/app/Controller/BoardPopoverController.php +++ b/app/Controller/BoardPopoverController.php @@ -23,9 +23,9 @@ class BoardPopoverController extends BaseController $this->response->html($this->template->render('board_popover/close_all_tasks_column', array( 'project' => $project, - 'nb_tasks' => $this->taskFinder->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id), - 'column' => $this->column->getColumnTitleById($column_id), - 'swimlane' => $this->swimlane->getNameById($swimlane_id) ?: t($project['default_swimlane']), + 'nb_tasks' => $this->taskFinderModel->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id), + 'column' => $this->columnModel->getColumnTitleById($column_id), + 'swimlane' => $this->swimlaneModel->getNameById($swimlane_id) ?: t($project['default_swimlane']), 'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id), ))); } @@ -40,8 +40,8 @@ class BoardPopoverController extends BaseController $project = $this->getProject(); $values = $this->request->getValues(); - $this->taskStatus->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']); - $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->column->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); + $this->taskStatusModel->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']); + $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->columnModel->getColumnTitleById($values['column_id']), $this->swimlaneModel->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id']))); } } diff --git a/app/Controller/BoardTooltipController.php b/app/Controller/BoardTooltipController.php index 2f1d949e..2a947027 100644 --- a/app/Controller/BoardTooltipController.php +++ b/app/Controller/BoardTooltipController.php @@ -19,7 +19,7 @@ class BoardTooltipController extends BaseController { $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_tasklinks', array( - 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), + 'links' => $this->taskLinkModel->getAllGroupedByLabel($task['id']), 'task' => $task, ))); } @@ -33,7 +33,7 @@ class BoardTooltipController extends BaseController { $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_external_links', array( - 'links' => $this->taskExternalLink->getAll($task['id']), + 'links' => $this->taskExternalLinkModel->getAll($task['id']), 'task' => $task, ))); } @@ -47,7 +47,7 @@ class BoardTooltipController extends BaseController { $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_subtasks', array( - 'subtasks' => $this->subtask->getAll($task['id']), + 'subtasks' => $this->subtaskModel->getAll($task['id']), 'task' => $task, ))); } @@ -62,7 +62,7 @@ class BoardTooltipController extends BaseController $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_files', array( - 'files' => $this->taskFile->getAll($task['id']), + 'files' => $this->taskFileModel->getAll($task['id']), 'task' => $task, ))); } @@ -78,7 +78,7 @@ class BoardTooltipController extends BaseController $this->response->html($this->template->render('board/tooltip_comments', array( 'task' => $task, - 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()) + 'comments' => $this->commentModel->getAll($task['id'], $this->userSession->getCommentSorting()) ))); } @@ -107,9 +107,9 @@ class BoardTooltipController extends BaseController $this->response->html($this->template->render('task_recurrence/info', array( 'task' => $task, - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + 'recurrence_trigger_list' => $this->taskModel->getRecurrenceTriggerList(), + 'recurrence_timeframe_list' => $this->taskModel->getRecurrenceTimeframeList(), + 'recurrence_basedate_list' => $this->taskModel->getRecurrenceBasedateList(), ))); } @@ -121,7 +121,7 @@ class BoardTooltipController extends BaseController public function swimlane() { $this->getProject(); - $swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id')); + $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); $this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane))); } } diff --git a/app/Controller/BoardViewController.php b/app/Controller/BoardViewController.php index 3c96af73..496fa995 100644 --- a/app/Controller/BoardViewController.php +++ b/app/Controller/BoardViewController.php @@ -22,7 +22,7 @@ class BoardViewController extends BaseController public function readonly() { $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); + $project = $this->projectModel->getByToken($token); if (empty($project)) { throw AccessForbiddenException::getInstance()->withoutLayout(); @@ -30,14 +30,14 @@ class BoardViewController extends BaseController $this->response->html($this->helper->layout->app('board/view_public', array( 'project' => $project, - 'swimlanes' => $this->board->getBoard($project['id']), + 'swimlanes' => $this->boardModel->getBoard($project['id']), 'title' => $project['name'], 'description' => $project['description'], 'no_layout' => true, 'not_editable' => true, - 'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'board_public_refresh_interval' => $this->configModel->get('board_public_refresh_interval'), + 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->configModel->get('board_highlight_period'), ))); } @@ -55,8 +55,8 @@ class BoardViewController extends BaseController 'project' => $project, 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->configModel->get('board_highlight_period'), 'swimlanes' => $this->taskLexer ->build($search) ->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id'])) diff --git a/app/Controller/CalendarController.php b/app/Controller/CalendarController.php index c875a18c..e5114f02 100644 --- a/app/Controller/CalendarController.php +++ b/app/Controller/CalendarController.php @@ -5,7 +5,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskAssigneeFilter; use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskStatusFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Calendar Controller @@ -29,7 +29,7 @@ class CalendarController extends BaseController 'project' => $project, 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), - 'check_interval' => $this->config->get('board_private_refresh_interval'), + 'check_interval' => $this->configModel->get('board_private_refresh_interval'), ))); } @@ -75,7 +75,7 @@ class CalendarController extends BaseController $events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end); $events = array_merge($events, $this->helper->calendar->getTaskEvents(clone($queryBuilder), $start, $end)); - if ($this->config->get('calendar_user_subtasks_time_tracking') == 1) { + if ($this->configModel->get('calendar_user_subtasks_time_tracking') == 1) { $events = array_merge($events, $this->helper->calendar->getSubtaskTimeTrackingEvents($user_id, $start, $end)); } @@ -98,7 +98,7 @@ class CalendarController extends BaseController if ($this->request->isAjax() && $this->request->isPost()) { $values = $this->request->getJson(); - $this->taskModification->update(array( + $this->taskModificationModel->update(array( 'id' => $values['task_id'], 'date_due' => substr($values['date_due'], 0, 10), )); diff --git a/app/Controller/CategoryController.php b/app/Controller/CategoryController.php index e7c8db54..fd1b3f94 100644 --- a/app/Controller/CategoryController.php +++ b/app/Controller/CategoryController.php @@ -21,7 +21,7 @@ class CategoryController extends BaseController */ private function getCategory() { - $category = $this->category->getById($this->request->getIntegerParam('category_id')); + $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); @@ -43,7 +43,7 @@ class CategoryController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('category/index', array( - 'categories' => $this->category->getList($project['id'], false), + 'categories' => $this->categoryModel->getList($project['id'], false), 'values' => $values + array('project_id' => $project['id']), 'errors' => $errors, 'project' => $project, @@ -64,7 +64,7 @@ class CategoryController extends BaseController list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { - if ($this->category->create($values)) { + if ($this->categoryModel->create($values)) { $this->flash->success(t('Your category have been created successfully.')); return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); } else { @@ -109,7 +109,7 @@ class CategoryController extends BaseController list($valid, $errors) = $this->categoryValidator->validateModification($values); if ($valid) { - if ($this->category->update($values)) { + if ($this->categoryModel->update($values)) { $this->flash->success(t('Your category have been updated successfully.')); return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); } else { @@ -148,7 +148,7 @@ class CategoryController extends BaseController $project = $this->getProject(); $category = $this->getCategory(); - if ($this->category->remove($category['id'])) { + if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->flash->failure(t('Unable to remove this category.')); diff --git a/app/Controller/ColumnController.php b/app/Controller/ColumnController.php index 5f04f426..8bf3d562 100644 --- a/app/Controller/ColumnController.php +++ b/app/Controller/ColumnController.php @@ -20,7 +20,7 @@ class ColumnController extends BaseController public function index() { $project = $this->getProject(); - $columns = $this->column->getAll($project['id']); + $columns = $this->columnModel->getAll($project['id']); $this->response->html($this->helper->layout->project('column/index', array( 'columns' => $columns, @@ -66,7 +66,7 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateCreation($values); if ($valid) { - if ($this->column->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) { + if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->flash->success(t('Column created successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); } else { @@ -87,7 +87,7 @@ class ColumnController extends BaseController public function edit(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $column = $this->column->getById($this->request->getIntegerParam('column_id')); + $column = $this->columnModel->getById($this->request->getIntegerParam('column_id')); $this->response->html($this->helper->layout->project('column/edit', array( 'errors' => $errors, @@ -111,7 +111,7 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateModification($values); if ($valid) { - if ($this->column->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { + if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->flash->success(t('Board updated successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); } else { @@ -133,7 +133,7 @@ class ColumnController extends BaseController $values = $this->request->getJson(); if (! empty($values) && isset($values['column_id']) && isset($values['position'])) { - $result = $this->column->changePosition($project['id'], $values['column_id'], $values['position']); + $result = $this->columnModel->changePosition($project['id'], $values['column_id'], $values['position']); $this->response->json(array('result' => $result)); } else { throw new AccessForbiddenException(); @@ -150,7 +150,7 @@ class ColumnController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( - 'column' => $this->column->getById($this->request->getIntegerParam('column_id')), + 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, 'title' => t('Remove a column from a board') ))); @@ -167,7 +167,7 @@ class ColumnController extends BaseController $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); - if ($this->column->remove($column_id)) { + if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { $this->flash->failure(t('Unable to remove this column.')); diff --git a/app/Controller/CommentController.php b/app/Controller/CommentController.php index 8d1132ae..696d240f 100644 --- a/app/Controller/CommentController.php +++ b/app/Controller/CommentController.php @@ -23,7 +23,7 @@ class CommentController extends BaseController */ private function getComment() { - $comment = $this->comment->getById($this->request->getIntegerParam('comment_id')); + $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); @@ -76,7 +76,7 @@ class CommentController extends BaseController list($valid, $errors) = $this->commentValidator->validateCreation($values); if ($valid) { - if ($this->comment->create($values)) { + if ($this->commentModel->create($values)) { $this->flash->success(t('Comment added successfully.')); } else { $this->flash->failure(t('Unable to create your comment.')); @@ -125,7 +125,7 @@ class CommentController extends BaseController list($valid, $errors) = $this->commentValidator->validateModification($values); if ($valid) { - if ($this->comment->update($values)) { + if ($this->commentModel->update($values)) { $this->flash->success(t('Comment updated successfully.')); } else { $this->flash->failure(t('Unable to update your comment.')); @@ -165,7 +165,7 @@ class CommentController extends BaseController $task = $this->getTask(); $comment = $this->getComment(); - if ($this->comment->remove($comment['id'])) { + if ($this->commentModel->remove($comment['id'])) { $this->flash->success(t('Comment removed successfully.')); } else { $this->flash->failure(t('Unable to remove this comment.')); diff --git a/app/Controller/ConfigController.php b/app/Controller/ConfigController.php index a5af0246..8bcf4c35 100644 --- a/app/Controller/ConfigController.php +++ b/app/Controller/ConfigController.php @@ -18,7 +18,7 @@ class ConfigController extends BaseController public function index() { $this->response->html($this->helper->layout->config('config/about', array( - 'db_size' => $this->config->getDatabaseSize(), + 'db_size' => $this->configModel->getDatabaseSize(), 'db_version' => $this->db->getDriver()->getDatabaseVersion(), 'user_agent' => $this->request->getServerVariable('HTTP_USER_AGENT'), 'title' => t('Settings').' > '.t('About'), @@ -54,8 +54,8 @@ class ConfigController extends BaseController break; } - if ($this->config->save($values)) { - $this->language->loadCurrentLanguage(); + if ($this->configModel->save($values)) { + $this->languageModel->loadCurrentLanguage(); $this->flash->success(t('Settings saved successfully.')); } else { $this->flash->failure(t('Unable to save your settings.')); @@ -72,8 +72,8 @@ class ConfigController extends BaseController public function application() { $this->response->html($this->helper->layout->config('config/application', array( - 'languages' => $this->language->getLanguages(), - 'timezones' => $this->timezone->getTimezones(), + 'languages' => $this->languageModel->getLanguages(), + 'timezones' => $this->timezoneModel->getTimezones(), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'datetime_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateTimeFormats()), 'time_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getTimeFormats()), @@ -89,8 +89,8 @@ class ConfigController extends BaseController public function project() { $this->response->html($this->helper->layout->config('config/project', array( - 'colors' => $this->color->getList(), - 'default_columns' => implode(', ', $this->board->getDefaultColumns()), + 'colors' => $this->colorModel->getList(), + 'default_columns' => implode(', ', $this->boardModel->getDefaultColumns()), 'title' => t('Settings').' > '.t('Project settings'), ))); } @@ -164,7 +164,7 @@ class ConfigController extends BaseController { $this->checkCSRFParam(); $this->response->withFileDownload('db.sqlite.gz'); - $this->response->binary($this->config->downloadDatabase()); + $this->response->binary($this->configModel->downloadDatabase()); } /** @@ -175,7 +175,7 @@ class ConfigController extends BaseController public function optimizeDb() { $this->checkCSRFParam(); - $this->config->optimizeDatabase(); + $this->configModel->optimizeDatabase(); $this->flash->success(t('Database optimization done.')); $this->response->redirect($this->helper->url->to('ConfigController', 'index')); } @@ -190,7 +190,7 @@ class ConfigController extends BaseController $type = $this->request->getStringParam('type'); $this->checkCSRFParam(); - $this->config->regenerateToken($type.'_token'); + $this->configModel->regenerateToken($type.'_token'); $this->flash->success(t('Token regenerated.')); $this->response->redirect($this->helper->url->to('ConfigController', $type)); diff --git a/app/Controller/CurrencyController.php b/app/Controller/CurrencyController.php index 5a0fac37..ad590035 100644 --- a/app/Controller/CurrencyController.php +++ b/app/Controller/CurrencyController.php @@ -20,11 +20,11 @@ class CurrencyController extends BaseController public function index(array $values = array(), array $errors = array()) { $this->response->html($this->helper->layout->config('currency/index', array( - 'config_values' => array('application_currency' => $this->config->get('application_currency')), + 'config_values' => array('application_currency' => $this->configModel->get('application_currency')), 'values' => $values, 'errors' => $errors, - 'rates' => $this->currency->getAll(), - 'currencies' => $this->currency->getCurrencies(), + 'rates' => $this->currencyModel->getAll(), + 'currencies' => $this->currencyModel->getCurrencies(), 'title' => t('Settings').' > '.t('Currency rates'), ))); } @@ -40,7 +40,7 @@ class CurrencyController extends BaseController list($valid, $errors) = $this->currencyValidator->validateCreation($values); if ($valid) { - if ($this->currency->create($values['currency'], $values['rate'])) { + if ($this->currencyModel->create($values['currency'], $values['rate'])) { $this->flash->success(t('The currency rate have been added successfully.')); return $this->response->redirect($this->helper->url->to('CurrencyController', 'index')); } else { @@ -60,7 +60,7 @@ class CurrencyController extends BaseController { $values = $this->request->getValues(); - if ($this->config->save($values)) { + if ($this->configModel->save($values)) { $this->flash->success(t('Settings saved successfully.')); } else { $this->flash->failure(t('Unable to save your settings.')); diff --git a/app/Controller/CustomFilterController.php b/app/Controller/CustomFilterController.php index 8dd98764..8bba0856 100644 --- a/app/Controller/CustomFilterController.php +++ b/app/Controller/CustomFilterController.php @@ -27,7 +27,7 @@ class CustomFilterController extends BaseController 'values' => $values + array('project_id' => $project['id']), 'errors' => $errors, 'project' => $project, - 'custom_filters' => $this->customFilter->getAll($project['id'], $this->userSession->getId()), + 'custom_filters' => $this->customFilterModel->getAll($project['id'], $this->userSession->getId()), 'title' => t('Custom filters'), ))); } @@ -47,7 +47,7 @@ class CustomFilterController extends BaseController list($valid, $errors) = $this->customFilterValidator->validateCreation($values); if ($valid) { - if ($this->customFilter->create($values)) { + if ($this->customFilterModel->create($values)) { $this->flash->success(t('Your custom filter have been created successfully.')); return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); } else { @@ -66,7 +66,7 @@ class CustomFilterController extends BaseController public function confirm() { $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, @@ -84,11 +84,11 @@ class CustomFilterController extends BaseController { $this->checkCSRFParam(); $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); - if ($this->customFilter->remove($filter['id'])) { + if ($this->customFilterModel->remove($filter['id'])) { $this->flash->success(t('Custom filter removed successfully.')); } else { $this->flash->failure(t('Unable to remove this custom filter.')); @@ -105,7 +105,7 @@ class CustomFilterController extends BaseController public function edit(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); @@ -126,7 +126,7 @@ class CustomFilterController extends BaseController public function update() { $project = $this->getProject(); - $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id')); + $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); @@ -143,7 +143,7 @@ class CustomFilterController extends BaseController list($valid, $errors) = $this->customFilterValidator->validateModification($values); if ($valid) { - if ($this->customFilter->update($values)) { + if ($this->customFilterModel->update($values)) { $this->flash->success(t('Your custom filter have been updated successfully.')); return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); } else { @@ -158,7 +158,7 @@ class CustomFilterController extends BaseController { $user_id = $this->userSession->getId(); - if ($filter['user_id'] != $user_id && ($this->projectUserRole->getUserRole($project['id'], $user_id) === Role::PROJECT_MANAGER || ! $this->userSession->isAdmin())) { + if ($filter['user_id'] != $user_id && ($this->projectUserRoleModel->getUserRole($project['id'], $user_id) === Role::PROJECT_MANAGER || ! $this->userSession->isAdmin())) { throw new AccessForbiddenException(); } } diff --git a/app/Controller/DashboardController.php b/app/Controller/DashboardController.php index 145e0bff..44874546 100644 --- a/app/Controller/DashboardController.php +++ b/app/Controller/DashboardController.php @@ -2,8 +2,8 @@ namespace Kanboard\Controller; -use Kanboard\Model\Project as ProjectModel; -use Kanboard\Model\Subtask as SubtaskModel; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\SubtaskModel; /** * Dashboard Controller @@ -28,7 +28,7 @@ class DashboardController extends BaseController ->setUrl('DashboardController', $action, array('pagination' => 'projects', 'user_id' => $user_id)) ->setMax($max) ->setOrder(ProjectModel::TABLE.'.name') - ->setQuery($this->project->getQueryColumnStats($this->projectPermission->getActiveProjectIds($user_id))) + ->setQuery($this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id))) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'projects'); } @@ -47,7 +47,7 @@ class DashboardController extends BaseController ->setUrl('DashboardController', $action, array('pagination' => 'tasks', 'user_id' => $user_id)) ->setMax($max) ->setOrder('tasks.id') - ->setQuery($this->taskFinder->getUserQuery($user_id)) + ->setQuery($this->taskFinderModel->getUserQuery($user_id)) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks'); } @@ -66,7 +66,7 @@ class DashboardController extends BaseController ->setUrl('DashboardController', $action, array('pagination' => 'subtasks', 'user_id' => $user_id)) ->setMax($max) ->setOrder('tasks.id') - ->setQuery($this->subtask->getUserQuery($user_id, array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))) + ->setQuery($this->subtaskModel->getUserQuery($user_id, array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); } @@ -147,7 +147,7 @@ class DashboardController extends BaseController $this->response->html($this->helper->layout->dashboard('dashboard/activity', array( 'title' => t('My activity stream'), - 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermission->getActiveProjectIds($user['id']), 100), + 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id']), 100), 'user' => $user, ))); } @@ -176,7 +176,7 @@ class DashboardController extends BaseController $this->response->html($this->helper->layout->dashboard('dashboard/notifications', array( 'title' => t('My notifications'), - 'notifications' => $this->userUnreadNotification->getAll($user['id']), + 'notifications' => $this->userUnreadNotificationModel->getAll($user['id']), 'user' => $user, ))); } diff --git a/app/Controller/DocumentationController.php b/app/Controller/DocumentationController.php index 379e3dab..d86fb3c8 100644 --- a/app/Controller/DocumentationController.php +++ b/app/Controller/DocumentationController.php @@ -20,7 +20,7 @@ class DocumentationController extends BaseController $page = 'index'; } - if ($this->language->getCurrentLanguage() === 'fr_FR') { + if ($this->languageModel->getCurrentLanguage() === 'fr_FR') { $filename = __DIR__.'/../../doc/fr/' . $page . '.markdown'; } else { $filename = __DIR__ . '/../../doc/' . $page . '.markdown'; @@ -83,7 +83,7 @@ class DocumentationController extends BaseController */ public function replaceImageUrl(array $matches) { - if ($this->language->getCurrentLanguage() === 'fr_FR') { + if ($this->languageModel->getCurrentLanguage() === 'fr_FR') { return '('.$this->helper->url->base().'doc/fr/'.$matches[1].')'; } diff --git a/app/Controller/ExportController.php b/app/Controller/ExportController.php index 4ed9ee08..b2fe0ebd 100644 --- a/app/Controller/ExportController.php +++ b/app/Controller/ExportController.php @@ -42,7 +42,7 @@ class ExportController extends BaseController 'to' => $to, ), 'errors' => array(), - 'date_format' => $this->config->get('application_date_format'), + 'date_format' => $this->configModel->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'project' => $project, 'title' => $page_title, diff --git a/app/Controller/FeedController.php b/app/Controller/FeedController.php index e453ecb9..cf2b1088 100644 --- a/app/Controller/FeedController.php +++ b/app/Controller/FeedController.php @@ -20,7 +20,7 @@ class FeedController extends BaseController public function user() { $token = $this->request->getStringParam('token'); - $user = $this->user->getByToken($token); + $user = $this->userModel->getByToken($token); // Token verification if (empty($user)) { @@ -28,7 +28,7 @@ class FeedController extends BaseController } $this->response->xml($this->template->render('feed/user', array( - 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermission->getActiveProjectIds($user['id'])), + 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id'])), 'user' => $user, ))); } @@ -41,7 +41,7 @@ class FeedController extends BaseController public function project() { $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); + $project = $this->projectModel->getByToken($token); if (empty($project)) { throw AccessForbiddenException::getInstance()->withoutLayout(); diff --git a/app/Controller/GroupCreationController.php b/app/Controller/GroupCreationController.php index 7d0bb93c..b297b19f 100644 --- a/app/Controller/GroupCreationController.php +++ b/app/Controller/GroupCreationController.php @@ -36,7 +36,7 @@ class GroupCreationController extends BaseController list($valid, $errors) = $this->groupValidator->validateCreation($values); if ($valid) { - if ($this->group->create($values['name']) !== false) { + if ($this->groupModel->create($values['name']) !== false) { $this->flash->success(t('Group created successfully.')); return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true); } else { diff --git a/app/Controller/GroupListController.php b/app/Controller/GroupListController.php index 17f3b2a9..4486bbff 100644 --- a/app/Controller/GroupListController.php +++ b/app/Controller/GroupListController.php @@ -21,7 +21,7 @@ class GroupListController extends BaseController ->setUrl('GroupListController', 'index') ->setMax(30) ->setOrder('name') - ->setQuery($this->group->getQuery()) + ->setQuery($this->groupModel->getQuery()) ->calculate(); $this->response->html($this->helper->layout->app('group/index', array( @@ -38,13 +38,13 @@ class GroupListController extends BaseController public function users() { $group_id = $this->request->getIntegerParam('group_id'); - $group = $this->group->getById($group_id); + $group = $this->groupModel->getById($group_id); $paginator = $this->paginator ->setUrl('GroupListController', 'users', array('group_id' => $group_id)) ->setMax(30) ->setOrder('username') - ->setQuery($this->groupMember->getQuery($group_id)) + ->setQuery($this->groupMemberModel->getQuery($group_id)) ->calculate(); $this->response->html($this->helper->layout->app('group/users', array( @@ -64,14 +64,14 @@ class GroupListController extends BaseController public function associate(array $values = array(), array $errors = array()) { $group_id = $this->request->getIntegerParam('group_id'); - $group = $this->group->getById($group_id); + $group = $this->groupModel->getById($group_id); if (empty($values)) { $values['group_id'] = $group_id; } $this->response->html($this->template->render('group/associate', array( - 'users' => $this->user->prepareList($this->groupMember->getNotMembers($group_id)), + 'users' => $this->userModel->prepareList($this->groupMemberModel->getNotMembers($group_id)), 'group' => $group, 'errors' => $errors, 'values' => $values, @@ -88,7 +88,7 @@ class GroupListController extends BaseController $values = $this->request->getValues(); if (isset($values['group_id']) && isset($values['user_id'])) { - if ($this->groupMember->addUser($values['group_id'], $values['user_id'])) { + if ($this->groupMemberModel->addUser($values['group_id'], $values['user_id'])) { $this->flash->success(t('Group member added successfully.')); return $this->response->redirect($this->helper->url->to('GroupListController', 'users', array('group_id' => $values['group_id'])), true); } else { @@ -108,8 +108,8 @@ class GroupListController extends BaseController { $group_id = $this->request->getIntegerParam('group_id'); $user_id = $this->request->getIntegerParam('user_id'); - $group = $this->group->getById($group_id); - $user = $this->user->getById($user_id); + $group = $this->groupModel->getById($group_id); + $user = $this->userModel->getById($user_id); $this->response->html($this->template->render('group/dissociate', array( 'group' => $group, @@ -128,7 +128,7 @@ class GroupListController extends BaseController $group_id = $this->request->getIntegerParam('group_id'); $user_id = $this->request->getIntegerParam('user_id'); - if ($this->groupMember->removeUser($group_id, $user_id)) { + if ($this->groupMemberModel->removeUser($group_id, $user_id)) { $this->flash->success(t('User removed successfully from this group.')); } else { $this->flash->failure(t('Unable to remove this user from the group.')); @@ -145,7 +145,7 @@ class GroupListController extends BaseController public function confirm() { $group_id = $this->request->getIntegerParam('group_id'); - $group = $this->group->getById($group_id); + $group = $this->groupModel->getById($group_id); $this->response->html($this->template->render('group/remove', array( 'group' => $group, @@ -162,7 +162,7 @@ class GroupListController extends BaseController $this->checkCSRFParam(); $group_id = $this->request->getIntegerParam('group_id'); - if ($this->group->remove($group_id)) { + if ($this->groupModel->remove($group_id)) { $this->flash->success(t('Group removed successfully.')); } else { $this->flash->failure(t('Unable to remove this group.')); diff --git a/app/Controller/GroupModificationController.php b/app/Controller/GroupModificationController.php index 1f225a14..bd181b74 100644 --- a/app/Controller/GroupModificationController.php +++ b/app/Controller/GroupModificationController.php @@ -20,7 +20,7 @@ class GroupModificationController extends BaseController public function show(array $values = array(), array $errors = array()) { if (empty($values)) { - $values = $this->group->getById($this->request->getIntegerParam('group_id')); + $values = $this->groupModel->getById($this->request->getIntegerParam('group_id')); } $this->response->html($this->template->render('group_modification/show', array( @@ -40,7 +40,7 @@ class GroupModificationController extends BaseController list($valid, $errors) = $this->groupValidator->validateModification($values); if ($valid) { - if ($this->group->update($values) !== false) { + if ($this->groupModel->update($values) !== false) { $this->flash->success(t('Group updated successfully.')); return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true); } else { diff --git a/app/Controller/ICalendarController.php b/app/Controller/ICalendarController.php index 78ea4d67..e354c6f1 100644 --- a/app/Controller/ICalendarController.php +++ b/app/Controller/ICalendarController.php @@ -8,7 +8,7 @@ use Kanboard\Filter\TaskAssigneeFilter; use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskStatusFilter; use Kanboard\Formatter\TaskICalFormatter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; use Eluceo\iCal\Component\Calendar as iCalendar; /** @@ -27,7 +27,7 @@ class ICalendarController extends BaseController public function user() { $token = $this->request->getStringParam('token'); - $user = $this->user->getByToken($token); + $user = $this->userModel->getByToken($token); // Token verification if (empty($user)) { @@ -37,7 +37,7 @@ class ICalendarController extends BaseController // Common filter $queryBuilder = new QueryBuilder(); $queryBuilder - ->withQuery($this->taskFinder->getICalQuery()) + ->withQuery($this->taskFinderModel->getICalQuery()) ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) ->withFilter(new TaskAssigneeFilter($user['id'])); @@ -58,7 +58,7 @@ class ICalendarController extends BaseController public function project() { $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); + $project = $this->projectModel->getByToken($token); // Token verification if (empty($project)) { @@ -68,7 +68,7 @@ class ICalendarController extends BaseController // Common filter $queryBuilder = new QueryBuilder(); $queryBuilder - ->withQuery($this->taskFinder->getICalQuery()) + ->withQuery($this->taskFinderModel->getICalQuery()) ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) ->withFilter(new TaskProjectFilter($project['id'])); diff --git a/app/Controller/LinkController.php b/app/Controller/LinkController.php index 08627d40..477b25a4 100644 --- a/app/Controller/LinkController.php +++ b/app/Controller/LinkController.php @@ -22,7 +22,7 @@ class LinkController extends BaseController */ private function getLink() { - $link = $this->link->getById($this->request->getIntegerParam('link_id')); + $link = $this->linkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); @@ -41,7 +41,7 @@ class LinkController extends BaseController public function index(array $values = array(), array $errors = array()) { $this->response->html($this->helper->layout->config('link/index', array( - 'links' => $this->link->getMergedList(), + 'links' => $this->linkModel->getMergedList(), 'values' => $values, 'errors' => $errors, 'title' => t('Settings').' > '.t('Task\'s links'), @@ -59,7 +59,7 @@ class LinkController extends BaseController list($valid, $errors) = $this->linkValidator->validateCreation($values); if ($valid) { - if ($this->link->create($values['label'], $values['opposite_label']) !== false) { + if ($this->linkModel->create($values['label'], $values['opposite_label']) !== false) { $this->flash->success(t('Link added successfully.')); return $this->response->redirect($this->helper->url->to('LinkController', 'index')); } else { @@ -86,7 +86,7 @@ class LinkController extends BaseController $this->response->html($this->helper->layout->config('link/edit', array( 'values' => $values ?: $link, 'errors' => $errors, - 'labels' => $this->link->getList($link['id']), + 'labels' => $this->linkModel->getList($link['id']), 'link' => $link, 'title' => t('Link modification') ))); @@ -103,7 +103,7 @@ class LinkController extends BaseController list($valid, $errors) = $this->linkValidator->validateModification($values); if ($valid) { - if ($this->link->update($values)) { + if ($this->linkModel->update($values)) { $this->flash->success(t('Link updated successfully.')); return $this->response->redirect($this->helper->url->to('LinkController', 'index')); } else { @@ -139,7 +139,7 @@ class LinkController extends BaseController $this->checkCSRFParam(); $link = $this->getLink(); - if ($this->link->remove($link['id'])) { + if ($this->linkModel->remove($link['id'])) { $this->flash->success(t('Link removed successfully.')); } else { $this->flash->failure(t('Unable to remove this link.')); diff --git a/app/Controller/PasswordResetController.php b/app/Controller/PasswordResetController.php index 9036b3e7..18b4be80 100644 --- a/app/Controller/PasswordResetController.php +++ b/app/Controller/PasswordResetController.php @@ -52,7 +52,7 @@ class PasswordResetController extends BaseController $this->checkActivation(); $token = $this->request->getStringParam('token'); - $user_id = $this->passwordReset->getUserIdByToken($token); + $user_id = $this->passwordResetModel->getUserIdByToken($token); if ($user_id !== false) { $this->response->html($this->helper->layout->app('password_reset/change', array( @@ -78,11 +78,11 @@ class PasswordResetController extends BaseController list($valid, $errors) = $this->passwordResetValidator->validateModification($values); if ($valid) { - $user_id = $this->passwordReset->getUserIdByToken($token); + $user_id = $this->passwordResetModel->getUserIdByToken($token); if ($user_id !== false) { - $this->user->update(array('id' => $user_id, 'password' => $values['password'])); - $this->passwordReset->disable($user_id); + $this->userModel->update(array('id' => $user_id, 'password' => $values['password'])); + $this->passwordResetModel->disable($user_id); } return $this->response->redirect($this->helper->url->to('AuthController', 'login')); @@ -96,10 +96,10 @@ class PasswordResetController extends BaseController */ private function sendEmail($username) { - $token = $this->passwordReset->create($username); + $token = $this->passwordResetModel->create($username); if ($token !== false) { - $user = $this->user->getByUsername($username); + $user = $this->userModel->getByUsername($username); $this->emailClient->send( $user['email'], @@ -115,7 +115,7 @@ class PasswordResetController extends BaseController */ private function checkActivation() { - if ($this->config->get('password_reset', 0) == 0) { + if ($this->configModel->get('password_reset', 0) == 0) { throw AccessForbiddenException::getInstance()->withoutLayout(); } } diff --git a/app/Controller/ProjectActionDuplicationController.php b/app/Controller/ProjectActionDuplicationController.php index 790b7ed3..a4993cca 100644 --- a/app/Controller/ProjectActionDuplicationController.php +++ b/app/Controller/ProjectActionDuplicationController.php @@ -13,7 +13,7 @@ class ProjectActionDuplicationController extends BaseController public function show() { $project = $this->getProject(); - $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + $projects = $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); unset($projects[$project['id']]); $this->response->html($this->template->render('project_action_duplication/show', array( @@ -27,7 +27,7 @@ class ProjectActionDuplicationController extends BaseController $project = $this->getProject(); $src_project_id = $this->request->getValue('src_project_id'); - if ($this->action->duplicate($src_project_id, $project['id'])) { + if ($this->actionModel->duplicate($src_project_id, $project['id'])) { $this->flash->success(t('Actions duplicated successfully.')); } else { $this->flash->failure(t('Unable to duplicate actions.')); diff --git a/app/Controller/ProjectCreationController.php b/app/Controller/ProjectCreationController.php index 4166ead1..c471cfdd 100644 --- a/app/Controller/ProjectCreationController.php +++ b/app/Controller/ProjectCreationController.php @@ -20,7 +20,7 @@ class ProjectCreationController extends BaseController public function create(array $values = array(), array $errors = array()) { $is_private = isset($values['is_private']) && $values['is_private'] == 1; - $projects_list = array(0 => t('Do not duplicate anything')) + $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $projects_list = array(0 => t('Do not duplicate anything')) + $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); $this->response->html($this->helper->layout->app('project_creation/create', array( 'values' => $values, @@ -98,7 +98,7 @@ class ProjectCreationController extends BaseController 'is_private' => $values['is_private'], ); - return $this->project->create($project, $this->userSession->getId(), true); + return $this->projectModel->create($project, $this->userSession->getId(), true); } /** @@ -112,13 +112,13 @@ class ProjectCreationController extends BaseController { $selection = array(); - foreach ($this->projectDuplication->getOptionalSelection() as $item) { + foreach ($this->projectDuplicationModel->getOptionalSelection() as $item) { if (isset($values[$item]) && $values[$item] == 1) { $selection[] = $item; } } - return $this->projectDuplication->duplicate( + return $this->projectDuplicationModel->duplicate( $values['src_project_id'], $selection, $this->userSession->getId(), diff --git a/app/Controller/ProjectEditController.php b/app/Controller/ProjectEditController.php index 64e02d1a..228d681c 100644 --- a/app/Controller/ProjectEditController.php +++ b/app/Controller/ProjectEditController.php @@ -73,7 +73,7 @@ class ProjectEditController extends BaseController list($valid, $errors) = $this->projectValidator->validateModification($values); if ($valid) { - if ($this->project->update($values)) { + if ($this->projectModel->update($values)) { $this->flash->success(t('Project updated successfully.')); return $this->response->redirect($this->helper->url->to('ProjectEditController', $redirect, array('project_id' => $project['id'])), true); } else { @@ -123,7 +123,7 @@ class ProjectEditController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project($template, array( - 'owners' => $this->projectUserRole->getAssignableUsersList($project['id'], true), + 'owners' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true), 'values' => empty($values) ? $project : $values, 'errors' => $errors, 'project' => $project, diff --git a/app/Controller/ProjectFileController.php b/app/Controller/ProjectFileController.php index f1bce09d..cbe48679 100644 --- a/app/Controller/ProjectFileController.php +++ b/app/Controller/ProjectFileController.php @@ -34,7 +34,7 @@ class ProjectFileController extends BaseController { $project = $this->getProject(); - if (! $this->projectFile->uploadFiles($project['id'], $this->request->getFileInfo('files'))) { + if (! $this->projectFileModel->uploadFiles($project['id'], $this->request->getFileInfo('files'))) { $this->flash->failure(t('Unable to upload the file.')); } @@ -50,9 +50,9 @@ class ProjectFileController extends BaseController { $this->checkCSRFParam(); $project = $this->getProject(); - $file = $this->projectFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->projectFileModel->getById($this->request->getIntegerParam('file_id')); - if ($this->projectFile->remove($file['id'])) { + if ($this->projectFileModel->remove($file['id'])) { $this->flash->success(t('File removed successfully.')); } else { $this->flash->failure(t('Unable to remove this file.')); @@ -69,7 +69,7 @@ class ProjectFileController extends BaseController public function confirm() { $project = $this->getProject(); - $file = $this->projectFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->projectFileModel->getById($this->request->getIntegerParam('file_id')); $this->response->html($this->template->render('project_file/remove', array( 'project' => $project, diff --git a/app/Controller/ProjectGanttController.php b/app/Controller/ProjectGanttController.php index 1c6ace58..a70d9eee 100644 --- a/app/Controller/ProjectGanttController.php +++ b/app/Controller/ProjectGanttController.php @@ -6,7 +6,7 @@ use Kanboard\Filter\ProjectIdsFilter; use Kanboard\Filter\ProjectStatusFilter; use Kanboard\Filter\ProjectTypeFilter; use Kanboard\Formatter\ProjectGanttFormatter; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Projects Gantt Controller @@ -21,13 +21,13 @@ class ProjectGanttController extends BaseController */ public function show() { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); $filter = $this->projectQuery - ->withFilter(new ProjectTypeFilter(Project::TYPE_TEAM)) - ->withFilter(new ProjectStatusFilter(Project::ACTIVE)) + ->withFilter(new ProjectTypeFilter(ProjectModel::TYPE_TEAM)) + ->withFilter(new ProjectStatusFilter(ProjectModel::ACTIVE)) ->withFilter(new ProjectIdsFilter($project_ids)); - $filter->getQuery()->asc(Project::TABLE.'.start_date'); + $filter->getQuery()->asc(ProjectModel::TABLE.'.start_date'); $this->response->html($this->helper->layout->app('project_gantt/show', array( 'projects' => $filter->format(new ProjectGanttFormatter($this->container)), @@ -42,7 +42,7 @@ class ProjectGanttController extends BaseController { $values = $this->request->getJson(); - $result = $this->project->update(array( + $result = $this->projectModel->update(array( 'id' => $values['id'], 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])), 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])), diff --git a/app/Controller/ProjectListController.php b/app/Controller/ProjectListController.php index 5571b3c9..e1172400 100644 --- a/app/Controller/ProjectListController.php +++ b/app/Controller/ProjectListController.php @@ -18,9 +18,9 @@ class ProjectListController extends BaseController public function show() { if ($this->userSession->isAdmin()) { - $project_ids = $this->project->getAllIds(); + $project_ids = $this->projectModel->getAllIds(); } else { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); } $nb_projects = count($project_ids); @@ -29,7 +29,7 @@ class ProjectListController extends BaseController ->setUrl('ProjectListController', 'show') ->setMax(20) ->setOrder('name') - ->setQuery($this->project->getQueryColumnStats($project_ids)) + ->setQuery($this->projectModel->getQueryColumnStats($project_ids)) ->calculate(); $this->response->html($this->helper->layout->app('project_list/show', array( diff --git a/app/Controller/ProjectOverviewController.php b/app/Controller/ProjectOverviewController.php index 75cf25ba..abdff657 100644 --- a/app/Controller/ProjectOverviewController.php +++ b/app/Controller/ProjectOverviewController.php @@ -16,17 +16,17 @@ class ProjectOverviewController extends BaseController public function show() { $project = $this->getProject(); - $this->project->getColumnStats($project); + $this->projectModel->getColumnStats($project); $this->response->html($this->helper->layout->app('project_overview/show', array( 'project' => $project, 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), - 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), + 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']), 'roles' => $this->role->getProjectRoles(), 'events' => $this->helper->projectActivity->getProjectEvents($project['id'], 10), - 'images' => $this->projectFile->getAllImages($project['id']), - 'files' => $this->projectFile->getAllDocuments($project['id']), + 'images' => $this->projectFileModel->getAllImages($project['id']), + 'files' => $this->projectFileModel->getAllDocuments($project['id']), ))); } } diff --git a/app/Controller/ProjectPermissionController.php b/app/Controller/ProjectPermissionController.php index d27681b1..f3ca6ed9 100644 --- a/app/Controller/ProjectPermissionController.php +++ b/app/Controller/ProjectPermissionController.php @@ -50,8 +50,8 @@ class ProjectPermissionController extends BaseController $this->response->html($this->helper->layout->project('project_permission/index', array( 'project' => $project, - 'users' => $this->projectUserRole->getUsers($project['id']), - 'groups' => $this->projectGroupRole->getGroups($project['id']), + 'users' => $this->projectUserRoleModel->getUsers($project['id']), + 'groups' => $this->projectGroupRoleModel->getGroups($project['id']), 'roles' => $this->role->getProjectRoles(), 'values' => $values, 'errors' => $errors, @@ -69,7 +69,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $values = $this->request->getValues() + array('is_everybody_allowed' => 0); - if ($this->project->update($values)) { + if ($this->projectModel->update($values)) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -90,7 +90,7 @@ class ProjectPermissionController extends BaseController if (empty($values['user_id'])) { $this->flash->failure(t('User not found.')); - } elseif ($this->projectUserRole->addUser($values['project_id'], $values['user_id'], $values['role'])) { + } elseif ($this->projectUserRoleModel->addUser($values['project_id'], $values['user_id'], $values['role'])) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -110,7 +110,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $user_id = $this->request->getIntegerParam('user_id'); - if ($this->projectUserRole->removeUser($project['id'], $user_id)) { + if ($this->projectUserRoleModel->removeUser($project['id'], $user_id)) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -129,7 +129,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $values = $this->request->getJson(); - if (! empty($project) && ! empty($values) && $this->projectUserRole->changeUserRole($project['id'], $values['id'], $values['role'])) { + if (! empty($project) && ! empty($values) && $this->projectUserRoleModel->changeUserRole($project['id'], $values['id'], $values['role'])) { $this->response->json(array('status' => 'ok')); } else { $this->response->json(array('status' => 'error')); @@ -147,10 +147,10 @@ class ProjectPermissionController extends BaseController $values = $this->request->getValues(); if (empty($values['group_id']) && ! empty($values['external_id'])) { - $values['group_id'] = $this->group->create($values['name'], $values['external_id']); + $values['group_id'] = $this->groupModel->create($values['name'], $values['external_id']); } - if ($this->projectGroupRole->addGroup($project['id'], $values['group_id'], $values['role'])) { + if ($this->projectGroupRoleModel->addGroup($project['id'], $values['group_id'], $values['role'])) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -170,7 +170,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $group_id = $this->request->getIntegerParam('group_id'); - if ($this->projectGroupRole->removeGroup($project['id'], $group_id)) { + if ($this->projectGroupRoleModel->removeGroup($project['id'], $group_id)) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -189,7 +189,7 @@ class ProjectPermissionController extends BaseController $project = $this->getProject(); $values = $this->request->getJson(); - if (! empty($project) && ! empty($values) && $this->projectGroupRole->changeGroupRole($project['id'], $values['id'], $values['role'])) { + if (! empty($project) && ! empty($values) && $this->projectGroupRoleModel->changeGroupRole($project['id'], $values['id'], $values['role'])) { $this->response->json(array('status' => 'ok')); } else { $this->response->json(array('status' => 'error')); diff --git a/app/Controller/ProjectStatusController.php b/app/Controller/ProjectStatusController.php index 16ac32b8..78e77870 100644 --- a/app/Controller/ProjectStatusController.php +++ b/app/Controller/ProjectStatusController.php @@ -31,7 +31,7 @@ class ProjectStatusController extends BaseController $project = $this->getProject(); $this->checkCSRFParam(); - if ($this->project->enable($project['id'])) { + if ($this->projectModel->enable($project['id'])) { $this->flash->success(t('Project activated successfully.')); } else { $this->flash->failure(t('Unable to activate this project.')); @@ -61,7 +61,7 @@ class ProjectStatusController extends BaseController $project = $this->getProject(); $this->checkCSRFParam(); - if ($this->project->disable($project['id'])) { + if ($this->projectModel->disable($project['id'])) { $this->flash->success(t('Project disabled successfully.')); } else { $this->flash->failure(t('Unable to disable this project.')); @@ -91,7 +91,7 @@ class ProjectStatusController extends BaseController $project = $this->getProject(); $this->checkCSRFParam(); - if ($this->project->remove($project['id'])) { + if ($this->projectModel->remove($project['id'])) { $this->flash->success(t('Project removed successfully.')); } else { $this->flash->failure(t('Unable to remove this project.')); diff --git a/app/Controller/ProjectUserOverviewController.php b/app/Controller/ProjectUserOverviewController.php index 90887a8a..686de830 100644 --- a/app/Controller/ProjectUserOverviewController.php +++ b/app/Controller/ProjectUserOverviewController.php @@ -2,8 +2,8 @@ namespace Kanboard\Controller; -use Kanboard\Model\User as UserModel; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\UserModel; +use Kanboard\Model\TaskModel; use Kanboard\Core\Security\Role; /** @@ -19,19 +19,19 @@ class ProjectUserOverviewController extends BaseController $user_id = $this->request->getIntegerParam('user_id', UserModel::EVERYBODY_ID); if ($this->userSession->isAdmin()) { - $project_ids = $this->project->getAllIds(); + $project_ids = $this->projectModel->getAllIds(); } else { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); } - return array($user_id, $project_ids, $this->user->getActiveUsersList(true)); + return array($user_id, $project_ids, $this->userModel->getActiveUsersList(true)); } private function role($role, $action, $title, $title_user) { list($user_id, $project_ids, $users) = $this->common(); - $query = $this->projectPermission->getQueryByRole($project_ids, $role)->callback(array($this->project, 'applyColumnStats')); + $query = $this->projectPermissionModel->getQueryByRole($project_ids, $role)->callback(array($this->projectModel, 'applyColumnStats')); if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) { $query->eq(UserModel::TABLE.'.id', $user_id); @@ -57,7 +57,7 @@ class ProjectUserOverviewController extends BaseController { list($user_id, $project_ids, $users) = $this->common(); - $query = $this->taskFinder->getProjectUserOverviewQuery($project_ids, $is_active); + $query = $this->taskFinderModel->getProjectUserOverviewQuery($project_ids, $is_active); if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) { $query->eq(TaskModel::TABLE.'.owner_id', $user_id); @@ -123,7 +123,7 @@ class ProjectUserOverviewController extends BaseController $project = $this->getProject(); return $this->response->html($this->template->render('project_user_overview/tooltip_users', array( - 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), + 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']), 'roles' => $this->role->getProjectRoles(), ))); } diff --git a/app/Controller/ProjectViewController.php b/app/Controller/ProjectViewController.php index ca112a41..92b93804 100644 --- a/app/Controller/ProjectViewController.php +++ b/app/Controller/ProjectViewController.php @@ -21,7 +21,7 @@ class ProjectViewController extends BaseController $this->response->html($this->helper->layout->project('project_view/show', array( 'project' => $project, - 'stats' => $this->project->getTaskStats($project['id']), + 'stats' => $this->projectModel->getTaskStats($project['id']), 'title' => $project['name'], ))); } @@ -53,7 +53,7 @@ class ProjectViewController extends BaseController $this->checkCSRFParam(); $switch = $this->request->getStringParam('switch'); - if ($this->project->{$switch.'PublicAccess'}($project['id'])) { + if ($this->projectModel->{$switch.'PublicAccess'}($project['id'])) { $this->flash->success(t('Project updated successfully.')); } else { $this->flash->failure(t('Unable to update this project.')); @@ -74,8 +74,8 @@ class ProjectViewController extends BaseController $this->response->html($this->helper->layout->project('project_view/integrations', array( 'project' => $project, 'title' => t('Integrations'), - 'webhook_token' => $this->config->get('webhook_token'), - 'values' => $this->projectMetadata->getAll($project['id']), + 'webhook_token' => $this->configModel->get('webhook_token'), + 'values' => $this->projectMetadataModel->getAll($project['id']), 'errors' => array(), ))); } @@ -89,7 +89,7 @@ class ProjectViewController extends BaseController { $project = $this->getProject(); - $this->projectMetadata->save($project['id'], $this->request->getValues()); + $this->projectMetadataModel->save($project['id'], $this->request->getValues()); $this->flash->success(t('Project updated successfully.')); $this->response->redirect($this->helper->url->to('ProjectViewController', 'integrations', array('project_id' => $project['id']))); } @@ -104,8 +104,8 @@ class ProjectViewController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('project_view/notifications', array( - 'notifications' => $this->projectNotification->readSettings($project['id']), - 'types' => $this->projectNotificationType->getTypes(), + 'notifications' => $this->projectNotificationModel->readSettings($project['id']), + 'types' => $this->projectNotificationTypeModel->getTypes(), 'project' => $project, 'title' => t('Notifications'), ))); @@ -121,7 +121,7 @@ class ProjectViewController extends BaseController $project = $this->getProject(); $values = $this->request->getValues(); - $this->projectNotification->saveSettings($project['id'], $values); + $this->projectNotificationModel->saveSettings($project['id'], $values); $this->flash->success(t('Project updated successfully.')); $this->response->redirect($this->helper->url->to('ProjectViewController', 'notifications', array('project_id' => $project['id']))); } @@ -149,7 +149,7 @@ class ProjectViewController extends BaseController public function doDuplication() { $project = $this->getProject(); - $project_id = $this->projectDuplication->duplicate($project['id'], array_keys($this->request->getValues()), $this->userSession->getId()); + $project_id = $this->projectDuplicationModel->duplicate($project['id'], array_keys($this->request->getValues()), $this->userSession->getId()); if ($project_id !== false) { $this->flash->success(t('Project cloned successfully.')); diff --git a/app/Controller/SearchController.php b/app/Controller/SearchController.php index 88718cf7..8557b182 100644 --- a/app/Controller/SearchController.php +++ b/app/Controller/SearchController.php @@ -14,7 +14,7 @@ class SearchController extends BaseController { public function index() { - $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + $projects = $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); $search = urldecode($this->request->getStringParam('search')); $nb_tasks = 0; diff --git a/app/Controller/SubtaskController.php b/app/Controller/SubtaskController.php index 26659fb4..46061122 100644 --- a/app/Controller/SubtaskController.php +++ b/app/Controller/SubtaskController.php @@ -36,7 +36,7 @@ class SubtaskController extends BaseController $this->response->html($this->template->render('subtask/create', array( 'values' => $values, 'errors' => $errors, - 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($task['project_id']), 'task' => $task, ))); } @@ -54,7 +54,7 @@ class SubtaskController extends BaseController list($valid, $errors) = $this->subtaskValidator->validateCreation($values); if ($valid) { - if ($this->subtask->create($values)) { + if ($this->subtaskModel->create($values)) { $this->flash->success(t('Sub-task added successfully.')); } else { $this->flash->failure(t('Unable to create your sub-task.')); @@ -87,8 +87,8 @@ class SubtaskController extends BaseController $this->response->html($this->template->render('subtask/edit', array( 'values' => empty($values) ? $subtask : $values, 'errors' => $errors, - 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), - 'status_list' => $this->subtask->getStatusList(), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($task['project_id']), + 'status_list' => $this->subtaskModel->getStatusList(), 'subtask' => $subtask, 'task' => $task, ))); @@ -108,7 +108,7 @@ class SubtaskController extends BaseController list($valid, $errors) = $this->subtaskValidator->validateModification($values); if ($valid) { - if ($this->subtask->update($values)) { + if ($this->subtaskModel->update($values)) { $this->flash->success(t('Sub-task updated successfully.')); } else { $this->flash->failure(t('Unable to update your sub-task.')); @@ -147,7 +147,7 @@ class SubtaskController extends BaseController $task = $this->getTask(); $subtask = $this->getSubtask(); - if ($this->subtask->remove($subtask['id'])) { + if ($this->subtaskModel->remove($subtask['id'])) { $this->flash->success(t('Sub-task removed successfully.')); } else { $this->flash->failure(t('Unable to remove this sub-task.')); @@ -168,7 +168,7 @@ class SubtaskController extends BaseController $values = $this->request->getJson(); if (! empty($values) && $this->helper->user->hasProjectAccess('SubtaskController', 'movePosition', $project_id)) { - $result = $this->subtask->changePosition($task_id, $values['subtask_id'], $values['position']); + $result = $this->subtaskModel->changePosition($task_id, $values['subtask_id'], $values['position']); $this->response->json(array('result' => $result)); } else { throw new AccessForbiddenException(); diff --git a/app/Controller/SubtaskConverterController.php b/app/Controller/SubtaskConverterController.php index 8a3021e2..65bcd2da 100644 --- a/app/Controller/SubtaskConverterController.php +++ b/app/Controller/SubtaskConverterController.php @@ -26,7 +26,7 @@ class SubtaskConverterController extends BaseController $project = $this->getProject(); $subtask = $this->getSubtask(); - $task_id = $this->subtask->convertToTask($project['id'], $subtask['id']); + $task_id = $this->subtaskModel->convertToTask($project['id'], $subtask['id']); if ($task_id !== false) { $this->flash->success(t('Subtask converted to task successfully.')); diff --git a/app/Controller/SubtaskRestrictionController.php b/app/Controller/SubtaskRestrictionController.php index 77626ba9..084fc0d9 100644 --- a/app/Controller/SubtaskRestrictionController.php +++ b/app/Controller/SubtaskRestrictionController.php @@ -2,7 +2,7 @@ namespace Kanboard\Controller; -use Kanboard\Model\Subtask as SubtaskModel; +use Kanboard\Model\SubtaskModel; /** * Subtask Restriction @@ -27,7 +27,7 @@ class SubtaskRestrictionController extends BaseController SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::STATUS_DONE => t('Done'), ), - 'subtask_inprogress' => $this->subtask->getSubtaskInProgress($this->userSession->getId()), + 'subtask_inprogress' => $this->subtaskModel->getSubtaskInProgress($this->userSession->getId()), 'subtask' => $subtask, 'task' => $task, ))); @@ -45,13 +45,13 @@ class SubtaskRestrictionController extends BaseController $values = $this->request->getValues(); // Change status of the previous "in progress" subtask - $this->subtask->update(array( + $this->subtaskModel->update(array( 'id' => $values['id'], 'status' => $values['status'], )); // Set the current subtask to "in progress" - $this->subtask->update(array( + $this->subtaskModel->update(array( 'id' => $subtask['id'], 'status' => SubtaskModel::STATUS_INPROGRESS, )); diff --git a/app/Controller/SubtaskStatusController.php b/app/Controller/SubtaskStatusController.php index 909123ec..699951fe 100644 --- a/app/Controller/SubtaskStatusController.php +++ b/app/Controller/SubtaskStatusController.php @@ -20,7 +20,7 @@ class SubtaskStatusController extends BaseController $task = $this->getTask(); $subtask = $this->getSubtask(); - $status = $this->subtask->toggleStatus($subtask['id']); + $status = $this->subtaskModel->toggleStatus($subtask['id']); if ($this->request->getIntegerParam('refresh-table') === 0) { $subtask['status'] = $status; @@ -44,10 +44,10 @@ class SubtaskStatusController extends BaseController $timer = $this->request->getStringParam('timer'); if ($timer === 'start') { - $this->subtaskTimeTracking->logStartTime($subtask_id, $this->userSession->getId()); + $this->subtaskTimeTrackingModel->logStartTime($subtask_id, $this->userSession->getId()); } elseif ($timer === 'stop') { - $this->subtaskTimeTracking->logEndTime($subtask_id, $this->userSession->getId()); - $this->subtaskTimeTracking->updateTaskTimeTracking($task['id']); + $this->subtaskTimeTrackingModel->logEndTime($subtask_id, $this->userSession->getId()); + $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); } $this->response->html($this->renderTable($task)); @@ -64,7 +64,7 @@ class SubtaskStatusController extends BaseController { return $this->template->render('subtask/table', array( 'task' => $task, - 'subtasks' => $this->subtask->getAll($task['id']), + 'subtasks' => $this->subtaskModel->getAll($task['id']), 'editable' => true, )); } diff --git a/app/Controller/SwimlaneController.php b/app/Controller/SwimlaneController.php index 13a64d40..4b9567e6 100644 --- a/app/Controller/SwimlaneController.php +++ b/app/Controller/SwimlaneController.php @@ -4,7 +4,7 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\PageNotFoundException; -use Kanboard\Model\Swimlane as SwimlaneModel; +use Kanboard\Model\SwimlaneModel; /** * Swimlanes Controller @@ -23,7 +23,7 @@ class SwimlaneController extends BaseController */ private function getSwimlane() { - $swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id')); + $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); @@ -42,9 +42,9 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->project('swimlane/index', array( - 'default_swimlane' => $this->swimlane->getDefault($project['id']), - 'active_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::ACTIVE), - 'inactive_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::INACTIVE), + 'default_swimlane' => $this->swimlaneModel->getDefault($project['id']), + 'active_swimlanes' => $this->swimlaneModel->getAllByStatus($project['id'], SwimlaneModel::ACTIVE), + 'inactive_swimlanes' => $this->swimlaneModel->getAllByStatus($project['id'], SwimlaneModel::INACTIVE), 'project' => $project, 'title' => t('Swimlanes') ))); @@ -81,7 +81,7 @@ class SwimlaneController extends BaseController list($valid, $errors) = $this->swimlaneValidator->validateCreation($values); if ($valid) { - if ($this->swimlane->create($values)) { + if ($this->swimlaneModel->create($values)) { $this->flash->success(t('Your swimlane have been created successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { @@ -103,7 +103,7 @@ class SwimlaneController extends BaseController public function editDefault(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $swimlane = $this->swimlane->getDefault($project['id']); + $swimlane = $this->swimlaneModel->getDefault($project['id']); $this->response->html($this->helper->layout->project('swimlane/edit_default', array( 'values' => empty($values) ? $swimlane : $values, @@ -125,7 +125,7 @@ class SwimlaneController extends BaseController list($valid, $errors) = $this->swimlaneValidator->validateDefaultModification($values); if ($valid) { - if ($this->swimlane->updateDefault($values)) { + if ($this->swimlaneModel->updateDefault($values)) { $this->flash->success(t('The default swimlane have been updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])), true); } else { @@ -169,7 +169,7 @@ class SwimlaneController extends BaseController list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { - if ($this->swimlane->update($values)) { + if ($this->swimlaneModel->update($values)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { @@ -207,7 +207,7 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); - if ($this->swimlane->remove($project['id'], $swimlane_id)) { + if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully.')); } else { $this->flash->failure(t('Unable to remove this swimlane.')); @@ -227,7 +227,7 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); - if ($this->swimlane->disable($project['id'], $swimlane_id)) { + if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -246,7 +246,7 @@ class SwimlaneController extends BaseController $this->checkCSRFParam(); $project = $this->getProject(); - if ($this->swimlane->disableDefault($project['id'])) { + if ($this->swimlaneModel->disableDefault($project['id'])) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -266,7 +266,7 @@ class SwimlaneController extends BaseController $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); - if ($this->swimlane->enable($project['id'], $swimlane_id)) { + if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -285,7 +285,7 @@ class SwimlaneController extends BaseController $this->checkCSRFParam(); $project = $this->getProject(); - if ($this->swimlane->enableDefault($project['id'])) { + if ($this->swimlaneModel->enableDefault($project['id'])) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); @@ -305,7 +305,7 @@ class SwimlaneController extends BaseController $values = $this->request->getJson(); if (! empty($values) && isset($values['swimlane_id']) && isset($values['position'])) { - $result = $this->swimlane->changePosition($project['id'], $values['swimlane_id'], $values['position']); + $result = $this->swimlaneModel->changePosition($project['id'], $values['swimlane_id'], $values['position']); $this->response->json(array('result' => $result)); } else { throw new AccessForbiddenException(); diff --git a/app/Controller/TaskAjaxController.php b/app/Controller/TaskAjaxController.php index d630b962..f9feff15 100644 --- a/app/Controller/TaskAjaxController.php +++ b/app/Controller/TaskAjaxController.php @@ -24,7 +24,7 @@ class TaskAjaxController extends BaseController public function autocomplete() { $search = $this->request->getStringParam('term'); - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); $exclude_task_id = $this->request->getIntegerParam('exclude_task_id'); if (empty($project_ids)) { diff --git a/app/Controller/TaskBulkController.php b/app/Controller/TaskBulkController.php index 528ae7a3..df7f589b 100644 --- a/app/Controller/TaskBulkController.php +++ b/app/Controller/TaskBulkController.php @@ -32,9 +32,9 @@ class TaskBulkController extends BaseController 'project' => $project, 'values' => $values, 'errors' => $errors, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, true), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), ))); } @@ -74,7 +74,7 @@ class TaskBulkController extends BaseController $title = trim($title); if (! empty($title)) { - $this->taskCreation->create(array( + $this->taskCreationModel->create(array( 'title' => $title, 'column_id' => $values['column_id'], 'swimlane_id' => $values['swimlane_id'], diff --git a/app/Controller/TaskCreationController.php b/app/Controller/TaskCreationController.php index b7af6d87..819de96e 100644 --- a/app/Controller/TaskCreationController.php +++ b/app/Controller/TaskCreationController.php @@ -21,13 +21,13 @@ class TaskCreationController extends BaseController public function show(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $swimlanes_list = $this->swimlane->getList($project['id'], false, true); + $swimlanes_list = $this->swimlaneModel->getList($project['id'], false, true); if (empty($values)) { $values = array( 'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)), 'column_id' => $this->request->getIntegerParam('column_id'), - 'color_id' => $this->color->getDefaultColor(), + 'color_id' => $this->colorModel->getDefaultColor(), 'owner_id' => $this->userSession->getId(), ); @@ -39,10 +39,10 @@ class TaskCreationController extends BaseController 'project' => $project, 'errors' => $errors, 'values' => $values + array('project_id' => $project['id']), - 'columns_list' => $this->column->getList($project['id']), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), + 'columns_list' => $this->columnModel->getList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, true), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), 'swimlanes_list' => $swimlanes_list, 'title' => $project['name'].' > '.t('New task') ))); @@ -60,7 +60,7 @@ class TaskCreationController extends BaseController list($valid, $errors) = $this->taskValidator->validateCreation($values); - if ($valid && $this->taskCreation->create($values)) { + if ($valid && $this->taskCreationModel->create($values)) { $this->flash->success(t('Task created successfully.')); return $this->afterSave($project, $values); } diff --git a/app/Controller/TaskDuplicationController.php b/app/Controller/TaskDuplicationController.php index ab7b6b42..6a475374 100644 --- a/app/Controller/TaskDuplicationController.php +++ b/app/Controller/TaskDuplicationController.php @@ -21,7 +21,7 @@ class TaskDuplicationController extends BaseController if ($this->request->getStringParam('confirmation') === 'yes') { $this->checkCSRFParam(); - $task_id = $this->taskDuplication->duplicate($task['id']); + $task_id = $this->taskDuplicationModel->duplicate($task['id']); if ($task_id > 0) { $this->flash->success(t('Task created successfully.')); @@ -50,7 +50,7 @@ class TaskDuplicationController extends BaseController $values = $this->request->getValues(); list($valid, ) = $this->taskValidator->validateProjectModification($values); - if ($valid && $this->taskDuplication->moveToProject($task['id'], + if ($valid && $this->taskDuplicationModel->moveToProject($task['id'], $values['project_id'], $values['swimlane_id'], $values['column_id'], @@ -80,7 +80,7 @@ class TaskDuplicationController extends BaseController list($valid, ) = $this->taskValidator->validateProjectModification($values); if ($valid) { - $task_id = $this->taskDuplication->duplicateToProject( + $task_id = $this->taskDuplicationModel->duplicateToProject( $task['id'], $values['project_id'], $values['swimlane_id'], $values['column_id'], $values['category_id'], $values['owner_id'] ); @@ -107,19 +107,19 @@ class TaskDuplicationController extends BaseController private function chooseDestination(array $task, $template) { $values = array(); - $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$task['project_id']]); if (! empty($projects_list)) { $dst_project_id = $this->request->getIntegerParam('dst_project_id', key($projects_list)); - $swimlanes_list = $this->swimlane->getList($dst_project_id, false, true); - $columns_list = $this->column->getList($dst_project_id); - $categories_list = $this->category->getList($dst_project_id); - $users_list = $this->projectUserRole->getAssignableUsersList($dst_project_id); + $swimlanes_list = $this->swimlaneModel->getList($dst_project_id, false, true); + $columns_list = $this->columnModel->getList($dst_project_id); + $categories_list = $this->categoryModel->getList($dst_project_id); + $users_list = $this->projectUserRoleModel->getAssignableUsersList($dst_project_id); - $values = $this->taskDuplication->checkDestinationProjectValues($task); + $values = $this->taskDuplicationModel->checkDestinationProjectValues($task); $values['project_id'] = $dst_project_id; } else { $swimlanes_list = array(); diff --git a/app/Controller/TaskExternalLinkController.php b/app/Controller/TaskExternalLinkController.php index 91dc734a..f3c6050d 100644 --- a/app/Controller/TaskExternalLinkController.php +++ b/app/Controller/TaskExternalLinkController.php @@ -76,7 +76,7 @@ class TaskExternalLinkController extends BaseController $values = $this->request->getValues(); list($valid, $errors) = $this->externalLinkValidator->validateCreation($values); - if ($valid && $this->taskExternalLink->create($values)) { + if ($valid && $this->taskExternalLinkModel->create($values)) { $this->flash->success(t('Link added successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -100,7 +100,7 @@ class TaskExternalLinkController extends BaseController $link_id = $this->request->getIntegerParam('link_id'); if ($link_id > 0) { - $values = $this->taskExternalLink->getById($link_id); + $values = $this->taskExternalLinkModel->getById($link_id); } if (empty($values)) { @@ -128,7 +128,7 @@ class TaskExternalLinkController extends BaseController $values = $this->request->getValues(); list($valid, $errors) = $this->externalLinkValidator->validateModification($values); - if ($valid && $this->taskExternalLink->update($values)) { + if ($valid && $this->taskExternalLinkModel->update($values)) { $this->flash->success(t('Link updated successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -145,7 +145,7 @@ class TaskExternalLinkController extends BaseController { $task = $this->getTask(); $link_id = $this->request->getIntegerParam('link_id'); - $link = $this->taskExternalLink->getById($link_id); + $link = $this->taskExternalLinkModel->getById($link_id); if (empty($link)) { throw new PageNotFoundException(); @@ -167,7 +167,7 @@ class TaskExternalLinkController extends BaseController $this->checkCSRFParam(); $task = $this->getTask(); - if ($this->taskExternalLink->remove($this->request->getIntegerParam('link_id'))) { + if ($this->taskExternalLinkModel->remove($this->request->getIntegerParam('link_id'))) { $this->flash->success(t('Link removed successfully.')); } else { $this->flash->failure(t('Unable to remove this link.')); diff --git a/app/Controller/TaskFileController.php b/app/Controller/TaskFileController.php index 44c19c27..77c0c026 100644 --- a/app/Controller/TaskFileController.php +++ b/app/Controller/TaskFileController.php @@ -19,7 +19,7 @@ class TaskFileController extends BaseController { $task = $this->getTask(); - if ($this->request->isPost() && $this->taskFile->uploadScreenshot($task['id'], $this->request->getValue('screenshot')) !== false) { + if ($this->request->isPost() && $this->taskFileModel->uploadScreenshot($task['id'], $this->request->getValue('screenshot')) !== false) { $this->flash->success(t('Screenshot uploaded successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -53,7 +53,7 @@ class TaskFileController extends BaseController { $task = $this->getTask(); - if (! $this->taskFile->uploadFiles($task['id'], $this->request->getFileInfo('files'))) { + if (! $this->taskFileModel->uploadFiles($task['id'], $this->request->getFileInfo('files'))) { $this->flash->failure(t('Unable to upload the file.')); } @@ -69,9 +69,9 @@ class TaskFileController extends BaseController { $this->checkCSRFParam(); $task = $this->getTask(); - $file = $this->taskFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->taskFileModel->getById($this->request->getIntegerParam('file_id')); - if ($file['task_id'] == $task['id'] && $this->taskFile->remove($file['id'])) { + if ($file['task_id'] == $task['id'] && $this->taskFileModel->remove($file['id'])) { $this->flash->success(t('File removed successfully.')); } else { $this->flash->failure(t('Unable to remove this file.')); @@ -88,7 +88,7 @@ class TaskFileController extends BaseController public function confirm() { $task = $this->getTask(); - $file = $this->taskFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->taskFileModel->getById($this->request->getIntegerParam('file_id')); $this->response->html($this->template->render('task_file/remove', array( 'task' => $task, diff --git a/app/Controller/TaskGanttController.php b/app/Controller/TaskGanttController.php index 3d0c5f50..868368e1 100644 --- a/app/Controller/TaskGanttController.php +++ b/app/Controller/TaskGanttController.php @@ -4,7 +4,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; use Kanboard\Formatter\TaskGanttFormatter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Tasks Gantt Controller @@ -47,7 +47,7 @@ class TaskGanttController extends BaseController $this->getProject(); $values = $this->request->getJson(); - $result = $this->taskModification->update(array( + $result = $this->taskModificationModel->update(array( 'id' => $values['id'], 'date_started' => strtotime($values['start']), 'date_due' => strtotime($values['end']), diff --git a/app/Controller/TaskGanttCreationController.php b/app/Controller/TaskGanttCreationController.php index 0ae4ab3b..c2998a3e 100644 --- a/app/Controller/TaskGanttCreationController.php +++ b/app/Controller/TaskGanttCreationController.php @@ -24,7 +24,7 @@ class TaskGanttCreationController extends BaseController $values = $values + array( 'project_id' => $project['id'], - 'column_id' => $this->column->getFirstColumnId($project['id']), + 'column_id' => $this->columnModel->getFirstColumnId($project['id']), 'position' => 1 ); @@ -35,10 +35,10 @@ class TaskGanttCreationController extends BaseController 'project' => $project, 'errors' => $errors, 'values' => $values, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), - 'swimlanes_list' => $this->swimlane->getList($project['id'], false, true), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, true), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($project['id']), + 'swimlanes_list' => $this->swimlaneModel->getList($project['id'], false, true), 'title' => $project['name'].' > '.t('New task') ))); } @@ -56,7 +56,7 @@ class TaskGanttCreationController extends BaseController list($valid, $errors) = $this->taskValidator->validateCreation($values); if ($valid) { - $task_id = $this->taskCreation->create($values); + $task_id = $this->taskCreationModel->create($values); if ($task_id !== false) { $this->flash->success(t('Task created successfully.')); diff --git a/app/Controller/TaskInternalLinkController.php b/app/Controller/TaskInternalLinkController.php index 4018c3a5..a140f1ff 100644 --- a/app/Controller/TaskInternalLinkController.php +++ b/app/Controller/TaskInternalLinkController.php @@ -22,7 +22,7 @@ class TaskInternalLinkController extends BaseController */ private function getTaskLink() { - $link = $this->taskLink->getById($this->request->getIntegerParam('link_id')); + $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); @@ -48,7 +48,7 @@ class TaskInternalLinkController extends BaseController 'values' => $values, 'errors' => $errors, 'task' => $task, - 'labels' => $this->link->getList(0, false), + 'labels' => $this->linkModel->getList(0, false), ))); } @@ -65,7 +65,7 @@ class TaskInternalLinkController extends BaseController list($valid, $errors) = $this->taskLinkValidator->validateCreation($values); if ($valid) { - if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { + if ($this->taskLinkModel->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { $this->flash->success(t('Link added successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } @@ -92,7 +92,7 @@ class TaskInternalLinkController extends BaseController $task_link = $this->getTaskLink(); if (empty($values)) { - $opposite_task = $this->taskFinder->getById($task_link['opposite_task_id']); + $opposite_task = $this->taskFinderModel->getById($task_link['opposite_task_id']); $values = $task_link; $values['title'] = '#'.$opposite_task['id'].' - '.$opposite_task['title']; } @@ -102,7 +102,7 @@ class TaskInternalLinkController extends BaseController 'errors' => $errors, 'task_link' => $task_link, 'task' => $task, - 'labels' => $this->link->getList(0, false) + 'labels' => $this->linkModel->getList(0, false) ))); } @@ -119,7 +119,7 @@ class TaskInternalLinkController extends BaseController list($valid, $errors) = $this->taskLinkValidator->validateModification($values); if ($valid) { - if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) { + if ($this->taskLinkModel->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) { $this->flash->success(t('Link updated successfully.')); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); } @@ -156,7 +156,7 @@ class TaskInternalLinkController extends BaseController $this->checkCSRFParam(); $task = $this->getTask(); - if ($this->taskLink->remove($this->request->getIntegerParam('link_id'))) { + if ($this->taskLinkModel->remove($this->request->getIntegerParam('link_id'))) { $this->flash->success(t('Link removed successfully.')); } else { $this->flash->failure(t('Unable to remove this link.')); diff --git a/app/Controller/TaskListController.php b/app/Controller/TaskListController.php index 898c14c8..c6d1fa92 100644 --- a/app/Controller/TaskListController.php +++ b/app/Controller/TaskListController.php @@ -3,7 +3,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** * Task List Controller diff --git a/app/Controller/TaskModificationController.php b/app/Controller/TaskModificationController.php index 09a8fabe..fc9113dd 100644 --- a/app/Controller/TaskModificationController.php +++ b/app/Controller/TaskModificationController.php @@ -20,7 +20,7 @@ class TaskModificationController extends BaseController public function start() { $task = $this->getTask(); - $this->taskModification->update(array('id' => $task['id'], 'date_started' => time())); + $this->taskModificationModel->update(array('id' => $task['id'], 'date_started' => time())); $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); } @@ -61,7 +61,7 @@ class TaskModificationController extends BaseController list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values); if ($valid) { - if ($this->taskModification->update($values)) { + if ($this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); @@ -85,7 +85,7 @@ class TaskModificationController extends BaseController public function edit(array $values = array(), array $errors = array()) { $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); + $project = $this->projectModel->getById($task['project_id']); if (empty($values)) { $values = $task; @@ -93,17 +93,17 @@ class TaskModificationController extends BaseController $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); } - $values = $this->dateParser->format($values, array('date_due'), $this->config->get('application_date_format', DateParser::DATE_FORMAT)); - $values = $this->dateParser->format($values, array('date_started'), $this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); + $values = $this->dateParser->format($values, array('date_due'), $this->configModel->get('application_date_format', DateParser::DATE_FORMAT)); + $values = $this->dateParser->format($values, array('date_started'), $this->configModel->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); $this->response->html($this->template->render('task_modification/edit_task', array( 'project' => $project, 'values' => $values, 'errors' => $errors, 'task' => $task, - 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($task['project_id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($task['project_id']), + 'colors_list' => $this->colorModel->getList(), + 'categories_list' => $this->categoryModel->getList($task['project_id']), ))); } @@ -119,7 +119,7 @@ class TaskModificationController extends BaseController list($valid, $errors) = $this->taskValidator->validateModification($values); - if ($valid && $this->taskModification->update($values)) { + if ($valid && $this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } else { diff --git a/app/Controller/TaskPopoverController.php b/app/Controller/TaskPopoverController.php index 9916a5d1..bf4e23d5 100644 --- a/app/Controller/TaskPopoverController.php +++ b/app/Controller/TaskPopoverController.php @@ -18,11 +18,11 @@ class TaskPopoverController extends BaseController public function changeAssignee() { $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); + $project = $this->projectModel->getById($task['project_id']); $this->response->html($this->template->render('task_popover/change_assignee', array( 'values' => $task, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'project' => $project, ))); } @@ -38,7 +38,7 @@ class TaskPopoverController extends BaseController list($valid,) = $this->taskValidator->validateAssigneeModification($values); - if ($valid && $this->taskModification->update($values)) { + if ($valid && $this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); @@ -55,11 +55,11 @@ class TaskPopoverController extends BaseController public function changeCategory() { $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); + $project = $this->projectModel->getById($task['project_id']); $this->response->html($this->template->render('task_popover/change_category', array( 'values' => $task, - 'categories_list' => $this->category->getList($project['id']), + 'categories_list' => $this->categoryModel->getList($project['id']), 'project' => $project, ))); } @@ -75,7 +75,7 @@ class TaskPopoverController extends BaseController list($valid,) = $this->taskValidator->validateCategoryModification($values); - if ($valid && $this->taskModification->update($values)) { + if ($valid && $this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); diff --git a/app/Controller/TaskRecurrenceController.php b/app/Controller/TaskRecurrenceController.php index cd9a2c92..dc7a0e1b 100644 --- a/app/Controller/TaskRecurrenceController.php +++ b/app/Controller/TaskRecurrenceController.php @@ -31,10 +31,10 @@ class TaskRecurrenceController extends BaseController 'values' => $values, 'errors' => $errors, 'task' => $task, - 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + 'recurrence_status_list' => $this->taskModel->getRecurrenceStatusList(), + 'recurrence_trigger_list' => $this->taskModel->getRecurrenceTriggerList(), + 'recurrence_timeframe_list' => $this->taskModel->getRecurrenceTimeframeList(), + 'recurrence_basedate_list' => $this->taskModel->getRecurrenceBasedateList(), ))); } @@ -51,7 +51,7 @@ class TaskRecurrenceController extends BaseController list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); if ($valid) { - if ($this->taskModification->update($values)) { + if ($this->taskModificationModel->update($values)) { $this->flash->success(t('Task updated successfully.')); } else { $this->flash->failure(t('Unable to update your task.')); diff --git a/app/Controller/TaskStatusController.php b/app/Controller/TaskStatusController.php index 98ab4e1e..82b4f9c4 100644 --- a/app/Controller/TaskStatusController.php +++ b/app/Controller/TaskStatusController.php @@ -46,7 +46,7 @@ class TaskStatusController extends BaseController if ($this->request->getStringParam('confirmation') === 'yes') { $this->checkCSRFParam(); - if ($this->taskStatus->$method($task['id'])) { + if ($this->taskStatusModel->$method($task['id'])) { $this->flash->success($success_message); } else { $this->flash->failure($failure_message); diff --git a/app/Controller/TaskSuppressionController.php b/app/Controller/TaskSuppressionController.php index 7c9165eb..600107c9 100644 --- a/app/Controller/TaskSuppressionController.php +++ b/app/Controller/TaskSuppressionController.php @@ -41,7 +41,7 @@ class TaskSuppressionController extends BaseController throw new AccessForbiddenException(); } - if ($this->task->remove($task['id'])) { + if ($this->taskModel->remove($task['id'])) { $this->flash->success(t('Task removed successfully.')); } else { $this->flash->failure(t('Unable to remove this task.')); diff --git a/app/Controller/TaskViewController.php b/app/Controller/TaskViewController.php index b16c15de..2a79ee45 100644 --- a/app/Controller/TaskViewController.php +++ b/app/Controller/TaskViewController.php @@ -21,14 +21,14 @@ class TaskViewController extends BaseController */ public function readonly() { - $project = $this->project->getByToken($this->request->getStringParam('token')); + $project = $this->projectModel->getByToken($this->request->getStringParam('token')); // Token verification if (empty($project)) { throw AccessForbiddenException::getInstance()->withoutLayout(); } - $task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id')); + $task = $this->taskFinderModel->getDetails($this->request->getIntegerParam('task_id')); if (empty($task)) { throw PageNotFoundException::getInstance()->withoutLayout(); @@ -40,12 +40,12 @@ class TaskViewController extends BaseController $this->response->html($this->helper->layout->app('task/public', array( 'project' => $project, - 'comments' => $this->comment->getAll($task['id']), - 'subtasks' => $this->subtask->getAll($task['id']), - 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), + 'comments' => $this->commentModel->getAll($task['id']), + 'subtasks' => $this->subtaskModel->getAll($task['id']), + 'links' => $this->taskLinkModel->getAllGroupedByLabel($task['id']), 'task' => $task, - 'columns_list' => $this->column->getList($task['project_id']), - 'colors_list' => $this->color->getList(), + 'columns_list' => $this->columnModel->getList($task['project_id']), + 'colors_list' => $this->colorModel->getList(), 'title' => $task['title'], 'no_layout' => true, 'auto_refresh' => true, @@ -61,7 +61,7 @@ class TaskViewController extends BaseController public function show() { $task = $this->getTask(); - $subtasks = $this->subtask->getAll($task['id']); + $subtasks = $this->subtaskModel->getAll($task['id']); $values = array( 'id' => $task['id'], @@ -70,19 +70,19 @@ class TaskViewController extends BaseController 'time_spent' => $task['time_spent'] ?: '', ); - $values = $this->dateParser->format($values, array('date_started'), $this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); + $values = $this->dateParser->format($values, array('date_started'), $this->configModel->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); $this->response->html($this->helper->layout->task('task/show', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), + 'project' => $this->projectModel->getById($task['project_id']), 'values' => $values, - 'files' => $this->taskFile->getAllDocuments($task['id']), - 'images' => $this->taskFile->getAllImages($task['id']), - 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()), + 'files' => $this->taskFileModel->getAllDocuments($task['id']), + 'images' => $this->taskFileModel->getAllImages($task['id']), + 'comments' => $this->commentModel->getAll($task['id'], $this->userSession->getCommentSorting()), 'subtasks' => $subtasks, - 'internal_links' => $this->taskLink->getAllGroupedByLabel($task['id']), - 'external_links' => $this->taskExternalLink->getAll($task['id']), - 'link_label_list' => $this->link->getList(0, false), + 'internal_links' => $this->taskLinkModel->getAllGroupedByLabel($task['id']), + 'external_links' => $this->taskExternalLinkModel->getAll($task['id']), + 'link_label_list' => $this->linkModel->getList(0, false), ))); } @@ -97,10 +97,10 @@ class TaskViewController extends BaseController $this->response->html($this->helper->layout->task('task/analytics', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), - 'lead_time' => $this->taskAnalytic->getLeadTime($task), - 'cycle_time' => $this->taskAnalytic->getCycleTime($task), - 'time_spent_columns' => $this->taskAnalytic->getTimeSpentByColumn($task), + 'project' => $this->projectModel->getById($task['project_id']), + 'lead_time' => $this->taskAnalyticModel->getLeadTime($task), + 'cycle_time' => $this->taskAnalyticModel->getCycleTime($task), + 'time_spent_columns' => $this->taskAnalyticModel->getTimeSpentByColumn($task), ))); } @@ -118,12 +118,12 @@ class TaskViewController extends BaseController ->setMax(15) ->setOrder('start') ->setDirection('DESC') - ->setQuery($this->subtaskTimeTracking->getTaskQuery($task['id'])) + ->setQuery($this->subtaskTimeTrackingModel->getTaskQuery($task['id'])) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); $this->response->html($this->helper->layout->task('task/time_tracking_details', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), + 'project' => $this->projectModel->getById($task['project_id']), 'subtask_paginator' => $subtask_paginator, ))); } @@ -139,8 +139,8 @@ class TaskViewController extends BaseController $this->response->html($this->helper->layout->task('task/transitions', array( 'task' => $task, - 'project' => $this->project->getById($task['project_id']), - 'transitions' => $this->transition->getAllByTask($task['id']), + 'project' => $this->projectModel->getById($task['project_id']), + 'transitions' => $this->transitionModel->getAllByTask($task['id']), ))); } } diff --git a/app/Controller/TwoFactorController.php b/app/Controller/TwoFactorController.php index c8540f85..d02c8950 100644 --- a/app/Controller/TwoFactorController.php +++ b/app/Controller/TwoFactorController.php @@ -91,7 +91,7 @@ class TwoFactorController extends UserViewController if ($provider->authenticate()) { $this->flash->success(t('The two factor authentication code is valid.')); - $this->user->update(array( + $this->userModel->update(array( 'id' => $user['id'], 'twofactor_activated' => 1, 'twofactor_secret' => $this->authenticationManager->getPostAuthenticationProvider()->getSecret(), @@ -117,7 +117,7 @@ class TwoFactorController extends UserViewController $user = $this->getUser(); $this->checkCurrentUser($user); - $this->user->update(array( + $this->userModel->update(array( 'id' => $user['id'], 'twofactor_activated' => 0, 'twofactor_secret' => '', @@ -186,7 +186,7 @@ class TwoFactorController extends UserViewController if ($this->request->getStringParam('disable') === 'yes') { $this->checkCSRFParam(); - $this->user->update(array( + $this->userModel->update(array( 'id' => $user['id'], 'twofactor_activated' => 0, 'twofactor_secret' => '', diff --git a/app/Controller/UserAjaxController.php b/app/Controller/UserAjaxController.php index 7b365667..ed180471 100644 --- a/app/Controller/UserAjaxController.php +++ b/app/Controller/UserAjaxController.php @@ -4,7 +4,7 @@ namespace Kanboard\Controller; use Kanboard\Filter\UserNameFilter; use Kanboard\Formatter\UserAutoCompleteFormatter; -use Kanboard\Model\User as UserModel; +use Kanboard\Model\UserModel; /** * User Ajax Controller @@ -36,7 +36,7 @@ class UserAjaxController extends BaseController { $project_id = $this->request->getStringParam('project_id'); $query = $this->request->getStringParam('q'); - $users = $this->projectPermission->findUsernames($project_id, $query); + $users = $this->projectPermissionModel->findUsernames($project_id, $query); $this->response->json($users); } diff --git a/app/Controller/UserCreationController.php b/app/Controller/UserCreationController.php index 4ae170e0..9c873f85 100644 --- a/app/Controller/UserCreationController.php +++ b/app/Controller/UserCreationController.php @@ -26,10 +26,10 @@ class UserCreationController extends BaseController $template = $isRemote ? 'user_creation/remote' : 'user_creation/local'; $this->response->html($this->template->render($template, array( - 'timezones' => $this->timezone->getTimezones(true), - 'languages' => $this->language->getLanguages(true), + 'timezones' => $this->timezoneModel->getTimezones(true), + 'languages' => $this->languageModel->getLanguages(true), 'roles' => $this->role->getApplicationRoles(), - 'projects' => $this->project->getList(), + 'projects' => $this->projectModel->getList(), 'errors' => $errors, 'values' => $values + array('role' => Role::APP_USER), ))); @@ -62,15 +62,15 @@ class UserCreationController extends BaseController $project_id = empty($values['project_id']) ? 0 : $values['project_id']; unset($values['project_id']); - $user_id = $this->user->create($values); + $user_id = $this->userModel->create($values); if ($user_id !== false) { if ($project_id !== 0) { - $this->projectUserRole->addUser($project_id, $user_id, Role::PROJECT_MEMBER); + $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MEMBER); } if (! empty($values['notifications_enabled'])) { - $this->userNotificationType->saveSelectedTypes($user_id, array(MailNotification::TYPE)); + $this->userNotificationTypeModel->saveSelectedTypes($user_id, array(MailNotification::TYPE)); } $this->flash->success(t('User created successfully.')); diff --git a/app/Controller/UserCredentialController.php b/app/Controller/UserCredentialController.php index 3310aaa8..4021dc37 100644 --- a/app/Controller/UserCredentialController.php +++ b/app/Controller/UserCredentialController.php @@ -44,9 +44,9 @@ class UserCredentialController extends BaseController list($valid, $errors) = $this->userValidator->validatePasswordModification($values); if ($valid) { - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $this->flash->success(t('Password modified successfully.')); - $this->userLocking->resetFailedLogin($user['username']); + $this->userLockingModel->resetFailedLogin($user['username']); } else { $this->flash->failure(t('Unable to change the password.')); } @@ -95,7 +95,7 @@ class UserCredentialController extends BaseController list($valid, $errors) = $this->userValidator->validateModification($values); if ($valid) { - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $this->flash->success(t('User updated successfully.')); } else { $this->flash->failure(t('Unable to update your user.')); diff --git a/app/Controller/UserListController.php b/app/Controller/UserListController.php index 685746fb..31fcdd44 100644 --- a/app/Controller/UserListController.php +++ b/app/Controller/UserListController.php @@ -21,7 +21,7 @@ class UserListController extends BaseController ->setUrl('UserListController', 'show') ->setMax(30) ->setOrder('username') - ->setQuery($this->user->getQuery()) + ->setQuery($this->userModel->getQuery()) ->calculate(); $this->response->html($this->helper->layout->app('user_list/show', array( diff --git a/app/Controller/UserModificationController.php b/app/Controller/UserModificationController.php index 0a50eb5b..d339fd9a 100644 --- a/app/Controller/UserModificationController.php +++ b/app/Controller/UserModificationController.php @@ -32,8 +32,8 @@ class UserModificationController extends BaseController 'values' => $values, 'errors' => $errors, 'user' => $user, - 'timezones' => $this->timezone->getTimezones(true), - 'languages' => $this->language->getLanguages(true), + 'timezones' => $this->timezoneModel->getTimezones(true), + 'languages' => $this->languageModel->getLanguages(true), 'roles' => $this->role->getApplicationRoles(), ))); } @@ -55,7 +55,7 @@ class UserModificationController extends BaseController list($valid, $errors) = $this->userValidator->validateModification($values); if ($valid) { - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $this->flash->success(t('User updated successfully.')); } else { $this->flash->failure(t('Unable to update your user.')); diff --git a/app/Controller/UserStatusController.php b/app/Controller/UserStatusController.php index bc40a7dd..070fb6fc 100644 --- a/app/Controller/UserStatusController.php +++ b/app/Controller/UserStatusController.php @@ -34,7 +34,7 @@ class UserStatusController extends BaseController $user = $this->getUser(); $this->checkCSRFParam(); - if ($this->user->remove($user['id'])) { + if ($this->userModel->remove($user['id'])) { $this->flash->success(t('User removed successfully.')); } else { $this->flash->failure(t('Unable to remove this user.')); @@ -67,7 +67,7 @@ class UserStatusController extends BaseController $user = $this->getUser(); $this->checkCSRFParam(); - if ($this->user->enable($user['id'])) { + if ($this->userModel->enable($user['id'])) { $this->flash->success(t('User activated successfully.')); } else { $this->flash->failure(t('Unable to enable this user.')); @@ -100,7 +100,7 @@ class UserStatusController extends BaseController $user = $this->getUser(); $this->checkCSRFParam(); - if ($this->user->disable($user['id'])) { + if ($this->userModel->disable($user['id'])) { $this->flash->success(t('User disabled successfully.')); } else { $this->flash->failure(t('Unable to disable this user.')); diff --git a/app/Controller/UserViewController.php b/app/Controller/UserViewController.php index b299e35b..a73c5c51 100644 --- a/app/Controller/UserViewController.php +++ b/app/Controller/UserViewController.php @@ -3,7 +3,7 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\PageNotFoundException; -use Kanboard\Model\Project as ProjectModel; +use Kanboard\Model\ProjectModel; /** * Class UserViewController @@ -21,7 +21,7 @@ class UserViewController extends BaseController */ public function profile() { - $user = $this->user->getById($this->request->getIntegerParam('user_id')); + $user = $this->userModel->getById($this->request->getIntegerParam('user_id')); if (empty($user)) { throw new PageNotFoundException(); @@ -43,8 +43,8 @@ class UserViewController extends BaseController $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/show', array( 'user' => $user, - 'timezones' => $this->timezone->getTimezones(true), - 'languages' => $this->language->getLanguages(true), + 'timezones' => $this->timezoneModel->getTimezones(true), + 'languages' => $this->languageModel->getLanguages(true), ))); } @@ -62,7 +62,7 @@ class UserViewController extends BaseController ->setMax(20) ->setOrder('start') ->setDirection('DESC') - ->setQuery($this->subtaskTimeTracking->getUserQuery($user['id'])) + ->setQuery($this->subtaskTimeTrackingModel->getUserQuery($user['id'])) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); $this->response->html($this->helper->layout->user('user_view/timesheet', array( @@ -80,7 +80,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/password_reset', array( - 'tokens' => $this->passwordReset->getAll($user['id']), + 'tokens' => $this->passwordResetModel->getAll($user['id']), 'user' => $user, ))); } @@ -94,7 +94,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/last', array( - 'last_logins' => $this->lastLogin->getAll($user['id']), + 'last_logins' => $this->lastLoginModel->getAll($user['id']), 'user' => $user, ))); } @@ -108,7 +108,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/sessions', array( - 'sessions' => $this->rememberMeSession->getAll($user['id']), + 'sessions' => $this->rememberMeSessionModel->getAll($user['id']), 'user' => $user, ))); } @@ -122,7 +122,7 @@ class UserViewController extends BaseController { $this->checkCSRFParam(); $user = $this->getUser(); - $this->rememberMeSession->remove($this->request->getIntegerParam('id')); + $this->rememberMeSessionModel->remove($this->request->getIntegerParam('id')); $this->response->redirect($this->helper->url->to('UserViewController', 'sessions', array('user_id' => $user['id']))); } @@ -137,16 +137,16 @@ class UserViewController extends BaseController if ($this->request->isPost()) { $values = $this->request->getValues(); - $this->userNotification->saveSettings($user['id'], $values); + $this->userNotificationModel->saveSettings($user['id'], $values); $this->flash->success(t('User updated successfully.')); return $this->response->redirect($this->helper->url->to('UserViewController', 'notifications', array('user_id' => $user['id']))); } return $this->response->html($this->helper->layout->user('user_view/notifications', array( - 'projects' => $this->projectUserRole->getProjectsByUser($user['id'], array(ProjectModel::ACTIVE)), - 'notifications' => $this->userNotification->readSettings($user['id']), - 'types' => $this->userNotificationType->getTypes(), - 'filters' => $this->userNotificationFilter->getFilters(), + 'projects' => $this->projectUserRoleModel->getProjectsByUser($user['id'], array(ProjectModel::ACTIVE)), + 'notifications' => $this->userNotificationModel->readSettings($user['id']), + 'types' => $this->userNotificationTypeModel->getTypes(), + 'filters' => $this->userNotificationFilterModel->getFilters(), 'user' => $user, ))); } @@ -162,14 +162,14 @@ class UserViewController extends BaseController if ($this->request->isPost()) { $values = $this->request->getValues(); - $this->userMetadata->save($user['id'], $values); + $this->userMetadataModel->save($user['id'], $values); $this->flash->success(t('User updated successfully.')); $this->response->redirect($this->helper->url->to('UserViewController', 'integrations', array('user_id' => $user['id']))); } $this->response->html($this->helper->layout->user('user_view/integrations', array( 'user' => $user, - 'values' => $this->userMetadata->getAll($user['id']), + 'values' => $this->userMetadataModel->getAll($user['id']), ))); } @@ -182,7 +182,7 @@ class UserViewController extends BaseController { $user = $this->getUser(); $this->response->html($this->helper->layout->user('user_view/external', array( - 'last_logins' => $this->lastLogin->getAll($user['id']), + 'last_logins' => $this->lastLoginModel->getAll($user['id']), 'user' => $user, ))); } @@ -200,7 +200,7 @@ class UserViewController extends BaseController if ($switch === 'enable' || $switch === 'disable') { $this->checkCSRFParam(); - if ($this->user->{$switch . 'PublicAccess'}($user['id'])) { + if ($this->userModel->{$switch . 'PublicAccess'}($user['id'])) { $this->flash->success(t('User updated successfully.')); } else { $this->flash->failure(t('Unable to update this user.')); diff --git a/app/Controller/WebNotificationController.php b/app/Controller/WebNotificationController.php index 263d6d9e..46a42063 100644 --- a/app/Controller/WebNotificationController.php +++ b/app/Controller/WebNotificationController.php @@ -19,7 +19,7 @@ class WebNotificationController extends BaseController { $user_id = $this->getUserId(); - $this->userUnreadNotification->markAllAsRead($user_id); + $this->userUnreadNotificationModel->markAllAsRead($user_id); $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); } @@ -33,7 +33,7 @@ class WebNotificationController extends BaseController $user_id = $this->getUserId(); $notification_id = $this->request->getIntegerParam('notification_id'); - $this->userUnreadNotification->markAsRead($user_id, $notification_id); + $this->userUnreadNotificationModel->markAsRead($user_id, $notification_id); $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); } @@ -45,8 +45,8 @@ class WebNotificationController extends BaseController $user_id = $this->getUserId(); $notification_id = $this->request->getIntegerParam('notification_id'); - $notification = $this->userUnreadNotification->getById($notification_id); - $this->userUnreadNotification->markAsRead($user_id, $notification_id); + $notification = $this->userUnreadNotificationModel->getById($notification_id); + $this->userUnreadNotificationModel->markAsRead($user_id, $notification_id); if (empty($notification)) { $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); diff --git a/app/Core/Action/ActionManager.php b/app/Core/Action/ActionManager.php index dfa5a140..1dfd820c 100644 --- a/app/Core/Action/ActionManager.php +++ b/app/Core/Action/ActionManager.php @@ -121,9 +121,9 @@ class ActionManager extends Base public function attachEvents() { if ($this->userSession->isLogged()) { - $actions = $this->action->getAllByUser($this->userSession->getId()); + $actions = $this->actionModel->getAllByUser($this->userSession->getId()); } else { - $actions = $this->action->getAll(); + $actions = $this->actionModel->getAll(); } foreach ($actions as $action) { diff --git a/app/Core/Base.php b/app/Core/Base.php index e490484c..99c093e4 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -10,136 +10,136 @@ use Pimple\Container; * @package core * @author Frederic Guillot * - * @property \Kanboard\Analytic\TaskDistributionAnalytic $taskDistributionAnalytic - * @property \Kanboard\Analytic\UserDistributionAnalytic $userDistributionAnalytic - * @property \Kanboard\Analytic\EstimatedTimeComparisonAnalytic $estimatedTimeComparisonAnalytic - * @property \Kanboard\Analytic\AverageLeadCycleTimeAnalytic $averageLeadCycleTimeAnalytic - * @property \Kanboard\Analytic\AverageTimeSpentColumnAnalytic $averageTimeSpentColumnAnalytic - * @property \Kanboard\Core\Action\ActionManager $actionManager - * @property \Kanboard\Core\ExternalLink\ExternalLinkManager $externalLinkManager - * @property \Kanboard\Core\Cache\MemoryCache $memoryCache - * @property \Kanboard\Core\Event\EventManager $eventManager - * @property \Kanboard\Core\Group\GroupManager $groupManager - * @property \Kanboard\Core\Http\Client $httpClient - * @property \Kanboard\Core\Http\OAuth2 $oauth - * @property \Kanboard\Core\Http\RememberMeCookie $rememberMeCookie - * @property \Kanboard\Core\Http\Request $request - * @property \Kanboard\Core\Http\Response $response - * @property \Kanboard\Core\Http\Router $router - * @property \Kanboard\Core\Http\Route $route - * @property \Kanboard\Core\Queue\QueueManager $queueManager - * @property \Kanboard\Core\Mail\Client $emailClient - * @property \Kanboard\Core\ObjectStorage\ObjectStorageInterface $objectStorage - * @property \Kanboard\Core\Plugin\Hook $hook - * @property \Kanboard\Core\Plugin\Loader $pluginLoader - * @property \Kanboard\Core\Security\AuthenticationManager $authenticationManager - * @property \Kanboard\Core\Security\AccessMap $applicationAccessMap - * @property \Kanboard\Core\Security\AccessMap $projectAccessMap - * @property \Kanboard\Core\Security\Authorization $applicationAuthorization - * @property \Kanboard\Core\Security\Authorization $projectAuthorization - * @property \Kanboard\Core\Security\Role $role - * @property \Kanboard\Core\Security\Token $token - * @property \Kanboard\Core\Session\FlashMessage $flash - * @property \Kanboard\Core\Session\SessionManager $sessionManager - * @property \Kanboard\Core\Session\SessionStorage $sessionStorage - * @property \Kanboard\Core\User\Avatar\AvatarManager $avatarManager - * @property \Kanboard\Core\User\GroupSync $groupSync - * @property \Kanboard\Core\User\UserProfile $userProfile - * @property \Kanboard\Core\User\UserSync $userSync - * @property \Kanboard\Core\User\UserSession $userSession - * @property \Kanboard\Core\DateParser $dateParser - * @property \Kanboard\Core\Helper $helper - * @property \Kanboard\Core\Paginator $paginator - * @property \Kanboard\Core\Template $template - * @property \Kanboard\Model\Action $action - * @property \Kanboard\Model\ActionParameter $actionParameter - * @property \Kanboard\Model\AvatarFile $avatarFile - * @property \Kanboard\Model\Board $board - * @property \Kanboard\Model\Category $category - * @property \Kanboard\Model\Color $color - * @property \Kanboard\Model\Column $column - * @property \Kanboard\Model\Comment $comment - * @property \Kanboard\Model\Config $config - * @property \Kanboard\Model\Currency $currency - * @property \Kanboard\Model\CustomFilter $customFilter - * @property \Kanboard\Model\TaskFile $taskFile - * @property \Kanboard\Model\ProjectFile $projectFile - * @property \Kanboard\Model\Group $group - * @property \Kanboard\Model\GroupMember $groupMember - * @property \Kanboard\Model\Language $language - * @property \Kanboard\Model\LastLogin $lastLogin - * @property \Kanboard\Model\Link $link - * @property \Kanboard\Model\Notification $notification - * @property \Kanboard\Model\PasswordReset $passwordReset - * @property \Kanboard\Model\Project $project - * @property \Kanboard\Model\ProjectActivity $projectActivity - * @property \Kanboard\Model\ProjectDuplication $projectDuplication - * @property \Kanboard\Model\ProjectDailyColumnStats $projectDailyColumnStats - * @property \Kanboard\Model\ProjectDailyStats $projectDailyStats - * @property \Kanboard\Model\ProjectMetadata $projectMetadata - * @property \Kanboard\Model\ProjectPermission $projectPermission - * @property \Kanboard\Model\ProjectUserRole $projectUserRole - * @property \Kanboard\Model\ProjectGroupRole $projectGroupRole - * @property \Kanboard\Model\ProjectNotification $projectNotification - * @property \Kanboard\Model\ProjectNotificationType $projectNotificationType - * @property \Kanboard\Model\RememberMeSession $rememberMeSession - * @property \Kanboard\Model\Subtask $subtask - * @property \Kanboard\Model\SubtaskTimeTracking $subtaskTimeTracking - * @property \Kanboard\Model\Swimlane $swimlane - * @property \Kanboard\Model\Task $task - * @property \Kanboard\Model\TaskAnalytic $taskAnalytic - * @property \Kanboard\Model\TaskCreation $taskCreation - * @property \Kanboard\Model\TaskDuplication $taskDuplication - * @property \Kanboard\Model\TaskExternalLink $taskExternalLink - * @property \Kanboard\Model\TaskFinder $taskFinder - * @property \Kanboard\Model\TaskLink $taskLink - * @property \Kanboard\Model\TaskModification $taskModification - * @property \Kanboard\Model\TaskPosition $taskPosition - * @property \Kanboard\Model\TaskStatus $taskStatus - * @property \Kanboard\Model\TaskMetadata $taskMetadata - * @property \Kanboard\Model\Timezone $timezone - * @property \Kanboard\Model\Transition $transition - * @property \Kanboard\Model\User $user - * @property \Kanboard\Model\UserLocking $userLocking - * @property \Kanboard\Model\UserMention $userMention - * @property \Kanboard\Model\UserNotification $userNotification - * @property \Kanboard\Model\UserNotificationType $userNotificationType - * @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter - * @property \Kanboard\Model\UserUnreadNotification $userUnreadNotification - * @property \Kanboard\Model\UserMetadata $userMetadata - * @property \Kanboard\Validator\ActionValidator $actionValidator - * @property \Kanboard\Validator\AuthValidator $authValidator - * @property \Kanboard\Validator\ColumnValidator $columnValidator - * @property \Kanboard\Validator\CategoryValidator $categoryValidator - * @property \Kanboard\Validator\CommentValidator $commentValidator - * @property \Kanboard\Validator\CurrencyValidator $currencyValidator - * @property \Kanboard\Validator\CustomFilterValidator $customFilterValidator - * @property \Kanboard\Validator\GroupValidator $groupValidator - * @property \Kanboard\Validator\LinkValidator $linkValidator - * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator - * @property \Kanboard\Validator\ProjectValidator $projectValidator - * @property \Kanboard\Validator\SubtaskValidator $subtaskValidator - * @property \Kanboard\Validator\SwimlaneValidator $swimlaneValidator - * @property \Kanboard\Validator\TaskLinkValidator $taskLinkValidator - * @property \Kanboard\Validator\ExternalLinkValidator $externalLinkValidator - * @property \Kanboard\Validator\TaskValidator $taskValidator - * @property \Kanboard\Validator\UserValidator $userValidator - * @property \Kanboard\Import\TaskImport $taskImport - * @property \Kanboard\Import\UserImport $userImport - * @property \Kanboard\Export\SubtaskExport $subtaskExport - * @property \Kanboard\Export\TaskExport $taskExport - * @property \Kanboard\Export\TransitionExport $transitionExport - * @property \Kanboard\Core\Filter\QueryBuilder $projectGroupRoleQuery - * @property \Kanboard\Core\Filter\QueryBuilder $projectUserRoleQuery - * @property \Kanboard\Core\Filter\QueryBuilder $projectActivityQuery - * @property \Kanboard\Core\Filter\QueryBuilder $userQuery - * @property \Kanboard\Core\Filter\QueryBuilder $projectQuery - * @property \Kanboard\Core\Filter\QueryBuilder $taskQuery - * @property \Kanboard\Core\Filter\LexerBuilder $taskLexer - * @property \Kanboard\Core\Filter\LexerBuilder $projectActivityLexer - * @property \Psr\Log\LoggerInterface $logger - * @property \PicoDb\Database $db - * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher + * @property \Kanboard\Analytic\TaskDistributionAnalytic $taskDistributionAnalytic + * @property \Kanboard\Analytic\UserDistributionAnalytic $userDistributionAnalytic + * @property \Kanboard\Analytic\EstimatedTimeComparisonAnalytic $estimatedTimeComparisonAnalytic + * @property \Kanboard\Analytic\AverageLeadCycleTimeAnalytic $averageLeadCycleTimeAnalytic + * @property \Kanboard\Analytic\AverageTimeSpentColumnAnalytic $averageTimeSpentColumnAnalytic + * @property \Kanboard\Core\Action\ActionManager $actionManager + * @property \Kanboard\Core\ExternalLink\ExternalLinkManager $externalLinkManager + * @property \Kanboard\Core\Cache\MemoryCache $memoryCache + * @property \Kanboard\Core\Event\EventManager $eventManager + * @property \Kanboard\Core\Group\GroupManager $groupManager + * @property \Kanboard\Core\Http\Client $httpClient + * @property \Kanboard\Core\Http\OAuth2 $oauth + * @property \Kanboard\Core\Http\RememberMeCookie $rememberMeCookie + * @property \Kanboard\Core\Http\Request $request + * @property \Kanboard\Core\Http\Response $response + * @property \Kanboard\Core\Http\Router $router + * @property \Kanboard\Core\Http\Route $route + * @property \Kanboard\Core\Queue\QueueManager $queueManager + * @property \Kanboard\Core\Mail\Client $emailClient + * @property \Kanboard\Core\ObjectStorage\ObjectStorageInterface $objectStorage + * @property \Kanboard\Core\Plugin\Hook $hook + * @property \Kanboard\Core\Plugin\Loader $pluginLoader + * @property \Kanboard\Core\Security\AuthenticationManager $authenticationManager + * @property \Kanboard\Core\Security\AccessMap $applicationAccessMap + * @property \Kanboard\Core\Security\AccessMap $projectAccessMap + * @property \Kanboard\Core\Security\Authorization $applicationAuthorization + * @property \Kanboard\Core\Security\Authorization $projectAuthorization + * @property \Kanboard\Core\Security\Role $role + * @property \Kanboard\Core\Security\Token $token + * @property \Kanboard\Core\Session\FlashMessage $flash + * @property \Kanboard\Core\Session\SessionManager $sessionManager + * @property \Kanboard\Core\Session\SessionStorage $sessionStorage + * @property \Kanboard\Core\User\Avatar\AvatarManager $avatarManager + * @property \Kanboard\Core\User\GroupSync $groupSync + * @property \Kanboard\Core\User\UserProfile $userProfile + * @property \Kanboard\Core\User\UserSync $userSync + * @property \Kanboard\Core\User\UserSession $userSession + * @property \Kanboard\Core\DateParser $dateParser + * @property \Kanboard\Core\Helper $helper + * @property \Kanboard\Core\Paginator $paginator + * @property \Kanboard\Core\Template $template + * @property \Kanboard\Model\ActionModel $actionModel + * @property \Kanboard\Model\ActionParameterModel $actionParameterModel + * @property \Kanboard\Model\AvatarFileModel $avatarFileModel + * @property \Kanboard\Model\BoardModel $boardModel + * @property \Kanboard\Model\CategoryModel $categoryModel + * @property \Kanboard\Model\ColorModel $colorModel + * @property \Kanboard\Model\ColumnModel $columnModel + * @property \Kanboard\Model\CommentModel $commentModel + * @property \Kanboard\Model\ConfigModel $configModel + * @property \Kanboard\Model\CurrencyModel $currencyModel + * @property \Kanboard\Model\CustomFilterModel $customFilterModel + * @property \Kanboard\Model\TaskFileModel $taskFileModel + * @property \Kanboard\Model\ProjectFileModel $projectFileModel + * @property \Kanboard\Model\GroupModel $groupModel + * @property \Kanboard\Model\GroupMemberModel $groupMemberModel + * @property \Kanboard\Model\LanguageModel $languageModel + * @property \Kanboard\Model\LastLoginModel $lastLoginModel + * @property \Kanboard\Model\LinkModel $linkModel + * @property \Kanboard\Model\NotificationModel $notificationModel + * @property \Kanboard\Model\PasswordResetModel $passwordResetModel + * @property \Kanboard\Model\ProjectModel $projectModel + * @property \Kanboard\Model\ProjectActivityModel $projectActivityModel + * @property \Kanboard\Model\ProjectDuplicationModel $projectDuplicationModel + * @property \Kanboard\Model\ProjectDailyColumnStatsModel $projectDailyColumnStatsModel + * @property \Kanboard\Model\ProjectDailyStatsModel $projectDailyStatsModel + * @property \Kanboard\Model\ProjectMetadataModel $projectMetadataModel + * @property \Kanboard\Model\ProjectPermissionModel $projectPermissionModel + * @property \Kanboard\Model\ProjectUserRoleModel $projectUserRoleModel + * @property \Kanboard\Model\ProjectGroupRoleModel $projectGroupRoleModel + * @property \Kanboard\Model\ProjectNotificationModel $projectNotificationModel + * @property \Kanboard\Model\ProjectNotificationTypeModel $projectNotificationTypeModel + * @property \Kanboard\Model\RememberMeSessionModel $rememberMeSessionModel + * @property \Kanboard\Model\SubtaskModel $subtaskModel + * @property \Kanboard\Model\SubtaskTimeTrackingModel $subtaskTimeTrackingModel + * @property \Kanboard\Model\SwimlaneModel $swimlaneModel + * @property \Kanboard\Model\TaskModel $taskModel + * @property \Kanboard\Model\TaskAnalyticModel $taskAnalyticModel + * @property \Kanboard\Model\TaskCreationModel $taskCreationModel + * @property \Kanboard\Model\TaskDuplicationModel $taskDuplicationModel + * @property \Kanboard\Model\TaskExternalLinkModel $taskExternalLinkModel + * @property \Kanboard\Model\TaskFinderModel $taskFinderModel + * @property \Kanboard\Model\TaskLinkModel $taskLinkModel + * @property \Kanboard\Model\TaskModificationModel $taskModificationModel + * @property \Kanboard\Model\TaskPositionModel $taskPositionModel + * @property \Kanboard\Model\TaskStatusModel $taskStatusModel + * @property \Kanboard\Model\TaskMetadataModel $taskMetadataModel + * @property \Kanboard\Model\TimezoneModel $timezoneModel + * @property \Kanboard\Model\TransitionModel $transitionModel + * @property \Kanboard\Model\UserModel $userModel + * @property \Kanboard\Model\UserLockingModel $userLockingModel + * @property \Kanboard\Model\UserMentionModel $userMentionModel + * @property \Kanboard\Model\UserNotificationModel $userNotificationModel + * @property \Kanboard\Model\UserNotificationTypeModel $userNotificationTypeModel + * @property \Kanboard\Model\UserNotificationFilterModel $userNotificationFilterModel + * @property \Kanboard\Model\UserUnreadNotificationModel $userUnreadNotificationModel + * @property \Kanboard\Model\UserMetadataModel $userMetadataModel + * @property \Kanboard\Validator\ActionValidator $actionValidator + * @property \Kanboard\Validator\AuthValidator $authValidator + * @property \Kanboard\Validator\ColumnValidator $columnValidator + * @property \Kanboard\Validator\CategoryValidator $categoryValidator + * @property \Kanboard\Validator\CommentValidator $commentValidator + * @property \Kanboard\Validator\CurrencyValidator $currencyValidator + * @property \Kanboard\Validator\CustomFilterValidator $customFilterValidator + * @property \Kanboard\Validator\GroupValidator $groupValidator + * @property \Kanboard\Validator\LinkValidator $linkValidator + * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator + * @property \Kanboard\Validator\ProjectValidator $projectValidator + * @property \Kanboard\Validator\SubtaskValidator $subtaskValidator + * @property \Kanboard\Validator\SwimlaneValidator $swimlaneValidator + * @property \Kanboard\Validator\TaskLinkValidator $taskLinkValidator + * @property \Kanboard\Validator\ExternalLinkValidator $externalLinkValidator + * @property \Kanboard\Validator\TaskValidator $taskValidator + * @property \Kanboard\Validator\UserValidator $userValidator + * @property \Kanboard\Import\TaskImport $taskImport + * @property \Kanboard\Import\UserImport $userImport + * @property \Kanboard\Export\SubtaskExport $subtaskExport + * @property \Kanboard\Export\TaskExport $taskExport + * @property \Kanboard\Export\TransitionExport $transitionExport + * @property \Kanboard\Core\Filter\QueryBuilder $projectGroupRoleQuery + * @property \Kanboard\Core\Filter\QueryBuilder $projectUserRoleQuery + * @property \Kanboard\Core\Filter\QueryBuilder $projectActivityQuery + * @property \Kanboard\Core\Filter\QueryBuilder $userQuery + * @property \Kanboard\Core\Filter\QueryBuilder $projectQuery + * @property \Kanboard\Core\Filter\QueryBuilder $taskQuery + * @property \Kanboard\Core\Filter\LexerBuilder $taskLexer + * @property \Kanboard\Core\Filter\LexerBuilder $projectActivityLexer + * @property \Psr\Log\LoggerInterface $logger + * @property \PicoDb\Database $db + * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher */ abstract class Base { diff --git a/app/Core/Event/EventManager.php b/app/Core/Event/EventManager.php index 162d23e8..9ae43170 100644 --- a/app/Core/Event/EventManager.php +++ b/app/Core/Event/EventManager.php @@ -2,8 +2,8 @@ namespace Kanboard\Core\Event; -use Kanboard\Model\Task; -use Kanboard\Model\TaskLink; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskLinkModel; /** * Event Manager @@ -44,15 +44,15 @@ class EventManager public function getAll() { $events = array( - TaskLink::EVENT_CREATE_UPDATE => t('Task link creation or modification'), - Task::EVENT_MOVE_COLUMN => t('Move a task to another column'), - Task::EVENT_UPDATE => t('Task modification'), - Task::EVENT_CREATE => t('Task creation'), - Task::EVENT_OPEN => t('Reopen a task'), - Task::EVENT_CLOSE => t('Closing a task'), - Task::EVENT_CREATE_UPDATE => t('Task creation or modification'), - Task::EVENT_ASSIGNEE_CHANGE => t('Task assignee change'), - Task::EVENT_DAILY_CRONJOB => t('Daily background job for tasks'), + TaskLinkModel::EVENT_CREATE_UPDATE => t('Task link creation or modification'), + TaskModel::EVENT_MOVE_COLUMN => t('Move a task to another column'), + TaskModel::EVENT_UPDATE => t('Task modification'), + TaskModel::EVENT_CREATE => t('Task creation'), + TaskModel::EVENT_OPEN => t('Reopen a task'), + TaskModel::EVENT_CLOSE => t('Closing a task'), + TaskModel::EVENT_CREATE_UPDATE => t('Task creation or modification'), + TaskModel::EVENT_ASSIGNEE_CHANGE => t('Task assignee change'), + TaskModel::EVENT_DAILY_CRONJOB => t('Daily background job for tasks'), ); $events = array_merge($events, $this->events); diff --git a/app/Core/Markdown.php b/app/Core/Markdown.php index 592c29b1..b5abe5ed 100644 --- a/app/Core/Markdown.php +++ b/app/Core/Markdown.php @@ -87,7 +87,7 @@ class Markdown extends Parsedown protected function inlineUserLink(array $Excerpt) { if (! $this->isPublicLink && preg_match('/^@([^\s]+)/', $Excerpt['text'], $matches)) { - $user_id = $this->container['user']->getIdByUsername($matches[1]); + $user_id = $this->container['userModel']->getIdByUsername($matches[1]); if (! empty($user_id)) { $url = $this->container['helper']->url->href('UserViewController', 'profile', array('user_id' => $user_id)); @@ -116,7 +116,7 @@ class Markdown extends Parsedown private function buildTaskLink($task_id) { if ($this->isPublicLink) { - $token = $this->container['memoryCache']->proxy($this->container['taskFinder'], 'getProjectToken', $task_id); + $token = $this->container['memoryCache']->proxy($this->container['taskFinderModel'], 'getProjectToken', $task_id); if (! empty($token)) { return $this->container['helper']->url->href( diff --git a/app/Core/User/GroupSync.php b/app/Core/User/GroupSync.php index 4e08d574..d0bb647b 100644 --- a/app/Core/User/GroupSync.php +++ b/app/Core/User/GroupSync.php @@ -21,7 +21,7 @@ class GroupSync extends Base */ public function synchronize($userId, array $externalGroupIds) { - $userGroups = $this->groupMember->getGroups($userId); + $userGroups = $this->groupMemberModel->getGroups($userId); $this->addGroups($userId, $userGroups, $externalGroupIds); $this->removeGroups($userId, $userGroups, $externalGroupIds); } @@ -40,10 +40,10 @@ class GroupSync extends Base foreach ($externalGroupIds as $externalGroupId) { if (! isset($userGroupIds[$externalGroupId])) { - $group = $this->group->getByExternalId($externalGroupId); + $group = $this->groupModel->getByExternalId($externalGroupId); if (! empty($group)) { - $this->groupMember->addUser($group['id'], $userId); + $this->groupMemberModel->addUser($group['id'], $userId); } } } @@ -61,7 +61,7 @@ class GroupSync extends Base { foreach ($userGroups as $userGroup) { if (! empty($userGroup['external_id']) && ! in_array($userGroup['external_id'], $externalGroupIds)) { - $this->groupMember->removeUser($userGroup['id'], $userId); + $this->groupMemberModel->removeUser($userGroup['id'], $userId); } } } diff --git a/app/Core/User/UserProfile.php b/app/Core/User/UserProfile.php index 4f873390..8b9ebb71 100644 --- a/app/Core/User/UserProfile.php +++ b/app/Core/User/UserProfile.php @@ -25,12 +25,12 @@ class UserProfile extends Base */ public function assign($userId, UserProviderInterface $user) { - $profile = $this->user->getById($userId); + $profile = $this->userModel->getById($userId); $values = UserProperty::filterProperties($profile, UserProperty::getProperties($user)); $values['id'] = $userId; - if ($this->user->update($values)) { + if ($this->userModel->update($values)) { $profile = array_merge($profile, $values); $this->userSession->initialize($profile); return true; @@ -49,7 +49,7 @@ class UserProfile extends Base public function initialize(UserProviderInterface $user) { if ($user->getInternalId()) { - $profile = $this->user->getById($user->getInternalId()); + $profile = $this->userModel->getById($user->getInternalId()); } elseif ($user->getExternalIdColumn() && $user->getExternalId()) { $profile = $this->userSync->synchronize($user); $this->groupSync->synchronize($profile['id'], $user->getExternalGroupIds()); diff --git a/app/Core/User/UserSession.php b/app/Core/User/UserSession.php index 0034c47a..9c63f07a 100644 --- a/app/Core/User/UserSession.php +++ b/app/Core/User/UserSession.php @@ -22,7 +22,7 @@ class UserSession extends Base public function refresh($user_id) { if ($this->getId() == $user_id) { - $this->initialize($this->user->getById($user_id)); + $this->initialize($this->userModel->getById($user_id)); } } diff --git a/app/Core/User/UserSync.php b/app/Core/User/UserSync.php index 055c7106..c2f85498 100644 --- a/app/Core/User/UserSync.php +++ b/app/Core/User/UserSync.php @@ -21,7 +21,7 @@ class UserSync extends Base */ public function synchronize(UserProviderInterface $user) { - $profile = $this->user->getByExternalId($user->getExternalIdColumn(), $user->getExternalId()); + $profile = $this->userModel->getByExternalId($user->getExternalIdColumn(), $user->getExternalId()); $properties = UserProperty::getProperties($user); if (! empty($profile)) { @@ -47,7 +47,7 @@ class UserSync extends Base if (! empty($values)) { $values['id'] = $profile['id']; - $result = $this->user->update($values); + $result = $this->userModel->update($values); return $result ? array_merge($profile, $properties) : $profile; } @@ -64,13 +64,13 @@ class UserSync extends Base */ private function createUser(UserProviderInterface $user, array $properties) { - $userId = $this->user->create($properties); + $userId = $this->userModel->create($properties); if ($userId === false) { $this->logger->error('Unable to create user profile: '.$user->getExternalId()); return array(); } - return $this->user->getById($userId); + return $this->userModel->getById($userId); } } diff --git a/app/Export/SubtaskExport.php b/app/Export/SubtaskExport.php index 386c566b..0939838f 100644 --- a/app/Export/SubtaskExport.php +++ b/app/Export/SubtaskExport.php @@ -3,9 +3,9 @@ namespace Kanboard\Export; use Kanboard\Core\Base; -use Kanboard\Model\Task; -use Kanboard\Model\Subtask; -use Kanboard\Model\User; +use Kanboard\Model\TaskModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\UserModel; /** * Subtask Export @@ -34,7 +34,7 @@ class SubtaskExport extends Base */ public function export($project_id, $from, $to) { - $this->subtask_status = $this->subtask->getStatusList(); + $this->subtask_status = $this->subtaskModel->getStatusList(); $subtasks = $this->getSubtasks($project_id, $from, $to); $results = array($this->getColumns()); @@ -106,19 +106,19 @@ class SubtaskExport extends Base $to = $this->dateParser->removeTimeFromTimestamp(strtotime('+1 day', $this->dateParser->getTimestamp($to))); } - return $this->db->table(Subtask::TABLE) + return $this->db->table(SubtaskModel::TABLE) ->eq('project_id', $project_id) ->columns( - Subtask::TABLE.'.*', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name', - Task::TABLE.'.title AS task_title' + SubtaskModel::TABLE.'.*', + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name', + TaskModel::TABLE.'.title AS task_title' ) ->gte('date_creation', $from) ->lte('date_creation', $to) - ->join(Task::TABLE, 'id', 'task_id') - ->join(User::TABLE, 'id', 'user_id') - ->asc(Subtask::TABLE.'.id') + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(UserModel::TABLE, 'id', 'user_id') + ->asc(SubtaskModel::TABLE.'.id') ->findAll(); } } diff --git a/app/Export/TaskExport.php b/app/Export/TaskExport.php index b98582aa..0e576d33 100644 --- a/app/Export/TaskExport.php +++ b/app/Export/TaskExport.php @@ -4,7 +4,7 @@ namespace Kanboard\Export; use Kanboard\Core\Base; use Kanboard\Core\DateParser; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use PDO; /** @@ -27,7 +27,7 @@ class TaskExport extends Base public function export($project_id, $from, $to) { $tasks = $this->getTasks($project_id, $from, $to); - $swimlanes = $this->swimlane->getList($project_id); + $swimlanes = $this->swimlaneModel->getList($project_id); $results = array($this->getColumns()); foreach ($tasks as &$task) { @@ -102,9 +102,9 @@ class TaskExport extends Base */ public function format(array &$task, array &$swimlanes) { - $colors = $this->color->getList(); + $colors = $this->colorModel->getList(); - $task['is_active'] = $task['is_active'] == Task::STATUS_OPEN ? e('Open') : e('Closed'); + $task['is_active'] = $task['is_active'] == TaskModel::STATUS_OPEN ? e('Open') : e('Closed'); $task['color_id'] = $colors[$task['color_id']]; $task['score'] = $task['score'] ?: 0; $task['swimlane_id'] = isset($swimlanes[$task['swimlane_id']]) ? $swimlanes[$task['swimlane_id']] : '?'; diff --git a/app/Export/TransitionExport.php b/app/Export/TransitionExport.php index 97dc28a7..0df1f70e 100644 --- a/app/Export/TransitionExport.php +++ b/app/Export/TransitionExport.php @@ -25,7 +25,7 @@ class TransitionExport extends Base public function export($project_id, $from, $to) { $results = array($this->getColumns()); - $transitions = $this->transition->getAllByProjectAndDate($project_id, $from, $to); + $transitions = $this->transitionModel->getAllByProjectAndDate($project_id, $from, $to); foreach ($transitions as $transition) { $results[] = $this->format($transition); @@ -68,7 +68,7 @@ class TransitionExport extends Base $transition['src_column'], $transition['dst_column'], $transition['name'] ?: $transition['username'], - date($this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT), $transition['date']), + date($this->configModel->get('application_datetime_format', DateParser::DATE_TIME_FORMAT), $transition['date']), round($transition['time_spent'] / 3600, 2) ); diff --git a/app/Filter/ProjectActivityCreationDateFilter.php b/app/Filter/ProjectActivityCreationDateFilter.php index d0b7f754..451f6548 100644 --- a/app/Filter/ProjectActivityCreationDateFilter.php +++ b/app/Filter/ProjectActivityCreationDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by creation date @@ -32,7 +32,7 @@ class ProjectActivityCreationDateFilter extends BaseDateFilter implements Filter */ public function apply() { - $this->applyDateFilter(ProjectActivity::TABLE.'.date_creation'); + $this->applyDateFilter(ProjectActivityModel::TABLE.'.date_creation'); return $this; } } diff --git a/app/Filter/ProjectActivityCreatorFilter.php b/app/Filter/ProjectActivityCreatorFilter.php index c95569d6..573238d8 100644 --- a/app/Filter/ProjectActivityCreatorFilter.php +++ b/app/Filter/ProjectActivityCreatorFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by creator @@ -54,7 +54,7 @@ class ProjectActivityCreatorFilter extends BaseFilter implements FilterInterface public function apply() { if ($this->value === 'me') { - $this->query->eq(ProjectActivity::TABLE . '.creator_id', $this->currentUserId); + $this->query->eq(ProjectActivityModel::TABLE . '.creator_id', $this->currentUserId); } else { $this->query->beginOr(); $this->query->ilike('uc.username', '%'.$this->value.'%'); diff --git a/app/Filter/ProjectActivityProjectIdFilter.php b/app/Filter/ProjectActivityProjectIdFilter.php index bb4d8bd1..7146a057 100644 --- a/app/Filter/ProjectActivityProjectIdFilter.php +++ b/app/Filter/ProjectActivityProjectIdFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by projectId @@ -32,7 +32,7 @@ class ProjectActivityProjectIdFilter extends BaseFilter implements FilterInterfa */ public function apply() { - $this->query->eq(ProjectActivity::TABLE.'.project_id', $this->value); + $this->query->eq(ProjectActivityModel::TABLE.'.project_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectActivityProjectIdsFilter.php b/app/Filter/ProjectActivityProjectIdsFilter.php index 47cf0c25..70968f79 100644 --- a/app/Filter/ProjectActivityProjectIdsFilter.php +++ b/app/Filter/ProjectActivityProjectIdsFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by projectIds @@ -33,9 +33,9 @@ class ProjectActivityProjectIdsFilter extends BaseFilter implements FilterInterf public function apply() { if (empty($this->value)) { - $this->query->eq(ProjectActivity::TABLE.'.project_id', 0); + $this->query->eq(ProjectActivityModel::TABLE.'.project_id', 0); } else { - $this->query->in(ProjectActivity::TABLE.'.project_id', $this->value); + $this->query->in(ProjectActivityModel::TABLE.'.project_id', $this->value); } return $this; diff --git a/app/Filter/ProjectActivityProjectNameFilter.php b/app/Filter/ProjectActivityProjectNameFilter.php index 0cf73657..b4872182 100644 --- a/app/Filter/ProjectActivityProjectNameFilter.php +++ b/app/Filter/ProjectActivityProjectNameFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter activity events by project name @@ -32,7 +32,7 @@ class ProjectActivityProjectNameFilter extends BaseFilter implements FilterInter */ public function apply() { - $this->query->ilike(Project::TABLE.'.name', '%'.$this->value.'%'); + $this->query->ilike(ProjectModel::TABLE.'.name', '%'.$this->value.'%'); return $this; } } diff --git a/app/Filter/ProjectActivityTaskIdFilter.php b/app/Filter/ProjectActivityTaskIdFilter.php index e99efe09..b8e074db 100644 --- a/app/Filter/ProjectActivityTaskIdFilter.php +++ b/app/Filter/ProjectActivityTaskIdFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Filter activity events by taskId @@ -32,7 +32,7 @@ class ProjectActivityTaskIdFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(ProjectActivity::TABLE.'.task_id', $this->value); + $this->query->eq(ProjectActivityModel::TABLE.'.task_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectActivityTaskStatusFilter.php b/app/Filter/ProjectActivityTaskStatusFilter.php index 69e2c52d..2c98cabf 100644 --- a/app/Filter/ProjectActivityTaskStatusFilter.php +++ b/app/Filter/ProjectActivityTaskStatusFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter activity events by task status @@ -33,9 +33,9 @@ class ProjectActivityTaskStatusFilter extends BaseFilter implements FilterInterf public function apply() { if ($this->value === 'open') { - $this->query->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN); + $this->query->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN); } elseif ($this->value === 'closed') { - $this->query->eq(Task::TABLE.'.is_active', Task::STATUS_CLOSED); + $this->query->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_CLOSED); } return $this; diff --git a/app/Filter/ProjectGroupRoleProjectFilter.php b/app/Filter/ProjectGroupRoleProjectFilter.php index b0950868..035931b3 100644 --- a/app/Filter/ProjectGroupRoleProjectFilter.php +++ b/app/Filter/ProjectGroupRoleProjectFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectGroupRole; +use Kanboard\Model\ProjectGroupRoleModel; /** * Filter ProjectGroupRole users by project @@ -32,7 +32,7 @@ class ProjectGroupRoleProjectFilter extends BaseFilter implements FilterInterfac */ public function apply() { - $this->query->eq(ProjectGroupRole::TABLE.'.project_id', $this->value); + $this->query->eq(ProjectGroupRoleModel::TABLE.'.project_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectGroupRoleUsernameFilter.php b/app/Filter/ProjectGroupRoleUsernameFilter.php index c10855bc..9feac33f 100644 --- a/app/Filter/ProjectGroupRoleUsernameFilter.php +++ b/app/Filter/ProjectGroupRoleUsernameFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\GroupMember; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\User; +use Kanboard\Model\GroupMemberModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\UserModel; /** * Filter ProjectGroupRole users by username @@ -35,9 +35,9 @@ class ProjectGroupRoleUsernameFilter extends BaseFilter implements FilterInterfa public function apply() { $this->query - ->join(GroupMember::TABLE, 'group_id', 'group_id', ProjectGroupRole::TABLE) - ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE) - ->ilike(User::TABLE.'.username', $this->value.'%'); + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', ProjectGroupRoleModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE) + ->ilike(UserModel::TABLE.'.username', $this->value.'%'); return $this; } diff --git a/app/Filter/ProjectIdsFilter.php b/app/Filter/ProjectIdsFilter.php index 641f7f18..9af9db5a 100644 --- a/app/Filter/ProjectIdsFilter.php +++ b/app/Filter/ProjectIdsFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter project by ids @@ -33,9 +33,9 @@ class ProjectIdsFilter extends BaseFilter implements FilterInterface public function apply() { if (empty($this->value)) { - $this->query->eq(Project::TABLE.'.id', 0); + $this->query->eq(ProjectModel::TABLE.'.id', 0); } else { - $this->query->in(Project::TABLE.'.id', $this->value); + $this->query->in(ProjectModel::TABLE.'.id', $this->value); } return $this; diff --git a/app/Filter/ProjectStatusFilter.php b/app/Filter/ProjectStatusFilter.php index a994600c..c1a06eff 100644 --- a/app/Filter/ProjectStatusFilter.php +++ b/app/Filter/ProjectStatusFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter project by status @@ -33,11 +33,11 @@ class ProjectStatusFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Project::TABLE.'.is_active', $this->value); + $this->query->eq(ProjectModel::TABLE.'.is_active', $this->value); } elseif ($this->value === 'inactive' || $this->value === 'closed' || $this->value === 'disabled') { - $this->query->eq(Project::TABLE.'.is_active', 0); + $this->query->eq(ProjectModel::TABLE.'.is_active', 0); } else { - $this->query->eq(Project::TABLE.'.is_active', 1); + $this->query->eq(ProjectModel::TABLE.'.is_active', 1); } return $this; diff --git a/app/Filter/ProjectTypeFilter.php b/app/Filter/ProjectTypeFilter.php index e085e2f6..6afcd293 100644 --- a/app/Filter/ProjectTypeFilter.php +++ b/app/Filter/ProjectTypeFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Filter project by type @@ -33,11 +33,11 @@ class ProjectTypeFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Project::TABLE.'.is_private', $this->value); + $this->query->eq(ProjectModel::TABLE.'.is_private', $this->value); } elseif ($this->value === 'private') { - $this->query->eq(Project::TABLE.'.is_private', Project::TYPE_PRIVATE); + $this->query->eq(ProjectModel::TABLE.'.is_private', ProjectModel::TYPE_PRIVATE); } else { - $this->query->eq(Project::TABLE.'.is_private', Project::TYPE_TEAM); + $this->query->eq(ProjectModel::TABLE.'.is_private', ProjectModel::TYPE_TEAM); } return $this; diff --git a/app/Filter/ProjectUserRoleProjectFilter.php b/app/Filter/ProjectUserRoleProjectFilter.php index 3b880df5..6952364e 100644 --- a/app/Filter/ProjectUserRoleProjectFilter.php +++ b/app/Filter/ProjectUserRoleProjectFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\ProjectUserRole; +use Kanboard\Model\ProjectUserRoleModel; /** * Filter ProjectUserRole users by project @@ -32,7 +32,7 @@ class ProjectUserRoleProjectFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(ProjectUserRole::TABLE.'.project_id', $this->value); + $this->query->eq(ProjectUserRoleModel::TABLE.'.project_id', $this->value); return $this; } } diff --git a/app/Filter/ProjectUserRoleUsernameFilter.php b/app/Filter/ProjectUserRoleUsernameFilter.php index c00493a3..327d3d57 100644 --- a/app/Filter/ProjectUserRoleUsernameFilter.php +++ b/app/Filter/ProjectUserRoleUsernameFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; /** * Filter ProjectUserRole users by username @@ -33,8 +33,8 @@ class ProjectUserRoleUsernameFilter extends BaseFilter implements FilterInterfac public function apply() { $this->query - ->join(User::TABLE, 'id', 'user_id') - ->ilike(User::TABLE.'.username', $this->value.'%'); + ->join(UserModel::TABLE, 'id', 'user_id') + ->ilike(UserModel::TABLE.'.username', $this->value.'%'); return $this; } diff --git a/app/Filter/TaskAssigneeFilter.php b/app/Filter/TaskAssigneeFilter.php index 783d6a12..d6962a93 100644 --- a/app/Filter/TaskAssigneeFilter.php +++ b/app/Filter/TaskAssigneeFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; -use Kanboard\Model\User; +use Kanboard\Model\TaskModel; +use Kanboard\Model\UserModel; /** * Filter tasks by assignee @@ -55,19 +55,19 @@ class TaskAssigneeFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.owner_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.owner_id', $this->value); } else { switch ($this->value) { case 'me': - $this->query->eq(Task::TABLE.'.owner_id', $this->currentUserId); + $this->query->eq(TaskModel::TABLE.'.owner_id', $this->currentUserId); break; case 'nobody': - $this->query->eq(Task::TABLE.'.owner_id', 0); + $this->query->eq(TaskModel::TABLE.'.owner_id', 0); break; default: $this->query->beginOr(); - $this->query->ilike(User::TABLE.'.username', '%'.$this->value.'%'); - $this->query->ilike(User::TABLE.'.name', '%'.$this->value.'%'); + $this->query->ilike(UserModel::TABLE.'.username', '%'.$this->value.'%'); + $this->query->ilike(UserModel::TABLE.'.name', '%'.$this->value.'%'); $this->query->closeOr(); } } diff --git a/app/Filter/TaskCategoryFilter.php b/app/Filter/TaskCategoryFilter.php index 517f24d9..35c52f69 100644 --- a/app/Filter/TaskCategoryFilter.php +++ b/app/Filter/TaskCategoryFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Category; -use Kanboard\Model\Task; +use Kanboard\Model\CategoryModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by category @@ -34,11 +34,11 @@ class TaskCategoryFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.category_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.category_id', $this->value); } elseif ($this->value === 'none') { - $this->query->eq(Task::TABLE.'.category_id', 0); + $this->query->eq(TaskModel::TABLE.'.category_id', 0); } else { - $this->query->eq(Category::TABLE.'.name', $this->value); + $this->query->eq(CategoryModel::TABLE.'.name', $this->value); } return $this; diff --git a/app/Filter/TaskColorFilter.php b/app/Filter/TaskColorFilter.php index 784162d4..2ddb47ce 100644 --- a/app/Filter/TaskColorFilter.php +++ b/app/Filter/TaskColorFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Color; -use Kanboard\Model\Task; +use Kanboard\Model\ColorModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by color @@ -18,7 +18,7 @@ class TaskColorFilter extends BaseFilter implements FilterInterface * Color object * * @access private - * @var Color + * @var ColorModel */ private $colorModel; @@ -26,10 +26,10 @@ class TaskColorFilter extends BaseFilter implements FilterInterface * Set color model object * * @access public - * @param Color $colorModel + * @param ColorModel $colorModel * @return TaskColorFilter */ - public function setColorModel(Color $colorModel) + public function setColorModel(ColorModel $colorModel) { $this->colorModel = $colorModel; return $this; @@ -54,7 +54,7 @@ class TaskColorFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(Task::TABLE.'.color_id', $this->colorModel->find($this->value)); + $this->query->eq(TaskModel::TABLE.'.color_id', $this->colorModel->find($this->value)); return $this; } } diff --git a/app/Filter/TaskColumnFilter.php b/app/Filter/TaskColumnFilter.php index 9a4d4253..fa925b79 100644 --- a/app/Filter/TaskColumnFilter.php +++ b/app/Filter/TaskColumnFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Column; -use Kanboard\Model\Task; +use Kanboard\Model\ColumnModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by column @@ -34,9 +34,9 @@ class TaskColumnFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.column_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.column_id', $this->value); } else { - $this->query->eq(Column::TABLE.'.title', $this->value); + $this->query->eq(ColumnModel::TABLE.'.title', $this->value); } return $this; diff --git a/app/Filter/TaskCommentFilter.php b/app/Filter/TaskCommentFilter.php index 455098c2..52db5581 100644 --- a/app/Filter/TaskCommentFilter.php +++ b/app/Filter/TaskCommentFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Comment; -use Kanboard\Model\Task; +use Kanboard\Model\CommentModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by comment @@ -33,8 +33,8 @@ class TaskCommentFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->ilike(Comment::TABLE.'.comment', '%'.$this->value.'%'); - $this->query->join(Comment::TABLE, 'task_id', 'id', Task::TABLE); + $this->query->ilike(CommentModel::TABLE.'.comment', '%'.$this->value.'%'); + $this->query->join(CommentModel::TABLE, 'task_id', 'id', TaskModel::TABLE); return $this; } diff --git a/app/Filter/TaskCompletionDateFilter.php b/app/Filter/TaskCompletionDateFilter.php index f206a3e2..79b5e7d8 100644 --- a/app/Filter/TaskCompletionDateFilter.php +++ b/app/Filter/TaskCompletionDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by completion date @@ -32,7 +32,7 @@ class TaskCompletionDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_completed'); + $this->applyDateFilter(TaskModel::TABLE.'.date_completed'); return $this; } } diff --git a/app/Filter/TaskCreationDateFilter.php b/app/Filter/TaskCreationDateFilter.php index bb6efad6..db28ac88 100644 --- a/app/Filter/TaskCreationDateFilter.php +++ b/app/Filter/TaskCreationDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by creation date @@ -32,7 +32,7 @@ class TaskCreationDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_creation'); + $this->applyDateFilter(TaskModel::TABLE.'.date_creation'); return $this; } } diff --git a/app/Filter/TaskCreatorFilter.php b/app/Filter/TaskCreatorFilter.php index af35e6bc..611db189 100644 --- a/app/Filter/TaskCreatorFilter.php +++ b/app/Filter/TaskCreatorFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by creator @@ -54,14 +54,14 @@ class TaskCreatorFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.creator_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.creator_id', $this->value); } else { switch ($this->value) { case 'me': - $this->query->eq(Task::TABLE.'.creator_id', $this->currentUserId); + $this->query->eq(TaskModel::TABLE.'.creator_id', $this->currentUserId); break; case 'nobody': - $this->query->eq(Task::TABLE.'.creator_id', 0); + $this->query->eq(TaskModel::TABLE.'.creator_id', 0); break; default: $this->query->beginOr(); diff --git a/app/Filter/TaskDescriptionFilter.php b/app/Filter/TaskDescriptionFilter.php index 6dda58ae..c73c2f56 100644 --- a/app/Filter/TaskDescriptionFilter.php +++ b/app/Filter/TaskDescriptionFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by description @@ -32,7 +32,7 @@ class TaskDescriptionFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->ilike(Task::TABLE.'.description', '%'.$this->value.'%'); + $this->query->ilike(TaskModel::TABLE.'.description', '%'.$this->value.'%'); return $this; } } diff --git a/app/Filter/TaskDueDateFilter.php b/app/Filter/TaskDueDateFilter.php index e36efdd0..0de055bf 100644 --- a/app/Filter/TaskDueDateFilter.php +++ b/app/Filter/TaskDueDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by due date @@ -32,9 +32,9 @@ class TaskDueDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->query->neq(Task::TABLE.'.date_due', 0); - $this->query->notNull(Task::TABLE.'.date_due'); - $this->applyDateFilter(Task::TABLE.'.date_due'); + $this->query->neq(TaskModel::TABLE.'.date_due', 0); + $this->query->notNull(TaskModel::TABLE.'.date_due'); + $this->applyDateFilter(TaskModel::TABLE.'.date_due'); return $this; } diff --git a/app/Filter/TaskDueDateRangeFilter.php b/app/Filter/TaskDueDateRangeFilter.php index 10deb0d3..a6aefbe2 100644 --- a/app/Filter/TaskDueDateRangeFilter.php +++ b/app/Filter/TaskDueDateRangeFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by due date range @@ -32,8 +32,8 @@ class TaskDueDateRangeFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->gte(Task::TABLE.'.date_due', is_numeric($this->value[0]) ? $this->value[0] : strtotime($this->value[0])); - $this->query->lte(Task::TABLE.'.date_due', is_numeric($this->value[1]) ? $this->value[1] : strtotime($this->value[1])); + $this->query->gte(TaskModel::TABLE.'.date_due', is_numeric($this->value[0]) ? $this->value[0] : strtotime($this->value[0])); + $this->query->lte(TaskModel::TABLE.'.date_due', is_numeric($this->value[1]) ? $this->value[1] : strtotime($this->value[1])); return $this; } } diff --git a/app/Filter/TaskIdExclusionFilter.php b/app/Filter/TaskIdExclusionFilter.php index 8bfefb2b..20177b29 100644 --- a/app/Filter/TaskIdExclusionFilter.php +++ b/app/Filter/TaskIdExclusionFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Exclude task ids @@ -32,7 +32,7 @@ class TaskIdExclusionFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->notin(Task::TABLE.'.id', $this->value); + $this->query->notin(TaskModel::TABLE.'.id', $this->value); return $this; } } diff --git a/app/Filter/TaskIdFilter.php b/app/Filter/TaskIdFilter.php index 87bac794..fdf668b6 100644 --- a/app/Filter/TaskIdFilter.php +++ b/app/Filter/TaskIdFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by id @@ -32,7 +32,7 @@ class TaskIdFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(Task::TABLE.'.id', $this->value); + $this->query->eq(TaskModel::TABLE.'.id', $this->value); return $this; } } diff --git a/app/Filter/TaskLinkFilter.php b/app/Filter/TaskLinkFilter.php index 18a13a09..98cd597f 100644 --- a/app/Filter/TaskLinkFilter.php +++ b/app/Filter/TaskLinkFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Link; -use Kanboard\Model\Task; -use Kanboard\Model\TaskLink; +use Kanboard\Model\LinkModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskLinkModel; use PicoDb\Database; use PicoDb\Table; @@ -60,9 +60,9 @@ class TaskLinkFilter extends BaseFilter implements FilterInterface $task_ids = $this->getSubQuery()->findAllByColumn('task_id'); if (! empty($task_ids)) { - $this->query->in(Task::TABLE.'.id', $task_ids); + $this->query->in(TaskModel::TABLE.'.id', $task_ids); } else { - $this->query->eq(Task::TABLE.'.id', 0); // No match + $this->query->eq(TaskModel::TABLE.'.id', 0); // No match } } @@ -74,12 +74,12 @@ class TaskLinkFilter extends BaseFilter implements FilterInterface */ protected function getSubQuery() { - return $this->db->table(TaskLink::TABLE) + return $this->db->table(TaskLinkModel::TABLE) ->columns( - TaskLink::TABLE.'.task_id', - Link::TABLE.'.label' + TaskLinkModel::TABLE.'.task_id', + LinkModel::TABLE.'.label' ) - ->join(Link::TABLE, 'id', 'link_id', TaskLink::TABLE) - ->ilike(Link::TABLE.'.label', $this->value); + ->join(LinkModel::TABLE, 'id', 'link_id', TaskLinkModel::TABLE) + ->ilike(LinkModel::TABLE.'.label', $this->value); } } diff --git a/app/Filter/TaskModificationDateFilter.php b/app/Filter/TaskModificationDateFilter.php index 5036e9c1..316f1835 100644 --- a/app/Filter/TaskModificationDateFilter.php +++ b/app/Filter/TaskModificationDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by modification date @@ -32,7 +32,7 @@ class TaskModificationDateFilter extends BaseDateFilter implements FilterInterfa */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_modification'); + $this->applyDateFilter(TaskModel::TABLE.'.date_modification'); return $this; } } diff --git a/app/Filter/TaskProjectFilter.php b/app/Filter/TaskProjectFilter.php index e432efee..0b5a336b 100644 --- a/app/Filter/TaskProjectFilter.php +++ b/app/Filter/TaskProjectFilter.php @@ -3,8 +3,8 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by project @@ -34,9 +34,9 @@ class TaskProjectFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.project_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.project_id', $this->value); } else { - $this->query->ilike(Project::TABLE.'.name', $this->value); + $this->query->ilike(ProjectModel::TABLE.'.name', $this->value); } return $this; diff --git a/app/Filter/TaskProjectsFilter.php b/app/Filter/TaskProjectsFilter.php index 47636b1d..2b6b16cb 100644 --- a/app/Filter/TaskProjectsFilter.php +++ b/app/Filter/TaskProjectsFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by project ids @@ -33,9 +33,9 @@ class TaskProjectsFilter extends BaseFilter implements FilterInterface public function apply() { if (empty($this->value)) { - $this->query->eq(Task::TABLE.'.project_id', 0); + $this->query->eq(TaskModel::TABLE.'.project_id', 0); } else { - $this->query->in(Task::TABLE.'.project_id', $this->value); + $this->query->in(TaskModel::TABLE.'.project_id', $this->value); } return $this; diff --git a/app/Filter/TaskReferenceFilter.php b/app/Filter/TaskReferenceFilter.php index 4ad47dd5..27c838f8 100644 --- a/app/Filter/TaskReferenceFilter.php +++ b/app/Filter/TaskReferenceFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by reference @@ -32,7 +32,7 @@ class TaskReferenceFilter extends BaseFilter implements FilterInterface */ public function apply() { - $this->query->eq(Task::TABLE.'.reference', $this->value); + $this->query->eq(TaskModel::TABLE.'.reference', $this->value); return $this; } } diff --git a/app/Filter/TaskStartDateFilter.php b/app/Filter/TaskStartDateFilter.php index dd30762b..d5abedb5 100644 --- a/app/Filter/TaskStartDateFilter.php +++ b/app/Filter/TaskStartDateFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by start date @@ -32,7 +32,7 @@ class TaskStartDateFilter extends BaseDateFilter implements FilterInterface */ public function apply() { - $this->applyDateFilter(Task::TABLE.'.date_started'); + $this->applyDateFilter(TaskModel::TABLE.'.date_started'); return $this; } } diff --git a/app/Filter/TaskStatusFilter.php b/app/Filter/TaskStatusFilter.php index 0ba4361e..a55532cb 100644 --- a/app/Filter/TaskStatusFilter.php +++ b/app/Filter/TaskStatusFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by status @@ -33,9 +33,9 @@ class TaskStatusFilter extends BaseFilter implements FilterInterface public function apply() { if ($this->value === 'open' || $this->value === 'closed') { - $this->query->eq(Task::TABLE.'.is_active', $this->value === 'open' ? Task::STATUS_OPEN : Task::STATUS_CLOSED); + $this->query->eq(TaskModel::TABLE.'.is_active', $this->value === 'open' ? TaskModel::STATUS_OPEN : TaskModel::STATUS_CLOSED); } else { - $this->query->eq(Task::TABLE.'.is_active', $this->value); + $this->query->eq(TaskModel::TABLE.'.is_active', $this->value); } return $this; diff --git a/app/Filter/TaskSubtaskAssigneeFilter.php b/app/Filter/TaskSubtaskAssigneeFilter.php index 4c757315..46553a3d 100644 --- a/app/Filter/TaskSubtaskAssigneeFilter.php +++ b/app/Filter/TaskSubtaskAssigneeFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Subtask; -use Kanboard\Model\Task; -use Kanboard\Model\User; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\TaskModel; +use Kanboard\Model\UserModel; use PicoDb\Database; use PicoDb\Table; @@ -81,9 +81,9 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface $task_ids = $this->getSubQuery()->findAllByColumn('task_id'); if (! empty($task_ids)) { - $this->query->in(Task::TABLE.'.id', $task_ids); + $this->query->in(TaskModel::TABLE.'.id', $task_ids); } else { - $this->query->eq(Task::TABLE.'.id', 0); // No match + $this->query->eq(TaskModel::TABLE.'.id', 0); // No match } } @@ -95,15 +95,15 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface */ protected function getSubQuery() { - $subquery = $this->db->table(Subtask::TABLE) + $subquery = $this->db->table(SubtaskModel::TABLE) ->columns( - Subtask::TABLE.'.user_id', - Subtask::TABLE.'.task_id', - User::TABLE.'.name', - User::TABLE.'.username' + SubtaskModel::TABLE.'.user_id', + SubtaskModel::TABLE.'.task_id', + UserModel::TABLE.'.name', + UserModel::TABLE.'.username' ) - ->join(User::TABLE, 'id', 'user_id', Subtask::TABLE) - ->neq(Subtask::TABLE.'.status', Subtask::STATUS_DONE); + ->join(UserModel::TABLE, 'id', 'user_id', SubtaskModel::TABLE) + ->neq(SubtaskModel::TABLE.'.status', SubtaskModel::STATUS_DONE); return $this->applySubQueryFilter($subquery); } @@ -118,19 +118,19 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface protected function applySubQueryFilter(Table $subquery) { if (is_int($this->value) || ctype_digit($this->value)) { - $subquery->eq(Subtask::TABLE.'.user_id', $this->value); + $subquery->eq(SubtaskModel::TABLE.'.user_id', $this->value); } else { switch ($this->value) { case 'me': - $subquery->eq(Subtask::TABLE.'.user_id', $this->currentUserId); + $subquery->eq(SubtaskModel::TABLE.'.user_id', $this->currentUserId); break; case 'nobody': - $subquery->eq(Subtask::TABLE.'.user_id', 0); + $subquery->eq(SubtaskModel::TABLE.'.user_id', 0); break; default: $subquery->beginOr(); - $subquery->ilike(User::TABLE.'.username', $this->value.'%'); - $subquery->ilike(User::TABLE.'.name', '%'.$this->value.'%'); + $subquery->ilike(UserModel::TABLE.'.username', $this->value.'%'); + $subquery->ilike(UserModel::TABLE.'.name', '%'.$this->value.'%'); $subquery->closeOr(); } } diff --git a/app/Filter/TaskSwimlaneFilter.php b/app/Filter/TaskSwimlaneFilter.php index 4e030244..07243969 100644 --- a/app/Filter/TaskSwimlaneFilter.php +++ b/app/Filter/TaskSwimlaneFilter.php @@ -3,9 +3,9 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Project; -use Kanboard\Model\Swimlane; -use Kanboard\Model\Task; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\SwimlaneModel; +use Kanboard\Model\TaskModel; /** * Filter tasks by swimlane @@ -35,13 +35,13 @@ class TaskSwimlaneFilter extends BaseFilter implements FilterInterface public function apply() { if (is_int($this->value) || ctype_digit($this->value)) { - $this->query->eq(Task::TABLE.'.swimlane_id', $this->value); + $this->query->eq(TaskModel::TABLE.'.swimlane_id', $this->value); } elseif ($this->value === 'default') { - $this->query->eq(Task::TABLE.'.swimlane_id', 0); + $this->query->eq(TaskModel::TABLE.'.swimlane_id', 0); } else { $this->query->beginOr(); - $this->query->ilike(Swimlane::TABLE.'.name', $this->value); - $this->query->ilike(Project::TABLE.'.default_swimlane', $this->value); + $this->query->ilike(SwimlaneModel::TABLE.'.name', $this->value); + $this->query->ilike(ProjectModel::TABLE.'.default_swimlane', $this->value); $this->query->closeOr(); } diff --git a/app/Filter/TaskTitleFilter.php b/app/Filter/TaskTitleFilter.php index 9853369c..4e3a2df1 100644 --- a/app/Filter/TaskTitleFilter.php +++ b/app/Filter/TaskTitleFilter.php @@ -3,7 +3,7 @@ namespace Kanboard\Filter; use Kanboard\Core\Filter\FilterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Filter tasks by title @@ -34,11 +34,11 @@ class TaskTitleFilter extends BaseFilter implements FilterInterface { if (ctype_digit($this->value) || (strlen($this->value) > 1 && $this->value{0} === '#' && ctype_digit(substr($this->value, 1)))) { $this->query->beginOr(); - $this->query->eq(Task::TABLE.'.id', str_replace('#', '', $this->value)); - $this->query->ilike(Task::TABLE.'.title', '%'.$this->value.'%'); + $this->query->eq(TaskModel::TABLE.'.id', str_replace('#', '', $this->value)); + $this->query->ilike(TaskModel::TABLE.'.title', '%'.$this->value.'%'); $this->query->closeOr(); } else { - $this->query->ilike(Task::TABLE.'.title', '%'.$this->value.'%'); + $this->query->ilike(TaskModel::TABLE.'.title', '%'.$this->value.'%'); } return $this; diff --git a/app/Formatter/BoardFormatter.php b/app/Formatter/BoardFormatter.php index 6a96b3e6..dbc7cf21 100644 --- a/app/Formatter/BoardFormatter.php +++ b/app/Formatter/BoardFormatter.php @@ -3,7 +3,7 @@ namespace Kanboard\Formatter; use Kanboard\Core\Filter\FormatterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Board Formatter @@ -43,11 +43,11 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface public function format() { $tasks = $this->query - ->eq(Task::TABLE.'.project_id', $this->projectId) - ->asc(Task::TABLE.'.position') + ->eq(TaskModel::TABLE.'.project_id', $this->projectId) + ->asc(TaskModel::TABLE.'.position') ->findAll(); - return $this->board->getBoard($this->projectId, function ($project_id, $column_id, $swimlane_id) use ($tasks) { + return $this->boardModel->getBoard($this->projectId, function ($project_id, $column_id, $swimlane_id) use ($tasks) { return array_filter($tasks, function (array $task) use ($column_id, $swimlane_id) { return $task['column_id'] == $column_id && $task['swimlane_id'] == $swimlane_id; }); diff --git a/app/Formatter/ProjectActivityEventFormatter.php b/app/Formatter/ProjectActivityEventFormatter.php index ae80e5e7..aa0ea7cd 100644 --- a/app/Formatter/ProjectActivityEventFormatter.php +++ b/app/Formatter/ProjectActivityEventFormatter.php @@ -21,7 +21,7 @@ class ProjectActivityEventFormatter extends BaseFormatter implements FormatterIn unset($event['data']); $event['author'] = $event['author_name'] ?: $event['author_username']; - $event['event_title'] = $this->notification->getTitleWithAuthor($event['author'], $event['event_name'], $event); + $event['event_title'] = $this->notificationModel->getTitleWithAuthor($event['author'], $event['event_name'], $event); $event['event_content'] = $this->renderEvent($event); } diff --git a/app/Formatter/ProjectGanttFormatter.php b/app/Formatter/ProjectGanttFormatter.php index 2400ed70..af04f498 100644 --- a/app/Formatter/ProjectGanttFormatter.php +++ b/app/Formatter/ProjectGanttFormatter.php @@ -21,7 +21,7 @@ class ProjectGanttFormatter extends BaseFormatter implements FormatterInterface public function format() { $projects = $this->query->findAll(); - $colors = $this->color->getDefaultColors(); + $colors = $this->colorModel->getDefaultColors(); $bars = array(); foreach ($projects as $project) { @@ -48,7 +48,7 @@ class ProjectGanttFormatter extends BaseFormatter implements FormatterInterface 'gantt_link' => $this->helper->url->href('TaskGanttController', 'show', array('project_id' => $project['id'])), 'color' => $color, 'not_defined' => empty($project['start_date']) || empty($project['end_date']), - 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), + 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']), ); } diff --git a/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php b/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php index 047a39b9..b7b81d87 100644 --- a/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php +++ b/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php @@ -25,8 +25,8 @@ class SubtaskTimeTrackingCalendarFormatter extends BaseFormatter implements Form 'title' => t('#%d', $row['task_id']).' '.$row['subtask_title'].$user, 'start' => date('Y-m-d\TH:i:s', $row['start']), 'end' => date('Y-m-d\TH:i:s', $row['end'] ?: time()), - 'backgroundColor' => $this->color->getBackgroundColor($row['color_id']), - 'borderColor' => $this->color->getBorderColor($row['color_id']), + 'backgroundColor' => $this->colorModel->getBackgroundColor($row['color_id']), + 'borderColor' => $this->colorModel->getBorderColor($row['color_id']), 'textColor' => 'black', 'url' => $this->helper->url->to('TaskViewController', 'show', array('task_id' => $row['task_id'], 'project_id' => $row['project_id'])), 'editable' => false, diff --git a/app/Formatter/TaskAutoCompleteFormatter.php b/app/Formatter/TaskAutoCompleteFormatter.php index 480ee797..4f1c4c69 100644 --- a/app/Formatter/TaskAutoCompleteFormatter.php +++ b/app/Formatter/TaskAutoCompleteFormatter.php @@ -3,7 +3,7 @@ namespace Kanboard\Formatter; use Kanboard\Core\Filter\FormatterInterface; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Task AutoComplete Formatter @@ -21,7 +21,7 @@ class TaskAutoCompleteFormatter extends BaseFormatter implements FormatterInterf */ public function format() { - $tasks = $this->query->columns(Task::TABLE.'.id', Task::TABLE.'.title')->findAll(); + $tasks = $this->query->columns(TaskModel::TABLE.'.id', TaskModel::TABLE.'.title')->findAll(); foreach ($tasks as &$task) { $task['value'] = $task['title']; diff --git a/app/Formatter/TaskCalendarFormatter.php b/app/Formatter/TaskCalendarFormatter.php index d478d2bd..75d2a83e 100644 --- a/app/Formatter/TaskCalendarFormatter.php +++ b/app/Formatter/TaskCalendarFormatter.php @@ -44,11 +44,11 @@ class TaskCalendarFormatter extends BaseTaskCalendarFormatter implements Formatt foreach ($this->query->findAll() as $task) { $events[] = array( - 'timezoneParam' => $this->timezone->getCurrentTimezone(), + 'timezoneParam' => $this->timezoneModel->getCurrentTimezone(), 'id' => $task['id'], 'title' => t('#%d', $task['id']).' '.$task['title'], - 'backgroundColor' => $this->color->getBackgroundColor($task['color_id']), - 'borderColor' => $this->color->getBorderColor($task['color_id']), + 'backgroundColor' => $this->colorModel->getBackgroundColor($task['color_id']), + 'borderColor' => $this->colorModel->getBorderColor($task['color_id']), 'textColor' => 'black', 'url' => $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), 'start' => date($this->getDateTimeFormat(), $task[$this->startColumn]), diff --git a/app/Formatter/TaskGanttFormatter.php b/app/Formatter/TaskGanttFormatter.php index 4ff5c019..ddb3f93a 100644 --- a/app/Formatter/TaskGanttFormatter.php +++ b/app/Formatter/TaskGanttFormatter.php @@ -47,7 +47,7 @@ class TaskGanttFormatter extends BaseFormatter implements FormatterInterface private function formatTask(array $task) { if (! isset($this->columns[$task['project_id']])) { - $this->columns[$task['project_id']] = $this->column->getList($task['project_id']); + $this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']); } $start = $task['date_started'] ?: time(); @@ -69,9 +69,9 @@ class TaskGanttFormatter extends BaseFormatter implements FormatterInterface ), 'column_title' => $task['column_name'], 'assignee' => $task['assignee_name'] ?: $task['assignee_username'], - 'progress' => $this->task->getProgress($task, $this->columns[$task['project_id']]).'%', + 'progress' => $this->taskModel->getProgress($task, $this->columns[$task['project_id']]).'%', 'link' => $this->helper->url->href('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), - 'color' => $this->color->getColorProperties($task['color_id']), + 'color' => $this->colorModel->getColorProperties($task['color_id']), 'not_defined' => empty($task['date_due']) || empty($task['date_started']), ); } diff --git a/app/Formatter/UserAutoCompleteFormatter.php b/app/Formatter/UserAutoCompleteFormatter.php index c46a24d0..cd23a2a4 100644 --- a/app/Formatter/UserAutoCompleteFormatter.php +++ b/app/Formatter/UserAutoCompleteFormatter.php @@ -2,7 +2,7 @@ namespace Kanboard\Formatter; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; use Kanboard\Core\Filter\FormatterInterface; /** @@ -21,7 +21,7 @@ class UserAutoCompleteFormatter extends BaseFormatter implements FormatterInterf */ public function format() { - $users = $this->query->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name')->findAll(); + $users = $this->query->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name')->findAll(); foreach ($users as &$user) { $user['value'] = $user['username'].' (#'.$user['id'].')'; diff --git a/app/Group/DatabaseBackendGroupProvider.php b/app/Group/DatabaseBackendGroupProvider.php index 6dbaa43c..29d04d57 100644 --- a/app/Group/DatabaseBackendGroupProvider.php +++ b/app/Group/DatabaseBackendGroupProvider.php @@ -23,7 +23,7 @@ class DatabaseBackendGroupProvider extends Base implements GroupBackendProviderI public function find($input) { $result = array(); - $groups = $this->group->search($input); + $groups = $this->groupModel->search($input); foreach ($groups as $group) { $result[] = new DatabaseGroupProvider($group); diff --git a/app/Helper/AppHelper.php b/app/Helper/AppHelper.php index 1f497929..b738f85c 100644 --- a/app/Helper/AppHelper.php +++ b/app/Helper/AppHelper.php @@ -22,7 +22,7 @@ class AppHelper extends Base */ public function config($param, $default_value = '') { - return $this->config->get($param, $default_value); + return $this->configModel->get($param, $default_value); } /** @@ -90,7 +90,7 @@ class AppHelper extends Base */ public function jsLang() { - return $this->language->getJsLanguageCode(); + return $this->languageModel->getJsLanguageCode(); } /** @@ -101,7 +101,7 @@ class AppHelper extends Base */ public function getTimezone() { - return $this->timezone->getCurrentTimezone(); + return $this->timezoneModel->getCurrentTimezone(); } /** diff --git a/app/Helper/AssetHelper.php b/app/Helper/AssetHelper.php index b3dc711f..dad1448a 100644 --- a/app/Helper/AssetHelper.php +++ b/app/Helper/AssetHelper.php @@ -45,8 +45,8 @@ class AssetHelper extends Base */ public function customCss() { - if ($this->config->get('application_stylesheet')) { - return '<style>'.$this->config->get('application_stylesheet').'</style>'; + if ($this->configModel->get('application_stylesheet')) { + return '<style>'.$this->configModel->get('application_stylesheet').'</style>'; } return ''; @@ -60,6 +60,6 @@ class AssetHelper extends Base */ public function colorCss() { - return '<style>'.$this->color->getCss().'</style>'; + return '<style>'.$this->colorModel->getCss().'</style>'; } } diff --git a/app/Helper/CalendarHelper.php b/app/Helper/CalendarHelper.php index d5f4af21..b35c40f7 100644 --- a/app/Helper/CalendarHelper.php +++ b/app/Helper/CalendarHelper.php @@ -47,7 +47,7 @@ class CalendarHelper extends Base */ public function getTaskEvents(QueryBuilder $queryBuilder, $start, $end) { - $startColumn = $this->config->get('calendar_project_tasks', 'date_started'); + $startColumn = $this->configModel->get('calendar_project_tasks', 'date_started'); $queryBuilder->getQuery()->addCondition($this->getCalendarCondition( $this->dateParser->getTimestampFromIsoFormat($start), @@ -75,7 +75,7 @@ class CalendarHelper extends Base { $formatter = new SubtaskTimeTrackingCalendarFormatter($this->container); return $formatter - ->withQuery($this->subtaskTimeTracking->getUserQuery($user_id) + ->withQuery($this->subtaskTimeTrackingModel->getUserQuery($user_id) ->addCondition($this->getCalendarCondition( $this->dateParser->getTimestampFromIsoFormat($start), $this->dateParser->getTimestampFromIsoFormat($end), diff --git a/app/Helper/DateHelper.php b/app/Helper/DateHelper.php index 3844ce64..7e2ec79c 100644 --- a/app/Helper/DateHelper.php +++ b/app/Helper/DateHelper.php @@ -22,7 +22,7 @@ class DateHelper extends Base */ public function time($value) { - return date($this->config->get('application_time_format', 'H:i'), $value); + return date($this->configModel->get('application_time_format', 'H:i'), $value); } /** @@ -42,7 +42,7 @@ class DateHelper extends Base $value = strtotime($value); } - return date($this->config->get('application_date_format', 'm/d/Y'), $value); + return date($this->configModel->get('application_date_format', 'm/d/Y'), $value); } /** @@ -54,7 +54,7 @@ class DateHelper extends Base */ public function datetime($value) { - return date($this->config->get('application_datetime_format', 'm/d/Y H:i'), $value); + return date($this->configModel->get('application_datetime_format', 'm/d/Y H:i'), $value); } /** diff --git a/app/Helper/LayoutHelper.php b/app/Helper/LayoutHelper.php index 42047dd9..8ebb05d4 100644 --- a/app/Helper/LayoutHelper.php +++ b/app/Helper/LayoutHelper.php @@ -27,7 +27,7 @@ class LayoutHelper extends Base } if (! isset($params['no_layout']) && ! isset($params['board_selector'])) { - $params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()); + $params['board_selector'] = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); } return $this->pageLayout($template, $params); @@ -110,7 +110,7 @@ class LayoutHelper extends Base public function config($template, array $params) { if (! isset($params['values'])) { - $params['values'] = $this->config->getAll(); + $params['values'] = $this->configModel->getAll(); } if (! isset($params['errors'])) { diff --git a/app/Helper/ProjectActivityHelper.php b/app/Helper/ProjectActivityHelper.php index 0638a978..40f386db 100644 --- a/app/Helper/ProjectActivityHelper.php +++ b/app/Helper/ProjectActivityHelper.php @@ -7,7 +7,7 @@ use Kanboard\Filter\ProjectActivityProjectIdFilter; use Kanboard\Filter\ProjectActivityProjectIdsFilter; use Kanboard\Filter\ProjectActivityTaskIdFilter; use Kanboard\Formatter\ProjectActivityEventFormatter; -use Kanboard\Model\ProjectActivity; +use Kanboard\Model\ProjectActivityModel; /** * Project Activity Helper @@ -26,7 +26,7 @@ class ProjectActivityHelper extends Base */ public function searchEvents($search) { - $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId()); + $projects = $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()); $events = array(); if ($search !== '') { @@ -34,7 +34,7 @@ class ProjectActivityHelper extends Base $queryBuilder ->withFilter(new ProjectActivityProjectIdsFilter(array_keys($projects))) ->getQuery() - ->desc(ProjectActivity::TABLE.'.id') + ->desc(ProjectActivityModel::TABLE.'.id') ->limit(500) ; @@ -58,7 +58,7 @@ class ProjectActivityHelper extends Base ->withFilter(new ProjectActivityProjectIdFilter($project_id)); $queryBuilder->getQuery() - ->desc(ProjectActivity::TABLE.'.id') + ->desc(ProjectActivityModel::TABLE.'.id') ->limit($limit) ; @@ -79,7 +79,7 @@ class ProjectActivityHelper extends Base ->withFilter(new ProjectActivityProjectIdsFilter($project_ids)); $queryBuilder->getQuery() - ->desc(ProjectActivity::TABLE.'.id') + ->desc(ProjectActivityModel::TABLE.'.id') ->limit($limit) ; @@ -98,7 +98,7 @@ class ProjectActivityHelper extends Base $queryBuilder = $this->projectActivityQuery ->withFilter(new ProjectActivityTaskIdFilter($task_id)); - $queryBuilder->getQuery()->desc(ProjectActivity::TABLE.'.id'); + $queryBuilder->getQuery()->desc(ProjectActivityModel::TABLE.'.id'); return $queryBuilder->format(new ProjectActivityEventFormatter($this->container)); } diff --git a/app/Helper/ProjectHeaderHelper.php b/app/Helper/ProjectHeaderHelper.php index 19570059..9514f4f2 100644 --- a/app/Helper/ProjectHeaderHelper.php +++ b/app/Helper/ProjectHeaderHelper.php @@ -48,9 +48,9 @@ class ProjectHeaderHelper extends Base return $this->template->render('project_header/header', array( 'project' => $project, 'filters' => $filters, - 'categories_list' => $this->category->getList($project['id'], false), - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], false), - 'custom_filters_list' => $this->customFilter->getAll($project['id'], $this->userSession->getId()), + 'categories_list' => $this->categoryModel->getList($project['id'], false), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], false), + 'custom_filters_list' => $this->customFilterModel->getAll($project['id'], $this->userSession->getId()), 'board_view' => $boardView, )); } diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index 4857d0ee..1b510d2a 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -22,22 +22,22 @@ class TaskHelper extends Base public function getColors() { - return $this->color->getList(); + return $this->colorModel->getList(); } public function recurrenceTriggers() { - return $this->task->getRecurrenceTriggerList(); + return $this->taskModel->getRecurrenceTriggerList(); } public function recurrenceTimeframes() { - return $this->task->getRecurrenceTimeframeList(); + return $this->taskModel->getRecurrenceTimeframeList(); } public function recurrenceBasedates() { - return $this->task->getRecurrenceBasedateList(); + return $this->taskModel->getRecurrenceBasedateList(); } public function canRemove(array $task) @@ -142,7 +142,7 @@ class TaskHelper extends Base public function selectStartDate(array $values, array $errors = array(), array $attributes = array()) { - $placeholder = date($this->config->get('application_date_format', 'm/d/Y H:i')); + $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y H:i')); $attributes = array_merge(array('tabindex="11"', 'placeholder="'.$placeholder.'"'), $attributes); $html = $this->helper->form->label(t('Start Date'), 'date_started'); @@ -153,7 +153,7 @@ class TaskHelper extends Base public function selectDueDate(array $values, array $errors = array(), array $attributes = array()) { - $placeholder = date($this->config->get('application_date_format', 'm/d/Y')); + $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y')); $attributes = array_merge(array('tabindex="12"', 'placeholder="'.$placeholder.'"'), $attributes); $html = $this->helper->form->label(t('Due Date'), 'date_due'); @@ -178,9 +178,9 @@ class TaskHelper extends Base public function getProgress($task) { if (! isset($this->columns[$task['project_id']])) { - $this->columns[$task['project_id']] = $this->column->getList($task['project_id']); + $this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']); } - return $this->task->getProgress($task, $this->columns[$task['project_id']]); + return $this->taskModel->getProgress($task, $this->columns[$task['project_id']]); } } diff --git a/app/Helper/UrlHelper.php b/app/Helper/UrlHelper.php index ab642c62..2127c69e 100644 --- a/app/Helper/UrlHelper.php +++ b/app/Helper/UrlHelper.php @@ -109,7 +109,7 @@ class UrlHelper extends Base public function base() { if (empty($this->base)) { - $this->base = $this->config->get('application_url') ?: $this->server(); + $this->base = $this->configModel->get('application_url') ?: $this->server(); } return $this->base; diff --git a/app/Helper/UserHelper.php b/app/Helper/UserHelper.php index b39d7b62..5c466df3 100644 --- a/app/Helper/UserHelper.php +++ b/app/Helper/UserHelper.php @@ -21,7 +21,7 @@ class UserHelper extends Base */ public function hasNotifications() { - return $this->userUnreadNotification->hasNotifications($this->userSession->getId()); + return $this->userUnreadNotificationModel->hasNotifications($this->userSession->getId()); } /** @@ -50,7 +50,7 @@ class UserHelper extends Base */ public function getFullname(array $user = array()) { - return $this->user->getFullname(empty($user) ? $this->userSession->getAll() : $user); + return $this->userModel->getFullname(empty($user) ? $this->userSession->getAll() : $user); } /** @@ -157,7 +157,7 @@ class UserHelper extends Base */ public function getProjectUserRole($project_id) { - return $this->memoryCache->proxy($this->projectUserRole, 'getUserRole', $project_id, $this->userSession->getId()); + return $this->memoryCache->proxy($this->projectUserRoleModel, 'getUserRole', $project_id, $this->userSession->getId()); } /** diff --git a/app/Import/TaskImport.php b/app/Import/TaskImport.php index 2abafe14..f5ca9b0e 100644 --- a/app/Import/TaskImport.php +++ b/app/Import/TaskImport.php @@ -69,7 +69,7 @@ class TaskImport extends Base $row = $this->prepare($row); if ($this->validateCreation($row)) { - if ($this->taskCreation->create($row) > 0) { + if ($this->taskCreationModel->create($row) > 0) { $this->logger->debug('TaskImport: imported successfully line '.$line_number); $this->counter++; } else { @@ -100,27 +100,27 @@ class TaskImport extends Base $values['time_spent'] = (float) $row['time_spent']; if (! empty($row['assignee'])) { - $values['owner_id'] = $this->user->getIdByUsername($row['assignee']); + $values['owner_id'] = $this->userModel->getIdByUsername($row['assignee']); } if (! empty($row['creator'])) { - $values['creator_id'] = $this->user->getIdByUsername($row['creator']); + $values['creator_id'] = $this->userModel->getIdByUsername($row['creator']); } if (! empty($row['color'])) { - $values['color_id'] = $this->color->find($row['color']); + $values['color_id'] = $this->colorModel->find($row['color']); } if (! empty($row['column'])) { - $values['column_id'] = $this->column->getColumnIdByTitle($this->projectId, $row['column']); + $values['column_id'] = $this->columnModel->getColumnIdByTitle($this->projectId, $row['column']); } if (! empty($row['category'])) { - $values['category_id'] = $this->category->getIdByName($this->projectId, $row['category']); + $values['category_id'] = $this->categoryModel->getIdByName($this->projectId, $row['category']); } if (! empty($row['swimlane'])) { - $values['swimlane_id'] = $this->swimlane->getIdByName($this->projectId, $row['swimlane']); + $values['swimlane_id'] = $this->swimlaneModel->getIdByName($this->projectId, $row['swimlane']); } if (! empty($row['date_due'])) { diff --git a/app/Import/UserImport.php b/app/Import/UserImport.php index 64300d77..c877e82a 100644 --- a/app/Import/UserImport.php +++ b/app/Import/UserImport.php @@ -2,7 +2,7 @@ namespace Kanboard\Import; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; use SimpleValidator\Validator; use SimpleValidator\Validators; use Kanboard\Core\Security\Role; @@ -56,7 +56,7 @@ class UserImport extends Base $row = $this->prepare($row); if ($this->validateCreation($row)) { - if ($this->user->create($row)) { + if ($this->userModel->create($row)) { $this->logger->debug('UserImport: imported successfully line '.$line_number); $this->counter++; } else { @@ -109,7 +109,7 @@ class UserImport extends Base { $v = new Validator($values, array( new Validators\MaxLength('username', t('The maximum length is %d characters', 50), 50), - new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), User::TABLE, 'id'), + new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), UserModel::TABLE, 'id'), new Validators\MinLength('password', t('The minimum length is %d characters', 6), 6), new Validators\Email('email', t('Email address invalid')), new Validators\Integer('is_ldap_user', t('This value must be an integer')), diff --git a/app/Job/NotificationJob.php b/app/Job/NotificationJob.php index d5fce222..904a9273 100644 --- a/app/Job/NotificationJob.php +++ b/app/Job/NotificationJob.php @@ -39,10 +39,10 @@ class NotificationJob extends BaseJob if (! empty($eventData)) { if (! empty($event['mention'])) { - $this->userNotification->sendUserNotification($event['mention'], $eventName, $eventData); + $this->userNotificationModel->sendUserNotification($event['mention'], $eventName, $eventData); } else { - $this->userNotification->sendNotifications($eventName, $eventData); - $this->projectNotification->sendNotifications($eventData['task']['project_id'], $eventName, $eventData); + $this->userNotificationModel->sendNotifications($eventName, $eventData); + $this->projectNotificationModel->sendNotifications($eventData['task']['project_id'], $eventName, $eventData); } } } @@ -64,19 +64,19 @@ class NotificationJob extends BaseJob switch ($eventObjectName) { case 'Kanboard\Event\TaskEvent': - $values['task'] = $this->taskFinder->getDetails($event['task_id']); + $values['task'] = $this->taskFinderModel->getDetails($event['task_id']); break; case 'Kanboard\Event\SubtaskEvent': - $values['subtask'] = $this->subtask->getById($event['id'], true); - $values['task'] = $this->taskFinder->getDetails($values['subtask']['task_id']); + $values['subtask'] = $this->subtaskModel->getById($event['id'], true); + $values['task'] = $this->taskFinderModel->getDetails($values['subtask']['task_id']); break; case 'Kanboard\Event\FileEvent': $values['file'] = $event; - $values['task'] = $this->taskFinder->getDetails($values['file']['task_id']); + $values['task'] = $this->taskFinderModel->getDetails($values['file']['task_id']); break; case 'Kanboard\Event\CommentEvent': - $values['comment'] = $this->comment->getById($event['id']); - $values['task'] = $this->taskFinder->getDetails($values['comment']['task_id']); + $values['comment'] = $this->commentModel->getById($event['id']); + $values['task'] = $this->taskFinderModel->getDetails($values['comment']['task_id']); break; } diff --git a/app/Job/ProjectMetricJob.php b/app/Job/ProjectMetricJob.php index 2c3e589c..6330bd4c 100644 --- a/app/Job/ProjectMetricJob.php +++ b/app/Job/ProjectMetricJob.php @@ -34,7 +34,7 @@ class ProjectMetricJob extends BaseJob $this->logger->debug(__METHOD__.' Run project metrics calculation'); $now = date('Y-m-d'); - $this->projectDailyColumnStats->updateTotals($projectId, $now); - $this->projectDailyStats->updateTotals($projectId, $now); + $this->projectDailyColumnStatsModel->updateTotals($projectId, $now); + $this->projectDailyStatsModel->updateTotals($projectId, $now); } } diff --git a/app/Middleware/ProjectAuthorizationMiddleware.php b/app/Middleware/ProjectAuthorizationMiddleware.php index 6000ee0e..704491b7 100644 --- a/app/Middleware/ProjectAuthorizationMiddleware.php +++ b/app/Middleware/ProjectAuthorizationMiddleware.php @@ -22,7 +22,7 @@ class ProjectAuthorizationMiddleware extends BaseMiddleware $task_id = $this->request->getIntegerParam('task_id'); if ($task_id > 0 && $project_id === 0) { - $project_id = $this->taskFinder->getProjectId($task_id); + $project_id = $this->taskFinderModel->getProjectId($task_id); } if ($project_id > 0 && ! $this->helper->user->hasProjectAccess($this->router->getController(), $this->router->getAction(), $project_id)) { diff --git a/app/Model/Action.php b/app/Model/ActionModel.php index 568ac85a..53393ed5 100644 --- a/app/Model/Action.php +++ b/app/Model/ActionModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Action Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Action extends Base +class ActionModel extends Base { /** * SQL table name for actions @@ -28,12 +28,12 @@ class Action extends Base */ public function getAllByUser($user_id) { - $project_ids = $this->projectPermission->getActiveProjectIds($user_id); + $project_ids = $this->projectPermissionModel->getActiveProjectIds($user_id); $actions = array(); if (! empty($project_ids)) { $actions = $this->db->table(self::TABLE)->in('project_id', $project_ids)->findAll(); - $params = $this->actionParameter->getAllByActions(array_column($actions, 'id')); + $params = $this->actionParameterModel->getAllByActions(array_column($actions, 'id')); $this->attachParamsToActions($actions, $params); } @@ -50,7 +50,7 @@ class Action extends Base public function getAllByProject($project_id) { $actions = $this->db->table(self::TABLE)->eq('project_id', $project_id)->findAll(); - $params = $this->actionParameter->getAllByActions(array_column($actions, 'id')); + $params = $this->actionParameterModel->getAllByActions(array_column($actions, 'id')); return $this->attachParamsToActions($actions, $params); } @@ -63,7 +63,7 @@ class Action extends Base public function getAll() { $actions = $this->db->table(self::TABLE)->findAll(); - $params = $this->actionParameter->getAll(); + $params = $this->actionParameterModel->getAll(); return $this->attachParamsToActions($actions, $params); } @@ -79,7 +79,7 @@ class Action extends Base $action = $this->db->table(self::TABLE)->eq('id', $action_id)->findOne(); if (! empty($action)) { - $action['params'] = $this->actionParameter->getAllByAction($action_id); + $action['params'] = $this->actionParameterModel->getAllByAction($action_id); } return $action; @@ -138,7 +138,7 @@ class Action extends Base $action_id = $this->db->getLastId(); - if (! $this->actionParameter->create($action_id, $values)) { + if (! $this->actionParameterModel->create($action_id, $values)) { $this->db->cancelTransaction(); return false; } @@ -158,7 +158,7 @@ class Action extends Base */ public function duplicate($src_project_id, $dst_project_id) { - $actions = $this->action->getAllByProject($src_project_id); + $actions = $this->actionModel->getAllByProject($src_project_id); foreach ($actions as $action) { $this->db->startTransaction(); @@ -176,7 +176,7 @@ class Action extends Base $action_id = $this->db->getLastId(); - if (! $this->actionParameter->duplicateParameters($dst_project_id, $action_id, $action['params'])) { + if (! $this->actionParameterModel->duplicateParameters($dst_project_id, $action_id, $action['params'])) { $this->logger->error('Action::duplicate => skip action '.$action['action_name'].' '.$action['id']); $this->db->cancelTransaction(); continue; diff --git a/app/Model/ActionParameter.php b/app/Model/ActionParameterModel.php index a2fe74e5..9895da0f 100644 --- a/app/Model/ActionParameter.php +++ b/app/Model/ActionParameterModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Action Parameter Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ActionParameter extends Base +class ActionParameterModel extends Base { /** * SQL table name @@ -147,16 +147,16 @@ class ActionParameter extends Base case 'project_id': return $value != $project_id ? $value : false; case 'category_id': - return $this->category->getIdByName($project_id, $this->category->getNameById($value)) ?: false; + return $this->categoryModel->getIdByName($project_id, $this->categoryModel->getNameById($value)) ?: false; case 'src_column_id': case 'dest_column_id': case 'dst_column_id': case 'column_id': - $column = $this->column->getById($value); - return empty($column) ? false : $this->column->getColumnIdByTitle($project_id, $column['title']) ?: false; + $column = $this->columnModel->getById($value); + return empty($column) ? false : $this->columnModel->getColumnIdByTitle($project_id, $column['title']) ?: false; case 'user_id': case 'owner_id': - return $this->projectPermission->isAssignable($project_id, $value) ? $value : false; + return $this->projectPermissionModel->isAssignable($project_id, $value) ? $value : false; default: return $value; } diff --git a/app/Model/AvatarFile.php b/app/Model/AvatarFileModel.php index cfb9e713..6e36d83f 100644 --- a/app/Model/AvatarFile.php +++ b/app/Model/AvatarFileModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Base; /** * Avatar File * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class AvatarFile extends Base +class AvatarFileModel extends Base { /** * Path prefix @@ -29,7 +29,7 @@ class AvatarFile extends Base */ public function getFilename($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->findOneColumn('avatar_path'); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->findOneColumn('avatar_path'); } /** @@ -42,7 +42,7 @@ class AvatarFile extends Base */ public function create($user_id, $path) { - $result = $this->db->table(User::TABLE)->eq('id', $user_id)->update(array( + $result = $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array( 'avatar_path' => $path, )); @@ -65,7 +65,7 @@ class AvatarFile extends Base if (! empty($filename)) { $this->objectStorage->remove($filename); - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('avatar_path' => '')); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('avatar_path' => '')); } } catch (Exception $e) { $this->logger->error($e->getMessage()); diff --git a/app/Model/Board.php b/app/Model/BoardModel.php index 91acfb1b..d2718b47 100644 --- a/app/Model/Board.php +++ b/app/Model/BoardModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Board model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Board extends Base +class BoardModel extends Base { /** * Get Kanboard default columns @@ -31,7 +31,7 @@ class Board extends Base */ public function getUserColumns() { - $column_names = explode(',', $this->config->get('board_columns', implode(',', $this->getDefaultColumns()))); + $column_names = explode(',', $this->configModel->get('board_columns', implode(',', $this->getDefaultColumns()))); $columns = array(); foreach ($column_names as $column_name) { @@ -66,7 +66,7 @@ class Board extends Base 'description' => $column['description'], ); - if (! $this->db->table(Column::TABLE)->save($values)) { + if (! $this->db->table(ColumnModel::TABLE)->save($values)) { return false; } } @@ -84,13 +84,13 @@ class Board extends Base */ public function duplicate($project_from, $project_to) { - $columns = $this->db->table(Column::TABLE) + $columns = $this->db->table(ColumnModel::TABLE) ->columns('title', 'task_limit', 'description') ->eq('project_id', $project_from) ->asc('position') ->findAll(); - return $this->board->create($project_to, $columns); + return $this->boardModel->create($project_to, $columns); } /** @@ -103,8 +103,8 @@ class Board extends Base */ public function getBoard($project_id, $callback = null) { - $swimlanes = $this->swimlane->getSwimlanes($project_id); - $columns = $this->column->getAll($project_id); + $swimlanes = $this->swimlaneModel->getSwimlanes($project_id); + $columns = $this->columnModel->getAll($project_id); $nb_columns = count($columns); for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) { @@ -122,7 +122,7 @@ class Board extends Base $swimlanes[0]['columns'][$j]['total_score'] = 0; } - $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id); + $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinderModel->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id); $swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']); $swimlanes[$i]['columns'][$j]['score'] = $this->getColumnSum($swimlanes[$i]['columns'][$j]['tasks'], 'score'); $swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks']; @@ -164,7 +164,7 @@ class Board extends Base public function getColumnStats($project_id, $prepend = false) { $listing = $this->db - ->hashtable(Task::TABLE) + ->hashtable(TaskModel::TABLE) ->eq('project_id', $project_id) ->eq('is_active', 1) ->groupBy('column_id') diff --git a/app/Model/Category.php b/app/Model/CategoryModel.php index 00690a41..62fb5611 100644 --- a/app/Model/Category.php +++ b/app/Model/CategoryModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Category model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Category extends Base +class CategoryModel extends Base { /** * SQL table name @@ -125,7 +125,7 @@ class Category extends Base public function createDefaultCategories($project_id) { $results = array(); - $categories = explode(',', $this->config->get('project_categories')); + $categories = explode(',', $this->configModel->get('project_categories')); foreach ($categories as $category) { $category = trim($category); @@ -176,7 +176,7 @@ class Category extends Base { $this->db->startTransaction(); - $this->db->table(Task::TABLE)->eq('category_id', $category_id)->update(array('category_id' => 0)); + $this->db->table(TaskModel::TABLE)->eq('category_id', $category_id)->update(array('category_id' => 0)); if (! $this->db->table(self::TABLE)->eq('id', $category_id)->remove()) { $this->db->cancelTransaction(); diff --git a/app/Model/Color.php b/app/Model/ColorModel.php index 025ca669..9e69dda2 100644 --- a/app/Model/Color.php +++ b/app/Model/ColorModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Color model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Color extends Base +class ColorModel extends Base { /** * Default colors @@ -165,7 +165,7 @@ class Color extends Base */ public function getDefaultColor() { - return $this->config->get('default_color', 'yellow'); + return $this->configModel->get('default_color', 'yellow'); } /** diff --git a/app/Model/Column.php b/app/Model/ColumnModel.php index 329ff2d0..1adac0f2 100644 --- a/app/Model/Column.php +++ b/app/Model/ColumnModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Column Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Column extends Base +class ColumnModel extends Base { /** * SQL table name diff --git a/app/Model/Comment.php b/app/Model/CommentModel.php index 7d3e1d6e..6e5fd9d8 100644 --- a/app/Model/Comment.php +++ b/app/Model/CommentModel.php @@ -9,10 +9,10 @@ use Kanboard\Core\Base; /** * Comment model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Comment extends Base +class CommentModel extends Base { /** * SQL table name @@ -48,12 +48,12 @@ class Comment extends Base self::TABLE.'.task_id', self::TABLE.'.user_id', self::TABLE.'.comment', - User::TABLE.'.username', - User::TABLE.'.name', - User::TABLE.'.email', - User::TABLE.'.avatar_path' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.email', + UserModel::TABLE.'.avatar_path' ) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->orderBy(self::TABLE.'.date_creation', $sorting) ->eq(self::TABLE.'.task_id', $task_id) ->findAll(); @@ -77,12 +77,12 @@ class Comment extends Base self::TABLE.'.date_creation', self::TABLE.'.comment', self::TABLE.'.reference', - User::TABLE.'.username', - User::TABLE.'.name', - User::TABLE.'.email', - User::TABLE.'.avatar_path' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.email', + UserModel::TABLE.'.avatar_path' ) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->eq(self::TABLE.'.id', $comment_id) ->findOne(); } @@ -117,7 +117,7 @@ class Comment extends Base if ($comment_id) { $event = new CommentEvent(array('id' => $comment_id) + $values); $this->dispatcher->dispatch(self::EVENT_CREATE, $event); - $this->userMention->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event); + $this->userMentionModel->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event); } return $comment_id; diff --git a/app/Model/Config.php b/app/Model/ConfigModel.php index 1b14efa1..945c5e6f 100644 --- a/app/Model/Config.php +++ b/app/Model/ConfigModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Security\Token; /** * Config model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Config extends Setting +class ConfigModel extends SettingModel { /** * Get a config variable with in-memory caching diff --git a/app/Model/Currency.php b/app/Model/CurrencyModel.php index 7c8cadd4..bfd9697c 100644 --- a/app/Model/Currency.php +++ b/app/Model/CurrencyModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Currency * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Currency extends Base +class CurrencyModel extends Base { /** * SQL table name @@ -67,7 +67,7 @@ class Currency extends Base public function getPrice($currency, $price) { static $rates = null; - $reference = $this->config->get('application_currency', 'USD'); + $reference = $this->configModel->get('application_currency', 'USD'); if ($reference !== $currency) { $rates = $rates === null ? $this->db->hashtable(self::TABLE)->getAll('currency', 'rate') : $rates; diff --git a/app/Model/CustomFilter.php b/app/Model/CustomFilterModel.php index 9d409bd4..a4c23b5c 100644 --- a/app/Model/CustomFilter.php +++ b/app/Model/CustomFilterModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Custom Filter model * - * @package model + * @package Kanboard\Model * @author Timo Litzbarski */ -class CustomFilter extends Base +class CustomFilterModel extends Base { /** * SQL table name @@ -32,8 +32,8 @@ class CustomFilter extends Base return $this->db ->table(self::TABLE) ->columns( - User::TABLE.'.name as owner_name', - User::TABLE.'.username as owner_username', + UserModel::TABLE.'.name as owner_name', + UserModel::TABLE.'.username as owner_username', self::TABLE.'.id', self::TABLE.'.user_id', self::TABLE.'.project_id', @@ -43,7 +43,7 @@ class CustomFilter extends Base self::TABLE.'.append' ) ->asc(self::TABLE.'.name') - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->beginOr() ->eq('is_shared', 1) ->eq('user_id', $user_id) diff --git a/app/Model/File.php b/app/Model/FileModel.php index 92032110..ad839799 100644 --- a/app/Model/File.php +++ b/app/Model/FileModel.php @@ -11,10 +11,10 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException; /** * Base File Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -abstract class File extends Base +abstract class FileModel extends Base { /** * Get PicoDb query to get all files @@ -35,10 +35,10 @@ abstract class File extends Base static::TABLE.'.date', static::TABLE.'.user_id', static::TABLE.'.size', - User::TABLE.'.username', - User::TABLE.'.name as user_name' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name as user_name' ) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->asc(static::TABLE.'.name'); } diff --git a/app/Model/GroupMember.php b/app/Model/GroupMemberModel.php index a0bbb9f8..a2077789 100644 --- a/app/Model/GroupMember.php +++ b/app/Model/GroupMemberModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Group Member Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class GroupMember extends Base +class GroupMemberModel extends Base { /** * SQL table name @@ -29,7 +29,7 @@ class GroupMember extends Base public function getQuery($group_id) { return $this->db->table(self::TABLE) - ->join(User::TABLE, 'id', 'user_id') + ->join(UserModel::TABLE, 'id', 'user_id') ->eq('group_id', $group_id); } @@ -58,7 +58,7 @@ class GroupMember extends Base ->columns('user_id') ->eq('group_id', $group_id); - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->notInSubquery('id', $subquery) ->findAll(); } @@ -121,10 +121,10 @@ class GroupMember extends Base public function getGroups($user_id) { return $this->db->table(self::TABLE) - ->columns(Group::TABLE.'.id', Group::TABLE.'.external_id', Group::TABLE.'.name') - ->join(Group::TABLE, 'id', 'group_id') + ->columns(GroupModel::TABLE.'.id', GroupModel::TABLE.'.external_id', GroupModel::TABLE.'.name') + ->join(GroupModel::TABLE, 'id', 'group_id') ->eq(self::TABLE.'.user_id', $user_id) - ->asc(Group::TABLE.'.name') + ->asc(GroupModel::TABLE.'.name') ->findAll(); } } diff --git a/app/Model/Group.php b/app/Model/GroupModel.php index 25579206..0a975570 100644 --- a/app/Model/Group.php +++ b/app/Model/GroupModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Group Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Group extends Base +class GroupModel extends Base { /** * SQL table name diff --git a/app/Model/Language.php b/app/Model/LanguageModel.php index 126dc5c0..eb6de004 100644 --- a/app/Model/Language.php +++ b/app/Model/LanguageModel.php @@ -11,7 +11,7 @@ use Kanboard\Core\Translator; * @package Kanboard\Model * @author Frederic Guillot */ -class Language extends Base +class LanguageModel extends Base { /** * Get all language codes @@ -164,7 +164,7 @@ class Language extends Base return $this->sessionStorage->user['language']; } - return $this->config->get('application_language', 'en_US'); + return $this->configModel->get('application_language', 'en_US'); } /** diff --git a/app/Model/LastLogin.php b/app/Model/LastLoginModel.php index 35c7afc9..16821392 100644 --- a/app/Model/LastLogin.php +++ b/app/Model/LastLoginModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * LastLogin model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class LastLogin extends Base +class LastLoginModel extends Base { /** * SQL table name diff --git a/app/Model/Link.php b/app/Model/LinkModel.php index f275edae..b72c7532 100644 --- a/app/Model/Link.php +++ b/app/Model/LinkModel.php @@ -8,11 +8,11 @@ use Kanboard\Core\Base; /** * Link model * - * @package model + * @package Kanboard\Model * @author Olivier Maridat * @author Frederic Guillot */ -class Link extends Base +class LinkModel extends Base { /** * SQL table name diff --git a/app/Model/Metadata.php b/app/Model/MetadataModel.php index b39ce098..6177e5f3 100644 --- a/app/Model/Metadata.php +++ b/app/Model/MetadataModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -abstract class Metadata extends Base +abstract class MetadataModel extends Base { /** * Get the table diff --git a/app/Model/Notification.php b/app/Model/NotificationModel.php index 1e96a8b4..8937b77e 100644 --- a/app/Model/Notification.php +++ b/app/Model/NotificationModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Notification extends Base +class NotificationModel extends Base { /** * Get the event title with author @@ -24,7 +24,7 @@ class Notification extends Base public function getTitleWithAuthor($event_author, $event_name, array $event_data) { switch ($event_name) { - case Task::EVENT_ASSIGNEE_CHANGE: + case TaskModel::EVENT_ASSIGNEE_CHANGE: $assignee = $event_data['task']['assignee_name'] ?: $event_data['task']['assignee_username']; if (! empty($assignee)) { @@ -32,22 +32,22 @@ class Notification extends Base } return e('%s remove the assignee of the task %s', $event_author, e('#%d', $event_data['task']['id'])); - case Task::EVENT_UPDATE: + case TaskModel::EVENT_UPDATE: return e('%s updated the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_CREATE: + case TaskModel::EVENT_CREATE: return e('%s created the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_CLOSE: + case TaskModel::EVENT_CLOSE: return e('%s closed the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_OPEN: + case TaskModel::EVENT_OPEN: return e('%s open the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_MOVE_COLUMN: + case TaskModel::EVENT_MOVE_COLUMN: return e( '%s moved the task #%d to the column "%s"', $event_author, $event_data['task']['id'], $event_data['task']['column_title'] ); - case Task::EVENT_MOVE_POSITION: + case TaskModel::EVENT_MOVE_POSITION: return e( '%s moved the task #%d to the position %d in the column "%s"', $event_author, @@ -55,7 +55,7 @@ class Notification extends Base $event_data['task']['position'], $event_data['task']['column_title'] ); - case Task::EVENT_MOVE_SWIMLANE: + case TaskModel::EVENT_MOVE_SWIMLANE: if ($event_data['task']['swimlane_id'] == 0) { return e('%s moved the task #%d to the first swimlane', $event_author, $event_data['task']['id']); } @@ -66,19 +66,19 @@ class Notification extends Base $event_data['task']['id'], $event_data['task']['swimlane_name'] ); - case Subtask::EVENT_UPDATE: + case SubtaskModel::EVENT_UPDATE: return e('%s updated a subtask for the task #%d', $event_author, $event_data['task']['id']); - case Subtask::EVENT_CREATE: + case SubtaskModel::EVENT_CREATE: return e('%s created a subtask for the task #%d', $event_author, $event_data['task']['id']); - case Comment::EVENT_UPDATE: + case CommentModel::EVENT_UPDATE: return e('%s updated a comment on the task #%d', $event_author, $event_data['task']['id']); - case Comment::EVENT_CREATE: + case CommentModel::EVENT_CREATE: return e('%s commented on the task #%d', $event_author, $event_data['task']['id']); - case TaskFile::EVENT_CREATE: + case TaskFileModel::EVENT_CREATE: return e('%s attached a file to the task #%d', $event_author, $event_data['task']['id']); - case Task::EVENT_USER_MENTION: + case TaskModel::EVENT_USER_MENTION: return e('%s mentioned you in the task #%d', $event_author, $event_data['task']['id']); - case Comment::EVENT_USER_MENTION: + case CommentModel::EVENT_USER_MENTION: return e('%s mentioned you in a comment on the task #%d', $event_author, $event_data['task']['id']); default: return e('Notification'); @@ -96,38 +96,38 @@ class Notification extends Base public function getTitleWithoutAuthor($event_name, array $event_data) { switch ($event_name) { - case TaskFile::EVENT_CREATE: + case TaskFileModel::EVENT_CREATE: return e('New attachment on task #%d: %s', $event_data['file']['task_id'], $event_data['file']['name']); - case Comment::EVENT_CREATE: + case CommentModel::EVENT_CREATE: return e('New comment on task #%d', $event_data['comment']['task_id']); - case Comment::EVENT_UPDATE: + case CommentModel::EVENT_UPDATE: return e('Comment updated on task #%d', $event_data['comment']['task_id']); - case Subtask::EVENT_CREATE: + case SubtaskModel::EVENT_CREATE: return e('New subtask on task #%d', $event_data['subtask']['task_id']); - case Subtask::EVENT_UPDATE: + case SubtaskModel::EVENT_UPDATE: return e('Subtask updated on task #%d', $event_data['subtask']['task_id']); - case Task::EVENT_CREATE: + case TaskModel::EVENT_CREATE: return e('New task #%d: %s', $event_data['task']['id'], $event_data['task']['title']); - case Task::EVENT_UPDATE: + case TaskModel::EVENT_UPDATE: return e('Task updated #%d', $event_data['task']['id']); - case Task::EVENT_CLOSE: + case TaskModel::EVENT_CLOSE: return e('Task #%d closed', $event_data['task']['id']); - case Task::EVENT_OPEN: + case TaskModel::EVENT_OPEN: return e('Task #%d opened', $event_data['task']['id']); - case Task::EVENT_MOVE_COLUMN: + case TaskModel::EVENT_MOVE_COLUMN: return e('Column changed for task #%d', $event_data['task']['id']); - case Task::EVENT_MOVE_POSITION: + case TaskModel::EVENT_MOVE_POSITION: return e('New position for task #%d', $event_data['task']['id']); - case Task::EVENT_MOVE_SWIMLANE: + case TaskModel::EVENT_MOVE_SWIMLANE: return e('Swimlane changed for task #%d', $event_data['task']['id']); - case Task::EVENT_ASSIGNEE_CHANGE: + case TaskModel::EVENT_ASSIGNEE_CHANGE: return e('Assignee changed on task #%d', $event_data['task']['id']); - case Task::EVENT_OVERDUE: + case TaskModel::EVENT_OVERDUE: $nb = count($event_data['tasks']); return $nb > 1 ? e('%d overdue tasks', $nb) : e('Task #%d is overdue', $event_data['tasks'][0]['id']); - case Task::EVENT_USER_MENTION: + case TaskModel::EVENT_USER_MENTION: return e('You were mentioned in the task #%d', $event_data['task']['id']); - case Comment::EVENT_USER_MENTION: + case CommentModel::EVENT_USER_MENTION: return e('You were mentioned in a comment on the task #%d', $event_data['task']['id']); default: return e('Notification'); diff --git a/app/Model/NotificationType.php b/app/Model/NotificationTypeModel.php index a4dffa09..432832ee 100644 --- a/app/Model/NotificationType.php +++ b/app/Model/NotificationTypeModel.php @@ -11,7 +11,7 @@ use Kanboard\Core\Base; * @package model * @author Frederic Guillot */ -abstract class NotificationType extends Base +abstract class NotificationTypeModel extends Base { /** * Container @@ -57,7 +57,7 @@ abstract class NotificationType extends Base * @param string $label * @param string $class * @param boolean $hidden - * @return NotificationType + * @return NotificationTypeModel */ public function setType($type, $label, $class, $hidden = false) { @@ -81,7 +81,7 @@ abstract class NotificationType extends Base * * @access public * @param string $type - * @return \Kanboard\Notification\NotificationInterface + * @return \Kanboard\Core\Notification\NotificationInterface */ public function getType($type) { diff --git a/app/Model/PasswordReset.php b/app/Model/PasswordResetModel.php index 895acb07..d7c74969 100644 --- a/app/Model/PasswordReset.php +++ b/app/Model/PasswordResetModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Password Reset Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class PasswordReset extends Base +class PasswordResetModel extends Base { /** * SQL table name @@ -48,7 +48,7 @@ class PasswordReset extends Base */ public function create($username, $expiration = 0) { - $user_id = $this->db->table(User::TABLE)->eq('username', $username)->neq('email', '')->notNull('email')->findOneColumn('id'); + $user_id = $this->db->table(UserModel::TABLE)->eq('username', $username)->neq('email', '')->notNull('email')->findOneColumn('id'); if (! $user_id) { return false; diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivityModel.php index f6bdbf92..380ea125 100644 --- a/app/Model/ProjectActivity.php +++ b/app/Model/ProjectActivityModel.php @@ -8,10 +8,10 @@ use PicoDb\Table; /** * Project activity model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectActivity extends Base +class ProjectActivityModel extends Base { /** * SQL table name @@ -63,17 +63,17 @@ class ProjectActivity extends Base { return $this ->db - ->table(ProjectActivity::TABLE) + ->table(ProjectActivityModel::TABLE) ->columns( - ProjectActivity::TABLE.'.*', + ProjectActivityModel::TABLE.'.*', 'uc.username AS author_username', 'uc.name AS author_name', 'uc.email', 'uc.avatar_path' ) - ->join(Task::TABLE, 'id', 'task_id') - ->join(Project::TABLE, 'id', 'project_id') - ->left(User::TABLE, 'uc', 'id', ProjectActivity::TABLE, 'creator_id'); + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->left(UserModel::TABLE, 'uc', 'id', ProjectActivityModel::TABLE, 'creator_id'); } /** diff --git a/app/Model/ProjectDailyColumnStats.php b/app/Model/ProjectDailyColumnStatsModel.php index 38487c76..a0f14cf4 100644 --- a/app/Model/ProjectDailyColumnStats.php +++ b/app/Model/ProjectDailyColumnStatsModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Project Daily Column Stats * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectDailyColumnStats extends Base +class ProjectDailyColumnStatsModel extends Base { /** * SQL table name @@ -86,7 +86,7 @@ class ProjectDailyColumnStats extends Base */ public function getAggregatedMetrics($project_id, $from, $to, $field = 'total') { - $columns = $this->column->getList($project_id); + $columns = $this->columnModel->getList($project_id); $metrics = $this->getMetrics($project_id, $from, $to); return $this->buildAggregate($metrics, $columns, $field); } @@ -207,10 +207,10 @@ class ProjectDailyColumnStats extends Base */ private function getScoreByColumns($project_id) { - $stats = $this->db->table(Task::TABLE) + $stats = $this->db->table(TaskModel::TABLE) ->columns('column_id', 'SUM(score) AS score') ->eq('project_id', $project_id) - ->eq('is_active', Task::STATUS_OPEN) + ->eq('is_active', TaskModel::STATUS_OPEN) ->notNull('score') ->groupBy('column_id') ->findAll(); @@ -227,7 +227,7 @@ class ProjectDailyColumnStats extends Base */ private function getTotalByColumns($project_id) { - $stats = $this->db->table(Task::TABLE) + $stats = $this->db->table(TaskModel::TABLE) ->columns('column_id', 'COUNT(*) AS total') ->eq('project_id', $project_id) ->in('is_active', $this->getTaskStatusConfig()) @@ -245,10 +245,10 @@ class ProjectDailyColumnStats extends Base */ private function getTaskStatusConfig() { - if ($this->config->get('cfd_include_closed_tasks') == 1) { - return array(Task::STATUS_OPEN, Task::STATUS_CLOSED); + if ($this->configModel->get('cfd_include_closed_tasks') == 1) { + return array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED); } - return array(Task::STATUS_OPEN); + return array(TaskModel::STATUS_OPEN); } } diff --git a/app/Model/ProjectDailyStats.php b/app/Model/ProjectDailyStatsModel.php index 08a0039e..0754d263 100644 --- a/app/Model/ProjectDailyStats.php +++ b/app/Model/ProjectDailyStatsModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Project Daily Stats * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectDailyStats extends Base +class ProjectDailyStatsModel extends Base { /** * SQL table name diff --git a/app/Model/ProjectDuplication.php b/app/Model/ProjectDuplicationModel.php index 871cadc8..b67f8302 100644 --- a/app/Model/ProjectDuplication.php +++ b/app/Model/ProjectDuplicationModel.php @@ -8,11 +8,11 @@ use Kanboard\Core\Security\Role; /** * Project Duplication * - * @package model + * @package Kanboard\Model * @author Frederic Guillot * @author Antonio Rabelo */ -class ProjectDuplication extends Base +class ProjectDuplicationModel extends Base { /** * Get list of optional models to duplicate @@ -22,7 +22,7 @@ class ProjectDuplication extends Base */ public function getOptionalSelection() { - return array('category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata'); + return array('categoryModel', 'projectPermissionModel', 'actionModel', 'swimlaneModel', 'taskModel', 'projectMetadataModel'); } /** @@ -33,7 +33,7 @@ class ProjectDuplication extends Base */ public function getPossibleSelection() { - return array('board', 'category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata'); + return array('boardModel', 'categoryModel', 'projectPermissionModel', 'actionModel', 'swimlaneModel', 'taskModel', 'projectMetadataModel'); } /** @@ -65,7 +65,7 @@ class ProjectDuplication extends Base * @param boolean $private Force the project to be private * @return integer Cloned Project Id */ - public function duplicate($src_project_id, $selection = array('projectPermission', 'category', 'action'), $owner_id = 0, $name = null, $private = null) + public function duplicate($src_project_id, $selection = array('projectPermissionModel', 'categoryModel', 'actionModel'), $owner_id = 0, $name = null, $private = null) { $this->db->startTransaction(); @@ -86,7 +86,7 @@ class ProjectDuplication extends Base } // Skip permissions for private projects - if ($private && $model === 'projectPermission') { + if ($private && $model === 'projectPermissionModel') { continue; } @@ -118,7 +118,7 @@ class ProjectDuplication extends Base */ private function copy($src_project_id, $owner_id = 0, $name = null, $private = null) { - $project = $this->project->getById($src_project_id); + $project = $this->projectModel->getById($src_project_id); $is_private = empty($project['is_private']) ? 0 : 1; $values = array( @@ -131,7 +131,7 @@ class ProjectDuplication extends Base 'owner_id' => $owner_id, ); - if (! $this->db->table(Project::TABLE)->save($values)) { + if (! $this->db->table(ProjectModel::TABLE)->save($values)) { return false; } @@ -149,9 +149,9 @@ class ProjectDuplication extends Base private function makeOwnerManager($dst_project_id, $owner_id) { if ($owner_id > 0) { - $this->projectUserRole->removeUser($dst_project_id, $owner_id); + $this->projectUserRoleModel->removeUser($dst_project_id, $owner_id); - if (! $this->projectUserRole->addUser($dst_project_id, $owner_id, Role::PROJECT_MANAGER)) { + if (! $this->projectUserRoleModel->addUser($dst_project_id, $owner_id, Role::PROJECT_MANAGER)) { return false; } } diff --git a/app/Model/ProjectFile.php b/app/Model/ProjectFileModel.php index 75348e0c..2177df27 100644 --- a/app/Model/ProjectFile.php +++ b/app/Model/ProjectFileModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * Project File Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectFile extends File +class ProjectFileModel extends FileModel { /** * SQL table name diff --git a/app/Model/ProjectGroupRole.php b/app/Model/ProjectGroupRoleModel.php index 3ce2b1dc..2729d5a6 100644 --- a/app/Model/ProjectGroupRole.php +++ b/app/Model/ProjectGroupRoleModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Security\Role; /** * Project Group Role * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectGroupRole extends Base +class ProjectGroupRoleModel extends Base { /** * SQL table name @@ -28,15 +28,15 @@ class ProjectGroupRole extends Base * @param array $status * @return array */ - public function getProjectsByUser($user_id, $status = array(Project::ACTIVE, Project::INACTIVE)) + public function getProjectsByUser($user_id, $status = array(ProjectModel::ACTIVE, ProjectModel::INACTIVE)) { return $this->db - ->hashtable(Project::TABLE) + ->hashtable(ProjectModel::TABLE) ->join(self::TABLE, 'project_id', 'id') - ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE) - ->eq(GroupMember::TABLE.'.user_id', $user_id) - ->in(Project::TABLE.'.is_active', $status) - ->getAll(Project::TABLE.'.id', Project::TABLE.'.name'); + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE) + ->eq(GroupMemberModel::TABLE.'.user_id', $user_id) + ->in(ProjectModel::TABLE.'.is_active', $status) + ->getAll(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name'); } /** @@ -50,8 +50,8 @@ class ProjectGroupRole extends Base public function getUserRole($project_id, $user_id) { $roles = $this->db->table(self::TABLE) - ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE) - ->eq(GroupMember::TABLE.'.user_id', $user_id) + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE) + ->eq(GroupMemberModel::TABLE.'.user_id', $user_id) ->eq(self::TABLE.'.project_id', $project_id) ->findAllByColumn('role'); @@ -68,8 +68,8 @@ class ProjectGroupRole extends Base public function getGroups($project_id) { return $this->db->table(self::TABLE) - ->columns(Group::TABLE.'.id', Group::TABLE.'.name', self::TABLE.'.role') - ->join(Group::TABLE, 'id', 'group_id') + ->columns(GroupModel::TABLE.'.id', GroupModel::TABLE.'.name', self::TABLE.'.role') + ->join(GroupModel::TABLE, 'id', 'group_id') ->eq('project_id', $project_id) ->asc('name') ->findAll(); @@ -85,11 +85,11 @@ class ProjectGroupRole extends Base public function getUsers($project_id) { return $this->db->table(self::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', self::TABLE.'.role') - ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE) - ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', self::TABLE.'.role') + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE) ->eq(self::TABLE.'.project_id', $project_id) - ->asc(User::TABLE.'.username') + ->asc(UserModel::TABLE.'.username') ->findAll(); } @@ -102,14 +102,14 @@ class ProjectGroupRole extends Base */ public function getAssignableUsers($project_id) { - return $this->db->table(User::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name') - ->join(GroupMember::TABLE, 'user_id', 'id', User::TABLE) - ->join(self::TABLE, 'group_id', 'group_id', GroupMember::TABLE) + return $this->db->table(UserModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name') + ->join(GroupMemberModel::TABLE, 'user_id', 'id', UserModel::TABLE) + ->join(self::TABLE, 'group_id', 'group_id', GroupMemberModel::TABLE) ->eq(self::TABLE.'.project_id', $project_id) - ->eq(User::TABLE.'.is_active', 1) + ->eq(UserModel::TABLE.'.is_active', 1) ->in(self::TABLE.'.role', array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER)) - ->asc(User::TABLE.'.username') + ->asc(UserModel::TABLE.'.username') ->findAll(); } diff --git a/app/Model/ProjectMetadata.php b/app/Model/ProjectMetadataModel.php index c8e4fe63..760acd7d 100644 --- a/app/Model/ProjectMetadata.php +++ b/app/Model/ProjectMetadataModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * Project Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectMetadata extends Metadata +class ProjectMetadataModel extends MetadataModel { /** * Get the table diff --git a/app/Model/Project.php b/app/Model/ProjectModel.php index 2cb0a431..34e11c13 100644 --- a/app/Model/Project.php +++ b/app/Model/ProjectModel.php @@ -9,10 +9,10 @@ use Kanboard\Core\Security\Role; /** * Project model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Project extends Base +class ProjectModel extends Base { /** * SQL table name for projects @@ -71,9 +71,9 @@ class Project extends Base public function getByIdWithOwner($project_id) { return $this->db->table(self::TABLE) - ->columns(self::TABLE.'.*', User::TABLE.'.username AS owner_username', User::TABLE.'.name AS owner_name') + ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name') ->eq(self::TABLE.'.id', $project_id) - ->join(User::TABLE, 'id', 'owner_id') + ->join(UserModel::TABLE, 'id', 'owner_id') ->findOne(); } @@ -269,8 +269,8 @@ class Project extends Base { $stats = array(); $stats['nb_active_tasks'] = 0; - $columns = $this->column->getAll($project_id); - $column_stats = $this->board->getColumnStats($project_id); + $columns = $this->columnModel->getAll($project_id); + $column_stats = $this->boardModel->getColumnStats($project_id); foreach ($columns as &$column) { $column['nb_active_tasks'] = isset($column_stats[$column['id']]) ? $column_stats[$column['id']] : 0; @@ -278,7 +278,7 @@ class Project extends Base } $stats['columns'] = $columns; - $stats['nb_tasks'] = $this->taskFinder->countByProjectId($project_id); + $stats['nb_tasks'] = $this->taskFinderModel->countByProjectId($project_id); $stats['nb_inactive_tasks'] = $stats['nb_tasks'] - $stats['nb_active_tasks']; return $stats; @@ -293,8 +293,8 @@ class Project extends Base */ public function getColumnStats(array &$project) { - $project['columns'] = $this->column->getAll($project['id']); - $stats = $this->board->getColumnStats($project['id']); + $project['columns'] = $this->columnModel->getAll($project['id']); + $stats = $this->boardModel->getColumnStats($project['id']); foreach ($project['columns'] as &$column) { $column['nb_tasks'] = isset($stats[$column['id']]) ? $stats[$column['id']] : 0; @@ -329,13 +329,13 @@ class Project extends Base public function getQueryColumnStats(array $project_ids) { if (empty($project_ids)) { - return $this->db->table(Project::TABLE)->limit(0); + return $this->db->table(ProjectModel::TABLE)->limit(0); } return $this->db - ->table(Project::TABLE) - ->columns(self::TABLE.'.*', User::TABLE.'.username AS owner_username', User::TABLE.'.name AS owner_name') - ->join(User::TABLE, 'id', 'owner_id') + ->table(ProjectModel::TABLE) + ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name') + ->join(UserModel::TABLE, 'id', 'owner_id') ->in(self::TABLE.'.id', $project_ids) ->callback(array($this, 'applyColumnStats')); } @@ -371,16 +371,16 @@ class Project extends Base $project_id = $this->db->getLastId(); - if (! $this->board->create($project_id, $this->board->getUserColumns())) { + if (! $this->boardModel->create($project_id, $this->boardModel->getUserColumns())) { $this->db->cancelTransaction(); return false; } if ($add_user && $user_id) { - $this->projectUserRole->addUser($project_id, $user_id, Role::PROJECT_MANAGER); + $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MANAGER); } - $this->category->createDefaultCategories($project_id); + $this->categoryModel->createDefaultCategories($project_id); $this->db->closeTransaction(); diff --git a/app/Model/ProjectNotification.php b/app/Model/ProjectNotificationModel.php index 5df042ca..aeeee4cd 100644 --- a/app/Model/ProjectNotification.php +++ b/app/Model/ProjectNotificationModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Project Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectNotification extends Base +class ProjectNotificationModel extends Base { /** * Send notifications @@ -22,15 +22,15 @@ class ProjectNotification extends Base */ public function sendNotifications($project_id, $event_name, array $event_data) { - $project = $this->project->getById($project_id); + $project = $this->projectModel->getById($project_id); $types = array_merge( - $this->projectNotificationType->getHiddenTypes(), - $this->projectNotificationType->getSelectedTypes($project_id) + $this->projectNotificationTypeModel->getHiddenTypes(), + $this->projectNotificationTypeModel->getSelectedTypes($project_id) ); foreach ($types as $type) { - $this->projectNotificationType->getType($type)->notifyProject($project, $event_name, $event_data); + $this->projectNotificationTypeModel->getType($type)->notifyProject($project, $event_name, $event_data); } } @@ -46,7 +46,7 @@ class ProjectNotification extends Base $this->db->startTransaction(); $types = empty($values['notification_types']) ? array() : array_keys($values['notification_types']); - $this->projectNotificationType->saveSelectedTypes($project_id, $types); + $this->projectNotificationTypeModel->saveSelectedTypes($project_id, $types); $this->db->closeTransaction(); } @@ -61,7 +61,7 @@ class ProjectNotification extends Base public function readSettings($project_id) { return array( - 'notification_types' => $this->projectNotificationType->getSelectedTypes($project_id), + 'notification_types' => $this->projectNotificationTypeModel->getSelectedTypes($project_id), ); } } diff --git a/app/Model/ProjectNotificationType.php b/app/Model/ProjectNotificationTypeModel.php index a00e465c..aeec77f2 100644 --- a/app/Model/ProjectNotificationType.php +++ b/app/Model/ProjectNotificationTypeModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * Project Notification Type * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectNotificationType extends NotificationType +class ProjectNotificationTypeModel extends NotificationTypeModel { /** * SQL table name diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermissionModel.php index bc35c956..a7c1857c 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermissionModel.php @@ -12,10 +12,10 @@ use Kanboard\Filter\ProjectUserRoleUsernameFilter; /** * Project Permission * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectPermission extends Base +class ProjectPermissionModel extends Base { /** * Get query for project users overview @@ -33,18 +33,18 @@ class ProjectPermission extends Base return $this ->db - ->table(ProjectUserRole::TABLE) - ->join(User::TABLE, 'id', 'user_id') - ->join(Project::TABLE, 'id', 'project_id') - ->eq(ProjectUserRole::TABLE.'.role', $role) - ->eq(Project::TABLE.'.is_private', 0) - ->in(Project::TABLE.'.id', $project_ids) + ->table(ProjectUserRoleModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id') + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->eq(ProjectUserRoleModel::TABLE.'.role', $role) + ->eq(ProjectModel::TABLE.'.is_private', 0) + ->in(ProjectModel::TABLE.'.id', $project_ids) ->columns( - User::TABLE.'.id', - User::TABLE.'.username', - User::TABLE.'.name', - Project::TABLE.'.name AS project_name', - Project::TABLE.'.id' + UserModel::TABLE.'.id', + UserModel::TABLE.'.username', + UserModel::TABLE.'.name', + ProjectModel::TABLE.'.name AS project_name', + ProjectModel::TABLE.'.id' ); } @@ -87,7 +87,7 @@ class ProjectPermission extends Base public function isEverybodyAllowed($project_id) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->eq('is_everybody_allowed', 1) ->exists(); @@ -107,7 +107,7 @@ class ProjectPermission extends Base } return in_array( - $this->projectUserRole->getUserRole($project_id, $user_id), + $this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER, Role::PROJECT_VIEWER) ); } @@ -122,8 +122,8 @@ class ProjectPermission extends Base */ public function isAssignable($project_id, $user_id) { - return $this->user->isActive($user_id) && - in_array($this->projectUserRole->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER)); + return $this->userModel->isActive($user_id) && + in_array($this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER)); } /** @@ -136,7 +136,7 @@ class ProjectPermission extends Base */ public function isMember($project_id, $user_id) { - return in_array($this->projectUserRole->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER, Role::PROJECT_VIEWER)); + return in_array($this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER, Role::PROJECT_VIEWER)); } /** @@ -148,7 +148,7 @@ class ProjectPermission extends Base */ public function getActiveProjectIds($user_id) { - return array_keys($this->projectUserRole->getActiveProjectsByUser($user_id)); + return array_keys($this->projectUserRoleModel->getActiveProjectsByUser($user_id)); } /** @@ -160,7 +160,7 @@ class ProjectPermission extends Base */ public function duplicate($project_src_id, $project_dst_id) { - return $this->projectUserRole->duplicate($project_src_id, $project_dst_id) && - $this->projectGroupRole->duplicate($project_src_id, $project_dst_id); + return $this->projectUserRoleModel->duplicate($project_src_id, $project_dst_id) && + $this->projectGroupRoleModel->duplicate($project_src_id, $project_dst_id); } } diff --git a/app/Model/ProjectUserRole.php b/app/Model/ProjectUserRoleModel.php index 05f96c6e..a0df0cfa 100644 --- a/app/Model/ProjectUserRole.php +++ b/app/Model/ProjectUserRoleModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Security\Role; /** * Project User Role * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectUserRole extends Base +class ProjectUserRoleModel extends Base { /** * SQL table name @@ -29,7 +29,7 @@ class ProjectUserRole extends Base */ public function getActiveProjectsByUser($user_id) { - return $this->getProjectsByUser($user_id, array(Project::ACTIVE)); + return $this->getProjectsByUser($user_id, array(ProjectModel::ACTIVE)); } /** @@ -40,19 +40,19 @@ class ProjectUserRole extends Base * @param array $status * @return array */ - public function getProjectsByUser($user_id, $status = array(Project::ACTIVE, Project::INACTIVE)) + public function getProjectsByUser($user_id, $status = array(ProjectModel::ACTIVE, ProjectModel::INACTIVE)) { $userProjects = $this->db - ->hashtable(Project::TABLE) + ->hashtable(ProjectModel::TABLE) ->beginOr() ->eq(self::TABLE.'.user_id', $user_id) - ->eq(Project::TABLE.'.is_everybody_allowed', 1) + ->eq(ProjectModel::TABLE.'.is_everybody_allowed', 1) ->closeOr() - ->in(Project::TABLE.'.is_active', $status) + ->in(ProjectModel::TABLE.'.is_active', $status) ->join(self::TABLE, 'project_id', 'id') - ->getAll(Project::TABLE.'.id', Project::TABLE.'.name'); + ->getAll(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name'); - $groupProjects = $this->projectGroupRole->getProjectsByUser($user_id, $status); + $groupProjects = $this->projectGroupRoleModel->getProjectsByUser($user_id, $status); $projects = $userProjects + $groupProjects; asort($projects); @@ -70,7 +70,7 @@ class ProjectUserRole extends Base */ public function getUserRole($project_id, $user_id) { - $projectInfo = $this->db->table(Project::TABLE) + $projectInfo = $this->db->table(ProjectModel::TABLE) ->eq('id', $project_id) ->columns('owner_id', 'is_everybody_allowed') ->findOne(); @@ -82,7 +82,7 @@ class ProjectUserRole extends Base $role = $this->db->table(self::TABLE)->eq('user_id', $user_id)->eq('project_id', $project_id)->findOneColumn('role'); if (empty($role)) { - $role = $this->projectGroupRole->getUserRole($project_id, $user_id); + $role = $this->projectGroupRoleModel->getUserRole($project_id, $user_id); } return $role; @@ -98,11 +98,11 @@ class ProjectUserRole extends Base public function getUsers($project_id) { return $this->db->table(self::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', self::TABLE.'.role') - ->join(User::TABLE, 'id', 'user_id') + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', self::TABLE.'.role') + ->join(UserModel::TABLE, 'id', 'user_id') ->eq('project_id', $project_id) - ->asc(User::TABLE.'.username') - ->asc(User::TABLE.'.name') + ->asc(UserModel::TABLE.'.username') + ->asc(UserModel::TABLE.'.name') ->findAll(); } @@ -116,10 +116,10 @@ class ProjectUserRole extends Base public function getAllUsers($project_id) { $userMembers = $this->getUsers($project_id); - $groupMembers = $this->projectGroupRole->getUsers($project_id); + $groupMembers = $this->projectGroupRoleModel->getUsers($project_id); $members = array_merge($userMembers, $groupMembers); - return $this->user->prepareList($members); + return $this->userModel->prepareList($members); } /** @@ -134,7 +134,7 @@ class ProjectUserRole extends Base $users = array(); $userMembers = $this->getUsers($project_id); - $groupMembers = $this->projectGroupRole->getUsers($project_id); + $groupMembers = $this->projectGroupRoleModel->getUsers($project_id); $members = array_merge($userMembers, $groupMembers); foreach ($members as $user) { @@ -157,22 +157,22 @@ class ProjectUserRole extends Base */ public function getAssignableUsers($project_id) { - if ($this->projectPermission->isEverybodyAllowed($project_id)) { - return $this->user->getActiveUsersList(); + if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) { + return $this->userModel->getActiveUsersList(); } $userMembers = $this->db->table(self::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name') - ->join(User::TABLE, 'id', 'user_id') - ->eq(User::TABLE.'.is_active', 1) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name') + ->join(UserModel::TABLE, 'id', 'user_id') + ->eq(UserModel::TABLE.'.is_active', 1) ->eq(self::TABLE.'.project_id', $project_id) ->in(self::TABLE.'.role', array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER)) ->findAll(); - $groupMembers = $this->projectGroupRole->getAssignableUsers($project_id); + $groupMembers = $this->projectGroupRoleModel->getAssignableUsers($project_id); $members = array_merge($userMembers, $groupMembers); - return $this->user->prepareList($members); + return $this->userModel->prepareList($members); } /** @@ -198,7 +198,7 @@ class ProjectUserRole extends Base } if ($everybody) { - $users = array(User::EVERYBODY_ID => t('Everybody')) + $users; + $users = array(UserModel::EVERYBODY_ID => t('Everybody')) + $users; } return $users; diff --git a/app/Model/RememberMeSession.php b/app/Model/RememberMeSessionModel.php index e3f2f132..f6c8d648 100644 --- a/app/Model/RememberMeSession.php +++ b/app/Model/RememberMeSessionModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Security\Token; /** * Remember Me Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class RememberMeSession extends Base +class RememberMeSessionModel extends Base { /** * SQL table name diff --git a/app/Model/Setting.php b/app/Model/SettingModel.php index 38af22e0..5b2ee54f 100644 --- a/app/Model/Setting.php +++ b/app/Model/SettingModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Application Settings * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -abstract class Setting extends Base +abstract class SettingModel extends Base { /** * SQL table name diff --git a/app/Model/Subtask.php b/app/Model/SubtaskModel.php index 1d53d6de..b63cf0a1 100644 --- a/app/Model/Subtask.php +++ b/app/Model/SubtaskModel.php @@ -9,10 +9,10 @@ use Kanboard\Event\SubtaskEvent; /** * Subtask Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Subtask extends Base +class SubtaskModel extends Base { /** * SQL table name @@ -96,20 +96,20 @@ class Subtask extends Base */ public function getUserQuery($user_id, array $status) { - return $this->db->table(Subtask::TABLE) + return $this->db->table(SubtaskModel::TABLE) ->columns( - Subtask::TABLE.'.*', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id', - Task::TABLE.'.title AS task_name', - Project::TABLE.'.name AS project_name' + SubtaskModel::TABLE.'.*', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id', + TaskModel::TABLE.'.title AS task_name', + ProjectModel::TABLE.'.name AS project_name' ) - ->subquery($this->subtaskTimeTracking->getTimerQuery($user_id), 'timer_start_date') + ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($user_id), 'timer_start_date') ->eq('user_id', $user_id) - ->eq(Project::TABLE.'.is_active', Project::ACTIVE) - ->in(Subtask::TABLE.'.status', $status) - ->join(Task::TABLE, 'id', 'task_id') - ->join(Project::TABLE, 'id', 'project_id', Task::TABLE) + ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE) + ->in(SubtaskModel::TABLE.'.status', $status) + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE) ->callback(array($this, 'addStatusName')); } @@ -127,11 +127,11 @@ class Subtask extends Base ->eq('task_id', $task_id) ->columns( self::TABLE.'.*', - User::TABLE.'.username', - User::TABLE.'.name' + UserModel::TABLE.'.username', + UserModel::TABLE.'.name' ) - ->subquery($this->subtaskTimeTracking->getTimerQuery($this->userSession->getId()), 'timer_start_date') - ->join(User::TABLE, 'id', 'user_id') + ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date') + ->join(UserModel::TABLE, 'id', 'user_id') ->asc(self::TABLE.'.position') ->callback(array($this, 'addStatusName')) ->findAll(); @@ -151,9 +151,9 @@ class Subtask extends Base return $this->db ->table(self::TABLE) ->eq(self::TABLE.'.id', $subtask_id) - ->columns(self::TABLE.'.*', User::TABLE.'.username', User::TABLE.'.name') - ->subquery($this->subtaskTimeTracking->getTimerQuery($this->userSession->getId()), 'timer_start_date') - ->join(User::TABLE, 'id', 'user_id') + ->columns(self::TABLE.'.*', UserModel::TABLE.'.username', UserModel::TABLE.'.name') + ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date') + ->join(UserModel::TABLE, 'id', 'user_id') ->callback(array($this, 'addStatusName')) ->findOne(); } @@ -345,7 +345,7 @@ class Subtask extends Base */ public function hasSubtaskInProgress($user_id) { - return $this->config->get('subtask_restriction') == 1 && + return $this->configModel->get('subtask_restriction') == 1 && $this->db->table(self::TABLE) ->eq('status', self::STATUS_INPROGRESS) ->eq('user_id', $user_id) @@ -383,7 +383,7 @@ class Subtask extends Base { return $this->db->transaction(function (Database $db) use ($src_task_id, $dst_task_id) { - $subtasks = $db->table(Subtask::TABLE) + $subtasks = $db->table(SubtaskModel::TABLE) ->columns('title', 'time_estimated', 'position') ->eq('task_id', $src_task_id) ->asc('position') @@ -392,7 +392,7 @@ class Subtask extends Base foreach ($subtasks as &$subtask) { $subtask['task_id'] = $dst_task_id; - if (! $db->table(Subtask::TABLE)->save($subtask)) { + if (! $db->table(SubtaskModel::TABLE)->save($subtask)) { return false; } } @@ -411,7 +411,7 @@ class Subtask extends Base { $subtask = $this->getById($subtask_id); - $task_id = $this->taskCreation->create(array( + $task_id = $this->taskCreationModel->create(array( 'project_id' => $project_id, 'title' => $subtask['title'], 'time_estimated' => $subtask['time_estimated'], diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTrackingModel.php index 8b5d2545..062e594a 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTrackingModel.php @@ -6,12 +6,12 @@ use DateTime; use Kanboard\Core\Base; /** - * Subtask timesheet + * Subtask time tracking * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class SubtaskTimeTracking extends Base +class SubtaskTimeTrackingModel extends Base { /** * SQL table name @@ -37,7 +37,7 @@ class SubtaskTimeTracking extends Base $user_id, $this->db->escapeIdentifier('end'), $this->db->escapeIdentifier('subtask_id'), - Subtask::TABLE.'.id' + SubtaskModel::TABLE.'.id' ); } @@ -58,14 +58,14 @@ class SubtaskTimeTracking extends Base self::TABLE.'.end', self::TABLE.'.start', self::TABLE.'.time_spent', - Subtask::TABLE.'.task_id', - Subtask::TABLE.'.title AS subtask_title', - Task::TABLE.'.title AS task_title', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id' + SubtaskModel::TABLE.'.task_id', + SubtaskModel::TABLE.'.title AS subtask_title', + TaskModel::TABLE.'.title AS task_title', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id' ) - ->join(Subtask::TABLE, 'id', 'subtask_id') - ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE) + ->join(SubtaskModel::TABLE, 'id', 'subtask_id') + ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE) ->eq(self::TABLE.'.user_id', $user_id); } @@ -87,16 +87,16 @@ class SubtaskTimeTracking extends Base self::TABLE.'.start', self::TABLE.'.time_spent', self::TABLE.'.user_id', - Subtask::TABLE.'.task_id', - Subtask::TABLE.'.title AS subtask_title', - Task::TABLE.'.project_id', - User::TABLE.'.username', - User::TABLE.'.name AS user_fullname' + SubtaskModel::TABLE.'.task_id', + SubtaskModel::TABLE.'.title AS subtask_title', + TaskModel::TABLE.'.project_id', + UserModel::TABLE.'.username', + UserModel::TABLE.'.name AS user_fullname' ) - ->join(Subtask::TABLE, 'id', 'subtask_id') - ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE) - ->join(User::TABLE, 'id', 'user_id', self::TABLE) - ->eq(Task::TABLE.'.id', $task_id); + ->join(SubtaskModel::TABLE, 'id', 'subtask_id') + ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', self::TABLE) + ->eq(TaskModel::TABLE.'.id', $task_id); } /** @@ -117,17 +117,17 @@ class SubtaskTimeTracking extends Base self::TABLE.'.start', self::TABLE.'.time_spent', self::TABLE.'.user_id', - Subtask::TABLE.'.task_id', - Subtask::TABLE.'.title AS subtask_title', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id', - User::TABLE.'.username', - User::TABLE.'.name AS user_fullname' + SubtaskModel::TABLE.'.task_id', + SubtaskModel::TABLE.'.title AS subtask_title', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id', + UserModel::TABLE.'.username', + UserModel::TABLE.'.name AS user_fullname' ) - ->join(Subtask::TABLE, 'id', 'subtask_id') - ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE) - ->join(User::TABLE, 'id', 'user_id', self::TABLE) - ->eq(Task::TABLE.'.project_id', $project_id) + ->join(SubtaskModel::TABLE, 'id', 'subtask_id') + ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', self::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project_id) ->asc(self::TABLE.'.id'); } @@ -250,10 +250,10 @@ class SubtaskTimeTracking extends Base */ public function updateSubtaskTimeSpent($subtask_id, $time_spent) { - $subtask = $this->subtask->getById($subtask_id); + $subtask = $this->subtaskModel->getById($subtask_id); // Fire the event subtask.update - return $this->subtask->update(array( + return $this->subtaskModel->update(array( 'id' => $subtask['id'], 'time_spent' => $subtask['time_spent'] + $time_spent, 'task_id' => $subtask['task_id'], @@ -272,7 +272,7 @@ class SubtaskTimeTracking extends Base $values = $this->calculateSubtaskTime($task_id); return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->update($values); } @@ -287,7 +287,7 @@ class SubtaskTimeTracking extends Base public function calculateSubtaskTime($task_id) { return $this->db - ->table(Subtask::TABLE) + ->table(SubtaskModel::TABLE) ->eq('task_id', $task_id) ->columns( 'SUM(time_spent) AS time_spent', diff --git a/app/Model/Swimlane.php b/app/Model/SwimlaneModel.php index 8efe68da..87591b99 100644 --- a/app/Model/Swimlane.php +++ b/app/Model/SwimlaneModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Swimlanes * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Swimlane extends Base +class SwimlaneModel extends Base { /** * SQL table name @@ -99,7 +99,7 @@ class Swimlane extends Base public function getDefault($project_id) { $result = $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->columns('id', 'default_swimlane', 'show_default_swimlane') ->findOne(); @@ -169,7 +169,7 @@ class Swimlane extends Base ->findAll(); $default_swimlane = $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->eq('show_default_swimlane', 1) ->findOneColumn('default_swimlane'); @@ -197,7 +197,7 @@ class Swimlane extends Base public function getList($project_id, $prepend = false, $only_active = false) { $swimlanes = array(); - $default = $this->db->table(Project::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane'); + $default = $this->db->table(ProjectModel::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane'); if ($prepend) { $swimlanes[-1] = t('All swimlanes'); @@ -224,7 +224,7 @@ class Swimlane extends Base */ public function create($values) { - if (! $this->project->exists($values['project_id'])) { + if (! $this->projectModel->exists($values['project_id'])) { return 0; } @@ -257,7 +257,7 @@ class Swimlane extends Base public function updateDefault(array $values) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $values['id']) ->update(array( 'default_swimlane' => $values['default_swimlane'], @@ -275,7 +275,7 @@ class Swimlane extends Base public function enableDefault($project_id) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->update(array( 'show_default_swimlane' => 1, @@ -292,7 +292,7 @@ class Swimlane extends Base public function disableDefault($project_id) { return $this->db - ->table(Project::TABLE) + ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->update(array( 'show_default_swimlane' => 0, @@ -373,7 +373,7 @@ class Swimlane extends Base $this->db->startTransaction(); // Tasks should not be assigned anymore to this swimlane - $this->db->table(Task::TABLE)->eq('swimlane_id', $swimlane_id)->update(array('swimlane_id' => 0)); + $this->db->table(TaskModel::TABLE)->eq('swimlane_id', $swimlane_id)->update(array('swimlane_id' => 0)); if (! $this->db->table(self::TABLE)->eq('id', $swimlane_id)->remove()) { $this->db->cancelTransaction(); diff --git a/app/Model/TaskAnalytic.php b/app/Model/TaskAnalyticModel.php index bf118b4e..3d6fe8a8 100644 --- a/app/Model/TaskAnalytic.php +++ b/app/Model/TaskAnalyticModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Task Analytic * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskAnalytic extends Base +class TaskAnalyticModel extends Base { /** * Get the time between date_creation and date_completed or now if empty @@ -50,8 +50,8 @@ class TaskAnalytic extends Base public function getTimeSpentByColumn(array $task) { $result = array(); - $columns = $this->column->getList($task['project_id']); - $sums = $this->transition->getTimeSpentByTask($task['id']); + $columns = $this->columnModel->getList($task['project_id']); + $sums = $this->transitionModel->getTimeSpentByTask($task['id']); foreach ($columns as $column_id => $column_title) { $time_spent = isset($sums[$column_id]) ? $sums[$column_id] : 0; diff --git a/app/Model/TaskCreation.php b/app/Model/TaskCreationModel.php index 2abfd95c..3800f831 100644 --- a/app/Model/TaskCreation.php +++ b/app/Model/TaskCreationModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Creation * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskCreation extends Base +class TaskCreationModel extends Base { /** * Create a task @@ -22,18 +22,18 @@ class TaskCreation extends Base */ public function create(array $values) { - if (! $this->project->exists($values['project_id'])) { + if (! $this->projectModel->exists($values['project_id'])) { return 0; } $position = empty($values['position']) ? 0 : $values['position']; $this->prepare($values); - $task_id = $this->db->table(Task::TABLE)->persist($values); + $task_id = $this->db->table(TaskModel::TABLE)->persist($values); if ($task_id !== false) { if ($position > 0 && $values['position'] > 1) { - $this->taskPosition->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false); + $this->taskPositionModel->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false); } $this->fireEvents($task_id, $values); @@ -57,11 +57,11 @@ class TaskCreation extends Base $this->helper->model->resetFields($values, array('date_started', 'creator_id', 'owner_id', 'swimlane_id', 'date_due', 'score', 'category_id', 'time_estimated')); if (empty($values['column_id'])) { - $values['column_id'] = $this->column->getFirstColumnId($values['project_id']); + $values['column_id'] = $this->columnModel->getFirstColumnId($values['project_id']); } if (empty($values['color_id'])) { - $values['color_id'] = $this->color->getDefaultColor(); + $values['color_id'] = $this->colorModel->getDefaultColor(); } if (empty($values['title'])) { @@ -76,7 +76,7 @@ class TaskCreation extends Base $values['date_creation'] = time(); $values['date_modification'] = $values['date_creation']; $values['date_moved'] = $values['date_creation']; - $values['position'] = $this->taskFinder->countByColumnAndSwimlaneId($values['project_id'], $values['column_id'], $values['swimlane_id']) + 1; + $values['position'] = $this->taskFinderModel->countByColumnAndSwimlaneId($values['project_id'], $values['column_id'], $values['swimlane_id']) + 1; } /** @@ -90,14 +90,14 @@ class TaskCreation extends Base { $event = new TaskEvent(array('task_id' => $task_id) + $values); - $this->logger->debug('Event fired: '.Task::EVENT_CREATE_UPDATE); - $this->logger->debug('Event fired: '.Task::EVENT_CREATE); + $this->logger->debug('Event fired: '.TaskModel::EVENT_CREATE_UPDATE); + $this->logger->debug('Event fired: '.TaskModel::EVENT_CREATE); - $this->dispatcher->dispatch(Task::EVENT_CREATE_UPDATE, $event); - $this->dispatcher->dispatch(Task::EVENT_CREATE, $event); + $this->dispatcher->dispatch(TaskModel::EVENT_CREATE_UPDATE, $event); + $this->dispatcher->dispatch(TaskModel::EVENT_CREATE, $event); if (! empty($values['description'])) { - $this->userMention->fireEvents($values['description'], Task::EVENT_USER_MENTION, $event); + $this->userMentionModel->fireEvents($values['description'], TaskModel::EVENT_USER_MENTION, $event); } } } diff --git a/app/Model/TaskDuplication.php b/app/Model/TaskDuplicationModel.php index 56457a01..9a4613e2 100644 --- a/app/Model/TaskDuplication.php +++ b/app/Model/TaskDuplicationModel.php @@ -10,10 +10,10 @@ use Kanboard\Event\TaskEvent; /** * Task Duplication * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskDuplication extends Base +class TaskDuplicationModel extends Base { /** * Fields to copy when duplicating a task @@ -63,19 +63,19 @@ class TaskDuplication extends Base { $values = $this->copyFields($task_id); - if ($values['recurrence_status'] == Task::RECURRING_STATUS_PENDING) { + if ($values['recurrence_status'] == TaskModel::RECURRING_STATUS_PENDING) { $values['recurrence_parent'] = $task_id; - $values['column_id'] = $this->column->getFirstColumnId($values['project_id']); + $values['column_id'] = $this->columnModel->getFirstColumnId($values['project_id']); $this->calculateRecurringTaskDueDate($values); $recurring_task_id = $this->save($task_id, $values); if ($recurring_task_id > 0) { $parent_update = $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->update(array( - 'recurrence_status' => Task::RECURRING_STATUS_PROCESSED, + 'recurrence_status' => TaskModel::RECURRING_STATUS_PROCESSED, 'recurrence_child' => $recurring_task_id, )); @@ -128,22 +128,22 @@ class TaskDuplication extends Base */ public function moveToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null) { - $task = $this->taskFinder->getById($task_id); + $task = $this->taskFinderModel->getById($task_id); $values = array(); $values['is_active'] = 1; $values['project_id'] = $project_id; $values['column_id'] = $column_id !== null ? $column_id : $task['column_id']; - $values['position'] = $this->taskFinder->countByColumnId($project_id, $values['column_id']) + 1; + $values['position'] = $this->taskFinderModel->countByColumnId($project_id, $values['column_id']) + 1; $values['swimlane_id'] = $swimlane_id !== null ? $swimlane_id : $task['swimlane_id']; $values['category_id'] = $category_id !== null ? $category_id : $task['category_id']; $values['owner_id'] = $owner_id !== null ? $owner_id : $task['owner_id']; $this->checkDestinationProjectValues($values); - if ($this->db->table(Task::TABLE)->eq('id', $task['id'])->update($values)) { + if ($this->db->table(TaskModel::TABLE)->eq('id', $task['id'])->update($values)) { $this->container['dispatcher']->dispatch( - Task::EVENT_MOVE_PROJECT, + TaskModel::EVENT_MOVE_PROJECT, new TaskEvent(array_merge($task, $values, array('task_id' => $task['id']))) ); } @@ -161,34 +161,34 @@ class TaskDuplication extends Base public function checkDestinationProjectValues(array &$values) { // Check if the assigned user is allowed for the destination project - if ($values['owner_id'] > 0 && ! $this->projectPermission->isUserAllowed($values['project_id'], $values['owner_id'])) { + if ($values['owner_id'] > 0 && ! $this->projectPermissionModel->isUserAllowed($values['project_id'], $values['owner_id'])) { $values['owner_id'] = 0; } // Check if the category exists for the destination project if ($values['category_id'] > 0) { - $values['category_id'] = $this->category->getIdByName( + $values['category_id'] = $this->categoryModel->getIdByName( $values['project_id'], - $this->category->getNameById($values['category_id']) + $this->categoryModel->getNameById($values['category_id']) ); } // Check if the swimlane exists for the destination project if ($values['swimlane_id'] > 0) { - $values['swimlane_id'] = $this->swimlane->getIdByName( + $values['swimlane_id'] = $this->swimlaneModel->getIdByName( $values['project_id'], - $this->swimlane->getNameById($values['swimlane_id']) + $this->swimlaneModel->getNameById($values['swimlane_id']) ); } // Check if the column exists for the destination project if ($values['column_id'] > 0) { - $values['column_id'] = $this->column->getColumnIdByTitle( + $values['column_id'] = $this->columnModel->getColumnIdByTitle( $values['project_id'], - $this->column->getColumnTitleById($values['column_id']) + $this->columnModel->getColumnTitleById($values['column_id']) ); - $values['column_id'] = $values['column_id'] ?: $this->column->getFirstColumnId($values['project_id']); + $values['column_id'] = $values['column_id'] ?: $this->columnModel->getFirstColumnId($values['project_id']); } return $values; @@ -203,7 +203,7 @@ class TaskDuplication extends Base public function calculateRecurringTaskDueDate(array &$values) { if (! empty($values['date_due']) && $values['recurrence_factor'] != 0) { - if ($values['recurrence_basedate'] == Task::RECURRING_BASEDATE_TRIGGERDATE) { + if ($values['recurrence_basedate'] == TaskModel::RECURRING_BASEDATE_TRIGGERDATE) { $values['date_due'] = time(); } @@ -211,10 +211,10 @@ class TaskDuplication extends Base $subtract = $values['recurrence_factor'] < 0; switch ($values['recurrence_timeframe']) { - case Task::RECURRING_TIMEFRAME_MONTHS: + case TaskModel::RECURRING_TIMEFRAME_MONTHS: $interval = 'P' . $factor . 'M'; break; - case Task::RECURRING_TIMEFRAME_YEARS: + case TaskModel::RECURRING_TIMEFRAME_YEARS: $interval = 'P' . $factor . 'Y'; break; default: @@ -239,7 +239,7 @@ class TaskDuplication extends Base */ private function copyFields($task_id) { - $task = $this->taskFinder->getById($task_id); + $task = $this->taskFinderModel->getById($task_id); $values = array(); foreach ($this->fields_to_duplicate as $field) { @@ -259,10 +259,10 @@ class TaskDuplication extends Base */ private function save($task_id, array $values) { - $new_task_id = $this->taskCreation->create($values); + $new_task_id = $this->taskCreationModel->create($values); if ($new_task_id) { - $this->subtask->duplicate($task_id, $new_task_id); + $this->subtaskModel->duplicate($task_id, $new_task_id); } return $new_task_id; diff --git a/app/Model/TaskExternalLink.php b/app/Model/TaskExternalLinkModel.php index f77a72bf..220b9c6f 100644 --- a/app/Model/TaskExternalLink.php +++ b/app/Model/TaskExternalLinkModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Task External Link Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskExternalLink extends Base +class TaskExternalLinkModel extends Base { /** * SQL table name @@ -31,10 +31,10 @@ class TaskExternalLink extends Base $types = $this->externalLinkManager->getTypes(); $links = $this->db->table(self::TABLE) - ->columns(self::TABLE.'.*', User::TABLE.'.name AS creator_name', User::TABLE.'.username AS creator_username') + ->columns(self::TABLE.'.*', UserModel::TABLE.'.name AS creator_name', UserModel::TABLE.'.username AS creator_username') ->eq('task_id', $task_id) ->asc('title') - ->join(User::TABLE, 'id', 'creator_id') + ->join(UserModel::TABLE, 'id', 'creator_id') ->findAll(); foreach ($links as &$link) { diff --git a/app/Model/TaskFile.php b/app/Model/TaskFileModel.php index 45a3b97f..21d319b0 100644 --- a/app/Model/TaskFile.php +++ b/app/Model/TaskFileModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * Task File Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskFile extends File +class TaskFileModel extends FileModel { /** * SQL table name diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinderModel.php index fed3a580..8b636e28 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinderModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Base; /** * Task Finder model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskFinder extends Base +class TaskFinderModel extends Base { /** * Get query for project user overview @@ -28,27 +28,27 @@ class TaskFinder extends Base } return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns( - Task::TABLE.'.id', - Task::TABLE.'.title', - Task::TABLE.'.date_due', - Task::TABLE.'.date_started', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id', - Task::TABLE.'.priority', - Task::TABLE.'.time_spent', - Task::TABLE.'.time_estimated', - Project::TABLE.'.name AS project_name', - Column::TABLE.'.title AS column_name', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name' + TaskModel::TABLE.'.id', + TaskModel::TABLE.'.title', + TaskModel::TABLE.'.date_due', + TaskModel::TABLE.'.date_started', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.color_id', + TaskModel::TABLE.'.priority', + TaskModel::TABLE.'.time_spent', + TaskModel::TABLE.'.time_estimated', + ProjectModel::TABLE.'.name AS project_name', + ColumnModel::TABLE.'.title AS column_name', + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name' ) - ->eq(Task::TABLE.'.is_active', $is_active) - ->in(Project::TABLE.'.id', $project_ids) - ->join(Project::TABLE, 'id', 'project_id') - ->join(Column::TABLE, 'id', 'column_id', Task::TABLE) - ->join(User::TABLE, 'id', 'owner_id', Task::TABLE); + ->eq(TaskModel::TABLE.'.is_active', $is_active) + ->in(ProjectModel::TABLE.'.id', $project_ids) + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE); } /** @@ -61,7 +61,7 @@ class TaskFinder extends Base public function getUserQuery($user_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns( 'tasks.id', 'tasks.title', @@ -77,11 +77,11 @@ class TaskFinder extends Base 'projects.name AS project_name', 'columns.title AS column_title' ) - ->join(Project::TABLE, 'id', 'project_id') - ->join(Column::TABLE, 'id', 'column_id') - ->eq(Task::TABLE.'.owner_id', $user_id) - ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN) - ->eq(Project::TABLE.'.is_active', Project::ACTIVE); + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->join(ColumnModel::TABLE, 'id', 'column_id') + ->eq(TaskModel::TABLE.'.owner_id', $user_id) + ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) + ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE); } /** @@ -93,15 +93,15 @@ class TaskFinder extends Base public function getExtendedQuery() { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->columns( - '(SELECT COUNT(*) FROM '.Comment::TABLE.' WHERE task_id=tasks.id) AS nb_comments', - '(SELECT COUNT(*) FROM '.TaskFile::TABLE.' WHERE task_id=tasks.id) AS nb_files', - '(SELECT COUNT(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id) AS nb_subtasks', - '(SELECT COUNT(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id AND status=2) AS nb_completed_subtasks', - '(SELECT COUNT(*) FROM '.TaskLink::TABLE.' WHERE '.TaskLink::TABLE.'.task_id = tasks.id) AS nb_links', - '(SELECT COUNT(*) FROM '.TaskExternalLink::TABLE.' WHERE '.TaskExternalLink::TABLE.'.task_id = tasks.id) AS nb_external_links', - '(SELECT DISTINCT 1 FROM '.TaskLink::TABLE.' WHERE '.TaskLink::TABLE.'.task_id = tasks.id AND '.TaskLink::TABLE.'.link_id = 9) AS is_milestone', + '(SELECT COUNT(*) FROM '.CommentModel::TABLE.' WHERE task_id=tasks.id) AS nb_comments', + '(SELECT COUNT(*) FROM '.TaskFileModel::TABLE.' WHERE task_id=tasks.id) AS nb_files', + '(SELECT COUNT(*) FROM '.SubtaskModel::TABLE.' WHERE '.SubtaskModel::TABLE.'.task_id=tasks.id) AS nb_subtasks', + '(SELECT COUNT(*) FROM '.SubtaskModel::TABLE.' WHERE '.SubtaskModel::TABLE.'.task_id=tasks.id AND status=2) AS nb_completed_subtasks', + '(SELECT COUNT(*) FROM '.TaskLinkModel::TABLE.' WHERE '.TaskLinkModel::TABLE.'.task_id = tasks.id) AS nb_links', + '(SELECT COUNT(*) FROM '.TaskExternalLinkModel::TABLE.' WHERE '.TaskExternalLinkModel::TABLE.'.task_id = tasks.id) AS nb_external_links', + '(SELECT DISTINCT 1 FROM '.TaskLinkModel::TABLE.' WHERE '.TaskLinkModel::TABLE.'.task_id = tasks.id AND '.TaskLinkModel::TABLE.'.link_id = 9) AS is_milestone', 'tasks.id', 'tasks.reference', 'tasks.title', @@ -132,24 +132,24 @@ class TaskFinder extends Base 'tasks.recurrence_child', 'tasks.time_estimated', 'tasks.time_spent', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name', - User::TABLE.'.email AS assignee_email', - User::TABLE.'.avatar_path AS assignee_avatar_path', - Category::TABLE.'.name AS category_name', - Category::TABLE.'.description AS category_description', - Column::TABLE.'.title AS column_name', - Column::TABLE.'.position AS column_position', - Swimlane::TABLE.'.name AS swimlane_name', - Project::TABLE.'.default_swimlane', - Project::TABLE.'.name AS project_name' + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name', + UserModel::TABLE.'.email AS assignee_email', + UserModel::TABLE.'.avatar_path AS assignee_avatar_path', + CategoryModel::TABLE.'.name AS category_name', + CategoryModel::TABLE.'.description AS category_description', + ColumnModel::TABLE.'.title AS column_name', + ColumnModel::TABLE.'.position AS column_position', + SwimlaneModel::TABLE.'.name AS swimlane_name', + ProjectModel::TABLE.'.default_swimlane', + ProjectModel::TABLE.'.name AS project_name' ) - ->join(User::TABLE, 'id', 'owner_id', Task::TABLE) - ->left(User::TABLE, 'uc', 'id', Task::TABLE, 'creator_id') - ->join(Category::TABLE, 'id', 'category_id', Task::TABLE) - ->join(Column::TABLE, 'id', 'column_id', Task::TABLE) - ->join(Swimlane::TABLE, 'id', 'swimlane_id', Task::TABLE) - ->join(Project::TABLE, 'id', 'project_id', Task::TABLE); + ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE) + ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id') + ->join(CategoryModel::TABLE, 'id', 'category_id', TaskModel::TABLE) + ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE) + ->join(SwimlaneModel::TABLE, 'id', 'swimlane_id', TaskModel::TABLE) + ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE); } /** @@ -164,11 +164,11 @@ class TaskFinder extends Base public function getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id = 0) { return $this->getExtendedQuery() - ->eq(Task::TABLE.'.project_id', $project_id) - ->eq(Task::TABLE.'.column_id', $column_id) - ->eq(Task::TABLE.'.swimlane_id', $swimlane_id) - ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN) - ->asc(Task::TABLE.'.position') + ->eq(TaskModel::TABLE.'.project_id', $project_id) + ->eq(TaskModel::TABLE.'.column_id', $column_id) + ->eq(TaskModel::TABLE.'.swimlane_id', $swimlane_id) + ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) + ->asc(TaskModel::TABLE.'.position') ->findAll(); } @@ -180,12 +180,12 @@ class TaskFinder extends Base * @param integer $status_id Status id * @return array */ - public function getAll($project_id, $status_id = Task::STATUS_OPEN) + public function getAll($project_id, $status_id = TaskModel::STATUS_OPEN) { return $this->db - ->table(Task::TABLE) - ->eq(Task::TABLE.'.project_id', $project_id) - ->eq(Task::TABLE.'.is_active', $status_id) + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project_id) + ->eq(TaskModel::TABLE.'.is_active', $status_id) ->findAll(); } @@ -197,12 +197,12 @@ class TaskFinder extends Base * @param array $status * @return array */ - public function getAllIds($project_id, array $status = array(Task::STATUS_OPEN)) + public function getAllIds($project_id, array $status = array(TaskModel::STATUS_OPEN)) { return $this->db - ->table(Task::TABLE) - ->eq(Task::TABLE.'.project_id', $project_id) - ->in(Task::TABLE.'.is_active', $status) + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project_id) + ->in(TaskModel::TABLE.'.is_active', $status) ->findAllByColumn('id'); } @@ -214,24 +214,24 @@ class TaskFinder extends Base */ public function getOverdueTasksQuery() { - return $this->db->table(Task::TABLE) + return $this->db->table(TaskModel::TABLE) ->columns( - Task::TABLE.'.id', - Task::TABLE.'.title', - Task::TABLE.'.date_due', - Task::TABLE.'.project_id', - Task::TABLE.'.creator_id', - Task::TABLE.'.owner_id', - Project::TABLE.'.name AS project_name', - User::TABLE.'.username AS assignee_username', - User::TABLE.'.name AS assignee_name' + TaskModel::TABLE.'.id', + TaskModel::TABLE.'.title', + TaskModel::TABLE.'.date_due', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.creator_id', + TaskModel::TABLE.'.owner_id', + ProjectModel::TABLE.'.name AS project_name', + UserModel::TABLE.'.username AS assignee_username', + UserModel::TABLE.'.name AS assignee_name' ) - ->join(Project::TABLE, 'id', 'project_id') - ->join(User::TABLE, 'id', 'owner_id') - ->eq(Project::TABLE.'.is_active', 1) - ->eq(Task::TABLE.'.is_active', 1) - ->neq(Task::TABLE.'.date_due', 0) - ->lte(Task::TABLE.'.date_due', mktime(23, 59, 59)); + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->join(UserModel::TABLE, 'id', 'owner_id') + ->eq(ProjectModel::TABLE.'.is_active', 1) + ->eq(TaskModel::TABLE.'.is_active', 1) + ->neq(TaskModel::TABLE.'.date_due', 0) + ->lte(TaskModel::TABLE.'.date_due', mktime(23, 59, 59)); } /** @@ -254,7 +254,7 @@ class TaskFinder extends Base */ public function getOverdueTasksByProject($project_id) { - return $this->getOverdueTasksQuery()->eq(Task::TABLE.'.project_id', $project_id)->findAll(); + return $this->getOverdueTasksQuery()->eq(TaskModel::TABLE.'.project_id', $project_id)->findAll(); } /** @@ -266,7 +266,7 @@ class TaskFinder extends Base */ public function getOverdueTasksByUser($user_id) { - return $this->getOverdueTasksQuery()->eq(Task::TABLE.'.owner_id', $user_id)->findAll(); + return $this->getOverdueTasksQuery()->eq(TaskModel::TABLE.'.owner_id', $user_id)->findAll(); } /** @@ -278,7 +278,7 @@ class TaskFinder extends Base */ public function getProjectId($task_id) { - return (int) $this->db->table(Task::TABLE)->eq('id', $task_id)->findOneColumn('project_id') ?: 0; + return (int) $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->findOneColumn('project_id') ?: 0; } /** @@ -290,7 +290,7 @@ class TaskFinder extends Base */ public function getById($task_id) { - return $this->db->table(Task::TABLE)->eq('id', $task_id)->findOne(); + return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->findOne(); } /** @@ -303,7 +303,7 @@ class TaskFinder extends Base */ public function getByReference($project_id, $reference) { - return $this->db->table(Task::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne(); + return $this->db->table(TaskModel::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne(); } /** @@ -378,11 +378,11 @@ class TaskFinder extends Base */ public function getICalQuery() { - return $this->db->table(Task::TABLE) - ->left(User::TABLE, 'ua', 'id', Task::TABLE, 'owner_id') - ->left(User::TABLE, 'uc', 'id', Task::TABLE, 'creator_id') + return $this->db->table(TaskModel::TABLE) + ->left(UserModel::TABLE, 'ua', 'id', TaskModel::TABLE, 'owner_id') + ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id') ->columns( - Task::TABLE.'.*', + TaskModel::TABLE.'.*', 'ua.email AS assignee_email', 'ua.name AS assignee_name', 'ua.username AS assignee_username', @@ -399,10 +399,10 @@ class TaskFinder extends Base * @param array $status List of status id * @return integer */ - public function countByProjectId($project_id, array $status = array(Task::STATUS_OPEN, Task::STATUS_CLOSED)) + public function countByProjectId($project_id, array $status = array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED)) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('project_id', $project_id) ->in('is_active', $status) ->count(); @@ -419,7 +419,7 @@ class TaskFinder extends Base public function countByColumnId($project_id, $column_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('project_id', $project_id) ->eq('column_id', $column_id) ->eq('is_active', 1) @@ -438,7 +438,7 @@ class TaskFinder extends Base public function countByColumnAndSwimlaneId($project_id, $column_id, $swimlane_id) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('project_id', $project_id) ->eq('column_id', $column_id) ->eq('swimlane_id', $swimlane_id) @@ -455,7 +455,7 @@ class TaskFinder extends Base */ public function exists($task_id) { - return $this->db->table(Task::TABLE)->eq('id', $task_id)->exists(); + return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->exists(); } /** @@ -468,9 +468,9 @@ class TaskFinder extends Base public function getProjectToken($task_id) { return $this->db - ->table(Task::TABLE) - ->eq(Task::TABLE.'.id', $task_id) - ->join(Project::TABLE, 'id', 'project_id') - ->findOneColumn(Project::TABLE.'.token'); + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.id', $task_id) + ->join(ProjectModel::TABLE, 'id', 'project_id') + ->findOneColumn(ProjectModel::TABLE.'.token'); } } diff --git a/app/Model/TaskLink.php b/app/Model/TaskLinkModel.php index 9c5b3ca3..45225e35 100644 --- a/app/Model/TaskLink.php +++ b/app/Model/TaskLinkModel.php @@ -8,11 +8,11 @@ use Kanboard\Event\TaskLinkEvent; /** * TaskLink model * - * @package model + * @package Kanboard\Model * @author Olivier Maridat * @author Frederic Guillot */ -class TaskLink extends Base +class TaskLinkModel extends Base { /** * SQL table name @@ -49,7 +49,7 @@ class TaskLink extends Base */ public function getOppositeTaskLink(array $task_link) { - $opposite_link_id = $this->link->getOppositeLinkId($task_link['link_id']); + $opposite_link_id = $this->linkModel->getOppositeLinkId($task_link['link_id']); return $this->db->table(self::TABLE) ->eq('opposite_task_id', $task_link['task_id']) @@ -72,31 +72,31 @@ class TaskLink extends Base ->columns( self::TABLE.'.id', self::TABLE.'.opposite_task_id AS task_id', - Link::TABLE.'.label', - Task::TABLE.'.title', - Task::TABLE.'.is_active', - Task::TABLE.'.project_id', - Task::TABLE.'.column_id', - Task::TABLE.'.color_id', - Task::TABLE.'.time_spent AS task_time_spent', - Task::TABLE.'.time_estimated AS task_time_estimated', - Task::TABLE.'.owner_id AS task_assignee_id', - User::TABLE.'.username AS task_assignee_username', - User::TABLE.'.name AS task_assignee_name', - Column::TABLE.'.title AS column_title', - Project::TABLE.'.name AS project_name' + LinkModel::TABLE.'.label', + TaskModel::TABLE.'.title', + TaskModel::TABLE.'.is_active', + TaskModel::TABLE.'.project_id', + TaskModel::TABLE.'.column_id', + TaskModel::TABLE.'.color_id', + TaskModel::TABLE.'.time_spent AS task_time_spent', + TaskModel::TABLE.'.time_estimated AS task_time_estimated', + TaskModel::TABLE.'.owner_id AS task_assignee_id', + UserModel::TABLE.'.username AS task_assignee_username', + UserModel::TABLE.'.name AS task_assignee_name', + ColumnModel::TABLE.'.title AS column_title', + ProjectModel::TABLE.'.name AS project_name' ) ->eq(self::TABLE.'.task_id', $task_id) - ->join(Link::TABLE, 'id', 'link_id') - ->join(Task::TABLE, 'id', 'opposite_task_id') - ->join(Column::TABLE, 'id', 'column_id', Task::TABLE) - ->join(User::TABLE, 'id', 'owner_id', Task::TABLE) - ->join(Project::TABLE, 'id', 'project_id', Task::TABLE) - ->asc(Link::TABLE.'.id') - ->desc(Column::TABLE.'.position') - ->desc(Task::TABLE.'.is_active') - ->asc(Task::TABLE.'.position') - ->asc(Task::TABLE.'.id') + ->join(LinkModel::TABLE, 'id', 'link_id') + ->join(TaskModel::TABLE, 'id', 'opposite_task_id') + ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE) + ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE) + ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE) + ->asc(LinkModel::TABLE.'.id') + ->desc(ColumnModel::TABLE.'.position') + ->desc(TaskModel::TABLE.'.is_active') + ->asc(TaskModel::TABLE.'.position') + ->asc(TaskModel::TABLE.'.id') ->findAll(); } @@ -132,7 +132,7 @@ class TaskLink extends Base private function fireEvents(array $events) { foreach ($events as $event) { - $event['project_id'] = $this->taskFinder->getProjectId($event['task_id']); + $event['project_id'] = $this->taskFinderModel->getProjectId($event['task_id']); $this->container['dispatcher']->dispatch(self::EVENT_CREATE_UPDATE, new TaskLinkEvent($event)); } } @@ -152,7 +152,7 @@ class TaskLink extends Base $this->db->startTransaction(); // Get opposite link - $opposite_link_id = $this->link->getOppositeLinkId($link_id); + $opposite_link_id = $this->linkModel->getOppositeLinkId($link_id); $values = array( 'task_id' => $task_id, @@ -204,7 +204,7 @@ class TaskLink extends Base $opposite_task_link = $this->getOppositeTaskLink($task_link); // Get opposite link - $opposite_link_id = $this->link->getOppositeLinkId($link_id); + $opposite_link_id = $this->linkModel->getOppositeLinkId($link_id); // Update the original task link $values = array( @@ -248,7 +248,7 @@ class TaskLink extends Base $this->db->startTransaction(); $link = $this->getById($task_link_id); - $link_id = $this->link->getOppositeLinkId($link['link_id']); + $link_id = $this->linkModel->getOppositeLinkId($link['link_id']); $this->db->table(self::TABLE)->eq('id', $task_link_id)->remove(); diff --git a/app/Model/TaskMetadata.php b/app/Model/TaskMetadataModel.php index d9d024bf..dc3f56ec 100644 --- a/app/Model/TaskMetadata.php +++ b/app/Model/TaskMetadataModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * Task Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskMetadata extends Metadata +class TaskMetadataModel extends MetadataModel { /** * Get the table diff --git a/app/Model/Task.php b/app/Model/TaskModel.php index bdb55c46..b0e7772a 100644 --- a/app/Model/Task.php +++ b/app/Model/TaskModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Task model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Task extends Base +class TaskModel extends Base { /** * SQL table name @@ -90,11 +90,11 @@ class Task extends Base */ public function remove($task_id) { - if (! $this->taskFinder->exists($task_id)) { + if (! $this->taskFinderModel->exists($task_id)) { return false; } - $this->taskFile->removeAll($task_id); + $this->taskFileModel->removeAll($task_id); return $this->db->table(self::TABLE)->eq('id', $task_id)->remove(); } @@ -126,8 +126,8 @@ class Task extends Base public function getRecurrenceStatusList() { return array( - Task::RECURRING_STATUS_NONE => t('No'), - Task::RECURRING_STATUS_PENDING => t('Yes'), + TaskModel::RECURRING_STATUS_NONE => t('No'), + TaskModel::RECURRING_STATUS_PENDING => t('Yes'), ); } @@ -140,9 +140,9 @@ class Task extends Base public function getRecurrenceTriggerList() { return array( - Task::RECURRING_TRIGGER_FIRST_COLUMN => t('When task is moved from first column'), - Task::RECURRING_TRIGGER_LAST_COLUMN => t('When task is moved to last column'), - Task::RECURRING_TRIGGER_CLOSE => t('When task is closed'), + TaskModel::RECURRING_TRIGGER_FIRST_COLUMN => t('When task is moved from first column'), + TaskModel::RECURRING_TRIGGER_LAST_COLUMN => t('When task is moved to last column'), + TaskModel::RECURRING_TRIGGER_CLOSE => t('When task is closed'), ); } @@ -155,8 +155,8 @@ class Task extends Base public function getRecurrenceBasedateList() { return array( - Task::RECURRING_BASEDATE_DUEDATE => t('Existing due date'), - Task::RECURRING_BASEDATE_TRIGGERDATE => t('Action date'), + TaskModel::RECURRING_BASEDATE_DUEDATE => t('Existing due date'), + TaskModel::RECURRING_BASEDATE_TRIGGERDATE => t('Action date'), ); } @@ -169,9 +169,9 @@ class Task extends Base public function getRecurrenceTimeframeList() { return array( - Task::RECURRING_TIMEFRAME_DAYS => t('Day(s)'), - Task::RECURRING_TIMEFRAME_MONTHS => t('Month(s)'), - Task::RECURRING_TIMEFRAME_YEARS => t('Year(s)'), + TaskModel::RECURRING_TIMEFRAME_DAYS => t('Day(s)'), + TaskModel::RECURRING_TIMEFRAME_MONTHS => t('Month(s)'), + TaskModel::RECURRING_TIMEFRAME_YEARS => t('Year(s)'), ); } @@ -212,10 +212,10 @@ class Task extends Base */ public function duplicate($src_project_id, $dst_project_id) { - $task_ids = $this->taskFinder->getAllIds($src_project_id, array(Task::STATUS_OPEN, Task::STATUS_CLOSED)); + $task_ids = $this->taskFinderModel->getAllIds($src_project_id, array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED)); foreach ($task_ids as $task_id) { - if (! $this->taskDuplication->duplicateToProject($task_id, $dst_project_id)) { + if (! $this->taskDuplicationModel->duplicateToProject($task_id, $dst_project_id)) { return false; } } diff --git a/app/Model/TaskModification.php b/app/Model/TaskModificationModel.php index 7e0ea8b2..762af2c5 100644 --- a/app/Model/TaskModification.php +++ b/app/Model/TaskModificationModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Modification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskModification extends Base +class TaskModificationModel extends Base { /** * Update a task @@ -23,10 +23,10 @@ class TaskModification extends Base */ public function update(array $values, $fire_events = true) { - $original_task = $this->taskFinder->getById($values['id']); + $original_task = $this->taskFinderModel->getById($values['id']); $this->prepare($values); - $result = $this->db->table(Task::TABLE)->eq('id', $original_task['id'])->update($values); + $result = $this->db->table(TaskModel::TABLE)->eq('id', $original_task['id'])->update($values); if ($fire_events && $result) { $this->fireEvents($original_task, $values); @@ -52,10 +52,10 @@ class TaskModification extends Base unset($event_data['changes']['date_modification']); if ($this->isFieldModified('owner_id', $event_data['changes'])) { - $events[] = Task::EVENT_ASSIGNEE_CHANGE; + $events[] = TaskModel::EVENT_ASSIGNEE_CHANGE; } elseif (! empty($event_data['changes'])) { - $events[] = Task::EVENT_CREATE_UPDATE; - $events[] = Task::EVENT_UPDATE; + $events[] = TaskModel::EVENT_CREATE_UPDATE; + $events[] = TaskModel::EVENT_UPDATE; } foreach ($events as $event) { diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPositionModel.php index 5b794795..9fdb8f7d 100644 --- a/app/Model/TaskPosition.php +++ b/app/Model/TaskPositionModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Position * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskPosition extends Base +class TaskPositionModel extends Base { /** * Move a task to another column or to another position @@ -31,9 +31,9 @@ class TaskPosition extends Base return false; } - $task = $this->taskFinder->getById($task_id); + $task = $this->taskFinderModel->getById($task_id); - if ($task['is_active'] == Task::STATUS_CLOSED) { + if ($task['is_active'] == TaskModel::STATUS_CLOSED) { return true; } @@ -132,7 +132,7 @@ class TaskPosition extends Base */ private function saveTaskPositions($project_id, $task_id, $position, $column_id, $swimlane_id) { - $tasks_ids = $this->db->table(Task::TABLE) + $tasks_ids = $this->db->table(TaskModel::TABLE) ->eq('is_active', 1) ->eq('swimlane_id', $swimlane_id) ->eq('project_id', $project_id) @@ -169,7 +169,7 @@ class TaskPosition extends Base $now = time(); - return $this->db->table(Task::TABLE)->eq('id', $task_id)->update(array( + return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array( 'date_moved' => $now, 'date_modification' => $now, )); @@ -187,7 +187,7 @@ class TaskPosition extends Base */ private function saveTaskPosition($task_id, $position, $column_id, $swimlane_id) { - $result = $this->db->table(Task::TABLE)->eq('id', $task_id)->update(array( + $result = $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array( 'position' => $position, 'column_id' => $column_id, 'swimlane_id' => $swimlane_id, @@ -226,14 +226,14 @@ class TaskPosition extends Base ); if ($task['swimlane_id'] != $new_swimlane_id) { - $this->logger->debug('Event fired: '.Task::EVENT_MOVE_SWIMLANE); - $this->dispatcher->dispatch(Task::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data)); + $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_SWIMLANE); + $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data)); } elseif ($task['column_id'] != $new_column_id) { - $this->logger->debug('Event fired: '.Task::EVENT_MOVE_COLUMN); - $this->dispatcher->dispatch(Task::EVENT_MOVE_COLUMN, new TaskEvent($event_data)); + $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_COLUMN); + $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_COLUMN, new TaskEvent($event_data)); } elseif ($task['position'] != $new_position) { - $this->logger->debug('Event fired: '.Task::EVENT_MOVE_POSITION); - $this->dispatcher->dispatch(Task::EVENT_MOVE_POSITION, new TaskEvent($event_data)); + $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_POSITION); + $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_POSITION, new TaskEvent($event_data)); } } } diff --git a/app/Model/TaskStatus.php b/app/Model/TaskStatusModel.php index 4ba13a60..4d573f0e 100644 --- a/app/Model/TaskStatus.php +++ b/app/Model/TaskStatusModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent; /** * Task Status * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class TaskStatus extends Base +class TaskStatusModel extends Base { /** * Return true if the task is closed @@ -22,7 +22,7 @@ class TaskStatus extends Base */ public function isClosed($task_id) { - return $this->checkStatus($task_id, Task::STATUS_CLOSED); + return $this->checkStatus($task_id, TaskModel::STATUS_CLOSED); } /** @@ -34,7 +34,7 @@ class TaskStatus extends Base */ public function isOpen($task_id) { - return $this->checkStatus($task_id, Task::STATUS_OPEN); + return $this->checkStatus($task_id, TaskModel::STATUS_OPEN); } /** @@ -46,8 +46,8 @@ class TaskStatus extends Base */ public function close($task_id) { - $this->subtask->closeAll($task_id); - return $this->changeStatus($task_id, Task::STATUS_CLOSED, time(), Task::EVENT_CLOSE); + $this->subtaskModel->closeAll($task_id); + return $this->changeStatus($task_id, TaskModel::STATUS_CLOSED, time(), TaskModel::EVENT_CLOSE); } /** @@ -59,7 +59,7 @@ class TaskStatus extends Base */ public function open($task_id) { - return $this->changeStatus($task_id, Task::STATUS_OPEN, 0, Task::EVENT_OPEN); + return $this->changeStatus($task_id, TaskModel::STATUS_OPEN, 0, TaskModel::EVENT_OPEN); } /** @@ -85,10 +85,10 @@ class TaskStatus extends Base public function closeTasksBySwimlaneAndColumn($swimlane_id, $column_id) { $task_ids = $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('swimlane_id', $swimlane_id) ->eq('column_id', $column_id) - ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN) + ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) ->findAllByColumn('id'); $this->closeMultipleTasks($task_ids); @@ -106,12 +106,12 @@ class TaskStatus extends Base */ private function changeStatus($task_id, $status, $date_completed, $event) { - if (! $this->taskFinder->exists($task_id)) { + if (! $this->taskFinderModel->exists($task_id)) { return false; } $result = $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->update(array( 'is_active' => $status, @@ -121,7 +121,7 @@ class TaskStatus extends Base if ($result) { $this->logger->debug('Event fired: '.$event); - $this->dispatcher->dispatch($event, new TaskEvent(array('task_id' => $task_id) + $this->taskFinder->getById($task_id))); + $this->dispatcher->dispatch($event, new TaskEvent(array('task_id' => $task_id) + $this->taskFinderModel->getById($task_id))); } return $result; @@ -138,7 +138,7 @@ class TaskStatus extends Base private function checkStatus($task_id, $status) { return $this->db - ->table(Task::TABLE) + ->table(TaskModel::TABLE) ->eq('id', $task_id) ->eq('is_active', $status) ->count() === 1; diff --git a/app/Model/Timezone.php b/app/Model/TimezoneModel.php index de426e79..8b3e895a 100644 --- a/app/Model/Timezone.php +++ b/app/Model/TimezoneModel.php @@ -10,7 +10,7 @@ use Kanboard\Core\Base; * @package Kanboard\Model * @author Frederic Guillot */ -class Timezone extends Base +class TimezoneModel extends Base { /** * Get available timezones @@ -43,7 +43,7 @@ class Timezone extends Base return $this->sessionStorage->user['timezone']; } - return $this->config->get('application_timezone', 'UTC'); + return $this->configModel->get('application_timezone', 'UTC'); } /** diff --git a/app/Model/Transition.php b/app/Model/TransitionModel.php index 2bc622b0..a4a58472 100644 --- a/app/Model/Transition.php +++ b/app/Model/TransitionModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * Transition * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Transition extends Base +class TransitionModel extends Base { /** * SQL table name @@ -71,17 +71,17 @@ class Transition extends Base ->columns( 'src.title as src_column', 'dst.title as dst_column', - User::TABLE.'.name', - User::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.username', self::TABLE.'.user_id', self::TABLE.'.date', self::TABLE.'.time_spent' ) ->eq('task_id', $task_id) ->desc('date') - ->join(User::TABLE, 'id', 'user_id') - ->join(Column::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') - ->join(Column::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') + ->join(UserModel::TABLE, 'id', 'user_id') + ->join(ColumnModel::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') + ->join(ColumnModel::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') ->findAll(); } @@ -106,12 +106,12 @@ class Transition extends Base return $this->db->table(self::TABLE) ->columns( - Task::TABLE.'.id', - Task::TABLE.'.title', + TaskModel::TABLE.'.id', + TaskModel::TABLE.'.title', 'src.title as src_column', 'dst.title as dst_column', - User::TABLE.'.name', - User::TABLE.'.username', + UserModel::TABLE.'.name', + UserModel::TABLE.'.username', self::TABLE.'.user_id', self::TABLE.'.date', self::TABLE.'.time_spent' @@ -121,10 +121,10 @@ class Transition extends Base ->eq(self::TABLE.'.project_id', $project_id) ->desc('date') ->desc(self::TABLE.'.id') - ->join(Task::TABLE, 'id', 'task_id') - ->join(User::TABLE, 'id', 'user_id') - ->join(Column::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') - ->join(Column::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') + ->join(TaskModel::TABLE, 'id', 'task_id') + ->join(UserModel::TABLE, 'id', 'user_id') + ->join(ColumnModel::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src') + ->join(ColumnModel::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst') ->findAll(); } } diff --git a/app/Model/UserLocking.php b/app/Model/UserLockingModel.php index ccaf402c..1d4d994c 100644 --- a/app/Model/UserLocking.php +++ b/app/Model/UserLockingModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * User Locking Model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserLocking extends Base +class UserLockingModel extends Base { /** * Get the number of failed login for the user @@ -21,7 +21,7 @@ class UserLocking extends Base */ public function getFailedLogin($username) { - return (int) $this->db->table(User::TABLE) + return (int) $this->db->table(UserModel::TABLE) ->eq('username', $username) ->findOneColumn('nb_failed_login'); } @@ -35,7 +35,7 @@ class UserLocking extends Base */ public function resetFailedLogin($username) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->update(array( 'nb_failed_login' => 0, @@ -52,7 +52,7 @@ class UserLocking extends Base */ public function incrementFailedLogin($username) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->increment('nb_failed_login', 1); } @@ -66,7 +66,7 @@ class UserLocking extends Base */ public function isLocked($username) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->neq('lock_expiration_date', 0) ->gte('lock_expiration_date', time()) @@ -83,7 +83,7 @@ class UserLocking extends Base */ public function lock($username, $duration = 15) { - return $this->db->table(User::TABLE) + return $this->db->table(UserModel::TABLE) ->eq('username', $username) ->update(array( 'lock_expiration_date' => time() + $duration * 60 diff --git a/app/Model/UserMention.php b/app/Model/UserMentionModel.php index 42b81840..cdb9949e 100644 --- a/app/Model/UserMention.php +++ b/app/Model/UserMentionModel.php @@ -8,10 +8,10 @@ use Kanboard\Event\GenericEvent; /** * User Mention * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserMention extends Base +class UserMentionModel extends Base { /** * Get list of mentioned users @@ -25,7 +25,7 @@ class UserMention extends Base $users = array(); if (preg_match_all('/@([^\s]+)/', $content, $matches)) { - $users = $this->db->table(User::TABLE) + $users = $this->db->table(UserModel::TABLE) ->columns('id', 'username', 'name', 'email', 'language') ->eq('notifications_enabled', 1) ->neq('id', $this->userSession->getId()) @@ -47,13 +47,13 @@ class UserMention extends Base public function fireEvents($content, $eventName, GenericEvent $event) { if (empty($event['project_id'])) { - $event['project_id'] = $this->taskFinder->getProjectId($event['task_id']); + $event['project_id'] = $this->taskFinderModel->getProjectId($event['task_id']); } $users = $this->getMentionedUsers($content); foreach ($users as $user) { - if ($this->projectPermission->isMember($event['project_id'], $user['id'])) { + if ($this->projectPermissionModel->isMember($event['project_id'], $user['id'])) { $event['mention'] = $user; $this->dispatcher->dispatch($eventName, $event); } diff --git a/app/Model/UserMetadata.php b/app/Model/UserMetadataModel.php index 491c1575..e931d3ba 100644 --- a/app/Model/UserMetadata.php +++ b/app/Model/UserMetadataModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * User Metadata * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserMetadata extends Metadata +class UserMetadataModel extends MetadataModel { /** * Get the table diff --git a/app/Model/User.php b/app/Model/UserModel.php index cbfca0ac..f7a051c5 100644 --- a/app/Model/User.php +++ b/app/Model/UserModel.php @@ -10,10 +10,10 @@ use Kanboard\Core\Security\Role; /** * User model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class User extends Base +class UserModel extends Base { /** * SQL table name @@ -86,7 +86,7 @@ class User extends Base { return $this->userSession->isAdmin() || // Avoid SQL query if connected $this->db - ->table(User::TABLE) + ->table(UserModel::TABLE) ->eq('id', $user_id) ->eq('role', Role::APP_ADMIN) ->exists(); @@ -212,7 +212,7 @@ class User extends Base $listing = $this->prepareList($users); if ($prepend) { - return array(User::EVERYBODY_ID => t('Everybody')) + $listing; + return array(UserModel::EVERYBODY_ID => t('Everybody')) + $listing; } return $listing; @@ -321,38 +321,38 @@ class User extends Base */ public function remove($user_id) { - $this->avatarFile->remove($user_id); + $this->avatarFileModel->remove($user_id); return $this->db->transaction(function (Database $db) use ($user_id) { // All assigned tasks are now unassigned (no foreign key) - if (! $db->table(Task::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) { + if (! $db->table(TaskModel::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) { return false; } // All assigned subtasks are now unassigned (no foreign key) - if (! $db->table(Subtask::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { + if (! $db->table(SubtaskModel::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { return false; } // All comments are not assigned anymore (no foreign key) - if (! $db->table(Comment::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { + if (! $db->table(CommentModel::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { return false; } // All private projects are removed - $project_ids = $db->table(Project::TABLE) + $project_ids = $db->table(ProjectModel::TABLE) ->eq('is_private', 1) - ->eq(ProjectUserRole::TABLE.'.user_id', $user_id) - ->join(ProjectUserRole::TABLE, 'project_id', 'id') - ->findAllByColumn(Project::TABLE.'.id'); + ->eq(ProjectUserRoleModel::TABLE.'.user_id', $user_id) + ->join(ProjectUserRoleModel::TABLE, 'project_id', 'id') + ->findAllByColumn(ProjectModel::TABLE.'.id'); if (! empty($project_ids)) { - $db->table(Project::TABLE)->in('id', $project_ids)->remove(); + $db->table(ProjectModel::TABLE)->in('id', $project_ids)->remove(); } // Finally remove the user - if (! $db->table(User::TABLE)->eq('id', $user_id)->remove()) { + if (! $db->table(UserModel::TABLE)->eq('id', $user_id)->remove()) { return false; } }); diff --git a/app/Model/UserNotificationFilter.php b/app/Model/UserNotificationFilterModel.php index d885da04..112ba290 100644 --- a/app/Model/UserNotificationFilter.php +++ b/app/Model/UserNotificationFilterModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * User Notification Filter * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserNotificationFilter extends Base +class UserNotificationFilterModel extends Base { /** * SQL table name @@ -54,7 +54,7 @@ class UserNotificationFilter extends Base */ public function getSelectedFilter($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->findOneColumn('notifications_filter'); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->findOneColumn('notifications_filter'); } /** @@ -67,7 +67,7 @@ class UserNotificationFilter extends Base */ public function saveFilter($user_id, $filter) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array( + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array( 'notifications_filter' => $filter, )); } diff --git a/app/Model/UserNotification.php b/app/Model/UserNotificationModel.php index ef90bb63..d77526f6 100644 --- a/app/Model/UserNotification.php +++ b/app/Model/UserNotificationModel.php @@ -8,10 +8,10 @@ use Kanboard\Core\Translator; /** * User Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserNotification extends Base +class UserNotificationModel extends Base { /** * Send notifications to people @@ -25,7 +25,7 @@ class UserNotification extends Base $users = $this->getUsersWithNotificationEnabled($event_data['task']['project_id'], $this->userSession->getId()); foreach ($users as $user) { - if ($this->userNotificationFilter->shouldReceiveNotification($user, $event_data)) { + if ($this->userNotificationFilterModel->shouldReceiveNotification($user, $event_data)) { $this->sendUserNotification($user, $event_name, $event_data); } } @@ -47,15 +47,15 @@ class UserNotification extends Base if (! empty($user['language'])) { Translator::load($user['language']); } else { - Translator::load($this->config->get('application_language', 'en_US')); + Translator::load($this->configModel->get('application_language', 'en_US')); } - foreach ($this->userNotificationType->getSelectedTypes($user['id']) as $type) { - $this->userNotificationType->getType($type)->notifyUser($user, $event_name, $event_data); + foreach ($this->userNotificationTypeModel->getSelectedTypes($user['id']) as $type) { + $this->userNotificationTypeModel->getType($type)->notifyUser($user, $event_name, $event_data); } // Restore locales - $this->language->loadCurrentLanguage(); + $this->languageModel->loadCurrentLanguage(); } /** @@ -68,7 +68,7 @@ class UserNotification extends Base */ public function getUsersWithNotificationEnabled($project_id, $exclude_user_id = 0) { - if ($this->projectPermission->isEverybodyAllowed($project_id)) { + if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) { return $this->getEverybodyWithNotificationEnabled($exclude_user_id); } @@ -94,7 +94,7 @@ class UserNotification extends Base */ public function enableNotification($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 1)); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 1)); } /** @@ -106,7 +106,7 @@ class UserNotification extends Base */ public function disableNotification($user_id) { - return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 0)); + return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 0)); } /** @@ -126,12 +126,12 @@ class UserNotification extends Base $this->disableNotification($user_id); } - $filter = empty($values['notifications_filter']) ? UserNotificationFilter::FILTER_BOTH : $values['notifications_filter']; + $filter = empty($values['notifications_filter']) ? UserNotificationFilterModel::FILTER_BOTH : $values['notifications_filter']; $project_ids = empty($values['notification_projects']) ? array() : array_keys($values['notification_projects']); - $this->userNotificationFilter->saveFilter($user_id, $filter); - $this->userNotificationFilter->saveSelectedProjects($user_id, $project_ids); - $this->userNotificationType->saveSelectedTypes($user_id, $types); + $this->userNotificationFilterModel->saveFilter($user_id, $filter); + $this->userNotificationFilterModel->saveSelectedProjects($user_id, $project_ids); + $this->userNotificationTypeModel->saveSelectedTypes($user_id, $types); } /** @@ -143,9 +143,9 @@ class UserNotification extends Base */ public function readSettings($user_id) { - $values = $this->db->table(User::TABLE)->eq('id', $user_id)->columns('notifications_enabled', 'notifications_filter')->findOne(); - $values['notification_types'] = $this->userNotificationType->getSelectedTypes($user_id); - $values['notification_projects'] = $this->userNotificationFilter->getSelectedProjects($user_id); + $values = $this->db->table(UserModel::TABLE)->eq('id', $user_id)->columns('notifications_enabled', 'notifications_filter')->findOne(); + $values['notification_types'] = $this->userNotificationTypeModel->getSelectedTypes($user_id); + $values['notification_projects'] = $this->userNotificationFilterModel->getSelectedProjects($user_id); return $values; } @@ -160,27 +160,27 @@ class UserNotification extends Base private function getProjectUserMembersWithNotificationEnabled($project_id, $exclude_user_id) { return $this->db - ->table(ProjectUserRole::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter') - ->join(User::TABLE, 'id', 'user_id') - ->eq(ProjectUserRole::TABLE.'.project_id', $project_id) - ->eq(User::TABLE.'.notifications_enabled', '1') - ->eq(User::TABLE.'.is_active', 1) - ->neq(User::TABLE.'.id', $exclude_user_id) + ->table(ProjectUserRoleModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter') + ->join(UserModel::TABLE, 'id', 'user_id') + ->eq(ProjectUserRoleModel::TABLE.'.project_id', $project_id) + ->eq(UserModel::TABLE.'.notifications_enabled', '1') + ->eq(UserModel::TABLE.'.is_active', 1) + ->neq(UserModel::TABLE.'.id', $exclude_user_id) ->findAll(); } private function getProjectGroupMembersWithNotificationEnabled($project_id, $exclude_user_id) { return $this->db - ->table(ProjectGroupRole::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter') - ->join(GroupMember::TABLE, 'group_id', 'group_id', ProjectGroupRole::TABLE) - ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE) - ->eq(ProjectGroupRole::TABLE.'.project_id', $project_id) - ->eq(User::TABLE.'.notifications_enabled', '1') - ->neq(User::TABLE.'.id', $exclude_user_id) - ->eq(User::TABLE.'.is_active', 1) + ->table(ProjectGroupRoleModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter') + ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', ProjectGroupRoleModel::TABLE) + ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE) + ->eq(ProjectGroupRoleModel::TABLE.'.project_id', $project_id) + ->eq(UserModel::TABLE.'.notifications_enabled', '1') + ->neq(UserModel::TABLE.'.id', $exclude_user_id) + ->eq(UserModel::TABLE.'.is_active', 1) ->findAll(); } @@ -194,11 +194,11 @@ class UserNotification extends Base private function getEverybodyWithNotificationEnabled($exclude_user_id) { return $this->db - ->table(User::TABLE) - ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter') + ->table(UserModel::TABLE) + ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter') ->eq('notifications_enabled', '1') - ->neq(User::TABLE.'.id', $exclude_user_id) - ->eq(User::TABLE.'.is_active', 1) + ->neq(UserModel::TABLE.'.id', $exclude_user_id) + ->eq(UserModel::TABLE.'.is_active', 1) ->findAll(); } } diff --git a/app/Model/UserNotificationType.php b/app/Model/UserNotificationTypeModel.php index d84cc690..0f377220 100644 --- a/app/Model/UserNotificationType.php +++ b/app/Model/UserNotificationTypeModel.php @@ -2,15 +2,13 @@ namespace Kanboard\Model; -use Kanboard\Core\Base; - /** * User Notification Type * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserNotificationType extends NotificationType +class UserNotificationTypeModel extends NotificationTypeModel { /** * SQL table name diff --git a/app/Model/UserUnreadNotification.php b/app/Model/UserUnreadNotificationModel.php index f3fcd601..6c930eef 100644 --- a/app/Model/UserUnreadNotification.php +++ b/app/Model/UserUnreadNotificationModel.php @@ -7,10 +7,10 @@ use Kanboard\Core\Base; /** * User Unread Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class UserUnreadNotification extends Base +class UserUnreadNotificationModel extends Base { /** * SQL table name @@ -112,6 +112,6 @@ class UserUnreadNotification extends Base private function unserialize(&$event) { $event['event_data'] = json_decode($event['event_data'], true); - $event['title'] = $this->notification->getTitleWithoutAuthor($event['event_name'], $event['event_data']); + $event['title'] = $this->notificationModel->getTitleWithoutAuthor($event['event_name'], $event['event_data']); } } diff --git a/app/Notification/ActivityStreamNotification.php b/app/Notification/ActivityStreamNotification.php index 8ac265d3..9f23c88a 100644 --- a/app/Notification/ActivityStreamNotification.php +++ b/app/Notification/ActivityStreamNotification.php @@ -36,7 +36,7 @@ class ActivityStreamNotification extends Base implements NotificationInterface public function notifyProject(array $project, $event_name, array $event_data) { if ($this->userSession->isLogged()) { - $this->projectActivity->createEvent( + $this->projectActivityModel->createEvent( $project['id'], $event_data['task']['id'], $this->userSession->getId(), diff --git a/app/Notification/MailNotification.php b/app/Notification/MailNotification.php index 0ba06715..2d27179c 100644 --- a/app/Notification/MailNotification.php +++ b/app/Notification/MailNotification.php @@ -4,10 +4,10 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; use Kanboard\Core\Notification\NotificationInterface; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFile; -use Kanboard\Model\Comment; -use Kanboard\Model\Subtask; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFileModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\SubtaskModel; /** * Email Notification @@ -68,7 +68,7 @@ class MailNotification extends Base implements NotificationInterface { return $this->template->render( 'notification/'.str_replace('.', '_', $event_name), - $event_data + array('application_url' => $this->config->get('application_url')) + $event_data + array('application_url' => $this->configModel->get('application_url')) ); } @@ -83,50 +83,50 @@ class MailNotification extends Base implements NotificationInterface public function getMailSubject($event_name, array $event_data) { switch ($event_name) { - case TaskFile::EVENT_CREATE: + case TaskFileModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New attachment'), $event_data); break; - case Comment::EVENT_CREATE: + case CommentModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New comment'), $event_data); break; - case Comment::EVENT_UPDATE: + case CommentModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Comment updated'), $event_data); break; - case Subtask::EVENT_CREATE: + case SubtaskModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New subtask'), $event_data); break; - case Subtask::EVENT_UPDATE: + case SubtaskModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Subtask updated'), $event_data); break; - case Task::EVENT_CREATE: + case TaskModel::EVENT_CREATE: $subject = $this->getStandardMailSubject(e('New task'), $event_data); break; - case Task::EVENT_UPDATE: + case TaskModel::EVENT_UPDATE: $subject = $this->getStandardMailSubject(e('Task updated'), $event_data); break; - case Task::EVENT_CLOSE: + case TaskModel::EVENT_CLOSE: $subject = $this->getStandardMailSubject(e('Task closed'), $event_data); break; - case Task::EVENT_OPEN: + case TaskModel::EVENT_OPEN: $subject = $this->getStandardMailSubject(e('Task opened'), $event_data); break; - case Task::EVENT_MOVE_COLUMN: + case TaskModel::EVENT_MOVE_COLUMN: $subject = $this->getStandardMailSubject(e('Column change'), $event_data); break; - case Task::EVENT_MOVE_POSITION: + case TaskModel::EVENT_MOVE_POSITION: $subject = $this->getStandardMailSubject(e('Position change'), $event_data); break; - case Task::EVENT_MOVE_SWIMLANE: + case TaskModel::EVENT_MOVE_SWIMLANE: $subject = $this->getStandardMailSubject(e('Swimlane change'), $event_data); break; - case Task::EVENT_ASSIGNEE_CHANGE: + case TaskModel::EVENT_ASSIGNEE_CHANGE: $subject = $this->getStandardMailSubject(e('Assignee change'), $event_data); break; - case Task::EVENT_USER_MENTION: - case Comment::EVENT_USER_MENTION: + case TaskModel::EVENT_USER_MENTION: + case CommentModel::EVENT_USER_MENTION: $subject = $this->getStandardMailSubject(e('Mentioned'), $event_data); break; - case Task::EVENT_OVERDUE: + case TaskModel::EVENT_OVERDUE: $subject = e('[%s] Overdue tasks', $event_data['project_name']); break; default: diff --git a/app/Notification/WebNotification.php b/app/Notification/WebNotification.php index 99c0c903..d8818828 100644 --- a/app/Notification/WebNotification.php +++ b/app/Notification/WebNotification.php @@ -30,7 +30,7 @@ class WebNotification extends Base implements NotificationInterface */ public function notifyUser(array $user, $event_name, array $event_data) { - $this->userUnreadNotification->create($user['id'], $event_name, $event_data); + $this->userUnreadNotificationModel->create($user['id'], $event_name, $event_data); } /** diff --git a/app/Notification/WebhookNotification.php b/app/Notification/WebhookNotification.php index 25d59251..16045535 100644 --- a/app/Notification/WebhookNotification.php +++ b/app/Notification/WebhookNotification.php @@ -35,8 +35,8 @@ class WebhookNotification extends Base implements NotificationInterface */ public function notifyProject(array $project, $event_name, array $event_data) { - $url = $this->config->get('webhook_url'); - $token = $this->config->get('webhook_token'); + $url = $this->configModel->get('webhook_url'); + $token = $this->configModel->get('webhook_token'); if (! empty($url)) { if (strpos($url, '?') !== false) { diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php index aa0f1111..3e6efb02 100644 --- a/app/ServiceProvider/ClassProvider.php +++ b/app/ServiceProvider/ClassProvider.php @@ -27,60 +27,60 @@ class ClassProvider implements ServiceProviderInterface 'AverageTimeSpentColumnAnalytic', ), 'Model' => array( - 'Action', - 'ActionParameter', - 'AvatarFile', - 'Board', - 'Category', - 'Color', - 'Column', - 'Comment', - 'Config', - 'Currency', - 'CustomFilter', - 'Group', - 'GroupMember', - 'Language', - 'LastLogin', - 'Link', - 'Notification', - 'PasswordReset', - 'Project', - 'ProjectFile', - 'ProjectActivity', - 'ProjectDuplication', - 'ProjectDailyColumnStats', - 'ProjectDailyStats', - 'ProjectPermission', - 'ProjectNotification', - 'ProjectMetadata', - 'ProjectGroupRole', - 'ProjectUserRole', - 'RememberMeSession', - 'Subtask', - 'SubtaskTimeTracking', - 'Swimlane', - 'Task', - 'TaskAnalytic', - 'TaskCreation', - 'TaskDuplication', - 'TaskExternalLink', - 'TaskFinder', - 'TaskFile', - 'TaskLink', - 'TaskModification', - 'TaskPosition', - 'TaskStatus', - 'TaskMetadata', - 'Timezone', - 'Transition', - 'User', - 'UserLocking', - 'UserMention', - 'UserNotification', - 'UserNotificationFilter', - 'UserUnreadNotification', - 'UserMetadata', + 'ActionModel', + 'ActionParameterModel', + 'AvatarFileModel', + 'BoardModel', + 'CategoryModel', + 'ColorModel', + 'ColumnModel', + 'CommentModel', + 'ConfigModel', + 'CurrencyModel', + 'CustomFilterModel', + 'GroupModel', + 'GroupMemberModel', + 'LanguageModel', + 'LastLoginModel', + 'LinkModel', + 'NotificationModel', + 'PasswordResetModel', + 'ProjectModel', + 'ProjectFileModel', + 'ProjectActivityModel', + 'ProjectDuplicationModel', + 'ProjectDailyColumnStatsModel', + 'ProjectDailyStatsModel', + 'ProjectPermissionModel', + 'ProjectNotificationModel', + 'ProjectMetadataModel', + 'ProjectGroupRoleModel', + 'ProjectUserRoleModel', + 'RememberMeSessionModel', + 'SubtaskModel', + 'SubtaskTimeTrackingModel', + 'SwimlaneModel', + 'TaskModel', + 'TaskAnalyticModel', + 'TaskCreationModel', + 'TaskDuplicationModel', + 'TaskExternalLinkModel', + 'TaskFinderModel', + 'TaskFileModel', + 'TaskLinkModel', + 'TaskModificationModel', + 'TaskPositionModel', + 'TaskStatusModel', + 'TaskMetadataModel', + 'TimezoneModel', + 'TransitionModel', + 'UserModel', + 'UserLockingModel', + 'UserMentionModel', + 'UserNotificationModel', + 'UserNotificationFilterModel', + 'UserUnreadNotificationModel', + 'UserMetadataModel', ), 'Validator' => array( 'ActionValidator', diff --git a/app/ServiceProvider/FilterProvider.php b/app/ServiceProvider/FilterProvider.php index b79c5185..cdef9ed8 100644 --- a/app/ServiceProvider/FilterProvider.php +++ b/app/ServiceProvider/FilterProvider.php @@ -27,10 +27,10 @@ use Kanboard\Filter\TaskStatusFilter; use Kanboard\Filter\TaskSubtaskAssigneeFilter; use Kanboard\Filter\TaskSwimlaneFilter; use Kanboard\Filter\TaskTitleFilter; -use Kanboard\Model\Project; -use Kanboard\Model\ProjectGroupRole; -use Kanboard\Model\ProjectUserRole; -use Kanboard\Model\User; +use Kanboard\Model\ProjectModel; +use Kanboard\Model\ProjectGroupRoleModel; +use Kanboard\Model\ProjectUserRoleModel; +use Kanboard\Model\UserModel; use Pimple\Container; use Pimple\ServiceProviderInterface; @@ -61,7 +61,7 @@ class FilterProvider implements ServiceProviderInterface { $container['userQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(User::TABLE)); + $builder->withQuery($c['db']->table(UserModel::TABLE)); return $builder; }); @@ -72,26 +72,26 @@ class FilterProvider implements ServiceProviderInterface { $container['projectGroupRoleQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(ProjectGroupRole::TABLE)); + $builder->withQuery($c['db']->table(ProjectGroupRoleModel::TABLE)); return $builder; }); $container['projectUserRoleQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(ProjectUserRole::TABLE)); + $builder->withQuery($c['db']->table(ProjectUserRoleModel::TABLE)); return $builder; }); $container['projectQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['db']->table(Project::TABLE)); + $builder->withQuery($c['db']->table(ProjectModel::TABLE)); return $builder; }); $container['projectActivityLexer'] = $container->factory(function ($c) { $builder = new LexerBuilder(); $builder - ->withQuery($c['projectActivity']->getQuery()) + ->withQuery($c['projectActivityModel']->getQuery()) ->withFilter(new ProjectActivityTaskTitleFilter(), true) ->withFilter(new ProjectActivityTaskStatusFilter()) ->withFilter(new ProjectActivityProjectNameFilter()) @@ -108,7 +108,7 @@ class FilterProvider implements ServiceProviderInterface $container['projectActivityQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['projectActivity']->getQuery()); + $builder->withQuery($c['projectActivityModel']->getQuery()); return $builder; }); @@ -120,7 +120,7 @@ class FilterProvider implements ServiceProviderInterface { $container['taskQuery'] = $container->factory(function ($c) { $builder = new QueryBuilder(); - $builder->withQuery($c['taskFinder']->getExtendedQuery()); + $builder->withQuery($c['taskFinderModel']->getExtendedQuery()); return $builder; }); @@ -128,13 +128,13 @@ class FilterProvider implements ServiceProviderInterface $builder = new LexerBuilder(); $builder - ->withQuery($c['taskFinder']->getExtendedQuery()) + ->withQuery($c['taskFinderModel']->getExtendedQuery()) ->withFilter(TaskAssigneeFilter::getInstance() ->setCurrentUserId($c['userSession']->getId()) ) ->withFilter(new TaskCategoryFilter()) ->withFilter(TaskColorFilter::getInstance() - ->setColorModel($c['color']) + ->setColorModel($c['colorModel']) ) ->withFilter(new TaskColumnFilter()) ->withFilter(new TaskCommentFilter()) diff --git a/app/ServiceProvider/NotificationProvider.php b/app/ServiceProvider/NotificationProvider.php index 2cb01576..a0571209 100644 --- a/app/ServiceProvider/NotificationProvider.php +++ b/app/ServiceProvider/NotificationProvider.php @@ -4,8 +4,8 @@ namespace Kanboard\ServiceProvider; use Pimple\Container; use Pimple\ServiceProviderInterface; -use Kanboard\Model\UserNotificationType; -use Kanboard\Model\ProjectNotificationType; +use Kanboard\Model\UserNotificationTypeModel; +use Kanboard\Model\ProjectNotificationTypeModel; use Kanboard\Notification\MailNotification as MailNotification; use Kanboard\Notification\WebNotification as WebNotification; @@ -26,15 +26,15 @@ class NotificationProvider implements ServiceProviderInterface */ public function register(Container $container) { - $container['userNotificationType'] = function ($container) { - $type = new UserNotificationType($container); + $container['userNotificationTypeModel'] = function ($container) { + $type = new UserNotificationTypeModel($container); $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\MailNotification'); $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\WebNotification'); return $type; }; - $container['projectNotificationType'] = function ($container) { - $type = new ProjectNotificationType($container); + $container['projectNotificationTypeModel'] = function ($container) { + $type = new ProjectNotificationTypeModel($container); $type->setType('webhook', 'Webhook', '\Kanboard\Notification\WebhookNotification', true); $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStreamNotification', true); return $type; diff --git a/app/Subscriber/AuthSubscriber.php b/app/Subscriber/AuthSubscriber.php index dfb95a00..0097c407 100644 --- a/app/Subscriber/AuthSubscriber.php +++ b/app/Subscriber/AuthSubscriber.php @@ -45,9 +45,9 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface $userAgent = $this->request->getUserAgent(); $ipAddress = $this->request->getIpAddress(); - $this->userLocking->resetFailedLogin($this->userSession->getUsername()); + $this->userLockingModel->resetFailedLogin($this->userSession->getUsername()); - $this->lastLogin->create( + $this->lastLoginModel->create( $event->getAuthType(), $this->userSession->getId(), $ipAddress, @@ -59,7 +59,7 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface } if (isset($this->sessionStorage->hasRememberMe) && $this->sessionStorage->hasRememberMe) { - $session = $this->rememberMeSession->create($this->userSession->getId(), $ipAddress, $userAgent); + $session = $this->rememberMeSessionModel->create($this->userSession->getId(), $ipAddress, $userAgent); $this->rememberMeCookie->write($session['token'], $session['sequence'], $session['expiration']); } } @@ -75,10 +75,10 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface $credentials = $this->rememberMeCookie->read(); if ($credentials !== false) { - $session = $this->rememberMeSession->find($credentials['token'], $credentials['sequence']); + $session = $this->rememberMeSessionModel->find($credentials['token'], $credentials['sequence']); if (! empty($session)) { - $this->rememberMeSession->remove($session['id']); + $this->rememberMeSessionModel->remove($session['id']); } $this->rememberMeCookie->remove(); @@ -97,10 +97,10 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface $username = $event->getUsername(); if (! empty($username)) { - $this->userLocking->incrementFailedLogin($username); + $this->userLockingModel->incrementFailedLogin($username); - if ($this->userLocking->getFailedLogin($username) > BRUTEFORCE_LOCKDOWN) { - $this->userLocking->lock($username, BRUTEFORCE_LOCKDOWN_DURATION); + if ($this->userLockingModel->getFailedLogin($username) > BRUTEFORCE_LOCKDOWN) { + $this->userLockingModel->lock($username, BRUTEFORCE_LOCKDOWN_DURATION); } } } diff --git a/app/Subscriber/BootstrapSubscriber.php b/app/Subscriber/BootstrapSubscriber.php index e60840f1..7d12e9ae 100644 --- a/app/Subscriber/BootstrapSubscriber.php +++ b/app/Subscriber/BootstrapSubscriber.php @@ -16,12 +16,12 @@ class BootstrapSubscriber extends BaseSubscriber implements EventSubscriberInter public function execute() { $this->logger->debug('Subscriber executed: '.__METHOD__); - $this->language->loadCurrentLanguage(); - $this->timezone->setCurrentTimezone(); + $this->languageModel->loadCurrentLanguage(); + $this->timezoneModel->setCurrentTimezone(); $this->actionManager->attachEvents(); if ($this->userSession->isLogged()) { - $this->sessionStorage->hasSubtaskInProgress = $this->subtask->hasSubtaskInProgress($this->userSession->getId()); + $this->sessionStorage->hasSubtaskInProgress = $this->subtaskModel->hasSubtaskInProgress($this->userSession->getId()); } } diff --git a/app/Subscriber/LdapUserPhotoSubscriber.php b/app/Subscriber/LdapUserPhotoSubscriber.php index 3cf46077..93672cd1 100644 --- a/app/Subscriber/LdapUserPhotoSubscriber.php +++ b/app/Subscriber/LdapUserPhotoSubscriber.php @@ -42,7 +42,7 @@ class LdapUserPhotoSubscriber extends BaseSubscriber implements EventSubscriberI if (empty($profile['avatar_path']) && ! empty($photo)) { $this->logger->info('Saving user photo from LDAP profile'); - $this->avatarFile->uploadImageContent($profile['id'], $photo); + $this->avatarFileModel->uploadImageContent($profile['id'], $photo); } } } diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php index 2a1fe6c7..db11e585 100644 --- a/app/Subscriber/NotificationSubscriber.php +++ b/app/Subscriber/NotificationSubscriber.php @@ -4,10 +4,10 @@ namespace Kanboard\Subscriber; use Kanboard\Event\GenericEvent; use Kanboard\Job\NotificationJob; -use Kanboard\Model\Task; -use Kanboard\Model\Comment; -use Kanboard\Model\Subtask; -use Kanboard\Model\TaskFile; +use Kanboard\Model\TaskModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\TaskFileModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class NotificationSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -15,21 +15,21 @@ class NotificationSubscriber extends BaseSubscriber implements EventSubscriberIn public static function getSubscribedEvents() { return array( - Task::EVENT_USER_MENTION => 'handleEvent', - Task::EVENT_CREATE => 'handleEvent', - Task::EVENT_UPDATE => 'handleEvent', - Task::EVENT_CLOSE => 'handleEvent', - Task::EVENT_OPEN => 'handleEvent', - Task::EVENT_MOVE_COLUMN => 'handleEvent', - Task::EVENT_MOVE_POSITION => 'handleEvent', - Task::EVENT_MOVE_SWIMLANE => 'handleEvent', - Task::EVENT_ASSIGNEE_CHANGE => 'handleEvent', - Subtask::EVENT_CREATE => 'handleEvent', - Subtask::EVENT_UPDATE => 'handleEvent', - Comment::EVENT_CREATE => 'handleEvent', - Comment::EVENT_UPDATE => 'handleEvent', - Comment::EVENT_USER_MENTION => 'handleEvent', - TaskFile::EVENT_CREATE => 'handleEvent', + TaskModel::EVENT_USER_MENTION => 'handleEvent', + TaskModel::EVENT_CREATE => 'handleEvent', + TaskModel::EVENT_UPDATE => 'handleEvent', + TaskModel::EVENT_CLOSE => 'handleEvent', + TaskModel::EVENT_OPEN => 'handleEvent', + TaskModel::EVENT_MOVE_COLUMN => 'handleEvent', + TaskModel::EVENT_MOVE_POSITION => 'handleEvent', + TaskModel::EVENT_MOVE_SWIMLANE => 'handleEvent', + TaskModel::EVENT_ASSIGNEE_CHANGE => 'handleEvent', + SubtaskModel::EVENT_CREATE => 'handleEvent', + SubtaskModel::EVENT_UPDATE => 'handleEvent', + CommentModel::EVENT_CREATE => 'handleEvent', + CommentModel::EVENT_UPDATE => 'handleEvent', + CommentModel::EVENT_USER_MENTION => 'handleEvent', + TaskFileModel::EVENT_CREATE => 'handleEvent', ); } diff --git a/app/Subscriber/ProjectDailySummarySubscriber.php b/app/Subscriber/ProjectDailySummarySubscriber.php index 982240c1..6971a121 100644 --- a/app/Subscriber/ProjectDailySummarySubscriber.php +++ b/app/Subscriber/ProjectDailySummarySubscriber.php @@ -4,7 +4,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\TaskEvent; use Kanboard\Job\ProjectMetricJob; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ProjectDailySummarySubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -12,11 +12,11 @@ class ProjectDailySummarySubscriber extends BaseSubscriber implements EventSubsc public static function getSubscribedEvents() { return array( - Task::EVENT_CREATE_UPDATE => 'execute', - Task::EVENT_CLOSE => 'execute', - Task::EVENT_OPEN => 'execute', - Task::EVENT_MOVE_COLUMN => 'execute', - Task::EVENT_MOVE_SWIMLANE => 'execute', + TaskModel::EVENT_CREATE_UPDATE => 'execute', + TaskModel::EVENT_CLOSE => 'execute', + TaskModel::EVENT_OPEN => 'execute', + TaskModel::EVENT_MOVE_COLUMN => 'execute', + TaskModel::EVENT_MOVE_SWIMLANE => 'execute', ); } diff --git a/app/Subscriber/ProjectModificationDateSubscriber.php b/app/Subscriber/ProjectModificationDateSubscriber.php index 62804a84..fee04eaa 100644 --- a/app/Subscriber/ProjectModificationDateSubscriber.php +++ b/app/Subscriber/ProjectModificationDateSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\GenericEvent; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ProjectModificationDateSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,14 +11,14 @@ class ProjectModificationDateSubscriber extends BaseSubscriber implements EventS public static function getSubscribedEvents() { return array( - Task::EVENT_CREATE_UPDATE => 'execute', - Task::EVENT_CLOSE => 'execute', - Task::EVENT_OPEN => 'execute', - Task::EVENT_MOVE_SWIMLANE => 'execute', - Task::EVENT_MOVE_COLUMN => 'execute', - Task::EVENT_MOVE_POSITION => 'execute', - Task::EVENT_MOVE_PROJECT => 'execute', - Task::EVENT_ASSIGNEE_CHANGE => 'execute', + TaskModel::EVENT_CREATE_UPDATE => 'execute', + TaskModel::EVENT_CLOSE => 'execute', + TaskModel::EVENT_OPEN => 'execute', + TaskModel::EVENT_MOVE_SWIMLANE => 'execute', + TaskModel::EVENT_MOVE_COLUMN => 'execute', + TaskModel::EVENT_MOVE_POSITION => 'execute', + TaskModel::EVENT_MOVE_PROJECT => 'execute', + TaskModel::EVENT_ASSIGNEE_CHANGE => 'execute', ); } @@ -26,7 +26,7 @@ class ProjectModificationDateSubscriber extends BaseSubscriber implements EventS { if (isset($event['project_id']) && !$this->isExecuted()) { $this->logger->debug('Subscriber executed: '.__METHOD__); - $this->project->updateModificationDate($event['project_id']); + $this->projectModel->updateModificationDate($event['project_id']); } } } diff --git a/app/Subscriber/RecurringTaskSubscriber.php b/app/Subscriber/RecurringTaskSubscriber.php index 09a5665a..75b7ff76 100644 --- a/app/Subscriber/RecurringTaskSubscriber.php +++ b/app/Subscriber/RecurringTaskSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\TaskEvent; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,8 +11,8 @@ class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberI public static function getSubscribedEvents() { return array( - Task::EVENT_MOVE_COLUMN => 'onMove', - Task::EVENT_CLOSE => 'onClose', + TaskModel::EVENT_MOVE_COLUMN => 'onMove', + TaskModel::EVENT_CLOSE => 'onClose', ); } @@ -20,11 +20,11 @@ class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberI { $this->logger->debug('Subscriber executed: '.__METHOD__); - if ($event['recurrence_status'] == Task::RECURRING_STATUS_PENDING) { - if ($event['recurrence_trigger'] == Task::RECURRING_TRIGGER_FIRST_COLUMN && $this->column->getFirstColumnId($event['project_id']) == $event['src_column_id']) { - $this->taskDuplication->duplicateRecurringTask($event['task_id']); - } elseif ($event['recurrence_trigger'] == Task::RECURRING_TRIGGER_LAST_COLUMN && $this->column->getLastColumnId($event['project_id']) == $event['dst_column_id']) { - $this->taskDuplication->duplicateRecurringTask($event['task_id']); + if ($event['recurrence_status'] == TaskModel::RECURRING_STATUS_PENDING) { + if ($event['recurrence_trigger'] == TaskModel::RECURRING_TRIGGER_FIRST_COLUMN && $this->columnModel->getFirstColumnId($event['project_id']) == $event['src_column_id']) { + $this->taskDuplicationModel->duplicateRecurringTask($event['task_id']); + } elseif ($event['recurrence_trigger'] == TaskModel::RECURRING_TRIGGER_LAST_COLUMN && $this->columnModel->getLastColumnId($event['project_id']) == $event['dst_column_id']) { + $this->taskDuplicationModel->duplicateRecurringTask($event['task_id']); } } } @@ -33,8 +33,8 @@ class RecurringTaskSubscriber extends BaseSubscriber implements EventSubscriberI { $this->logger->debug('Subscriber executed: '.__METHOD__); - if ($event['recurrence_status'] == Task::RECURRING_STATUS_PENDING && $event['recurrence_trigger'] == Task::RECURRING_TRIGGER_CLOSE) { - $this->taskDuplication->duplicateRecurringTask($event['task_id']); + if ($event['recurrence_status'] == TaskModel::RECURRING_STATUS_PENDING && $event['recurrence_trigger'] == TaskModel::RECURRING_TRIGGER_CLOSE) { + $this->taskDuplicationModel->duplicateRecurringTask($event['task_id']); } } } diff --git a/app/Subscriber/SubtaskTimeTrackingSubscriber.php b/app/Subscriber/SubtaskTimeTrackingSubscriber.php index c0852bc8..7e39c126 100644 --- a/app/Subscriber/SubtaskTimeTrackingSubscriber.php +++ b/app/Subscriber/SubtaskTimeTrackingSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Kanboard\Model\Subtask; +use Kanboard\Model\SubtaskModel; use Kanboard\Event\SubtaskEvent; class SubtaskTimeTrackingSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,9 +11,9 @@ class SubtaskTimeTrackingSubscriber extends BaseSubscriber implements EventSubsc public static function getSubscribedEvents() { return array( - Subtask::EVENT_CREATE => 'updateTaskTime', - Subtask::EVENT_DELETE => 'updateTaskTime', - Subtask::EVENT_UPDATE => array( + SubtaskModel::EVENT_CREATE => 'updateTaskTime', + SubtaskModel::EVENT_DELETE => 'updateTaskTime', + SubtaskModel::EVENT_UPDATE => array( array('logStartEnd', 10), array('updateTaskTime', 0), ) @@ -24,24 +24,24 @@ class SubtaskTimeTrackingSubscriber extends BaseSubscriber implements EventSubsc { if (isset($event['task_id'])) { $this->logger->debug('Subscriber executed: '.__METHOD__); - $this->subtaskTimeTracking->updateTaskTimeTracking($event['task_id']); + $this->subtaskTimeTrackingModel->updateTaskTimeTracking($event['task_id']); } } public function logStartEnd(SubtaskEvent $event) { - if (isset($event['status']) && $this->config->get('subtask_time_tracking') == 1) { + if (isset($event['status']) && $this->configModel->get('subtask_time_tracking') == 1) { $this->logger->debug('Subscriber executed: '.__METHOD__); - $subtask = $this->subtask->getById($event['id']); + $subtask = $this->subtaskModel->getById($event['id']); if (empty($subtask['user_id'])) { return false; } - if ($subtask['status'] == Subtask::STATUS_INPROGRESS) { - return $this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']); + if ($subtask['status'] == SubtaskModel::STATUS_INPROGRESS) { + return $this->subtaskTimeTrackingModel->logStartTime($subtask['id'], $subtask['user_id']); } else { - return $this->subtaskTimeTracking->logEndTime($subtask['id'], $subtask['user_id']); + return $this->subtaskTimeTrackingModel->logEndTime($subtask['id'], $subtask['user_id']); } } } diff --git a/app/Subscriber/TransitionSubscriber.php b/app/Subscriber/TransitionSubscriber.php index bd537484..26d08f88 100644 --- a/app/Subscriber/TransitionSubscriber.php +++ b/app/Subscriber/TransitionSubscriber.php @@ -3,7 +3,7 @@ namespace Kanboard\Subscriber; use Kanboard\Event\TaskEvent; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class TransitionSubscriber extends BaseSubscriber implements EventSubscriberInterface @@ -11,7 +11,7 @@ class TransitionSubscriber extends BaseSubscriber implements EventSubscriberInte public static function getSubscribedEvents() { return array( - Task::EVENT_MOVE_COLUMN => 'execute', + TaskModel::EVENT_MOVE_COLUMN => 'execute', ); } @@ -22,7 +22,7 @@ class TransitionSubscriber extends BaseSubscriber implements EventSubscriberInte $user_id = $this->userSession->getId(); if (! empty($user_id)) { - $this->transition->save($user_id, $event->getAll()); + $this->transitionModel->save($user_id, $event->getAll()); } } } diff --git a/app/Template/analytic/compare_hours.php b/app/Template/analytic/compare_hours.php index 03a2981a..70d8d02b 100644 --- a/app/Template/analytic/compare_hours.php +++ b/app/Template/analytic/compare_hours.php @@ -40,7 +40,7 @@ <?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </td> <td> - <?php if ($task['is_active'] == \Kanboard\Model\Task::STATUS_OPEN): ?> + <?php if ($task['is_active'] == \Kanboard\Model\TaskModel::STATUS_OPEN): ?> <?= t('Open') ?> <?php else: ?> <?= t('Closed') ?> diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index 8cf3e709..11df8962 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -33,11 +33,11 @@ </span> <?php endif ?> - <?php if ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PENDING): ?> + <?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PENDING): ?> <span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', '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'] == \Kanboard\Model\Task::RECURRING_STATUS_PROCESSED): ?> + <?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PROCESSED): ?> <span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', '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 ?> diff --git a/app/Template/dashboard/projects.php b/app/Template/dashboard/projects.php index 4aa40621..5bf92980 100644 --- a/app/Template/dashboard/projects.php +++ b/app/Template/dashboard/projects.php @@ -8,7 +8,7 @@ <tr> <th class="column-5"><?= $paginator->order('Id', 'id') ?></th> <th class="column-3"><?= $paginator->order('<i class="fa fa-lock fa-fw" title="'.t('Private project').'"></i>', 'is_private') ?></th> - <th class="column-25"><?= $paginator->order(t('Project'), \Kanboard\Model\Project::TABLE.'.name') ?></th> + <th class="column-25"><?= $paginator->order(t('Project'), \Kanboard\Model\ProjectModel::TABLE.'.name') ?></th> <th><?= t('Columns') ?></th> </tr> <?php foreach ($paginator->getCollection() as $project): ?> diff --git a/app/Template/project_creation/create.php b/app/Template/project_creation/create.php index fb892012..01d06bab 100644 --- a/app/Template/project_creation/create.php +++ b/app/Template/project_creation/create.php @@ -22,10 +22,10 @@ <?= $this->form->checkbox('projectPermission', t('Permissions'), 1, true) ?> <?php endif ?> - <?= $this->form->checkbox('category', t('Categories'), 1, true) ?> - <?= $this->form->checkbox('action', t('Actions'), 1, true) ?> - <?= $this->form->checkbox('swimlane', t('Swimlanes'), 1, true) ?> - <?= $this->form->checkbox('task', t('Tasks'), 1, false) ?> + <?= $this->form->checkbox('categoryModel', t('Categories'), 1, true) ?> + <?= $this->form->checkbox('actionModel', t('Actions'), 1, true) ?> + <?= $this->form->checkbox('swimlaneModel', t('Swimlanes'), 1, true) ?> + <?= $this->form->checkbox('taskModel', t('Tasks'), 1, false) ?> </div> <div class="form-actions"> diff --git a/app/Template/project_view/duplicate.php b/app/Template/project_view/duplicate.php index 41ae39df..d2cd127a 100644 --- a/app/Template/project_view/duplicate.php +++ b/app/Template/project_view/duplicate.php @@ -14,11 +14,11 @@ <?= $this->form->checkbox('projectPermission', t('Permissions'), 1, true) ?> <?php endif ?> - <?= $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) ?> - <?= $this->form->checkbox('projectMetadata', t('Metadata'), 1, false) ?> + <?= $this->form->checkbox('categoryModel', t('Categories'), 1, true) ?> + <?= $this->form->checkbox('actionModel', t('Actions'), 1, true) ?> + <?= $this->form->checkbox('swimlaneModel', t('Swimlanes'), 1, false) ?> + <?= $this->form->checkbox('taskModel', t('Tasks'), 1, false) ?> + <?= $this->form->checkbox('projectMetadataModel', t('Metadata'), 1, false) ?> <div class="form-actions"> <button type="submit" class="btn btn-red"><?= t('Duplicate') ?></button> diff --git a/app/Template/search/results.php b/app/Template/search/results.php index 97667c75..8376b9e8 100644 --- a/app/Template/search/results.php +++ b/app/Template/search/results.php @@ -41,7 +41,7 @@ <?= $this->dt->date($task['date_due']) ?> </td> <td> - <?php if ($task['is_active'] == \Kanboard\Model\Task::STATUS_OPEN): ?> + <?php if ($task['is_active'] == \Kanboard\Model\TaskModel::STATUS_OPEN): ?> <?= t('Open') ?> <?php else: ?> <?= t('Closed') ?> diff --git a/app/Template/task/time_tracking_details.php b/app/Template/task/time_tracking_details.php index d86273c5..1a179522 100644 --- a/app/Template/task/time_tracking_details.php +++ b/app/Template/task/time_tracking_details.php @@ -14,7 +14,7 @@ <th><?= $subtask_paginator->order(t('Subtask'), 'subtask_title') ?></th> <th class="column-20"><?= $subtask_paginator->order(t('Start'), 'start') ?></th> <th class="column-20"><?= $subtask_paginator->order(t('End'), 'end') ?></th> - <th class="column-10"><?= $subtask_paginator->order(t('Time spent'), \Kanboard\Model\SubtaskTimeTracking::TABLE.'.time_spent') ?></th> + <th class="column-10"><?= $subtask_paginator->order(t('Time spent'), \Kanboard\Model\SubtaskTimeTrackingModel::TABLE.'.time_spent') ?></th> </tr> <?php foreach ($subtask_paginator->getCollection() as $record): ?> <tr> diff --git a/app/Template/task_list/show.php b/app/Template/task_list/show.php index 9ffcb2e8..bb95b6a3 100644 --- a/app/Template/task_list/show.php +++ b/app/Template/task_list/show.php @@ -47,7 +47,7 @@ <?= $this->dt->date($task['date_due']) ?> </td> <td> - <?php if ($task['is_active'] == \Kanboard\Model\Task::STATUS_OPEN): ?> + <?php if ($task['is_active'] == \Kanboard\Model\TaskModel::STATUS_OPEN): ?> <?= t('Open') ?> <?php else: ?> <?= t('Closed') ?> diff --git a/app/Template/task_recurrence/edit.php b/app/Template/task_recurrence/edit.php index 550db2f8..09d14826 100644 --- a/app/Template/task_recurrence/edit.php +++ b/app/Template/task_recurrence/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Edit recurrence') ?></h2> </div> -<?php if ($task['recurrence_status'] != \Kanboard\Model\Task::RECURRING_STATUS_NONE): ?> +<?php if ($task['recurrence_status'] != \Kanboard\Model\TaskModel::RECURRING_STATUS_NONE): ?> <div class="listing"> <?= $this->render('task_recurrence/info', array( 'task' => $task, @@ -13,7 +13,7 @@ </div> <?php endif ?> -<?php if ($task['recurrence_status'] != \Kanboard\Model\Task::RECURRING_STATUS_PROCESSED): ?> +<?php if ($task['recurrence_status'] != \Kanboard\Model\TaskModel::RECURRING_STATUS_PROCESSED): ?> <form class="popover-form" method="post" action="<?= $this->url->href('TaskRecurrenceController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> diff --git a/app/Template/task_recurrence/info.php b/app/Template/task_recurrence/info.php index 97794604..04d58c7f 100644 --- a/app/Template/task_recurrence/info.php +++ b/app/Template/task_recurrence/info.php @@ -1,7 +1,7 @@ <ul> - <?php if ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PENDING): ?> + <?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PENDING): ?> <li><?= t('Recurrent task is scheduled to be generated') ?></li> - <?php elseif ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PROCESSED): ?> + <?php elseif ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PROCESSED): ?> <li><?= t('Recurrent task has been generated:') ?> <ul> <li> diff --git a/app/User/Avatar/GravatarProvider.php b/app/User/Avatar/GravatarProvider.php index 87ca51b1..e066d766 100644 --- a/app/User/Avatar/GravatarProvider.php +++ b/app/User/Avatar/GravatarProvider.php @@ -37,6 +37,6 @@ class GravatarProvider extends Base implements AvatarProviderInterface */ public function isActive(array $user) { - return !empty($user['email']) && $this->config->get('integration_gravatar') == 1; + return !empty($user['email']) && $this->configModel->get('integration_gravatar') == 1; } } diff --git a/app/User/LdapUserProvider.php b/app/User/LdapUserProvider.php index 74cf4cd5..274d7665 100644 --- a/app/User/LdapUserProvider.php +++ b/app/User/LdapUserProvider.php @@ -3,7 +3,7 @@ namespace Kanboard\User; use Kanboard\Core\User\UserProviderInterface; -use Kanboard\Model\Language; +use Kanboard\Model\LanguageModel; /** * LDAP User Provider @@ -211,7 +211,7 @@ class LdapUserProvider implements UserProviderInterface $attributes = array('is_ldap_user' => 1); if (! empty($this->language)) { - $attributes['language'] = Language::findCode($this->language); + $attributes['language'] = LanguageModel::findCode($this->language); } return $attributes; diff --git a/app/Validator/AuthValidator.php b/app/Validator/AuthValidator.php index cd6e04d5..14d66ee4 100644 --- a/app/Validator/AuthValidator.php +++ b/app/Validator/AuthValidator.php @@ -59,7 +59,7 @@ class AuthValidator extends Base $result = true; $errors = array(); - if ($this->userLocking->isLocked($values['username'])) { + if ($this->userLockingModel->isLocked($values['username'])) { $result = false; $errors['login'] = t('Your account is locked for %d minutes', BRUTEFORCE_LOCKDOWN_DURATION); $this->logger->error('Account locked: '.$values['username']); @@ -100,7 +100,7 @@ class AuthValidator extends Base $result = true; $errors = array(); - if ($this->userLocking->hasCaptcha($values['username'])) { + if ($this->userLockingModel->hasCaptcha($values['username'])) { if (! isset($this->sessionStorage->captcha)) { $result = false; } else { diff --git a/app/Validator/GroupValidator.php b/app/Validator/GroupValidator.php index 2226abd3..2946ca23 100644 --- a/app/Validator/GroupValidator.php +++ b/app/Validator/GroupValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Group; +use Kanboard\Model\GroupModel; /** * Group Validator @@ -63,7 +63,7 @@ class GroupValidator extends Base return array( new Validators\Required('name', t('The name is required')), new Validators\MaxLength('name', t('The maximum length is %d characters', 100), 100), - new Validators\Unique('name', t('The name must be unique'), $this->db->getConnection(), Group::TABLE, 'id'), + new Validators\Unique('name', t('The name must be unique'), $this->db->getConnection(), GroupModel::TABLE, 'id'), new Validators\MaxLength('external_id', t('The maximum length is %d characters', 255), 255), new Validators\Integer('id', t('This value must be an integer')), ); diff --git a/app/Validator/LinkValidator.php b/app/Validator/LinkValidator.php index 10a826da..2a9967a2 100644 --- a/app/Validator/LinkValidator.php +++ b/app/Validator/LinkValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Link; +use Kanboard\Model\LinkModel; /** * Link Validator @@ -25,7 +25,7 @@ class LinkValidator extends Base { $v = new Validator($values, array( new Validators\Required('label', t('Field required')), - new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), Link::TABLE), + new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), LinkModel::TABLE), new Validators\NotEquals('label', 'opposite_label', t('The labels must be different')), )); @@ -48,7 +48,7 @@ class LinkValidator extends Base new Validators\Required('id', t('Field required')), new Validators\Required('opposite_id', t('Field required')), new Validators\Required('label', t('Field required')), - new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), Link::TABLE), + new Validators\Unique('label', t('This label must be unique'), $this->db->getConnection(), LinkModel::TABLE), )); return array( diff --git a/app/Validator/ProjectValidator.php b/app/Validator/ProjectValidator.php index 1c6c90f8..b1406a2f 100644 --- a/app/Validator/ProjectValidator.php +++ b/app/Validator/ProjectValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Project Validator @@ -34,7 +34,7 @@ class ProjectValidator extends Base new Validators\MaxLength('start_date', t('The maximum length is %d characters', 10), 10), new Validators\MaxLength('end_date', t('The maximum length is %d characters', 10), 10), new Validators\AlphaNumeric('identifier', t('This value must be alphanumeric')) , - new Validators\Unique('identifier', t('The identifier must be unique'), $this->db->getConnection(), Project::TABLE), + new Validators\Unique('identifier', t('The identifier must be unique'), $this->db->getConnection(), ProjectModel::TABLE), ); } diff --git a/app/Validator/TaskLinkValidator.php b/app/Validator/TaskLinkValidator.php index c88c2b16..1c167e4c 100644 --- a/app/Validator/TaskLinkValidator.php +++ b/app/Validator/TaskLinkValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Task Link Validator @@ -27,7 +27,7 @@ class TaskLinkValidator extends Base new Validators\Required('opposite_task_id', t('Field required')), new Validators\Required('link_id', t('Field required')), new Validators\NotEquals('opposite_task_id', 'task_id', t('A task cannot be linked to itself')), - new Validators\Exists('opposite_task_id', t('This linked task id doesn\'t exists'), $this->db->getConnection(), Task::TABLE, 'id') + new Validators\Exists('opposite_task_id', t('This linked task id doesn\'t exists'), $this->db->getConnection(), TaskModel::TABLE, 'id') ); } diff --git a/app/Validator/UserValidator.php b/app/Validator/UserValidator.php index e5953f30..1a24f23e 100644 --- a/app/Validator/UserValidator.php +++ b/app/Validator/UserValidator.php @@ -4,7 +4,7 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; /** * User Validator @@ -25,7 +25,7 @@ class UserValidator extends Base return array( new Validators\MaxLength('role', t('The maximum length is %d characters', 25), 25), new Validators\MaxLength('username', t('The maximum length is %d characters', 50), 50), - new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), User::TABLE, 'id'), + new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), UserModel::TABLE, 'id'), new Validators\Email('email', t('Email address invalid')), new Validators\Integer('is_ldap_user', t('This value must be an integer')), ); |