Rename all models

This commit is contained in:
Frederic Guillot 2016-05-28 19:48:22 -04:00
parent 936376ffe7
commit 14713b0ec7
411 changed files with 4145 additions and 4156 deletions

View File

@ -65,11 +65,11 @@ class CommentCreation extends Base
*/ */
public function doAction(array $data) public function doAction(array $data)
{ {
return (bool) $this->comment->create(array( return (bool) $this->commentModel->create(array(
'reference' => isset($data['reference']) ? $data['reference'] : '', 'reference' => isset($data['reference']) ? $data['reference'] : '',
'comment' => $data['comment'], 'comment' => $data['comment'],
'task_id' => $data['task_id'], '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,
)); ));
} }

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Add a comment of the triggering event to the task description. * Add a comment of the triggering event to the task description.
@ -32,7 +32,7 @@ class CommentCreationMoveTaskColumn extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
); );
} }
@ -71,9 +71,9 @@ class CommentCreationMoveTaskColumn extends Base
return false; 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']), 'comment' => t('Moved to column %s', $column['title']),
'task_id' => $data['task_id'], 'task_id' => $data['task_id'],
'user_id' => $this->userSession->getId(), 'user_id' => $this->userSession->getId(),

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Set a category automatically according to the color * Set a category automatically according to the color
@ -32,7 +32,7 @@ class TaskAssignCategoryColor extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_CREATE_UPDATE, TaskModel::EVENT_CREATE_UPDATE,
); );
} }
@ -78,7 +78,7 @@ class TaskAssignCategoryColor extends Base
'category_id' => $this->getParam('category_id'), 'category_id' => $this->getParam('category_id'),
); );
return $this->taskModification->update($values); return $this->taskModificationModel->update($values);
} }
/** /**

View File

@ -74,7 +74,7 @@ class TaskAssignCategoryLabel extends Base
'category_id' => $this->getParam('category_id'), 'category_id' => $this->getParam('category_id'),
); );
return $this->taskModification->update($values); return $this->taskModificationModel->update($values);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\TaskLink; use Kanboard\Model\TaskLinkModel;
/** /**
* Set a category automatically according to a task link * Set a category automatically according to a task link
@ -33,7 +33,7 @@ class TaskAssignCategoryLink extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
TaskLink::EVENT_CREATE_UPDATE, TaskLinkModel::EVENT_CREATE_UPDATE,
); );
} }
@ -79,7 +79,7 @@ class TaskAssignCategoryLink extends Base
'category_id' => $this->getParam('category_id'), '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) public function hasRequiredCondition(array $data)
{ {
if ($data['link_id'] == $this->getParam('link_id')) { 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']); return empty($task['category_id']);
} }

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Assign a color to a specific category * Assign a color to a specific category
@ -32,7 +32,7 @@ class TaskAssignColorCategory extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_CREATE_UPDATE, TaskModel::EVENT_CREATE_UPDATE,
); );
} }
@ -78,7 +78,7 @@ class TaskAssignColorCategory extends Base
'color_id' => $this->getParam('color_id'), 'color_id' => $this->getParam('color_id'),
); );
return $this->taskModification->update($values, false); return $this->taskModificationModel->update($values, false);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Assign a color to a task * Assign a color to a task
@ -32,8 +32,8 @@ class TaskAssignColorColumn extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_CREATE, TaskModel::EVENT_CREATE,
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
); );
} }
@ -79,7 +79,7 @@ class TaskAssignColorColumn extends Base
'color_id' => $this->getParam('color_id'), 'color_id' => $this->getParam('color_id'),
); );
return $this->taskModification->update($values, false); return $this->taskModificationModel->update($values, false);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\TaskLink; use Kanboard\Model\TaskLinkModel;
/** /**
* Assign a color to a specific task link * Assign a color to a specific task link
@ -32,7 +32,7 @@ class TaskAssignColorLink extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
TaskLink::EVENT_CREATE_UPDATE, TaskLinkModel::EVENT_CREATE_UPDATE,
); );
} }
@ -78,7 +78,7 @@ class TaskAssignColorLink extends Base
'color_id' => $this->getParam('color_id'), 'color_id' => $this->getParam('color_id'),
); );
return $this->taskModification->update($values, false); return $this->taskModificationModel->update($values, false);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Assign a color to a priority * Assign a color to a priority
@ -32,7 +32,7 @@ class TaskAssignColorPriority extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_CREATE_UPDATE, TaskModel::EVENT_CREATE_UPDATE,
); );
} }
@ -78,7 +78,7 @@ class TaskAssignColorPriority extends Base
'color_id' => $this->getParam('color_id'), 'color_id' => $this->getParam('color_id'),
); );
return $this->taskModification->update($values, false); return $this->taskModificationModel->update($values, false);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Assign a color to a specific user * Assign a color to a specific user
@ -32,8 +32,8 @@ class TaskAssignColorUser extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_CREATE, TaskModel::EVENT_CREATE,
Task::EVENT_ASSIGNEE_CHANGE, TaskModel::EVENT_ASSIGNEE_CHANGE,
); );
} }
@ -79,7 +79,7 @@ class TaskAssignColorUser extends Base
'color_id' => $this->getParam('color_id'), 'color_id' => $this->getParam('color_id'),
); );
return $this->taskModification->update($values, false); return $this->taskModificationModel->update($values, false);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Assign a task to the logged user * Assign a task to the logged user
@ -32,7 +32,7 @@ class TaskAssignCurrentUser extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_CREATE, TaskModel::EVENT_CREATE,
); );
} }
@ -78,7 +78,7 @@ class TaskAssignCurrentUser extends Base
'owner_id' => $this->userSession->getId(), 'owner_id' => $this->userSession->getId(),
); );
return $this->taskModification->update($values); return $this->taskModificationModel->update($values);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Assign a task to the logged user on column change * Assign a task to the logged user on column change
@ -32,7 +32,7 @@ class TaskAssignCurrentUserColumn extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
); );
} }
@ -81,7 +81,7 @@ class TaskAssignCurrentUserColumn extends Base
'owner_id' => $this->userSession->getId(), 'owner_id' => $this->userSession->getId(),
); );
return $this->taskModification->update($values); return $this->taskModificationModel->update($values);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Assign a task to a specific user * Assign a task to a specific user
@ -32,8 +32,8 @@ class TaskAssignSpecificUser extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_CREATE_UPDATE, TaskModel::EVENT_CREATE_UPDATE,
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
); );
} }
@ -79,7 +79,7 @@ class TaskAssignSpecificUser extends Base
'owner_id' => $this->getParam('user_id'), 'owner_id' => $this->getParam('user_id'),
); );
return $this->taskModification->update($values); return $this->taskModificationModel->update($values);
} }
/** /**

View File

@ -71,7 +71,7 @@ class TaskAssignUser extends Base
'owner_id' => $data['owner_id'], '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) public function hasRequiredCondition(array $data)
{ {
return $this->projectPermission->isAssignable($this->getProjectId(), $data['owner_id']); return $this->projectPermissionModel->isAssignable($this->getProjectId(), $data['owner_id']);
} }
} }

View File

@ -63,7 +63,7 @@ class TaskClose extends Base
*/ */
public function doAction(array $data) public function doAction(array $data)
{ {
return $this->taskStatus->close($data['task_id']); return $this->taskStatusModel->close($data['task_id']);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Close automatically a task in a specific column * Close automatically a task in a specific column
@ -32,7 +32,7 @@ class TaskCloseColumn extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
); );
} }
@ -67,7 +67,7 @@ class TaskCloseColumn extends Base
*/ */
public function doAction(array $data) public function doAction(array $data)
{ {
return $this->taskStatus->close($data['task_id']); return $this->taskStatusModel->close($data['task_id']);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Close automatically a task after when inactive * Close automatically a task after when inactive
@ -31,7 +31,7 @@ class TaskCloseNoActivity extends Base
*/ */
public function getCompatibleEvents() 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']; $duration = time() - $task['date_modification'];
if ($duration > $max) { if ($duration > $max) {
$results[] = $this->taskStatus->close($task['id']); $results[] = $this->taskStatusModel->close($task['id']);
} }
} }

View File

@ -66,7 +66,7 @@ class TaskCreation extends Base
*/ */
public function doAction(array $data) public function doAction(array $data)
{ {
return (bool) $this->taskCreation->create(array( return (bool) $this->taskCreationModel->create(array(
'project_id' => $data['project_id'], 'project_id' => $data['project_id'],
'title' => $data['title'], 'title' => $data['title'],
'reference' => $data['reference'], 'reference' => $data['reference'],

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Duplicate a task to another project * Duplicate a task to another project
@ -32,8 +32,8 @@ class TaskDuplicateAnotherProject extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
Task::EVENT_CLOSE, TaskModel::EVENT_CLOSE,
); );
} }
@ -74,8 +74,8 @@ class TaskDuplicateAnotherProject extends Base
*/ */
public function doAction(array $data) public function doAction(array $data)
{ {
$destination_column_id = $this->column->getFirstColumnId($this->getParam('project_id')); $destination_column_id = $this->columnModel->getFirstColumnId($this->getParam('project_id'));
return (bool) $this->taskDuplication->duplicateToProject($data['task_id'], $this->getParam('project_id'), null, $destination_column_id); return (bool) $this->taskDuplicationModel->duplicateToProject($data['task_id'], $this->getParam('project_id'), null, $destination_column_id);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Email a task to someone * Email a task to someone
@ -32,8 +32,8 @@ class TaskEmail extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
Task::EVENT_CLOSE, TaskModel::EVENT_CLOSE,
); );
} }
@ -75,16 +75,16 @@ class TaskEmail extends Base
*/ */
public function doAction(array $data) 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'])) { if (! empty($user['email'])) {
$task = $this->taskFinder->getDetails($data['task_id']); $task = $this->taskFinderModel->getDetails($data['task_id']);
$this->emailClient->send( $this->emailClient->send(
$user['email'], $user['email'],
$user['name'] ?: $user['username'], $user['name'] ?: $user['username'],
$this->getParam('subject'), $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; return true;

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Email a task with no activity * Email a task with no activity
@ -32,7 +32,7 @@ class TaskEmailNoActivity extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_DAILY_CRONJOB, TaskModel::EVENT_DAILY_CRONJOB,
); );
} }
@ -85,7 +85,7 @@ class TaskEmailNoActivity extends Base
{ {
$results = array(); $results = array();
$max = $this->getParam('duration') * 86400; $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'])) { if (! empty($user['email'])) {
foreach ($data['tasks'] as $task) { foreach ($data['tasks'] as $task) {
@ -110,13 +110,13 @@ class TaskEmailNoActivity extends Base
*/ */
private function sendEmail($task_id, array $user) private function sendEmail($task_id, array $user)
{ {
$task = $this->taskFinder->getDetails($task_id); $task = $this->taskFinderModel->getDetails($task_id);
$this->emailClient->send( $this->emailClient->send(
$user['email'], $user['email'],
$user['name'] ?: $user['username'], $user['name'] ?: $user['username'],
$this->getParam('subject'), $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; return true;

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Move a task to another project * Move a task to another project
@ -32,8 +32,8 @@ class TaskMoveAnotherProject extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
Task::EVENT_CLOSE, TaskModel::EVENT_CLOSE,
); );
} }
@ -75,7 +75,7 @@ class TaskMoveAnotherProject extends Base
*/ */
public function doAction(array $data) 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'));
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Move a task to another column when an assignee is set * Move a task to another column when an assignee is set
@ -32,8 +32,8 @@ class TaskMoveColumnAssigned extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_ASSIGNEE_CHANGE, TaskModel::EVENT_ASSIGNEE_CHANGE,
Task::EVENT_UPDATE, TaskModel::EVENT_UPDATE,
); );
} }
@ -75,9 +75,9 @@ class TaskMoveColumnAssigned extends Base
*/ */
public function doAction(array $data) 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['project_id'],
$data['task_id'], $data['task_id'],
$this->getParam('dest_column_id'), $this->getParam('dest_column_id'),

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Move a task to another column when the category is changed * Move a task to another column when the category is changed
@ -32,7 +32,7 @@ class TaskMoveColumnCategoryChange extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_UPDATE, TaskModel::EVENT_UPDATE,
); );
} }
@ -74,9 +74,9 @@ class TaskMoveColumnCategoryChange extends Base
*/ */
public function doAction(array $data) 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['project_id'],
$data['task_id'], $data['task_id'],
$this->getParam('dest_column_id'), $this->getParam('dest_column_id'),

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Move a task to another column when an assignee is cleared * Move a task to another column when an assignee is cleared
@ -32,8 +32,8 @@ class TaskMoveColumnUnAssigned extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_ASSIGNEE_CHANGE, TaskModel::EVENT_ASSIGNEE_CHANGE,
Task::EVENT_UPDATE, TaskModel::EVENT_UPDATE,
); );
} }
@ -75,9 +75,9 @@ class TaskMoveColumnUnAssigned extends Base
*/ */
public function doAction(array $data) 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['project_id'],
$data['task_id'], $data['task_id'],
$this->getParam('dest_column_id'), $this->getParam('dest_column_id'),

View File

@ -63,7 +63,7 @@ class TaskOpen extends Base
*/ */
public function doAction(array $data) public function doAction(array $data)
{ {
return $this->taskStatus->open($data['task_id']); return $this->taskStatusModel->open($data['task_id']);
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Kanboard\Action; namespace Kanboard\Action;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Set the start date of task * Set the start date of task
@ -32,7 +32,7 @@ class TaskUpdateStartDate extends Base
public function getCompatibleEvents() public function getCompatibleEvents()
{ {
return array( return array(
Task::EVENT_MOVE_COLUMN, TaskModel::EVENT_MOVE_COLUMN,
); );
} }
@ -77,7 +77,7 @@ class TaskUpdateStartDate extends Base
'date_started' => time(), 'date_started' => time(),
); );
return $this->taskModification->update($values, false); return $this->taskModificationModel->update($values, false);
} }
/** /**

View File

@ -3,7 +3,7 @@
namespace Kanboard\Analytic; namespace Kanboard\Analytic;
use Kanboard\Core\Base; use Kanboard\Core\Base;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Average Lead and Cycle Time * Average Lead and Cycle Time
@ -106,7 +106,7 @@ class AverageLeadCycleTimeAnalytic extends Base
private function getTasks($project_id) private function getTasks($project_id)
{ {
return $this->db return $this->db
->table(Task::TABLE) ->table(TaskModel::TABLE)
->columns('date_completed', 'date_creation', 'date_started') ->columns('date_completed', 'date_creation', 'date_started')
->eq('project_id', $project_id) ->eq('project_id', $project_id)
->desc('id') ->desc('id')

View File

@ -3,7 +3,7 @@
namespace Kanboard\Analytic; namespace Kanboard\Analytic;
use Kanboard\Core\Base; use Kanboard\Core\Base;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Average Time Spent by Column * Average Time Spent by Column
@ -40,7 +40,7 @@ class AverageTimeSpentColumnAnalytic extends Base
private function initialize($project_id) private function initialize($project_id)
{ {
$stats = array(); $stats = array();
$columns = $this->column->getList($project_id); $columns = $this->columnModel->getList($project_id);
foreach ($columns as $column_id => $column_title) { foreach ($columns as $column_id => $column_title) {
$stats[$column_id] = array( $stats[$column_id] = array(
@ -110,7 +110,7 @@ class AverageTimeSpentColumnAnalytic extends Base
*/ */
private function getTaskTimeByColumns(array &$task) private function getTaskTimeByColumns(array &$task)
{ {
$columns = $this->transition->getTimeSpentByTask($task['id']); $columns = $this->transitionModel->getTimeSpentByTask($task['id']);
if (! isset($columns[$task['column_id']])) { if (! isset($columns[$task['column_id']])) {
$columns[$task['column_id']] = 0; $columns[$task['column_id']] = 0;
@ -144,7 +144,7 @@ class AverageTimeSpentColumnAnalytic extends Base
private function getTasks($project_id) private function getTasks($project_id)
{ {
return $this->db return $this->db
->table(Task::TABLE) ->table(TaskModel::TABLE)
->columns('id', 'date_completed', 'date_moved', 'column_id') ->columns('id', 'date_completed', 'date_moved', 'column_id')
->eq('project_id', $project_id) ->eq('project_id', $project_id)
->desc('id') ->desc('id')

View File

@ -3,7 +3,7 @@
namespace Kanboard\Analytic; namespace Kanboard\Analytic;
use Kanboard\Core\Base; use Kanboard\Core\Base;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
/** /**
* Estimated/Spent Time Comparison * Estimated/Spent Time Comparison
@ -22,7 +22,7 @@ class EstimatedTimeComparisonAnalytic extends Base
*/ */
public function build($project_id) 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') ->columns('SUM(time_estimated) AS time_estimated', 'SUM(time_spent) AS time_spent', 'is_active')
->eq('project_id', $project_id) ->eq('project_id', $project_id)
->groupBy('is_active') ->groupBy('is_active')
@ -40,7 +40,7 @@ class EstimatedTimeComparisonAnalytic extends Base
); );
foreach ($rows as $row) { 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_spent'] = $row['time_spent'];
$metrics[$key]['time_estimated'] = $row['time_estimated']; $metrics[$key]['time_estimated'] = $row['time_estimated'];
} }

View File

@ -23,10 +23,10 @@ class TaskDistributionAnalytic extends Base
{ {
$metrics = array(); $metrics = array();
$total = 0; $total = 0;
$columns = $this->column->getAll($project_id); $columns = $this->columnModel->getAll($project_id);
foreach ($columns as $column) { 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; $total += $nb_tasks;
$metrics[] = array( $metrics[] = array(

View File

@ -23,8 +23,8 @@ class UserDistributionAnalytic extends Base
{ {
$metrics = array(); $metrics = array();
$total = 0; $total = 0;
$tasks = $this->taskFinder->getAll($project_id); $tasks = $this->taskFinderModel->getAll($project_id);
$users = $this->projectUserRole->getAssignableUsersList($project_id); $users = $this->projectUserRoleModel->getAssignableUsersList($project_id);
foreach ($tasks as $task) { foreach ($tasks as $task) {
$user = isset($users[$task['owner_id']]) ? $users[$task['owner_id']] : $users[0]; $user = isset($users[$task['owner_id']]) ? $users[$task['owner_id']] : $users[0];

View File

@ -29,12 +29,12 @@ class ActionApi extends Base
public function removeAction($action_id) public function removeAction($action_id)
{ {
return $this->action->remove($action_id); return $this->actionModel->remove($action_id);
} }
public function getActions($project_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) 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);
} }
} }

View File

@ -14,7 +14,7 @@ class AppApi extends Base
{ {
public function getTimezone() public function getTimezone()
{ {
return $this->timezone->getCurrentTimezone(); return $this->timezoneModel->getCurrentTimezone();
} }
public function getVersion() public function getVersion()
@ -24,17 +24,17 @@ class AppApi extends Base
public function getDefaultTaskColor() public function getDefaultTaskColor()
{ {
return $this->color->getDefaultColor(); return $this->colorModel->getDefaultColor();
} }
public function getDefaultTaskColors() public function getDefaultTaskColors()
{ {
return $this->color->getDefaultColors(); return $this->colorModel->getDefaultColors();
} }
public function getColorList() public function getColorList()
{ {
return $this->color->getList(); return $this->colorModel->getList();
} }
public function getApplicationRoles() public function getApplicationRoles()

View File

@ -28,7 +28,7 @@ class AuthApi extends BaseApi
if ($this->isUserAuthenticated($username, $password)) { if ($this->isUserAuthenticated($username, $password)) {
$this->checkProcedurePermission(true, $method); $this->checkProcedurePermission(true, $method);
$this->userSession->initialize($this->user->getByUsername($username)); $this->userSession->initialize($this->userModel->getByUsername($username));
} elseif ($this->isAppAuthenticated($username, $password)) { } elseif ($this->isAppAuthenticated($username, $password)) {
$this->checkProcedurePermission(false, $method); $this->checkProcedurePermission(false, $method);
} else { } else {
@ -48,7 +48,7 @@ class AuthApi extends BaseApi
private function isUserAuthenticated($username, $password) private function isUserAuthenticated($username, $password)
{ {
return $username !== 'jsonrpc' && return $username !== 'jsonrpc' &&
! $this->userLocking->isLocked($username) && ! $this->userLockingModel->isLocked($username) &&
$this->authenticationManager->passwordAuthentication($username, $password); $this->authenticationManager->passwordAuthentication($username, $password);
} }
@ -77,6 +77,6 @@ class AuthApi extends BaseApi
return API_AUTHENTICATION_TOKEN; return API_AUTHENTICATION_TOKEN;
} }
return $this->config->get('api_token'); return $this->configModel->get('api_token');
} }
} }

View File

@ -60,7 +60,7 @@ abstract class BaseApi extends Base
public function checkProjectPermission($project_id) 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'); throw new AccessDeniedException('Permission denied');
} }
} }
@ -68,7 +68,7 @@ abstract class BaseApi extends Base
public function checkTaskPermission($task_id) public function checkTaskPermission($task_id)
{ {
if ($this->userSession->isLogged()) { if ($this->userSession->isLogged()) {
$this->checkProjectPermission($this->taskFinder->getProjectId($task_id)); $this->checkProjectPermission($this->taskFinderModel->getProjectId($task_id));
} }
} }
@ -76,7 +76,7 @@ abstract class BaseApi extends Base
{ {
if (! empty($task)) { if (! empty($task)) {
$task['url'] = $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true); $task['url'] = $this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true);
$task['color'] = $this->color->getColorProperties($task['color_id']); $task['color'] = $this->colorModel->getColorProperties($task['color_id']);
} }
return $task; return $task;

View File

@ -13,6 +13,6 @@ class BoardApi extends BaseApi
public function getBoard($project_id) public function getBoard($project_id)
{ {
$this->checkProjectPermission($project_id); $this->checkProjectPermission($project_id);
return $this->board->getBoard($project_id); return $this->boardModel->getBoard($project_id);
} }
} }

View File

@ -14,17 +14,17 @@ class CategoryApi extends Base
{ {
public function getCategory($category_id) public function getCategory($category_id)
{ {
return $this->category->getById($category_id); return $this->categoryModel->getById($category_id);
} }
public function getAllCategories($project_id) public function getAllCategories($project_id)
{ {
return $this->category->getAll($project_id); return $this->categoryModel->getAll($project_id);
} }
public function removeCategory($category_id) public function removeCategory($category_id)
{ {
return $this->category->remove($category_id); return $this->categoryModel->remove($category_id);
} }
public function createCategory($project_id, $name) public function createCategory($project_id, $name)
@ -35,7 +35,7 @@ class CategoryApi extends Base
); );
list($valid, ) = $this->categoryValidator->validateCreation($values); 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) public function updateCategory($id, $name)
@ -46,6 +46,6 @@ class CategoryApi extends Base
); );
list($valid, ) = $this->categoryValidator->validateModification($values); list($valid, ) = $this->categoryValidator->validateModification($values);
return $valid && $this->category->update($values); return $valid && $this->categoryModel->update($values);
} }
} }

View File

@ -12,31 +12,31 @@ class ColumnApi extends BaseApi
{ {
public function getColumns($project_id) public function getColumns($project_id)
{ {
return $this->column->getAll($project_id); return $this->columnModel->getAll($project_id);
} }
public function getColumn($column_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 = '') 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 = '') 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) 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) 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);
} }
} }

View File

@ -14,17 +14,17 @@ class CommentApi extends Base
{ {
public function getComment($comment_id) public function getComment($comment_id)
{ {
return $this->comment->getById($comment_id); return $this->commentModel->getById($comment_id);
} }
public function getAllComments($task_id) public function getAllComments($task_id)
{ {
return $this->comment->getAll($task_id); return $this->commentModel->getAll($task_id);
} }
public function removeComment($comment_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 = '') public function createComment($task_id, $user_id, $content, $reference = '')
@ -38,7 +38,7 @@ class CommentApi extends Base
list($valid, ) = $this->commentValidator->validateCreation($values); 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) public function updateComment($id, $content)
@ -49,6 +49,6 @@ class CommentApi extends Base
); );
list($valid, ) = $this->commentValidator->validateModification($values); list($valid, ) = $this->commentValidator->validateModification($values);
return $valid && $this->comment->update($values); return $valid && $this->commentModel->update($values);
} }
} }

View File

@ -14,18 +14,18 @@ class FileApi extends BaseApi
{ {
public function getTaskFile($file_id) public function getTaskFile($file_id)
{ {
return $this->taskFile->getById($file_id); return $this->taskFileModel->getById($file_id);
} }
public function getAllTaskFiles($task_id) public function getAllTaskFiles($task_id)
{ {
return $this->taskFile->getAll($task_id); return $this->taskFileModel->getAll($task_id);
} }
public function downloadTaskFile($file_id) public function downloadTaskFile($file_id)
{ {
try { try {
$file = $this->taskFile->getById($file_id); $file = $this->taskFileModel->getById($file_id);
if (! empty($file)) { if (! empty($file)) {
return base64_encode($this->objectStorage->get($file['path'])); 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) public function createTaskFile($project_id, $task_id, $filename, $blob)
{ {
try { try {
return $this->taskFile->uploadContent($task_id, $filename, $blob); return $this->taskFileModel->uploadContent($task_id, $filename, $blob);
} catch (ObjectStorageException $e) { } catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage()); $this->logger->error($e->getMessage());
return false; return false;
@ -49,12 +49,12 @@ class FileApi extends BaseApi
public function removeTaskFile($file_id) public function removeTaskFile($file_id)
{ {
return $this->taskFile->remove($file_id); return $this->taskFileModel->remove($file_id);
} }
public function removeAllTaskFiles($task_id) public function removeAllTaskFiles($task_id)
{ {
return $this->taskFile->removeAll($task_id); return $this->taskFileModel->removeAll($task_id);
} }
// Deprecated procedures // Deprecated procedures

View File

@ -14,7 +14,7 @@ class GroupApi extends Base
{ {
public function createGroup($name, $external_id = '') 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) 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) public function removeGroup($group_id)
{ {
return $this->group->remove($group_id); return $this->groupModel->remove($group_id);
} }
public function getGroup($group_id) public function getGroup($group_id)
{ {
return $this->group->getById($group_id); return $this->groupModel->getById($group_id);
} }
public function getAllGroups() public function getAllGroups()
{ {
return $this->group->getAll(); return $this->groupModel->getAll();
} }
} }

View File

@ -14,26 +14,26 @@ class GroupMemberApi extends Base
{ {
public function getMemberGroups($user_id) public function getMemberGroups($user_id)
{ {
return $this->groupMember->getGroups($user_id); return $this->groupMemberModel->getGroups($user_id);
} }
public function getGroupMembers($group_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) 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) 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) public function isGroupMember($group_id, $user_id)
{ {
return $this->groupMember->isMember($group_id, $user_id); return $this->groupMemberModel->isMember($group_id, $user_id);
} }
} }

View File

@ -21,7 +21,7 @@ class LinkApi extends Base
*/ */
public function getLinkById($link_id) 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) 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) 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() 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); 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); 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) public function removeLink($link_id)
{ {
return $this->link->remove($link_id); return $this->linkModel->remove($link_id);
} }
} }

View File

@ -2,7 +2,7 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Model\Subtask as SubtaskModel; use Kanboard\Model\SubtaskModel;
/** /**
* Me API controller * Me API controller
@ -20,25 +20,25 @@ class MeApi extends BaseApi
public function getMyDashboard() public function getMyDashboard()
{ {
$user_id = $this->userSession->getId(); $user_id = $this->userSession->getId();
$projects = $this->project->getQueryColumnStats($this->projectPermission->getActiveProjectIds($user_id))->findAll(); $projects = $this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id))->findAll();
$tasks = $this->taskFinder->getUserQuery($user_id)->findAll(); $tasks = $this->taskFinderModel->getUserQuery($user_id)->findAll();
return array( return array(
'projects' => $this->formatProjects($projects), 'projects' => $this->formatProjects($projects),
'tasks' => $this->formatTasks($tasks), '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() 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); return $this->helper->projectActivity->getProjectsEvents($project_ids, 100);
} }
public function createMyPrivateProject($name, $description = null) 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; return false;
} }
@ -49,23 +49,23 @@ class MeApi extends BaseApi
); );
list($valid, ) = $this->projectValidator->validateCreation($values); 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() public function getMyProjectsList()
{ {
return $this->projectUserRole->getProjectsByUser($this->userSession->getId()); return $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId());
} }
public function getMyOverdueTasks() public function getMyOverdueTasks()
{ {
return $this->taskFinder->getOverdueTasksByUser($this->userSession->getId()); return $this->taskFinderModel->getOverdueTasksByUser($this->userSession->getId());
} }
public function getMyProjects() public function getMyProjects()
{ {
$project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId());
$projects = $this->project->getAllByIds($project_ids); $projects = $this->projectModel->getAllByIds($project_ids);
return $this->formatProjects($projects); return $this->formatProjects($projects);
} }

View File

@ -13,42 +13,42 @@ class ProjectApi extends BaseApi
public function getProjectById($project_id) public function getProjectById($project_id)
{ {
$this->checkProjectPermission($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) public function getProjectByName($name)
{ {
return $this->formatProject($this->project->getByName($name)); return $this->formatProject($this->projectModel->getByName($name));
} }
public function getAllProjects() public function getAllProjects()
{ {
return $this->formatProjects($this->project->getAll()); return $this->formatProjects($this->projectModel->getAll());
} }
public function removeProject($project_id) public function removeProject($project_id)
{ {
return $this->project->remove($project_id); return $this->projectModel->remove($project_id);
} }
public function enableProject($project_id) public function enableProject($project_id)
{ {
return $this->project->enable($project_id); return $this->projectModel->enable($project_id);
} }
public function disableProject($project_id) public function disableProject($project_id)
{ {
return $this->project->disable($project_id); return $this->projectModel->disable($project_id);
} }
public function enableProjectPublicAccess($project_id) public function enableProjectPublicAccess($project_id)
{ {
return $this->project->enablePublicAccess($project_id); return $this->projectModel->enablePublicAccess($project_id);
} }
public function disableProjectPublicAccess($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) public function getProjectActivities(array $project_ids)
@ -70,7 +70,7 @@ class ProjectApi extends BaseApi
); );
list($valid, ) = $this->projectValidator->validateCreation($values); 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) public function updateProject($id, $name, $description = null)
@ -82,6 +82,6 @@ class ProjectApi extends BaseApi
); );
list($valid, ) = $this->projectValidator->validateModification($values); list($valid, ) = $this->projectValidator->validateModification($values);
return $valid && $this->project->update($values); return $valid && $this->projectModel->update($values);
} }
} }

View File

@ -15,42 +15,42 @@ class ProjectPermissionApi extends Base
{ {
public function getProjectUsers($project_id) 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) 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) 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) 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) 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) 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) 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) 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 // Deprecated

View File

@ -14,17 +14,17 @@ class SubtaskApi extends Base
{ {
public function getSubtask($subtask_id) public function getSubtask($subtask_id)
{ {
return $this->subtask->getById($subtask_id); return $this->subtaskModel->getById($subtask_id);
} }
public function getAllSubtasks($task_id) public function getAllSubtasks($task_id)
{ {
return $this->subtask->getAll($task_id); return $this->subtaskModel->getAll($task_id);
} }
public function removeSubtask($subtask_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) 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); 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) 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); list($valid, ) = $this->subtaskValidator->validateApiModification($values);
return $valid && $this->subtask->update($values); return $valid && $this->subtaskModel->update($values);
} }
} }

View File

@ -14,37 +14,37 @@ class SwimlaneApi extends Base
{ {
public function getActiveSwimlanes($project_id) public function getActiveSwimlanes($project_id)
{ {
return $this->swimlane->getSwimlanes($project_id); return $this->swimlaneModel->getSwimlanes($project_id);
} }
public function getAllSwimlanes($project_id) public function getAllSwimlanes($project_id)
{ {
return $this->swimlane->getAll($project_id); return $this->swimlaneModel->getAll($project_id);
} }
public function getSwimlaneById($swimlane_id) public function getSwimlaneById($swimlane_id)
{ {
return $this->swimlane->getById($swimlane_id); return $this->swimlaneModel->getById($swimlane_id);
} }
public function getSwimlaneByName($project_id, $name) 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) public function getSwimlane($swimlane_id)
{ {
return $this->swimlane->getById($swimlane_id); return $this->swimlaneModel->getById($swimlane_id);
} }
public function getDefaultSwimlane($project_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 = '') 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) public function updateSwimlane($swimlane_id, $name, $description = null)
@ -55,26 +55,26 @@ class SwimlaneApi extends Base
$values['description'] = $description; $values['description'] = $description;
} }
return $this->swimlane->update($values); return $this->swimlaneModel->update($values);
} }
public function removeSwimlane($project_id, $swimlane_id) 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) 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) 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) 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);
} }
} }

View File

@ -3,7 +3,7 @@
namespace Kanboard\Api; namespace Kanboard\Api;
use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskProjectFilter;
use Kanboard\Model\Task as TaskModel; use Kanboard\Model\TaskModel;
/** /**
* Task API controller * Task API controller
@ -22,63 +22,63 @@ class TaskApi extends BaseApi
public function getTask($task_id) public function getTask($task_id)
{ {
$this->checkTaskPermission($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) public function getTaskByReference($project_id, $reference)
{ {
$this->checkProjectPermission($project_id); $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) public function getAllTasks($project_id, $status_id = TaskModel::STATUS_OPEN)
{ {
$this->checkProjectPermission($project_id); $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() public function getOverdueTasks()
{ {
return $this->taskFinder->getOverdueTasks(); return $this->taskFinderModel->getOverdueTasks();
} }
public function getOverdueTasksByProject($project_id) public function getOverdueTasksByProject($project_id)
{ {
$this->checkProjectPermission($project_id); $this->checkProjectPermission($project_id);
return $this->taskFinder->getOverdueTasksByProject($project_id); return $this->taskFinderModel->getOverdueTasksByProject($project_id);
} }
public function openTask($task_id) public function openTask($task_id)
{ {
$this->checkTaskPermission($task_id); $this->checkTaskPermission($task_id);
return $this->taskStatus->open($task_id); return $this->taskStatusModel->open($task_id);
} }
public function closeTask($task_id) public function closeTask($task_id)
{ {
$this->checkTaskPermission($task_id); $this->checkTaskPermission($task_id);
return $this->taskStatus->close($task_id); return $this->taskStatusModel->close($task_id);
} }
public function removeTask($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) public function moveTaskPosition($project_id, $task_id, $column_id, $position, $swimlane_id = 0)
{ {
$this->checkProjectPermission($project_id); $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) 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) 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, 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); $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; return false;
} }
@ -119,7 +119,7 @@ class TaskApi extends BaseApi
list($valid, ) = $this->taskValidator->validateCreation($values); 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, public function updateTask($id, $title = null, $color_id = null, $owner_id = null,
@ -129,13 +129,13 @@ class TaskApi extends BaseApi
{ {
$this->checkTaskPermission($id); $this->checkTaskPermission($id);
$project_id = $this->taskFinder->getProjectId($id); $project_id = $this->taskFinderModel->getProjectId($id);
if ($project_id === 0) { if ($project_id === 0) {
return false; 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; return false;
} }
@ -164,6 +164,6 @@ class TaskApi extends BaseApi
} }
list($valid) = $this->taskValidator->validateApiModification($values); list($valid) = $this->taskValidator->validateApiModification($values);
return $valid && $this->taskModification->update($values); return $valid && $this->taskModificationModel->update($values);
} }
} }

View File

@ -21,7 +21,7 @@ class TaskLinkApi extends Base
*/ */
public function getTaskLinkById($task_link_id) 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) 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) 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) 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) public function removeTaskLink($task_link_id)
{ {
return $this->taskLink->remove($task_link_id); return $this->taskLinkModel->remove($task_link_id);
} }
} }

View File

@ -19,37 +19,37 @@ class UserApi extends Base
{ {
public function getUser($user_id) public function getUser($user_id)
{ {
return $this->user->getById($user_id); return $this->userModel->getById($user_id);
} }
public function getUserByName($username) public function getUserByName($username)
{ {
return $this->user->getByUsername($username); return $this->userModel->getByUsername($username);
} }
public function getAllUsers() public function getAllUsers()
{ {
return $this->user->getAll(); return $this->userModel->getAll();
} }
public function removeUser($user_id) public function removeUser($user_id)
{ {
return $this->user->remove($user_id); return $this->userModel->remove($user_id);
} }
public function disableUser($user_id) public function disableUser($user_id)
{ {
return $this->user->disable($user_id); return $this->userModel->disable($user_id);
} }
public function enableUser($user_id) public function enableUser($user_id)
{ {
return $this->user->enable($user_id); return $this->userModel->enable($user_id);
} }
public function isActiveUser($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) 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); 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, 'is_ldap_user' => 1,
); );
return $this->user->create($values); return $this->userModel->create($values);
} catch (LdapException $e) { } catch (LdapException $e) {
$this->logger->error($e->getMessage()); $this->logger->error($e->getMessage());
@ -133,6 +133,6 @@ class UserApi extends Base
} }
list($valid, ) = $this->userValidator->validateApiModification($values); list($valid, ) = $this->userValidator->validateApiModification($values);
return $valid && $this->user->update($values); return $valid && $this->userModel->update($values);
} }
} }

View File

@ -5,7 +5,7 @@ namespace Kanboard\Auth;
use Kanboard\Core\Base; use Kanboard\Core\Base;
use Kanboard\Core\Security\PasswordAuthenticationProviderInterface; use Kanboard\Core\Security\PasswordAuthenticationProviderInterface;
use Kanboard\Core\Security\SessionCheckProviderInterface; use Kanboard\Core\Security\SessionCheckProviderInterface;
use Kanboard\Model\User; use Kanboard\Model\UserModel;
use Kanboard\User\DatabaseUserProvider; use Kanboard\User\DatabaseUserProvider;
/** /**
@ -60,7 +60,7 @@ class DatabaseAuth extends Base implements PasswordAuthenticationProviderInterfa
public function authenticate() public function authenticate()
{ {
$user = $this->db $user = $this->db
->table(User::TABLE) ->table(UserModel::TABLE)
->columns('id', 'password') ->columns('id', 'password')
->eq('username', $this->username) ->eq('username', $this->username)
->eq('disable_login_form', 0) ->eq('disable_login_form', 0)
@ -84,7 +84,7 @@ class DatabaseAuth extends Base implements PasswordAuthenticationProviderInterfa
*/ */
public function isValidSession() public function isValidSession()
{ {
return $this->user->isActive($this->userSession->getId()); return $this->userModel->isActive($this->userSession->getId());
} }
/** /**

View File

@ -44,16 +44,16 @@ class RememberMeAuth extends Base implements PreAuthenticationProviderInterface
$credentials = $this->rememberMeCookie->read(); $credentials = $this->rememberMeCookie->read();
if ($credentials !== false) { if ($credentials !== false) {
$session = $this->rememberMeSession->find($credentials['token'], $credentials['sequence']); $session = $this->rememberMeSessionModel->find($credentials['token'], $credentials['sequence']);
if (! empty($session)) { if (! empty($session)) {
$this->rememberMeCookie->write( $this->rememberMeCookie->write(
$session['token'], $session['token'],
$this->rememberMeSession->updateSequence($session['token']), $this->rememberMeSessionModel->updateSequence($session['token']),
$session['expiration'] $session['expiration']
); );
$this->userInfo = $this->user->getById($session['user_id']); $this->userInfo = $this->userModel->getById($session['user_id']);
return true; return true;
} }

View File

@ -11,24 +11,24 @@ use Symfony\Component\Console\Command\Command;
* @package console * @package console
* @author Frederic Guillot * @author Frederic Guillot
* *
* @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator * @property \Kanboard\Validator\PasswordResetValidator $passwordResetValidator
* @property \Kanboard\Export\SubtaskExport $subtaskExport * @property \Kanboard\Export\SubtaskExport $subtaskExport
* @property \Kanboard\Export\TaskExport $taskExport * @property \Kanboard\Export\TaskExport $taskExport
* @property \Kanboard\Export\TransitionExport $transitionExport * @property \Kanboard\Export\TransitionExport $transitionExport
* @property \Kanboard\Model\Notification $notification * @property \Kanboard\Model\NotificationModel $notificationModel
* @property \Kanboard\Model\Project $project * @property \Kanboard\Model\ProjectModel $projectModel
* @property \Kanboard\Model\ProjectPermission $projectPermission * @property \Kanboard\Model\ProjectPermissionModel $projectPermissionModel
* @property \Kanboard\Model\ProjectDailyColumnStats $projectDailyColumnStats * @property \Kanboard\Model\ProjectDailyColumnStatsModel $projectDailyColumnStatsModel
* @property \Kanboard\Model\ProjectDailyStats $projectDailyStats * @property \Kanboard\Model\ProjectDailyStatsModel $projectDailyStatsModel
* @property \Kanboard\Model\Task $task * @property \Kanboard\Model\TaskModel $taskModel
* @property \Kanboard\Model\TaskFinder $taskFinder * @property \Kanboard\Model\TaskFinderModel $taskFinderModel
* @property \Kanboard\Model\User $user * @property \Kanboard\Model\UserModel $userModel
* @property \Kanboard\Model\UserNotification $userNotification * @property \Kanboard\Model\UserNotificationModel $userNotificationModel
* @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter * @property \Kanboard\Model\UserNotificationFilterModel $userNotificationFilterModel
* @property \Kanboard\Model\ProjectUserRole $projectUserRole * @property \Kanboard\Model\ProjectUserRoleModel $projectUserRoleModel
* @property \Kanboard\Core\Plugin\Loader $pluginLoader * @property \Kanboard\Core\Plugin\Loader $pluginLoader
* @property \Kanboard\Core\Http\Client $httpClient * @property \Kanboard\Core\Http\Client $httpClient
* @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
*/ */
abstract class BaseCommand extends Command abstract class BaseCommand extends Command
{ {

View File

@ -21,7 +21,7 @@ class ProjectDailyColumnStatsExportCommand extends BaseCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$data = $this->projectDailyColumnStats->getAggregatedMetrics( $data = $this->projectDailyColumnStatsModel->getAggregatedMetrics(
$input->getArgument('project_id'), $input->getArgument('project_id'),
$input->getArgument('start_date'), $input->getArgument('start_date'),
$input->getArgument('end_date') $input->getArgument('end_date')

View File

@ -2,7 +2,7 @@
namespace Kanboard\Console; namespace Kanboard\Console;
use Kanboard\Model\Project; use Kanboard\Model\ProjectModel;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -17,12 +17,12 @@ class ProjectDailyStatsCalculationCommand extends BaseCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$projects = $this->project->getAllByStatus(Project::ACTIVE); $projects = $this->projectModel->getAllByStatus(ProjectModel::ACTIVE);
foreach ($projects as $project) { foreach ($projects as $project) {
$output->writeln('Run calculation for '.$project['name']); $output->writeln('Run calculation for '.$project['name']);
$this->projectDailyColumnStats->updateTotals($project['id'], date('Y-m-d')); $this->projectDailyColumnStatsModel->updateTotals($project['id'], date('Y-m-d'));
$this->projectDailyStats->updateTotals($project['id'], date('Y-m-d')); $this->projectDailyStatsModel->updateTotals($project['id'], date('Y-m-d'));
} }
} }
} }

View File

@ -60,14 +60,14 @@ class ResetPasswordCommand extends BaseCommand
private function resetPassword(OutputInterface $output, $username, $password) private function resetPassword(OutputInterface $output, $username, $password)
{ {
$userId = $this->user->getIdByUsername($username); $userId = $this->userModel->getIdByUsername($username);
if (empty($userId)) { if (empty($userId)) {
$output->writeln('<error>User not found</error>'); $output->writeln('<error>User not found</error>');
return false; 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>'); $output->writeln('<error>Unable to update password</error>');
return false; return false;
} }

View File

@ -19,14 +19,14 @@ class ResetTwoFactorCommand extends BaseCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$username = $input->getArgument('username'); $username = $input->getArgument('username');
$userId = $this->user->getIdByUsername($username); $userId = $this->userModel->getIdByUsername($username);
if (empty($userId)) { if (empty($userId)) {
$output->writeln('<error>User not found</error>'); $output->writeln('<error>User not found</error>');
return false; 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>'); $output->writeln('<error>Unable to update user profile</error>');
return false; return false;
} }

View File

@ -2,7 +2,7 @@
namespace Kanboard\Console; namespace Kanboard\Console;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
use Kanboard\Core\Security\Role; use Kanboard\Core\Security\Role;
use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -65,10 +65,10 @@ class TaskOverdueNotificationCommand extends BaseCommand
*/ */
public function sendGroupOverdueTaskNotifications() public function sendGroupOverdueTaskNotifications()
{ {
$tasks = $this->taskFinder->getOverdueTasks(); $tasks = $this->taskFinderModel->getOverdueTasks();
foreach ($this->groupByColumn($tasks, 'owner_id') as $user_tasks) { 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) { foreach ($users as $user) {
$this->sendUserOverdueTaskNotifications($user, $user_tasks); $this->sendUserOverdueTaskNotifications($user, $user_tasks);
@ -85,14 +85,14 @@ class TaskOverdueNotificationCommand extends BaseCommand
*/ */
public function sendOverdueTaskNotificationsToManagers() public function sendOverdueTaskNotificationsToManagers()
{ {
$tasks = $this->taskFinder->getOverdueTasks(); $tasks = $this->taskFinderModel->getOverdueTasks();
foreach ($this->groupByColumn($tasks, 'project_id') as $project_id => $project_tasks) { 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(); $managers = array();
foreach ($users as $user) { 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) { if($role == Role::PROJECT_MANAGER) {
$managers[] = $user; $managers[] = $user;
} }
@ -113,10 +113,10 @@ class TaskOverdueNotificationCommand extends BaseCommand
*/ */
public function sendOverdueTaskNotifications() public function sendOverdueTaskNotifications()
{ {
$tasks = $this->taskFinder->getOverdueTasks(); $tasks = $this->taskFinderModel->getOverdueTasks();
foreach ($this->groupByColumn($tasks, 'project_id') as $project_id => $project_tasks) { 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) { foreach ($users as $user) {
$this->sendUserOverdueTaskNotifications($user, $project_tasks); $this->sendUserOverdueTaskNotifications($user, $project_tasks);
@ -139,16 +139,16 @@ class TaskOverdueNotificationCommand extends BaseCommand
$project_names = array(); $project_names = array();
foreach ($tasks as $task) { foreach ($tasks as $task) {
if ($this->userNotificationFilter->shouldReceiveNotification($user, array('task' => $task))) { if ($this->userNotificationFilterModel->shouldReceiveNotification($user, array('task' => $task))) {
$user_tasks[] = $task; $user_tasks[] = $task;
$project_names[$task['project_id']] = $task['project_name']; $project_names[$task['project_id']] = $task['project_name'];
} }
} }
if (! empty($user_tasks)) { if (! empty($user_tasks)) {
$this->userNotification->sendUserNotification( $this->userNotificationModel->sendUserNotification(
$user, $user,
Task::EVENT_OVERDUE, TaskModel::EVENT_OVERDUE,
array('tasks' => $user_tasks, 'project_name' => implode(", ", $project_names)) array('tasks' => $user_tasks, 'project_name' => implode(", ", $project_names))
); );
} }
@ -163,9 +163,9 @@ class TaskOverdueNotificationCommand extends BaseCommand
*/ */
public function sendUserOverdueTaskNotificationsToManagers(array $manager, array $tasks) public function sendUserOverdueTaskNotificationsToManagers(array $manager, array $tasks)
{ {
$this->userNotification->sendUserNotification( $this->userNotificationModel->sendUserNotification(
$manager, $manager,
Task::EVENT_OVERDUE, TaskModel::EVENT_OVERDUE,
array('tasks' => $tasks, 'project_name' => $tasks[0]['project_name']) array('tasks' => $tasks, 'project_name' => $tasks[0]['project_name'])
); );
} }

View File

@ -4,7 +4,7 @@ namespace Kanboard\Console;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Kanboard\Model\Task; use Kanboard\Model\TaskModel;
use Kanboard\Event\TaskListEvent; use Kanboard\Event\TaskListEvent;
class TaskTriggerCommand extends BaseCommand class TaskTriggerCommand extends BaseCommand
@ -19,7 +19,7 @@ class TaskTriggerCommand extends BaseCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
foreach ($this->getProjectIds() as $project_id) { foreach ($this->getProjectIds() as $project_id) {
$tasks = $this->taskFinder->getAll($project_id); $tasks = $this->taskFinderModel->getAll($project_id);
$nb_tasks = count($tasks); $nb_tasks = count($tasks);
if ($nb_tasks > 0) { if ($nb_tasks > 0) {
@ -31,7 +31,7 @@ class TaskTriggerCommand extends BaseCommand
private function getProjectIds() private function getProjectIds()
{ {
$listeners = $this->dispatcher->getListeners(Task::EVENT_DAILY_CRONJOB); $listeners = $this->dispatcher->getListeners(TaskModel::EVENT_DAILY_CRONJOB);
$project_ids = array(); $project_ids = array();
foreach ($listeners as $listener) { foreach ($listeners as $listener) {
@ -46,6 +46,6 @@ class TaskTriggerCommand extends BaseCommand
$event = new TaskListEvent(array('project_id' => $project_id)); $event = new TaskListEvent(array('project_id' => $project_id));
$event->setTasks($tasks); $event->setTasks($tasks);
$this->dispatcher->dispatch(Task::EVENT_DAILY_CRONJOB, $event); $this->dispatcher->dispatch(TaskModel::EVENT_DAILY_CRONJOB, $event);
} }
} }

View File

@ -18,7 +18,7 @@ class ActionController extends BaseController
public function index() public function index()
{ {
$project = $this->getProject(); $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( $this->response->html($this->helper->layout->project('action/index', array(
'values' => array('project_id' => $project['id']), 'values' => array('project_id' => $project['id']),
@ -27,12 +27,12 @@ class ActionController extends BaseController
'available_actions' => $this->actionManager->getAvailableActions(), 'available_actions' => $this->actionManager->getAvailableActions(),
'available_events' => $this->eventManager->getAll(), 'available_events' => $this->eventManager->getAll(),
'available_params' => $this->actionManager->getAvailableParameters($actions), 'available_params' => $this->actionManager->getAvailableParameters($actions),
'columns_list' => $this->column->getList($project['id']), 'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()), 'projects_list' => $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId()),
'colors_list' => $this->color->getList(), 'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->category->getList($project['id']), 'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->link->getList(0, false), 'links_list' => $this->linkModel->getList(0, false),
'title' => t('Automatic actions') 'title' => t('Automatic actions')
))); )));
} }
@ -47,7 +47,7 @@ class ActionController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$this->response->html($this->helper->layout->project('action/remove', array( $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_events' => $this->eventManager->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(), 'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project, 'project' => $project,
@ -64,9 +64,9 @@ class ActionController extends BaseController
{ {
$this->checkCSRFParam(); $this->checkCSRFParam();
$project = $this->getProject(); $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.')); $this->flash->success(t('Action removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this action.')); $this->flash->failure(t('Unable to remove this action.'));

View File

@ -69,19 +69,19 @@ class ActionCreationController extends BaseController
$this->doCreation($project, $values + array('params' => array())); $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']]); unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array( $this->response->html($this->template->render('action_creation/params', array(
'values' => $values, 'values' => $values,
'action_params' => $action_params, 'action_params' => $action_params,
'columns_list' => $this->column->getList($project['id']), 'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list, 'projects_list' => $projects_list,
'colors_list' => $this->color->getList(), 'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->category->getList($project['id']), 'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->link->getList(0, false), 'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->project->getPriorities($project), 'priorities_list' => $this->projectModel->getPriorities($project),
'project' => $project, 'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(), 'available_actions' => $this->actionManager->getAvailableActions(),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
@ -110,7 +110,7 @@ class ActionCreationController extends BaseController
list($valid, ) = $this->actionValidator->validateCreation($values); list($valid, ) = $this->actionValidator->validateCreation($values);
if ($valid) { 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.')); $this->flash->success(t('Your automatic action have been created successfully.'));
} else { } else {
$this->flash->failure(t('Unable to create your automatic action.')); $this->flash->failure(t('Unable to create your automatic action.'));

View File

@ -38,7 +38,7 @@ class ActivityController extends BaseController
$this->response->html($this->helper->layout->task('activity/task', array( $this->response->html($this->helper->layout->task('activity/task', array(
'title' => $task['title'], 'title' => $task['title'],
'task' => $task, 'task' => $task,
'project' => $this->project->getById($task['project_id']), 'project' => $this->projectModel->getById($task['project_id']),
'events' => $this->helper->projectActivity->getTaskEvents($task['id']), 'events' => $this->helper->projectActivity->getTaskEvents($task['id']),
))); )));
} }

View File

@ -3,7 +3,7 @@
namespace Kanboard\Controller; namespace Kanboard\Controller;
use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskProjectFilter;
use Kanboard\Model\Task as TaskModel; use Kanboard\Model\TaskModel;
/** /**
* Project Analytic Controller * Project Analytic Controller
@ -30,8 +30,8 @@ class AnalyticController extends BaseController
), ),
'project' => $project, 'project' => $project,
'average' => $this->averageLeadCycleTimeAnalytic->build($project['id']), 'average' => $this->averageLeadCycleTimeAnalytic->build($project['id']),
'metrics' => $this->projectDailyStats->getRawMetrics($project['id'], $from, $to), 'metrics' => $this->projectDailyStatsModel->getRawMetrics($project['id'], $from, $to),
'date_format' => $this->config->get('application_date_format'), 'date_format' => $this->configModel->get('application_date_format'),
'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
'title' => t('Lead and Cycle time for "%s"', $project['name']), 'title' => t('Lead and Cycle time for "%s"', $project['name']),
))); )));
@ -145,7 +145,7 @@ class AnalyticController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
list($from, $to) = $this->getDates(); 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( $this->response->html($this->helper->layout->analytic($template, array(
'values' => array( 'values' => array(
@ -153,9 +153,9 @@ class AnalyticController extends BaseController
'to' => $to, 'to' => $to,
), ),
'display_graph' => $display_graph, '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, '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()), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
'title' => t($title, $project['name']), 'title' => t($title, $project['name']),
))); )));

View File

@ -23,7 +23,7 @@ class AuthController extends BaseController
$this->response->redirect($this->helper->url->to('DashboardController', 'show')); $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
} else { } else {
$this->response->html($this->helper->layout->app('auth/index', array( $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, 'errors' => $errors,
'values' => $values, 'values' => $values,
'no_layout' => true, 'no_layout' => true,

View File

@ -32,7 +32,7 @@ class AvatarFileController extends BaseController
{ {
$user = $this->getUser(); $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->flash->failure(t('Unable to upload the file.'));
} }
@ -46,7 +46,7 @@ class AvatarFileController extends BaseController
{ {
$this->checkCSRFParam(); $this->checkCSRFParam();
$user = $this->getUser(); $user = $this->getUser();
$this->avatarFile->remove($user['id']); $this->avatarFileModel->remove($user['id']);
$this->userSession->refresh($user['id']); $this->userSession->refresh($user['id']);
$this->response->redirect($this->helper->url->to('AvatarFileController', '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 AvatarFileController extends BaseController
{ {
$user_id = $this->request->getIntegerParam('user_id'); $user_id = $this->request->getIntegerParam('user_id');
$size = $this->request->getStringParam('size', 48); $size = $this->request->getStringParam('size', 48);
$filename = $this->avatarFile->getFilename($user_id); $filename = $this->avatarFileModel->getFilename($user_id);
$etag = md5($filename.$size); $etag = md5($filename.$size);
$this->response->withCache(365 * 86400, $etag); $this->response->withCache(365 * 86400, $etag);

View File

@ -33,7 +33,7 @@ abstract class BaseController extends Base
*/ */
protected function checkWebhookToken() 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); $this->response->text('Not Authorized', 401);
} }
} }
@ -49,7 +49,7 @@ abstract class BaseController extends Base
protected function getTask() protected function getTask()
{ {
$project_id = $this->request->getIntegerParam('project_id'); $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)) { if (empty($task)) {
throw new PageNotFoundException(); throw new PageNotFoundException();
@ -78,7 +78,7 @@ abstract class BaseController extends Base
if ($task_id > 0) { if ($task_id > 0) {
$model = 'taskFile'; $model = 'taskFile';
$project_id = $this->taskFinder->getProjectId($task_id); $project_id = $this->taskFinderModel->getProjectId($task_id);
if ($project_id !== $this->request->getIntegerParam('project_id')) { if ($project_id !== $this->request->getIntegerParam('project_id')) {
throw new AccessForbiddenException(); throw new AccessForbiddenException();
@ -106,7 +106,7 @@ abstract class BaseController extends Base
protected function getProject($project_id = 0) protected function getProject($project_id = 0)
{ {
$project_id = $this->request->getIntegerParam('project_id', $project_id); $project_id = $this->request->getIntegerParam('project_id', $project_id);
$project = $this->project->getByIdWithOwner($project_id); $project = $this->projectModel->getByIdWithOwner($project_id);
if (empty($project)) { if (empty($project)) {
throw new PageNotFoundException(); throw new PageNotFoundException();
@ -125,7 +125,7 @@ abstract class BaseController extends Base
*/ */
protected function getUser() 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)) { if (empty($user)) {
throw new PageNotFoundException(); throw new PageNotFoundException();
@ -147,7 +147,7 @@ abstract class BaseController extends Base
*/ */
protected function getSubtask() protected function getSubtask()
{ {
$subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id')); $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) { if (empty($subtask)) {
throw new PageNotFoundException(); throw new PageNotFoundException();

View File

@ -28,7 +28,7 @@ class BoardAjaxController extends BaseController
$values = $this->request->getJson(); $values = $this->request->getJson();
$result =$this->taskPosition->movePosition( $result =$this->taskPositionModel->movePosition(
$project_id, $project_id,
$values['task_id'], $values['task_id'],
$values['column_id'], $values['column_id'],
@ -55,7 +55,7 @@ class BoardAjaxController extends BaseController
if (! $project_id || ! $this->request->isAjax()) { if (! $project_id || ! $this->request->isAjax()) {
throw new AccessForbiddenException(); throw new AccessForbiddenException();
} elseif (! $this->project->isModifiedSince($project_id, $timestamp)) { } elseif (! $this->projectModel->isModifiedSince($project_id, $timestamp)) {
$this->response->status(304); $this->response->status(304);
} else { } else {
$this->response->html($this->renderBoard($project_id)); $this->response->html($this->renderBoard($project_id));
@ -129,9 +129,9 @@ class BoardAjaxController extends BaseController
protected function renderBoard($project_id) protected function renderBoard($project_id)
{ {
return $this->template->render('board/table_container', array( return $this->template->render('board/table_container', array(
'project' => $this->project->getById($project_id), 'project' => $this->projectModel->getById($project_id),
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'),
'board_highlight_period' => $this->config->get('board_highlight_period'), 'board_highlight_period' => $this->configModel->get('board_highlight_period'),
'swimlanes' => $this->taskLexer 'swimlanes' => $this->taskLexer
->build($this->userSession->getFilters($project_id)) ->build($this->userSession->getFilters($project_id))
->format(BoardFormatter::getInstance($this->container)->setProjectId($project_id)) ->format(BoardFormatter::getInstance($this->container)->setProjectId($project_id))

View File

@ -23,9 +23,9 @@ class BoardPopoverController extends BaseController
$this->response->html($this->template->render('board_popover/close_all_tasks_column', array( $this->response->html($this->template->render('board_popover/close_all_tasks_column', array(
'project' => $project, 'project' => $project,
'nb_tasks' => $this->taskFinder->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id), 'nb_tasks' => $this->taskFinderModel->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id),
'column' => $this->column->getColumnTitleById($column_id), 'column' => $this->columnModel->getColumnTitleById($column_id),
'swimlane' => $this->swimlane->getNameById($swimlane_id) ?: t($project['default_swimlane']), 'swimlane' => $this->swimlaneModel->getNameById($swimlane_id) ?: t($project['default_swimlane']),
'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id), 'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id),
))); )));
} }
@ -40,8 +40,8 @@ class BoardPopoverController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$values = $this->request->getValues(); $values = $this->request->getValues();
$this->taskStatus->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_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->column->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); $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']))); $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])));
} }
} }

View File

@ -19,7 +19,7 @@ class BoardTooltipController extends BaseController
{ {
$task = $this->getTask(); $task = $this->getTask();
$this->response->html($this->template->render('board/tooltip_tasklinks', array( $this->response->html($this->template->render('board/tooltip_tasklinks', array(
'links' => $this->taskLink->getAllGroupedByLabel($task['id']), 'links' => $this->taskLinkModel->getAllGroupedByLabel($task['id']),
'task' => $task, 'task' => $task,
))); )));
} }
@ -33,7 +33,7 @@ class BoardTooltipController extends BaseController
{ {
$task = $this->getTask(); $task = $this->getTask();
$this->response->html($this->template->render('board/tooltip_external_links', array( $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, 'task' => $task,
))); )));
} }
@ -47,7 +47,7 @@ class BoardTooltipController extends BaseController
{ {
$task = $this->getTask(); $task = $this->getTask();
$this->response->html($this->template->render('board/tooltip_subtasks', array( $this->response->html($this->template->render('board/tooltip_subtasks', array(
'subtasks' => $this->subtask->getAll($task['id']), 'subtasks' => $this->subtaskModel->getAll($task['id']),
'task' => $task, 'task' => $task,
))); )));
} }
@ -62,7 +62,7 @@ class BoardTooltipController extends BaseController
$task = $this->getTask(); $task = $this->getTask();
$this->response->html($this->template->render('board/tooltip_files', array( $this->response->html($this->template->render('board/tooltip_files', array(
'files' => $this->taskFile->getAll($task['id']), 'files' => $this->taskFileModel->getAll($task['id']),
'task' => $task, 'task' => $task,
))); )));
} }
@ -78,7 +78,7 @@ class BoardTooltipController extends BaseController
$this->response->html($this->template->render('board/tooltip_comments', array( $this->response->html($this->template->render('board/tooltip_comments', array(
'task' => $task, 'task' => $task,
'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()) 'comments' => $this->commentModel->getAll($task['id'], $this->userSession->getCommentSorting())
))); )));
} }
@ -107,9 +107,9 @@ class BoardTooltipController extends BaseController
$this->response->html($this->template->render('task_recurrence/info', array( $this->response->html($this->template->render('task_recurrence/info', array(
'task' => $task, 'task' => $task,
'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), 'recurrence_trigger_list' => $this->taskModel->getRecurrenceTriggerList(),
'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), 'recurrence_timeframe_list' => $this->taskModel->getRecurrenceTimeframeList(),
'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), 'recurrence_basedate_list' => $this->taskModel->getRecurrenceBasedateList(),
))); )));
} }
@ -121,7 +121,7 @@ class BoardTooltipController extends BaseController
public function swimlane() public function swimlane()
{ {
$this->getProject(); $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))); $this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane)));
} }
} }

View File

@ -22,7 +22,7 @@ class BoardViewController extends BaseController
public function readonly() public function readonly()
{ {
$token = $this->request->getStringParam('token'); $token = $this->request->getStringParam('token');
$project = $this->project->getByToken($token); $project = $this->projectModel->getByToken($token);
if (empty($project)) { if (empty($project)) {
throw AccessForbiddenException::getInstance()->withoutLayout(); throw AccessForbiddenException::getInstance()->withoutLayout();
@ -30,14 +30,14 @@ class BoardViewController extends BaseController
$this->response->html($this->helper->layout->app('board/view_public', array( $this->response->html($this->helper->layout->app('board/view_public', array(
'project' => $project, 'project' => $project,
'swimlanes' => $this->board->getBoard($project['id']), 'swimlanes' => $this->boardModel->getBoard($project['id']),
'title' => $project['name'], 'title' => $project['name'],
'description' => $project['description'], 'description' => $project['description'],
'no_layout' => true, 'no_layout' => true,
'not_editable' => true, 'not_editable' => true,
'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'), 'board_public_refresh_interval' => $this->configModel->get('board_public_refresh_interval'),
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'),
'board_highlight_period' => $this->config->get('board_highlight_period'), 'board_highlight_period' => $this->configModel->get('board_highlight_period'),
))); )));
} }
@ -55,8 +55,8 @@ class BoardViewController extends BaseController
'project' => $project, 'project' => $project,
'title' => $project['name'], 'title' => $project['name'],
'description' => $this->helper->projectHeader->getDescription($project), 'description' => $this->helper->projectHeader->getDescription($project),
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_private_refresh_interval' => $this->configModel->get('board_private_refresh_interval'),
'board_highlight_period' => $this->config->get('board_highlight_period'), 'board_highlight_period' => $this->configModel->get('board_highlight_period'),
'swimlanes' => $this->taskLexer 'swimlanes' => $this->taskLexer
->build($search) ->build($search)
->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id'])) ->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id']))

View File

@ -5,7 +5,7 @@ namespace Kanboard\Controller;
use Kanboard\Filter\TaskAssigneeFilter; use Kanboard\Filter\TaskAssigneeFilter;
use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskProjectFilter;
use Kanboard\Filter\TaskStatusFilter; use Kanboard\Filter\TaskStatusFilter;
use Kanboard\Model\Task as TaskModel; use Kanboard\Model\TaskModel;
/** /**
* Calendar Controller * Calendar Controller
@ -29,7 +29,7 @@ class CalendarController extends BaseController
'project' => $project, 'project' => $project,
'title' => $project['name'], 'title' => $project['name'],
'description' => $this->helper->projectHeader->getDescription($project), 'description' => $this->helper->projectHeader->getDescription($project),
'check_interval' => $this->config->get('board_private_refresh_interval'), 'check_interval' => $this->configModel->get('board_private_refresh_interval'),
))); )));
} }
@ -75,7 +75,7 @@ class CalendarController extends BaseController
$events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end); $events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end);
$events = array_merge($events, $this->helper->calendar->getTaskEvents(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)); $events = array_merge($events, $this->helper->calendar->getSubtaskTimeTrackingEvents($user_id, $start, $end));
} }
@ -98,7 +98,7 @@ class CalendarController extends BaseController
if ($this->request->isAjax() && $this->request->isPost()) { if ($this->request->isAjax() && $this->request->isPost()) {
$values = $this->request->getJson(); $values = $this->request->getJson();
$this->taskModification->update(array( $this->taskModificationModel->update(array(
'id' => $values['task_id'], 'id' => $values['task_id'],
'date_due' => substr($values['date_due'], 0, 10), 'date_due' => substr($values['date_due'], 0, 10),
)); ));

View File

@ -21,7 +21,7 @@ class CategoryController extends BaseController
*/ */
private function getCategory() private function getCategory()
{ {
$category = $this->category->getById($this->request->getIntegerParam('category_id')); $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) { if (empty($category)) {
throw new PageNotFoundException(); throw new PageNotFoundException();
@ -43,7 +43,7 @@ class CategoryController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$this->response->html($this->helper->layout->project('category/index', array( $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']), 'values' => $values + array('project_id' => $project['id']),
'errors' => $errors, 'errors' => $errors,
'project' => $project, 'project' => $project,
@ -64,7 +64,7 @@ class CategoryController extends BaseController
list($valid, $errors) = $this->categoryValidator->validateCreation($values); list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->category->create($values)) { if ($this->categoryModel->create($values)) {
$this->flash->success(t('Your category have been created successfully.')); $this->flash->success(t('Your category have been created successfully.'));
return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
} else { } else {
@ -109,7 +109,7 @@ class CategoryController extends BaseController
list($valid, $errors) = $this->categoryValidator->validateModification($values); list($valid, $errors) = $this->categoryValidator->validateModification($values);
if ($valid) { if ($valid) {
if ($this->category->update($values)) { if ($this->categoryModel->update($values)) {
$this->flash->success(t('Your category have been updated successfully.')); $this->flash->success(t('Your category have been updated successfully.'));
return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
} else { } else {
@ -148,7 +148,7 @@ class CategoryController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$category = $this->getCategory(); $category = $this->getCategory();
if ($this->category->remove($category['id'])) { if ($this->categoryModel->remove($category['id'])) {
$this->flash->success(t('Category removed successfully.')); $this->flash->success(t('Category removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this category.')); $this->flash->failure(t('Unable to remove this category.'));

View File

@ -20,7 +20,7 @@ class ColumnController extends BaseController
public function index() public function index()
{ {
$project = $this->getProject(); $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( $this->response->html($this->helper->layout->project('column/index', array(
'columns' => $columns, 'columns' => $columns,
@ -66,7 +66,7 @@ class ColumnController extends BaseController
list($valid, $errors) = $this->columnValidator->validateCreation($values); list($valid, $errors) = $this->columnValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->column->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) { if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) {
$this->flash->success(t('Column created successfully.')); $this->flash->success(t('Column created successfully.'));
return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);
} else { } else {
@ -87,7 +87,7 @@ class ColumnController extends BaseController
public function edit(array $values = array(), array $errors = array()) public function edit(array $values = array(), array $errors = array())
{ {
$project = $this->getProject(); $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( $this->response->html($this->helper->layout->project('column/edit', array(
'errors' => $errors, 'errors' => $errors,
@ -111,7 +111,7 @@ class ColumnController extends BaseController
list($valid, $errors) = $this->columnValidator->validateModification($values); list($valid, $errors) = $this->columnValidator->validateModification($values);
if ($valid) { 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.')); $this->flash->success(t('Board updated successfully.'));
return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
} else { } else {
@ -133,7 +133,7 @@ class ColumnController extends BaseController
$values = $this->request->getJson(); $values = $this->request->getJson();
if (! empty($values) && isset($values['column_id']) && isset($values['position'])) { 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)); $this->response->json(array('result' => $result));
} else { } else {
throw new AccessForbiddenException(); throw new AccessForbiddenException();
@ -150,7 +150,7 @@ class ColumnController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$this->response->html($this->helper->layout->project('column/remove', array( $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, 'project' => $project,
'title' => t('Remove a column from a board') 'title' => t('Remove a column from a board')
))); )));
@ -167,7 +167,7 @@ class ColumnController extends BaseController
$this->checkCSRFParam(); $this->checkCSRFParam();
$column_id = $this->request->getIntegerParam('column_id'); $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.')); $this->flash->success(t('Column removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this column.')); $this->flash->failure(t('Unable to remove this column.'));

View File

@ -23,7 +23,7 @@ class CommentController extends BaseController
*/ */
private function getComment() private function getComment()
{ {
$comment = $this->comment->getById($this->request->getIntegerParam('comment_id')); $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id'));
if (empty($comment)) { if (empty($comment)) {
throw new PageNotFoundException(); throw new PageNotFoundException();
@ -76,7 +76,7 @@ class CommentController extends BaseController
list($valid, $errors) = $this->commentValidator->validateCreation($values); list($valid, $errors) = $this->commentValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->comment->create($values)) { if ($this->commentModel->create($values)) {
$this->flash->success(t('Comment added successfully.')); $this->flash->success(t('Comment added successfully.'));
} else { } else {
$this->flash->failure(t('Unable to create your comment.')); $this->flash->failure(t('Unable to create your comment.'));
@ -125,7 +125,7 @@ class CommentController extends BaseController
list($valid, $errors) = $this->commentValidator->validateModification($values); list($valid, $errors) = $this->commentValidator->validateModification($values);
if ($valid) { if ($valid) {
if ($this->comment->update($values)) { if ($this->commentModel->update($values)) {
$this->flash->success(t('Comment updated successfully.')); $this->flash->success(t('Comment updated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to update your comment.')); $this->flash->failure(t('Unable to update your comment.'));
@ -165,7 +165,7 @@ class CommentController extends BaseController
$task = $this->getTask(); $task = $this->getTask();
$comment = $this->getComment(); $comment = $this->getComment();
if ($this->comment->remove($comment['id'])) { if ($this->commentModel->remove($comment['id'])) {
$this->flash->success(t('Comment removed successfully.')); $this->flash->success(t('Comment removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this comment.')); $this->flash->failure(t('Unable to remove this comment.'));

View File

@ -18,7 +18,7 @@ class ConfigController extends BaseController
public function index() public function index()
{ {
$this->response->html($this->helper->layout->config('config/about', array( $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(), 'db_version' => $this->db->getDriver()->getDatabaseVersion(),
'user_agent' => $this->request->getServerVariable('HTTP_USER_AGENT'), 'user_agent' => $this->request->getServerVariable('HTTP_USER_AGENT'),
'title' => t('Settings').' &gt; '.t('About'), 'title' => t('Settings').' &gt; '.t('About'),
@ -54,8 +54,8 @@ class ConfigController extends BaseController
break; break;
} }
if ($this->config->save($values)) { if ($this->configModel->save($values)) {
$this->language->loadCurrentLanguage(); $this->languageModel->loadCurrentLanguage();
$this->flash->success(t('Settings saved successfully.')); $this->flash->success(t('Settings saved successfully.'));
} else { } else {
$this->flash->failure(t('Unable to save your settings.')); $this->flash->failure(t('Unable to save your settings.'));
@ -72,8 +72,8 @@ class ConfigController extends BaseController
public function application() public function application()
{ {
$this->response->html($this->helper->layout->config('config/application', array( $this->response->html($this->helper->layout->config('config/application', array(
'languages' => $this->language->getLanguages(), 'languages' => $this->languageModel->getLanguages(),
'timezones' => $this->timezone->getTimezones(), 'timezones' => $this->timezoneModel->getTimezones(),
'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
'datetime_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateTimeFormats()), 'datetime_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateTimeFormats()),
'time_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getTimeFormats()), 'time_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getTimeFormats()),
@ -89,8 +89,8 @@ class ConfigController extends BaseController
public function project() public function project()
{ {
$this->response->html($this->helper->layout->config('config/project', array( $this->response->html($this->helper->layout->config('config/project', array(
'colors' => $this->color->getList(), 'colors' => $this->colorModel->getList(),
'default_columns' => implode(', ', $this->board->getDefaultColumns()), 'default_columns' => implode(', ', $this->boardModel->getDefaultColumns()),
'title' => t('Settings').' &gt; '.t('Project settings'), 'title' => t('Settings').' &gt; '.t('Project settings'),
))); )));
} }
@ -164,7 +164,7 @@ class ConfigController extends BaseController
{ {
$this->checkCSRFParam(); $this->checkCSRFParam();
$this->response->withFileDownload('db.sqlite.gz'); $this->response->withFileDownload('db.sqlite.gz');
$this->response->binary($this->config->downloadDatabase()); $this->response->binary($this->configModel->downloadDatabase());
} }
/** /**
@ -175,7 +175,7 @@ class ConfigController extends BaseController
public function optimizeDb() public function optimizeDb()
{ {
$this->checkCSRFParam(); $this->checkCSRFParam();
$this->config->optimizeDatabase(); $this->configModel->optimizeDatabase();
$this->flash->success(t('Database optimization done.')); $this->flash->success(t('Database optimization done.'));
$this->response->redirect($this->helper->url->to('ConfigController', 'index')); $this->response->redirect($this->helper->url->to('ConfigController', 'index'));
} }
@ -190,7 +190,7 @@ class ConfigController extends BaseController
$type = $this->request->getStringParam('type'); $type = $this->request->getStringParam('type');
$this->checkCSRFParam(); $this->checkCSRFParam();
$this->config->regenerateToken($type.'_token'); $this->configModel->regenerateToken($type.'_token');
$this->flash->success(t('Token regenerated.')); $this->flash->success(t('Token regenerated.'));
$this->response->redirect($this->helper->url->to('ConfigController', $type)); $this->response->redirect($this->helper->url->to('ConfigController', $type));

View File

@ -20,11 +20,11 @@ class CurrencyController extends BaseController
public function index(array $values = array(), array $errors = array()) public function index(array $values = array(), array $errors = array())
{ {
$this->response->html($this->helper->layout->config('currency/index', 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, 'values' => $values,
'errors' => $errors, 'errors' => $errors,
'rates' => $this->currency->getAll(), 'rates' => $this->currencyModel->getAll(),
'currencies' => $this->currency->getCurrencies(), 'currencies' => $this->currencyModel->getCurrencies(),
'title' => t('Settings').' &gt; '.t('Currency rates'), 'title' => t('Settings').' &gt; '.t('Currency rates'),
))); )));
} }
@ -40,7 +40,7 @@ class CurrencyController extends BaseController
list($valid, $errors) = $this->currencyValidator->validateCreation($values); list($valid, $errors) = $this->currencyValidator->validateCreation($values);
if ($valid) { 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.')); $this->flash->success(t('The currency rate have been added successfully.'));
return $this->response->redirect($this->helper->url->to('CurrencyController', 'index')); return $this->response->redirect($this->helper->url->to('CurrencyController', 'index'));
} else { } else {
@ -60,7 +60,7 @@ class CurrencyController extends BaseController
{ {
$values = $this->request->getValues(); $values = $this->request->getValues();
if ($this->config->save($values)) { if ($this->configModel->save($values)) {
$this->flash->success(t('Settings saved successfully.')); $this->flash->success(t('Settings saved successfully.'));
} else { } else {
$this->flash->failure(t('Unable to save your settings.')); $this->flash->failure(t('Unable to save your settings.'));

View File

@ -27,7 +27,7 @@ class CustomFilterController extends BaseController
'values' => $values + array('project_id' => $project['id']), 'values' => $values + array('project_id' => $project['id']),
'errors' => $errors, 'errors' => $errors,
'project' => $project, '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'), 'title' => t('Custom filters'),
))); )));
} }
@ -47,7 +47,7 @@ class CustomFilterController extends BaseController
list($valid, $errors) = $this->customFilterValidator->validateCreation($values); list($valid, $errors) = $this->customFilterValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->customFilter->create($values)) { if ($this->customFilterModel->create($values)) {
$this->flash->success(t('Your custom filter have been created successfully.')); $this->flash->success(t('Your custom filter have been created successfully.'));
return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} else { } else {
@ -66,7 +66,7 @@ class CustomFilterController extends BaseController
public function confirm() public function confirm()
{ {
$project = $this->getProject(); $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( $this->response->html($this->helper->layout->project('custom_filter/remove', array(
'project' => $project, 'project' => $project,
@ -84,11 +84,11 @@ class CustomFilterController extends BaseController
{ {
$this->checkCSRFParam(); $this->checkCSRFParam();
$project = $this->getProject(); $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); $this->checkPermission($project, $filter);
if ($this->customFilter->remove($filter['id'])) { if ($this->customFilterModel->remove($filter['id'])) {
$this->flash->success(t('Custom filter removed successfully.')); $this->flash->success(t('Custom filter removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this custom filter.')); $this->flash->failure(t('Unable to remove this custom filter.'));
@ -105,7 +105,7 @@ class CustomFilterController extends BaseController
public function edit(array $values = array(), array $errors = array()) public function edit(array $values = array(), array $errors = array())
{ {
$project = $this->getProject(); $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); $this->checkPermission($project, $filter);
@ -126,7 +126,7 @@ class CustomFilterController extends BaseController
public function update() public function update()
{ {
$project = $this->getProject(); $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); $this->checkPermission($project, $filter);
@ -143,7 +143,7 @@ class CustomFilterController extends BaseController
list($valid, $errors) = $this->customFilterValidator->validateModification($values); list($valid, $errors) = $this->customFilterValidator->validateModification($values);
if ($valid) { if ($valid) {
if ($this->customFilter->update($values)) { if ($this->customFilterModel->update($values)) {
$this->flash->success(t('Your custom filter have been updated successfully.')); $this->flash->success(t('Your custom filter have been updated successfully.'));
return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} else { } else {
@ -158,7 +158,7 @@ class CustomFilterController extends BaseController
{ {
$user_id = $this->userSession->getId(); $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(); throw new AccessForbiddenException();
} }
} }

View File

@ -2,8 +2,8 @@
namespace Kanboard\Controller; namespace Kanboard\Controller;
use Kanboard\Model\Project as ProjectModel; use Kanboard\Model\ProjectModel;
use Kanboard\Model\Subtask as SubtaskModel; use Kanboard\Model\SubtaskModel;
/** /**
* Dashboard Controller * Dashboard Controller
@ -28,7 +28,7 @@ class DashboardController extends BaseController
->setUrl('DashboardController', $action, array('pagination' => 'projects', 'user_id' => $user_id)) ->setUrl('DashboardController', $action, array('pagination' => 'projects', 'user_id' => $user_id))
->setMax($max) ->setMax($max)
->setOrder(ProjectModel::TABLE.'.name') ->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'); ->calculateOnlyIf($this->request->getStringParam('pagination') === 'projects');
} }
@ -47,7 +47,7 @@ class DashboardController extends BaseController
->setUrl('DashboardController', $action, array('pagination' => 'tasks', 'user_id' => $user_id)) ->setUrl('DashboardController', $action, array('pagination' => 'tasks', 'user_id' => $user_id))
->setMax($max) ->setMax($max)
->setOrder('tasks.id') ->setOrder('tasks.id')
->setQuery($this->taskFinder->getUserQuery($user_id)) ->setQuery($this->taskFinderModel->getUserQuery($user_id))
->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks'); ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks');
} }
@ -66,7 +66,7 @@ class DashboardController extends BaseController
->setUrl('DashboardController', $action, array('pagination' => 'subtasks', 'user_id' => $user_id)) ->setUrl('DashboardController', $action, array('pagination' => 'subtasks', 'user_id' => $user_id))
->setMax($max) ->setMax($max)
->setOrder('tasks.id') ->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'); ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks');
} }
@ -147,7 +147,7 @@ class DashboardController extends BaseController
$this->response->html($this->helper->layout->dashboard('dashboard/activity', array( $this->response->html($this->helper->layout->dashboard('dashboard/activity', array(
'title' => t('My activity stream'), '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, 'user' => $user,
))); )));
} }
@ -176,7 +176,7 @@ class DashboardController extends BaseController
$this->response->html($this->helper->layout->dashboard('dashboard/notifications', array( $this->response->html($this->helper->layout->dashboard('dashboard/notifications', array(
'title' => t('My notifications'), 'title' => t('My notifications'),
'notifications' => $this->userUnreadNotification->getAll($user['id']), 'notifications' => $this->userUnreadNotificationModel->getAll($user['id']),
'user' => $user, 'user' => $user,
))); )));
} }

View File

@ -20,7 +20,7 @@ class DocumentationController extends BaseController
$page = 'index'; $page = 'index';
} }
if ($this->language->getCurrentLanguage() === 'fr_FR') { if ($this->languageModel->getCurrentLanguage() === 'fr_FR') {
$filename = __DIR__.'/../../doc/fr/' . $page . '.markdown'; $filename = __DIR__.'/../../doc/fr/' . $page . '.markdown';
} else { } else {
$filename = __DIR__ . '/../../doc/' . $page . '.markdown'; $filename = __DIR__ . '/../../doc/' . $page . '.markdown';
@ -83,7 +83,7 @@ class DocumentationController extends BaseController
*/ */
public function replaceImageUrl(array $matches) 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].')'; return '('.$this->helper->url->base().'doc/fr/'.$matches[1].')';
} }

View File

@ -42,7 +42,7 @@ class ExportController extends BaseController
'to' => $to, 'to' => $to,
), ),
'errors' => array(), '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()), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
'project' => $project, 'project' => $project,
'title' => $page_title, 'title' => $page_title,

View File

@ -20,7 +20,7 @@ class FeedController extends BaseController
public function user() public function user()
{ {
$token = $this->request->getStringParam('token'); $token = $this->request->getStringParam('token');
$user = $this->user->getByToken($token); $user = $this->userModel->getByToken($token);
// Token verification // Token verification
if (empty($user)) { if (empty($user)) {
@ -28,7 +28,7 @@ class FeedController extends BaseController
} }
$this->response->xml($this->template->render('feed/user', array( $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, 'user' => $user,
))); )));
} }
@ -41,7 +41,7 @@ class FeedController extends BaseController
public function project() public function project()
{ {
$token = $this->request->getStringParam('token'); $token = $this->request->getStringParam('token');
$project = $this->project->getByToken($token); $project = $this->projectModel->getByToken($token);
if (empty($project)) { if (empty($project)) {
throw AccessForbiddenException::getInstance()->withoutLayout(); throw AccessForbiddenException::getInstance()->withoutLayout();

View File

@ -36,7 +36,7 @@ class GroupCreationController extends BaseController
list($valid, $errors) = $this->groupValidator->validateCreation($values); list($valid, $errors) = $this->groupValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->group->create($values['name']) !== false) { if ($this->groupModel->create($values['name']) !== false) {
$this->flash->success(t('Group created successfully.')); $this->flash->success(t('Group created successfully.'));
return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true); return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true);
} else { } else {

View File

@ -21,7 +21,7 @@ class GroupListController extends BaseController
->setUrl('GroupListController', 'index') ->setUrl('GroupListController', 'index')
->setMax(30) ->setMax(30)
->setOrder('name') ->setOrder('name')
->setQuery($this->group->getQuery()) ->setQuery($this->groupModel->getQuery())
->calculate(); ->calculate();
$this->response->html($this->helper->layout->app('group/index', array( $this->response->html($this->helper->layout->app('group/index', array(
@ -38,13 +38,13 @@ class GroupListController extends BaseController
public function users() public function users()
{ {
$group_id = $this->request->getIntegerParam('group_id'); $group_id = $this->request->getIntegerParam('group_id');
$group = $this->group->getById($group_id); $group = $this->groupModel->getById($group_id);
$paginator = $this->paginator $paginator = $this->paginator
->setUrl('GroupListController', 'users', array('group_id' => $group_id)) ->setUrl('GroupListController', 'users', array('group_id' => $group_id))
->setMax(30) ->setMax(30)
->setOrder('username') ->setOrder('username')
->setQuery($this->groupMember->getQuery($group_id)) ->setQuery($this->groupMemberModel->getQuery($group_id))
->calculate(); ->calculate();
$this->response->html($this->helper->layout->app('group/users', array( $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()) public function associate(array $values = array(), array $errors = array())
{ {
$group_id = $this->request->getIntegerParam('group_id'); $group_id = $this->request->getIntegerParam('group_id');
$group = $this->group->getById($group_id); $group = $this->groupModel->getById($group_id);
if (empty($values)) { if (empty($values)) {
$values['group_id'] = $group_id; $values['group_id'] = $group_id;
} }
$this->response->html($this->template->render('group/associate', array( $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, 'group' => $group,
'errors' => $errors, 'errors' => $errors,
'values' => $values, 'values' => $values,
@ -88,7 +88,7 @@ class GroupListController extends BaseController
$values = $this->request->getValues(); $values = $this->request->getValues();
if (isset($values['group_id']) && isset($values['user_id'])) { 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.')); $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); return $this->response->redirect($this->helper->url->to('GroupListController', 'users', array('group_id' => $values['group_id'])), true);
} else { } else {
@ -108,8 +108,8 @@ class GroupListController extends BaseController
{ {
$group_id = $this->request->getIntegerParam('group_id'); $group_id = $this->request->getIntegerParam('group_id');
$user_id = $this->request->getIntegerParam('user_id'); $user_id = $this->request->getIntegerParam('user_id');
$group = $this->group->getById($group_id); $group = $this->groupModel->getById($group_id);
$user = $this->user->getById($user_id); $user = $this->userModel->getById($user_id);
$this->response->html($this->template->render('group/dissociate', array( $this->response->html($this->template->render('group/dissociate', array(
'group' => $group, 'group' => $group,
@ -128,7 +128,7 @@ class GroupListController extends BaseController
$group_id = $this->request->getIntegerParam('group_id'); $group_id = $this->request->getIntegerParam('group_id');
$user_id = $this->request->getIntegerParam('user_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.')); $this->flash->success(t('User removed successfully from this group.'));
} else { } else {
$this->flash->failure(t('Unable to remove this user from the group.')); $this->flash->failure(t('Unable to remove this user from the group.'));
@ -145,7 +145,7 @@ class GroupListController extends BaseController
public function confirm() public function confirm()
{ {
$group_id = $this->request->getIntegerParam('group_id'); $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( $this->response->html($this->template->render('group/remove', array(
'group' => $group, 'group' => $group,
@ -162,7 +162,7 @@ class GroupListController extends BaseController
$this->checkCSRFParam(); $this->checkCSRFParam();
$group_id = $this->request->getIntegerParam('group_id'); $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.')); $this->flash->success(t('Group removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this group.')); $this->flash->failure(t('Unable to remove this group.'));

View File

@ -20,7 +20,7 @@ class GroupModificationController extends BaseController
public function show(array $values = array(), array $errors = array()) public function show(array $values = array(), array $errors = array())
{ {
if (empty($values)) { 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( $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); list($valid, $errors) = $this->groupValidator->validateModification($values);
if ($valid) { if ($valid) {
if ($this->group->update($values) !== false) { if ($this->groupModel->update($values) !== false) {
$this->flash->success(t('Group updated successfully.')); $this->flash->success(t('Group updated successfully.'));
return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true); return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true);
} else { } else {

View File

@ -8,7 +8,7 @@ use Kanboard\Filter\TaskAssigneeFilter;
use Kanboard\Filter\TaskProjectFilter; use Kanboard\Filter\TaskProjectFilter;
use Kanboard\Filter\TaskStatusFilter; use Kanboard\Filter\TaskStatusFilter;
use Kanboard\Formatter\TaskICalFormatter; use Kanboard\Formatter\TaskICalFormatter;
use Kanboard\Model\Task as TaskModel; use Kanboard\Model\TaskModel;
use Eluceo\iCal\Component\Calendar as iCalendar; use Eluceo\iCal\Component\Calendar as iCalendar;
/** /**
@ -27,7 +27,7 @@ class ICalendarController extends BaseController
public function user() public function user()
{ {
$token = $this->request->getStringParam('token'); $token = $this->request->getStringParam('token');
$user = $this->user->getByToken($token); $user = $this->userModel->getByToken($token);
// Token verification // Token verification
if (empty($user)) { if (empty($user)) {
@ -37,7 +37,7 @@ class ICalendarController extends BaseController
// Common filter // Common filter
$queryBuilder = new QueryBuilder(); $queryBuilder = new QueryBuilder();
$queryBuilder $queryBuilder
->withQuery($this->taskFinder->getICalQuery()) ->withQuery($this->taskFinderModel->getICalQuery())
->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN))
->withFilter(new TaskAssigneeFilter($user['id'])); ->withFilter(new TaskAssigneeFilter($user['id']));
@ -58,7 +58,7 @@ class ICalendarController extends BaseController
public function project() public function project()
{ {
$token = $this->request->getStringParam('token'); $token = $this->request->getStringParam('token');
$project = $this->project->getByToken($token); $project = $this->projectModel->getByToken($token);
// Token verification // Token verification
if (empty($project)) { if (empty($project)) {
@ -68,7 +68,7 @@ class ICalendarController extends BaseController
// Common filter // Common filter
$queryBuilder = new QueryBuilder(); $queryBuilder = new QueryBuilder();
$queryBuilder $queryBuilder
->withQuery($this->taskFinder->getICalQuery()) ->withQuery($this->taskFinderModel->getICalQuery())
->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN))
->withFilter(new TaskProjectFilter($project['id'])); ->withFilter(new TaskProjectFilter($project['id']));

View File

@ -22,7 +22,7 @@ class LinkController extends BaseController
*/ */
private function getLink() private function getLink()
{ {
$link = $this->link->getById($this->request->getIntegerParam('link_id')); $link = $this->linkModel->getById($this->request->getIntegerParam('link_id'));
if (empty($link)) { if (empty($link)) {
throw new PageNotFoundException(); throw new PageNotFoundException();
@ -41,7 +41,7 @@ class LinkController extends BaseController
public function index(array $values = array(), array $errors = array()) public function index(array $values = array(), array $errors = array())
{ {
$this->response->html($this->helper->layout->config('link/index', array( $this->response->html($this->helper->layout->config('link/index', array(
'links' => $this->link->getMergedList(), 'links' => $this->linkModel->getMergedList(),
'values' => $values, 'values' => $values,
'errors' => $errors, 'errors' => $errors,
'title' => t('Settings').' &gt; '.t('Task\'s links'), 'title' => t('Settings').' &gt; '.t('Task\'s links'),
@ -59,7 +59,7 @@ class LinkController extends BaseController
list($valid, $errors) = $this->linkValidator->validateCreation($values); list($valid, $errors) = $this->linkValidator->validateCreation($values);
if ($valid) { 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.')); $this->flash->success(t('Link added successfully.'));
return $this->response->redirect($this->helper->url->to('LinkController', 'index')); return $this->response->redirect($this->helper->url->to('LinkController', 'index'));
} else { } else {
@ -86,7 +86,7 @@ class LinkController extends BaseController
$this->response->html($this->helper->layout->config('link/edit', array( $this->response->html($this->helper->layout->config('link/edit', array(
'values' => $values ?: $link, 'values' => $values ?: $link,
'errors' => $errors, 'errors' => $errors,
'labels' => $this->link->getList($link['id']), 'labels' => $this->linkModel->getList($link['id']),
'link' => $link, 'link' => $link,
'title' => t('Link modification') 'title' => t('Link modification')
))); )));
@ -103,7 +103,7 @@ class LinkController extends BaseController
list($valid, $errors) = $this->linkValidator->validateModification($values); list($valid, $errors) = $this->linkValidator->validateModification($values);
if ($valid) { if ($valid) {
if ($this->link->update($values)) { if ($this->linkModel->update($values)) {
$this->flash->success(t('Link updated successfully.')); $this->flash->success(t('Link updated successfully.'));
return $this->response->redirect($this->helper->url->to('LinkController', 'index')); return $this->response->redirect($this->helper->url->to('LinkController', 'index'));
} else { } else {
@ -139,7 +139,7 @@ class LinkController extends BaseController
$this->checkCSRFParam(); $this->checkCSRFParam();
$link = $this->getLink(); $link = $this->getLink();
if ($this->link->remove($link['id'])) { if ($this->linkModel->remove($link['id'])) {
$this->flash->success(t('Link removed successfully.')); $this->flash->success(t('Link removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this link.')); $this->flash->failure(t('Unable to remove this link.'));

View File

@ -52,7 +52,7 @@ class PasswordResetController extends BaseController
$this->checkActivation(); $this->checkActivation();
$token = $this->request->getStringParam('token'); $token = $this->request->getStringParam('token');
$user_id = $this->passwordReset->getUserIdByToken($token); $user_id = $this->passwordResetModel->getUserIdByToken($token);
if ($user_id !== false) { if ($user_id !== false) {
$this->response->html($this->helper->layout->app('password_reset/change', array( $this->response->html($this->helper->layout->app('password_reset/change', array(
@ -78,11 +78,11 @@ class PasswordResetController extends BaseController
list($valid, $errors) = $this->passwordResetValidator->validateModification($values); list($valid, $errors) = $this->passwordResetValidator->validateModification($values);
if ($valid) { if ($valid) {
$user_id = $this->passwordReset->getUserIdByToken($token); $user_id = $this->passwordResetModel->getUserIdByToken($token);
if ($user_id !== false) { if ($user_id !== false) {
$this->user->update(array('id' => $user_id, 'password' => $values['password'])); $this->userModel->update(array('id' => $user_id, 'password' => $values['password']));
$this->passwordReset->disable($user_id); $this->passwordResetModel->disable($user_id);
} }
return $this->response->redirect($this->helper->url->to('AuthController', 'login')); return $this->response->redirect($this->helper->url->to('AuthController', 'login'));
@ -96,10 +96,10 @@ class PasswordResetController extends BaseController
*/ */
private function sendEmail($username) private function sendEmail($username)
{ {
$token = $this->passwordReset->create($username); $token = $this->passwordResetModel->create($username);
if ($token !== false) { if ($token !== false) {
$user = $this->user->getByUsername($username); $user = $this->userModel->getByUsername($username);
$this->emailClient->send( $this->emailClient->send(
$user['email'], $user['email'],
@ -115,7 +115,7 @@ class PasswordResetController extends BaseController
*/ */
private function checkActivation() private function checkActivation()
{ {
if ($this->config->get('password_reset', 0) == 0) { if ($this->configModel->get('password_reset', 0) == 0) {
throw AccessForbiddenException::getInstance()->withoutLayout(); throw AccessForbiddenException::getInstance()->withoutLayout();
} }
} }

View File

@ -13,7 +13,7 @@ class ProjectActionDuplicationController extends BaseController
public function show() public function show()
{ {
$project = $this->getProject(); $project = $this->getProject();
$projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId()); $projects = $this->projectUserRoleModel->getProjectsByUser($this->userSession->getId());
unset($projects[$project['id']]); unset($projects[$project['id']]);
$this->response->html($this->template->render('project_action_duplication/show', array( $this->response->html($this->template->render('project_action_duplication/show', array(
@ -27,7 +27,7 @@ class ProjectActionDuplicationController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$src_project_id = $this->request->getValue('src_project_id'); $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.')); $this->flash->success(t('Actions duplicated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to duplicate actions.')); $this->flash->failure(t('Unable to duplicate actions.'));

View File

@ -20,7 +20,7 @@ class ProjectCreationController extends BaseController
public function create(array $values = array(), array $errors = array()) public function create(array $values = array(), array $errors = array())
{ {
$is_private = isset($values['is_private']) && $values['is_private'] == 1; $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( $this->response->html($this->helper->layout->app('project_creation/create', array(
'values' => $values, 'values' => $values,
@ -98,7 +98,7 @@ class ProjectCreationController extends BaseController
'is_private' => $values['is_private'], 'is_private' => $values['is_private'],
); );
return $this->project->create($project, $this->userSession->getId(), true); return $this->projectModel->create($project, $this->userSession->getId(), true);
} }
/** /**
@ -112,13 +112,13 @@ class ProjectCreationController extends BaseController
{ {
$selection = array(); $selection = array();
foreach ($this->projectDuplication->getOptionalSelection() as $item) { foreach ($this->projectDuplicationModel->getOptionalSelection() as $item) {
if (isset($values[$item]) && $values[$item] == 1) { if (isset($values[$item]) && $values[$item] == 1) {
$selection[] = $item; $selection[] = $item;
} }
} }
return $this->projectDuplication->duplicate( return $this->projectDuplicationModel->duplicate(
$values['src_project_id'], $values['src_project_id'],
$selection, $selection,
$this->userSession->getId(), $this->userSession->getId(),

View File

@ -73,7 +73,7 @@ class ProjectEditController extends BaseController
list($valid, $errors) = $this->projectValidator->validateModification($values); list($valid, $errors) = $this->projectValidator->validateModification($values);
if ($valid) { if ($valid) {
if ($this->project->update($values)) { if ($this->projectModel->update($values)) {
$this->flash->success(t('Project updated successfully.')); $this->flash->success(t('Project updated successfully.'));
return $this->response->redirect($this->helper->url->to('ProjectEditController', $redirect, array('project_id' => $project['id'])), true); return $this->response->redirect($this->helper->url->to('ProjectEditController', $redirect, array('project_id' => $project['id'])), true);
} else { } else {
@ -123,7 +123,7 @@ class ProjectEditController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$this->response->html($this->helper->layout->project($template, array( $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, 'values' => empty($values) ? $project : $values,
'errors' => $errors, 'errors' => $errors,
'project' => $project, 'project' => $project,

View File

@ -34,7 +34,7 @@ class ProjectFileController extends BaseController
{ {
$project = $this->getProject(); $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->flash->failure(t('Unable to upload the file.'));
} }
@ -50,9 +50,9 @@ class ProjectFileController extends BaseController
{ {
$this->checkCSRFParam(); $this->checkCSRFParam();
$project = $this->getProject(); $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.')); $this->flash->success(t('File removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this file.')); $this->flash->failure(t('Unable to remove this file.'));
@ -69,7 +69,7 @@ class ProjectFileController extends BaseController
public function confirm() public function confirm()
{ {
$project = $this->getProject(); $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( $this->response->html($this->template->render('project_file/remove', array(
'project' => $project, 'project' => $project,

View File

@ -6,7 +6,7 @@ use Kanboard\Filter\ProjectIdsFilter;
use Kanboard\Filter\ProjectStatusFilter; use Kanboard\Filter\ProjectStatusFilter;
use Kanboard\Filter\ProjectTypeFilter; use Kanboard\Filter\ProjectTypeFilter;
use Kanboard\Formatter\ProjectGanttFormatter; use Kanboard\Formatter\ProjectGanttFormatter;
use Kanboard\Model\Project; use Kanboard\Model\ProjectModel;
/** /**
* Projects Gantt Controller * Projects Gantt Controller
@ -21,13 +21,13 @@ class ProjectGanttController extends BaseController
*/ */
public function show() public function show()
{ {
$project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId());
$filter = $this->projectQuery $filter = $this->projectQuery
->withFilter(new ProjectTypeFilter(Project::TYPE_TEAM)) ->withFilter(new ProjectTypeFilter(ProjectModel::TYPE_TEAM))
->withFilter(new ProjectStatusFilter(Project::ACTIVE)) ->withFilter(new ProjectStatusFilter(ProjectModel::ACTIVE))
->withFilter(new ProjectIdsFilter($project_ids)); ->withFilter(new ProjectIdsFilter($project_ids));
$filter->getQuery()->asc(Project::TABLE.'.start_date'); $filter->getQuery()->asc(ProjectModel::TABLE.'.start_date');
$this->response->html($this->helper->layout->app('project_gantt/show', array( $this->response->html($this->helper->layout->app('project_gantt/show', array(
'projects' => $filter->format(new ProjectGanttFormatter($this->container)), 'projects' => $filter->format(new ProjectGanttFormatter($this->container)),
@ -42,7 +42,7 @@ class ProjectGanttController extends BaseController
{ {
$values = $this->request->getJson(); $values = $this->request->getJson();
$result = $this->project->update(array( $result = $this->projectModel->update(array(
'id' => $values['id'], 'id' => $values['id'],
'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])), 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])),
'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])), 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])),

View File

@ -18,9 +18,9 @@ class ProjectListController extends BaseController
public function show() public function show()
{ {
if ($this->userSession->isAdmin()) { if ($this->userSession->isAdmin()) {
$project_ids = $this->project->getAllIds(); $project_ids = $this->projectModel->getAllIds();
} else { } else {
$project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId());
} }
$nb_projects = count($project_ids); $nb_projects = count($project_ids);
@ -29,7 +29,7 @@ class ProjectListController extends BaseController
->setUrl('ProjectListController', 'show') ->setUrl('ProjectListController', 'show')
->setMax(20) ->setMax(20)
->setOrder('name') ->setOrder('name')
->setQuery($this->project->getQueryColumnStats($project_ids)) ->setQuery($this->projectModel->getQueryColumnStats($project_ids))
->calculate(); ->calculate();
$this->response->html($this->helper->layout->app('project_list/show', array( $this->response->html($this->helper->layout->app('project_list/show', array(

View File

@ -16,17 +16,17 @@ class ProjectOverviewController extends BaseController
public function show() public function show()
{ {
$project = $this->getProject(); $project = $this->getProject();
$this->project->getColumnStats($project); $this->projectModel->getColumnStats($project);
$this->response->html($this->helper->layout->app('project_overview/show', array( $this->response->html($this->helper->layout->app('project_overview/show', array(
'project' => $project, 'project' => $project,
'title' => $project['name'], 'title' => $project['name'],
'description' => $this->helper->projectHeader->getDescription($project), 'description' => $this->helper->projectHeader->getDescription($project),
'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']),
'roles' => $this->role->getProjectRoles(), 'roles' => $this->role->getProjectRoles(),
'events' => $this->helper->projectActivity->getProjectEvents($project['id'], 10), 'events' => $this->helper->projectActivity->getProjectEvents($project['id'], 10),
'images' => $this->projectFile->getAllImages($project['id']), 'images' => $this->projectFileModel->getAllImages($project['id']),
'files' => $this->projectFile->getAllDocuments($project['id']), 'files' => $this->projectFileModel->getAllDocuments($project['id']),
))); )));
} }
} }

View File

@ -50,8 +50,8 @@ class ProjectPermissionController extends BaseController
$this->response->html($this->helper->layout->project('project_permission/index', array( $this->response->html($this->helper->layout->project('project_permission/index', array(
'project' => $project, 'project' => $project,
'users' => $this->projectUserRole->getUsers($project['id']), 'users' => $this->projectUserRoleModel->getUsers($project['id']),
'groups' => $this->projectGroupRole->getGroups($project['id']), 'groups' => $this->projectGroupRoleModel->getGroups($project['id']),
'roles' => $this->role->getProjectRoles(), 'roles' => $this->role->getProjectRoles(),
'values' => $values, 'values' => $values,
'errors' => $errors, 'errors' => $errors,
@ -69,7 +69,7 @@ class ProjectPermissionController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$values = $this->request->getValues() + array('is_everybody_allowed' => 0); $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.')); $this->flash->success(t('Project updated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to update this project.')); $this->flash->failure(t('Unable to update this project.'));
@ -90,7 +90,7 @@ class ProjectPermissionController extends BaseController
if (empty($values['user_id'])) { if (empty($values['user_id'])) {
$this->flash->failure(t('User not found.')); $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.')); $this->flash->success(t('Project updated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to update this project.')); $this->flash->failure(t('Unable to update this project.'));
@ -110,7 +110,7 @@ class ProjectPermissionController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$user_id = $this->request->getIntegerParam('user_id'); $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.')); $this->flash->success(t('Project updated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to update this project.')); $this->flash->failure(t('Unable to update this project.'));
@ -129,7 +129,7 @@ class ProjectPermissionController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$values = $this->request->getJson(); $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')); $this->response->json(array('status' => 'ok'));
} else { } else {
$this->response->json(array('status' => 'error')); $this->response->json(array('status' => 'error'));
@ -147,10 +147,10 @@ class ProjectPermissionController extends BaseController
$values = $this->request->getValues(); $values = $this->request->getValues();
if (empty($values['group_id']) && ! empty($values['external_id'])) { 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.')); $this->flash->success(t('Project updated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to update this project.')); $this->flash->failure(t('Unable to update this project.'));
@ -170,7 +170,7 @@ class ProjectPermissionController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$group_id = $this->request->getIntegerParam('group_id'); $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.')); $this->flash->success(t('Project updated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to update this project.')); $this->flash->failure(t('Unable to update this project.'));
@ -189,7 +189,7 @@ class ProjectPermissionController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$values = $this->request->getJson(); $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')); $this->response->json(array('status' => 'ok'));
} else { } else {
$this->response->json(array('status' => 'error')); $this->response->json(array('status' => 'error'));

View File

@ -31,7 +31,7 @@ class ProjectStatusController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$this->checkCSRFParam(); $this->checkCSRFParam();
if ($this->project->enable($project['id'])) { if ($this->projectModel->enable($project['id'])) {
$this->flash->success(t('Project activated successfully.')); $this->flash->success(t('Project activated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to activate this project.')); $this->flash->failure(t('Unable to activate this project.'));
@ -61,7 +61,7 @@ class ProjectStatusController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$this->checkCSRFParam(); $this->checkCSRFParam();
if ($this->project->disable($project['id'])) { if ($this->projectModel->disable($project['id'])) {
$this->flash->success(t('Project disabled successfully.')); $this->flash->success(t('Project disabled successfully.'));
} else { } else {
$this->flash->failure(t('Unable to disable this project.')); $this->flash->failure(t('Unable to disable this project.'));
@ -91,7 +91,7 @@ class ProjectStatusController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$this->checkCSRFParam(); $this->checkCSRFParam();
if ($this->project->remove($project['id'])) { if ($this->projectModel->remove($project['id'])) {
$this->flash->success(t('Project removed successfully.')); $this->flash->success(t('Project removed successfully.'));
} else { } else {
$this->flash->failure(t('Unable to remove this project.')); $this->flash->failure(t('Unable to remove this project.'));

View File

@ -2,8 +2,8 @@
namespace Kanboard\Controller; namespace Kanboard\Controller;
use Kanboard\Model\User as UserModel; use Kanboard\Model\UserModel;
use Kanboard\Model\Task as TaskModel; use Kanboard\Model\TaskModel;
use Kanboard\Core\Security\Role; use Kanboard\Core\Security\Role;
/** /**
@ -19,19 +19,19 @@ class ProjectUserOverviewController extends BaseController
$user_id = $this->request->getIntegerParam('user_id', UserModel::EVERYBODY_ID); $user_id = $this->request->getIntegerParam('user_id', UserModel::EVERYBODY_ID);
if ($this->userSession->isAdmin()) { if ($this->userSession->isAdmin()) {
$project_ids = $this->project->getAllIds(); $project_ids = $this->projectModel->getAllIds();
} else { } 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) private function role($role, $action, $title, $title_user)
{ {
list($user_id, $project_ids, $users) = $this->common(); 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])) { if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) {
$query->eq(UserModel::TABLE.'.id', $user_id); $query->eq(UserModel::TABLE.'.id', $user_id);
@ -57,7 +57,7 @@ class ProjectUserOverviewController extends BaseController
{ {
list($user_id, $project_ids, $users) = $this->common(); 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])) { if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) {
$query->eq(TaskModel::TABLE.'.owner_id', $user_id); $query->eq(TaskModel::TABLE.'.owner_id', $user_id);
@ -123,7 +123,7 @@ class ProjectUserOverviewController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
return $this->response->html($this->template->render('project_user_overview/tooltip_users', array( return $this->response->html($this->template->render('project_user_overview/tooltip_users', array(
'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']), 'users' => $this->projectUserRoleModel->getAllUsersGroupedByRole($project['id']),
'roles' => $this->role->getProjectRoles(), 'roles' => $this->role->getProjectRoles(),
))); )));
} }

View File

@ -21,7 +21,7 @@ class ProjectViewController extends BaseController
$this->response->html($this->helper->layout->project('project_view/show', array( $this->response->html($this->helper->layout->project('project_view/show', array(
'project' => $project, 'project' => $project,
'stats' => $this->project->getTaskStats($project['id']), 'stats' => $this->projectModel->getTaskStats($project['id']),
'title' => $project['name'], 'title' => $project['name'],
))); )));
} }
@ -53,7 +53,7 @@ class ProjectViewController extends BaseController
$this->checkCSRFParam(); $this->checkCSRFParam();
$switch = $this->request->getStringParam('switch'); $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.')); $this->flash->success(t('Project updated successfully.'));
} else { } else {
$this->flash->failure(t('Unable to update this project.')); $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( $this->response->html($this->helper->layout->project('project_view/integrations', array(
'project' => $project, 'project' => $project,
'title' => t('Integrations'), 'title' => t('Integrations'),
'webhook_token' => $this->config->get('webhook_token'), 'webhook_token' => $this->configModel->get('webhook_token'),
'values' => $this->projectMetadata->getAll($project['id']), 'values' => $this->projectMetadataModel->getAll($project['id']),
'errors' => array(), 'errors' => array(),
))); )));
} }
@ -89,7 +89,7 @@ class ProjectViewController extends BaseController
{ {
$project = $this->getProject(); $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->flash->success(t('Project updated successfully.'));
$this->response->redirect($this->helper->url->to('ProjectViewController', 'integrations', array('project_id' => $project['id']))); $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(); $project = $this->getProject();
$this->response->html($this->helper->layout->project('project_view/notifications', array( $this->response->html($this->helper->layout->project('project_view/notifications', array(
'notifications' => $this->projectNotification->readSettings($project['id']), 'notifications' => $this->projectNotificationModel->readSettings($project['id']),
'types' => $this->projectNotificationType->getTypes(), 'types' => $this->projectNotificationTypeModel->getTypes(),
'project' => $project, 'project' => $project,
'title' => t('Notifications'), 'title' => t('Notifications'),
))); )));
@ -121,7 +121,7 @@ class ProjectViewController extends BaseController
$project = $this->getProject(); $project = $this->getProject();
$values = $this->request->getValues(); $values = $this->request->getValues();
$this->projectNotification->saveSettings($project['id'], $values); $this->projectNotificationModel->saveSettings($project['id'], $values);
$this->flash->success(t('Project updated successfully.')); $this->flash->success(t('Project updated successfully.'));
$this->response->redirect($this->helper->url->to('ProjectViewController', 'notifications', array('project_id' => $project['id']))); $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() public function doDuplication()
{ {
$project = $this->getProject(); $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) { if ($project_id !== false) {
$this->flash->success(t('Project cloned successfully.')); $this->flash->success(t('Project cloned successfully.'));

Some files were not shown because too many files have changed in this diff Show More