diff options
Diffstat (limited to 'app')
501 files changed, 3916 insertions, 3461 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 deleted file mode 100644 index a9ad5baf..00000000 --- a/app/Api/AuthApi.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -namespace Kanboard\Api; - -use JsonRPC\Exception\AuthenticationFailureException; - -/** - * Base class - * - * @package Kanboard\Api - * @author Frederic Guillot - */ -class AuthApi extends BaseApi -{ - /** - * Check api credentials - * - * @access public - * @param string $username - * @param string $password - * @param string $class - * @param string $method - * @throws AuthenticationFailureException - */ - public function checkCredentials($username, $password, $class, $method) - { - $this->dispatcher->dispatch('app.bootstrap'); - - if ($this->isUserAuthenticated($username, $password)) { - $this->checkProcedurePermission(true, $method); - $this->userSession->initialize($this->user->getByUsername($username)); - } elseif ($this->isAppAuthenticated($username, $password)) { - $this->checkProcedurePermission(false, $method); - } else { - $this->logger->error('API authentication failure for '.$username); - throw new AuthenticationFailureException('Wrong credentials'); - } - } - - /** - * Check user credentials - * - * @access public - * @param string $username - * @param string $password - * @return boolean - */ - private function isUserAuthenticated($username, $password) - { - return $username !== 'jsonrpc' && - ! $this->userLocking->isLocked($username) && - $this->authenticationManager->passwordAuthentication($username, $password); - } - - /** - * Check administrative credentials - * - * @access public - * @param string $username - * @param string $password - * @return boolean - */ - private function isAppAuthenticated($username, $password) - { - return $username === 'jsonrpc' && $password === $this->getApiToken(); - } - - /** - * Get API Token - * - * @access private - * @return string - */ - private function getApiToken() - { - if (defined('API_AUTHENTICATION_TOKEN')) { - return API_AUTHENTICATION_TOKEN; - } - - return $this->config->get('api_token'); - } -} diff --git a/app/Api/BaseApi.php b/app/Api/BaseApi.php index 37e11030..9f69aa65 100644 --- a/app/Api/BaseApi.php +++ b/app/Api/BaseApi.php @@ -13,54 +13,9 @@ use Kanboard\Core\Base; */ abstract class BaseApi extends Base { - private $user_allowed_procedures = array( - 'getMe', - 'getMyDashboard', - 'getMyActivityStream', - 'createMyPrivateProject', - 'getMyProjectsList', - 'getMyProjects', - 'getMyOverdueTasks', - ); - - private $both_allowed_procedures = array( - 'getTimezone', - 'getVersion', - 'getDefaultTaskColor', - 'getDefaultTaskColors', - 'getColorList', - 'getProjectById', - 'getTask', - 'getTaskByReference', - 'getAllTasks', - 'openTask', - 'closeTask', - 'moveTaskPosition', - 'createTask', - 'updateTask', - 'getBoard', - 'getProjectActivity', - 'getOverdueTasksByProject', - 'searchTasks', - ); - - public function checkProcedurePermission($is_user, $procedure) - { - $is_both_procedure = in_array($procedure, $this->both_allowed_procedures); - $is_user_procedure = in_array($procedure, $this->user_allowed_procedures); - - if ($is_user && ! $is_both_procedure && ! $is_user_procedure) { - throw new AccessDeniedException('Permission denied'); - } elseif (! $is_user && ! $is_both_procedure && $is_user_procedure) { - throw new AccessDeniedException('Permission denied'); - } - - $this->logger->debug('API call: '.$procedure); - } - 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,15 +23,15 @@ 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)); } } protected function formatTask($task) { if (! empty($task)) { - $task['url'] = $this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true); - $task['color'] = $this->color->getColorProperties($task['color_id']); + $task['url'] = $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true); + $task['color'] = $this->colorModel->getColorProperties($task['color_id']); } return $task; @@ -97,9 +52,9 @@ abstract class BaseApi extends Base { if (! empty($project)) { $project['url'] = array( - 'board' => $this->helper->url->to('board', 'show', array('project_id' => $project['id']), '', true), - 'calendar' => $this->helper->url->to('calendar', 'show', array('project_id' => $project['id']), '', true), - 'list' => $this->helper->url->to('listing', 'show', array('project_id' => $project['id']), '', true), + 'board' => $this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id']), '', true), + 'calendar' => $this->helper->url->to('CalendarController', 'show', array('project_id' => $project['id']), '', true), + 'list' => $this->helper->url->to('TaskListController', 'show', array('project_id' => $project['id']), '', true), ); } 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/Middleware/AuthenticationApiMiddleware.php b/app/Api/Middleware/AuthenticationApiMiddleware.php new file mode 100644 index 00000000..5f63e1a1 --- /dev/null +++ b/app/Api/Middleware/AuthenticationApiMiddleware.php @@ -0,0 +1,130 @@ +<?php + +namespace Kanboard\Api\Middleware; + +use JsonRPC\Exception\AccessDeniedException; +use JsonRPC\Exception\AuthenticationFailureException; +use JsonRPC\MiddlewareInterface; +use Kanboard\Core\Base; + +/** + * Class AuthenticationApiMiddleware + * + * @package Kanboard\Api\Middleware + * @author Frederic Guillot + */ +class AuthenticationApiMiddleware extends Base implements MiddlewareInterface +{ + private $user_allowed_procedures = array( + 'getMe', + 'getMyDashboard', + 'getMyActivityStream', + 'createMyPrivateProject', + 'getMyProjectsList', + 'getMyProjects', + 'getMyOverdueTasks', + ); + + private $both_allowed_procedures = array( + 'getTimezone', + 'getVersion', + 'getDefaultTaskColor', + 'getDefaultTaskColors', + 'getColorList', + 'getProjectById', + 'getTask', + 'getTaskByReference', + 'getAllTasks', + 'openTask', + 'closeTask', + 'moveTaskPosition', + 'createTask', + 'updateTask', + 'getBoard', + 'getProjectActivity', + 'getOverdueTasksByProject', + 'searchTasks', + ); + + /** + * Execute Middleware + * + * @access public + * @param string $username + * @param string $password + * @param string $procedureName + * @throws AccessDeniedException + * @throws AuthenticationFailureException + */ + public function execute($username, $password, $procedureName) + { + $this->dispatcher->dispatch('app.bootstrap'); + + if ($this->isUserAuthenticated($username, $password)) { + $this->checkProcedurePermission(true, $procedureName); + $this->userSession->initialize($this->userModel->getByUsername($username)); + } elseif ($this->isAppAuthenticated($username, $password)) { + $this->checkProcedurePermission(false, $procedureName); + } else { + $this->logger->error('API authentication failure for '.$username); + throw new AuthenticationFailureException('Wrong credentials'); + } + } + + /** + * Check user credentials + * + * @access public + * @param string $username + * @param string $password + * @return boolean + */ + private function isUserAuthenticated($username, $password) + { + return $username !== 'jsonrpc' && + ! $this->userLockingModel->isLocked($username) && + $this->authenticationManager->passwordAuthentication($username, $password); + } + + /** + * Check administrative credentials + * + * @access public + * @param string $username + * @param string $password + * @return boolean + */ + private function isAppAuthenticated($username, $password) + { + return $username === 'jsonrpc' && $password === $this->getApiToken(); + } + + /** + * Get API Token + * + * @access private + * @return string + */ + private function getApiToken() + { + if (defined('API_AUTHENTICATION_TOKEN')) { + return API_AUTHENTICATION_TOKEN; + } + + return $this->configModel->get('api_token'); + } + + public function checkProcedurePermission($is_user, $procedure) + { + $is_both_procedure = in_array($procedure, $this->both_allowed_procedures); + $is_user_procedure = in_array($procedure, $this->user_allowed_procedures); + + if ($is_user && ! $is_both_procedure && ! $is_user_procedure) { + throw new AccessDeniedException('Permission denied'); + } elseif (! $is_user && ! $is_both_procedure && $is_user_procedure) { + throw new AccessDeniedException('Permission denied'); + } + + $this->logger->debug('API call: '.$procedure); + } +} 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..50417071 100644 --- a/app/Console/BaseCommand.php +++ b/app/Console/BaseCommand.php @@ -11,24 +11,25 @@ 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 \Kanboard\Core\Queue\QueueManager $queueManager + * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher */ abstract class BaseCommand extends Command { diff --git a/app/Console/PluginInstallCommand.php b/app/Console/PluginInstallCommand.php index 1c6e14b3..a82f0069 100644 --- a/app/Console/PluginInstallCommand.php +++ b/app/Console/PluginInstallCommand.php @@ -4,6 +4,7 @@ namespace Kanboard\Console; use Kanboard\Core\Plugin\Installer; use Kanboard\Core\Plugin\PluginInstallerException; +use LogicException; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -21,7 +22,7 @@ class PluginInstallCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { if (!Installer::isConfigured()) { - $output->writeln('<error>Kanboard is not configured to install plugins itself</error>'); + throw new LogicException('Kanboard is not configured to install plugins itself'); } try { diff --git a/app/Console/PluginUninstallCommand.php b/app/Console/PluginUninstallCommand.php index c645e03f..48722130 100644 --- a/app/Console/PluginUninstallCommand.php +++ b/app/Console/PluginUninstallCommand.php @@ -4,6 +4,7 @@ namespace Kanboard\Console; use Kanboard\Core\Plugin\Installer; use Kanboard\Core\Plugin\PluginInstallerException; +use LogicException; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -21,7 +22,7 @@ class PluginUninstallCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { if (!Installer::isConfigured()) { - $output->writeln('<error>Kanboard is not configured to remove plugins itself</error>'); + throw new LogicException('Kanboard is not configured to install plugins itself'); } try { diff --git a/app/Console/PluginUpgradeCommand.php b/app/Console/PluginUpgradeCommand.php index 839124b1..6c66e917 100644 --- a/app/Console/PluginUpgradeCommand.php +++ b/app/Console/PluginUpgradeCommand.php @@ -5,6 +5,7 @@ namespace Kanboard\Console; use Kanboard\Core\Plugin\Base as BasePlugin; use Kanboard\Core\Plugin\Directory; use Kanboard\Core\Plugin\Installer; +use LogicException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -21,7 +22,7 @@ class PluginUpgradeCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { if (!Installer::isConfigured()) { - $output->writeln('<error>Kanboard is not configured to upgrade plugins itself</error>'); + throw new LogicException('Kanboard is not configured to install plugins itself'); } $installer = new Installer($this->container); 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/Action.php b/app/Controller/ActionController.php index 40497a62..097640f6 100644 --- a/app/Controller/Action.php +++ b/app/Controller/ActionController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Automatic Actions + * Automatic Actions Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Action extends BaseController +class ActionController extends BaseController { /** * List of automatic actions for a given project @@ -18,7 +18,7 @@ class Action 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 Action 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 Action 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,14 +64,14 @@ class Action 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.')); } - $this->response->redirect($this->helper->url->to('action', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id']))); } } diff --git a/app/Controller/ActionCreation.php b/app/Controller/ActionCreationController.php index 388b30e2..e984f8d4 100644 --- a/app/Controller/ActionCreation.php +++ b/app/Controller/ActionCreationController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Action Creation + * Action Creation Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class ActionCreation extends BaseController +class ActionCreationController extends BaseController { /** * Show the form (step 1) @@ -69,19 +69,19 @@ class ActionCreation 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,13 +110,13 @@ class ActionCreation 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.')); } } - $this->response->redirect($this->helper->url->to('action', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id']))); } } diff --git a/app/Controller/Activity.php b/app/Controller/ActivityController.php index 0c6aa3f3..9f9841af 100644 --- a/app/Controller/Activity.php +++ b/app/Controller/ActivityController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Activity stream + * Activity Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Activity extends BaseController +class ActivityController extends BaseController { /** * Activity page for a project @@ -38,7 +38,7 @@ class Activity 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/Analytic.php b/app/Controller/AnalyticController.php index ba73c15c..cf3ba034 100644 --- a/app/Controller/Analytic.php +++ b/app/Controller/AnalyticController.php @@ -3,15 +3,15 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** - * Project Analytic controller + * Project Analytic Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Analytic extends BaseController +class AnalyticController extends BaseController { /** * Show average Lead and Cycle time @@ -30,8 +30,8 @@ class Analytic 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']), ))); @@ -47,7 +47,7 @@ class Analytic extends BaseController $project = $this->getProject(); $paginator = $this->paginator - ->setUrl('analytic', 'compareHours', array('project_id' => $project['id'])) + ->setUrl('AnalyticController', 'compareHours', array('project_id' => $project['id'])) ->setMax(30) ->setOrder(TaskModel::TABLE.'.id') ->setQuery($this->taskQuery @@ -145,7 +145,7 @@ class Analytic 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 Analytic 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/AppController.php b/app/Controller/AppController.php index 60bc154a..45cf39a5 100644 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -8,6 +8,7 @@ use Kanboard\Core\Base; * Class AppController * * @package Kanboard\Controller + * @author Frederic Guillot */ class AppController extends Base { diff --git a/app/Controller/Auth.php b/app/Controller/AuthController.php index cad44a34..dc46070c 100644 --- a/app/Controller/Auth.php +++ b/app/Controller/AuthController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Authentication controller + * Authentication Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Auth extends BaseController +class AuthController extends BaseController { /** * Display the form login @@ -23,7 +23,7 @@ class Auth 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, @@ -59,9 +59,9 @@ class Auth extends BaseController { if (! DISABLE_LOGOUT) { $this->sessionManager->close(); - $this->response->redirect($this->helper->url->to('auth', 'login')); + $this->response->redirect($this->helper->url->to('AuthController', 'login')); } else { - $this->response->redirect($this->helper->url->to('auth', 'index')); + $this->response->redirect($this->helper->url->to('AuthController', 'index')); } } diff --git a/app/Controller/AvatarFile.php b/app/Controller/AvatarFileController.php index 1891a2fc..6879c577 100644 --- a/app/Controller/AvatarFile.php +++ b/app/Controller/AvatarFileController.php @@ -8,10 +8,10 @@ use Kanboard\Core\Thumbnail; /** * Avatar File Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class AvatarFile extends BaseController +class AvatarFileController extends BaseController { /** * Display avatar page @@ -32,11 +32,11 @@ class AvatarFile 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.')); } - $this->response->redirect($this->helper->url->to('AvatarFile', 'show', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id']))); } /** @@ -46,9 +46,9 @@ class AvatarFile 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('AvatarFile', 'show', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id']))); } /** @@ -58,7 +58,7 @@ class AvatarFile 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/Board.php b/app/Controller/BoardAjaxController.php index 0f6b3b14..24914671 100644 --- a/app/Controller/Board.php +++ b/app/Controller/BoardAjaxController.php @@ -6,67 +6,15 @@ use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Formatter\BoardFormatter; /** - * Board controller + * Class BoardAjaxController * - * @package controller - * @author Frederic Guillot + * @package Kanboard\Controller + * @author Fredric Guillot */ -class Board extends BaseController +class BoardAjaxController extends BaseController { /** - * Display the public version of a board - * Access checked by a simple token, no user login, read only, auto-refresh - * - * @access public - */ - public function readonly() - { - $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); - - // Token verification - if (empty($project)) { - throw AccessForbiddenException::getInstance()->withoutLayout(); - } - - // Display the board with a specific layout - $this->response->html($this->helper->layout->app('board/view_public', array( - 'project' => $project, - 'swimlanes' => $this->board->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'), - ))); - } - - /** - * Show a board for a given project - * - * @access public - */ - public function show() - { - $project = $this->getProject(); - $search = $this->helper->projectHeader->getSearchQuery($project); - - $this->response->html($this->helper->layout->app('board/view_private', array( - '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'), - 'swimlanes' => $this->taskLexer - ->build($search) - ->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id'])) - ))); - } - - /** - * Save the board (Ajax request made by the drag and drop) + * Save new task positions (Ajax request made by the drag and drop) * * @access public */ @@ -80,7 +28,7 @@ class Board extends BaseController $values = $this->request->getJson(); - $result =$this->taskPosition->movePosition( + $result =$this->taskPositionModel->movePosition( $project_id, $values['task_id'], $values['column_id'], @@ -106,8 +54,8 @@ class Board extends BaseController $timestamp = $this->request->getIntegerParam('timestamp'); if (! $project_id || ! $this->request->isAjax()) { - $this->response->status(403); - } elseif (! $this->project->isModifiedSince($project_id, $timestamp)) { + throw new AccessForbiddenException(); + } elseif (! $this->projectModel->isModifiedSince($project_id, $timestamp)) { $this->response->status(304); } else { $this->response->html($this->renderBoard($project_id)); @@ -167,23 +115,23 @@ class Board extends BaseController if ($this->request->isAjax()) { $this->response->html($this->renderBoard($project_id)); } else { - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id))); + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project_id))); } } /** * Render board * - * @access private + * @access protected * @param integer $project_id * @return string */ - private function renderBoard($project_id) + 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/BoardPopover.php b/app/Controller/BoardPopoverController.php index d3117f78..a0f5ae12 100644 --- a/app/Controller/BoardPopover.php +++ b/app/Controller/BoardPopoverController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Board Popover + * Board Popover Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class BoardPopover extends BaseController +class BoardPopoverController extends BaseController { /** * Confirmation before to close all column tasks @@ -23,9 +23,9 @@ class BoardPopover 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 BoardPopover 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->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id']))); + $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/BoardTooltip.php b/app/Controller/BoardTooltipController.php index 49d02ced..2a947027 100644 --- a/app/Controller/BoardTooltip.php +++ b/app/Controller/BoardTooltipController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Board Tooltip * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class BoardTooltip extends BaseController +class BoardTooltipController extends BaseController { /** * Get links on mouseover @@ -19,7 +19,7 @@ class BoardTooltip 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 BoardTooltip 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 BoardTooltip 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 BoardTooltip 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 BoardTooltip 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 BoardTooltip 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 BoardTooltip 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 new file mode 100644 index 00000000..496fa995 --- /dev/null +++ b/app/Controller/BoardViewController.php @@ -0,0 +1,65 @@ +<?php + +namespace Kanboard\Controller; + +use Kanboard\Core\Controller\AccessForbiddenException; +use Kanboard\Formatter\BoardFormatter; + +/** + * Board controller + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class BoardViewController extends BaseController +{ + /** + * Display the public version of a board + * Access checked by a simple token, no user login, read only, auto-refresh + * + * @access public + */ + public function readonly() + { + $token = $this->request->getStringParam('token'); + $project = $this->projectModel->getByToken($token); + + if (empty($project)) { + throw AccessForbiddenException::getInstance()->withoutLayout(); + } + + $this->response->html($this->helper->layout->app('board/view_public', array( + 'project' => $project, + 'swimlanes' => $this->boardModel->getBoard($project['id']), + 'title' => $project['name'], + 'description' => $project['description'], + 'no_layout' => true, + 'not_editable' => true, + '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'), + ))); + } + + /** + * Show a board for a given project + * + * @access public + */ + public function show() + { + $project = $this->getProject(); + $search = $this->helper->projectHeader->getSearchQuery($project); + + $this->response->html($this->helper->layout->app('board/view_private', array( + 'project' => $project, + 'title' => $project['name'], + 'description' => $this->helper->projectHeader->getDescription($project), + '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/Calendar.php b/app/Controller/CalendarController.php index 706c1d3b..e5114f02 100644 --- a/app/Controller/Calendar.php +++ b/app/Controller/CalendarController.php @@ -5,16 +5,16 @@ 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; /** - * Project Calendar controller + * Calendar Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot * @author Timo Litzbarski */ -class Calendar extends BaseController +class CalendarController extends BaseController { /** * Show calendar view for projects @@ -29,7 +29,7 @@ class Calendar 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 Calendar 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 Calendar 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/Captcha.php b/app/Controller/CaptchaController.php index f6c717b3..43b2f823 100644 --- a/app/Controller/Captcha.php +++ b/app/Controller/CaptchaController.php @@ -7,10 +7,10 @@ use Gregwar\Captcha\CaptchaBuilder; /** * Captcha Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Captcha extends BaseController +class CaptchaController extends BaseController { /** * Display captcha image diff --git a/app/Controller/Category.php b/app/Controller/CategoryController.php index 954d92cc..dd6e1c35 100644 --- a/app/Controller/Category.php +++ b/app/Controller/CategoryController.php @@ -5,12 +5,12 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\PageNotFoundException; /** - * Category management + * Category Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Category extends BaseController +class CategoryController extends BaseController { /** * Get the category (common method between actions) @@ -21,7 +21,7 @@ class Category 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 Category 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,9 +64,9 @@ class Category extends BaseController list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { - if ($this->category->create($values)) { + if ($this->categoryModel->create($values) !== false) { $this->flash->success(t('Your category have been created successfully.')); - return $this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); } else { $this->flash->failure(t('Unable to create your category.')); } @@ -109,9 +109,9 @@ class Category 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('category', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); } else { $this->flash->failure(t('Unable to update your category.')); } @@ -148,12 +148,12 @@ class Category 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.')); } - $this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); } } diff --git a/app/Controller/Column.php b/app/Controller/ColumnController.php index 294c31d8..95fbcaaa 100644 --- a/app/Controller/Column.php +++ b/app/Controller/ColumnController.php @@ -5,12 +5,12 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\AccessForbiddenException; /** - * Column controller + * Column Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Column extends BaseController +class ColumnController extends BaseController { /** * Display columns list @@ -20,7 +20,7 @@ class Column 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,9 +66,9 @@ class Column 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']) !== false) { $this->flash->success(t('Column created successfully.')); - return $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])), true); + return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); } else { $errors['title'] = array(t('Another column with the same name exists in the project')); } @@ -87,7 +87,7 @@ class Column 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,9 +111,9 @@ class Column 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('column', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); } else { $this->flash->failure(t('Unable to update this board.')); } @@ -133,7 +133,7 @@ class Column 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 Column 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,12 +167,12 @@ class Column 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.')); } - $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); } } diff --git a/app/Controller/Comment.php b/app/Controller/CommentController.php index 83a67b41..2a8c258a 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/CommentController.php @@ -6,12 +6,12 @@ use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\PageNotFoundException; /** - * Comment controller + * Comment Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Comment extends BaseController +class CommentController extends BaseController { /** * Get the current comment @@ -23,7 +23,7 @@ class Comment 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,13 +76,13 @@ class Comment extends BaseController list($valid, $errors) = $this->commentValidator->validateCreation($values); if ($valid) { - if ($this->comment->create($values)) { + if ($this->commentModel->create($values) !== false) { $this->flash->success(t('Comment added successfully.')); } else { $this->flash->failure(t('Unable to create your comment.')); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true); } return $this->create($values, $errors); @@ -125,13 +125,13 @@ class Comment 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.')); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false); } return $this->edit($values, $errors); @@ -165,13 +165,13 @@ class Comment 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.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); } /** @@ -186,6 +186,6 @@ class Comment extends BaseController $order = $this->userSession->getCommentSorting() === 'ASC' ? 'DESC' : 'ASC'; $this->userSession->setCommentSorting($order); - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); } } diff --git a/app/Controller/Config.php b/app/Controller/ConfigController.php index abf6565c..8bcf4c35 100644 --- a/app/Controller/Config.php +++ b/app/Controller/ConfigController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Config controller + * Config Controller * - * @package controller + * @package Kanboard/Controller * @author Frederic Guillot */ -class Config extends BaseController +class ConfigController extends BaseController { /** * Display the about page @@ -18,7 +18,7 @@ class Config 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,14 +54,14 @@ class Config 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.')); } - $this->response->redirect($this->helper->url->to('config', $redirect)); + $this->response->redirect($this->helper->url->to('ConfigController', $redirect)); } /** @@ -72,8 +72,8 @@ class Config 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 Config 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 Config extends BaseController { $this->checkCSRFParam(); $this->response->withFileDownload('db.sqlite.gz'); - $this->response->binary($this->config->downloadDatabase()); + $this->response->binary($this->configModel->downloadDatabase()); } /** @@ -175,9 +175,9 @@ class Config 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('config', 'index')); + $this->response->redirect($this->helper->url->to('ConfigController', 'index')); } /** @@ -190,9 +190,9 @@ class Config 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('config', $type)); + $this->response->redirect($this->helper->url->to('ConfigController', $type)); } } diff --git a/app/Controller/Currency.php b/app/Controller/CurrencyController.php index 872d6929..ad590035 100644 --- a/app/Controller/Currency.php +++ b/app/Controller/CurrencyController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Currency controller + * Currency Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Currency extends BaseController +class CurrencyController extends BaseController { /** * Display all currency rates and form @@ -20,11 +20,11 @@ class Currency 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,9 +40,9 @@ class Currency 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('currency', 'index')); + return $this->response->redirect($this->helper->url->to('CurrencyController', 'index')); } else { $this->flash->failure(t('Unable to add this currency rate.')); } @@ -60,12 +60,12 @@ class Currency 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.')); } - $this->response->redirect($this->helper->url->to('currency', 'index')); + $this->response->redirect($this->helper->url->to('CurrencyController', 'index')); } } diff --git a/app/Controller/Customfilter.php b/app/Controller/CustomFilterController.php index d0794366..e5f674cd 100644 --- a/app/Controller/Customfilter.php +++ b/app/Controller/CustomFilterController.php @@ -6,17 +6,21 @@ use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Security\Role; /** - * Custom Filter management + * Custom Filter Controller * - * @package controller + * @package Kanboard\Controller * @author Timo Litzbarski + * @author Frederic Guillot */ -class Customfilter extends BaseController +class CustomFilterController extends BaseController { /** * Display list of filters * * @access public + * @param array $values + * @param array $errors + * @throws \Kanboard\Core\Controller\PageNotFoundException */ public function index(array $values = array(), array $errors = array()) { @@ -26,7 +30,7 @@ class Customfilter 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'), ))); } @@ -46,9 +50,9 @@ class Customfilter extends BaseController list($valid, $errors) = $this->customFilterValidator->validateCreation($values); if ($valid) { - if ($this->customFilter->create($values)) { + if ($this->customFilterModel->create($values) !== false) { $this->flash->success(t('Your custom filter have been created successfully.')); - return $this->response->redirect($this->helper->url->to('customfilter', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); } else { $this->flash->failure(t('Unable to create your custom filter.')); } @@ -65,7 +69,7 @@ class Customfilter 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, @@ -83,28 +87,32 @@ class Customfilter 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.')); } - $this->response->redirect($this->helper->url->to('customfilter', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); } /** * Edit a custom filter (display the form) * * @access public + * @param array $values + * @param array $errors + * @throws AccessForbiddenException + * @throws \Kanboard\Core\Controller\PageNotFoundException */ 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); @@ -125,7 +133,7 @@ class Customfilter 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); @@ -142,9 +150,9 @@ class Customfilter 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('customfilter', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); } else { $this->flash->failure(t('Unable to update custom filter.')); } @@ -157,7 +165,7 @@ class Customfilter 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/Doc.php b/app/Controller/DocumentationController.php index 5caf5f5f..d86fb3c8 100644 --- a/app/Controller/Doc.php +++ b/app/Controller/DocumentationController.php @@ -7,10 +7,10 @@ use Parsedown; /** * Documentation Viewer * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Doc extends BaseController +class DocumentationController extends BaseController { public function show() { @@ -20,7 +20,7 @@ class Doc 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'; @@ -71,7 +71,7 @@ class Doc extends BaseController */ public function replaceMarkdownUrl(array $matches) { - return '('.$this->helper->url->to('doc', 'show', array('file' => str_replace('.markdown', '', $matches[1]))).')'; + return '('.$this->helper->url->to('DocumentationController', 'show', array('file' => str_replace('.markdown', '', $matches[1]))).')'; } /** @@ -83,7 +83,7 @@ class Doc 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/Export.php b/app/Controller/ExportController.php index 7e1d2fdc..b2fe0ebd 100644 --- a/app/Controller/Export.php +++ b/app/Controller/ExportController.php @@ -3,12 +3,12 @@ namespace Kanboard\Controller; /** - * Export controller + * Export Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Export extends BaseController +class ExportController extends BaseController { /** * Common export method @@ -35,14 +35,14 @@ class Export extends BaseController $this->response->html($this->helper->layout->project('export/'.$action, array( 'values' => array( - 'controller' => 'export', + 'controller' => 'ExportController', 'action' => $action, 'project_id' => $project['id'], 'from' => $from, '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/Feed.php b/app/Controller/FeedController.php index 7554a499..cf2b1088 100644 --- a/app/Controller/Feed.php +++ b/app/Controller/FeedController.php @@ -7,10 +7,10 @@ use Kanboard\Core\Controller\AccessForbiddenException; /** * Atom/RSS Feed controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Feed extends BaseController +class FeedController extends BaseController { /** * RSS feed for a user @@ -20,7 +20,7 @@ class Feed 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 Feed 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 Feed 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/FileViewer.php b/app/Controller/FileViewerController.php index a49b0fb2..245845c7 100644 --- a/app/Controller/FileViewer.php +++ b/app/Controller/FileViewerController.php @@ -7,10 +7,10 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException; /** * File Viewer Controller * - * @package controller + * @package Kanbaord\Controller * @author Frederic Guillot */ -class FileViewer extends BaseController +class FileViewerController extends BaseController { /** * Get file content from object storage diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php deleted file mode 100644 index d062b2fe..00000000 --- a/app/Controller/Gantt.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php - -namespace Kanboard\Controller; - -use Kanboard\Filter\ProjectIdsFilter; -use Kanboard\Filter\ProjectStatusFilter; -use Kanboard\Filter\ProjectTypeFilter; -use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Formatter\ProjectGanttFormatter; -use Kanboard\Formatter\TaskGanttFormatter; -use Kanboard\Model\Task as TaskModel; -use Kanboard\Model\Project as ProjectModel; - -/** - * Gantt controller - * - * @package controller - * @author Frederic Guillot - */ -class Gantt extends BaseController -{ - /** - * Show Gantt chart for all projects - */ - public function projects() - { - $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); - $filter = $this->projectQuery - ->withFilter(new ProjectTypeFilter(ProjectModel::TYPE_TEAM)) - ->withFilter(new ProjectStatusFilter(ProjectModel::ACTIVE)) - ->withFilter(new ProjectIdsFilter($project_ids)); - - $filter->getQuery()->asc(ProjectModel::TABLE.'.start_date'); - - $this->response->html($this->helper->layout->app('gantt/projects', array( - 'projects' => $filter->format(new ProjectGanttFormatter($this->container)), - 'title' => t('Gantt chart for all projects'), - ))); - } - - /** - * Save new project start date and end date - */ - public function saveProjectDate() - { - $values = $this->request->getJson(); - - $result = $this->project->update(array( - 'id' => $values['id'], - 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])), - 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])), - )); - - if (! $result) { - $this->response->json(array('message' => 'Unable to save project'), 400); - } else { - $this->response->json(array('message' => 'OK'), 201); - } - } - - /** - * Show Gantt chart for one project - */ - public function project() - { - $project = $this->getProject(); - $search = $this->helper->projectHeader->getSearchQuery($project); - $sorting = $this->request->getStringParam('sorting', 'board'); - $filter = $this->taskLexer->build($search)->withFilter(new TaskProjectFilter($project['id'])); - - if ($sorting === 'date') { - $filter->getQuery()->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation'); - } else { - $filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position'); - } - - $this->response->html($this->helper->layout->app('gantt/project', array( - 'project' => $project, - 'title' => $project['name'], - 'description' => $this->helper->projectHeader->getDescription($project), - 'sorting' => $sorting, - 'tasks' => $filter->format(new TaskGanttFormatter($this->container)), - ))); - } - - /** - * Save new task start date and due date - */ - public function saveTaskDate() - { - $this->getProject(); - $values = $this->request->getJson(); - - $result = $this->taskModification->update(array( - 'id' => $values['id'], - 'date_started' => strtotime($values['start']), - 'date_due' => strtotime($values['end']), - )); - - if (! $result) { - $this->response->json(array('message' => 'Unable to save task'), 400); - } else { - $this->response->json(array('message' => 'OK'), 201); - } - } - - /** - * Simplified form to create a new task - * - * @access public - * @param array $values - * @param array $errors - * @throws \Kanboard\Core\Controller\PageNotFoundException - */ - public function task(array $values = array(), array $errors = array()) - { - $project = $this->getProject(); - - $values = $values + array( - 'project_id' => $project['id'], - 'column_id' => $this->column->getFirstColumnId($project['id']), - 'position' => 1 - ); - - $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); - $values = $this->hook->merge('controller:gantt:task:form:default', $values, array('default_values' => $values)); - - $this->response->html($this->template->render('gantt/task_creation', array( - '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), - 'title' => $project['name'].' > '.t('New task') - ))); - } - - /** - * Validate and save a new task - * - * @access public - */ - public function saveTask() - { - $project = $this->getProject(); - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateCreation($values); - - if ($valid) { - $task_id = $this->taskCreation->create($values); - - if ($task_id !== false) { - $this->flash->success(t('Task created successfully.')); - return $this->response->redirect($this->helper->url->to('gantt', 'project', array('project_id' => $project['id']))); - } else { - $this->flash->failure(t('Unable to create your task.')); - } - } - - return $this->task($values, $errors); - } -} 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/Ical.php b/app/Controller/ICalendarController.php index 091ea5f4..e354c6f1 100644 --- a/app/Controller/Ical.php +++ b/app/Controller/ICalendarController.php @@ -8,16 +8,16 @@ 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; /** - * iCalendar controller + * iCalendar Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Ical extends BaseController +class ICalendarController extends BaseController { /** * Get user iCalendar @@ -27,7 +27,7 @@ class Ical 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 Ical 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 Ical 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 Ical 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/Link.php b/app/Controller/LinkController.php index d28f5e4e..477b25a4 100644 --- a/app/Controller/Link.php +++ b/app/Controller/LinkController.php @@ -5,13 +5,13 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\PageNotFoundException; /** - * Link controller + * Link Controller * - * @package controller + * @package Kanboard\Controller * @author Olivier Maridat * @author Frederic Guillot */ -class Link extends BaseController +class LinkController extends BaseController { /** * Get the current link @@ -22,7 +22,7 @@ class Link 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 Link 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,9 +59,9 @@ class Link 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('link', 'index')); + return $this->response->redirect($this->helper->url->to('LinkController', 'index')); } else { $this->flash->failure(t('Unable to create your link.')); } @@ -86,7 +86,7 @@ class Link 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,9 +103,9 @@ class Link 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('link', 'index')); + return $this->response->redirect($this->helper->url->to('LinkController', 'index')); } else { $this->flash->failure(t('Unable to update your link.')); } @@ -139,12 +139,12 @@ class Link 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.')); } - $this->response->redirect($this->helper->url->to('link', 'index')); + $this->response->redirect($this->helper->url->to('LinkController', 'index')); } } diff --git a/app/Controller/Oauth.php b/app/Controller/OAuthController.php index 04adf154..7663ddcc 100644 --- a/app/Controller/Oauth.php +++ b/app/Controller/OAuthController.php @@ -5,12 +5,12 @@ namespace Kanboard\Controller; use Kanboard\Core\Security\OAuthAuthenticationProviderInterface; /** - * OAuth controller + * OAuth Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Oauth extends BaseController +class OAuthController extends BaseController { /** * Redirect to the provider if no code received diff --git a/app/Controller/PasswordReset.php b/app/Controller/PasswordResetController.php index 7050d6d2..18b4be80 100644 --- a/app/Controller/PasswordReset.php +++ b/app/Controller/PasswordResetController.php @@ -7,10 +7,10 @@ use Kanboard\Core\Controller\AccessForbiddenException; /** * Password Reset Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class PasswordReset extends BaseController +class PasswordResetController extends BaseController { /** * Show the form to reset the password @@ -38,7 +38,7 @@ class PasswordReset extends BaseController if ($valid) { $this->sendEmail($values['username']); - $this->response->redirect($this->helper->url->to('auth', 'login')); + $this->response->redirect($this->helper->url->to('AuthController', 'login')); } else { $this->create($values, $errors); } @@ -52,7 +52,7 @@ class PasswordReset 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( @@ -62,7 +62,7 @@ class PasswordReset extends BaseController 'no_layout' => true, ))); } else { - $this->response->redirect($this->helper->url->to('auth', 'login')); + $this->response->redirect($this->helper->url->to('AuthController', 'login')); } } @@ -78,14 +78,14 @@ class PasswordReset 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('auth', 'login')); + return $this->response->redirect($this->helper->url->to('AuthController', 'login')); } return $this->change($values, $errors); @@ -96,10 +96,10 @@ class PasswordReset 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 PasswordReset 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/ActionProject.php b/app/Controller/ProjectActionDuplicationController.php index 10b3c9d4..a4993cca 100644 --- a/app/Controller/ActionProject.php +++ b/app/Controller/ProjectActionDuplicationController.php @@ -5,18 +5,18 @@ namespace Kanboard\Controller; /** * Duplicate automatic action from another project * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class ActionProject extends BaseController +class ProjectActionDuplicationController extends BaseController { - public function project() + 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('action_project/project', array( + $this->response->html($this->template->render('project_action_duplication/show', array( 'project' => $project, 'projects_list' => $projects, ))); @@ -27,12 +27,12 @@ class ActionProject 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.')); } - $this->response->redirect($this->helper->url->to('action', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id']))); } } diff --git a/app/Controller/ProjectCreation.php b/app/Controller/ProjectCreationController.php index 0ffa2174..c471cfdd 100644 --- a/app/Controller/ProjectCreation.php +++ b/app/Controller/ProjectCreationController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Project Creation Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class ProjectCreation extends BaseController +class ProjectCreationController extends BaseController { /** * Display a form to create a new project @@ -20,7 +20,7 @@ class ProjectCreation 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 ProjectCreation 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 ProjectCreation 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 774c6909..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 { @@ -97,11 +97,11 @@ class ProjectEditController extends BaseController { if ($redirect === 'edit') { if (isset($values['is_private'])) { - if (! $this->helper->user->hasProjectAccess('ProjectCreation', 'create', $project['id'])) { + if (! $this->helper->user->hasProjectAccess('ProjectCreationController', 'create', $project['id'])) { unset($values['is_private']); } } elseif ($project['is_private'] == 1 && ! isset($values['is_private'])) { - if ($this->helper->user->hasProjectAccess('ProjectCreation', 'create', $project['id'])) { + if ($this->helper->user->hasProjectAccess('ProjectCreationController', 'create', $project['id'])) { $values += array('is_private' => 0); } } @@ -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/ProjectFile.php b/app/Controller/ProjectFileController.php index 6ec5ff27..cbe48679 100644 --- a/app/Controller/ProjectFile.php +++ b/app/Controller/ProjectFileController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Project File Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class ProjectFile extends BaseController +class ProjectFileController extends BaseController { /** * File upload form @@ -34,11 +34,11 @@ class ProjectFile 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.')); } - $this->response->redirect($this->helper->url->to('ProjectOverview', 'show', array('project_id' => $project['id'])), true); + $this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id'])), true); } /** @@ -50,15 +50,15 @@ class ProjectFile 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.')); } - $this->response->redirect($this->helper->url->to('ProjectOverview', 'show', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id']))); } /** @@ -69,7 +69,7 @@ class ProjectFile 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 new file mode 100644 index 00000000..a70d9eee --- /dev/null +++ b/app/Controller/ProjectGanttController.php @@ -0,0 +1,57 @@ +<?php + +namespace Kanboard\Controller; + +use Kanboard\Filter\ProjectIdsFilter; +use Kanboard\Filter\ProjectStatusFilter; +use Kanboard\Filter\ProjectTypeFilter; +use Kanboard\Formatter\ProjectGanttFormatter; +use Kanboard\Model\ProjectModel; + +/** + * Projects Gantt Controller + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class ProjectGanttController extends BaseController +{ + /** + * Show Gantt chart for all projects + */ + public function show() + { + $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); + $filter = $this->projectQuery + ->withFilter(new ProjectTypeFilter(ProjectModel::TYPE_TEAM)) + ->withFilter(new ProjectStatusFilter(ProjectModel::ACTIVE)) + ->withFilter(new ProjectIdsFilter($project_ids)); + + $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)), + 'title' => t('Gantt chart for all projects'), + ))); + } + + /** + * Save new project start date and end date + */ + public function save() + { + $values = $this->request->getJson(); + + $result = $this->projectModel->update(array( + 'id' => $values['id'], + 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])), + 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])), + )); + + if (! $result) { + $this->response->json(array('message' => 'Unable to save project'), 400); + } else { + $this->response->json(array('message' => 'OK'), 201); + } + } +} 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/ProjectOverview.php b/app/Controller/ProjectOverviewController.php index f8837f95..abdff657 100644 --- a/app/Controller/ProjectOverview.php +++ b/app/Controller/ProjectOverviewController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Project Overview Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class ProjectOverview extends BaseController +class ProjectOverviewController extends BaseController { /** * Show project overview @@ -16,17 +16,17 @@ class ProjectOverview 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/Projectuser.php b/app/Controller/ProjectUserOverviewController.php index fe1fe0f1..686de830 100644 --- a/app/Controller/Projectuser.php +++ b/app/Controller/ProjectUserOverviewController.php @@ -2,36 +2,36 @@ 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; /** * Project User overview * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Projectuser extends BaseController +class ProjectUserOverviewController extends BaseController { private function common() { $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); @@ -39,13 +39,13 @@ class Projectuser extends BaseController } $paginator = $this->paginator - ->setUrl('projectuser', $action, array('user_id' => $user_id)) + ->setUrl('ProjectUserOverviewController', $action, array('user_id' => $user_id)) ->setMax(30) ->setOrder('projects.name') ->setQuery($query) ->calculate(); - $this->response->html($this->helper->layout->projectUser('project_user/roles', array( + $this->response->html($this->helper->layout->projectUser('project_user_overview/roles', array( 'paginator' => $paginator, 'title' => $title, 'user_id' => $user_id, @@ -57,7 +57,7 @@ class Projectuser 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); @@ -65,13 +65,13 @@ class Projectuser extends BaseController } $paginator = $this->paginator - ->setUrl('projectuser', $action, array('user_id' => $user_id)) + ->setUrl('ProjectUserOverviewController', $action, array('user_id' => $user_id)) ->setMax(50) ->setOrder(TaskModel::TABLE.'.id') ->setQuery($query) ->calculate(); - $this->response->html($this->helper->layout->projectUser('project_user/tasks', array( + $this->response->html($this->helper->layout->projectUser('project_user_overview/tasks', array( 'paginator' => $paginator, 'title' => $title, 'user_id' => $user_id, @@ -122,8 +122,8 @@ class Projectuser extends BaseController { $project = $this->getProject(); - return $this->response->html($this->template->render('project_user/tooltip_users', array( - 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), + return $this->response->html($this->template->render('project_user_overview/tooltip_users', array( + '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/Search.php b/app/Controller/SearchController.php index a092cba6..8557b182 100644 --- a/app/Controller/Search.php +++ b/app/Controller/SearchController.php @@ -5,21 +5,21 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectsFilter; /** - * Search controller + * Search Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Search extends BaseController +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; $paginator = $this->paginator - ->setUrl('search', 'index', array('search' => $search)) + ->setUrl('SearchController', 'index', array('search' => $search)) ->setMax(30) ->setOrder('tasks.id') ->setDirection('DESC'); @@ -39,7 +39,7 @@ class Search extends BaseController $this->response->html($this->helper->layout->app('search/index', array( 'values' => array( 'search' => $search, - 'controller' => 'search', + 'controller' => 'SearchController', 'action' => 'index', ), 'paginator' => $paginator, @@ -56,7 +56,7 @@ class Search extends BaseController $this->response->html($this->helper->layout->app('search/activity', array( 'values' => array( 'search' => $search, - 'controller' => 'search', + 'controller' => 'SearchController', 'action' => 'activity', ), 'title' => t('Search in activity stream').($nb_events > 0 ? ' ('.$nb_events.')' : ''), diff --git a/app/Controller/SubtaskController.php b/app/Controller/SubtaskController.php index 830548da..93dab5cd 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) !== false) { $this->flash->success(t('Sub-task added successfully.')); } else { $this->flash->failure(t('Unable to create your sub-task.')); @@ -64,7 +64,7 @@ class SubtaskController extends BaseController return $this->create(array('project_id' => $task['project_id'], 'task_id' => $task['id'], 'another_subtask' => 1)); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'), true); } return $this->create($values, $errors); @@ -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,13 +108,13 @@ 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.')); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } return $this->edit($values, $errors); @@ -147,13 +147,13 @@ 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.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } /** @@ -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 829b937a..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.')); @@ -34,6 +34,6 @@ class SubtaskConverterController extends BaseController $this->flash->failure(t('Unable to convert the subtask.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $project['id'], 'task_id' => $task_id)), true); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $project['id'], 'task_id' => $task_id)), true); } } diff --git a/app/Controller/SubtaskRestrictionController.php b/app/Controller/SubtaskRestrictionController.php index 185371e7..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,17 +45,17 @@ 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, )); - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } } diff --git a/app/Controller/SubtaskStatusController.php b/app/Controller/SubtaskStatusController.php index e24002dc..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,9 +64,8 @@ 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, - 'redirect' => 'task', )); } } diff --git a/app/Controller/Swimlane.php b/app/Controller/SwimlaneController.php index 4575e909..c7c20ce8 100644 --- a/app/Controller/Swimlane.php +++ b/app/Controller/SwimlaneController.php @@ -4,15 +4,15 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\PageNotFoundException; -use Kanboard\Model\Swimlane as SwimlaneModel; +use Kanboard\Model\SwimlaneModel; /** - * Swimlanes + * Swimlanes Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Swimlane extends BaseController +class SwimlaneController extends BaseController { /** * Get the swimlane (common method between actions) @@ -23,7 +23,7 @@ class Swimlane 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 Swimlane 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,9 +81,9 @@ class Swimlane extends BaseController list($valid, $errors) = $this->swimlaneValidator->validateCreation($values); if ($valid) { - if ($this->swimlane->create($values)) { + if ($this->swimlaneModel->create($values) !== false) { $this->flash->success(t('Your swimlane have been created successfully.')); - return $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } @@ -103,7 +103,7 @@ class Swimlane 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,9 +125,9 @@ class Swimlane 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('swimlane', 'index', array('project_id' => $project['id'])), true); + return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])), true); } else { $this->flash->failure(t('Unable to update this swimlane.')); } @@ -169,9 +169,9 @@ class Swimlane 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('swimlane', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } @@ -207,13 +207,13 @@ class Swimlane 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.')); } - $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } /** @@ -227,13 +227,13 @@ class Swimlane 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.')); } - $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } /** @@ -246,13 +246,13 @@ class Swimlane 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.')); } - $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } /** @@ -266,13 +266,13 @@ class Swimlane 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.')); } - $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } /** @@ -285,13 +285,13 @@ class Swimlane 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.')); } - $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } /** @@ -305,7 +305,7 @@ class Swimlane 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/TaskHelper.php b/app/Controller/TaskAjaxController.php index 2f14c0eb..f9feff15 100644 --- a/app/Controller/TaskHelper.php +++ b/app/Controller/TaskAjaxController.php @@ -9,12 +9,12 @@ use Kanboard\Filter\TaskTitleFilter; use Kanboard\Formatter\TaskAutoCompleteFormatter; /** - * Task Ajax Helper + * Task Ajax Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class TaskHelper extends BaseController +class TaskAjaxController extends BaseController { /** * Task auto-completion (Ajax) @@ -24,7 +24,7 @@ class TaskHelper 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 4b4a2594..df7f589b 100644 --- a/app/Controller/TaskBulkController.php +++ b/app/Controller/TaskBulkController.php @@ -6,6 +6,7 @@ namespace Kanboard\Controller; * Class TaskBulkController * * @package Kanboard\Controller + * @author Frederic Guillot */ class TaskBulkController extends BaseController { @@ -31,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']), ))); } @@ -49,7 +50,7 @@ class TaskBulkController extends BaseController if ($valid) { $this->createTasks($project, $values); $this->response->redirect($this->helper->url->to( - 'Board', + 'BoardViewController', 'show', array('project_id' => $project['id']), 'swimlane-'. $values['swimlane_id'] @@ -73,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 2a63ddcc..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); } @@ -82,6 +82,6 @@ class TaskCreationController extends BaseController )); } - return $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id'])), true); + return $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true); } } diff --git a/app/Controller/Taskduplication.php b/app/Controller/TaskDuplicationController.php index ff60228e..6a475374 100644 --- a/app/Controller/Taskduplication.php +++ b/app/Controller/TaskDuplicationController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Task Duplication controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Taskduplication extends BaseController +class TaskDuplicationController extends BaseController { /** * Duplicate a task @@ -21,14 +21,14 @@ class Taskduplication 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.')); - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id))); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id))); } else { $this->flash->failure(t('Unable to create this task.')); - return $this->response->redirect($this->helper->url->to('taskduplication', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + return $this->response->redirect($this->helper->url->to('TaskDuplicationController', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } } @@ -50,14 +50,14 @@ class Taskduplication 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'], $values['category_id'], $values['owner_id'])) { $this->flash->success(t('Task updated successfully.')); - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $values['project_id'], 'task_id' => $task['id']))); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $values['project_id'], 'task_id' => $task['id']))); } $this->flash->failure(t('Unable to update your task.')); @@ -80,14 +80,14 @@ class Taskduplication 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'] ); if ($task_id > 0) { $this->flash->success(t('Task created successfully.')); - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $values['project_id'], 'task_id' => $task_id))); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $values['project_id'], 'task_id' => $task_id))); } } @@ -107,19 +107,19 @@ class Taskduplication 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/TaskExternalLink.php b/app/Controller/TaskExternalLinkController.php index 9f040957..9c04eb00 100644 --- a/app/Controller/TaskExternalLink.php +++ b/app/Controller/TaskExternalLinkController.php @@ -8,10 +8,10 @@ use Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound; /** * Task External Link Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class TaskExternalLink extends BaseController +class TaskExternalLinkController extends BaseController { /** * First creation form @@ -76,9 +76,9 @@ class TaskExternalLink 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) !== false) { $this->flash->success(t('Link added successfully.')); - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } return $this->edit($values, $errors); @@ -100,7 +100,7 @@ class TaskExternalLink 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,9 +128,9 @@ class TaskExternalLink 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('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } return $this->edit($values, $errors); @@ -145,7 +145,7 @@ class TaskExternalLink 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,12 +167,12 @@ class TaskExternalLink 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.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } } diff --git a/app/Controller/TaskFile.php b/app/Controller/TaskFileController.php index 0fcd2d69..77c0c026 100644 --- a/app/Controller/TaskFile.php +++ b/app/Controller/TaskFileController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Task File Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class TaskFile extends BaseController +class TaskFileController extends BaseController { /** * Screenshot @@ -19,9 +19,9 @@ class TaskFile 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('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } return $this->response->html($this->template->render('task_file/screenshot', array( @@ -53,11 +53,11 @@ class TaskFile 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.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } /** @@ -69,15 +69,15 @@ class TaskFile 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.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } /** @@ -88,7 +88,7 @@ class TaskFile 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 new file mode 100644 index 00000000..868368e1 --- /dev/null +++ b/app/Controller/TaskGanttController.php @@ -0,0 +1,62 @@ +<?php + +namespace Kanboard\Controller; + +use Kanboard\Filter\TaskProjectFilter; +use Kanboard\Formatter\TaskGanttFormatter; +use Kanboard\Model\TaskModel; + +/** + * Tasks Gantt Controller + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class TaskGanttController extends BaseController +{ + /** + * Show Gantt chart for one project + */ + public function show() + { + $project = $this->getProject(); + $search = $this->helper->projectHeader->getSearchQuery($project); + $sorting = $this->request->getStringParam('sorting', 'board'); + $filter = $this->taskLexer->build($search)->withFilter(new TaskProjectFilter($project['id'])); + + if ($sorting === 'date') { + $filter->getQuery()->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation'); + } else { + $filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position'); + } + + $this->response->html($this->helper->layout->app('task_gantt/show', array( + 'project' => $project, + 'title' => $project['name'], + 'description' => $this->helper->projectHeader->getDescription($project), + 'sorting' => $sorting, + 'tasks' => $filter->format(new TaskGanttFormatter($this->container)), + ))); + } + + /** + * Save new task start date and due date + */ + public function save() + { + $this->getProject(); + $values = $this->request->getJson(); + + $result = $this->taskModificationModel->update(array( + 'id' => $values['id'], + 'date_started' => strtotime($values['start']), + 'date_due' => strtotime($values['end']), + )); + + if (! $result) { + $this->response->json(array('message' => 'Unable to save task'), 400); + } else { + $this->response->json(array('message' => 'OK'), 201); + } + } +} diff --git a/app/Controller/TaskGanttCreationController.php b/app/Controller/TaskGanttCreationController.php new file mode 100644 index 00000000..c2998a3e --- /dev/null +++ b/app/Controller/TaskGanttCreationController.php @@ -0,0 +1,71 @@ +<?php + +namespace Kanboard\Controller; + +/** + * Class TaskGanttCreationController + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class TaskGanttCreationController extends BaseController +{ + /** + * Simplified form to create a new task + * + * @access public + * @param array $values + * @param array $errors + * @throws \Kanboard\Core\Controller\PageNotFoundException + */ + public function show(array $values = array(), array $errors = array()) + { + $project = $this->getProject(); + + $values = $values + array( + 'project_id' => $project['id'], + 'column_id' => $this->columnModel->getFirstColumnId($project['id']), + 'position' => 1 + ); + + $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); + $values = $this->hook->merge('controller:gantt:task:form:default', $values, array('default_values' => $values)); + + $this->response->html($this->template->render('task_gantt_creation/show', array( + 'project' => $project, + 'errors' => $errors, + 'values' => $values, + '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') + ))); + } + + /** + * Validate and save a new task + * + * @access public + */ + public function save() + { + $project = $this->getProject(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateCreation($values); + + if ($valid) { + $task_id = $this->taskCreationModel->create($values); + + if ($task_id !== false) { + $this->flash->success(t('Task created successfully.')); + return $this->response->redirect($this->helper->url->to('TaskGanttController', 'show', array('project_id' => $project['id']))); + } else { + $this->flash->failure(t('Unable to create your task.')); + } + } + + return $this->show($values, $errors); + } +} diff --git a/app/Controller/TaskImport.php b/app/Controller/TaskImportController.php index 5e37fb2f..aff2d390 100644 --- a/app/Controller/TaskImport.php +++ b/app/Controller/TaskImportController.php @@ -7,10 +7,10 @@ use Kanboard\Core\Csv; /** * Task Import controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class TaskImport extends BaseController +class TaskImportController extends BaseController { /** * Upload the file and ask settings @@ -19,11 +19,11 @@ class TaskImport extends BaseController * @param array $errors * @throws \Kanboard\Core\Controller\PageNotFoundException */ - public function step1(array $values = array(), array $errors = array()) + public function show(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $this->response->html($this->helper->layout->project('task_import/step1', array( + $this->response->html($this->helper->layout->project('task_import/show', array( 'project' => $project, 'values' => $values, 'errors' => $errors, @@ -31,36 +31,35 @@ class TaskImport extends BaseController 'delimiters' => Csv::getDelimiters(), 'enclosures' => Csv::getEnclosures(), 'title' => t('Import tasks from CSV file'), - ))); + ), 'task_import/sidebar')); } /** * Process CSV file - * */ - public function step2() + public function save() { $project = $this->getProject(); $values = $this->request->getValues(); $filename = $this->request->getFilePath('file'); if (! file_exists($filename)) { - $this->step1($values, array('file' => array(t('Unable to read your file')))); - } + $this->show($values, array('file' => array(t('Unable to read your file')))); + } else { + $this->taskImport->projectId = $project['id']; - $this->taskImport->projectId = $project['id']; + $csv = new Csv($values['delimiter'], $values['enclosure']); + $csv->setColumnMapping($this->taskImport->getColumnMapping()); + $csv->read($filename, array($this->taskImport, 'import')); - $csv = new Csv($values['delimiter'], $values['enclosure']); - $csv->setColumnMapping($this->taskImport->getColumnMapping()); - $csv->read($filename, array($this->taskImport, 'import')); + if ($this->taskImport->counter > 0) { + $this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter)); + } else { + $this->flash->failure(t('Nothing have been imported!')); + } - if ($this->taskImport->counter > 0) { - $this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter)); - } else { - $this->flash->failure(t('Nothing have been imported!')); + $this->response->redirect($this->helper->url->to('TaskImportController', 'show', array('project_id' => $project['id']))); } - - $this->response->redirect($this->helper->url->to('taskImport', 'step1', array('project_id' => $project['id']))); } /** diff --git a/app/Controller/TaskInternalLink.php b/app/Controller/TaskInternalLinkController.php index 6ff20252..a140f1ff 100644 --- a/app/Controller/TaskInternalLink.php +++ b/app/Controller/TaskInternalLinkController.php @@ -7,11 +7,11 @@ use Kanboard\Core\Controller\PageNotFoundException; /** * TaskInternalLink Controller * - * @package controller + * @package Kanboard\Controller * @author Olivier Maridat * @author Frederic Guillot */ -class TaskInternalLink extends BaseController +class TaskInternalLinkController extends BaseController { /** * Get the current link @@ -22,7 +22,7 @@ class TaskInternalLink 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 TaskInternalLink extends BaseController 'values' => $values, 'errors' => $errors, 'task' => $task, - 'labels' => $this->link->getList(0, false), + 'labels' => $this->linkModel->getList(0, false), ))); } @@ -65,9 +65,9 @@ class TaskInternalLink 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('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } $errors = array('title' => array(t('The exact same link already exists'))); @@ -92,7 +92,7 @@ class TaskInternalLink 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 TaskInternalLink extends BaseController 'errors' => $errors, 'task_link' => $task_link, 'task' => $task, - 'labels' => $this->link->getList(0, false) + 'labels' => $this->linkModel->getList(0, false) ))); } @@ -119,9 +119,9 @@ class TaskInternalLink 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('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); } $this->flash->failure(t('Unable to update your link.')); @@ -156,12 +156,12 @@ class TaskInternalLink 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.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } } diff --git a/app/Controller/Listing.php b/app/Controller/TaskListController.php index 93a7b836..c6d1fa92 100644 --- a/app/Controller/Listing.php +++ b/app/Controller/TaskListController.php @@ -3,15 +3,15 @@ namespace Kanboard\Controller; use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\Task as TaskModel; +use Kanboard\Model\TaskModel; /** - * List view controller + * Task List Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Listing extends BaseController +class TaskListController extends BaseController { /** * Show list view for projects @@ -24,7 +24,7 @@ class Listing extends BaseController $search = $this->helper->projectHeader->getSearchQuery($project); $paginator = $this->paginator - ->setUrl('listing', 'show', array('project_id' => $project['id'])) + ->setUrl('TaskListController', 'show', array('project_id' => $project['id'])) ->setMax(30) ->setOrder(TaskModel::TABLE.'.id') ->setDirection('DESC') @@ -35,7 +35,7 @@ class Listing extends BaseController ) ->calculate(); - $this->response->html($this->helper->layout->app('listing/show', array( + $this->response->html($this->helper->layout->app('task_list/show', array( 'project' => $project, 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), diff --git a/app/Controller/Taskmodification.php b/app/Controller/TaskModificationController.php index e8eafe20..fc9113dd 100644 --- a/app/Controller/Taskmodification.php +++ b/app/Controller/TaskModificationController.php @@ -7,10 +7,10 @@ use Kanboard\Core\DateParser; /** * Task Modification controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Taskmodification extends BaseController +class TaskModificationController extends BaseController { /** * Set automatically the start date @@ -20,8 +20,8 @@ class Taskmodification extends BaseController public function start() { $task = $this->getTask(); - $this->taskModification->update(array('id' => $task['id'], 'date_started' => time())); - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + $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,13 +61,13 @@ class Taskmodification 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.')); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } return $this->description($values, $errors); @@ -85,7 +85,7 @@ class Taskmodification 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 Taskmodification 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,9 +119,9 @@ class Taskmodification 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('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } else { $this->flash->failure(t('Unable to update your task.')); $this->edit($values, $errors); diff --git a/app/Controller/TaskPopover.php b/app/Controller/TaskPopoverController.php index 0e47cffe..bf4e23d5 100644 --- a/app/Controller/TaskPopover.php +++ b/app/Controller/TaskPopoverController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Task Popover * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class TaskPopover extends BaseController +class TaskPopoverController extends BaseController { /** * Change a task assignee directly from the board @@ -18,11 +18,11 @@ class TaskPopover 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,13 +38,13 @@ class TaskPopover 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.')); } - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $values['project_id'])), true); } /** @@ -55,11 +55,11 @@ class TaskPopover 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,13 +75,13 @@ class TaskPopover 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.')); } - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $values['project_id'])), true); } /** diff --git a/app/Controller/TaskRecurrence.php b/app/Controller/TaskRecurrenceController.php index 72dce3a5..dc7a0e1b 100644 --- a/app/Controller/TaskRecurrence.php +++ b/app/Controller/TaskRecurrenceController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Task Recurrence controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class TaskRecurrence extends BaseController +class TaskRecurrenceController extends BaseController { /** * Edit recurrence form @@ -31,10 +31,10 @@ class TaskRecurrence 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,13 +51,13 @@ class TaskRecurrence 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.')); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } return $this->edit($values, $errors); diff --git a/app/Controller/Taskstatus.php b/app/Controller/TaskStatusController.php index eeaf8513..82b4f9c4 100644 --- a/app/Controller/Taskstatus.php +++ b/app/Controller/TaskStatusController.php @@ -5,10 +5,10 @@ namespace Kanboard\Controller; /** * Task Status controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Taskstatus extends BaseController +class TaskStatusController extends BaseController { /** * Close a task @@ -46,13 +46,13 @@ class Taskstatus 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); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } return $this->response->html($this->template->render($template, array( diff --git a/app/Controller/TaskSuppressionController.php b/app/Controller/TaskSuppressionController.php new file mode 100644 index 00000000..600107c9 --- /dev/null +++ b/app/Controller/TaskSuppressionController.php @@ -0,0 +1,53 @@ +<?php + +namespace Kanboard\Controller; + +use Kanboard\Core\Controller\AccessForbiddenException; + +/** + * Class TaskSuppressionController + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class TaskSuppressionController extends BaseController +{ + /** + * Confirmation dialog box before to remove the task + */ + public function confirm() + { + $task = $this->getTask(); + + if (! $this->helper->user->canRemoveTask($task)) { + throw new AccessForbiddenException(); + } + + $this->response->html($this->template->render('task_suppression/remove', array( + 'task' => $task, + 'redirect' => $this->request->getStringParam('redirect'), + ))); + } + + /** + * Remove a task + */ + public function remove() + { + $task = $this->getTask(); + $this->checkCSRFParam(); + + if (! $this->helper->user->canRemoveTask($task)) { + throw new AccessForbiddenException(); + } + + if ($this->taskModel->remove($task['id'])) { + $this->flash->success(t('Task removed successfully.')); + } else { + $this->flash->failure(t('Unable to remove this task.')); + } + + $redirect = $this->request->getStringParam('redirect') === ''; + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $task['project_id'])), $redirect); + } +} diff --git a/app/Controller/Task.php b/app/Controller/TaskViewController.php index 1ce13f69..2a79ee45 100644 --- a/app/Controller/Task.php +++ b/app/Controller/TaskViewController.php @@ -7,12 +7,12 @@ use Kanboard\Core\Controller\PageNotFoundException; use Kanboard\Core\DateParser; /** - * Task controller + * Task Controller * - * @package controller + * @package Kanboard\Controller * @author Frederic Guillot */ -class Task extends BaseController +class TaskViewController extends BaseController { /** * Public access (display a task) @@ -21,14 +21,14 @@ class Task 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 Task 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 Task 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 Task 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 Task 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), ))); } @@ -114,16 +114,16 @@ class Task extends BaseController $task = $this->getTask(); $subtask_paginator = $this->paginator - ->setUrl('task', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'pagination' => 'subtasks')) + ->setUrl('TaskViewController', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'pagination' => 'subtasks')) ->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,38 +139,8 @@ class Task 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']), - ))); - } - - /** - * Remove a task - * - * @access public - */ - public function remove() - { - $task = $this->getTask(); - - if (! $this->helper->user->canRemoveTask($task)) { - throw new AccessForbiddenException(); - } - - if ($this->request->getStringParam('confirmation') === 'yes') { - $this->checkCSRFParam(); - - if ($this->task->remove($task['id'])) { - $this->flash->success(t('Task removed successfully.')); - } else { - $this->flash->failure(t('Unable to remove this task.')); - } - - return $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])), true); - } - - return $this->response->html($this->template->render('task/remove', array( - 'task' => $task, + 'project' => $this->projectModel->getById($task['project_id']), + 'transitions' => $this->transitionModel->getAllByTask($task['id']), ))); } } diff --git a/app/Controller/Twofactor.php b/app/Controller/TwoFactorController.php index 118613b2..d02c8950 100644 --- a/app/Controller/Twofactor.php +++ b/app/Controller/TwoFactorController.php @@ -7,10 +7,10 @@ use Kanboard\Core\Controller\AccessForbiddenException; /** * Two Factor Auth controller * - * @package controller + * @package Kanboard/Controller * @author Frederic Guillot */ -class Twofactor extends UserViewController +class TwoFactorController extends UserViewController { /** * Only the current user can access to 2FA settings @@ -91,7 +91,7 @@ class Twofactor 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(), @@ -100,10 +100,10 @@ class Twofactor extends UserViewController unset($this->sessionStorage->twoFactorSecret); $this->userSession->disablePostAuthentication(); - $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id']))); } else { $this->flash->failure(t('The two factor authentication code is not valid.')); - $this->response->redirect($this->helper->url->to('twofactor', 'show', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('TwoFactorController', 'show', array('user_id' => $user['id']))); } } @@ -117,7 +117,7 @@ class Twofactor extends UserViewController $user = $this->getUser(); $this->checkCurrentUser($user); - $this->user->update(array( + $this->userModel->update(array( 'id' => $user['id'], 'twofactor_activated' => 0, 'twofactor_secret' => '', @@ -127,7 +127,7 @@ class Twofactor extends UserViewController $this->userSession->disablePostAuthentication(); $this->flash->success(t('User updated successfully.')); - $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id']))); } /** @@ -152,7 +152,7 @@ class Twofactor extends UserViewController $this->response->redirect($this->helper->url->to('DashboardController', 'show')); } else { $this->flash->failure(t('The two factor authentication code is not valid.')); - $this->response->redirect($this->helper->url->to('twofactor', 'code')); + $this->response->redirect($this->helper->url->to('TwoFactorController', 'code')); } } @@ -186,7 +186,7 @@ class Twofactor 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 49f9db54..9c873f85 100644 --- a/app/Controller/UserCreationController.php +++ b/app/Controller/UserCreationController.php @@ -3,7 +3,7 @@ namespace Kanboard\Controller; use Kanboard\Core\Security\Role; -use Kanboard\Notification\Mail as MailNotification; +use Kanboard\Notification\MailNotification; /** * Class UserCreationController @@ -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/WebNotification.php b/app/Controller/WebNotification.php deleted file mode 100644 index a62da0e3..00000000 --- a/app/Controller/WebNotification.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -namespace Kanboard\Controller; - -/** - * Web notification controller - * - * @package controller - * @author Frederic Guillot - */ -class WebNotification extends BaseController -{ - /** - * Mark all notifications as read - * - * @access public - */ - public function flush() - { - $user_id = $this->getUserId(); - - $this->userUnreadNotification->markAllAsRead($user_id); - $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); - } - - /** - * Mark a notification as read - * - * @access public - */ - public function remove() - { - $user_id = $this->getUserId(); - $notification_id = $this->request->getIntegerParam('notification_id'); - - $this->userUnreadNotification->markAsRead($user_id, $notification_id); - $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); - } - - private function getUserId() - { - $user_id = $this->request->getIntegerParam('user_id'); - - if (! $this->userSession->isAdmin() && $user_id != $this->userSession->getId()) { - $user_id = $this->userSession->getId(); - } - - return $user_id; - } -} diff --git a/app/Controller/WebNotificationController.php b/app/Controller/WebNotificationController.php new file mode 100644 index 00000000..46a42063 --- /dev/null +++ b/app/Controller/WebNotificationController.php @@ -0,0 +1,79 @@ +<?php + +namespace Kanboard\Controller; + +/** + * Web notification controller + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class WebNotificationController extends BaseController +{ + /** + * Mark all notifications as read + * + * @access public + */ + public function flush() + { + $user_id = $this->getUserId(); + + $this->userUnreadNotificationModel->markAllAsRead($user_id); + $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); + } + + /** + * Mark a notification as read + * + * @access public + */ + public function remove() + { + $user_id = $this->getUserId(); + $notification_id = $this->request->getIntegerParam('notification_id'); + + $this->userUnreadNotificationModel->markAsRead($user_id, $notification_id); + $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); + } + + /** + * Redirect to the task and mark notification as read + */ + public function redirect() + { + $user_id = $this->getUserId(); + $notification_id = $this->request->getIntegerParam('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))); + } elseif ($this->helper->text->contains($notification['event_name'], 'comment')) { + $this->response->redirect($this->helper->url->to( + 'TaskViewController', + 'show', + array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id']), + 'comment-'.$notification['event_data']['comment']['id'] + )); + } else { + $this->response->redirect($this->helper->url->to( + 'TaskViewController', + 'show', + array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id']) + )); + } + } + + private function getUserId() + { + $user_id = $this->request->getIntegerParam('user_id'); + + if (! $this->userSession->isAdmin() && $user_id != $this->userSession->getId()) { + $user_id = $this->userSession->getId(); + } + + return $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..7b4462e2 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -10,136 +10,138 @@ 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 + * @property \Symfony\Component\Console\Application $cli + * @property \JsonRPC\Server $api */ 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 0e7b6425..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,11 +116,11 @@ 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( - 'task', + 'TaskViewController', 'readonly', array( 'token' => $token, @@ -133,7 +133,7 @@ class Markdown extends Parsedown } return $this->container['helper']->url->href( - 'task', + 'TaskViewController', 'show', array('task_id' => $task_id) ); diff --git a/app/Notification/NotificationInterface.php b/app/Core/Notification/NotificationInterface.php index 8431a77c..d336983a 100644 --- a/app/Notification/NotificationInterface.php +++ b/app/Core/Notification/NotificationInterface.php @@ -1,11 +1,11 @@ <?php -namespace Kanboard\Notification; +namespace Kanboard\Core\Notification; /** * Notification Interface * - * @package core + * @package Kanboard\Core\Notification * @author Frederic Guillot */ interface NotificationInterface 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 532e6822..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) { @@ -44,11 +44,11 @@ class ProjectGanttFormatter extends BaseFormatter implements FormatterInterface (int) date('j', $end), ), 'link' => $this->helper->url->href('ProjectViewController', 'show', array('project_id' => $project['id'])), - 'board_link' => $this->helper->url->href('board', 'show', array('project_id' => $project['id'])), - 'gantt_link' => $this->helper->url->href('gantt', 'project', array('project_id' => $project['id'])), + 'board_link' => $this->helper->url->href('BoardViewController', 'show', array('project_id' => $project['id'])), + '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 c5d4e2be..b7b81d87 100644 --- a/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php +++ b/app/Formatter/SubtaskTimeTrackingCalendarFormatter.php @@ -25,10 +25,10 @@ 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('task', 'show', array('task_id' => $row['task_id'], 'project_id' => $row['project_id'])), + '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 ca0d5c05..75d2a83e 100644 --- a/app/Formatter/TaskCalendarFormatter.php +++ b/app/Formatter/TaskCalendarFormatter.php @@ -44,13 +44,13 @@ 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('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + 'url' => $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), 'start' => date($this->getDateTimeFormat(), $task[$this->startColumn]), 'end' => date($this->getDateTimeFormat(), $task[$this->endColumn] ?: time()), 'editable' => $this->fullDay, diff --git a/app/Formatter/TaskGanttFormatter.php b/app/Formatter/TaskGanttFormatter.php index 3209aa37..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']]).'%', - 'link' => $this->helper->url->href('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), - 'color' => $this->color->getColorProperties($task['color_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->colorModel->getColorProperties($task['color_id']), 'not_defined' => empty($task['date_due']) || empty($task['date_started']), ); } diff --git a/app/Formatter/TaskICalFormatter.php b/app/Formatter/TaskICalFormatter.php index a149f725..890674c7 100644 --- a/app/Formatter/TaskICalFormatter.php +++ b/app/Formatter/TaskICalFormatter.php @@ -117,7 +117,7 @@ class TaskICalFormatter extends BaseTaskCalendarFormatter implements FormatterIn $vEvent->setModified($dateModif); $vEvent->setUseTimezone(true); $vEvent->setSummary(t('#%d', $task['id']).' '.$task['title']); - $vEvent->setUrl($this->helper->url->base().$this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $vEvent->setUrl($this->helper->url->base().$this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); if (! empty($task['owner_id'])) { $vEvent->setOrganizer($task['assignee_name'] ?: $task['assignee_username'], $task['assignee_email']); 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 aeb0c846..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); @@ -96,7 +96,7 @@ class LayoutHelper extends Base public function projectUser($template, array $params) { $params['filter'] = array('user_id' => $params['user_id']); - return $this->subLayout('project_user/layout', 'project_user/sidebar', $template, $params); + return $this->subLayout('project_user_overview/layout', 'project_user_overview/sidebar', $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..e33438d6 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -22,27 +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(); - } - - public function canRemove(array $task) - { - return $this->taskPermission->canRemoveTask($task); + return $this->taskModel->getRecurrenceBasedateList(); } public function selectAssignee(array $users, array $values, array $errors = array(), array $attributes = array()) @@ -142,7 +137,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 +148,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 +173,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 095c4af4..2127c69e 100644 --- a/app/Helper/UrlHelper.php +++ b/app/Helper/UrlHelper.php @@ -25,7 +25,7 @@ class UrlHelper extends Base */ public function doc($label, $file) { - return $this->link($label, 'doc', 'show', array('file' => $file), false, '', '', true); + return $this->link($label, 'DocumentationController', 'show', array('file' => $file), false, '', '', true); } /** @@ -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..304a3254 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) !== false) { $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/AuthenticationMiddleware.php b/app/Middleware/AuthenticationMiddleware.php index c29b7ab6..499843fd 100644 --- a/app/Middleware/AuthenticationMiddleware.php +++ b/app/Middleware/AuthenticationMiddleware.php @@ -39,7 +39,7 @@ class AuthenticationMiddleware extends BaseMiddleware $this->response->text('Not Authorized', 401); } else { $this->sessionStorage->redirectAfterLogin = $this->request->getUri(); - $this->response->redirect($this->helper->url->to('auth', 'login')); + $this->response->redirect($this->helper->url->to('AuthController', 'login')); } } } diff --git a/app/Middleware/PostAuthenticationMiddleware.php b/app/Middleware/PostAuthenticationMiddleware.php index c1237f47..f7eccbce 100644 --- a/app/Middleware/PostAuthenticationMiddleware.php +++ b/app/Middleware/PostAuthenticationMiddleware.php @@ -19,7 +19,7 @@ class PostAuthenticationMiddleware extends BaseMiddleware { $controller = strtolower($this->router->getController()); $action = strtolower($this->router->getAction()); - $ignore = ($controller === 'twofactor' && in_array($action, array('code', 'check'))) || ($controller === 'auth' && $action === 'logout'); + $ignore = ($controller === 'twofactorcontroller' && in_array($action, array('code', 'check'))) || ($controller === 'authcontroller' && $action === 'logout'); if ($ignore === false && $this->userSession->hasPostAuthentication() && ! $this->userSession->isPostAuthenticationValidated()) { $this->nextMiddleware = null; @@ -28,7 +28,7 @@ class PostAuthenticationMiddleware extends BaseMiddleware $this->response->text('Not Authorized', 401); } - $this->response->redirect($this->helper->url->to('twofactor', 'code')); + $this->response->redirect($this->helper->url->to('TwoFactorController', 'code')); } $this->next(); 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 f055d9d0..53393ed5 100644 --- a/app/Model/Action.php +++ b/app/Model/ActionModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -26,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); } @@ -48,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); } @@ -61,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); } @@ -77,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; @@ -136,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; } @@ -156,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(); @@ -174,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 53edcbc8..9895da0f 100644 --- a/app/Model/ActionParameter.php +++ b/app/Model/ActionParameterModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -145,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 9f47ccc7..6e36d83f 100644 --- a/app/Model/AvatarFile.php +++ b/app/Model/AvatarFileModel.php @@ -3,14 +3,15 @@ namespace Kanboard\Model; use Exception; +use Kanboard\Core\Base; /** * Avatar File * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class AvatarFile extends Base +class AvatarFileModel extends Base { /** * Path prefix @@ -28,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'); } /** @@ -41,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, )); @@ -64,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/Base.php b/app/Model/Base.php deleted file mode 100644 index a27560c8..00000000 --- a/app/Model/Base.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -namespace Kanboard\Model; - -use PicoDb\Database; - -/** - * Base model class - * - * @package model - * @author Frederic Guillot - */ -abstract class Base extends \Kanboard\Core\Base -{ - /** - * Save a record in the database - * - * @access public - * @param string $table Table name - * @param array $values Form values - * @return boolean|integer - */ - public function persist($table, array $values) - { - return $this->db->transaction(function (Database $db) use ($table, $values) { - - if (! $db->table($table)->save($values)) { - return false; - } - - return (int) $db->getLastId(); - }); - } -} diff --git a/app/Model/Board.php b/app/Model/BoardModel.php index d41ecafe..d2718b47 100644 --- a/app/Model/Board.php +++ b/app/Model/BoardModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -29,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) { @@ -64,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; } } @@ -82,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); } /** @@ -101,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++) { @@ -120,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']; @@ -162,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 1d5f6546..62fb5611 100644 --- a/app/Model/Category.php +++ b/app/Model/CategoryModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -123,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); @@ -148,7 +150,7 @@ class Category extends Base */ public function create(array $values) { - return $this->persist(self::TABLE, $values); + return $this->db->table(self::TABLE)->persist($values); } /** @@ -174,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 dee28643..9e69dda2 100644 --- a/app/Model/Color.php +++ b/app/Model/ColorModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; + /** * Color model * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Color extends Base +class ColorModel extends Base { /** * Default colors @@ -163,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 ccdcb049..1adac0f2 100644 --- a/app/Model/Column.php +++ b/app/Model/ColumnModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -140,7 +142,7 @@ class Column extends Base 'description' => $description, ); - return $this->persist(self::TABLE, $values); + return $this->db->table(self::TABLE)->persist($values); } /** diff --git a/app/Model/Comment.php b/app/Model/CommentModel.php index c5091d89..36e1fc48 100644 --- a/app/Model/Comment.php +++ b/app/Model/CommentModel.php @@ -3,14 +3,15 @@ namespace Kanboard\Model; use Kanboard\Event\CommentEvent; +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 @@ -46,12 +47,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(); @@ -75,12 +76,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(); } @@ -110,12 +111,12 @@ class Comment extends Base public function create(array $values) { $values['date_creation'] = time(); - $comment_id = $this->persist(self::TABLE, $values); + $comment_id = $this->db->table(self::TABLE)->persist($values); - if ($comment_id) { + if ($comment_id !== false) { $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 abcce2f0..bfd9697c 100644 --- a/app/Model/Currency.php +++ b/app/Model/CurrencyModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; + /** * Currency * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Currency extends Base +class CurrencyModel extends Base { /** * SQL table name @@ -65,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 3a6a1a3a..a4c23b5c 100644 --- a/app/Model/CustomFilter.php +++ b/app/Model/CustomFilterModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -30,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', @@ -41,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) @@ -71,7 +73,7 @@ class CustomFilter extends Base */ public function create(array $values) { - return $this->persist(self::TABLE, $values); + return $this->db->table(self::TABLE)->persist($values); } /** diff --git a/app/Model/File.php b/app/Model/FileModel.php index e383235c..8cdea9a0 100644 --- a/app/Model/File.php +++ b/app/Model/FileModel.php @@ -3,6 +3,7 @@ namespace Kanboard\Model; use Exception; +use Kanboard\Core\Base; use Kanboard\Core\Thumbnail; use Kanboard\Event\FileEvent; use Kanboard\Core\ObjectStorage\ObjectStorageException; @@ -10,12 +11,48 @@ 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 the table + * + * @abstract + * @access protected + * @return string + */ + abstract protected function getTable(); + + /** + * Define the foreign key + * + * @abstract + * @access protected + * @return string + */ + abstract protected function getForeignKey(); + + /** + * Get the path prefix + * + * @abstract + * @access protected + * @return string + */ + abstract protected function getPathPrefix(); + + /** + * Get event name + * + * @abstract + * @access protected + * @return string + */ + abstract protected function getEventName(); + + /** * Get PicoDb query to get all files * * @access protected @@ -24,21 +61,21 @@ abstract class File extends Base protected function getQuery() { return $this->db - ->table(static::TABLE) + ->table($this->getTable()) ->columns( - static::TABLE.'.id', - static::TABLE.'.name', - static::TABLE.'.path', - static::TABLE.'.is_image', - static::TABLE.'.'.static::FOREIGN_KEY, - static::TABLE.'.date', - static::TABLE.'.user_id', - static::TABLE.'.size', - User::TABLE.'.username', - User::TABLE.'.name as user_name' + $this->getTable().'.id', + $this->getTable().'.name', + $this->getTable().'.path', + $this->getTable().'.is_image', + $this->getTable().'.'.$this->getForeignKey(), + $this->getTable().'.date', + $this->getTable().'.user_id', + $this->getTable().'.size', + UserModel::TABLE.'.username', + UserModel::TABLE.'.name as user_name' ) - ->join(User::TABLE, 'id', 'user_id') - ->asc(static::TABLE.'.name'); + ->join(UserModel::TABLE, 'id', 'user_id') + ->asc($this->getTable().'.name'); } /** @@ -50,7 +87,7 @@ abstract class File extends Base */ public function getById($file_id) { - return $this->db->table(static::TABLE)->eq('id', $file_id)->findOne(); + return $this->db->table($this->getTable())->eq('id', $file_id)->findOne(); } /** @@ -62,7 +99,7 @@ abstract class File extends Base */ public function getAll($id) { - return $this->getQuery()->eq(static::FOREIGN_KEY, $id)->findAll(); + return $this->getQuery()->eq($this->getForeignKey(), $id)->findAll(); } /** @@ -74,7 +111,7 @@ abstract class File extends Base */ public function getAllImages($id) { - return $this->getQuery()->eq(static::FOREIGN_KEY, $id)->eq('is_image', 1)->findAll(); + return $this->getQuery()->eq($this->getForeignKey(), $id)->eq('is_image', 1)->findAll(); } /** @@ -86,7 +123,7 @@ abstract class File extends Base */ public function getAllDocuments($id) { - return $this->getQuery()->eq(static::FOREIGN_KEY, $id)->eq('is_image', 0)->findAll(); + return $this->getQuery()->eq($this->getForeignKey(), $id)->eq('is_image', 0)->findAll(); } /** @@ -102,7 +139,7 @@ abstract class File extends Base public function create($id, $name, $path, $size) { $values = array( - static::FOREIGN_KEY => $id, + $this->getForeignKey() => $id, 'name' => substr($name, 0, 255), 'path' => $path, 'is_image' => $this->isImage($name) ? 1 : 0, @@ -111,12 +148,12 @@ abstract class File extends Base 'date' => time(), ); - $result = $this->db->table(static::TABLE)->insert($values); + $result = $this->db->table($this->getTable())->insert($values); if ($result) { $file_id = (int) $this->db->getLastId(); $event = new FileEvent($values + array('file_id' => $file_id)); - $this->dispatcher->dispatch(static::EVENT_CREATE, $event); + $this->dispatcher->dispatch($this->getEventName(), $event); return $file_id; } @@ -132,7 +169,7 @@ abstract class File extends Base */ public function removeAll($id) { - $file_ids = $this->db->table(static::TABLE)->eq(static::FOREIGN_KEY, $id)->asc('id')->findAllByColumn('id'); + $file_ids = $this->db->table($this->getTable())->eq($this->getForeignKey(), $id)->asc('id')->findAllByColumn('id'); $results = array(); foreach ($file_ids as $file_id) { @@ -159,7 +196,7 @@ abstract class File extends Base $this->objectStorage->remove($this->getThumbnailPath($file['path'])); } - return $this->db->table(static::TABLE)->eq('id', $file['id'])->remove(); + return $this->db->table($this->getTable())->eq('id', $file['id'])->remove(); } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); return false; @@ -210,7 +247,7 @@ abstract class File extends Base */ public function generatePath($id, $filename) { - return static::PATH_PREFIX.DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR.hash('sha1', $filename.time()); + return $this->getPathPrefix().DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR.hash('sha1', $filename.time()); } /** @@ -252,6 +289,7 @@ abstract class File extends Base * @access public * @param integer $id * @param array $file + * @throws Exception */ public function uploadFile($id, array $file) { diff --git a/app/Model/GroupMember.php b/app/Model/GroupMemberModel.php index baf303c4..a2077789 100644 --- a/app/Model/GroupMember.php +++ b/app/Model/GroupMemberModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -27,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); } @@ -56,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(); } @@ -119,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 24dc432b..0a975570 100644 --- a/app/Model/Group.php +++ b/app/Model/GroupModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -97,7 +99,7 @@ class Group extends Base */ public function create($name, $external_id = '') { - return $this->persist(self::TABLE, array( + return $this->db->table(self::TABLE)->persist(array( 'name' => $name, 'external_id' => $external_id, )); diff --git a/app/Model/Language.php b/app/Model/LanguageModel.php index 441771e0..eb6de004 100644 --- a/app/Model/Language.php +++ b/app/Model/LanguageModel.php @@ -2,6 +2,7 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; use Kanboard\Core\Translator; /** @@ -10,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 @@ -163,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 feb5f5a3..16821392 100644 --- a/app/Model/LastLogin.php +++ b/app/Model/LastLoginModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 903a98d6..b72c7532 100644 --- a/app/Model/Link.php +++ b/app/Model/LinkModel.php @@ -3,15 +3,16 @@ namespace Kanboard\Model; use PDO; +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 52f6b009..6177e5f3 100644 --- a/app/Model/Metadata.php +++ b/app/Model/MetadataModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 c252aa31..8937b77e 100644 --- a/app/Model/Notification.php +++ b/app/Model/NotificationModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -22,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)) { @@ -30,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, @@ -53,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']); } @@ -64,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'); @@ -94,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 289aae9c..432832ee 100644 --- a/app/Model/NotificationType.php +++ b/app/Model/NotificationTypeModel.php @@ -3,6 +3,7 @@ namespace Kanboard\Model; use Pimple\Container; +use Kanboard\Core\Base; /** * Notification Type @@ -10,7 +11,7 @@ use Pimple\Container; * @package model * @author Frederic Guillot */ -abstract class NotificationType extends Base +abstract class NotificationTypeModel extends Base { /** * Container @@ -56,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) { @@ -80,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 5cfd3c97..d7c74969 100644 --- a/app/Model/PasswordReset.php +++ b/app/Model/PasswordResetModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -46,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 d993015b..380ea125 100644 --- a/app/Model/ProjectActivity.php +++ b/app/Model/ProjectActivityModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -62,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 0706a110..a0f14cf4 100644 --- a/app/Model/ProjectDailyColumnStats.php +++ b/app/Model/ProjectDailyColumnStatsModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -84,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); } @@ -205,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(); @@ -225,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()) @@ -243,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 974f5813..0754d263 100644 --- a/app/Model/ProjectDailyStats.php +++ b/app/Model/ProjectDailyStatsModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 79011258..b67f8302 100644 --- a/app/Model/ProjectDuplication.php +++ b/app/Model/ProjectDuplicationModel.php @@ -2,16 +2,17 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -21,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'); } /** @@ -32,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'); } /** @@ -64,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(); @@ -85,7 +86,7 @@ class ProjectDuplication extends Base } // Skip permissions for private projects - if ($private && $model === 'projectPermission') { + if ($private && $model === 'projectPermissionModel') { continue; } @@ -117,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( @@ -130,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; } @@ -148,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/ProjectFile.php deleted file mode 100644 index aa9bf15b..00000000 --- a/app/Model/ProjectFile.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -namespace Kanboard\Model; - -/** - * Project File Model - * - * @package model - * @author Frederic Guillot - */ -class ProjectFile extends File -{ - /** - * SQL table name - * - * @var string - */ - const TABLE = 'project_has_files'; - - /** - * SQL foreign key - * - * @var string - */ - const FOREIGN_KEY = 'project_id'; - - /** - * Path prefix - * - * @var string - */ - const PATH_PREFIX = 'projects'; - - /** - * Events - * - * @var string - */ - const EVENT_CREATE = 'project.file.create'; -} diff --git a/app/Model/ProjectFileModel.php b/app/Model/ProjectFileModel.php new file mode 100644 index 00000000..b464bb2a --- /dev/null +++ b/app/Model/ProjectFileModel.php @@ -0,0 +1,74 @@ +<?php + +namespace Kanboard\Model; + +/** + * Project File Model + * + * @package Kanboard\Model + * @author Frederic Guillot + */ +class ProjectFileModel extends FileModel +{ + /** + * Table name + * + * @var string + */ + const TABLE = 'project_has_files'; + + /** + * Events + * + * @var string + */ + const EVENT_CREATE = 'project.file.create'; + + /** + * Get the table + * + * @abstract + * @access protected + * @return string + */ + protected function getTable() + { + return self::TABLE; + } + + /** + * Define the foreign key + * + * @abstract + * @access protected + * @return string + */ + protected function getForeignKey() + { + return 'project_id'; + } + + /** + * Define the path prefix + * + * @abstract + * @access protected + * @return string + */ + protected function getPathPrefix() + { + return 'projects'; + } + + /** + * Get event name + * + * @abstract + * @access protected + * @return string + */ + protected function getEventName() + { + return self::EVENT_CREATE; + } +} diff --git a/app/Model/ProjectGroupRole.php b/app/Model/ProjectGroupRoleModel.php index afad4a44..2729d5a6 100644 --- a/app/Model/ProjectGroupRole.php +++ b/app/Model/ProjectGroupRoleModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -27,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'); } /** @@ -49,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'); @@ -67,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(); @@ -84,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(); } @@ -101,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 2b3aadf5..760acd7d 100644 --- a/app/Model/ProjectMetadata.php +++ b/app/Model/ProjectMetadataModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * 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 9843a54c..34e11c13 100644 --- a/app/Model/Project.php +++ b/app/Model/ProjectModel.php @@ -2,16 +2,17 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; use Kanboard\Core\Security\Token; 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 @@ -70,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(); } @@ -268,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; @@ -277,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; @@ -292,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; @@ -328,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')); } @@ -370,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 a355902f..aeeee4cd 100644 --- a/app/Model/ProjectNotification.php +++ b/app/Model/ProjectNotificationModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; + /** * Project Notification * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class ProjectNotification extends Base +class ProjectNotificationModel extends Base { /** * Send notifications @@ -20,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); } } @@ -44,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(); } @@ -59,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 a4719598..aeec77f2 100644 --- a/app/Model/ProjectNotificationType.php +++ b/app/Model/ProjectNotificationTypeModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * 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 59af2b58..a7c1857c 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermissionModel.php @@ -2,6 +2,7 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; use Kanboard\Core\Security\Role; use Kanboard\Filter\ProjectGroupRoleProjectFilter; use Kanboard\Filter\ProjectGroupRoleUsernameFilter; @@ -11,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 @@ -32,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' ); } @@ -86,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(); @@ -106,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) ); } @@ -121,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)); } /** @@ -135,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)); } /** @@ -147,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)); } /** @@ -159,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 db26fd5f..a0df0cfa 100644 --- a/app/Model/ProjectUserRole.php +++ b/app/Model/ProjectUserRoleModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -28,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)); } /** @@ -39,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); @@ -69,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(); @@ -81,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; @@ -97,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(); } @@ -115,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); } /** @@ -133,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) { @@ -156,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); } /** @@ -197,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 8989a6d7..f6c8d648 100644 --- a/app/Model/RememberMeSession.php +++ b/app/Model/RememberMeSessionModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 c5a4765c..5b2ee54f 100644 --- a/app/Model/Setting.php +++ b/app/Model/SettingModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 e56796a0..019064ad 100644 --- a/app/Model/Subtask.php +++ b/app/Model/SubtaskModel.php @@ -3,15 +3,16 @@ namespace Kanboard\Model; use PicoDb\Database; +use Kanboard\Core\Base; 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 @@ -95,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')); } @@ -126,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(); @@ -150,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(); } @@ -215,9 +216,9 @@ class Subtask extends Base public function create(array $values) { $this->prepareCreation($values); - $subtask_id = $this->persist(self::TABLE, $values); + $subtask_id = $this->db->table(self::TABLE)->persist($values); - if ($subtask_id) { + if ($subtask_id !== false) { $this->container['dispatcher']->dispatch( self::EVENT_CREATE, new SubtaskEvent(array('id' => $subtask_id) + $values) @@ -344,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) @@ -382,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') @@ -391,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; } } @@ -410,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 be04ee1b..062e594a 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTrackingModel.php @@ -3,14 +3,15 @@ namespace Kanboard\Model; 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 @@ -36,7 +37,7 @@ class SubtaskTimeTracking extends Base $user_id, $this->db->escapeIdentifier('end'), $this->db->escapeIdentifier('subtask_id'), - Subtask::TABLE.'.id' + SubtaskModel::TABLE.'.id' ); } @@ -57,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); } @@ -86,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); } /** @@ -116,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'); } @@ -249,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'], @@ -271,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); } @@ -286,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 721f20d3..87591b99 100644 --- a/app/Model/Swimlane.php +++ b/app/Model/SwimlaneModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; + /** * Swimlanes * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Swimlane extends Base +class SwimlaneModel extends Base { /** * SQL table name @@ -97,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(); @@ -167,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'); @@ -195,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'); @@ -222,11 +224,12 @@ class Swimlane extends Base */ public function create($values) { - if (! $this->project->exists($values['project_id'])) { + if (! $this->projectModel->exists($values['project_id'])) { return 0; } + $values['position'] = $this->getLastPosition($values['project_id']); - return $this->persist(self::TABLE, $values); + return $this->db->table(self::TABLE)->persist($values); } /** @@ -254,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'], @@ -272,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, @@ -289,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, @@ -370,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 cff56744..3d6fe8a8 100644 --- a/app/Model/TaskAnalytic.php +++ b/app/Model/TaskAnalyticModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -48,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 2d2e5504..3800f831 100644 --- a/app/Model/TaskCreation.php +++ b/app/Model/TaskCreationModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -21,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->persist(Task::TABLE, $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); @@ -56,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'])) { @@ -75,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; } /** @@ -89,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 ebdd4d29..9a4613e2 100644 --- a/app/Model/TaskDuplication.php +++ b/app/Model/TaskDuplicationModel.php @@ -4,15 +4,16 @@ namespace Kanboard\Model; use DateTime; use DateInterval; +use Kanboard\Core\Base; 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 @@ -62,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, )); @@ -127,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']))) ); } @@ -160,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; @@ -202,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(); } @@ -210,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: @@ -238,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) { @@ -258,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 f2c756b4..220b9c6f 100644 --- a/app/Model/TaskExternalLink.php +++ b/app/Model/TaskExternalLinkModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -29,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) { @@ -69,7 +71,7 @@ class TaskExternalLink extends Base $values['date_creation'] = time(); $values['date_modification'] = $values['date_creation']; - return $this->persist(self::TABLE, $values); + return $this->db->table(self::TABLE)->persist($values); } /** diff --git a/app/Model/TaskFile.php b/app/Model/TaskFile.php deleted file mode 100644 index 45a3b97f..00000000 --- a/app/Model/TaskFile.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Kanboard\Model; - -/** - * Task File Model - * - * @package model - * @author Frederic Guillot - */ -class TaskFile extends File -{ - /** - * SQL table name - * - * @var string - */ - const TABLE = 'task_has_files'; - - /** - * SQL foreign key - * - * @var string - */ - const FOREIGN_KEY = 'task_id'; - - /** - * Path prefix - * - * @var string - */ - const PATH_PREFIX = 'tasks'; - - /** - * Events - * - * @var string - */ - const EVENT_CREATE = 'task.file.create'; - - /** - * Handle screenshot upload - * - * @access public - * @param integer $task_id Task id - * @param string $blob Base64 encoded image - * @return bool|integer - */ - public function uploadScreenshot($task_id, $blob) - { - $original_filename = e('Screenshot taken %s', $this->helper->dt->datetime(time())).'.png'; - return $this->uploadContent($task_id, $original_filename, $blob); - } -} diff --git a/app/Model/TaskFileModel.php b/app/Model/TaskFileModel.php new file mode 100644 index 00000000..24c1ad4b --- /dev/null +++ b/app/Model/TaskFileModel.php @@ -0,0 +1,88 @@ +<?php + +namespace Kanboard\Model; + +/** + * Task File Model + * + * @package Kanboard\Model + * @author Frederic Guillot + */ +class TaskFileModel extends FileModel +{ + /** + * Table name + * + * @var string + */ + const TABLE = 'task_has_files'; + + /** + * Events + * + * @var string + */ + const EVENT_CREATE = 'task.file.create'; + + /** + * Get the table + * + * @abstract + * @access protected + * @return string + */ + protected function getTable() + { + return self::TABLE; + } + + /** + * Define the foreign key + * + * @abstract + * @access protected + * @return string + */ + protected function getForeignKey() + { + return 'task_id'; + } + + /** + * Define the path prefix + * + * @abstract + * @access protected + * @return string + */ + protected function getPathPrefix() + { + return 'tasks'; + } + + /** + * Get event name + * + * @abstract + * @access protected + * @return string + */ + protected function getEventName() + { + return self::EVENT_CREATE; + } + + /** + * Handle screenshot upload + * + * @access public + * @param integer $task_id Task id + * @param string $blob Base64 encoded image + * @return bool|integer + */ + public function uploadScreenshot($task_id, $blob) + { + $original_filename = e('Screenshot taken %s', $this->helper->dt->datetime(time())).'.png'; + return $this->uploadContent($task_id, $original_filename, $blob); + } +} diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinderModel.php index f8566bc2..8b636e28 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinderModel.php @@ -3,14 +3,15 @@ namespace Kanboard\Model; use PDO; +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 @@ -27,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); } /** @@ -60,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', @@ -76,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); } /** @@ -92,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', @@ -131,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); } /** @@ -163,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(); } @@ -179,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(); } @@ -196,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'); } @@ -213,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)); } /** @@ -253,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(); } /** @@ -265,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(); } /** @@ -277,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; } /** @@ -289,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(); } /** @@ -302,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(); } /** @@ -377,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', @@ -398,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(); @@ -418,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) @@ -437,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) @@ -454,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(); } /** @@ -467,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 e46ea476..45225e35 100644 --- a/app/Model/TaskLink.php +++ b/app/Model/TaskLinkModel.php @@ -2,16 +2,17 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -48,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']) @@ -71,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(); } @@ -131,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)); } } @@ -151,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, @@ -203,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( @@ -247,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 f8b41b9f..b0e7772a 100644 --- a/app/Model/Task.php +++ b/app/Model/TaskModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -88,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(); } @@ -124,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'), ); } @@ -138,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'), ); } @@ -153,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'), ); } @@ -167,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)'), ); } @@ -210,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 a77b78a4..762af2c5 100644 --- a/app/Model/TaskModification.php +++ b/app/Model/TaskModificationModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -22,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); @@ -51,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 4c9928d7..9fdb8f7d 100644 --- a/app/Model/TaskPosition.php +++ b/app/Model/TaskPositionModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -30,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; } @@ -131,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) @@ -168,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, )); @@ -186,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, @@ -225,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 ac35a96d..4d573f0e 100644 --- a/app/Model/TaskStatus.php +++ b/app/Model/TaskStatusModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -21,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); } /** @@ -33,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); } /** @@ -45,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); } /** @@ -58,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); } /** @@ -84,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); @@ -105,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, @@ -120,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; @@ -137,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 c6b33736..8b3e895a 100644 --- a/app/Model/Timezone.php +++ b/app/Model/TimezoneModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; + /** * Class Timezone * * @package Kanboard\Model * @author Frederic Guillot */ -class Timezone extends Base +class TimezoneModel extends Base { /** * Get available timezones @@ -41,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 870d95fd..a4a58472 100644 --- a/app/Model/Transition.php +++ b/app/Model/TransitionModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; + /** * Transition * - * @package model + * @package Kanboard\Model * @author Frederic Guillot */ -class Transition extends Base +class TransitionModel extends Base { /** * SQL table name @@ -69,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(); } @@ -104,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' @@ -119,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 67e4c244..1d4d994c 100644 --- a/app/Model/UserLocking.php +++ b/app/Model/UserLockingModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -19,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'); } @@ -33,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, @@ -50,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); } @@ -64,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()) @@ -81,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 97a4e419..cdb9949e 100644 --- a/app/Model/UserMention.php +++ b/app/Model/UserMentionModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -24,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()) @@ -46,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 8b880756..e931d3ba 100644 --- a/app/Model/UserMetadata.php +++ b/app/Model/UserMetadataModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * 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 6dd78dbb..f7a051c5 100644 --- a/app/Model/User.php +++ b/app/Model/UserModel.php @@ -3,16 +3,17 @@ namespace Kanboard\Model; use PicoDb\Database; +use Kanboard\Core\Base; use Kanboard\Core\Security\Token; 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 @@ -85,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(); @@ -211,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; @@ -269,7 +270,7 @@ class User extends Base public function create(array $values) { $this->prepare($values); - return $this->persist(self::TABLE, $values); + return $this->db->table(self::TABLE)->persist($values); } /** @@ -320,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 780ddfc7..112ba290 100644 --- a/app/Model/UserNotificationFilter.php +++ b/app/Model/UserNotificationFilterModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -52,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'); } /** @@ -65,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 6882e671..d77526f6 100644 --- a/app/Model/UserNotification.php +++ b/app/Model/UserNotificationModel.php @@ -2,15 +2,16 @@ namespace Kanboard\Model; +use Kanboard\Core\Base; 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 @@ -24,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); } } @@ -46,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(); } /** @@ -67,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); } @@ -93,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)); } /** @@ -105,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)); } /** @@ -125,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); } /** @@ -142,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; } @@ -159,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(); } @@ -193,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 89beb480..0f377220 100644 --- a/app/Model/UserNotificationType.php +++ b/app/Model/UserNotificationTypeModel.php @@ -5,10 +5,10 @@ namespace Kanboard\Model; /** * 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 cc0f326a..6c930eef 100644 --- a/app/Model/UserUnreadNotification.php +++ b/app/Model/UserUnreadNotificationModel.php @@ -2,13 +2,15 @@ namespace Kanboard\Model; +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 @@ -36,6 +38,23 @@ class UserUnreadNotification extends Base } /** + * Get one notification + * + * @param integer $notification_id + * @return array|null + */ + public function getById($notification_id) + { + $notification = $this->db->table(self::TABLE)->eq('id', $notification_id)->findOne(); + + if (! empty($notification)) { + $this->unserialize($notification); + } + + return $notification; + } + + /** * Get all notifications for a user * * @access public @@ -47,8 +66,7 @@ class UserUnreadNotification extends Base $events = $this->db->table(self::TABLE)->eq('user_id', $user_id)->asc('date_creation')->findAll(); foreach ($events as &$event) { - $event['event_data'] = json_decode($event['event_data'], true); - $event['title'] = $this->notification->getTitleWithoutAuthor($event['event_name'], $event['event_data']); + $this->unserialize($event); } return $events; @@ -90,4 +108,10 @@ class UserUnreadNotification extends Base { return $this->db->table(self::TABLE)->eq('user_id', $user_id)->exists(); } + + private function unserialize(&$event) + { + $event['event_data'] = json_decode($event['event_data'], true); + $event['title'] = $this->notificationModel->getTitleWithoutAuthor($event['event_name'], $event['event_data']); + } } diff --git a/app/Notification/ActivityStream.php b/app/Notification/ActivityStreamNotification.php index 325732ec..9f23c88a 100644 --- a/app/Notification/ActivityStream.php +++ b/app/Notification/ActivityStreamNotification.php @@ -3,14 +3,15 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; +use Kanboard\Core\Notification\NotificationInterface; /** * Activity Stream Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class ActivityStream extends Base implements NotificationInterface +class ActivityStreamNotification extends Base implements NotificationInterface { /** * Send notification to a user @@ -35,7 +36,7 @@ class ActivityStream 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/Mail.php b/app/Notification/MailNotification.php index c924fb50..2d27179c 100644 --- a/app/Notification/Mail.php +++ b/app/Notification/MailNotification.php @@ -3,18 +3,19 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; -use Kanboard\Model\Task; -use Kanboard\Model\TaskFile; -use Kanboard\Model\Comment; -use Kanboard\Model\Subtask; +use Kanboard\Core\Notification\NotificationInterface; +use Kanboard\Model\TaskModel; +use Kanboard\Model\TaskFileModel; +use Kanboard\Model\CommentModel; +use Kanboard\Model\SubtaskModel; /** * Email Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class Mail extends Base implements NotificationInterface +class MailNotification extends Base implements NotificationInterface { /** * Notification type @@ -67,7 +68,7 @@ class Mail 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')) ); } @@ -82,50 +83,50 @@ class Mail 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/Web.php b/app/Notification/WebNotification.php index 9271c193..d8818828 100644 --- a/app/Notification/Web.php +++ b/app/Notification/WebNotification.php @@ -3,14 +3,15 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; +use Kanboard\Core\Notification\NotificationInterface; /** * Web Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class Web extends Base implements NotificationInterface +class WebNotification extends Base implements NotificationInterface { /** * Notification type @@ -29,7 +30,7 @@ class Web 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/Webhook.php b/app/Notification/WebhookNotification.php index e187909f..16045535 100644 --- a/app/Notification/Webhook.php +++ b/app/Notification/WebhookNotification.php @@ -3,14 +3,15 @@ namespace Kanboard\Notification; use Kanboard\Core\Base; +use Kanboard\Core\Notification\NotificationInterface; /** * Webhook Notification * - * @package notification + * @package Kanboard\Notification * @author Frederic Guillot */ -class Webhook extends Base implements NotificationInterface +class WebhookNotification extends Base implements NotificationInterface { /** * Send notification to a user @@ -34,8 +35,8 @@ class Webhook 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/ApiProvider.php b/app/ServiceProvider/ApiProvider.php new file mode 100644 index 00000000..19d945f6 --- /dev/null +++ b/app/ServiceProvider/ApiProvider.php @@ -0,0 +1,74 @@ +<?php + +namespace Kanboard\ServiceProvider; + +use JsonRPC\Server; +use Kanboard\Api\ActionApi; +use Kanboard\Api\AppApi; +use Kanboard\Api\BoardApi; +use Kanboard\Api\CategoryApi; +use Kanboard\Api\ColumnApi; +use Kanboard\Api\CommentApi; +use Kanboard\Api\FileApi; +use Kanboard\Api\GroupApi; +use Kanboard\Api\GroupMemberApi; +use Kanboard\Api\LinkApi; +use Kanboard\Api\MeApi; +use Kanboard\Api\Middleware\AuthenticationApiMiddleware; +use Kanboard\Api\ProjectApi; +use Kanboard\Api\ProjectPermissionApi; +use Kanboard\Api\SubtaskApi; +use Kanboard\Api\SwimlaneApi; +use Kanboard\Api\TaskApi; +use Kanboard\Api\TaskLinkApi; +use Kanboard\Api\UserApi; +use Pimple\Container; +use Pimple\ServiceProviderInterface; + +/** + * Class ApiProvider + * + * @package Kanboard\ServiceProvider + * @author Frederic Guillot + */ +class ApiProvider implements ServiceProviderInterface +{ + /** + * Registers services on the given container. + * + * @param Container $container + * @return Container + */ + public function register(Container $container) + { + $server = new Server(); + $server->setAuthenticationHeader(API_AUTHENTICATION_HEADER); + $server->getMiddlewareHandler() + ->withMiddleware(new AuthenticationApiMiddleware($container)) + ; + + $server->getProcedureHandler() + ->withObject(new MeApi($container)) + ->withObject(new ActionApi($container)) + ->withObject(new AppApi($container)) + ->withObject(new BoardApi($container)) + ->withObject(new ColumnApi($container)) + ->withObject(new CategoryApi($container)) + ->withObject(new CommentApi($container)) + ->withObject(new FileApi($container)) + ->withObject(new LinkApi($container)) + ->withObject(new ProjectApi($container)) + ->withObject(new ProjectPermissionApi($container)) + ->withObject(new SubtaskApi($container)) + ->withObject(new SwimlaneApi($container)) + ->withObject(new TaskApi($container)) + ->withObject(new TaskLinkApi($container)) + ->withObject(new UserApi($container)) + ->withObject(new GroupApi($container)) + ->withObject(new GroupMemberApi($container)) + ; + + $container['api'] = $server; + return $container; + } +} diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php index 051dcc30..2fad8a3a 100644 --- a/app/ServiceProvider/AuthenticationProvider.php +++ b/app/ServiceProvider/AuthenticationProvider.php @@ -66,41 +66,42 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->setRoleHierarchy(Role::PROJECT_MANAGER, array(Role::PROJECT_MEMBER, Role::PROJECT_VIEWER)); $acl->setRoleHierarchy(Role::PROJECT_MEMBER, array(Role::PROJECT_VIEWER)); - $acl->add('Action', '*', Role::PROJECT_MANAGER); - $acl->add('ActionProject', '*', Role::PROJECT_MANAGER); - $acl->add('ActionCreation', '*', Role::PROJECT_MANAGER); - $acl->add('Analytic', '*', Role::PROJECT_MANAGER); - $acl->add('Board', 'save', Role::PROJECT_MEMBER); - $acl->add('BoardPopover', '*', Role::PROJECT_MEMBER); - $acl->add('TaskPopover', '*', Role::PROJECT_MEMBER); - $acl->add('Calendar', 'save', Role::PROJECT_MEMBER); - $acl->add('Category', '*', Role::PROJECT_MANAGER); - $acl->add('Column', '*', Role::PROJECT_MANAGER); - $acl->add('Comment', '*', Role::PROJECT_MEMBER); - $acl->add('Customfilter', '*', Role::PROJECT_MEMBER); - $acl->add('Export', '*', Role::PROJECT_MANAGER); - $acl->add('TaskFile', array('screenshot', 'create', 'save', 'remove', 'confirm'), Role::PROJECT_MEMBER); - $acl->add('Gantt', '*', Role::PROJECT_MANAGER); + $acl->add('ActionController', '*', Role::PROJECT_MANAGER); + $acl->add('ProjectActionDuplicationController', '*', Role::PROJECT_MANAGER); + $acl->add('ActionCreationController', '*', Role::PROJECT_MANAGER); + $acl->add('AnalyticController', '*', Role::PROJECT_MANAGER); + $acl->add('BoardAjaxController', 'save', Role::PROJECT_MEMBER); + $acl->add('BoardPopoverController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskPopoverController', '*', Role::PROJECT_MEMBER); + $acl->add('CalendarController', 'save', Role::PROJECT_MEMBER); + $acl->add('CategoryController', '*', Role::PROJECT_MANAGER); + $acl->add('ColumnController', '*', Role::PROJECT_MANAGER); + $acl->add('CommentController', '*', Role::PROJECT_MEMBER); + $acl->add('CustomFilterController', '*', Role::PROJECT_MEMBER); + $acl->add('ExportController', '*', Role::PROJECT_MANAGER); + $acl->add('TaskFileController', array('screenshot', 'create', 'save', 'remove', 'confirm'), Role::PROJECT_MEMBER); + $acl->add('TaskGanttController', '*', Role::PROJECT_MANAGER); + $acl->add('TaskGanttCreationController', '*', Role::PROJECT_MANAGER); $acl->add('ProjectViewController', array('share', 'updateSharing', 'integrations', 'updateIntegrations', 'notifications', 'updateNotifications', 'duplicate', 'doDuplication'), Role::PROJECT_MANAGER); $acl->add('ProjectPermissionController', '*', Role::PROJECT_MANAGER); $acl->add('ProjectEditController', '*', Role::PROJECT_MANAGER); - $acl->add('ProjectFile', '*', Role::PROJECT_MEMBER); - $acl->add('Projectuser', '*', Role::PROJECT_MANAGER); + $acl->add('ProjectFileController', '*', Role::PROJECT_MEMBER); + $acl->add('ProjectUserOverviewController', '*', Role::PROJECT_MANAGER); $acl->add('ProjectStatusController', '*', Role::PROJECT_MANAGER); $acl->add('SubtaskController', '*', Role::PROJECT_MEMBER); $acl->add('SubtaskRestrictionController', '*', Role::PROJECT_MEMBER); $acl->add('SubtaskStatusController', '*', Role::PROJECT_MEMBER); - $acl->add('Swimlane', '*', Role::PROJECT_MANAGER); - $acl->add('Task', 'remove', Role::PROJECT_MEMBER); + $acl->add('SwimlaneController', '*', Role::PROJECT_MANAGER); + $acl->add('TaskSuppressionController', '*', Role::PROJECT_MEMBER); $acl->add('TaskCreationController', '*', Role::PROJECT_MEMBER); $acl->add('TaskBulkController', '*', Role::PROJECT_MEMBER); - $acl->add('Taskduplication', '*', Role::PROJECT_MEMBER); - $acl->add('TaskRecurrence', '*', Role::PROJECT_MEMBER); - $acl->add('TaskImport', '*', Role::PROJECT_MANAGER); - $acl->add('TaskInternalLink', '*', Role::PROJECT_MEMBER); - $acl->add('TaskExternalLink', '*', Role::PROJECT_MEMBER); - $acl->add('Taskmodification', '*', Role::PROJECT_MEMBER); - $acl->add('Taskstatus', '*', Role::PROJECT_MEMBER); + $acl->add('TaskDuplicationController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskRecurrenceController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskImportController', '*', Role::PROJECT_MANAGER); + $acl->add('TaskInternalLinkController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskExternalLinkController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskModificationController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskStatusController', '*', Role::PROJECT_MEMBER); $acl->add('UserAjaxController', array('mention'), Role::PROJECT_MEMBER); return $acl; @@ -120,27 +121,26 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->setRoleHierarchy(Role::APP_MANAGER, array(Role::APP_USER, Role::APP_PUBLIC)); $acl->setRoleHierarchy(Role::APP_USER, array(Role::APP_PUBLIC)); - $acl->add('Auth', array('login', 'check'), Role::APP_PUBLIC); - $acl->add('Captcha', '*', Role::APP_PUBLIC); - $acl->add('PasswordReset', '*', Role::APP_PUBLIC); - $acl->add('Webhook', '*', Role::APP_PUBLIC); - $acl->add('Task', 'readonly', Role::APP_PUBLIC); - $acl->add('Board', 'readonly', Role::APP_PUBLIC); - $acl->add('Ical', '*', Role::APP_PUBLIC); - $acl->add('Feed', '*', Role::APP_PUBLIC); - $acl->add('AvatarFile', 'show', Role::APP_PUBLIC); + $acl->add('AuthController', array('login', 'check'), Role::APP_PUBLIC); + $acl->add('CaptchaController', '*', Role::APP_PUBLIC); + $acl->add('PasswordResetController', '*', Role::APP_PUBLIC); + $acl->add('TaskViewController', 'readonly', Role::APP_PUBLIC); + $acl->add('BoardViewController', 'readonly', Role::APP_PUBLIC); + $acl->add('ICalendarController', '*', Role::APP_PUBLIC); + $acl->add('FeedController', '*', Role::APP_PUBLIC); + $acl->add('AvatarFileController', 'show', Role::APP_PUBLIC); - $acl->add('Config', '*', Role::APP_ADMIN); + $acl->add('ConfigController', '*', Role::APP_ADMIN); $acl->add('PluginController', '*', Role::APP_ADMIN); - $acl->add('Currency', '*', Role::APP_ADMIN); - $acl->add('Gantt', array('projects', 'saveProjectDate'), Role::APP_MANAGER); + $acl->add('CurrencyController', '*', Role::APP_ADMIN); + $acl->add('ProjectGanttController', '*', Role::APP_MANAGER); $acl->add('GroupListController', '*', Role::APP_ADMIN); $acl->add('GroupCreationController', '*', Role::APP_ADMIN); $acl->add('GroupModificationController', '*', Role::APP_ADMIN); - $acl->add('Link', '*', Role::APP_ADMIN); - $acl->add('ProjectCreation', 'create', Role::APP_MANAGER); - $acl->add('Projectuser', '*', Role::APP_MANAGER); - $acl->add('Twofactor', 'disable', Role::APP_ADMIN); + $acl->add('LinkController', '*', Role::APP_ADMIN); + $acl->add('ProjectCreationController', 'create', Role::APP_MANAGER); + $acl->add('ProjectUserOverviewController', '*', Role::APP_MANAGER); + $acl->add('TwoFactorController', 'disable', Role::APP_ADMIN); $acl->add('UserImportController', '*', Role::APP_ADMIN); $acl->add('UserCreationController', '*', Role::APP_ADMIN); $acl->add('UserListController', '*', Role::APP_ADMIN); diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php index 154b921f..3e6efb02 100644 --- a/app/ServiceProvider/ClassProvider.php +++ b/app/ServiceProvider/ClassProvider.php @@ -4,7 +4,6 @@ namespace Kanboard\ServiceProvider; use Pimple\Container; use Pimple\ServiceProviderInterface; -use Kanboard\Core\Mail\Client as EmailClient; use Kanboard\Core\ObjectStorage\FileStorage; use Kanboard\Core\Paginator; use Kanboard\Core\Http\OAuth2; @@ -28,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', @@ -161,14 +160,6 @@ class ClassProvider implements ServiceProviderInterface return new FileStorage(FILES_DIR); }; - $container['emailClient'] = function ($container) { - $mailer = new EmailClient($container); - $mailer->setTransport('smtp', '\Kanboard\Core\Mail\Transport\Smtp'); - $mailer->setTransport('sendmail', '\Kanboard\Core\Mail\Transport\Sendmail'); - $mailer->setTransport('mail', '\Kanboard\Core\Mail\Transport\Mail'); - return $mailer; - }; - $container['cspRules'] = array( 'default-src' => "'self'", 'style-src' => "'self' 'unsafe-inline'", diff --git a/app/ServiceProvider/CommandProvider.php b/app/ServiceProvider/CommandProvider.php new file mode 100644 index 00000000..55c2712b --- /dev/null +++ b/app/ServiceProvider/CommandProvider.php @@ -0,0 +1,62 @@ +<?php + +namespace Kanboard\ServiceProvider; + +use Kanboard\Console\CronjobCommand; +use Kanboard\Console\LocaleComparatorCommand; +use Kanboard\Console\LocaleSyncCommand; +use Kanboard\Console\PluginInstallCommand; +use Kanboard\Console\PluginUninstallCommand; +use Kanboard\Console\PluginUpgradeCommand; +use Kanboard\Console\ProjectDailyColumnStatsExportCommand; +use Kanboard\Console\ProjectDailyStatsCalculationCommand; +use Kanboard\Console\ResetPasswordCommand; +use Kanboard\Console\ResetTwoFactorCommand; +use Kanboard\Console\SubtaskExportCommand; +use Kanboard\Console\TaskExportCommand; +use Kanboard\Console\TaskOverdueNotificationCommand; +use Kanboard\Console\TaskTriggerCommand; +use Kanboard\Console\TransitionExportCommand; +use Kanboard\Console\WorkerCommand; +use Pimple\Container; +use Pimple\ServiceProviderInterface; +use Symfony\Component\Console\Application; + +/** + * Class CommandProvider + * + * @package Kanboard\ServiceProvider + * @author Frederic Guillot + */ +class CommandProvider implements ServiceProviderInterface +{ + /** + * Registers services on the given container. + * + * @param Container $container + * @return Container + */ + public function register(Container $container) + { + $application = new Application('Kanboard', APP_VERSION); + $application->add(new TaskOverdueNotificationCommand($container)); + $application->add(new SubtaskExportCommand($container)); + $application->add(new TaskExportCommand($container)); + $application->add(new ProjectDailyStatsCalculationCommand($container)); + $application->add(new ProjectDailyColumnStatsExportCommand($container)); + $application->add(new TransitionExportCommand($container)); + $application->add(new LocaleSyncCommand($container)); + $application->add(new LocaleComparatorCommand($container)); + $application->add(new TaskTriggerCommand($container)); + $application->add(new CronjobCommand($container)); + $application->add(new WorkerCommand($container)); + $application->add(new ResetPasswordCommand($container)); + $application->add(new ResetTwoFactorCommand($container)); + $application->add(new PluginUpgradeCommand($container)); + $application->add(new PluginInstallCommand($container)); + $application->add(new PluginUninstallCommand($container)); + + $container['cli'] = $application; + return $container; + } +} 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/MailProvider.php b/app/ServiceProvider/MailProvider.php new file mode 100644 index 00000000..685709e3 --- /dev/null +++ b/app/ServiceProvider/MailProvider.php @@ -0,0 +1,34 @@ +<?php + +namespace Kanboard\ServiceProvider; + +use Kanboard\Core\Mail\Client as EmailClient; +use Pimple\Container; +use Pimple\ServiceProviderInterface; + +/** + * Mail Provider + * + * @package Kanboard\ServiceProvider + * @author Frederic Guillot + */ +class MailProvider implements ServiceProviderInterface +{ + /** + * Registers services on the given container. + * + * @param Container $container + */ + public function register(Container $container) + { + $container['emailClient'] = function ($container) { + $mailer = new EmailClient($container); + $mailer->setTransport('smtp', '\Kanboard\Core\Mail\Transport\Smtp'); + $mailer->setTransport('sendmail', '\Kanboard\Core\Mail\Transport\Sendmail'); + $mailer->setTransport('mail', '\Kanboard\Core\Mail\Transport\Mail'); + return $mailer; + }; + + return $container; + } +} diff --git a/app/ServiceProvider/NotificationProvider.php b/app/ServiceProvider/NotificationProvider.php index 23d1d516..a0571209 100644 --- a/app/ServiceProvider/NotificationProvider.php +++ b/app/ServiceProvider/NotificationProvider.php @@ -4,10 +4,10 @@ namespace Kanboard\ServiceProvider; use Pimple\Container; use Pimple\ServiceProviderInterface; -use Kanboard\Model\UserNotificationType; -use Kanboard\Model\ProjectNotificationType; -use Kanboard\Notification\Mail as MailNotification; -use Kanboard\Notification\Web as WebNotification; +use Kanboard\Model\UserNotificationTypeModel; +use Kanboard\Model\ProjectNotificationTypeModel; +use Kanboard\Notification\MailNotification as MailNotification; +use Kanboard\Notification\WebNotification as WebNotification; /** * Notification Provider @@ -26,17 +26,17 @@ class NotificationProvider implements ServiceProviderInterface */ public function register(Container $container) { - $container['userNotificationType'] = function ($container) { - $type = new UserNotificationType($container); - $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\Mail'); - $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\Web'); + $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); - $type->setType('webhook', 'Webhook', '\Kanboard\Notification\Webhook', true); - $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStream', true); + $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/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php index 2d705217..3d1391df 100644 --- a/app/ServiceProvider/RouteProvider.php +++ b/app/ServiceProvider/RouteProvider.php @@ -41,28 +41,27 @@ class RouteProvider implements ServiceProviderInterface $container['route']->addRoute('dashboard/:user_id/notifications', 'DashboardController', 'notifications'); // Search routes - $container['route']->addRoute('search', 'search', 'index'); - $container['route']->addRoute('search/activity', 'search', 'activity'); + $container['route']->addRoute('search', 'SearchController', 'index'); + $container['route']->addRoute('search/activity', 'SearchController', 'activity'); // ProjectCreation routes - $container['route']->addRoute('project/create', 'ProjectCreation', 'create'); - $container['route']->addRoute('project/create/private', 'ProjectCreation', 'createPrivate'); + $container['route']->addRoute('project/create', 'ProjectCreationController', 'create'); + $container['route']->addRoute('project/create/private', 'ProjectCreationController', 'createPrivate'); // Project routes $container['route']->addRoute('projects', 'ProjectListController', 'show'); $container['route']->addRoute('project/:project_id', 'ProjectViewController', 'show'); $container['route']->addRoute('p/:project_id', 'ProjectViewController', 'show'); - $container['route']->addRoute('project/:project_id/customer-filters', 'customfilter', 'index'); + $container['route']->addRoute('project/:project_id/customer-filters', 'CustomFilterController', 'index'); $container['route']->addRoute('project/:project_id/share', 'ProjectViewController', 'share'); $container['route']->addRoute('project/:project_id/notifications', 'ProjectViewController', 'notifications'); $container['route']->addRoute('project/:project_id/integrations', 'ProjectViewController', 'integrations'); $container['route']->addRoute('project/:project_id/duplicate', 'ProjectViewController', 'duplicate'); $container['route']->addRoute('project/:project_id/permissions', 'ProjectPermissionController', 'index'); - $container['route']->addRoute('project/:project_id/import', 'taskImport', 'step1'); - $container['route']->addRoute('project/:project_id/activity', 'activity', 'project'); + $container['route']->addRoute('project/:project_id/activity', 'ActivityController', 'project'); // Project Overview - $container['route']->addRoute('project/:project_id/overview', 'ProjectOverview', 'show'); + $container['route']->addRoute('project/:project_id/overview', 'ProjectOverviewController', 'show'); // ProjectEdit routes $container['route']->addRoute('project/:project_id/edit', 'ProjectEditController', 'edit'); @@ -71,73 +70,76 @@ class RouteProvider implements ServiceProviderInterface $container['route']->addRoute('project/:project_id/edit/priority', 'ProjectEditController', 'priority'); // ProjectUser routes - $container['route']->addRoute('projects/managers/:user_id', 'projectuser', 'managers'); - $container['route']->addRoute('projects/members/:user_id', 'projectuser', 'members'); - $container['route']->addRoute('projects/tasks/:user_id/opens', 'projectuser', 'opens'); - $container['route']->addRoute('projects/tasks/:user_id/closed', 'projectuser', 'closed'); - $container['route']->addRoute('projects/managers', 'projectuser', 'managers'); + $container['route']->addRoute('projects/managers/:user_id', 'ProjectUserOverviewController', 'managers'); + $container['route']->addRoute('projects/members/:user_id', 'ProjectUserOverviewController', 'members'); + $container['route']->addRoute('projects/tasks/:user_id/opens', 'ProjectUserOverviewController', 'opens'); + $container['route']->addRoute('projects/tasks/:user_id/closed', 'ProjectUserOverviewController', 'closed'); + $container['route']->addRoute('projects/managers', 'ProjectUserOverviewController', 'managers'); // Action routes - $container['route']->addRoute('project/:project_id/actions', 'action', 'index'); + $container['route']->addRoute('project/:project_id/actions', 'ActionController', 'index'); // Column routes - $container['route']->addRoute('project/:project_id/columns', 'column', 'index'); + $container['route']->addRoute('project/:project_id/columns', 'ColumnController', 'index'); // Swimlane routes - $container['route']->addRoute('project/:project_id/swimlanes', 'swimlane', 'index'); + $container['route']->addRoute('project/:project_id/swimlanes', 'SwimlaneController', 'index'); // Category routes - $container['route']->addRoute('project/:project_id/categories', 'category', 'index'); + $container['route']->addRoute('project/:project_id/categories', 'CategoryController', 'index'); + + // Import routes + $container['route']->addRoute('project/:project_id/import', 'TaskImportController', 'show'); // Task routes - $container['route']->addRoute('project/:project_id/task/:task_id', 'task', 'show'); - $container['route']->addRoute('t/:task_id', 'task', 'show'); - $container['route']->addRoute('public/task/:task_id/:token', 'task', 'readonly'); + $container['route']->addRoute('project/:project_id/task/:task_id', 'TaskViewController', 'show'); + $container['route']->addRoute('t/:task_id', 'TaskViewController', 'show'); + $container['route']->addRoute('public/task/:task_id/:token', 'TaskViewController', 'readonly'); - $container['route']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task'); - $container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'task', 'transitions'); - $container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'task', 'analytics'); - $container['route']->addRoute('project/:project_id/task/:task_id/time-tracking', 'task', 'timetracking'); + $container['route']->addRoute('project/:project_id/task/:task_id/activity', 'ActivityController', 'task'); + $container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'TaskViewController', 'transitions'); + $container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'TaskViewController', 'analytics'); + $container['route']->addRoute('project/:project_id/task/:task_id/time-tracking', 'TaskViewController', 'timetracking'); // Exports - $container['route']->addRoute('export/tasks/:project_id', 'export', 'tasks'); - $container['route']->addRoute('export/subtasks/:project_id', 'export', 'subtasks'); - $container['route']->addRoute('export/transitions/:project_id', 'export', 'transitions'); - $container['route']->addRoute('export/summary/:project_id', 'export', 'summary'); + $container['route']->addRoute('export/tasks/:project_id', 'ExportController', 'tasks'); + $container['route']->addRoute('export/subtasks/:project_id', 'ExportController', 'subtasks'); + $container['route']->addRoute('export/transitions/:project_id', 'ExportController', 'transitions'); + $container['route']->addRoute('export/summary/:project_id', 'ExportController', 'summary'); // Analytics routes - $container['route']->addRoute('analytics/tasks/:project_id', 'analytic', 'tasks'); - $container['route']->addRoute('analytics/users/:project_id', 'analytic', 'users'); - $container['route']->addRoute('analytics/cfd/:project_id', 'analytic', 'cfd'); - $container['route']->addRoute('analytics/burndown/:project_id', 'analytic', 'burndown'); - $container['route']->addRoute('analytics/average-time-column/:project_id', 'analytic', 'averageTimeByColumn'); - $container['route']->addRoute('analytics/lead-cycle-time/:project_id', 'analytic', 'leadAndCycleTime'); - $container['route']->addRoute('analytics/estimated-spent-time/:project_id', 'analytic', 'compareHours'); + $container['route']->addRoute('analytics/tasks/:project_id', 'AnalyticController', 'tasks'); + $container['route']->addRoute('analytics/users/:project_id', 'AnalyticController', 'users'); + $container['route']->addRoute('analytics/cfd/:project_id', 'AnalyticController', 'cfd'); + $container['route']->addRoute('analytics/burndown/:project_id', 'AnalyticController', 'burndown'); + $container['route']->addRoute('analytics/average-time-column/:project_id', 'AnalyticController', 'averageTimeByColumn'); + $container['route']->addRoute('analytics/lead-cycle-time/:project_id', 'AnalyticController', 'leadAndCycleTime'); + $container['route']->addRoute('analytics/estimated-spent-time/:project_id', 'AnalyticController', 'compareHours'); // Board routes - $container['route']->addRoute('board/:project_id', 'board', 'show'); - $container['route']->addRoute('b/:project_id', 'board', 'show'); - $container['route']->addRoute('public/board/:token', 'board', 'readonly'); + $container['route']->addRoute('board/:project_id', 'BoardViewController', 'show'); + $container['route']->addRoute('b/:project_id', 'BoardViewController', 'show'); + $container['route']->addRoute('public/board/:token', 'BoardViewController', 'readonly'); // Calendar routes - $container['route']->addRoute('calendar/:project_id', 'calendar', 'show'); - $container['route']->addRoute('c/:project_id', 'calendar', 'show'); + $container['route']->addRoute('calendar/:project_id', 'CalendarController', 'show'); + $container['route']->addRoute('c/:project_id', 'CalendarController', 'show'); // Listing routes - $container['route']->addRoute('list/:project_id', 'listing', 'show'); - $container['route']->addRoute('l/:project_id', 'listing', 'show'); + $container['route']->addRoute('list/:project_id', 'TaskListController', 'show'); + $container['route']->addRoute('l/:project_id', 'TaskListController', 'show'); // Gantt routes - $container['route']->addRoute('gantt/:project_id', 'gantt', 'project'); - $container['route']->addRoute('gantt/:project_id/sort/:sorting', 'gantt', 'project'); + $container['route']->addRoute('gantt/:project_id', 'TaskGanttController', 'show'); + $container['route']->addRoute('gantt/:project_id/sort/:sorting', 'TaskGanttController', 'show'); // Feed routes - $container['route']->addRoute('feed/project/:token', 'feed', 'project'); - $container['route']->addRoute('feed/user/:token', 'feed', 'user'); + $container['route']->addRoute('feed/project/:token', 'FeedController', 'project'); + $container['route']->addRoute('feed/user/:token', 'FeedController', 'user'); // Ical routes - $container['route']->addRoute('ical/project/:token', 'ical', 'project'); - $container['route']->addRoute('ical/user/:token', 'ical', 'user'); + $container['route']->addRoute('ical/project/:token', 'ICalendarController', 'project'); + $container['route']->addRoute('ical/user/:token', 'ICalendarController', 'user'); // Users $container['route']->addRoute('users', 'UserListController', 'show'); @@ -153,41 +155,41 @@ class RouteProvider implements ServiceProviderInterface $container['route']->addRoute('user/:user_id/accounts', 'UserViewController', 'external'); $container['route']->addRoute('user/:user_id/integrations', 'UserViewController', 'integrations'); $container['route']->addRoute('user/:user_id/authentication', 'UserCredentialController', 'changeAuthentication'); - $container['route']->addRoute('user/:user_id/2fa', 'twofactor', 'index'); - $container['route']->addRoute('user/:user_id/avatar', 'AvatarFile', 'show'); + $container['route']->addRoute('user/:user_id/2fa', 'TwoFactorController', 'index'); + $container['route']->addRoute('user/:user_id/avatar', 'AvatarFileController', 'show'); // Groups $container['route']->addRoute('groups', 'GroupListController', 'index'); $container['route']->addRoute('group/:group_id/members', 'GroupListController', 'users'); // Config - $container['route']->addRoute('settings', 'config', 'index'); - $container['route']->addRoute('settings/application', 'config', 'application'); - $container['route']->addRoute('settings/project', 'config', 'project'); - $container['route']->addRoute('settings/project', 'config', 'project'); - $container['route']->addRoute('settings/board', 'config', 'board'); - $container['route']->addRoute('settings/calendar', 'config', 'calendar'); - $container['route']->addRoute('settings/integrations', 'config', 'integrations'); - $container['route']->addRoute('settings/webhook', 'config', 'webhook'); - $container['route']->addRoute('settings/api', 'config', 'api'); - $container['route']->addRoute('settings/links', 'link', 'index'); - $container['route']->addRoute('settings/currencies', 'currency', 'index'); + $container['route']->addRoute('settings', 'ConfigController', 'index'); + $container['route']->addRoute('settings/application', 'ConfigController', 'application'); + $container['route']->addRoute('settings/project', 'ConfigController', 'project'); + $container['route']->addRoute('settings/project', 'ConfigController', 'project'); + $container['route']->addRoute('settings/board', 'ConfigController', 'board'); + $container['route']->addRoute('settings/calendar', 'ConfigController', 'calendar'); + $container['route']->addRoute('settings/integrations', 'ConfigController', 'integrations'); + $container['route']->addRoute('settings/webhook', 'ConfigController', 'webhook'); + $container['route']->addRoute('settings/api', 'ConfigController', 'api'); + $container['route']->addRoute('settings/links', 'LinkController', 'index'); + $container['route']->addRoute('settings/currencies', 'CurrencyController', 'index'); // Plugins $container['route']->addRoute('extensions', 'PluginController', 'show'); $container['route']->addRoute('extensions/directory', 'PluginController', 'directory'); // Doc - $container['route']->addRoute('documentation/:file', 'doc', 'show'); - $container['route']->addRoute('documentation', 'doc', 'show'); + $container['route']->addRoute('documentation/:file', 'DocumentationController', 'show'); + $container['route']->addRoute('documentation', 'DocumentationController', 'show'); // Auth routes - $container['route']->addRoute('login', 'auth', 'login'); - $container['route']->addRoute('logout', 'auth', 'logout'); + $container['route']->addRoute('login', 'AuthController', 'login'); + $container['route']->addRoute('logout', 'AuthController', 'logout'); // PasswordReset - $container['route']->addRoute('forgot-password', 'PasswordReset', 'create'); - $container['route']->addRoute('forgot-password/change/:token', 'PasswordReset', 'change'); + $container['route']->addRoute('forgot-password', 'PasswordResetController', 'create'); + $container['route']->addRoute('forgot-password/change/:token', 'PasswordResetController', 'change'); } return $container; 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/action/index.php b/app/Template/action/index.php index 63d63887..0a94e4f0 100644 --- a/app/Template/action/index.php +++ b/app/Template/action/index.php @@ -3,11 +3,11 @@ <ul> <li> <i class="fa fa-plus fa-fw"></i> - <?= $this->url->link(t('Add a new action'), 'ActionCreation', 'create', array('project_id' => $project['id']), false, 'popover') ?> + <?= $this->url->link(t('Add a new action'), 'ActionCreationController', 'create', array('project_id' => $project['id']), false, 'popover') ?> </li> <li> <i class="fa fa-copy fa-fw"></i> - <?= $this->url->link(t('Import from another project'), 'ActionProject', 'project', array('project_id' => $project['id']), false, 'popover') ?> + <?= $this->url->link(t('Import from another project'), 'ProjectActionDuplicationController', 'show', array('project_id' => $project['id']), false, 'popover') ?> </li> </ul> </div> @@ -63,9 +63,9 @@ </ul> </td> <td> - <?= $this->url->link(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'ActionController', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id']), false, 'popover') ?> </td> </tr> <?php endforeach ?> </table> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/action/remove.php b/app/Template/action/remove.php index 070a7918..384bec7a 100644 --- a/app/Template/action/remove.php +++ b/app/Template/action/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'action', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'ActionController', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'ActionController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/action_creation/create.php b/app/Template/action_creation/create.php index bccb19b3..c0d2880e 100644 --- a/app/Template/action_creation/create.php +++ b/app/Template/action_creation/create.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Add an action') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreation', 'event', array('project_id' => $project['id'])) ?>"> +<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreationController', 'event', array('project_id' => $project['id'])) ?>"> <?= $this->form->csrf() ?> <?= $this->form->hidden('project_id', $values) ?> @@ -11,6 +11,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Next step') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'Action', 'index', array(), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'ActionController', 'index', array(), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/action_creation/event.php b/app/Template/action_creation/event.php index e7e5aaf9..cdf00310 100644 --- a/app/Template/action_creation/event.php +++ b/app/Template/action_creation/event.php @@ -2,7 +2,7 @@ <h2><?= t('Choose an event') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreation', 'params', array('project_id' => $project['id'])) ?>"> +<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreationController', 'params', array('project_id' => $project['id'])) ?>"> <?= $this->form->csrf() ?> @@ -22,6 +22,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Next step') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'ActionController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/action_creation/params.php b/app/Template/action_creation/params.php index 46ca52a4..fa892177 100644 --- a/app/Template/action_creation/params.php +++ b/app/Template/action_creation/params.php @@ -2,7 +2,7 @@ <h2><?= t('Define action parameters') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreation', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreationController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -50,6 +50,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'ActionController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/activity/project.php b/app/Template/activity/project.php index 176d9b99..ce1c8c0f 100644 --- a/app/Template/activity/project.php +++ b/app/Template/activity/project.php @@ -1,14 +1,14 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Analytic', $this->app->getRouterAction()) ?> + <?= $this->projectHeader->render($project, 'AnalyticController', $this->app->getRouterAction()) ?> <?php if ($project['is_public']): ?> <div class="menu-inline pull-right"> <ul> - <li><i class="fa fa-rss-square fa-fw"></i><?= $this->url->link(t('RSS feed'), 'feed', 'project', array('token' => $project['token']), false, '', '', true) ?></li> - <li><i class="fa fa-calendar fa-fw"></i><?= $this->url->link(t('iCal feed'), 'ical', 'project', array('token' => $project['token'])) ?></li> + <li><i class="fa fa-rss-square fa-fw"></i><?= $this->url->link(t('RSS feed'), 'FeedController', 'project', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-calendar fa-fw"></i><?= $this->url->link(t('iCal feed'), 'ICalendarController', 'project', array('token' => $project['token'])) ?></li> </ul> </div> <?php endif ?> <?= $this->render('event/events', array('events' => $events)) ?> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/analytic/burndown.php b/app/Template/analytic/burndown.php index ed6c8aeb..e979595d 100644 --- a/app/Template/analytic/burndown.php +++ b/app/Template/analytic/burndown.php @@ -12,7 +12,7 @@ <hr/> -<form method="post" class="form-inline" action="<?= $this->url->href('analytic', 'burndown', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" class="form-inline" action="<?= $this->url->href('AnalyticController', 'burndown', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/analytic/cfd.php b/app/Template/analytic/cfd.php index ee259c70..8dfb5b00 100644 --- a/app/Template/analytic/cfd.php +++ b/app/Template/analytic/cfd.php @@ -12,7 +12,7 @@ <hr/> -<form method="post" class="form-inline" action="<?= $this->url->href('analytic', 'cfd', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" class="form-inline" action="<?= $this->url->href('AnalyticController', 'cfd', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/analytic/compare_hours.php b/app/Template/analytic/compare_hours.php index 8249e7ba..70d8d02b 100644 --- a/app/Template/analytic/compare_hours.php +++ b/app/Template/analytic/compare_hours.php @@ -34,13 +34,13 @@ <?php foreach ($paginator->getCollection() as $task): ?> <tr> <td class="task-table color-<?= $task['color_id'] ?>"> - <?= $this->url->link('#'.$this->text->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $this->url->link('#'.$this->text->e($task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </td> <td> - <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $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/analytic/layout.php b/app/Template/analytic/layout.php index e9b9db61..e3c6099f 100644 --- a/app/Template/analytic/layout.php +++ b/app/Template/analytic/layout.php @@ -1,5 +1,5 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Listing', 'show') ?> + <?= $this->projectHeader->render($project, 'TaskListController', 'show') ?> <section class="sidebar-container"> <?= $this->render($sidebar_template, array('project' => $project)) ?> diff --git a/app/Template/analytic/lead_cycle_time.php b/app/Template/analytic/lead_cycle_time.php index 82ffe534..2dccc136 100644 --- a/app/Template/analytic/lead_cycle_time.php +++ b/app/Template/analytic/lead_cycle_time.php @@ -16,7 +16,7 @@ <div id="chart" data-metrics='<?= json_encode($metrics, JSON_HEX_APOS) ?>' data-label-cycle="<?= t('Cycle Time') ?>" data-label-lead="<?= t('Lead Time') ?>"></div> - <form method="post" class="form-inline" action="<?= $this->url->href('analytic', 'leadAndCycleTime', array('project_id' => $project['id'])) ?>" autocomplete="off"> + <form method="post" class="form-inline" action="<?= $this->url->href('AnalyticController', 'leadAndCycleTime', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/analytic/sidebar.php b/app/Template/analytic/sidebar.php index 76289b9f..de3dccf8 100644 --- a/app/Template/analytic/sidebar.php +++ b/app/Template/analytic/sidebar.php @@ -1,29 +1,29 @@ <div class="sidebar"> <h2><?= t('Reportings') ?></h2> <ul> - <li <?= $this->app->checkMenuSelection('analytic', 'tasks') ?>> - <?= $this->url->link(t('Task distribution'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('AnalyticController', 'tasks') ?>> + <?= $this->url->link(t('Task distribution'), 'AnalyticController', 'tasks', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('analytic', 'users') ?>> - <?= $this->url->link(t('User repartition'), 'analytic', 'users', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('AnalyticController', 'users') ?>> + <?= $this->url->link(t('User repartition'), 'AnalyticController', 'users', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('analytic', 'cfd') ?>> - <?= $this->url->link(t('Cumulative flow diagram'), 'analytic', 'cfd', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('AnalyticController', 'cfd') ?>> + <?= $this->url->link(t('Cumulative flow diagram'), 'AnalyticController', 'cfd', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('analytic', 'burndown') ?>> - <?= $this->url->link(t('Burndown chart'), 'analytic', 'burndown', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('AnalyticController', 'burndown') ?>> + <?= $this->url->link(t('Burndown chart'), 'AnalyticController', 'burndown', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('analytic', 'averageTimeByColumn') ?>> - <?= $this->url->link(t('Average time into each column'), 'analytic', 'averageTimeByColumn', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('AnalyticController', 'averageTimeByColumn') ?>> + <?= $this->url->link(t('Average time into each column'), 'AnalyticController', 'averageTimeByColumn', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('analytic', 'leadAndCycleTime') ?>> - <?= $this->url->link(t('Lead and cycle time'), 'analytic', 'leadAndCycleTime', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('AnalyticController', 'leadAndCycleTime') ?>> + <?= $this->url->link(t('Lead and cycle time'), 'AnalyticController', 'leadAndCycleTime', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('analytic', 'compareHours') ?>> - <?= $this->url->link(t('Estimated vs actual time'), 'analytic', 'compareHours', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('AnalyticController', 'compareHours') ?>> + <?= $this->url->link(t('Estimated vs actual time'), 'AnalyticController', 'compareHours', array('project_id' => $project['id'])) ?> </li> - + <?= $this->hook->render('template:analytic:sidebar', array('project' => $project)) ?> - + </ul> </div> diff --git a/app/Template/auth/index.php b/app/Template/auth/index.php index cc562170..45bbdb8e 100644 --- a/app/Template/auth/index.php +++ b/app/Template/auth/index.php @@ -7,7 +7,7 @@ <?php endif ?> <?php if (! HIDE_LOGIN_FORM): ?> - <form method="post" action="<?= $this->url->href('auth', 'check') ?>"> + <form method="post" action="<?= $this->url->href('AuthController', 'check') ?>"> <?= $this->form->csrf() ?> @@ -19,7 +19,7 @@ <?php if (isset($captcha) && $captcha): ?> <?= $this->form->label(t('Enter the text below'), 'captcha') ?> - <img src="<?= $this->url->href('Captcha', 'image') ?>"/> + <img src="<?= $this->url->href('CaptchaController', 'image') ?>" alt="Captcha"> <?= $this->form->text('captcha', array(), $errors, array('required')) ?> <?php endif ?> @@ -32,11 +32,11 @@ </div> <?php if ($this->app->config('password_reset') == 1): ?> <div class="reset-password"> - <?= $this->url->link(t('Forgot password?'), 'PasswordReset', 'create') ?> + <?= $this->url->link(t('Forgot password?'), 'PasswordResetController', 'create') ?> </div> <?php endif ?> </form> <?php endif ?> <?= $this->hook->render('template:auth:login-form:after') ?> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/avatar_file/show.php b/app/Template/avatar_file/show.php index 9f19a1ab..37c56cec 100644 --- a/app/Template/avatar_file/show.php +++ b/app/Template/avatar_file/show.php @@ -6,14 +6,14 @@ <div class="form-actions"> <?php if (! empty($user['avatar_path'])): ?> - <?= $this->url->link(t('Remove my image'), 'AvatarFile', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Remove my image'), 'AvatarFileController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?> <?php endif ?> </div> <hr> <h3><?= t('Upload my avatar image') ?></h3> -<form method="post" enctype="multipart/form-data" action="<?= $this->url->href('AvatarFile', 'upload', array('user_id' => $user['id'])) ?>"> +<form method="post" enctype="multipart/form-data" action="<?= $this->url->href('AvatarFileController', 'upload', array('user_id' => $user['id'])) ?>"> <?= $this->form->csrf() ?> <?= $this->form->file('avatar') ?> diff --git a/app/Template/board/table_column.php b/app/Template/board/table_column.php index eced52dc..f7a9f6ad 100644 --- a/app/Template/board/table_column.php +++ b/app/Template/board/table_column.php @@ -43,7 +43,7 @@ <?php if ($column['nb_tasks'] > 0): ?> <li> <i class="fa fa-close fa-fw"></i> - <?= $this->url->link(t('Close all tasks of this column'), 'BoardPopover', 'confirmCloseColumnTasks', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> + <?= $this->url->link(t('Close all tasks of this column'), 'BoardPopoverController', 'confirmCloseColumnTasks', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> </li> <?php endif ?> <?php endif ?> diff --git a/app/Template/board/table_container.php b/app/Template/board/table_container.php index 82bbec93..a93e7001 100644 --- a/app/Template/board/table_container.php +++ b/app/Template/board/table_container.php @@ -10,9 +10,9 @@ class="board-project-<?= $project['id'] ?>" data-project-id="<?= $project['id'] ?>" data-check-interval="<?= $board_private_refresh_interval ?>" - data-save-url="<?= $this->url->href('board', 'save', array('project_id' => $project['id'])) ?>" - data-reload-url="<?= $this->url->href('board', 'reload', array('project_id' => $project['id'])) ?>" - data-check-url="<?= $this->url->href('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" + data-save-url="<?= $this->url->href('BoardAjaxController', 'save', array('project_id' => $project['id'])) ?>" + data-reload-url="<?= $this->url->href('BoardAjaxController', 'reload', array('project_id' => $project['id'])) ?>" + data-check-url="<?= $this->url->href('BoardAjaxController', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" data-task-creation-url="<?= $this->url->href('TaskCreationController', 'show', array('project_id' => $project['id'])) ?>" > <?php endif ?> diff --git a/app/Template/board/table_swimlane.php b/app/Template/board/table_swimlane.php index 349b9acb..c5937e01 100644 --- a/app/Template/board/table_swimlane.php +++ b/app/Template/board/table_swimlane.php @@ -14,7 +14,7 @@ <span title="<?= t('Description') ?>" class="tooltip" - data-href="<?= $this->url->href('BoardTooltip', 'swimlane', array('swimlane_id' => $swimlane['id'], 'project_id' => $project['id'])) ?>"> + data-href="<?= $this->url->href('BoardTooltipController', 'swimlane', array('swimlane_id' => $swimlane['id'], 'project_id' => $project['id'])) ?>"> <i class="fa fa-info-circle"></i> </span> <?php endif ?> diff --git a/app/Template/board/task_avatar.php b/app/Template/board/task_avatar.php index 53739b19..14b55476 100644 --- a/app/Template/board/task_avatar.php +++ b/app/Template/board/task_avatar.php @@ -1,9 +1,9 @@ <?php if (! empty($task['owner_id'])): ?> <div class="task-board-avatars"> <span - <?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> class="task-board-assignee task-board-change-assignee" - data-url="<?= $this->url->href('TaskPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + data-url="<?= $this->url->href('TaskPopoverController', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> <?php else: ?> class="task-board-assignee"> <?php endif ?> diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index dbfe65b0..11df8962 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -6,7 +6,7 @@ <?php else: ?> <?= $this->url->link( $this->text->e($task['category_name']), - 'TaskPopover', + 'TaskPopoverController', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, @@ -33,36 +33,36 @@ </span> <?php endif ?> - <?php if ($task['recurrence_status'] == \Kanboard\Model\Task::RECURRING_STATUS_PENDING): ?> - <span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90"></i></span> + <?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): ?> - <span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90 fa-inverse"></i></span> + <?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 ?> <?php if (! empty($task['nb_links'])): ?> - <span title="<?= t('Links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-code-fork fa-fw"></i><?= $task['nb_links'] ?></span> + <span title="<?= t('Links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-code-fork fa-fw"></i><?= $task['nb_links'] ?></span> <?php endif ?> <?php if (! empty($task['nb_external_links'])): ?> - <span title="<?= t('External links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'externallinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-external-link fa-fw"></i><?= $task['nb_external_links'] ?></span> + <span title="<?= t('External links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'externallinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-external-link fa-fw"></i><?= $task['nb_external_links'] ?></span> <?php endif ?> <?php if (! empty($task['nb_subtasks'])): ?> - <span title="<?= t('Sub-Tasks') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'subtasks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-bars"></i> <?= round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?></span> + <span title="<?= t('Sub-Tasks') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'subtasks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-bars"></i> <?= round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?></span> <?php endif ?> <?php if (! empty($task['nb_files'])): ?> - <span title="<?= t('Attachments') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-paperclip"></i> <?= $task['nb_files'] ?></span> + <span title="<?= t('Attachments') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-paperclip"></i> <?= $task['nb_files'] ?></span> <?php endif ?> <?php if (! empty($task['nb_comments'])): ?> - <span title="<?= $task['nb_comments'] == 1 ? t('%d comment', $task['nb_comments']) : t('%d comments', $task['nb_comments']) ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'comments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-comment-o"></i> <?= $task['nb_comments'] ?></span> + <span title="<?= $task['nb_comments'] == 1 ? t('%d comment', $task['nb_comments']) : t('%d comments', $task['nb_comments']) ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'comments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-comment-o"></i> <?= $task['nb_comments'] ?></span> <?php endif ?> <?php if (! empty($task['description'])): ?> - <span title="<?= t('Description') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + <span title="<?= t('Description') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> <i class="fa fa-file-text-o"></i> </span> <?php endif ?> diff --git a/app/Template/board/task_private.php b/app/Template/board/task_private.php index 57623042..94b396a6 100644 --- a/app/Template/board/task_private.php +++ b/app/Template/board/task_private.php @@ -1,6 +1,6 @@ <div class=" task-board - <?= $task['is_active'] == 1 ? ($this->user->hasProjectAccess('board', 'save', $task['project_id']) ? 'draggable-item ' : '').'task-board-status-open '.($task['date_modification'] > (time() - $board_highlight_period) ? 'task-board-recent' : '') : 'task-board-status-closed' ?> + <?= $task['is_active'] == 1 ? ($this->user->hasProjectAccess('BoardViewController', 'save', $task['project_id']) ? 'draggable-item ' : '').'task-board-status-open '.($task['date_modification'] > (time() - $board_highlight_period) ? 'task-board-recent' : '') : 'task-board-status-closed' ?> color-<?= $task['color_id'] ?>" data-task-id="<?= $task['id'] ?>" data-column-id="<?= $task['column_id'] ?>" @@ -9,14 +9,14 @@ data-owner-id="<?= $task['owner_id'] ?>" data-category-id="<?= $task['category_id'] ?>" data-due-date="<?= $task['date_due'] ?>" - data-task-url="<?= $this->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + data-task-url="<?= $this->url->href('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> <div class="task-board-sort-handle" style="display: none;"><i class="fa fa-arrows-alt"></i></div> <?php if ($this->board->isCollapsed($task['project_id'])): ?> <div class="task-board-collapsed"> <div class="task-board-saving-icon" style="display: none;"><i class="fa fa-spinner fa-pulse"></i></div> - <?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> <?= $this->render('task/dropdown', array('task' => $task)) ?> <?php else: ?> <strong><?= '#'.$task['id'] ?></strong> @@ -27,12 +27,12 @@ <?= $this->text->e($this->user->getInitials($task['assignee_name'] ?: $task['assignee_username'])) ?> </span> - <?php endif ?> - <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title tooltip', $this->text->e($task['title'])) ?> + <?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title tooltip', $this->text->e($task['title'])) ?> </div> <?php else: ?> <div class="task-board-expanded"> <div class="task-board-saving-icon" style="display: none;"><i class="fa fa-spinner fa-pulse fa-2x"></i></div> - <?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> <?= $this->render('task/dropdown', array('task' => $task)) ?> <?php else: ?> <strong><?= '#'.$task['id'] ?></strong> @@ -48,7 +48,7 @@ <?= $this->hook->render('template:board:private:task:before-title', array('task' => $task)) ?> <div class="task-board-title"> - <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $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')) ?> </div> <?= $this->hook->render('template:board:private:task:after-title', array('task' => $task)) ?> diff --git a/app/Template/board/task_public.php b/app/Template/board/task_public.php index a53d42c8..82eb6535 100644 --- a/app/Template/board/task_public.php +++ b/app/Template/board/task_public.php @@ -1,6 +1,6 @@ <div class="task-board color-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"> - <?= $this->url->link('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + <?= $this->url->link('#'.$task['id'], 'TaskViewController', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> <?php if ($task['reference']): ?> <span class="task-board-reference" title="<?= t('Reference') ?>"> @@ -12,7 +12,7 @@ <?= $this->hook->render('template:board:public:task:before-title', array('task' => $task)) ?> <div class="task-board-title"> - <?= $this->url->link($this->text->e($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + <?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> </div> <?= $this->hook->render('template:board:public:task:after-title', array('task' => $task)) ?> @@ -21,4 +21,4 @@ 'not_editable' => $not_editable, 'project' => $project, )) ?> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/board/tooltip_files.php b/app/Template/board/tooltip_files.php index 5ade5b5b..6f9e2640 100644 --- a/app/Template/board/tooltip_files.php +++ b/app/Template/board/tooltip_files.php @@ -9,9 +9,9 @@ </tr> <tr> <td> - <i class="fa fa-download fa-fw"></i><?= $this->url->link(t('download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <i class="fa fa-download fa-fw"></i><?= $this->url->link(t('download'), 'FileViewerController', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> <?php if ($file['is_image'] == 1): ?> - <i class="fa fa-eye"></i> <?= $this->url->link(t('open file'), 'FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + <i class="fa fa-eye"></i> <?= $this->url->link(t('open file'), 'FileViewerController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> <?php endif ?> </td> </tr> diff --git a/app/Template/board/tooltip_tasklinks.php b/app/Template/board/tooltip_tasklinks.php index 6424c39d..d1156cbe 100644 --- a/app/Template/board/tooltip_tasklinks.php +++ b/app/Template/board/tooltip_tasklinks.php @@ -12,7 +12,7 @@ <td class="column-60"> <?= $this->url->link( $this->text->e('#'.$link['task_id'].' '.$link['title']), - 'task', 'show', array('task_id' => $link['task_id'], 'project_id' => $link['project_id']), + 'TaskViewController', 'show', array('task_id' => $link['task_id'], 'project_id' => $link['project_id']), false, $link['is_active'] ? '' : 'task-link-closed' ) ?> @@ -31,4 +31,4 @@ <?php endforeach ?> <?php endforeach ?> </table> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/board/view_private.php b/app/Template/board/view_private.php index 13702273..a89e7d2b 100644 --- a/app/Template/board/view_private.php +++ b/app/Template/board/view_private.php @@ -1,6 +1,6 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Board', 'show', true) ?> + <?= $this->projectHeader->render($project, 'BoardViewController', 'show', true) ?> <?= $this->render('board/table_container', array( 'project' => $project, diff --git a/app/Template/board_popover/close_all_tasks_column.php b/app/Template/board_popover/close_all_tasks_column.php index 5090f499..57f703e3 100644 --- a/app/Template/board_popover/close_all_tasks_column.php +++ b/app/Template/board_popover/close_all_tasks_column.php @@ -2,7 +2,7 @@ <div class="page-header"> <h2><?= t('Do you really want to close all tasks of this column?') ?></h2> </div> - <form method="post" action="<?= $this->url->href('BoardPopover', 'closeColumnTasks', array('project_id' => $project['id'])) ?>"> + <form method="post" action="<?= $this->url->href('BoardPopoverController', 'closeColumnTasks', array('project_id' => $project['id'])) ?>"> <?= $this->form->csrf() ?> <?= $this->form->hidden('column_id', $values) ?> <?= $this->form->hidden('swimlane_id', $values) ?> @@ -12,7 +12,7 @@ <div class="form-actions"> <button type="submit" class="btn btn-red"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/calendar/show.php b/app/Template/calendar/show.php index f00e810b..3635f627 100644 --- a/app/Template/calendar/show.php +++ b/app/Template/calendar/show.php @@ -1,9 +1,9 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Calendar', 'show') ?> + <?= $this->projectHeader->render($project, 'CalendarController', 'show') ?> <div id="calendar" - data-save-url="<?= $this->url->href('calendar', 'save', array('project_id' => $project['id'])) ?>" - data-check-url="<?= $this->url->href('calendar', 'project', array('project_id' => $project['id'])) ?>" + data-save-url="<?= $this->url->href('CalendarController', 'save', array('project_id' => $project['id'])) ?>" + data-check-url="<?= $this->url->href('CalendarController', 'project', array('project_id' => $project['id'])) ?>" data-check-interval="<?= $check_interval ?>" > </div> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/category/edit.php b/app/Template/category/edit.php index 7b592689..fac56db3 100644 --- a/app/Template/category/edit.php +++ b/app/Template/category/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Category modification for the project "%s"', $project['name']) ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('category', 'update', array('project_id' => $project['id'], 'category_id' => $values['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('CategoryController', 'update', array('project_id' => $project['id'], 'category_id' => $values['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -18,6 +18,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'category', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'CategoryController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/category/index.php b/app/Template/category/index.php index b3bdfd81..a103d89f 100644 --- a/app/Template/category/index.php +++ b/app/Template/category/index.php @@ -15,10 +15,10 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <li> - <?= $this->url->link(t('Edit'), 'category', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?> + <?= $this->url->link(t('Edit'), 'CategoryController', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?> </li> <li> - <?= $this->url->link(t('Remove'), 'category', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'CategoryController', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?> </li> </ul> </div> @@ -31,7 +31,7 @@ <div class="page-header"> <h2><?= t('Add a new category') ?></h2> </div> -<form method="post" action="<?= $this->url->href('category', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('CategoryController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('project_id', $values) ?> @@ -42,4 +42,4 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/category/remove.php b/app/Template/category/remove.php index cad58d37..e7b9c9b4 100644 --- a/app/Template/category/remove.php +++ b/app/Template/category/remove.php @@ -9,9 +9,9 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'category', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'CategoryController', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'category', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'CategoryController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </div> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/column/create.php b/app/Template/column/create.php index 2d325f76..023de525 100644 --- a/app/Template/column/create.php +++ b/app/Template/column/create.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Add a new column') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('Column', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('ColumnController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -21,4 +21,4 @@ <?= t('or') ?> <?= $this->url->link(t('cancel'), 'column', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/column/edit.php b/app/Template/column/edit.php index 412858a9..a742e4b9 100644 --- a/app/Template/column/edit.php +++ b/app/Template/column/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Edit column "%s"', $column['title']) ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('column', 'update', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('ColumnController', 'update', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -21,6 +21,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'column', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'ColumnController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/column/index.php b/app/Template/column/index.php index 6bc67c5a..4f5f0a60 100644 --- a/app/Template/column/index.php +++ b/app/Template/column/index.php @@ -3,7 +3,7 @@ <ul> <li> <i class="fa fa-plus fa-fw"></i> - <?= $this->url->link(t('Add a new column'), 'Column', 'create', array('project_id' => $project['id']), false, 'popover') ?> + <?= $this->url->link(t('Add a new column'), 'ColumnController', 'create', array('project_id' => $project['id']), false, 'popover') ?> </li> </ul> </div> @@ -13,7 +13,7 @@ <?php else: ?> <table class="columns-table table-stripped" - data-save-position-url="<?= $this->url->href('Column', 'move', array('project_id' => $project['id'])) ?>"> + data-save-position-url="<?= $this->url->href('ColumnController', 'move', array('project_id' => $project['id'])) ?>"> <thead> <tr> <th class="column-70"><?= t('Column title') ?></th> @@ -41,10 +41,10 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <li> - <?= $this->url->link(t('Edit'), 'column', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?> + <?= $this->url->link(t('Edit'), 'ColumnController', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?> </li> <li> - <?= $this->url->link(t('Remove'), 'column', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'ColumnController', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?> </li> </ul> </div> diff --git a/app/Template/column/remove.php b/app/Template/column/remove.php index ccab889d..b231a9a7 100644 --- a/app/Template/column/remove.php +++ b/app/Template/column/remove.php @@ -9,7 +9,7 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'column', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> - <?= t('or') ?> <?= $this->url->link(t('cancel'), 'column', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('Yes'), 'ColumnController', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'ColumnController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/comment/create.php b/app/Template/comment/create.php index fa7c0ca6..0358107a 100644 --- a/app/Template/comment/create.php +++ b/app/Template/comment/create.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Add a comment') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('CommentController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('task_id', $values) ?> <?= $this->form->hidden('user_id', $values) ?> @@ -24,6 +24,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/comment/edit.php b/app/Template/comment/edit.php index 4036b673..f69fc0c1 100644 --- a/app/Template/comment/edit.php +++ b/app/Template/comment/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Edit a comment') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('comment', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('CommentController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> @@ -22,6 +22,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/comment/remove.php b/app/Template/comment/remove.php index 3174df02..55587b67 100644 --- a/app/Template/comment/remove.php +++ b/app/Template/comment/remove.php @@ -14,8 +14,8 @@ )) ?> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'comment', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'CommentController', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/comment/show.php b/app/Template/comment/show.php index 2aca26b3..8419a14e 100644 --- a/app/Template/comment/show.php +++ b/app/Template/comment/show.php @@ -26,11 +26,11 @@ <?php if ($editable && ($this->user->isAdmin() || $this->user->isCurrentUser($comment['user_id']))): ?> <li> <i class="fa fa-remove fa-fw"></i> - <?= $this->url->link(t('remove'), 'comment', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), false, 'popover') ?> + <?= $this->url->link(t('remove'), 'CommentController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), false, 'popover') ?> </li> <li> <i class="fa fa-edit fa-fw"></i> - <?= $this->url->link(t('edit'), 'comment', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), false, 'popover') ?> + <?= $this->url->link(t('edit'), 'CommentController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), false, 'popover') ?> </li> <?php endif ?> </ul> diff --git a/app/Template/comments/create.php b/app/Template/comments/create.php index 633f4392..3fa6ddc0 100644 --- a/app/Template/comments/create.php +++ b/app/Template/comments/create.php @@ -1,4 +1,4 @@ -<form method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('CommentController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('task_id', $values) ?> <?= $this->form->hidden('user_id', $values) ?> diff --git a/app/Template/comments/show.php b/app/Template/comments/show.php index 76af5593..43f6b2c2 100644 --- a/app/Template/comments/show.php +++ b/app/Template/comments/show.php @@ -6,7 +6,7 @@ <?php if (!isset($is_public) || !$is_public): ?> <div class="comment-sorting"> <i class="fa fa-sort"></i> - <?= $this->url->link(t('change sorting'), 'comment', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('change sorting'), 'CommentController', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> <?php endif ?> <?php foreach ($comments as $comment): ?> @@ -30,4 +30,4 @@ )) ?> <?php endif ?> </div> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/config/about.php b/app/Template/config/about.php index 7c599ef7..8e2d1325 100644 --- a/app/Template/config/about.php +++ b/app/Template/config/about.php @@ -65,11 +65,11 @@ <strong><?= $this->text->bytes($db_size) ?></strong> </li> <li> - <?= $this->url->link(t('Download the database'), 'config', 'downloadDb', array(), true) ?> + <?= $this->url->link(t('Download the database'), 'ConfigController', 'downloadDb', array(), true) ?> <?= t('(Gzip compressed Sqlite file)') ?> </li> <li> - <?= $this->url->link(t('Optimize the database'), 'config', 'optimizeDb', array(), true) ?> + <?= $this->url->link(t('Optimize the database'), 'ConfigController', 'optimizeDb', array(), true) ?> <?= t('(VACUUM command)') ?> </li> </ul> diff --git a/app/Template/config/api.php b/app/Template/config/api.php index 3ebbb956..95f77355 100644 --- a/app/Template/config/api.php +++ b/app/Template/config/api.php @@ -12,7 +12,7 @@ <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->base().'jsonrpc.php' ?>"> </li> <li> - <?= $this->url->link(t('Reset token'), 'config', 'token', array('type' => 'api'), true) ?> + <?= $this->url->link(t('Reset token'), 'ConfigController', 'token', array('type' => 'api'), true) ?> </li> </ul> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/config/application.php b/app/Template/config/application.php index ee0e147b..0f842f6e 100644 --- a/app/Template/config/application.php +++ b/app/Template/config/application.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Application settings') ?></h2> </div> -<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'application')) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('ConfigController', 'save', array('redirect' => 'application')) ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/config/board.php b/app/Template/config/board.php index 75cd40ef..62a736e7 100644 --- a/app/Template/config/board.php +++ b/app/Template/config/board.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Board settings') ?></h2> </div> -<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'board')) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('ConfigController', 'save', array('redirect' => 'board')) ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/config/calendar.php b/app/Template/config/calendar.php index 37084a8b..90e034e9 100644 --- a/app/Template/config/calendar.php +++ b/app/Template/config/calendar.php @@ -2,7 +2,7 @@ <h2><?= t('Calendar settings') ?></h2> </div> <section> -<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'calendar')) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('ConfigController', 'save', array('redirect' => 'calendar')) ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/config/integrations.php b/app/Template/config/integrations.php index 2a29b358..3ba4e865 100644 --- a/app/Template/config/integrations.php +++ b/app/Template/config/integrations.php @@ -2,7 +2,7 @@ <h2><?= t('Integration with third-party services') ?></h2> </div> -<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'integrations')) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('ConfigController', 'save', array('redirect' => 'integrations')) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->hook->render('template:config:integrations', array('values' => $values)) ?> diff --git a/app/Template/config/project.php b/app/Template/config/project.php index b0112773..6d8d131a 100644 --- a/app/Template/config/project.php +++ b/app/Template/config/project.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Project settings') ?></h2> </div> -<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'project')) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('ConfigController', 'save', array('redirect' => 'project')) ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/config/sidebar.php b/app/Template/config/sidebar.php index a2a5a6cb..187ecd93 100644 --- a/app/Template/config/sidebar.php +++ b/app/Template/config/sidebar.php @@ -1,35 +1,35 @@ <div class="sidebar"> <h2><?= t('Actions') ?></h2> <ul> - <li <?= $this->app->checkMenuSelection('config', 'index') ?>> - <?= $this->url->link(t('About'), 'config', 'index') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'index') ?>> + <?= $this->url->link(t('About'), 'ConfigController', 'index') ?> </li> - <li <?= $this->app->checkMenuSelection('config', 'application') ?>> - <?= $this->url->link(t('Application settings'), 'config', 'application') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'application') ?>> + <?= $this->url->link(t('Application settings'), 'ConfigController', 'application') ?> </li> - <li <?= $this->app->checkMenuSelection('config', 'project') ?>> - <?= $this->url->link(t('Project settings'), 'config', 'project') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'project') ?>> + <?= $this->url->link(t('Project settings'), 'ConfigController', 'project') ?> </li> - <li <?= $this->app->checkMenuSelection('config', 'board') ?>> - <?= $this->url->link(t('Board settings'), 'config', 'board') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'board') ?>> + <?= $this->url->link(t('Board settings'), 'ConfigController', 'board') ?> </li> - <li <?= $this->app->checkMenuSelection('config', 'calendar') ?>> - <?= $this->url->link(t('Calendar settings'), 'config', 'calendar') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'calendar') ?>> + <?= $this->url->link(t('Calendar settings'), 'ConfigController', 'calendar') ?> </li> - <li <?= $this->app->checkMenuSelection('link') ?>> - <?= $this->url->link(t('Link settings'), 'link', 'index') ?> + <li <?= $this->app->checkMenuSelection('LinkController') ?>> + <?= $this->url->link(t('Link settings'), 'LinkController', 'index') ?> </li> - <li <?= $this->app->checkMenuSelection('currency', 'index') ?>> - <?= $this->url->link(t('Currency rates'), 'currency', 'index') ?> + <li <?= $this->app->checkMenuSelection('CurrencyController', 'index') ?>> + <?= $this->url->link(t('Currency rates'), 'CurrencyController', 'index') ?> </li> - <li <?= $this->app->checkMenuSelection('config', 'integrations') ?>> - <?= $this->url->link(t('Integrations'), 'config', 'integrations') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'integrations') ?>> + <?= $this->url->link(t('Integrations'), 'ConfigController', 'integrations') ?> </li> - <li <?= $this->app->checkMenuSelection('config', 'webhook') ?>> - <?= $this->url->link(t('Webhooks'), 'config', 'webhook') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'webhook') ?>> + <?= $this->url->link(t('Webhooks'), 'ConfigController', 'webhook') ?> </li> - <li <?= $this->app->checkMenuSelection('config', 'api') ?>> - <?= $this->url->link(t('API'), 'config', 'api') ?> + <li <?= $this->app->checkMenuSelection('ConfigController', 'api') ?>> + <?= $this->url->link(t('API'), 'ConfigController', 'api') ?> </li> <?= $this->hook->render('template:config:sidebar') ?> </ul> diff --git a/app/Template/config/webhook.php b/app/Template/config/webhook.php index 3bba907c..e3245873 100644 --- a/app/Template/config/webhook.php +++ b/app/Template/config/webhook.php @@ -2,7 +2,7 @@ <h2><?= t('Webhook settings') ?></h2> </div> <section> -<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'webhook')) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('ConfigController', 'save', array('redirect' => 'webhook')) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -25,7 +25,7 @@ <strong><?= $this->text->e($values['webhook_token']) ?></strong> </li> <li> - <?= $this->url->link(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?> + <?= $this->url->link(t('Reset token'), 'ConfigController', 'token', array('type' => 'webhook'), true) ?> </li> </ul> </section> diff --git a/app/Template/currency/index.php b/app/Template/currency/index.php index d35ac459..9881cee5 100644 --- a/app/Template/currency/index.php +++ b/app/Template/currency/index.php @@ -24,7 +24,7 @@ <hr/> <h3><?= t('Change reference currency') ?></h3> <?php endif ?> -<form method="post" action="<?= $this->url->href('currency', 'reference') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('CurrencyController', 'reference') ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -38,7 +38,7 @@ <hr/> <h3><?= t('Add a new currency rate') ?></h3> -<form method="post" action="<?= $this->url->href('currency', 'create') ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('CurrencyController', 'create') ?>" autocomplete="off"> <?= $this->form->csrf() ?> diff --git a/app/Template/custom_filter/add.php b/app/Template/custom_filter/add.php index 56f7921c..3801cc30 100644 --- a/app/Template/custom_filter/add.php +++ b/app/Template/custom_filter/add.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Add a new filter') ?></h2> </div> -<form method="post" action="<?= $this->url->href('customfilter', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('CustomFilterController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('project_id', $values) ?> diff --git a/app/Template/custom_filter/edit.php b/app/Template/custom_filter/edit.php index 051a5062..26da8da2 100644 --- a/app/Template/custom_filter/edit.php +++ b/app/Template/custom_filter/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Edit custom filter') ?></h2> </div> -<form class="form-popover" method="post" action="<?= $this->url->href('customfilter', 'update', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id'])) ?>" autocomplete="off"> +<form class="form-popover" method="post" action="<?= $this->url->href('CustomFilterController', 'update', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -27,6 +27,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'customfilter', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'CustomFilterController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/custom_filter/index.php b/app/Template/custom_filter/index.php index 12a4eece..08c8040c 100644 --- a/app/Template/custom_filter/index.php +++ b/app/Template/custom_filter/index.php @@ -32,12 +32,12 @@ </td> <td><?= $this->text->e($filter['owner_name'] ?: $filter['owner_username']) ?></td> <td> - <?php if ($filter['user_id'] == $this->user->getId() || $this->user->hasProjectAccess('customfilter', 'edit', $project['id'])): ?> + <?php if ($filter['user_id'] == $this->user->getId() || $this->user->hasProjectAccess('CustomFilterController', 'edit', $project['id'])): ?> <div class="dropdown"> <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> - <li><?= $this->url->link(t('Remove'), 'customfilter', 'confirm', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id']), false, 'popover') ?></li> - <li><?= $this->url->link(t('Edit'), 'customfilter', 'edit', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id']), false, 'popover') ?></li> + <li><?= $this->url->link(t('Remove'), 'CustomFilterController', 'confirm', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id']), false, 'popover') ?></li> + <li><?= $this->url->link(t('Edit'), 'CustomFilterController', 'edit', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id']), false, 'popover') ?></li> </ul> </div> <?php endif ?> diff --git a/app/Template/custom_filter/remove.php b/app/Template/custom_filter/remove.php index d4c67a2b..609f19b2 100644 --- a/app/Template/custom_filter/remove.php +++ b/app/Template/custom_filter/remove.php @@ -9,9 +9,9 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'customfilter', 'remove', array('project_id' => $project['id'], 'filter_id' => $filter['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'CustomFilterController', 'remove', array('project_id' => $project['id'], 'filter_id' => $filter['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'customfilter', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'CustomFilterController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </div> </section> diff --git a/app/Template/dashboard/calendar.php b/app/Template/dashboard/calendar.php index a154203b..75c96d83 100644 --- a/app/Template/dashboard/calendar.php +++ b/app/Template/dashboard/calendar.php @@ -1,5 +1,5 @@ <div id="calendar" - data-check-url="<?= $this->url->href('calendar', 'user', array('user_id' => $user['id'])) ?>" - data-save-url="<?= $this->url->href('calendar', 'save') ?>" + data-check-url="<?= $this->url->href('CalendarController', 'user', array('user_id' => $user['id'])) ?>" + data-save-url="<?= $this->url->href('CalendarController', 'save') ?>" > </div> diff --git a/app/Template/dashboard/layout.php b/app/Template/dashboard/layout.php index 187f7f42..795537a6 100644 --- a/app/Template/dashboard/layout.php +++ b/app/Template/dashboard/layout.php @@ -1,21 +1,21 @@ <section id="main"> <div class="page-header"> <ul> - <?php if ($this->user->hasAccess('ProjectCreation', 'create')): ?> + <?php if ($this->user->hasAccess('ProjectCreationController', 'create')): ?> <li> <i class="fa fa-plus fa-fw"></i> - <?= $this->url->link(t('New project'), 'ProjectCreation', 'create', array(), false, 'popover') ?> + <?= $this->url->link(t('New project'), 'ProjectCreationController', 'create', array(), false, 'popover') ?> </li> <?php endif ?> <?php if ($this->app->config('disable_private_project', 0) == 0): ?> <li> <i class="fa fa-lock fa-fw"></i> - <?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?> + <?= $this->url->link(t('New private project'), 'ProjectCreationController', 'createPrivate', array(), false, 'popover') ?> </li> <?php endif ?> <li> <i class="fa fa-search fa-fw"></i> - <?= $this->url->link(t('Search'), 'search', 'index') ?> + <?= $this->url->link(t('Search'), 'SearchController', 'index') ?> </li> <li> <i class="fa fa-folder fa-fw"></i> diff --git a/app/Template/dashboard/notifications.php b/app/Template/dashboard/notifications.php index b64eb0b7..e0e9b878 100644 --- a/app/Template/dashboard/notifications.php +++ b/app/Template/dashboard/notifications.php @@ -8,7 +8,7 @@ <ul> <li> <i class="fa fa-check-square-o fa-fw"></i> - <?= $this->url->link(t('Mark all as read'), 'webNotification', 'flush', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Mark all as read'), 'WebNotificationController', 'flush', array('user_id' => $user['id'])) ?> </li> </ul> </div> @@ -36,16 +36,12 @@ <i class="fa fa-file-o fa-fw"></i> <?php endif ?> - <?php if ($this->text->contains($notification['event_name'], 'comment')): ?> - <?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id']), false, '', '', false, 'comment-'.$notification['event_data']['comment']['id']) ?> - <?php elseif ($this->text->contains($notification['event_name'], 'task.overdue')): ?> + <?php if ($this->text->contains($notification['event_name'], 'task.overdue')): ?> <?php if (count($notification['event_data']['tasks']) > 1): ?> <?= $notification['title'] ?> - <?php else: ?> - <?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['tasks'][0]['id'], 'project_id' => $notification['event_data']['tasks'][0]['project_id'])) ?> <?php endif ?> <?php else: ?> - <?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id'])) ?> + <?= $this->url->link($notification['title'], 'WebNotificationController', 'redirect', array('notification_id' => $notification['id'], 'user_id' => $user['id'])) ?> <?php endif ?> </td> <td> @@ -53,9 +49,9 @@ </td> <td> <i class="fa fa-check fa-fw"></i> - <?= $this->url->link(t('Mark as read'), 'webNotification', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?> + <?= $this->url->link(t('Mark as read'), 'WebNotificationController', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?> </td> </tr> <?php endforeach ?> </table> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/dashboard/projects.php b/app/Template/dashboard/projects.php index cdf19bdf..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): ?> @@ -22,14 +22,14 @@ <?php endif ?> </td> <td> - <?php if ($this->user->hasProjectAccess('gantt', 'project', $project['id'])): ?> - <?= $this->url->link('<i class="fa fa-sliders fa-fw"></i>', 'gantt', 'project', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?> + <?php if ($this->user->hasProjectAccess('TaskGanttController', 'show', $project['id'])): ?> + <?= $this->url->link('<i class="fa fa-sliders fa-fw"></i>', 'TaskGanttController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?> <?php endif ?> - <?= $this->url->link('<i class="fa fa-list"></i>', 'listing', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('List')) ?> - <?= $this->url->link('<i class="fa fa-calendar"></i>', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?> + <?= $this->url->link('<i class="fa fa-list"></i>', 'TaskListController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('List')) ?> + <?= $this->url->link('<i class="fa fa-calendar"></i>', 'CalendarController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?> - <?= $this->url->link($this->text->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link($this->text->e($project['name']), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?> <?php if (! empty($project['description'])): ?> <span class="tooltip" title="<?= $this->text->markdownAttribute($project['description']) ?>"> <i class="fa fa-info-circle"></i> diff --git a/app/Template/dashboard/show.php b/app/Template/dashboard/show.php index bc4e2952..917a6651 100644 --- a/app/Template/dashboard/show.php +++ b/app/Template/dashboard/show.php @@ -2,7 +2,7 @@ <form method="get" action="<?= $this->url->dir() ?>" class="search"> <?= $this->form->hidden('controller', array('controller' => 'search')) ?> <?= $this->form->hidden('action', array('action' => 'index')) ?> - <?= $this->form->text('search', array(), array(), array('placeholder="'.t('Search').'"'), 'form-input-large') ?> + <?= $this->form->text('SearchController', array(), array(), array('placeholder="'.t('Search').'"'), 'form-input-large') ?> <?= $this->render('app/filters_helper') ?> </form> </div> diff --git a/app/Template/dashboard/subtasks.php b/app/Template/dashboard/subtasks.php index ee6caf02..8e0aa3ce 100644 --- a/app/Template/dashboard/subtasks.php +++ b/app/Template/dashboard/subtasks.php @@ -18,10 +18,10 @@ <?= $this->render('task/dropdown', array('task' => array('id' => $subtask['task_id'], 'project_id' => $subtask['project_id']))) ?> </td> <td> - <?= $this->url->link($this->text->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> + <?= $this->url->link($this->text->e($subtask['project_name']), 'BoardViewController', 'show', array('project_id' => $subtask['project_id'])) ?> </td> <td> - <?= $this->url->link($this->text->e($subtask['task_name']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> + <?= $this->url->link($this->text->e($subtask['task_name']), 'TaskViewController', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> </td> <td> <?= $this->subtask->toggleStatus($subtask, $subtask['project_id']) ?> diff --git a/app/Template/dashboard/tasks.php b/app/Template/dashboard/tasks.php index 756bd9b4..4b83a96a 100644 --- a/app/Template/dashboard/tasks.php +++ b/app/Template/dashboard/tasks.php @@ -20,10 +20,10 @@ <?= $this->render('task/dropdown', array('task' => $task)) ?> </td> <td> - <?= $this->url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link($this->text->e($task['project_name']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?> </td> <td> - <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </td> <td> <?php if ($task['priority'] >= 0): ?> diff --git a/app/Template/doc/show.php b/app/Template/doc/show.php index 8fbadc93..a8dbd762 100644 --- a/app/Template/doc/show.php +++ b/app/Template/doc/show.php @@ -3,11 +3,11 @@ <ul> <li> <i class="fa fa-life-ring fa-fw"></i> - <?= $this->url->link(t('Table of contents'), 'doc', 'show', array('file' => 'index')) ?> + <?= $this->url->link(t('Table of contents'), 'DocumentationController', 'show', array('file' => 'index')) ?> </li> </ul> </div> <div class="markdown documentation"> <?= $content ?> </div> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/event/comment_create.php b/app/Template/event/comment_create.php index 9869c94b..45132e6d 100644 --- a/app/Template/event/comment_create.php +++ b/app/Template/event/comment_create.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s commented the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/event/comment_update.php b/app/Template/event/comment_update.php index 19420cf9..5a0821bd 100644 --- a/app/Template/event/comment_update.php +++ b/app/Template/event/comment_update.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s updated a comment on the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/event/subtask_create.php b/app/Template/event/subtask_create.php index 7e41d5c9..1bf36c05 100644 --- a/app/Template/event/subtask_create.php +++ b/app/Template/event/subtask_create.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s created a subtask for the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> @@ -20,4 +20,4 @@ <?php endif ?> </li> </ul> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/event/subtask_update.php b/app/Template/event/subtask_update.php index 9fea4fe8..201402f6 100644 --- a/app/Template/event/subtask_update.php +++ b/app/Template/event/subtask_update.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s updated a subtask for the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/event/task_assignee_change.php b/app/Template/event/task_assignee_change.php index db78e7df..7c962223 100644 --- a/app/Template/event/task_assignee_change.php +++ b/app/Template/event/task_assignee_change.php @@ -4,14 +4,14 @@ <?php if (! empty($assignee)): ?> <?= e('%s changed the assignee of the task %s to %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), $this->text->e($assignee) ) ?> <?php else: ?> - <?= e('%s remove the assignee of the task %s', $this->text->e($author), $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))) ?> + <?= e('%s remove the assignee of the task %s', $this->text->e($author), $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))) ?> <?php endif ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> <div class="activity-description"> <p class="activity-task-title"><?= $this->text->e($task['title']) ?></p> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/event/task_close.php b/app/Template/event/task_close.php index 04157b0d..90ff9207 100644 --- a/app/Template/event/task_close.php +++ b/app/Template/event/task_close.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s closed the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/event/task_create.php b/app/Template/event/task_create.php index 6e26cdb8..017a5ada 100644 --- a/app/Template/event/task_create.php +++ b/app/Template/event/task_create.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s created the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/event/task_file_create.php b/app/Template/event/task_file_create.php index 0d8e545d..d329529a 100644 --- a/app/Template/event/task_file_create.php +++ b/app/Template/event/task_file_create.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s attached a new file to the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/event/task_move_column.php b/app/Template/event/task_move_column.php index 0a78bca7..f3155e47 100644 --- a/app/Template/event/task_move_column.php +++ b/app/Template/event/task_move_column.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s moved the task %s to the column "%s"', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), $this->text->e($task['column_title']) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> diff --git a/app/Template/event/task_move_position.php b/app/Template/event/task_move_position.php index eeadfa02..ecdd02b6 100644 --- a/app/Template/event/task_move_position.php +++ b/app/Template/event/task_move_position.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s moved the task %s to the position #%d in the column "%s"', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), $task['position'], $this->text->e($task['column_title']) ) ?> diff --git a/app/Template/event/task_move_swimlane.php b/app/Template/event/task_move_swimlane.php index a190bc0a..fe9bfb55 100644 --- a/app/Template/event/task_move_swimlane.php +++ b/app/Template/event/task_move_swimlane.php @@ -2,12 +2,12 @@ <?php if ($task['swimlane_id'] == 0): ?> <?= e('%s moved the task %s to the first swimlane', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <?php else: ?> <?= e('%s moved the task %s to the swimlane "%s"', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), $this->text->e($task['swimlane_name']) ) ?> <?php endif ?> diff --git a/app/Template/event/task_open.php b/app/Template/event/task_open.php index d9cd90b3..548aa98f 100644 --- a/app/Template/event/task_open.php +++ b/app/Template/event/task_open.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s opened the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/event/task_update.php b/app/Template/event/task_update.php index 07b94ff8..7c7507c0 100644 --- a/app/Template/event/task_update.php +++ b/app/Template/event/task_update.php @@ -1,7 +1,7 @@ <p class="activity-title"> <?= e('%s updated the task %s', $this->text->e($author), - $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ) ?> <span class="activity-date"><?= $this->dt->datetime($date_creation) ?></span> </p> diff --git a/app/Template/export/sidebar.php b/app/Template/export/sidebar.php index 6a1de7e9..55fbaeef 100644 --- a/app/Template/export/sidebar.php +++ b/app/Template/export/sidebar.php @@ -1,18 +1,18 @@ <div class="sidebar"> <h2><?= t('Exports') ?></h2> <ul> - <li <?= $this->app->getRouterAction() === 'tasks' ? 'class="active"' : '' ?>> - <?= $this->url->link(t('Tasks'), 'export', 'tasks', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('ExportController', 'tasks') ?>> + <?= $this->url->link(t('Tasks'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->getRouterAction() === 'subtasks' ? 'class="active"' : '' ?>> - <?= $this->url->link(t('Subtasks'), 'export', 'subtasks', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('ExportController', 'subtasks') ?>> + <?= $this->url->link(t('Subtasks'), 'ExportController', 'subtasks', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->getRouterAction() === 'transitions' ? 'class="active"' : '' ?>> - <?= $this->url->link(t('Task transitions'), 'export', 'transitions', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('ExportController', 'transitions') ?>> + <?= $this->url->link(t('Task transitions'), 'ExportController', 'transitions', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->getRouterAction() === 'summary' ? 'class="active"' : '' ?>> - <?= $this->url->link(t('Daily project summary'), 'export', 'summary', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('ExportController', 'summary') ?>> + <?= $this->url->link(t('Daily project summary'), 'ExportController', 'summary', array('project_id' => $project['id'])) ?> </li> <?= $this->hook->render('template:export:sidebar') ?> </ul> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/feed/project.php b/app/Template/feed/project.php index 1c6d1166..213a04d4 100644 --- a/app/Template/feed/project.php +++ b/app/Template/feed/project.php @@ -2,15 +2,15 @@ <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"> <title><?= t('%s\'s activity', $project['name']) ?></title> <link rel="alternate" type="text/html" href="<?= $this->url->base() ?>"/> - <link rel="self" type="application/atom+xml" href="<?= $this->url->href('feed', 'project', array('token' => $project['token']), false, '', true) ?>"/> + <link rel="self" type="application/atom+xml" href="<?= $this->url->href('FeedController', 'project', array('token' => $project['token']), false, '', true) ?>"/> <updated><?= date(DATE_ATOM) ?></updated> - <id><?= $this->url->href('feed', 'project', array('token' => $project['token']), false, '', true) ?></id> + <id><?= $this->url->href('FeedController', 'project', array('token' => $project['token']), false, '', true) ?></id> <icon><?= $this->url->base() ?>assets/img/favicon.png</icon> <?php foreach ($events as $e): ?> <entry> <title type="text"><?= $e['event_title'] ?></title> - <link rel="alternate" href="<?= $this->url->href('task', 'show', array('task_id' => $e['task_id']), false, '', true) ?>"/> + <link rel="alternate" href="<?= $this->url->href('TaskViewController', 'show', array('task_id' => $e['task_id']), false, '', true) ?>"/> <id><?= $e['id'].'-'.$e['event_name'].'-'.$e['task_id'].'-'.$e['date_creation'] ?></id> <published><?= date(DATE_ATOM, $e['date_creation']) ?></published> <updated><?= date(DATE_ATOM, $e['date_creation']) ?></updated> @@ -24,4 +24,4 @@ </content> </entry> <?php endforeach ?> -</feed>
\ No newline at end of file +</feed> diff --git a/app/Template/feed/user.php b/app/Template/feed/user.php index 28847f1f..0c45f03c 100644 --- a/app/Template/feed/user.php +++ b/app/Template/feed/user.php @@ -2,15 +2,15 @@ <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"> <title><?= t('Project activities for %s', $user['name'] ?: $user['username']) ?></title> <link rel="alternate" type="text/html" href="<?= $this->url->base() ?>"/> - <link rel="self" type="application/atom+xml" href="<?= $this->url->href('feed', 'user', array('token' => $user['token']), false, '', true) ?>"/> + <link rel="self" type="application/atom+xml" href="<?= $this->url->href('FeedController', 'user', array('token' => $user['token']), false, '', true) ?>"/> <updated><?= date(DATE_ATOM) ?></updated> - <id><?= $this->url->href('feed', 'user', array('token' => $user['token']), false, '', true) ?></id> + <id><?= $this->url->href('FeedController', 'user', array('token' => $user['token']), false, '', true) ?></id> <icon><?= $this->url->base() ?>assets/img/favicon.png</icon> <?php foreach ($events as $e): ?> <entry> <title type="text"><?= $e['event_title'] ?></title> - <link rel="alternate" href="<?= $this->url->href('task', 'show', array('task_id' => $e['task_id']), false, '', true) ?>"/> + <link rel="alternate" href="<?= $this->url->href('TaskViewController', 'show', array('task_id' => $e['task_id']), false, '', true) ?>"/> <id><?= $e['id'].'-'.$e['event_name'].'-'.$e['task_id'].'-'.$e['date_creation'] ?></id> <published><?= date(DATE_ATOM, $e['date_creation']) ?></published> <updated><?= date(DATE_ATOM, $e['date_creation']) ?></updated> @@ -24,4 +24,4 @@ </content> </entry> <?php endforeach ?> -</feed>
\ No newline at end of file +</feed> diff --git a/app/Template/file_viewer/show.php b/app/Template/file_viewer/show.php index 191aaa6c..e829a178 100644 --- a/app/Template/file_viewer/show.php +++ b/app/Template/file_viewer/show.php @@ -3,7 +3,7 @@ </div> <div class="file-viewer"> <?php if ($file['is_image']): ?> - <img src="<?= $this->url->href('FileViewer', 'image', $params) ?>" alt="<?= $this->text->e($file['name']) ?>"> + <img src="<?= $this->url->href('FileViewerController', 'image', $params) ?>" alt="<?= $this->text->e($file['name']) ?>"> <?php elseif ($type === 'markdown'): ?> <article class="markdown"> <?= $this->text->markdown($content) ?> @@ -11,4 +11,4 @@ <?php elseif ($type === 'text'): ?> <pre><?= $content ?></pre> <?php endif ?> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/header.php b/app/Template/header.php index 1ff8bf33..15b70ead 100644 --- a/app/Template/header.php +++ b/app/Template/header.php @@ -23,7 +23,7 @@ data-notfound="<?= t('No results match:') ?>" data-placeholder="<?= t('Display another project') ?>" data-redirect-regex="PROJECT_ID" - data-redirect-url="<?= $this->url->href('board', 'show', array('project_id' => 'PROJECT_ID')) ?>"> + data-redirect-url="<?= $this->url->href('BoardViewController', 'show', array('project_id' => 'PROJECT_ID')) ?>"> <option value=""></option> <?php foreach ($board_selector as $board_id => $board_name): ?> <option value="<?= $board_id ?>"><?= $this->text->e($board_name) ?></option> @@ -38,7 +38,7 @@ </span> <?php endif ?> - <?php $has_project_creation_access = $this->user->hasAccess('ProjectCreation', 'create'); ?> + <?php $has_project_creation_access = $this->user->hasAccess('ProjectCreationController', 'create'); ?> <?php $is_private_project_enabled = $this->app->config('disable_private_project', 0) == 0; ?> <?php if ($has_project_creation_access || (!$has_project_creation_access && $is_private_project_enabled)): ?> @@ -46,11 +46,13 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-plus fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <?php if ($has_project_creation_access): ?> - <li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New project'), 'ProjectCreation', 'create', array(), false, 'popover') ?></li> + <li><i class="fa fa-plus fa-fw"></i> + <?= $this->url->link(t('New project'), 'ProjectCreationController', 'create', array(), false, 'popover') ?></li> <?php endif ?> <?php if ($is_private_project_enabled): ?> <li> - <i class="fa fa-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?> + <i class="fa fa-lock fa-fw"></i> + <?= $this->url->link(t('New private project'), 'ProjectCreationController', 'createPrivate', array(), false, 'popover') ?> </li> <?php endif ?> </ul> @@ -88,17 +90,17 @@ </li> <li> <i class="fa fa-cog fa-fw"></i> - <?= $this->url->link(t('Settings'), 'config', 'index') ?> + <?= $this->url->link(t('Settings'), 'ConfigController', 'index') ?> </li> <?php endif ?> <li> <i class="fa fa-life-ring fa-fw"></i> - <?= $this->url->link(t('Documentation'), 'doc', 'show') ?> + <?= $this->url->link(t('Documentation'), 'DocumentationController', 'show') ?> </li> <?php if (! DISABLE_LOGOUT): ?> <li> <i class="fa fa-sign-out fa-fw"></i> - <?= $this->url->link(t('Logout'), 'auth', 'logout') ?> + <?= $this->url->link(t('Logout'), 'AuthController', 'logout') ?> </li> <?php endif ?> </ul> diff --git a/app/Template/layout.php b/app/Template/layout.php index ff29e18f..9c4d69c5 100644 --- a/app/Template/layout.php +++ b/app/Template/layout.php @@ -45,8 +45,8 @@ <?= $this->hook->render('template:layout:head') ?> </head> <body data-status-url="<?= $this->url->href('UserAjaxController', 'status') ?>" - data-login-url="<?= $this->url->href('auth', 'login') ?>" - data-keyboard-shortcut-url="<?= $this->url->href('Doc', 'shortcuts') ?>" + data-login-url="<?= $this->url->href('AuthController', 'login') ?>" + data-keyboard-shortcut-url="<?= $this->url->href('DocumentationController', 'shortcuts') ?>" data-timezone="<?= $this->app->getTimezone() ?>" data-js-lang="<?= $this->app->jsLang() ?>"> diff --git a/app/Template/link/create.php b/app/Template/link/create.php index 3b36abee..23990604 100644 --- a/app/Template/link/create.php +++ b/app/Template/link/create.php @@ -2,7 +2,7 @@ <h2><?= t('Add a new link') ?></h2> </div> -<form action="<?= $this->url->href('link', 'save') ?>" method="post" autocomplete="off"> +<form action="<?= $this->url->href('LinkController', 'save') ?>" method="post" autocomplete="off"> <?= $this->form->csrf() ?> @@ -15,4 +15,4 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/link/edit.php b/app/Template/link/edit.php index e91422be..0ad73275 100644 --- a/app/Template/link/edit.php +++ b/app/Template/link/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Link modification') ?></h2> </div> -<form action="<?= $this->url->href('link', 'update', array('link_id' => $link['id'])) ?>" method="post" autocomplete="off"> +<form action="<?= $this->url->href('LinkController', 'update', array('link_id' => $link['id'])) ?>" method="post" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> @@ -18,4 +18,4 @@ <?= t('or') ?> <?= $this->url->link(t('cancel'), 'link', 'index') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/link/index.php b/app/Template/link/index.php index 1475bd50..7e32069a 100644 --- a/app/Template/link/index.php +++ b/app/Template/link/index.php @@ -18,9 +18,9 @@ </td> <td> <ul> - <?= $this->url->link(t('Edit'), 'link', 'edit', array('link_id' => $link['id'])) ?> + <?= $this->url->link(t('Edit'), 'LinkController', 'edit', array('link_id' => $link['id'])) ?> <?= t('or') ?> - <?= $this->url->link(t('Remove'), 'link', 'confirm', array('link_id' => $link['id'])) ?> + <?= $this->url->link(t('Remove'), 'LinkController', 'confirm', array('link_id' => $link['id'])) ?> </ul> </td> </tr> @@ -30,4 +30,4 @@ <?= t('There is no link.') ?> <?php endif ?> -<?= $this->render('link/create', array('values' => $values, 'errors' => $errors)) ?>
\ No newline at end of file +<?= $this->render('link/create', array('values' => $values, 'errors' => $errors)) ?> diff --git a/app/Template/link/remove.php b/app/Template/link/remove.php index 12ca14bb..b7fbef5e 100644 --- a/app/Template/link/remove.php +++ b/app/Template/link/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'link', 'remove', array('link_id' => $link['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'LinkController', 'remove', array('link_id' => $link['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'link', 'index') ?> + <?= $this->url->link(t('cancel'), 'LinkController', 'index') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/notification/footer.php b/app/Template/notification/footer.php index c3b37884..6ac260cb 100644 --- a/app/Template/notification/footer.php +++ b/app/Template/notification/footer.php @@ -2,6 +2,6 @@ Kanboard <?php if (isset($application_url) && ! empty($application_url)): ?> - - <a href="<?= $this->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', true) ?>"><?= t('view the task on Kanboard') ?></a> - - <a href="<?= $this->url->href('board', 'show', array('project_id' => $task['project_id']), false, '', true) ?>"><?= t('view the board on Kanboard') ?></a> + - <a href="<?= $this->url->href('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', true) ?>"><?= t('view the task on Kanboard') ?></a> + - <a href="<?= $this->url->href('BoardViewController', 'show', array('project_id' => $task['project_id']), false, '', true) ?>"><?= t('view the board on Kanboard') ?></a> <?php endif ?> diff --git a/app/Template/notification/task_overdue.php b/app/Template/notification/task_overdue.php index a9fad249..406e41f7 100644 --- a/app/Template/notification/task_overdue.php +++ b/app/Template/notification/task_overdue.php @@ -14,7 +14,7 @@ <td style="border: 1px solid #eee;">#<?= $task['id'] ?></td> <td style="border: 1px solid #eee;"> <?php if ($application_url): ?> - <a href="<?= $this->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', true) ?>"><?= $this->text->e($task['title']) ?></a> + <a href="<?= $this->url->href('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', true) ?>"><?= $this->text->e($task['title']) ?></a> <?php else: ?> <?= $this->text->e($task['title']) ?> <?php endif ?> diff --git a/app/Template/password_reset/change.php b/app/Template/password_reset/change.php index 0a1d8de4..80a035da 100644 --- a/app/Template/password_reset/change.php +++ b/app/Template/password_reset/change.php @@ -1,6 +1,6 @@ <div class="form-login"> <h2><?= t('Password Reset') ?></h2> - <form method="post" action="<?= $this->url->href('PasswordReset', 'update', array('token' => $token)) ?>"> + <form method="post" action="<?= $this->url->href('PasswordResetController', 'update', array('token' => $token)) ?>"> <?= $this->form->csrf() ?> <?= $this->form->label(t('New password'), 'password') ?> @@ -13,4 +13,4 @@ <button type="submit" class="btn btn-blue"><?= t('Change Password') ?></button> </div> </form> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/password_reset/create.php b/app/Template/password_reset/create.php index 918a0eb4..f43d95fc 100644 --- a/app/Template/password_reset/create.php +++ b/app/Template/password_reset/create.php @@ -1,17 +1,17 @@ <div class="form-login"> <h2><?= t('Password Reset') ?></h2> - <form method="post" action="<?= $this->url->href('PasswordReset', 'save') ?>"> + <form method="post" action="<?= $this->url->href('PasswordResetController', 'save') ?>"> <?= $this->form->csrf() ?> <?= $this->form->label(t('Username'), 'username') ?> <?= $this->form->text('username', $values, $errors, array('autofocus', 'required')) ?> <?= $this->form->label(t('Enter the text below'), 'captcha') ?> - <img src="<?= $this->url->href('Captcha', 'image') ?>"/> + <img src="<?= $this->url->href('CaptchaController', 'image') ?>" alt="Captcha"> <?= $this->form->text('captcha', array(), $errors, array('required')) ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Change Password') ?></button> </div> </form> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/password_reset/email.php b/app/Template/password_reset/email.php index 62788b49..63b08e49 100644 --- a/app/Template/password_reset/email.php +++ b/app/Template/password_reset/email.php @@ -1,6 +1,6 @@ <p><?= t('To reset your password click on this link:') ?></p> -<p><?= $this->url->to('PasswordReset', 'change', array('token' => $token), '', true) ?></p> +<p><?= $this->url->to('PasswordResetController', 'change', array('token' => $token), '', true) ?></p> <hr> -Kanboard
\ No newline at end of file +Kanboard diff --git a/app/Template/project/dropdown.php b/app/Template/project/dropdown.php index edebdd65..90dccf21 100644 --- a/app/Template/project/dropdown.php +++ b/app/Template/project/dropdown.php @@ -3,32 +3,32 @@ <ul> <li> <i class="fa fa-th fa-fw"></i> - <?= $this->url->link(t('Board'), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Board'), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-calendar fa-fw"></i> - <?= $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Calendar'), 'CalendarController', 'show', array('project_id' => $project['id'])) ?> </li> <li> <i class="fa fa-list fa-fw"></i> - <?= $this->url->link(t('Listing'), 'listing', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Listing'), 'TaskListController', 'show', array('project_id' => $project['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('Gantt', 'project', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskGanttController', 'show', $project['id'])): ?> <li> <i class="fa fa-sliders fa-fw"></i> - <?= $this->url->link(t('Gantt'), 'gantt', 'project', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Gantt'), 'TaskGanttController', 'show', array('project_id' => $project['id'])) ?> </li> <?php endif ?> <li> <i class="fa fa-dashboard fa-fw"></i> - <?= $this->url->link(t('Activity'), 'activity', 'project', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Activity'), 'ActivityController', 'project', array('project_id' => $project['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('analytic', 'tasks', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('AnalyticController', 'tasks', $project['id'])): ?> <li> <i class="fa fa-line-chart fa-fw"></i> - <?= $this->url->link(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Analytics'), 'AnalyticController', 'tasks', array('project_id' => $project['id'])) ?> </li> <?php endif ?> diff --git a/app/Template/project/layout.php b/app/Template/project/layout.php index fcb3e5f3..ec039202 100644 --- a/app/Template/project/layout.php +++ b/app/Template/project/layout.php @@ -1,5 +1,5 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Listing', 'show') ?> + <?= $this->projectHeader->render($project, 'TaskListController', 'show') ?> <section class="sidebar-container"> <?= $this->render($sidebar_template, array('project' => $project)) ?> @@ -8,4 +8,4 @@ <?= $content_for_sublayout ?> </div> </section> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php index 1071e78b..9bc0c9c4 100644 --- a/app/Template/project/sidebar.php +++ b/app/Template/project/sidebar.php @@ -4,9 +4,9 @@ <li <?= $this->app->checkMenuSelection('ProjectViewController', 'show') ?>> <?= $this->url->link(t('Summary'), 'ProjectViewController', 'show', array('project_id' => $project['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('customfilter', 'index', $project['id'])): ?> - <li <?= $this->app->checkMenuSelection('customfilter') ?>> - <?= $this->url->link(t('Custom filters'), 'customfilter', 'index', array('project_id' => $project['id'])) ?> + <?php if ($this->user->hasProjectAccess('CustomFilterController', 'index', $project['id'])): ?> + <li <?= $this->app->checkMenuSelection('CustomFilterController') ?>> + <?= $this->url->link(t('Custom filters'), 'CustomFilterController', 'index', array('project_id' => $project['id'])) ?> </li> <?php endif ?> @@ -23,22 +23,22 @@ <li <?= $this->app->checkMenuSelection('ProjectViewController', 'integrations') ?>> <?= $this->url->link(t('Integrations'), 'ProjectViewController', 'integrations', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('column') ?>> - <?= $this->url->link(t('Columns'), 'column', 'index', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('ColumnController') ?>> + <?= $this->url->link(t('Columns'), 'ColumnController', 'index', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('swimlane') ?>> - <?= $this->url->link(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('SwimlaneController') ?>> + <?= $this->url->link(t('Swimlanes'), 'SwimlaneController', 'index', array('project_id' => $project['id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('category') ?>> - <?= $this->url->link(t('Categories'), 'category', 'index', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('CategoryController') ?>> + <?= $this->url->link(t('Categories'), 'CategoryController', 'index', array('project_id' => $project['id'])) ?> </li> <?php if ($project['is_private'] == 0): ?> <li <?= $this->app->checkMenuSelection('ProjectPermissionController') ?>> <?= $this->url->link(t('Permissions'), 'ProjectPermissionController', 'index', array('project_id' => $project['id'])) ?> </li> <?php endif ?> - <li <?= $this->app->checkMenuSelection('action') ?>> - <?= $this->url->link(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?> + <li <?= $this->app->checkMenuSelection('ActionController') ?>> + <?= $this->url->link(t('Automatic actions'), 'ActionController', 'index', array('project_id' => $project['id'])) ?> </li> <li <?= $this->app->checkMenuSelection('ProjectViewController', 'duplicate') ?>> <?= $this->url->link(t('Duplicate'), 'ProjectViewController', 'duplicate', array('project_id' => $project['id'])) ?> @@ -51,9 +51,6 @@ <?= $this->url->link(t('Enable'), 'ProjectStatusController', 'confirmEnable', array('project_id' => $project['id']), false, 'popover') ?> <?php endif ?> </li> - <li <?= $this->app->checkMenuSelection('taskImport') ?>> - <?= $this->url->link(t('Import'), 'taskImport', 'step1', array('project_id' => $project['id'])) ?> - </li> <?php if ($this->user->hasProjectAccess('ProjectStatusController', 'remove', $project['id'])): ?> <li> <?= $this->url->link(t('Remove'), 'ProjectStatusController', 'confirmRemove', array('project_id' => $project['id']), false, 'popover') ?> diff --git a/app/Template/action_project/project.php b/app/Template/project_action_duplication/show.php index 226f3b19..2eebb262 100644 --- a/app/Template/action_project/project.php +++ b/app/Template/project_action_duplication/show.php @@ -4,8 +4,7 @@ <?php if (empty($projects_list)): ?> <p class="alert"><?= t('There is no available project.') ?></p> <?php else: ?> - <form class="popover-form" method="post" action="<?= $this->url->href('ActionProject', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> - + <form class="popover-form" method="post" action="<?= $this->url->href('ProjectActionDuplicationController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->label(t('Create from another project'), 'src_project_id') ?> @@ -17,4 +16,4 @@ <?= $this->url->link(t('cancel'), 'Action', 'index', array(), false, 'close-popover') ?> </div> </form> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/project_creation/create.php b/app/Template/project_creation/create.php index ea5783a6..01d06bab 100644 --- a/app/Template/project_creation/create.php +++ b/app/Template/project_creation/create.php @@ -2,7 +2,7 @@ <div class="page-header"> <h2><?= $title ?></h2> </div> - <form class="popover-form" id="project-creation-form" method="post" action="<?= $this->url->href('ProjectCreation', 'save') ?>" autocomplete="off"> + <form class="popover-form" id="project-creation-form" method="post" action="<?= $this->url->href('ProjectCreationController', 'save') ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('is_private', $values) ?> @@ -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_edit/general.php b/app/Template/project_edit/general.php index b817bcd4..c7421477 100644 --- a/app/Template/project_edit/general.php +++ b/app/Template/project_edit/general.php @@ -24,7 +24,7 @@ <?= $this->form->select('owner_id', $owners, $values, $errors) ?> </div> - <?php if ($this->user->hasProjectAccess('ProjectCreation', 'create', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('ProjectCreationController', 'create', $project['id'])): ?> <hr> <?= $this->form->checkbox('is_private', t('Private project'), 1, $project['is_private'] == 1) ?> <p class="form-help"><?= t('Private projects do not have users and groups management.') ?></p> diff --git a/app/Template/project_file/create.php b/app/Template/project_file/create.php index 9858b273..e262799b 100644 --- a/app/Template/project_file/create.php +++ b/app/Template/project_file/create.php @@ -4,7 +4,7 @@ <div id="file-done" style="display:none"> <p class="alert alert-success"> <?= t('All files have been uploaded successfully.') ?> - <?= $this->url->link(t('View uploaded files'), 'ProjectOverview', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('View uploaded files'), 'ProjectOverviewController', 'show', array('project_id' => $project['id'])) ?> </p> </div> @@ -18,7 +18,7 @@ <div id="file-dropzone" data-max-size="<?= $max_size ?>" - data-url="<?= $this->url->href('ProjectFile', 'save', array('project_id' => $project['id'])) ?>"> + data-url="<?= $this->url->href('ProjectFileController', 'save', array('project_id' => $project['id'])) ?>"> <div id="file-dropzone-inner"> <?= t('Drag and drop your files here') ?> <?= t('or') ?> <a href="#" id="file-browser"><?= t('choose files') ?></a> </div> @@ -29,5 +29,5 @@ <div class="form-actions"> <input type="submit" value="<?= t('Upload files') ?>" class="btn btn-blue" id="file-upload-button" disabled> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'ProjectOverview', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'ProjectOverviewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> diff --git a/app/Template/project_file/remove.php b/app/Template/project_file/remove.php index ba834288..0517a9e7 100644 --- a/app/Template/project_file/remove.php +++ b/app/Template/project_file/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'ProjectFile', 'remove', array('project_id' => $project['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'ProjectFileController', 'remove', array('project_id' => $project['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'ProjectOverview', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'ProjectOverviewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/gantt/projects.php b/app/Template/project_gantt/show.php index b8431d03..af22a6ed 100644 --- a/app/Template/gantt/projects.php +++ b/app/Template/project_gantt/show.php @@ -4,8 +4,8 @@ <li> <i class="fa fa-folder fa-fw"></i><?= $this->url->link(t('Projects list'), 'ProjectListController', 'show') ?> </li> - <?php if ($this->user->hasAccess('projectuser', 'managers')): ?> - <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('Users overview'), 'projectuser', 'managers') ?></li> + <?php if ($this->user->hasAccess('ProjectUserOverviewController', 'managers')): ?> + <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('Users overview'), 'ProjectUserOverviewController', 'managers') ?></li> <?php endif ?> </ul> </div> @@ -16,7 +16,7 @@ <div id="gantt-chart" data-records='<?= json_encode($projects, JSON_HEX_APOS) ?>' - data-save-url="<?= $this->url->href('gantt', 'saveProjectDate') ?>" + data-save-url="<?= $this->url->href('ProjectGanttController', 'save') ?>" data-label-project-manager="<?= t('Project managers') ?>" data-label-project-member="<?= t('Project members') ?>" data-label-gantt-link="<?= t('Gantt chart for this project') ?>" diff --git a/app/Template/project_header/dropdown.php b/app/Template/project_header/dropdown.php index 5a27e981..79a1b389 100644 --- a/app/Template/project_header/dropdown.php +++ b/app/Template/project_header/dropdown.php @@ -5,11 +5,11 @@ <li> <span class="filter-display-mode" <?= $this->board->isCollapsed($project['id']) ? '' : 'style="display: none;"' ?>> <i class="fa fa-expand fa-fw"></i> - <?= $this->url->link(t('Expand tasks'), 'board', 'expand', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?> + <?= $this->url->link(t('Expand tasks'), 'BoardAjaxController', 'expand', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?> </span> <span class="filter-display-mode" <?= $this->board->isCollapsed($project['id']) ? 'style="display: none;"' : '' ?>> <i class="fa fa-compress fa-fw"></i> - <?= $this->url->link(t('Collapse tasks'), 'board', 'collapse', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?> + <?= $this->url->link(t('Collapse tasks'), 'BoardAjaxController', 'collapse', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?> </span> </li> <li> @@ -39,36 +39,43 @@ <li> <i class="fa fa-dashboard fa-fw"></i> - <?= $this->url->link(t('Activity'), 'activity', 'project', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Activity'), 'ActivityController', 'project', array('project_id' => $project['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('customfilter', 'index', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('CustomFilterController', 'index', $project['id'])): ?> <li> <i class="fa fa-filter fa-fw"></i> - <?= $this->url->link(t('Custom filters'), 'customfilter', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Custom filters'), 'CustomFilterController', 'index', array('project_id' => $project['id'])) ?> </li> <?php endif ?> <?php if ($project['is_public']): ?> <li> <i class="fa fa-share-alt fa-fw"></i> - <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?> + <?= $this->url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?> </li> <?php endif ?> <?= $this->hook->render('template:project:dropdown', array('project' => $project)) ?> - <?php if ($this->user->hasProjectAccess('analytic', 'tasks', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('AnalyticController', 'tasks', $project['id'])): ?> <li> <i class="fa fa-line-chart fa-fw"></i> - <?= $this->url->link(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Analytics'), 'AnalyticController', 'tasks', array('project_id' => $project['id'])) ?> </li> <?php endif ?> - <?php if ($this->user->hasProjectAccess('export', 'tasks', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('ExportController', 'tasks', $project['id'])): ?> + <li> + <i class="fa fa-upload fa-fw"></i> + <?= $this->url->link(t('Exports'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?> + </li> + <?php endif ?> + + <?php if ($this->user->hasProjectAccess('TaskImportController', 'tasks', $project['id'])): ?> <li> <i class="fa fa-download fa-fw"></i> - <?= $this->url->link(t('Exports'), 'export', 'tasks', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Imports'), 'TaskImportController', 'show', array('project_id' => $project['id'])) ?> </li> <?php endif ?> diff --git a/app/Template/project_header/views.php b/app/Template/project_header/views.php index 353e4b62..3a41c91b 100644 --- a/app/Template/project_header/views.php +++ b/app/Template/project_header/views.php @@ -1,24 +1,24 @@ <ul class="views"> - <li <?= $this->app->getRouterController() === 'ProjectOverview' ? 'class="active"' : '' ?>> + <li <?= $this->app->checkMenuSelection('ProjectOverviewController') ?>> <i class="fa fa-eye fa-fw"></i> - <?= $this->url->link(t('Overview'), 'ProjectOverview', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-overview', t('Keyboard shortcut: "%s"', 'v o')) ?> + <?= $this->url->link(t('Overview'), 'ProjectOverviewController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-overview', t('Keyboard shortcut: "%s"', 'v o')) ?> </li> - <li <?= $this->app->getRouterController() === 'Board' ? 'class="active"' : '' ?>> + <li <?= $this->app->checkMenuSelection('BoardViewController') ?>> <i class="fa fa-th fa-fw"></i> - <?= $this->url->link(t('Board'), 'board', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-board', t('Keyboard shortcut: "%s"', 'v b')) ?> + <?= $this->url->link(t('Board'), 'BoardViewController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-board', t('Keyboard shortcut: "%s"', 'v b')) ?> </li> - <li <?= $this->app->getRouterController() === 'Calendar' ? 'class="active"' : '' ?>> + <li <?= $this->app->checkMenuSelection('Calendar') ?>> <i class="fa fa-calendar fa-fw"></i> - <?= $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-calendar', t('Keyboard shortcut: "%s"', 'v c')) ?> + <?= $this->url->link(t('Calendar'), 'CalendarController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-calendar', t('Keyboard shortcut: "%s"', 'v c')) ?> </li> - <li <?= $this->app->getRouterController() === 'Listing' ? 'class="active"' : '' ?>> + <li <?= $this->app->checkMenuSelection('TaskListController') ?>> <i class="fa fa-list fa-fw"></i> - <?= $this->url->link(t('List'), 'listing', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-listing', t('Keyboard shortcut: "%s"', 'v l')) ?> + <?= $this->url->link(t('List'), 'TaskListController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-listing', t('Keyboard shortcut: "%s"', 'v l')) ?> </li> - <?php if ($this->user->hasProjectAccess('gantt', 'project', $project['id'])): ?> - <li <?= $this->app->getRouterController() === 'Gantt' ? 'class="active"' : '' ?>> + <?php if ($this->user->hasProjectAccess('TaskGanttController', 'show', $project['id'])): ?> + <li <?= $this->app->checkMenuSelection('TaskGanttController') ?>> <i class="fa fa-sliders fa-fw"></i> - <?= $this->url->link(t('Gantt'), 'gantt', 'project', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-gantt', t('Keyboard shortcut: "%s"', 'v g')) ?> + <?= $this->url->link(t('Gantt'), 'TaskGanttController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-gantt', t('Keyboard shortcut: "%s"', 'v g')) ?> </li> <?php endif ?> -</ul>
\ No newline at end of file +</ul> diff --git a/app/Template/project_list/show.php b/app/Template/project_list/show.php index 06e4a626..8b9f1396 100644 --- a/app/Template/project_list/show.php +++ b/app/Template/project_list/show.php @@ -1,11 +1,11 @@ <section id="main"> <div class="page-header"> <ul> - <?php if ($this->user->hasAccess('projectuser', 'managers')): ?> - <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('Users overview'), 'projectuser', 'managers') ?></li> + <?php if ($this->user->hasAccess('ProjectUserOverviewController', 'managers')): ?> + <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('Users overview'), 'ProjectUserOverviewController', 'managers') ?></li> <?php endif ?> - <?php if ($this->user->hasAccess('gantt', 'projects')): ?> - <li><i class="fa fa-sliders fa-fw"></i><?= $this->url->link(t('Projects Gantt chart'), 'gantt', 'projects') ?></li> + <?php if ($this->user->hasAccess('ProjectGanttController', 'show')): ?> + <li><i class="fa fa-sliders fa-fw"></i><?= $this->url->link(t('Projects Gantt chart'), 'ProjectGanttController', 'show') ?></li> <?php endif ?> </ul> </div> @@ -20,7 +20,7 @@ <th class="column-8"><?= $paginator->order(t('Start date'), 'start_date') ?></th> <th class="column-8"><?= $paginator->order(t('End date'), 'end_date') ?></th> <th class="column-15"><?= $paginator->order(t('Owner'), 'owner_id') ?></th> - <?php if ($this->user->hasAccess('projectuser', 'managers')): ?> + <?php if ($this->user->hasAccess('ProjectUserOverviewController', 'managers')): ?> <th class="column-10"><?= t('Users') ?></th> <?php endif ?> <th><?= t('Columns') ?></th> @@ -38,7 +38,7 @@ <?php endif ?> </td> <td> - <?= $this->url->link($this->text->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link($this->text->e($project['name']), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?> <?php if ($project['is_public']): ?> <i class="fa fa-share-alt fa-fw" title="<?= t('Shared project') ?>"></i> @@ -64,10 +64,10 @@ <?= $this->text->e($project['owner_name'] ?: $project['owner_username']) ?> <?php endif ?> </td> - <?php if ($this->user->hasAccess('projectuser', 'managers')): ?> + <?php if ($this->user->hasAccess('ProjectUserOverviewController', 'managers')): ?> <td> <i class="fa fa-users fa-fw"></i> - <span class="tooltip" title="<?= t('Members') ?>" data-href="<?= $this->url->href('Projectuser', 'users', array('project_id' => $project['id'])) ?>"><?= t('Members') ?></span> + <span class="tooltip" title="<?= t('Members') ?>" data-href="<?= $this->url->href('ProjectUserOverviewController', 'users', array('project_id' => $project['id'])) ?>"><?= t('Members') ?></span> </td> <?php endif ?> <td class="dashboard-project-stats"> diff --git a/app/Template/project_overview/attachments.php b/app/Template/project_overview/attachments.php index eaabfd5f..ab8cf2ad 100644 --- a/app/Template/project_overview/attachments.php +++ b/app/Template/project_overview/attachments.php @@ -3,9 +3,9 @@ <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Attachments') ?></h3> </div> <div class="accordion-content"> - <?php if ($this->user->hasProjectAccess('ProjectFile', 'create', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('ProjectFileController', 'create', $project['id'])): ?> <div class="buttons-header"> - <?= $this->url->button('fa-plus', t('Upload a file'), 'ProjectFile', 'create', array('project_id' => $project['id']), 'popover') ?> + <?= $this->url->button('fa-plus', t('Upload a file'), 'ProjectFileController', 'create', array('project_id' => $project['id']), 'popover') ?> </div> <?php endif ?> diff --git a/app/Template/project_overview/files.php b/app/Template/project_overview/files.php index c570b771..fa870938 100644 --- a/app/Template/project_overview/files.php +++ b/app/Template/project_overview/files.php @@ -16,17 +16,17 @@ <?php if ($this->file->getPreviewType($file['name']) !== null): ?> <li> <i class="fa fa-eye fa-fw"></i> - <?= $this->url->link(t('View file'), 'FileViewer', 'show', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?> + <?= $this->url->link(t('View file'), 'FileViewerController', 'show', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?> </li> <?php endif ?> <li> <i class="fa fa-download fa-fw"></i> - <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?> + <?= $this->url->link(t('Download'), 'FileViewerController', 'download', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('ProjectFile', 'remove', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('ProjectFileController', 'remove', $project['id'])): ?> <li> <i class="fa fa-trash fa-fw"></i> - <?= $this->url->link(t('Remove'), 'ProjectFile', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'ProjectFileController', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?> </li> <?php endif ?> </ul> diff --git a/app/Template/project_overview/images.php b/app/Template/project_overview/images.php index f6937e12..7f38e2b1 100644 --- a/app/Template/project_overview/images.php +++ b/app/Template/project_overview/images.php @@ -2,7 +2,7 @@ <div class="file-thumbnails"> <?php foreach ($images as $file): ?> <div class="file-thumbnail"> - <a href="<?= $this->url->href('FileViewer', 'show', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $project['id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a> + <a href="<?= $this->url->href('FileViewerController', 'show', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewerController', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $project['id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a> <div class="file-thumbnail-content"> <div class="file-thumbnail-title"> <div class="dropdown"> @@ -10,12 +10,12 @@ <ul> <li> <i class="fa fa-download fa-fw"></i> - <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?> + <?= $this->url->link(t('Download'), 'FileViewerController', 'download', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('ProjectFile', 'remove', $project['id'])): ?> + <?php if ($this->user->hasProjectAccess('ProjectFileController', 'remove', $project['id'])): ?> <li> <i class="fa fa-trash fa-fw"></i> - <?= $this->url->link(t('Remove'), 'ProjectFile', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'ProjectFileController', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?> </li> <?php endif ?> </ul> diff --git a/app/Template/project_overview/information.php b/app/Template/project_overview/information.php index 2032ed28..fdf0f753 100644 --- a/app/Template/project_overview/information.php +++ b/app/Template/project_overview/information.php @@ -29,9 +29,9 @@ <?php endif ?> <?php if ($project['is_public']): ?> - <li><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li> - <li><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'feed', 'project', array('token' => $project['token']), false, '', '', true) ?></li> - <li><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'project', array('token' => $project['token'])) ?></li> + <li><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'FeedController', 'project', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ICalendarController', 'project', array('token' => $project['token'])) ?></li> <?php endif ?> </ul> </div> diff --git a/app/Template/project_overview/show.php b/app/Template/project_overview/show.php index 6fe815b3..6b2bc2cf 100644 --- a/app/Template/project_overview/show.php +++ b/app/Template/project_overview/show.php @@ -1,5 +1,5 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'ProjectOverview', 'show') ?> + <?= $this->projectHeader->render($project, 'ProjectOverviewController', 'show') ?> <?= $this->render('project_overview/columns', array('project' => $project)) ?> <?= $this->render('project_overview/description', array('project' => $project)) ?> <?= $this->render('project_overview/attachments', array('project' => $project, 'images' => $images, 'files' => $files)) ?> diff --git a/app/Template/project_user/sidebar.php b/app/Template/project_user/sidebar.php deleted file mode 100644 index f1cffcad..00000000 --- a/app/Template/project_user/sidebar.php +++ /dev/null @@ -1,30 +0,0 @@ -<div class="sidebar"> - <h2><?= t('Actions') ?></h2> - - <?= $this->form->select( - 'user_id', - $users, - $filter, - array(), - array('data-redirect-url="'.$this->url->href('projectuser', $this->app->getRouterAction(), array('user_id' => 'USER_ID')).'"', 'data-redirect-regex="USER_ID"'), - 'chosen-select select-auto-redirect' - ) ?> - - <br><br> - <ul> - <li <?= $this->app->checkMenuSelection('projectuser', 'managers') ?>> - <?= $this->url->link(t('Project managers'), 'projectuser', 'managers', $filter) ?> - </li> - <li <?= $this->app->checkMenuSelection('projectuser', 'members') ?>> - <?= $this->url->link(t('Project members'), 'projectuser', 'members', $filter) ?> - </li> - <li <?= $this->app->checkMenuSelection('projectuser', 'opens') ?>> - <?= $this->url->link(t('Open tasks'), 'projectuser', 'opens', $filter) ?> - </li> - <li <?= $this->app->checkMenuSelection('projectuser', 'closed') ?>> - <?= $this->url->link(t('Closed tasks'), 'projectuser', 'closed', $filter) ?> - </li> - - <?= $this->hook->render('template:project-user:sidebar') ?> - </ul> -</div> diff --git a/app/Template/project_user/layout.php b/app/Template/project_user_overview/layout.php index ab4326f6..19b83436 100644 --- a/app/Template/project_user/layout.php +++ b/app/Template/project_user_overview/layout.php @@ -5,10 +5,10 @@ <i class="fa fa-folder fa-fw"></i> <?= $this->url->link(t('Projects list'), 'ProjectListController', 'show') ?> </li> - <?php if ($this->user->hasAccess('gantt', 'projects')): ?> + <?php if ($this->user->hasAccess('ProjectGanttController', 'show')): ?> <li> <i class="fa fa-sliders fa-fw"></i> - <?= $this->url->link(t('Projects Gantt chart'), 'gantt', 'projects') ?> + <?= $this->url->link(t('Projects Gantt chart'), 'ProjectGanttController', 'show') ?> </li> <?php endif ?> </ul> diff --git a/app/Template/project_user/roles.php b/app/Template/project_user_overview/roles.php index 6be929d8..87c8df85 100644 --- a/app/Template/project_user/roles.php +++ b/app/Template/project_user_overview/roles.php @@ -13,8 +13,8 @@ <?= $this->text->e($this->user->getFullname($project)) ?> </td> <td> - <?= $this->url->link('<i class="fa fa-th"></i>', 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> - <?= $this->url->link('<i class="fa fa-sliders fa-fw"></i>', 'gantt', 'project', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?> + <?= $this->url->link('<i class="fa fa-th"></i>', 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> + <?= $this->url->link('<i class="fa fa-sliders fa-fw"></i>', 'TaskGanttController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?> <?= $this->url->link('<i class="fa fa-cog fa-fw"></i>', 'ProjectViewController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Project settings')) ?> <?= $this->text->e($project['project_name']) ?> diff --git a/app/Template/project_user_overview/sidebar.php b/app/Template/project_user_overview/sidebar.php new file mode 100644 index 00000000..9a87d4eb --- /dev/null +++ b/app/Template/project_user_overview/sidebar.php @@ -0,0 +1,30 @@ +<div class="sidebar"> + <h2><?= t('Actions') ?></h2> + + <?= $this->form->select( + 'user_id', + $users, + $filter, + array(), + array('data-redirect-url="'.$this->url->href('ProjectUserOverviewController', $this->app->getRouterAction(), array('user_id' => 'USER_ID')).'"', 'data-redirect-regex="USER_ID"'), + 'chosen-select select-auto-redirect' + ) ?> + + <br><br> + <ul> + <li <?= $this->app->checkMenuSelection('ProjectUserOverviewController', 'managers') ?>> + <?= $this->url->link(t('Project managers'), 'ProjectUserOverviewController', 'managers', $filter) ?> + </li> + <li <?= $this->app->checkMenuSelection('ProjectUserOverviewController', 'members') ?>> + <?= $this->url->link(t('Project members'), 'ProjectUserOverviewController', 'members', $filter) ?> + </li> + <li <?= $this->app->checkMenuSelection('ProjectUserOverviewController', 'opens') ?>> + <?= $this->url->link(t('Open tasks'), 'ProjectUserOverviewController', 'opens', $filter) ?> + </li> + <li <?= $this->app->checkMenuSelection('ProjectUserOverviewController', 'closed') ?>> + <?= $this->url->link(t('Closed tasks'), 'ProjectUserOverviewController', 'closed', $filter) ?> + </li> + + <?= $this->hook->render('template:project-user:sidebar') ?> + </ul> +</div> diff --git a/app/Template/project_user/tasks.php b/app/Template/project_user_overview/tasks.php index 108d3b33..af0a3d97 100644 --- a/app/Template/project_user/tasks.php +++ b/app/Template/project_user_overview/tasks.php @@ -14,16 +14,16 @@ <?php foreach ($paginator->getCollection() as $task): ?> <tr> <td class="task-table color-<?= $task['color_id'] ?>"> - <?= $this->url->link('#'.$this->text->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $this->url->link('#'.$this->text->e($task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </td> <td> - <?= $this->url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link($this->text->e($task['project_name']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?> </td> <td> <?= $this->text->e($task['column_name']) ?> </td> <td> - <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $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['assignee_username']): ?> diff --git a/app/Template/project_user/tooltip_users.php b/app/Template/project_user_overview/tooltip_users.php index 81300eaa..7117a87f 100644 --- a/app/Template/project_user/tooltip_users.php +++ b/app/Template/project_user_overview/tooltip_users.php @@ -7,7 +7,7 @@ <tr><th><?= $role_name ?></th></tr> <?php foreach ($users[$role] as $user_id => $user): ?> <tr><td> - <?= $this->url->link($this->text->e($user), 'Projectuser', 'opens', array('user_id' => $user_id)) ?> + <?= $this->url->link($this->text->e($user), 'ProjectUserOverviewController', 'opens', array('user_id' => $user_id)) ?> </td></tr> <?php endforeach ?> <?php endif ?> 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/project_view/share.php b/app/Template/project_view/share.php index 6161faa9..409f37e6 100644 --- a/app/Template/project_view/share.php +++ b/app/Template/project_view/share.php @@ -6,9 +6,9 @@ <div class="listing"> <ul class="no-bullet"> - <li><strong><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></strong></li> - <li><strong><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'feed', 'project', array('token' => $project['token']), false, '', '', true) ?></strong></li> - <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'project', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'FeedController', 'project', array('token' => $project['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ICalendarController', 'project', array('token' => $project['token']), false, '', '', true) ?></strong></li> </ul> </div> diff --git a/app/Template/project_view/show.php b/app/Template/project_view/show.php index 4aba4919..5efe8ce6 100644 --- a/app/Template/project_view/show.php +++ b/app/Template/project_view/show.php @@ -13,9 +13,9 @@ <?php endif ?> <?php if ($project['is_public']): ?> - <li><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li> - <li><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'feed', 'project', array('token' => $project['token']), false, '', '', true) ?></li> - <li><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'project', array('token' => $project['token'])) ?></li> + <li><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'FeedController', 'project', array('token' => $project['token']), false, '', '', true) ?></li> + <li><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ICalendarController', 'project', array('token' => $project['token'])) ?></li> <?php else: ?> <li><?= t('Public access disabled') ?></li> <?php endif ?> @@ -35,11 +35,11 @@ <?php if ($stats['nb_tasks'] > 0): ?> <?php if ($stats['nb_active_tasks'] > 0): ?> - <li><?= $this->url->link(t('%d tasks on the board', $stats['nb_active_tasks']), 'board', 'show', array('project_id' => $project['id'], 'search' => 'status:open')) ?></li> + <li><?= $this->url->link(t('%d tasks on the board', $stats['nb_active_tasks']), 'BoardViewController', 'show', array('project_id' => $project['id'], 'search' => 'status:open')) ?></li> <?php endif ?> <?php if ($stats['nb_inactive_tasks'] > 0): ?> - <li><?= $this->url->link(t('%d closed tasks', $stats['nb_inactive_tasks']), 'listing', 'show', array('project_id' => $project['id'], 'search' => 'status:closed')) ?></li> + <li><?= $this->url->link(t('%d closed tasks', $stats['nb_inactive_tasks']), 'TaskListController', 'show', array('project_id' => $project['id'], 'search' => 'status:closed')) ?></li> <?php endif ?> <li><?= t('%d tasks in total', $stats['nb_tasks']) ?></li> diff --git a/app/Template/search/activity.php b/app/Template/search/activity.php index 60362215..9abc7d7e 100644 --- a/app/Template/search/activity.php +++ b/app/Template/search/activity.php @@ -3,7 +3,7 @@ <ul> <li> <i class="fa fa-search fa-fw"></i> - <?= $this->url->link(t('Search tasks'), 'search', 'index') ?> + <?= $this->url->link(t('Search tasks'), 'SearchController', 'index') ?> </li> </ul> </div> @@ -36,4 +36,4 @@ <?= $this->render('event/events', array('events' => $events)) ?> <?php endif ?> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/search/index.php b/app/Template/search/index.php index d5d07ed6..bc528af7 100644 --- a/app/Template/search/index.php +++ b/app/Template/search/index.php @@ -3,7 +3,7 @@ <ul> <li> <i class="fa fa-search fa-fw"></i> - <?= $this->url->link(t('Activity stream search'), 'search', 'activity') ?> + <?= $this->url->link(t('Activity stream search'), 'SearchController', 'activity') ?> </li> </ul> </div> @@ -40,4 +40,4 @@ )) ?> <?php endif ?> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/search/results.php b/app/Template/search/results.php index 79df3544..8376b9e8 100644 --- a/app/Template/search/results.php +++ b/app/Template/search/results.php @@ -13,10 +13,10 @@ <?php foreach ($paginator->getCollection() as $task): ?> <tr> <td> - <?= $this->url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + <?= $this->url->link($this->text->e($task['project_name']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?> </td> <td class="task-table color-<?= $task['color_id'] ?>"> - <?= $this->url->link('#'.$this->text->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $this->url->link('#'.$this->text->e($task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> </td> <td> <?= $this->text->e($task['swimlane_name'] ?: $task['default_swimlane']) ?> @@ -28,7 +28,7 @@ <?= $this->text->e($task['category_name']) ?> </td> <td> - <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $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['assignee_username']): ?> @@ -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/subtask/create.php b/app/Template/subtask/create.php index 31b99f90..3c080f7c 100644 --- a/app/Template/subtask/create.php +++ b/app/Template/subtask/create.php @@ -15,6 +15,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php index 9e316ea5..8f256cea 100644 --- a/app/Template/subtask/edit.php +++ b/app/Template/subtask/edit.php @@ -15,6 +15,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/subtask/remove.php b/app/Template/subtask/remove.php index 33c10e88..426c1a93 100644 --- a/app/Template/subtask/remove.php +++ b/app/Template/subtask/remove.php @@ -15,6 +15,6 @@ <div class="form-actions"> <?= $this->url->link(t('Yes'), 'SubtaskController', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </div> diff --git a/app/Template/subtask_converter/show.php b/app/Template/subtask_converter/show.php index af8af49e..63f45482 100644 --- a/app/Template/subtask_converter/show.php +++ b/app/Template/subtask_converter/show.php @@ -15,6 +15,6 @@ <div class="form-actions"> <?= $this->url->link(t('Yes'), 'SubtaskConverterController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </div> diff --git a/app/Template/subtask_restriction/show.php b/app/Template/subtask_restriction/show.php index 1ff49915..ec8b8d5b 100644 --- a/app/Template/subtask_restriction/show.php +++ b/app/Template/subtask_restriction/show.php @@ -12,6 +12,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-red"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/swimlane/create.php b/app/Template/swimlane/create.php index a9b4374b..f5aa1591 100644 --- a/app/Template/swimlane/create.php +++ b/app/Template/swimlane/create.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Add a new swimlane') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('swimlane', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('SwimlaneController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('project_id', $values) ?> @@ -15,6 +15,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'Swimlane', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/swimlane/edit.php b/app/Template/swimlane/edit.php index b08099ae..b10cdd52 100644 --- a/app/Template/swimlane/edit.php +++ b/app/Template/swimlane/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Swimlane modification for the project "%s"', $project['name']) ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('swimlane', 'update', array('project_id' => $project['id'], 'swimlane_id' => $values['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('SwimlaneController', 'update', array('project_id' => $project['id'], 'swimlane_id' => $values['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -18,6 +18,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'swimlane', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/swimlane/edit_default.php b/app/Template/swimlane/edit_default.php index 3bf82568..f271c513 100644 --- a/app/Template/swimlane/edit_default.php +++ b/app/Template/swimlane/edit_default.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Change default swimlane') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('swimlane', 'updateDefault', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('SwimlaneController', 'updateDefault', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> @@ -13,6 +13,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'Swimlane', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/swimlane/index.php b/app/Template/swimlane/index.php index fad35306..4f78a405 100644 --- a/app/Template/swimlane/index.php +++ b/app/Template/swimlane/index.php @@ -3,7 +3,7 @@ <ul> <li> <i class="fa fa-plus fa-fw"></i> - <?= $this->url->link(t('Add a new swimlane'), 'Swimlane', 'create', array('project_id' => $project['id']), false, 'popover') ?> + <?= $this->url->link(t('Add a new swimlane'), 'SwimlaneController', 'create', array('project_id' => $project['id']), false, 'popover') ?> </li> </ul> </div> diff --git a/app/Template/swimlane/remove.php b/app/Template/swimlane/remove.php index 9be39ff8..f16b778c 100644 --- a/app/Template/swimlane/remove.php +++ b/app/Template/swimlane/remove.php @@ -9,9 +9,9 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'swimlane', 'remove', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'SwimlaneController', 'remove', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'swimlane', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </div> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/swimlane/table.php b/app/Template/swimlane/table.php index ec3cb621..be123b08 100644 --- a/app/Template/swimlane/table.php +++ b/app/Template/swimlane/table.php @@ -1,6 +1,6 @@ <table class="swimlanes-table table-stripped" - data-save-position-url="<?= $this->url->href('Swimlane', 'move', array('project_id' => $project['id'])) ?>"> + data-save-position-url="<?= $this->url->href('SwimlaneController', 'move', array('project_id' => $project['id'])) ?>"> <thead> <tr> <th><?= t('Name') ?></th> @@ -20,13 +20,13 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <li> - <?= $this->url->link(t('Edit'), 'Swimlane', 'editDefault', array('project_id' => $project['id']), false, 'popover') ?> + <?= $this->url->link(t('Edit'), 'SwimlaneController', 'editDefault', array('project_id' => $project['id']), false, 'popover') ?> </li> <li> <?php if ($default_swimlane['show_default_swimlane'] == 1): ?> - <?= $this->url->link(t('Disable'), 'Swimlane', 'disableDefault', array('project_id' => $project['id']), true) ?> + <?= $this->url->link(t('Disable'), 'SwimlaneController', 'disableDefault', array('project_id' => $project['id']), true) ?> <?php else: ?> - <?= $this->url->link(t('Enable'), 'Swimlane', 'enableDefault', array('project_id' => $project['id']), true) ?> + <?= $this->url->link(t('Enable'), 'SwimlaneController', 'enableDefault', array('project_id' => $project['id']), true) ?> <?php endif ?> </li> </ul> @@ -55,17 +55,17 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <li> - <?= $this->url->link(t('Edit'), 'swimlane', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> + <?= $this->url->link(t('Edit'), 'SwimlaneController', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> </li> <li> <?php if ($swimlane['is_active']): ?> - <?= $this->url->link(t('Disable'), 'swimlane', 'disable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->url->link(t('Disable'), 'SwimlaneController', 'disable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php else: ?> - <?= $this->url->link(t('Enable'), 'swimlane', 'enable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> + <?= $this->url->link(t('Enable'), 'SwimlaneController', 'enable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php endif ?> </li> <li> - <?= $this->url->link(t('Remove'), 'swimlane', 'confirm', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'SwimlaneController', 'confirm', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> </li> </ul> </div> diff --git a/app/Template/task/details.php b/app/Template/task/details.php index 5b8b7c6d..fe2bba67 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -32,13 +32,13 @@ <?php if ($project['is_public']): ?> <li class="smaller"> <i class="fa fa-external-link fa-fw"></i> - <?= $this->url->link(t('Public link'), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> + <?= $this->url->link(t('Public link'), 'TaskViewController', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> </li> <?php endif ?> <?php if ($project['is_public'] && !$editable): ?> <li class="smaller"> <i class="fa fa-th fa-fw"></i> - <?= $this->url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?> + <?= $this->url->link(t('Back to the board'), 'BoardViewController', 'readonly', array('token' => $project['token'])) ?> </li> <?php endif ?> <li class="smaller"> @@ -148,7 +148,7 @@ <?php if ($editable && empty($task['date_started'])): ?> <div class="task-summary-buttons"> - <?= $this->url->button('fa-play', t('Set start date'), 'taskmodification', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->button('fa-play', t('Set start date'), 'TaskModificationController', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </div> <?php endif ?> diff --git a/app/Template/task/dropdown.php b/app/Template/task/dropdown.php index 887e1828..b6b9c789 100644 --- a/app/Template/task/dropdown.php +++ b/app/Template/task/dropdown.php @@ -4,24 +4,24 @@ <?php if (array_key_exists('date_started', $task) && empty($task['date_started'])): ?> <li> <i class="fa fa-play fa-fw"></i> - <?= $this->url->link(t('Set automatically the start date'), 'taskmodification', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Set automatically the start date'), 'TaskModificationController', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> <li> <i class="fa fa-user fa-fw"></i> - <?= $this->url->link(t('Change assignee'), 'TaskPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Change assignee'), 'TaskPopoverController', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-tag fa-fw"></i> - <?= $this->url->link(t('Change category'), 'TaskPopover', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Change category'), 'TaskPopoverController', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-pencil-square-o fa-fw"></i> - <?= $this->url->link(t('Edit the task'), 'taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Edit the task'), 'TaskModificationController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-align-left fa-fw"></i> - <?= $this->url->link(t('Edit the description'), 'taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Edit the description'), 'TaskModificationController', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-plus fa-fw"></i> @@ -29,46 +29,46 @@ </li> <li> <i class="fa fa-code-fork fa-fw"></i> - <?= $this->url->link(t('Add internal link'), 'TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add internal link'), 'TaskInternalLinkController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-external-link fa-fw"></i> - <?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add external link'), 'TaskExternalLinkController', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-comment-o fa-fw"></i> - <?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add a comment'), 'CommentController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-camera fa-fw"></i> - <?= $this->url->link(t('Add a screenshot'), 'TaskPopover', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add a screenshot'), 'TaskPopoverController', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-files-o fa-fw"></i> - <?= $this->url->link(t('Duplicate'), 'taskduplication', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Duplicate'), 'TaskDuplicationController', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-clipboard fa-fw"></i> - <?= $this->url->link(t('Duplicate to another project'), 'taskduplication', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Duplicate to another project'), 'TaskDuplicationController', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-clone fa-fw"></i> - <?= $this->url->link(t('Move to another project'), 'taskduplication', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Move to another project'), 'TaskDuplicationController', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <?php if ($this->user->canRemoveTask($task)): ?> <li> <i class="fa fa-trash-o fa-fw"></i> - <?= $this->url->link(t('Remove'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'TaskSuppressionController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <?php endif ?> <?php if (isset($task['is_active'])): ?> <li> <?php if ($task['is_active'] == 1): ?> <i class="fa fa-times fa-fw"></i> - <?= $this->url->link(t('Close this task'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Close this task'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?php else: ?> <i class="fa fa-check-square-o fa-fw"></i> - <?= $this->url->link(t('Open this task'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Open this task'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?php endif ?> </li> <?php endif ?> diff --git a/app/Template/task/layout.php b/app/Template/task/layout.php index 4bc67406..00e0e9ae 100644 --- a/app/Template/task/layout.php +++ b/app/Template/task/layout.php @@ -1,13 +1,13 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Listing', 'show') ?> + <?= $this->projectHeader->render($project, 'TaskListController', 'show') ?> <?= $this->hook->render('template:task:layout:top', array('task' => $task)) ?> <section class="sidebar-container" id="task-view" - data-edit-url="<?= $this->url->href('taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" - data-description-url="<?= $this->url->href('taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" + data-edit-url="<?= $this->url->href('TaskModificationController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" + data-description-url="<?= $this->url->href('TaskModificationController', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" data-subtask-url="<?= $this->url->href('SubtaskController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" - data-internal-link-url="<?= $this->url->href('TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" - data-comment-url="<?= $this->url->href('comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + data-internal-link-url="<?= $this->url->href('TaskInternalLinkController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" + data-comment-url="<?= $this->url->href('CommentController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> <?= $this->render($sidebar_template, array('task' => $task)) ?> diff --git a/app/Template/task/remove.php b/app/Template/task/remove.php deleted file mode 100644 index b869b646..00000000 --- a/app/Template/task/remove.php +++ /dev/null @@ -1,15 +0,0 @@ -<div class="page-header"> - <h2><?= t('Remove a task') ?></h2> -</div> - -<div class="confirm"> - <p class="alert alert-info"> - <?= t('Do you really want to remove this task: "%s"?', $this->text->e($task['title'])) ?> - </p> - - <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> - <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> - </div> -</div> diff --git a/app/Template/task/show.php b/app/Template/task/show.php index 8f41d653..2b54eea8 100644 --- a/app/Template/task/show.php +++ b/app/Template/task/show.php @@ -3,7 +3,7 @@ <?= $this->render('task/details', array( 'task' => $task, 'project' => $project, - 'editable' => $this->user->hasProjectAccess('taskmodification', 'edit', $project['id']), + 'editable' => $this->user->hasProjectAccess('TaskModificationController', 'edit', $project['id']), )) ?> <?= $this->hook->render('template:task:show:before-description', array('task' => $task, 'project' => $project)) ?> @@ -46,7 +46,7 @@ 'task' => $task, 'comments' => $comments, 'project' => $project, - 'editable' => $this->user->hasProjectAccess('comment', 'edit', $project['id']), + 'editable' => $this->user->hasProjectAccess('CommentController', 'edit', $project['id']), )) ?> <?= $this->hook->render('template:task:show:bottom', array('task' => $task, 'project' => $project)) ?> diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index 3dc518b4..e77ec18a 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -1,46 +1,46 @@ <div class="sidebar sidebar-icons"> <h2><?= t('Task #%d', $task['id']) ?></h2> <ul> - <li <?= $this->app->checkMenuSelection('task', 'show') ?>> + <li <?= $this->app->checkMenuSelection('TaskViewController', 'show') ?>> <i class="fa fa-newspaper-o fa-fw"></i> - <?= $this->url->link(t('Summary'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Summary'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('activity', 'task') ?>> + <li <?= $this->app->checkMenuSelection('ActivityController', 'task') ?>> <i class="fa fa-dashboard fa-fw"></i> - <?= $this->url->link(t('Activity stream'), 'activity', 'task', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Activity stream'), 'ActivityController', 'task', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('task', 'transitions') ?>> + <li <?= $this->app->checkMenuSelection('TaskViewController', 'transitions') ?>> <i class="fa fa-arrows-h fa-fw"></i> - <?= $this->url->link(t('Transitions'), 'task', 'transitions', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Transitions'), 'TaskViewController', 'transitions', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> - <li <?= $this->app->checkMenuSelection('task', 'analytics') ?>> + <li <?= $this->app->checkMenuSelection('TaskViewController', 'analytics') ?>> <i class="fa fa-bar-chart fa-fw"></i> - <?= $this->url->link(t('Analytics'), 'task', 'analytics', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Analytics'), 'TaskViewController', 'analytics', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <?php if ($task['time_estimated'] > 0 || $task['time_spent'] > 0): ?> - <li <?= $this->app->checkMenuSelection('task', 'timetracking') ?>> + <li <?= $this->app->checkMenuSelection('TaskViewController', 'timetracking') ?>> <i class="fa fa-clock-o fa-fw"></i> - <?= $this->url->link(t('Time tracking'), 'task', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('Time tracking'), 'TaskViewController', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> <?= $this->hook->render('template:task:sidebar:information', array('task' => $task)) ?> </ul> - <?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> <h2><?= t('Actions') ?></h2> <ul> <li> <i class="fa fa-pencil-square-o fa-fw"></i> - <?= $this->url->link(t('Edit the task'), 'taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Edit the task'), 'TaskModificationController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-align-left fa-fw"></i> - <?= $this->url->link(t('Edit the description'), 'taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Edit the description'), 'TaskModificationController', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-refresh fa-rotate-90 fa-fw"></i> - <?= $this->url->link(t('Edit recurrence'), 'TaskRecurrence', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Edit recurrence'), 'TaskRecurrenceController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-plus fa-fw"></i> @@ -48,49 +48,49 @@ </li> <li> <i class="fa fa-code-fork fa-fw"></i> - <?= $this->url->link(t('Add internal link'), 'TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add internal link'), 'TaskInternalLinkController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-external-link fa-fw"></i> - <?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add external link'), 'TaskExternalLinkController', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-comment-o fa-fw"></i> - <?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add a comment'), 'CommentController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-file fa-fw"></i> - <?= $this->url->link(t('Attach a document'), 'TaskFile', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Attach a document'), 'TaskFileController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-camera fa-fw"></i> - <?= $this->url->link(t('Add a screenshot'), 'TaskFile', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Add a screenshot'), 'TaskFileController', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-files-o fa-fw"></i> - <?= $this->url->link(t('Duplicate'), 'taskduplication', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Duplicate'), 'TaskDuplicationController', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-clipboard fa-fw"></i> - <?= $this->url->link(t('Duplicate to another project'), 'taskduplication', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Duplicate to another project'), 'TaskDuplicationController', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <i class="fa fa-clone fa-fw"></i> - <?= $this->url->link(t('Move to another project'), 'taskduplication', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Move to another project'), 'TaskDuplicationController', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> <?php if ($task['is_active'] == 1): ?> <i class="fa fa-times fa-fw"></i> - <?= $this->url->link(t('Close this task'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Close this task'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?php else: ?> <i class="fa fa-check-square-o fa-fw"></i> - <?= $this->url->link(t('Open this task'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Open this task'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?php endif ?> </li> <?php if ($this->user->canRemoveTask($task)): ?> <li> <i class="fa fa-trash-o fa-fw"></i> - <?= $this->url->link(t('Remove'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'TaskSuppressionController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'popover') ?> </li> <?php endif ?> 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_bulk/show.php b/app/Template/task_bulk/show.php index 5f76f808..1391c2c1 100644 --- a/app/Template/task_bulk/show.php +++ b/app/Template/task_bulk/show.php @@ -19,7 +19,7 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> - <?= t('or') ?> <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/task_creation/show.php b/app/Template/task_creation/show.php index cecf459d..7bebbfe9 100644 --- a/app/Template/task_creation/show.php +++ b/app/Template/task_creation/show.php @@ -48,6 +48,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue" tabindex="15"><?= t('Save') ?></button> - <?= t('or') ?> <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> + <?= t('or') ?> <?= $this->url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/task_duplication/copy.php b/app/Template/task_duplication/copy.php index b7337a1e..58b4d837 100644 --- a/app/Template/task_duplication/copy.php +++ b/app/Template/task_duplication/copy.php @@ -6,7 +6,7 @@ <p class="alert"><?= t('There is no destination project available.') ?></p> <?php else: ?> - <form class="popover-form" method="post" action="<?= $this->url->href('taskduplication', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <form class="popover-form" method="post" action="<?= $this->url->href('TaskDuplicationController', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> @@ -17,7 +17,7 @@ $projects_list, $values, array(), - array('data-redirect="'.$this->url->href('taskduplication', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'dst_project_id' => 'PROJECT_ID')).'"'), + array('data-redirect="'.$this->url->href('TaskDuplicationController', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'dst_project_id' => 'PROJECT_ID')).'"'), 'task-reload-project-destination' ) ?> <span class="loading-icon" style="display: none"> <i class="fa fa-spinner fa-spin"></i></span> @@ -41,8 +41,8 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/task_duplication/duplicate.php b/app/Template/task_duplication/duplicate.php index 376f6b3b..c0baf94e 100644 --- a/app/Template/task_duplication/duplicate.php +++ b/app/Template/task_duplication/duplicate.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'taskduplication', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'TaskDuplicationController', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/task_duplication/move.php b/app/Template/task_duplication/move.php index beebf9eb..8f01c4b9 100644 --- a/app/Template/task_duplication/move.php +++ b/app/Template/task_duplication/move.php @@ -6,7 +6,7 @@ <p class="alert"><?= t('There is no destination project available.') ?></p> <?php else: ?> - <form class="popover-form" method="post" action="<?= $this->url->href('taskduplication', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <form class="popover-form" method="post" action="<?= $this->url->href('TaskDuplicationController', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> @@ -17,7 +17,7 @@ $projects_list, $values, array(), - array('data-redirect="'.$this->url->href('taskduplication', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'dst_project_id' => 'PROJECT_ID')).'"'), + array('data-redirect="'.$this->url->href('TaskDuplicationController', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'dst_project_id' => 'PROJECT_ID')).'"'), 'task-reload-project-destination' ) ?> <span class="loading-icon" style="display: none"> <i class="fa fa-spinner fa-spin"></i></span> @@ -41,8 +41,8 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/task_external_link/create.php b/app/Template/task_external_link/create.php index 5d49eef0..beddfc90 100644 --- a/app/Template/task_external_link/create.php +++ b/app/Template/task_external_link/create.php @@ -2,12 +2,12 @@ <h2><?= t('Add a new external link') ?></h2> </div> -<form class="popover-form" action="<?= $this->url->href('TaskExternalLink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> +<form class="popover-form" action="<?= $this->url->href('TaskExternalLinkController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> <?= $this->render('task_external_link/form', array('task' => $task, 'dependencies' => $dependencies, 'values' => $values, 'errors' => $errors)) ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskExternalLinkController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/task_external_link/edit.php b/app/Template/task_external_link/edit.php index dcbc2633..917a28b9 100644 --- a/app/Template/task_external_link/edit.php +++ b/app/Template/task_external_link/edit.php @@ -2,12 +2,12 @@ <h2><?= t('Edit external link') ?></h2> </div> -<form class="popover-form" action="<?= $this->url->href('TaskExternalLink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> +<form class="popover-form" action="<?= $this->url->href('TaskExternalLinkController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> <?= $this->render('task_external_link/form', array('task' => $task, 'dependencies' => $dependencies, 'values' => $values, 'errors' => $errors)) ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskExternalLinkController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/task_external_link/find.php b/app/Template/task_external_link/find.php index 3977a66c..a88b29ce 100644 --- a/app/Template/task_external_link/find.php +++ b/app/Template/task_external_link/find.php @@ -2,7 +2,7 @@ <h2><?= t('Add a new external link') ?></h2> </div> -<form class="popover-form" action="<?= $this->url->href('TaskExternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> +<form class="popover-form" action="<?= $this->url->href('TaskExternalLinkController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?> @@ -23,6 +23,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Next') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/task_external_link/remove.php b/app/Template/task_external_link/remove.php index 01535255..2a888a60 100644 --- a/app/Template/task_external_link/remove.php +++ b/app/Template/task_external_link/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'TaskExternalLink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'TaskExternalLinkController', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskExternalLinkController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/task_external_link/table.php b/app/Template/task_external_link/table.php index 1f32f4dd..56ef0363 100644 --- a/app/Template/task_external_link/table.php +++ b/app/Template/task_external_link/table.php @@ -6,7 +6,7 @@ <th class="column-10"><?= t('Dependency') ?></th> <th class="column-15"><?= t('Creator') ?></th> <th class="column-15"><?= t('Date') ?></th> - <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskExternalLinkController', 'edit', $task['project_id'])): ?> <th class="column-5"><?= t('Action') ?></th> <?php endif ?> </tr> @@ -27,13 +27,13 @@ <td> <?= $this->dt->date($link['date_creation']) ?> </td> - <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskExternalLinkController', 'edit', $task['project_id'])): ?> <td> <div class="dropdown"> <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> - <li><?= $this->url->link(t('Edit'), 'TaskExternalLink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> - <li><?= $this->url->link(t('Remove'), 'TaskExternalLink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> + <li><?= $this->url->link(t('Edit'), 'TaskExternalLinkController', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> + <li><?= $this->url->link(t('Remove'), 'TaskExternalLinkController', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> </ul> </div> </td> diff --git a/app/Template/task_file/create.php b/app/Template/task_file/create.php index 4abe6634..e05cf829 100644 --- a/app/Template/task_file/create.php +++ b/app/Template/task_file/create.php @@ -4,7 +4,7 @@ <div id="file-done" style="display:none"> <p class="alert alert-success"> <?= t('All files have been uploaded successfully.') ?> - <?= $this->url->link(t('View uploaded files'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link(t('View uploaded files'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </p> </div> @@ -18,7 +18,7 @@ <div id="file-dropzone" data-max-size="<?= $max_size ?>" - data-url="<?= $this->url->href('TaskFile', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + data-url="<?= $this->url->href('TaskFileController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> <div id="file-dropzone-inner"> <?= t('Drag and drop your files here') ?> <?= t('or') ?> <a href="#" id="file-browser"><?= t('choose files') ?></a> </div> @@ -29,5 +29,5 @@ <div class="form-actions"> <input type="submit" value="<?= t('Upload files') ?>" class="btn btn-blue" id="file-upload-button" disabled> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> diff --git a/app/Template/task_file/files.php b/app/Template/task_file/files.php index 5603014e..7ca59b1c 100644 --- a/app/Template/task_file/files.php +++ b/app/Template/task_file/files.php @@ -16,17 +16,17 @@ <?php if ($this->file->getPreviewType($file['name']) !== null): ?> <li> <i class="fa fa-eye fa-fw"></i> - <?= $this->url->link(t('View file'), 'FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + <?= $this->url->link(t('View file'), 'FileViewerController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> </li> <?php endif ?> <li> <i class="fa fa-download fa-fw"></i> - <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <?= $this->url->link(t('Download'), 'FileViewerController', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskFileController', 'remove', $task['project_id'])): ?> <li> <i class="fa fa-trash fa-fw"></i> - <?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'TaskFileController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> </li> <?php endif ?> </ul> @@ -44,4 +44,4 @@ </tr> <?php endforeach ?> </table> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/task_file/images.php b/app/Template/task_file/images.php index 55c098cb..81c33151 100644 --- a/app/Template/task_file/images.php +++ b/app/Template/task_file/images.php @@ -2,7 +2,7 @@ <div class="file-thumbnails"> <?php foreach ($images as $file): ?> <div class="file-thumbnail"> - <a href="<?= $this->url->href('FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a> + <a href="<?= $this->url->href('FileViewerController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewerController', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a> <div class="file-thumbnail-content"> <div class="file-thumbnail-title"> <div class="dropdown"> @@ -10,12 +10,12 @@ <ul> <li> <i class="fa fa-download fa-fw"></i> - <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + <?= $this->url->link(t('Download'), 'FileViewerController', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> </li> - <?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskFileController', 'remove', $task['project_id'])): ?> <li> <i class="fa fa-trash fa-fw"></i> - <?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + <?= $this->url->link(t('Remove'), 'TaskFileController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> </li> <?php endif ?> </ul> @@ -31,4 +31,4 @@ </div> <?php endforeach ?> </div> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/task_file/remove.php b/app/Template/task_file/remove.php index fe601f6f..42894f05 100644 --- a/app/Template/task_file/remove.php +++ b/app/Template/task_file/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'TaskFile', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'TaskFileController', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/task_file/screenshot.php b/app/Template/task_file/screenshot.php index 2880478d..6300159f 100644 --- a/app/Template/task_file/screenshot.php +++ b/app/Template/task_file/screenshot.php @@ -6,14 +6,14 @@ <p id="screenshot-inner"><?= t('Take a screenshot and press CTRL+V or ⌘+V to paste here.') ?></p> </div> -<form class="popover-form" action="<?= $this->url->href('TaskFile', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post"> +<form class="popover-form" action="<?= $this->url->href('TaskFileController', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post"> <input type="hidden" name="screenshot"/> <?= $this->form->csrf() ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> -<p class="alert alert-info"><?= t('This feature does not work with all browsers.') ?></p>
\ No newline at end of file +<p class="alert alert-info"><?= t('This feature does not work with all browsers.') ?></p> diff --git a/app/Template/gantt/project.php b/app/Template/task_gantt/show.php index e6c8592f..c5d338fb 100644 --- a/app/Template/gantt/project.php +++ b/app/Template/task_gantt/show.php @@ -1,18 +1,18 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Gantt', 'project') ?> + <?= $this->projectHeader->render($project, 'TaskGanttController', 'show') ?> <div class="menu-inline"> <ul> <li <?= $sorting === 'board' ? 'class="active"' : '' ?>> <i class="fa fa-sort-numeric-asc fa-fw"></i> - <?= $this->url->link(t('Sort by position'), 'gantt', 'project', array('project_id' => $project['id'], 'sorting' => 'board')) ?> + <?= $this->url->link(t('Sort by position'), 'TaskGanttController', 'show', array('project_id' => $project['id'], 'sorting' => 'board')) ?> </li> <li <?= $sorting === 'date' ? 'class="active"' : '' ?>> <i class="fa fa-sort-amount-asc fa-fw"></i> - <?= $this->url->link(t('Sort by date'), 'gantt', 'project', array('project_id' => $project['id'], 'sorting' => 'date')) ?> + <?= $this->url->link(t('Sort by date'), 'TaskGanttController', 'show', array('project_id' => $project['id'], 'sorting' => 'date')) ?> </li> <li> <i class="fa fa-plus fa-fw"></i> - <?= $this->url->link(t('Add task'), 'gantt', 'task', array('project_id' => $project['id']), false, 'popover') ?> + <?= $this->url->link(t('Add task'), 'TaskGanttCreationController', 'show', array('project_id' => $project['id']), false, 'popover') ?> </li> </ul> </div> @@ -21,7 +21,7 @@ <div id="gantt-chart" data-records='<?= json_encode($tasks, JSON_HEX_APOS) ?>' - data-save-url="<?= $this->url->href('gantt', 'saveTaskDate', array('project_id' => $project['id'])) ?>" + data-save-url="<?= $this->url->href('TaskGanttController', 'save', array('project_id' => $project['id'])) ?>" data-label-start-date="<?= t('Start date:') ?>" data-label-end-date="<?= t('Due date:') ?>" data-label-assignee="<?= t('Assignee:') ?>" @@ -31,4 +31,4 @@ <?php else: ?> <p class="alert"><?= t('There is no task in your project.') ?></p> <?php endif ?> -</section>
\ No newline at end of file +</section> diff --git a/app/Template/gantt/task_creation.php b/app/Template/task_gantt_creation/show.php index 448a808d..683bc8c8 100644 --- a/app/Template/gantt/task_creation.php +++ b/app/Template/task_gantt_creation/show.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('New task') ?></h2> </div> -<form method="post" action="<?= $this->url->href('gantt', 'saveTask', array('project_id' => $values['project_id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('TaskGanttCreationController', 'save', array('project_id' => $values['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('project_id', $values) ?> <?= $this->form->hidden('column_id', $values) ?> @@ -30,6 +30,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue" tabindex="15"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskGanttController', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/task_import/step1.php b/app/Template/task_import/show.php index abb43505..cc6a7b3a 100644 --- a/app/Template/task_import/step1.php +++ b/app/Template/task_import/show.php @@ -1,7 +1,7 @@ <div class="page-header"> <h2><?= t('Tasks Importation') ?></h2> </div> -<form action="<?= $this->url->href('taskImport', 'step2', array('project_id' => $project['id'])) ?>" method="post" enctype="multipart/form-data"> +<form action="<?= $this->url->href('TaskImportController', 'save', array('project_id' => $project['id'])) ?>" method="post" enctype="multipart/form-data"> <?= $this->form->csrf() ?> <?= $this->form->label(t('Delimiter'), 'delimiter') ?> @@ -31,4 +31,4 @@ <li><?= t('The due date must use the ISO format: YYYY-MM-DD') ?></li> </ul> </div> -<p><i class="fa fa-download fa-fw"></i><?= $this->url->link(t('Download CSV template'), 'taskImport', 'template', array('project_id' => $project['id'])) ?></p>
\ No newline at end of file +<p><i class="fa fa-download fa-fw"></i><?= $this->url->link(t('Download CSV template'), 'TaskImportController', 'template', array('project_id' => $project['id'])) ?></p> diff --git a/app/Template/task_import/sidebar.php b/app/Template/task_import/sidebar.php new file mode 100644 index 00000000..4cd92af8 --- /dev/null +++ b/app/Template/task_import/sidebar.php @@ -0,0 +1,9 @@ +<div class="sidebar"> + <h2><?= t('Imports') ?></h2> + <ul> + <li <?= $this->app->checkMenuSelection('TaskImportController', 'show') ?>> + <?= $this->url->link(t('Tasks').' (CSV)', 'TaskImportController', 'show', array('project_id' => $project['id'])) ?> + </li> + <?= $this->hook->render('template:task-import:sidebar') ?> + </ul> +</div> diff --git a/app/Template/task_internal_link/create.php b/app/Template/task_internal_link/create.php index 94dcdd66..fed29605 100644 --- a/app/Template/task_internal_link/create.php +++ b/app/Template/task_internal_link/create.php @@ -2,7 +2,7 @@ <h2><?= t('Add a new link') ?></h2> </div> -<form class="popover-form" action="<?= $this->url->href('TaskInternalLink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> +<form class="popover-form" action="<?= $this->url->href('TaskInternalLinkController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?> @@ -21,13 +21,13 @@ 'placeholder="'.t('Start to type task title...').'"', 'title="'.t('Start to type task title...').'"', 'data-dst-field="opposite_task_id"', - 'data-search-url="'.$this->url->href('TaskHelper', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', + 'data-search-url="'.$this->url->href('TaskAjaxController', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', ), 'autocomplete') ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/task_internal_link/edit.php b/app/Template/task_internal_link/edit.php index 03622df7..f4df57bd 100644 --- a/app/Template/task_internal_link/edit.php +++ b/app/Template/task_internal_link/edit.php @@ -2,7 +2,7 @@ <h2><?= t('Edit link') ?></h2> </div> -<form action="<?= $this->url->href('TaskInternalLink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'link_id' => $task_link['id'])) ?>" method="post" autocomplete="off"> +<form action="<?= $this->url->href('TaskInternalLinkController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'link_id' => $task_link['id'])) ?>" method="post" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> @@ -22,13 +22,13 @@ 'placeholder="'.t('Start to type task title...').'"', 'title="'.t('Start to type task title...').'"', 'data-dst-field="opposite_task_id"', - 'data-search-url="'.$this->url->href('TaskHelper', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', + 'data-search-url="'.$this->url->href('TaskAjaxController', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', ), 'autocomplete') ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/task_internal_link/remove.php b/app/Template/task_internal_link/remove.php index 82156ece..966ad116 100644 --- a/app/Template/task_internal_link/remove.php +++ b/app/Template/task_internal_link/remove.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'TaskInternalLink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'TaskInternalLinkController', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/task_internal_link/table.php b/app/Template/task_internal_link/table.php index 57a3536c..424d4791 100644 --- a/app/Template/task_internal_link/table.php +++ b/app/Template/task_internal_link/table.php @@ -24,7 +24,7 @@ <?php if ($is_public): ?> <?= $this->url->link( $this->text->e('#'.$link['task_id'].' '.$link['title']), - 'task', + 'TaskViewController', 'readonly', array('task_id' => $link['task_id'], 'token' => $project['token']), false, @@ -33,7 +33,7 @@ <?php else: ?> <?= $this->url->link( $this->text->e('#'.$link['task_id'].' '.$link['title']), - 'task', + 'TaskViewController', 'show', array('task_id' => $link['task_id'], 'project_id' => $link['project_id']), false, @@ -72,8 +72,8 @@ <div class="dropdown"> <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> - <li><?= $this->url->link(t('Edit'), 'TaskInternalLink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> - <li><?= $this->url->link(t('Remove'), 'TaskInternalLink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> + <li><?= $this->url->link(t('Edit'), 'TaskInternalLinkController', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> + <li><?= $this->url->link(t('Remove'), 'TaskInternalLinkController', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> </ul> </div> </td> diff --git a/app/Template/listing/show.php b/app/Template/task_list/show.php index a5cba1c4..bb95b6a3 100644 --- a/app/Template/listing/show.php +++ b/app/Template/task_list/show.php @@ -1,5 +1,5 @@ <section id="main"> - <?= $this->projectHeader->render($project, 'Listing', 'show') ?> + <?= $this->projectHeader->render($project, 'TaskListController', 'show') ?> <?php if ($paginator->isEmpty()): ?> <p class="alert"><?= t('No tasks found.') ?></p> @@ -18,7 +18,7 @@ <?php foreach ($paginator->getCollection() as $task): ?> <tr> <td class="task-table color-<?= $task['color_id'] ?>"> - <?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + <?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> <?= $this->render('task/dropdown', array('task' => $task)) ?> <?php else: ?> #<?= $task['id'] ?> @@ -34,7 +34,7 @@ <?= $this->text->e($task['category_name']) ?> </td> <td> - <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <?= $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['assignee_username']): ?> @@ -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_modification/edit_description.php b/app/Template/task_modification/edit_description.php index 801b4005..339ed036 100644 --- a/app/Template/task_modification/edit_description.php +++ b/app/Template/task_modification/edit_description.php @@ -2,7 +2,7 @@ <h2><?= t('Edit the description') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('taskmodification', 'updateDescription', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('TaskModificationController', 'updateDescription', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> @@ -22,6 +22,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/task_modification/edit_task.php b/app/Template/task_modification/edit_task.php index 5ddec5ea..0707fd9a 100644 --- a/app/Template/task_modification/edit_task.php +++ b/app/Template/task_modification/edit_task.php @@ -1,8 +1,7 @@ <div class="page-header"> <h2><?= t('Edit a task') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('taskmodification', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> - +<form class="popover-form" method="post" action="<?= $this->url->href('TaskModificationController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('id', $values) ?> <?= $this->form->hidden('project_id', $values) ?> @@ -34,6 +33,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue" tabindex="15"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> diff --git a/app/Template/task_popover/change_assignee.php b/app/Template/task_popover/change_assignee.php index bf68c34d..02f3e198 100644 --- a/app/Template/task_popover/change_assignee.php +++ b/app/Template/task_popover/change_assignee.php @@ -2,7 +2,7 @@ <div class="page-header"> <h2><?= t('Change assignee for the task "%s"', $values['title']) ?></h2> </div> - <form class="popover-form" method="post" action="<?= $this->url->href('TaskPopover', 'updateAssignee', array('task_id' => $values['id'], 'project_id' => $project['id'])) ?>"> + <form class="popover-form" method="post" action="<?= $this->url->href('TaskPopoverController', 'updateAssignee', array('task_id' => $values['id'], 'project_id' => $project['id'])) ?>"> <?= $this->form->csrf() ?> @@ -14,7 +14,7 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> </section> diff --git a/app/Template/task_popover/change_category.php b/app/Template/task_popover/change_category.php index 0364e660..eb6a373d 100644 --- a/app/Template/task_popover/change_category.php +++ b/app/Template/task_popover/change_category.php @@ -2,7 +2,7 @@ <div class="page-header"> <h2><?= t('Change category for the task "%s"', $values['title']) ?></h2> </div> - <form class="popover-form" method="post" action="<?= $this->url->href('TaskPopover', 'updateCategory', array('task_id' => $values['id'], 'project_id' => $project['id'])) ?>"> + <form class="popover-form" method="post" action="<?= $this->url->href('TaskPopoverController', 'updateCategory', array('task_id' => $values['id'], 'project_id' => $project['id'])) ?>"> <?= $this->form->csrf() ?> @@ -14,7 +14,7 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form> </section> diff --git a/app/Template/task_recurrence/edit.php b/app/Template/task_recurrence/edit.php index 0f5d611a..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,9 +13,9 @@ </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('TaskRecurrence', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <form class="popover-form" method="post" action="<?= $this->url->href('TaskRecurrenceController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -40,8 +40,8 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/Template/task_recurrence/info.php b/app/Template/task_recurrence/info.php index 1a6574df..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> @@ -24,14 +24,14 @@ <?php if ($task['recurrence_parent']): ?> <li> <?= t('This task has been created by: ') ?> - <?= $this->url->link('#'.$task['recurrence_parent'], 'task', 'show', array('task_id' => $task['recurrence_parent'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link('#'.$task['recurrence_parent'], 'TaskViewController', 'show', array('task_id' => $task['recurrence_parent'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> <?php if ($task['recurrence_child']): ?> <li> <?= t('This task has created this child task: ') ?> - <?= $this->url->link('#'.$task['recurrence_child'], 'task', 'show', array('task_id' => $task['recurrence_child'], 'project_id' => $task['project_id'])) ?> + <?= $this->url->link('#'.$task['recurrence_child'], 'TaskViewController', 'show', array('task_id' => $task['recurrence_child'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> <?php endif ?> -</ul>
\ No newline at end of file +</ul> diff --git a/app/Template/task_status/close.php b/app/Template/task_status/close.php index 7d200544..2d7b0ce5 100644 --- a/app/Template/task_status/close.php +++ b/app/Template/task_status/close.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> + <?= $this->url->link(t('Yes'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/task_status/open.php b/app/Template/task_status/open.php index 5d19bfbe..242b5db5 100644 --- a/app/Template/task_status/open.php +++ b/app/Template/task_status/open.php @@ -8,8 +8,8 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> + <?= $this->url->link(t('Yes'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> -</div>
\ No newline at end of file +</div> diff --git a/app/Template/task_suppression/remove.php b/app/Template/task_suppression/remove.php new file mode 100644 index 00000000..5d0f7720 --- /dev/null +++ b/app/Template/task_suppression/remove.php @@ -0,0 +1,15 @@ +<div class="page-header"> + <h2><?= t('Remove a task') ?></h2> +</div> + +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to remove this task: "%s"?', $this->text->e($task['title'])) ?> + </p> + + <div class="form-actions"> + <?= $this->url->link(t('Yes'), 'TaskSuppressionController', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => $redirect), true, 'btn btn-red popover-link') ?> + <?= t('or') ?> + <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> + </div> +</div> diff --git a/app/Template/twofactor/check.php b/app/Template/twofactor/check.php index b0cb4825..06801d50 100644 --- a/app/Template/twofactor/check.php +++ b/app/Template/twofactor/check.php @@ -1,4 +1,4 @@ -<form method="post" action="<?= $this->url->href('twofactor', 'check', array('user_id' => $this->user->getId())) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('TwoFactorController', 'check', array('user_id' => $this->user->getId())) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->label(t('Code'), 'code') ?> @@ -7,4 +7,4 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Check my code') ?></button> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/twofactor/disable.php b/app/Template/twofactor/disable.php index bdbe1233..bc419181 100644 --- a/app/Template/twofactor/disable.php +++ b/app/Template/twofactor/disable.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'twofactor', 'disable', array('user_id' => $user['id'], 'disable' => 'yes'), true, 'btn btn-red') ?> + <?= $this->url->link(t('Yes'), 'TwoFactorController', 'disable', array('user_id' => $user['id'], 'disable' => 'yes'), true, 'btn btn-red') ?> <?= t('or') ?> <?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?> </div> </div> diff --git a/app/Template/twofactor/index.php b/app/Template/twofactor/index.php index 6de36514..1ed414ed 100644 --- a/app/Template/twofactor/index.php +++ b/app/Template/twofactor/index.php @@ -2,7 +2,7 @@ <h2><?= t('Two factor authentication') ?></h2> </div> -<form method="post" action="<?= $this->url->href('twofactor', $user['twofactor_activated'] == 1 ? 'deactivate' : 'show', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('TwoFactorController', $user['twofactor_activated'] == 1 ? 'deactivate' : 'show', array('user_id' => $user['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <p><?= t('Two-Factor Provider: ') ?><strong><?= $this->text->e($provider) ?></strong></p> <div class="form-actions"> diff --git a/app/Template/twofactor/show.php b/app/Template/twofactor/show.php index 59897e20..0aeef427 100644 --- a/app/Template/twofactor/show.php +++ b/app/Template/twofactor/show.php @@ -19,7 +19,7 @@ <?php endif ?> <h3><?= t('Test your device') ?></h3> -<form method="post" action="<?= $this->url->href('twofactor', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off"> +<form method="post" action="<?= $this->url->href('TwoFactorController', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->label(t('Code'), 'code') ?> @@ -28,4 +28,4 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Check my code') ?></button> </div> -</form>
\ No newline at end of file +</form> diff --git a/app/Template/user_view/share.php b/app/Template/user_view/share.php index 9ef150e8..570b766e 100644 --- a/app/Template/user_view/share.php +++ b/app/Template/user_view/share.php @@ -5,8 +5,8 @@ <?php if (! empty($user['token'])): ?> <div class="listing"> <ul class="no-bullet"> - <li><strong><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'feed', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> - <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'FeedController', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ICalendarController', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> </ul> </div> <?= $this->url->link(t('Disable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> diff --git a/app/Template/user_view/show.php b/app/Template/user_view/show.php index 390a1e45..fc11f8a1 100644 --- a/app/Template/user_view/show.php +++ b/app/Template/user_view/show.php @@ -37,8 +37,8 @@ <div class="listing"> <ul class="no-bullet"> - <li><strong><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'feed', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> - <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'FeedController', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ICalendarController', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> </ul> </div> <?php endif ?> diff --git a/app/Template/user_view/sidebar.php b/app/Template/user_view/sidebar.php index 5eb0457b..d200a7f5 100644 --- a/app/Template/user_view/sidebar.php +++ b/app/Template/user_view/sidebar.php @@ -38,7 +38,7 @@ <?= $this->url->link(t('Edit profile'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?> </li> <li <?= $this->app->checkMenuSelection('AvatarFile') ?>> - <?= $this->url->link(t('Avatar'), 'AvatarFile', 'show', array('user_id' => $user['id'])) ?> + <?= $this->url->link(t('Avatar'), 'AvatarFileController', 'show', array('user_id' => $user['id'])) ?> </li> <?php endif ?> @@ -49,12 +49,12 @@ <?php endif ?> <?php if ($this->user->isCurrentUser($user['id'])): ?> - <li <?= $this->app->checkMenuSelection('twofactor', 'index') ?>> - <?= $this->url->link(t('Two factor authentication'), 'twofactor', 'index', array('user_id' => $user['id'])) ?> + <li <?= $this->app->checkMenuSelection('TwoFactorController', 'index') ?>> + <?= $this->url->link(t('Two factor authentication'), 'TwoFactorController', 'index', array('user_id' => $user['id'])) ?> </li> - <?php elseif ($this->user->hasAccess('twofactor', 'disable') && $user['twofactor_activated'] == 1): ?> - <li <?= $this->app->checkMenuSelection('twofactor', 'disable') ?>> - <?= $this->url->link(t('Two factor authentication'), 'twofactor', 'disable', array('user_id' => $user['id'])) ?> + <?php elseif ($this->user->hasAccess('TwoFactorController', 'disable') && $user['twofactor_activated'] == 1): ?> + <li <?= $this->app->checkMenuSelection('TwoFactorController', 'disable') ?>> + <?= $this->url->link(t('Two factor authentication'), 'TwoFactorController', 'disable', array('user_id' => $user['id'])) ?> </li> <?php endif ?> diff --git a/app/Template/user_view/timesheet.php b/app/Template/user_view/timesheet.php index 92ebafb5..3df57492 100644 --- a/app/Template/user_view/timesheet.php +++ b/app/Template/user_view/timesheet.php @@ -16,8 +16,8 @@ </tr> <?php foreach ($subtask_paginator->getCollection() as $record): ?> <tr> - <td><?= $this->url->link($this->text->e($record['task_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> - <td><?= $this->url->link($this->text->e($record['subtask_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> + <td><?= $this->url->link($this->text->e($record['task_title']), 'TaskViewController', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> + <td><?= $this->url->link($this->text->e($record['subtask_title']), 'TaskViewController', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td> <td><?= $this->dt->datetime($record['start']) ?></td> <td><?= $this->dt->datetime($record['end']) ?></td> <td><?= n($record['time_spent']).' '.t('hours') ?></td> @@ -26,4 +26,4 @@ </table> <?= $subtask_paginator ?> -<?php endif ?>
\ No newline at end of file +<?php endif ?> diff --git a/app/User/Avatar/AvatarFileProvider.php b/app/User/Avatar/AvatarFileProvider.php index eea565f0..790245a4 100644 --- a/app/User/Avatar/AvatarFileProvider.php +++ b/app/User/Avatar/AvatarFileProvider.php @@ -23,7 +23,7 @@ class AvatarFileProvider extends Base implements AvatarProviderInterface */ public function render(array $user, $size) { - $url = $this->helper->url->href('AvatarFile', 'image', array('user_id' => $user['id'], 'size' => $size)); + $url = $this->helper->url->href('AvatarFileController', 'image', array('user_id' => $user['id'], 'size' => $size)); $title = $this->helper->text->e($user['name'] ?: $user['username']); return '<img src="' . $url . '" alt="' . $title . '" title="' . $title . '">'; } 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/ActionValidator.php b/app/Validator/ActionValidator.php index 95ee7d21..4ce5db46 100644 --- a/app/Validator/ActionValidator.php +++ b/app/Validator/ActionValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Action Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class ActionValidator extends Base +class ActionValidator extends BaseValidator { /** * Validate action creation diff --git a/app/Validator/AuthValidator.php b/app/Validator/AuthValidator.php index cd6e04d5..03ff6f22 100644 --- a/app/Validator/AuthValidator.php +++ b/app/Validator/AuthValidator.php @@ -9,10 +9,10 @@ use Gregwar\Captcha\CaptchaBuilder; /** * Authentication Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class AuthValidator extends Base +class AuthValidator extends BaseValidator { /** * Validate user login form @@ -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/Base.php b/app/Validator/BaseValidator.php index ba32a503..6088538c 100644 --- a/app/Validator/Base.php +++ b/app/Validator/BaseValidator.php @@ -2,15 +2,16 @@ namespace Kanboard\Validator; +use Kanboard\Core\Base; use SimpleValidator\Validators; /** * Base Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class Base extends \Kanboard\Core\Base +abstract class BaseValidator extends Base { /** * Execute multiple validators diff --git a/app/Validator/CategoryValidator.php b/app/Validator/CategoryValidator.php index 715aed66..fc42d2e5 100644 --- a/app/Validator/CategoryValidator.php +++ b/app/Validator/CategoryValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Category Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class CategoryValidator extends Base +class CategoryValidator extends BaseValidator { /** * Validate category creation diff --git a/app/Validator/ColumnValidator.php b/app/Validator/ColumnValidator.php index f0f1659b..25aa45d0 100644 --- a/app/Validator/ColumnValidator.php +++ b/app/Validator/ColumnValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Column Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class ColumnValidator extends Base +class ColumnValidator extends BaseValidator { /** * Validate column modification diff --git a/app/Validator/CommentValidator.php b/app/Validator/CommentValidator.php index 4eb54206..fc8e6da8 100644 --- a/app/Validator/CommentValidator.php +++ b/app/Validator/CommentValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Comment Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class CommentValidator extends Base +class CommentValidator extends BaseValidator { /** * Validate comment creation diff --git a/app/Validator/CurrencyValidator.php b/app/Validator/CurrencyValidator.php index ee191523..4f375c54 100644 --- a/app/Validator/CurrencyValidator.php +++ b/app/Validator/CurrencyValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Currency Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class CurrencyValidator extends Base +class CurrencyValidator extends BaseValidator { /** * Validate diff --git a/app/Validator/CustomFilterValidator.php b/app/Validator/CustomFilterValidator.php index 07f2a1eb..1ab9303d 100644 --- a/app/Validator/CustomFilterValidator.php +++ b/app/Validator/CustomFilterValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Custom Filter Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class CustomFilterValidator extends Base +class CustomFilterValidator extends BaseValidator { /** * Common validation rules diff --git a/app/Validator/ExternalLinkValidator.php b/app/Validator/ExternalLinkValidator.php index fff4133b..9c017708 100644 --- a/app/Validator/ExternalLinkValidator.php +++ b/app/Validator/ExternalLinkValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * External Link Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class ExternalLinkValidator extends Base +class ExternalLinkValidator extends BaseValidator { /** * Validate creation diff --git a/app/Validator/GroupValidator.php b/app/Validator/GroupValidator.php index 2226abd3..8b21c697 100644 --- a/app/Validator/GroupValidator.php +++ b/app/Validator/GroupValidator.php @@ -4,15 +4,15 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Group; +use Kanboard\Model\GroupModel; /** * Group Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class GroupValidator extends Base +class GroupValidator extends BaseValidator { /** * Validate creation @@ -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..8e1c8780 100644 --- a/app/Validator/LinkValidator.php +++ b/app/Validator/LinkValidator.php @@ -4,15 +4,15 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Link; +use Kanboard\Model\LinkModel; /** * Link Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class LinkValidator extends Base +class LinkValidator extends BaseValidator { /** * Validate creation @@ -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/PasswordResetValidator.php b/app/Validator/PasswordResetValidator.php index baf2d8d7..e44e5206 100644 --- a/app/Validator/PasswordResetValidator.php +++ b/app/Validator/PasswordResetValidator.php @@ -9,10 +9,10 @@ use Gregwar\Captcha\CaptchaBuilder; /** * Password Reset Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class PasswordResetValidator extends Base +class PasswordResetValidator extends BaseValidator { /** * Validate creation @@ -87,6 +87,6 @@ class PasswordResetValidator extends Base } } - return array($result, $errors);; + return array($result, $errors); } } diff --git a/app/Validator/ProjectValidator.php b/app/Validator/ProjectValidator.php index 1c6c90f8..9ef59111 100644 --- a/app/Validator/ProjectValidator.php +++ b/app/Validator/ProjectValidator.php @@ -4,15 +4,15 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Project; +use Kanboard\Model\ProjectModel; /** * Project Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class ProjectValidator extends Base +class ProjectValidator extends BaseValidator { /** * Common validation rules @@ -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/SubtaskValidator.php b/app/Validator/SubtaskValidator.php index 1989b7f4..b80de41d 100644 --- a/app/Validator/SubtaskValidator.php +++ b/app/Validator/SubtaskValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Subtask Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class SubtaskValidator extends Base +class SubtaskValidator extends BaseValidator { /** * Validate creation diff --git a/app/Validator/SwimlaneValidator.php b/app/Validator/SwimlaneValidator.php index 4cc780f9..16f8bfba 100644 --- a/app/Validator/SwimlaneValidator.php +++ b/app/Validator/SwimlaneValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Swimlane Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class SwimlaneValidator extends Base +class SwimlaneValidator extends BaseValidator { /** * Validate creation diff --git a/app/Validator/TaskLinkValidator.php b/app/Validator/TaskLinkValidator.php index c88c2b16..6da257bf 100644 --- a/app/Validator/TaskLinkValidator.php +++ b/app/Validator/TaskLinkValidator.php @@ -4,15 +4,15 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\Task; +use Kanboard\Model\TaskModel; /** * Task Link Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class TaskLinkValidator extends Base +class TaskLinkValidator extends BaseValidator { /** * Common validation rules @@ -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/TaskValidator.php b/app/Validator/TaskValidator.php index 55ea8fdd..7c39ff51 100644 --- a/app/Validator/TaskValidator.php +++ b/app/Validator/TaskValidator.php @@ -8,10 +8,10 @@ use SimpleValidator\Validators; /** * Task Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class TaskValidator extends Base +class TaskValidator extends BaseValidator { /** * Common validation rules diff --git a/app/Validator/UserValidator.php b/app/Validator/UserValidator.php index e5953f30..9911de50 100644 --- a/app/Validator/UserValidator.php +++ b/app/Validator/UserValidator.php @@ -4,15 +4,15 @@ namespace Kanboard\Validator; use SimpleValidator\Validator; use SimpleValidator\Validators; -use Kanboard\Model\User; +use Kanboard\Model\UserModel; /** * User Validator * - * @package validator + * @package Kanboard\Validator * @author Frederic Guillot */ -class UserValidator extends Base +class UserValidator extends BaseValidator { /** * Common validation rules @@ -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')), ); diff --git a/app/common.php b/app/common.php index e018aa12..72be3603 100644 --- a/app/common.php +++ b/app/common.php @@ -31,6 +31,7 @@ require __DIR__.'/constants.php'; require __DIR__.'/check_setup.php'; $container = new Pimple\Container; +$container->register(new Kanboard\ServiceProvider\MailProvider()); $container->register(new Kanboard\ServiceProvider\HelperProvider()); $container->register(new Kanboard\ServiceProvider\SessionProvider()); $container->register(new Kanboard\ServiceProvider\LoggingProvider()); @@ -46,4 +47,6 @@ $container->register(new Kanboard\ServiceProvider\ExternalLinkProvider()); $container->register(new Kanboard\ServiceProvider\AvatarProvider()); $container->register(new Kanboard\ServiceProvider\FilterProvider()); $container->register(new Kanboard\ServiceProvider\QueueProvider()); +$container->register(new Kanboard\ServiceProvider\ApiProvider()); +$container->register(new Kanboard\ServiceProvider\CommandProvider()); $container->register(new Kanboard\ServiceProvider\PluginProvider()); |