summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/ActionModel.php (renamed from app/Model/Action.php)20
-rw-r--r--app/Model/ActionParameterModel.php (renamed from app/Model/ActionParameter.php)12
-rw-r--r--app/Model/AvatarFileModel.php (renamed from app/Model/AvatarFile.php)10
-rw-r--r--app/Model/BoardModel.php (renamed from app/Model/Board.php)20
-rw-r--r--app/Model/CategoryModel.php (renamed from app/Model/Category.php)8
-rw-r--r--app/Model/ColorModel.php (renamed from app/Model/Color.php)6
-rw-r--r--app/Model/ColumnModel.php (renamed from app/Model/Column.php)4
-rw-r--r--app/Model/CommentModel.php (renamed from app/Model/Comment.php)26
-rw-r--r--app/Model/ConfigModel.php (renamed from app/Model/Config.php)4
-rw-r--r--app/Model/CurrencyModel.php (renamed from app/Model/Currency.php)6
-rw-r--r--app/Model/CustomFilterModel.php (renamed from app/Model/CustomFilter.php)10
-rw-r--r--app/Model/FileModel.php (renamed from app/Model/File.php)10
-rw-r--r--app/Model/GroupMemberModel.php (renamed from app/Model/GroupMember.php)14
-rw-r--r--app/Model/GroupModel.php (renamed from app/Model/Group.php)4
-rw-r--r--app/Model/LanguageModel.php (renamed from app/Model/Language.php)4
-rw-r--r--app/Model/LastLoginModel.php (renamed from app/Model/LastLogin.php)4
-rw-r--r--app/Model/LinkModel.php (renamed from app/Model/Link.php)4
-rw-r--r--app/Model/MetadataModel.php (renamed from app/Model/Metadata.php)4
-rw-r--r--app/Model/NotificationModel.php (renamed from app/Model/Notification.php)66
-rw-r--r--app/Model/NotificationTypeModel.php (renamed from app/Model/NotificationType.php)6
-rw-r--r--app/Model/PasswordResetModel.php (renamed from app/Model/PasswordReset.php)6
-rw-r--r--app/Model/ProjectActivityModel.php (renamed from app/Model/ProjectActivity.php)14
-rw-r--r--app/Model/ProjectDailyColumnStatsModel.php (renamed from app/Model/ProjectDailyColumnStats.php)18
-rw-r--r--app/Model/ProjectDailyStatsModel.php (renamed from app/Model/ProjectDailyStats.php)4
-rw-r--r--app/Model/ProjectDuplicationModel.php (renamed from app/Model/ProjectDuplication.php)20
-rw-r--r--app/Model/ProjectFileModel.php (renamed from app/Model/ProjectFile.php)6
-rw-r--r--app/Model/ProjectGroupRoleModel.php (renamed from app/Model/ProjectGroupRole.php)44
-rw-r--r--app/Model/ProjectMetadataModel.php (renamed from app/Model/ProjectMetadata.php)6
-rw-r--r--app/Model/ProjectModel.php (renamed from app/Model/Project.php)32
-rw-r--r--app/Model/ProjectNotificationModel.php (renamed from app/Model/ProjectNotification.php)16
-rw-r--r--app/Model/ProjectNotificationTypeModel.php (renamed from app/Model/ProjectNotificationType.php)6
-rw-r--r--app/Model/ProjectPermissionModel.php (renamed from app/Model/ProjectPermission.php)42
-rw-r--r--app/Model/ProjectUserRoleModel.php (renamed from app/Model/ProjectUserRole.php)52
-rw-r--r--app/Model/RememberMeSessionModel.php (renamed from app/Model/RememberMeSession.php)4
-rw-r--r--app/Model/SettingModel.php (renamed from app/Model/Setting.php)4
-rw-r--r--app/Model/SubtaskModel.php (renamed from app/Model/Subtask.php)48
-rw-r--r--app/Model/SubtaskTimeTrackingModel.php (renamed from app/Model/SubtaskTimeTracking.php)68
-rw-r--r--app/Model/SwimlaneModel.php (renamed from app/Model/Swimlane.php)20
-rw-r--r--app/Model/TaskAnalyticModel.php (renamed from app/Model/TaskAnalytic.php)8
-rw-r--r--app/Model/TaskCreationModel.php (renamed from app/Model/TaskCreation.php)26
-rw-r--r--app/Model/TaskDuplicationModel.php (renamed from app/Model/TaskDuplication.php)48
-rw-r--r--app/Model/TaskExternalLinkModel.php (renamed from app/Model/TaskExternalLink.php)8
-rw-r--r--app/Model/TaskFileModel.php (renamed from app/Model/TaskFile.php)4
-rw-r--r--app/Model/TaskFinderModel.php (renamed from app/Model/TaskFinder.php)198
-rw-r--r--app/Model/TaskLinkModel.php (renamed from app/Model/TaskLink.php)60
-rw-r--r--app/Model/TaskMetadataModel.php (renamed from app/Model/TaskMetadata.php)4
-rw-r--r--app/Model/TaskModel.php (renamed from app/Model/Task.php)32
-rw-r--r--app/Model/TaskModificationModel.php (renamed from app/Model/TaskModification.php)14
-rw-r--r--app/Model/TaskPositionModel.php (renamed from app/Model/TaskPosition.php)26
-rw-r--r--app/Model/TaskStatusModel.php (renamed from app/Model/TaskStatus.php)26
-rw-r--r--app/Model/TimezoneModel.php (renamed from app/Model/Timezone.php)4
-rw-r--r--app/Model/TransitionModel.php (renamed from app/Model/Transition.php)30
-rw-r--r--app/Model/UserLockingModel.php (renamed from app/Model/UserLocking.php)14
-rw-r--r--app/Model/UserMentionModel.php (renamed from app/Model/UserMention.php)10
-rw-r--r--app/Model/UserMetadataModel.php (renamed from app/Model/UserMetadata.php)6
-rw-r--r--app/Model/UserModel.php (renamed from app/Model/User.php)28
-rw-r--r--app/Model/UserNotificationFilterModel.php (renamed from app/Model/UserNotificationFilter.php)8
-rw-r--r--app/Model/UserNotificationModel.php (renamed from app/Model/UserNotification.php)72
-rw-r--r--app/Model/UserNotificationTypeModel.php (renamed from app/Model/UserNotificationType.php)6
-rw-r--r--app/Model/UserUnreadNotificationModel.php (renamed from app/Model/UserUnreadNotification.php)6
60 files changed, 640 insertions, 650 deletions
diff --git a/app/Model/Action.php b/app/Model/ActionModel.php
index 568ac85a..53393ed5 100644
--- a/app/Model/Action.php
+++ b/app/Model/ActionModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Action Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Action extends Base
+class ActionModel extends Base
{
/**
* SQL table name for actions
@@ -28,12 +28,12 @@ class Action extends Base
*/
public function getAllByUser($user_id)
{
- $project_ids = $this->projectPermission->getActiveProjectIds($user_id);
+ $project_ids = $this->projectPermissionModel->getActiveProjectIds($user_id);
$actions = array();
if (! empty($project_ids)) {
$actions = $this->db->table(self::TABLE)->in('project_id', $project_ids)->findAll();
- $params = $this->actionParameter->getAllByActions(array_column($actions, 'id'));
+ $params = $this->actionParameterModel->getAllByActions(array_column($actions, 'id'));
$this->attachParamsToActions($actions, $params);
}
@@ -50,7 +50,7 @@ class Action extends Base
public function getAllByProject($project_id)
{
$actions = $this->db->table(self::TABLE)->eq('project_id', $project_id)->findAll();
- $params = $this->actionParameter->getAllByActions(array_column($actions, 'id'));
+ $params = $this->actionParameterModel->getAllByActions(array_column($actions, 'id'));
return $this->attachParamsToActions($actions, $params);
}
@@ -63,7 +63,7 @@ class Action extends Base
public function getAll()
{
$actions = $this->db->table(self::TABLE)->findAll();
- $params = $this->actionParameter->getAll();
+ $params = $this->actionParameterModel->getAll();
return $this->attachParamsToActions($actions, $params);
}
@@ -79,7 +79,7 @@ class Action extends Base
$action = $this->db->table(self::TABLE)->eq('id', $action_id)->findOne();
if (! empty($action)) {
- $action['params'] = $this->actionParameter->getAllByAction($action_id);
+ $action['params'] = $this->actionParameterModel->getAllByAction($action_id);
}
return $action;
@@ -138,7 +138,7 @@ class Action extends Base
$action_id = $this->db->getLastId();
- if (! $this->actionParameter->create($action_id, $values)) {
+ if (! $this->actionParameterModel->create($action_id, $values)) {
$this->db->cancelTransaction();
return false;
}
@@ -158,7 +158,7 @@ class Action extends Base
*/
public function duplicate($src_project_id, $dst_project_id)
{
- $actions = $this->action->getAllByProject($src_project_id);
+ $actions = $this->actionModel->getAllByProject($src_project_id);
foreach ($actions as $action) {
$this->db->startTransaction();
@@ -176,7 +176,7 @@ class Action extends Base
$action_id = $this->db->getLastId();
- if (! $this->actionParameter->duplicateParameters($dst_project_id, $action_id, $action['params'])) {
+ if (! $this->actionParameterModel->duplicateParameters($dst_project_id, $action_id, $action['params'])) {
$this->logger->error('Action::duplicate => skip action '.$action['action_name'].' '.$action['id']);
$this->db->cancelTransaction();
continue;
diff --git a/app/Model/ActionParameter.php b/app/Model/ActionParameterModel.php
index a2fe74e5..9895da0f 100644
--- a/app/Model/ActionParameter.php
+++ b/app/Model/ActionParameterModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Action Parameter Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ActionParameter extends Base
+class ActionParameterModel extends Base
{
/**
* SQL table name
@@ -147,16 +147,16 @@ class ActionParameter extends Base
case 'project_id':
return $value != $project_id ? $value : false;
case 'category_id':
- return $this->category->getIdByName($project_id, $this->category->getNameById($value)) ?: false;
+ return $this->categoryModel->getIdByName($project_id, $this->categoryModel->getNameById($value)) ?: false;
case 'src_column_id':
case 'dest_column_id':
case 'dst_column_id':
case 'column_id':
- $column = $this->column->getById($value);
- return empty($column) ? false : $this->column->getColumnIdByTitle($project_id, $column['title']) ?: false;
+ $column = $this->columnModel->getById($value);
+ return empty($column) ? false : $this->columnModel->getColumnIdByTitle($project_id, $column['title']) ?: false;
case 'user_id':
case 'owner_id':
- return $this->projectPermission->isAssignable($project_id, $value) ? $value : false;
+ return $this->projectPermissionModel->isAssignable($project_id, $value) ? $value : false;
default:
return $value;
}
diff --git a/app/Model/AvatarFile.php b/app/Model/AvatarFileModel.php
index cfb9e713..6e36d83f 100644
--- a/app/Model/AvatarFile.php
+++ b/app/Model/AvatarFileModel.php
@@ -8,10 +8,10 @@ use Kanboard\Core\Base;
/**
* Avatar File
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class AvatarFile extends Base
+class AvatarFileModel extends Base
{
/**
* Path prefix
@@ -29,7 +29,7 @@ class AvatarFile extends Base
*/
public function getFilename($user_id)
{
- return $this->db->table(User::TABLE)->eq('id', $user_id)->findOneColumn('avatar_path');
+ return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->findOneColumn('avatar_path');
}
/**
@@ -42,7 +42,7 @@ class AvatarFile extends Base
*/
public function create($user_id, $path)
{
- $result = $this->db->table(User::TABLE)->eq('id', $user_id)->update(array(
+ $result = $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array(
'avatar_path' => $path,
));
@@ -65,7 +65,7 @@ class AvatarFile extends Base
if (! empty($filename)) {
$this->objectStorage->remove($filename);
- return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('avatar_path' => ''));
+ return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('avatar_path' => ''));
}
} catch (Exception $e) {
$this->logger->error($e->getMessage());
diff --git a/app/Model/Board.php b/app/Model/BoardModel.php
index 91acfb1b..d2718b47 100644
--- a/app/Model/Board.php
+++ b/app/Model/BoardModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Board model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Board extends Base
+class BoardModel extends Base
{
/**
* Get Kanboard default columns
@@ -31,7 +31,7 @@ class Board extends Base
*/
public function getUserColumns()
{
- $column_names = explode(',', $this->config->get('board_columns', implode(',', $this->getDefaultColumns())));
+ $column_names = explode(',', $this->configModel->get('board_columns', implode(',', $this->getDefaultColumns())));
$columns = array();
foreach ($column_names as $column_name) {
@@ -66,7 +66,7 @@ class Board extends Base
'description' => $column['description'],
);
- if (! $this->db->table(Column::TABLE)->save($values)) {
+ if (! $this->db->table(ColumnModel::TABLE)->save($values)) {
return false;
}
}
@@ -84,13 +84,13 @@ class Board extends Base
*/
public function duplicate($project_from, $project_to)
{
- $columns = $this->db->table(Column::TABLE)
+ $columns = $this->db->table(ColumnModel::TABLE)
->columns('title', 'task_limit', 'description')
->eq('project_id', $project_from)
->asc('position')
->findAll();
- return $this->board->create($project_to, $columns);
+ return $this->boardModel->create($project_to, $columns);
}
/**
@@ -103,8 +103,8 @@ class Board extends Base
*/
public function getBoard($project_id, $callback = null)
{
- $swimlanes = $this->swimlane->getSwimlanes($project_id);
- $columns = $this->column->getAll($project_id);
+ $swimlanes = $this->swimlaneModel->getSwimlanes($project_id);
+ $columns = $this->columnModel->getAll($project_id);
$nb_columns = count($columns);
for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) {
@@ -122,7 +122,7 @@ class Board extends Base
$swimlanes[0]['columns'][$j]['total_score'] = 0;
}
- $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id);
+ $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinderModel->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id);
$swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']);
$swimlanes[$i]['columns'][$j]['score'] = $this->getColumnSum($swimlanes[$i]['columns'][$j]['tasks'], 'score');
$swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks'];
@@ -164,7 +164,7 @@ class Board extends Base
public function getColumnStats($project_id, $prepend = false)
{
$listing = $this->db
- ->hashtable(Task::TABLE)
+ ->hashtable(TaskModel::TABLE)
->eq('project_id', $project_id)
->eq('is_active', 1)
->groupBy('column_id')
diff --git a/app/Model/Category.php b/app/Model/CategoryModel.php
index 00690a41..62fb5611 100644
--- a/app/Model/Category.php
+++ b/app/Model/CategoryModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Category model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Category extends Base
+class CategoryModel extends Base
{
/**
* SQL table name
@@ -125,7 +125,7 @@ class Category extends Base
public function createDefaultCategories($project_id)
{
$results = array();
- $categories = explode(',', $this->config->get('project_categories'));
+ $categories = explode(',', $this->configModel->get('project_categories'));
foreach ($categories as $category) {
$category = trim($category);
@@ -176,7 +176,7 @@ class Category extends Base
{
$this->db->startTransaction();
- $this->db->table(Task::TABLE)->eq('category_id', $category_id)->update(array('category_id' => 0));
+ $this->db->table(TaskModel::TABLE)->eq('category_id', $category_id)->update(array('category_id' => 0));
if (! $this->db->table(self::TABLE)->eq('id', $category_id)->remove()) {
$this->db->cancelTransaction();
diff --git a/app/Model/Color.php b/app/Model/ColorModel.php
index 025ca669..9e69dda2 100644
--- a/app/Model/Color.php
+++ b/app/Model/ColorModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Color model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Color extends Base
+class ColorModel extends Base
{
/**
* Default colors
@@ -165,7 +165,7 @@ class Color extends Base
*/
public function getDefaultColor()
{
- return $this->config->get('default_color', 'yellow');
+ return $this->configModel->get('default_color', 'yellow');
}
/**
diff --git a/app/Model/Column.php b/app/Model/ColumnModel.php
index 329ff2d0..1adac0f2 100644
--- a/app/Model/Column.php
+++ b/app/Model/ColumnModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Column Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Column extends Base
+class ColumnModel extends Base
{
/**
* SQL table name
diff --git a/app/Model/Comment.php b/app/Model/CommentModel.php
index 7d3e1d6e..6e5fd9d8 100644
--- a/app/Model/Comment.php
+++ b/app/Model/CommentModel.php
@@ -9,10 +9,10 @@ use Kanboard\Core\Base;
/**
* Comment model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Comment extends Base
+class CommentModel extends Base
{
/**
* SQL table name
@@ -48,12 +48,12 @@ class Comment extends Base
self::TABLE.'.task_id',
self::TABLE.'.user_id',
self::TABLE.'.comment',
- User::TABLE.'.username',
- User::TABLE.'.name',
- User::TABLE.'.email',
- User::TABLE.'.avatar_path'
+ UserModel::TABLE.'.username',
+ UserModel::TABLE.'.name',
+ UserModel::TABLE.'.email',
+ UserModel::TABLE.'.avatar_path'
)
- ->join(User::TABLE, 'id', 'user_id')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->orderBy(self::TABLE.'.date_creation', $sorting)
->eq(self::TABLE.'.task_id', $task_id)
->findAll();
@@ -77,12 +77,12 @@ class Comment extends Base
self::TABLE.'.date_creation',
self::TABLE.'.comment',
self::TABLE.'.reference',
- User::TABLE.'.username',
- User::TABLE.'.name',
- User::TABLE.'.email',
- User::TABLE.'.avatar_path'
+ UserModel::TABLE.'.username',
+ UserModel::TABLE.'.name',
+ UserModel::TABLE.'.email',
+ UserModel::TABLE.'.avatar_path'
)
- ->join(User::TABLE, 'id', 'user_id')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->eq(self::TABLE.'.id', $comment_id)
->findOne();
}
@@ -117,7 +117,7 @@ class Comment extends Base
if ($comment_id) {
$event = new CommentEvent(array('id' => $comment_id) + $values);
$this->dispatcher->dispatch(self::EVENT_CREATE, $event);
- $this->userMention->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event);
+ $this->userMentionModel->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event);
}
return $comment_id;
diff --git a/app/Model/Config.php b/app/Model/ConfigModel.php
index 1b14efa1..945c5e6f 100644
--- a/app/Model/Config.php
+++ b/app/Model/ConfigModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Security\Token;
/**
* Config model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Config extends Setting
+class ConfigModel extends SettingModel
{
/**
* Get a config variable with in-memory caching
diff --git a/app/Model/Currency.php b/app/Model/CurrencyModel.php
index 7c8cadd4..bfd9697c 100644
--- a/app/Model/Currency.php
+++ b/app/Model/CurrencyModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Currency
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Currency extends Base
+class CurrencyModel extends Base
{
/**
* SQL table name
@@ -67,7 +67,7 @@ class Currency extends Base
public function getPrice($currency, $price)
{
static $rates = null;
- $reference = $this->config->get('application_currency', 'USD');
+ $reference = $this->configModel->get('application_currency', 'USD');
if ($reference !== $currency) {
$rates = $rates === null ? $this->db->hashtable(self::TABLE)->getAll('currency', 'rate') : $rates;
diff --git a/app/Model/CustomFilter.php b/app/Model/CustomFilterModel.php
index 9d409bd4..a4c23b5c 100644
--- a/app/Model/CustomFilter.php
+++ b/app/Model/CustomFilterModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Custom Filter model
*
- * @package model
+ * @package Kanboard\Model
* @author Timo Litzbarski
*/
-class CustomFilter extends Base
+class CustomFilterModel extends Base
{
/**
* SQL table name
@@ -32,8 +32,8 @@ class CustomFilter extends Base
return $this->db
->table(self::TABLE)
->columns(
- User::TABLE.'.name as owner_name',
- User::TABLE.'.username as owner_username',
+ UserModel::TABLE.'.name as owner_name',
+ UserModel::TABLE.'.username as owner_username',
self::TABLE.'.id',
self::TABLE.'.user_id',
self::TABLE.'.project_id',
@@ -43,7 +43,7 @@ class CustomFilter extends Base
self::TABLE.'.append'
)
->asc(self::TABLE.'.name')
- ->join(User::TABLE, 'id', 'user_id')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->beginOr()
->eq('is_shared', 1)
->eq('user_id', $user_id)
diff --git a/app/Model/File.php b/app/Model/FileModel.php
index 92032110..ad839799 100644
--- a/app/Model/File.php
+++ b/app/Model/FileModel.php
@@ -11,10 +11,10 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
* Base File Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-abstract class File extends Base
+abstract class FileModel extends Base
{
/**
* Get PicoDb query to get all files
@@ -35,10 +35,10 @@ abstract class File extends Base
static::TABLE.'.date',
static::TABLE.'.user_id',
static::TABLE.'.size',
- User::TABLE.'.username',
- User::TABLE.'.name as user_name'
+ UserModel::TABLE.'.username',
+ UserModel::TABLE.'.name as user_name'
)
- ->join(User::TABLE, 'id', 'user_id')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->asc(static::TABLE.'.name');
}
diff --git a/app/Model/GroupMember.php b/app/Model/GroupMemberModel.php
index a0bbb9f8..a2077789 100644
--- a/app/Model/GroupMember.php
+++ b/app/Model/GroupMemberModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Group Member Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class GroupMember extends Base
+class GroupMemberModel extends Base
{
/**
* SQL table name
@@ -29,7 +29,7 @@ class GroupMember extends Base
public function getQuery($group_id)
{
return $this->db->table(self::TABLE)
- ->join(User::TABLE, 'id', 'user_id')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->eq('group_id', $group_id);
}
@@ -58,7 +58,7 @@ class GroupMember extends Base
->columns('user_id')
->eq('group_id', $group_id);
- return $this->db->table(User::TABLE)
+ return $this->db->table(UserModel::TABLE)
->notInSubquery('id', $subquery)
->findAll();
}
@@ -121,10 +121,10 @@ class GroupMember extends Base
public function getGroups($user_id)
{
return $this->db->table(self::TABLE)
- ->columns(Group::TABLE.'.id', Group::TABLE.'.external_id', Group::TABLE.'.name')
- ->join(Group::TABLE, 'id', 'group_id')
+ ->columns(GroupModel::TABLE.'.id', GroupModel::TABLE.'.external_id', GroupModel::TABLE.'.name')
+ ->join(GroupModel::TABLE, 'id', 'group_id')
->eq(self::TABLE.'.user_id', $user_id)
- ->asc(Group::TABLE.'.name')
+ ->asc(GroupModel::TABLE.'.name')
->findAll();
}
}
diff --git a/app/Model/Group.php b/app/Model/GroupModel.php
index 25579206..0a975570 100644
--- a/app/Model/Group.php
+++ b/app/Model/GroupModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Group Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Group extends Base
+class GroupModel extends Base
{
/**
* SQL table name
diff --git a/app/Model/Language.php b/app/Model/LanguageModel.php
index 126dc5c0..eb6de004 100644
--- a/app/Model/Language.php
+++ b/app/Model/LanguageModel.php
@@ -11,7 +11,7 @@ use Kanboard\Core\Translator;
* @package Kanboard\Model
* @author Frederic Guillot
*/
-class Language extends Base
+class LanguageModel extends Base
{
/**
* Get all language codes
@@ -164,7 +164,7 @@ class Language extends Base
return $this->sessionStorage->user['language'];
}
- return $this->config->get('application_language', 'en_US');
+ return $this->configModel->get('application_language', 'en_US');
}
/**
diff --git a/app/Model/LastLogin.php b/app/Model/LastLoginModel.php
index 35c7afc9..16821392 100644
--- a/app/Model/LastLogin.php
+++ b/app/Model/LastLoginModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* LastLogin model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class LastLogin extends Base
+class LastLoginModel extends Base
{
/**
* SQL table name
diff --git a/app/Model/Link.php b/app/Model/LinkModel.php
index f275edae..b72c7532 100644
--- a/app/Model/Link.php
+++ b/app/Model/LinkModel.php
@@ -8,11 +8,11 @@ use Kanboard\Core\Base;
/**
* Link model
*
- * @package model
+ * @package Kanboard\Model
* @author Olivier Maridat
* @author Frederic Guillot
*/
-class Link extends Base
+class LinkModel extends Base
{
/**
* SQL table name
diff --git a/app/Model/Metadata.php b/app/Model/MetadataModel.php
index b39ce098..6177e5f3 100644
--- a/app/Model/Metadata.php
+++ b/app/Model/MetadataModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Metadata
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-abstract class Metadata extends Base
+abstract class MetadataModel extends Base
{
/**
* Get the table
diff --git a/app/Model/Notification.php b/app/Model/NotificationModel.php
index 1e96a8b4..8937b77e 100644
--- a/app/Model/Notification.php
+++ b/app/Model/NotificationModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Notification
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Notification extends Base
+class NotificationModel extends Base
{
/**
* Get the event title with author
@@ -24,7 +24,7 @@ class Notification extends Base
public function getTitleWithAuthor($event_author, $event_name, array $event_data)
{
switch ($event_name) {
- case Task::EVENT_ASSIGNEE_CHANGE:
+ case TaskModel::EVENT_ASSIGNEE_CHANGE:
$assignee = $event_data['task']['assignee_name'] ?: $event_data['task']['assignee_username'];
if (! empty($assignee)) {
@@ -32,22 +32,22 @@ class Notification extends Base
}
return e('%s remove the assignee of the task %s', $event_author, e('#%d', $event_data['task']['id']));
- case Task::EVENT_UPDATE:
+ case TaskModel::EVENT_UPDATE:
return e('%s updated the task #%d', $event_author, $event_data['task']['id']);
- case Task::EVENT_CREATE:
+ case TaskModel::EVENT_CREATE:
return e('%s created the task #%d', $event_author, $event_data['task']['id']);
- case Task::EVENT_CLOSE:
+ case TaskModel::EVENT_CLOSE:
return e('%s closed the task #%d', $event_author, $event_data['task']['id']);
- case Task::EVENT_OPEN:
+ case TaskModel::EVENT_OPEN:
return e('%s open the task #%d', $event_author, $event_data['task']['id']);
- case Task::EVENT_MOVE_COLUMN:
+ case TaskModel::EVENT_MOVE_COLUMN:
return e(
'%s moved the task #%d to the column "%s"',
$event_author,
$event_data['task']['id'],
$event_data['task']['column_title']
);
- case Task::EVENT_MOVE_POSITION:
+ case TaskModel::EVENT_MOVE_POSITION:
return e(
'%s moved the task #%d to the position %d in the column "%s"',
$event_author,
@@ -55,7 +55,7 @@ class Notification extends Base
$event_data['task']['position'],
$event_data['task']['column_title']
);
- case Task::EVENT_MOVE_SWIMLANE:
+ case TaskModel::EVENT_MOVE_SWIMLANE:
if ($event_data['task']['swimlane_id'] == 0) {
return e('%s moved the task #%d to the first swimlane', $event_author, $event_data['task']['id']);
}
@@ -66,19 +66,19 @@ class Notification extends Base
$event_data['task']['id'],
$event_data['task']['swimlane_name']
);
- case Subtask::EVENT_UPDATE:
+ case SubtaskModel::EVENT_UPDATE:
return e('%s updated a subtask for the task #%d', $event_author, $event_data['task']['id']);
- case Subtask::EVENT_CREATE:
+ case SubtaskModel::EVENT_CREATE:
return e('%s created a subtask for the task #%d', $event_author, $event_data['task']['id']);
- case Comment::EVENT_UPDATE:
+ case CommentModel::EVENT_UPDATE:
return e('%s updated a comment on the task #%d', $event_author, $event_data['task']['id']);
- case Comment::EVENT_CREATE:
+ case CommentModel::EVENT_CREATE:
return e('%s commented on the task #%d', $event_author, $event_data['task']['id']);
- case TaskFile::EVENT_CREATE:
+ case TaskFileModel::EVENT_CREATE:
return e('%s attached a file to the task #%d', $event_author, $event_data['task']['id']);
- case Task::EVENT_USER_MENTION:
+ case TaskModel::EVENT_USER_MENTION:
return e('%s mentioned you in the task #%d', $event_author, $event_data['task']['id']);
- case Comment::EVENT_USER_MENTION:
+ case CommentModel::EVENT_USER_MENTION:
return e('%s mentioned you in a comment on the task #%d', $event_author, $event_data['task']['id']);
default:
return e('Notification');
@@ -96,38 +96,38 @@ class Notification extends Base
public function getTitleWithoutAuthor($event_name, array $event_data)
{
switch ($event_name) {
- case TaskFile::EVENT_CREATE:
+ case TaskFileModel::EVENT_CREATE:
return e('New attachment on task #%d: %s', $event_data['file']['task_id'], $event_data['file']['name']);
- case Comment::EVENT_CREATE:
+ case CommentModel::EVENT_CREATE:
return e('New comment on task #%d', $event_data['comment']['task_id']);
- case Comment::EVENT_UPDATE:
+ case CommentModel::EVENT_UPDATE:
return e('Comment updated on task #%d', $event_data['comment']['task_id']);
- case Subtask::EVENT_CREATE:
+ case SubtaskModel::EVENT_CREATE:
return e('New subtask on task #%d', $event_data['subtask']['task_id']);
- case Subtask::EVENT_UPDATE:
+ case SubtaskModel::EVENT_UPDATE:
return e('Subtask updated on task #%d', $event_data['subtask']['task_id']);
- case Task::EVENT_CREATE:
+ case TaskModel::EVENT_CREATE:
return e('New task #%d: %s', $event_data['task']['id'], $event_data['task']['title']);
- case Task::EVENT_UPDATE:
+ case TaskModel::EVENT_UPDATE:
return e('Task updated #%d', $event_data['task']['id']);
- case Task::EVENT_CLOSE:
+ case TaskModel::EVENT_CLOSE:
return e('Task #%d closed', $event_data['task']['id']);
- case Task::EVENT_OPEN:
+ case TaskModel::EVENT_OPEN:
return e('Task #%d opened', $event_data['task']['id']);
- case Task::EVENT_MOVE_COLUMN:
+ case TaskModel::EVENT_MOVE_COLUMN:
return e('Column changed for task #%d', $event_data['task']['id']);
- case Task::EVENT_MOVE_POSITION:
+ case TaskModel::EVENT_MOVE_POSITION:
return e('New position for task #%d', $event_data['task']['id']);
- case Task::EVENT_MOVE_SWIMLANE:
+ case TaskModel::EVENT_MOVE_SWIMLANE:
return e('Swimlane changed for task #%d', $event_data['task']['id']);
- case Task::EVENT_ASSIGNEE_CHANGE:
+ case TaskModel::EVENT_ASSIGNEE_CHANGE:
return e('Assignee changed on task #%d', $event_data['task']['id']);
- case Task::EVENT_OVERDUE:
+ case TaskModel::EVENT_OVERDUE:
$nb = count($event_data['tasks']);
return $nb > 1 ? e('%d overdue tasks', $nb) : e('Task #%d is overdue', $event_data['tasks'][0]['id']);
- case Task::EVENT_USER_MENTION:
+ case TaskModel::EVENT_USER_MENTION:
return e('You were mentioned in the task #%d', $event_data['task']['id']);
- case Comment::EVENT_USER_MENTION:
+ case CommentModel::EVENT_USER_MENTION:
return e('You were mentioned in a comment on the task #%d', $event_data['task']['id']);
default:
return e('Notification');
diff --git a/app/Model/NotificationType.php b/app/Model/NotificationTypeModel.php
index a4dffa09..432832ee 100644
--- a/app/Model/NotificationType.php
+++ b/app/Model/NotificationTypeModel.php
@@ -11,7 +11,7 @@ use Kanboard\Core\Base;
* @package model
* @author Frederic Guillot
*/
-abstract class NotificationType extends Base
+abstract class NotificationTypeModel extends Base
{
/**
* Container
@@ -57,7 +57,7 @@ abstract class NotificationType extends Base
* @param string $label
* @param string $class
* @param boolean $hidden
- * @return NotificationType
+ * @return NotificationTypeModel
*/
public function setType($type, $label, $class, $hidden = false)
{
@@ -81,7 +81,7 @@ abstract class NotificationType extends Base
*
* @access public
* @param string $type
- * @return \Kanboard\Notification\NotificationInterface
+ * @return \Kanboard\Core\Notification\NotificationInterface
*/
public function getType($type)
{
diff --git a/app/Model/PasswordReset.php b/app/Model/PasswordResetModel.php
index 895acb07..d7c74969 100644
--- a/app/Model/PasswordReset.php
+++ b/app/Model/PasswordResetModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Password Reset Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class PasswordReset extends Base
+class PasswordResetModel extends Base
{
/**
* SQL table name
@@ -48,7 +48,7 @@ class PasswordReset extends Base
*/
public function create($username, $expiration = 0)
{
- $user_id = $this->db->table(User::TABLE)->eq('username', $username)->neq('email', '')->notNull('email')->findOneColumn('id');
+ $user_id = $this->db->table(UserModel::TABLE)->eq('username', $username)->neq('email', '')->notNull('email')->findOneColumn('id');
if (! $user_id) {
return false;
diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivityModel.php
index f6bdbf92..380ea125 100644
--- a/app/Model/ProjectActivity.php
+++ b/app/Model/ProjectActivityModel.php
@@ -8,10 +8,10 @@ use PicoDb\Table;
/**
* Project activity model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectActivity extends Base
+class ProjectActivityModel extends Base
{
/**
* SQL table name
@@ -63,17 +63,17 @@ class ProjectActivity extends Base
{
return $this
->db
- ->table(ProjectActivity::TABLE)
+ ->table(ProjectActivityModel::TABLE)
->columns(
- ProjectActivity::TABLE.'.*',
+ ProjectActivityModel::TABLE.'.*',
'uc.username AS author_username',
'uc.name AS author_name',
'uc.email',
'uc.avatar_path'
)
- ->join(Task::TABLE, 'id', 'task_id')
- ->join(Project::TABLE, 'id', 'project_id')
- ->left(User::TABLE, 'uc', 'id', ProjectActivity::TABLE, 'creator_id');
+ ->join(TaskModel::TABLE, 'id', 'task_id')
+ ->join(ProjectModel::TABLE, 'id', 'project_id')
+ ->left(UserModel::TABLE, 'uc', 'id', ProjectActivityModel::TABLE, 'creator_id');
}
/**
diff --git a/app/Model/ProjectDailyColumnStats.php b/app/Model/ProjectDailyColumnStatsModel.php
index 38487c76..a0f14cf4 100644
--- a/app/Model/ProjectDailyColumnStats.php
+++ b/app/Model/ProjectDailyColumnStatsModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Project Daily Column Stats
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectDailyColumnStats extends Base
+class ProjectDailyColumnStatsModel extends Base
{
/**
* SQL table name
@@ -86,7 +86,7 @@ class ProjectDailyColumnStats extends Base
*/
public function getAggregatedMetrics($project_id, $from, $to, $field = 'total')
{
- $columns = $this->column->getList($project_id);
+ $columns = $this->columnModel->getList($project_id);
$metrics = $this->getMetrics($project_id, $from, $to);
return $this->buildAggregate($metrics, $columns, $field);
}
@@ -207,10 +207,10 @@ class ProjectDailyColumnStats extends Base
*/
private function getScoreByColumns($project_id)
{
- $stats = $this->db->table(Task::TABLE)
+ $stats = $this->db->table(TaskModel::TABLE)
->columns('column_id', 'SUM(score) AS score')
->eq('project_id', $project_id)
- ->eq('is_active', Task::STATUS_OPEN)
+ ->eq('is_active', TaskModel::STATUS_OPEN)
->notNull('score')
->groupBy('column_id')
->findAll();
@@ -227,7 +227,7 @@ class ProjectDailyColumnStats extends Base
*/
private function getTotalByColumns($project_id)
{
- $stats = $this->db->table(Task::TABLE)
+ $stats = $this->db->table(TaskModel::TABLE)
->columns('column_id', 'COUNT(*) AS total')
->eq('project_id', $project_id)
->in('is_active', $this->getTaskStatusConfig())
@@ -245,10 +245,10 @@ class ProjectDailyColumnStats extends Base
*/
private function getTaskStatusConfig()
{
- if ($this->config->get('cfd_include_closed_tasks') == 1) {
- return array(Task::STATUS_OPEN, Task::STATUS_CLOSED);
+ if ($this->configModel->get('cfd_include_closed_tasks') == 1) {
+ return array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED);
}
- return array(Task::STATUS_OPEN);
+ return array(TaskModel::STATUS_OPEN);
}
}
diff --git a/app/Model/ProjectDailyStats.php b/app/Model/ProjectDailyStatsModel.php
index 08a0039e..0754d263 100644
--- a/app/Model/ProjectDailyStats.php
+++ b/app/Model/ProjectDailyStatsModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Project Daily Stats
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectDailyStats extends Base
+class ProjectDailyStatsModel extends Base
{
/**
* SQL table name
diff --git a/app/Model/ProjectDuplication.php b/app/Model/ProjectDuplicationModel.php
index 871cadc8..b67f8302 100644
--- a/app/Model/ProjectDuplication.php
+++ b/app/Model/ProjectDuplicationModel.php
@@ -8,11 +8,11 @@ use Kanboard\Core\Security\Role;
/**
* Project Duplication
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
* @author Antonio Rabelo
*/
-class ProjectDuplication extends Base
+class ProjectDuplicationModel extends Base
{
/**
* Get list of optional models to duplicate
@@ -22,7 +22,7 @@ class ProjectDuplication extends Base
*/
public function getOptionalSelection()
{
- return array('category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata');
+ return array('categoryModel', 'projectPermissionModel', 'actionModel', 'swimlaneModel', 'taskModel', 'projectMetadataModel');
}
/**
@@ -33,7 +33,7 @@ class ProjectDuplication extends Base
*/
public function getPossibleSelection()
{
- return array('board', 'category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata');
+ return array('boardModel', 'categoryModel', 'projectPermissionModel', 'actionModel', 'swimlaneModel', 'taskModel', 'projectMetadataModel');
}
/**
@@ -65,7 +65,7 @@ class ProjectDuplication extends Base
* @param boolean $private Force the project to be private
* @return integer Cloned Project Id
*/
- public function duplicate($src_project_id, $selection = array('projectPermission', 'category', 'action'), $owner_id = 0, $name = null, $private = null)
+ public function duplicate($src_project_id, $selection = array('projectPermissionModel', 'categoryModel', 'actionModel'), $owner_id = 0, $name = null, $private = null)
{
$this->db->startTransaction();
@@ -86,7 +86,7 @@ class ProjectDuplication extends Base
}
// Skip permissions for private projects
- if ($private && $model === 'projectPermission') {
+ if ($private && $model === 'projectPermissionModel') {
continue;
}
@@ -118,7 +118,7 @@ class ProjectDuplication extends Base
*/
private function copy($src_project_id, $owner_id = 0, $name = null, $private = null)
{
- $project = $this->project->getById($src_project_id);
+ $project = $this->projectModel->getById($src_project_id);
$is_private = empty($project['is_private']) ? 0 : 1;
$values = array(
@@ -131,7 +131,7 @@ class ProjectDuplication extends Base
'owner_id' => $owner_id,
);
- if (! $this->db->table(Project::TABLE)->save($values)) {
+ if (! $this->db->table(ProjectModel::TABLE)->save($values)) {
return false;
}
@@ -149,9 +149,9 @@ class ProjectDuplication extends Base
private function makeOwnerManager($dst_project_id, $owner_id)
{
if ($owner_id > 0) {
- $this->projectUserRole->removeUser($dst_project_id, $owner_id);
+ $this->projectUserRoleModel->removeUser($dst_project_id, $owner_id);
- if (! $this->projectUserRole->addUser($dst_project_id, $owner_id, Role::PROJECT_MANAGER)) {
+ if (! $this->projectUserRoleModel->addUser($dst_project_id, $owner_id, Role::PROJECT_MANAGER)) {
return false;
}
}
diff --git a/app/Model/ProjectFile.php b/app/Model/ProjectFileModel.php
index 75348e0c..2177df27 100644
--- a/app/Model/ProjectFile.php
+++ b/app/Model/ProjectFileModel.php
@@ -2,15 +2,13 @@
namespace Kanboard\Model;
-use Kanboard\Core\Base;
-
/**
* Project File Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectFile extends File
+class ProjectFileModel extends FileModel
{
/**
* SQL table name
diff --git a/app/Model/ProjectGroupRole.php b/app/Model/ProjectGroupRoleModel.php
index 3ce2b1dc..2729d5a6 100644
--- a/app/Model/ProjectGroupRole.php
+++ b/app/Model/ProjectGroupRoleModel.php
@@ -8,10 +8,10 @@ use Kanboard\Core\Security\Role;
/**
* Project Group Role
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectGroupRole extends Base
+class ProjectGroupRoleModel extends Base
{
/**
* SQL table name
@@ -28,15 +28,15 @@ class ProjectGroupRole extends Base
* @param array $status
* @return array
*/
- public function getProjectsByUser($user_id, $status = array(Project::ACTIVE, Project::INACTIVE))
+ public function getProjectsByUser($user_id, $status = array(ProjectModel::ACTIVE, ProjectModel::INACTIVE))
{
return $this->db
- ->hashtable(Project::TABLE)
+ ->hashtable(ProjectModel::TABLE)
->join(self::TABLE, 'project_id', 'id')
- ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE)
- ->eq(GroupMember::TABLE.'.user_id', $user_id)
- ->in(Project::TABLE.'.is_active', $status)
- ->getAll(Project::TABLE.'.id', Project::TABLE.'.name');
+ ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE)
+ ->eq(GroupMemberModel::TABLE.'.user_id', $user_id)
+ ->in(ProjectModel::TABLE.'.is_active', $status)
+ ->getAll(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name');
}
/**
@@ -50,8 +50,8 @@ class ProjectGroupRole extends Base
public function getUserRole($project_id, $user_id)
{
$roles = $this->db->table(self::TABLE)
- ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE)
- ->eq(GroupMember::TABLE.'.user_id', $user_id)
+ ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE)
+ ->eq(GroupMemberModel::TABLE.'.user_id', $user_id)
->eq(self::TABLE.'.project_id', $project_id)
->findAllByColumn('role');
@@ -68,8 +68,8 @@ class ProjectGroupRole extends Base
public function getGroups($project_id)
{
return $this->db->table(self::TABLE)
- ->columns(Group::TABLE.'.id', Group::TABLE.'.name', self::TABLE.'.role')
- ->join(Group::TABLE, 'id', 'group_id')
+ ->columns(GroupModel::TABLE.'.id', GroupModel::TABLE.'.name', self::TABLE.'.role')
+ ->join(GroupModel::TABLE, 'id', 'group_id')
->eq('project_id', $project_id)
->asc('name')
->findAll();
@@ -85,11 +85,11 @@ class ProjectGroupRole extends Base
public function getUsers($project_id)
{
return $this->db->table(self::TABLE)
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', self::TABLE.'.role')
- ->join(GroupMember::TABLE, 'group_id', 'group_id', self::TABLE)
- ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE)
+ ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', self::TABLE.'.role')
+ ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', self::TABLE)
+ ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE)
->eq(self::TABLE.'.project_id', $project_id)
- ->asc(User::TABLE.'.username')
+ ->asc(UserModel::TABLE.'.username')
->findAll();
}
@@ -102,14 +102,14 @@ class ProjectGroupRole extends Base
*/
public function getAssignableUsers($project_id)
{
- return $this->db->table(User::TABLE)
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name')
- ->join(GroupMember::TABLE, 'user_id', 'id', User::TABLE)
- ->join(self::TABLE, 'group_id', 'group_id', GroupMember::TABLE)
+ return $this->db->table(UserModel::TABLE)
+ ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name')
+ ->join(GroupMemberModel::TABLE, 'user_id', 'id', UserModel::TABLE)
+ ->join(self::TABLE, 'group_id', 'group_id', GroupMemberModel::TABLE)
->eq(self::TABLE.'.project_id', $project_id)
- ->eq(User::TABLE.'.is_active', 1)
+ ->eq(UserModel::TABLE.'.is_active', 1)
->in(self::TABLE.'.role', array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER))
- ->asc(User::TABLE.'.username')
+ ->asc(UserModel::TABLE.'.username')
->findAll();
}
diff --git a/app/Model/ProjectMetadata.php b/app/Model/ProjectMetadataModel.php
index c8e4fe63..760acd7d 100644
--- a/app/Model/ProjectMetadata.php
+++ b/app/Model/ProjectMetadataModel.php
@@ -2,15 +2,13 @@
namespace Kanboard\Model;
-use Kanboard\Core\Base;
-
/**
* Project Metadata
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectMetadata extends Metadata
+class ProjectMetadataModel extends MetadataModel
{
/**
* Get the table
diff --git a/app/Model/Project.php b/app/Model/ProjectModel.php
index 2cb0a431..34e11c13 100644
--- a/app/Model/Project.php
+++ b/app/Model/ProjectModel.php
@@ -9,10 +9,10 @@ use Kanboard\Core\Security\Role;
/**
* Project model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Project extends Base
+class ProjectModel extends Base
{
/**
* SQL table name for projects
@@ -71,9 +71,9 @@ class Project extends Base
public function getByIdWithOwner($project_id)
{
return $this->db->table(self::TABLE)
- ->columns(self::TABLE.'.*', User::TABLE.'.username AS owner_username', User::TABLE.'.name AS owner_name')
+ ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name')
->eq(self::TABLE.'.id', $project_id)
- ->join(User::TABLE, 'id', 'owner_id')
+ ->join(UserModel::TABLE, 'id', 'owner_id')
->findOne();
}
@@ -269,8 +269,8 @@ class Project extends Base
{
$stats = array();
$stats['nb_active_tasks'] = 0;
- $columns = $this->column->getAll($project_id);
- $column_stats = $this->board->getColumnStats($project_id);
+ $columns = $this->columnModel->getAll($project_id);
+ $column_stats = $this->boardModel->getColumnStats($project_id);
foreach ($columns as &$column) {
$column['nb_active_tasks'] = isset($column_stats[$column['id']]) ? $column_stats[$column['id']] : 0;
@@ -278,7 +278,7 @@ class Project extends Base
}
$stats['columns'] = $columns;
- $stats['nb_tasks'] = $this->taskFinder->countByProjectId($project_id);
+ $stats['nb_tasks'] = $this->taskFinderModel->countByProjectId($project_id);
$stats['nb_inactive_tasks'] = $stats['nb_tasks'] - $stats['nb_active_tasks'];
return $stats;
@@ -293,8 +293,8 @@ class Project extends Base
*/
public function getColumnStats(array &$project)
{
- $project['columns'] = $this->column->getAll($project['id']);
- $stats = $this->board->getColumnStats($project['id']);
+ $project['columns'] = $this->columnModel->getAll($project['id']);
+ $stats = $this->boardModel->getColumnStats($project['id']);
foreach ($project['columns'] as &$column) {
$column['nb_tasks'] = isset($stats[$column['id']]) ? $stats[$column['id']] : 0;
@@ -329,13 +329,13 @@ class Project extends Base
public function getQueryColumnStats(array $project_ids)
{
if (empty($project_ids)) {
- return $this->db->table(Project::TABLE)->limit(0);
+ return $this->db->table(ProjectModel::TABLE)->limit(0);
}
return $this->db
- ->table(Project::TABLE)
- ->columns(self::TABLE.'.*', User::TABLE.'.username AS owner_username', User::TABLE.'.name AS owner_name')
- ->join(User::TABLE, 'id', 'owner_id')
+ ->table(ProjectModel::TABLE)
+ ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name')
+ ->join(UserModel::TABLE, 'id', 'owner_id')
->in(self::TABLE.'.id', $project_ids)
->callback(array($this, 'applyColumnStats'));
}
@@ -371,16 +371,16 @@ class Project extends Base
$project_id = $this->db->getLastId();
- if (! $this->board->create($project_id, $this->board->getUserColumns())) {
+ if (! $this->boardModel->create($project_id, $this->boardModel->getUserColumns())) {
$this->db->cancelTransaction();
return false;
}
if ($add_user && $user_id) {
- $this->projectUserRole->addUser($project_id, $user_id, Role::PROJECT_MANAGER);
+ $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MANAGER);
}
- $this->category->createDefaultCategories($project_id);
+ $this->categoryModel->createDefaultCategories($project_id);
$this->db->closeTransaction();
diff --git a/app/Model/ProjectNotification.php b/app/Model/ProjectNotificationModel.php
index 5df042ca..aeeee4cd 100644
--- a/app/Model/ProjectNotification.php
+++ b/app/Model/ProjectNotificationModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Project Notification
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectNotification extends Base
+class ProjectNotificationModel extends Base
{
/**
* Send notifications
@@ -22,15 +22,15 @@ class ProjectNotification extends Base
*/
public function sendNotifications($project_id, $event_name, array $event_data)
{
- $project = $this->project->getById($project_id);
+ $project = $this->projectModel->getById($project_id);
$types = array_merge(
- $this->projectNotificationType->getHiddenTypes(),
- $this->projectNotificationType->getSelectedTypes($project_id)
+ $this->projectNotificationTypeModel->getHiddenTypes(),
+ $this->projectNotificationTypeModel->getSelectedTypes($project_id)
);
foreach ($types as $type) {
- $this->projectNotificationType->getType($type)->notifyProject($project, $event_name, $event_data);
+ $this->projectNotificationTypeModel->getType($type)->notifyProject($project, $event_name, $event_data);
}
}
@@ -46,7 +46,7 @@ class ProjectNotification extends Base
$this->db->startTransaction();
$types = empty($values['notification_types']) ? array() : array_keys($values['notification_types']);
- $this->projectNotificationType->saveSelectedTypes($project_id, $types);
+ $this->projectNotificationTypeModel->saveSelectedTypes($project_id, $types);
$this->db->closeTransaction();
}
@@ -61,7 +61,7 @@ class ProjectNotification extends Base
public function readSettings($project_id)
{
return array(
- 'notification_types' => $this->projectNotificationType->getSelectedTypes($project_id),
+ 'notification_types' => $this->projectNotificationTypeModel->getSelectedTypes($project_id),
);
}
}
diff --git a/app/Model/ProjectNotificationType.php b/app/Model/ProjectNotificationTypeModel.php
index a00e465c..aeec77f2 100644
--- a/app/Model/ProjectNotificationType.php
+++ b/app/Model/ProjectNotificationTypeModel.php
@@ -2,15 +2,13 @@
namespace Kanboard\Model;
-use Kanboard\Core\Base;
-
/**
* Project Notification Type
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectNotificationType extends NotificationType
+class ProjectNotificationTypeModel extends NotificationTypeModel
{
/**
* SQL table name
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermissionModel.php
index bc35c956..a7c1857c 100644
--- a/app/Model/ProjectPermission.php
+++ b/app/Model/ProjectPermissionModel.php
@@ -12,10 +12,10 @@ use Kanboard\Filter\ProjectUserRoleUsernameFilter;
/**
* Project Permission
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectPermission extends Base
+class ProjectPermissionModel extends Base
{
/**
* Get query for project users overview
@@ -33,18 +33,18 @@ class ProjectPermission extends Base
return $this
->db
- ->table(ProjectUserRole::TABLE)
- ->join(User::TABLE, 'id', 'user_id')
- ->join(Project::TABLE, 'id', 'project_id')
- ->eq(ProjectUserRole::TABLE.'.role', $role)
- ->eq(Project::TABLE.'.is_private', 0)
- ->in(Project::TABLE.'.id', $project_ids)
+ ->table(ProjectUserRoleModel::TABLE)
+ ->join(UserModel::TABLE, 'id', 'user_id')
+ ->join(ProjectModel::TABLE, 'id', 'project_id')
+ ->eq(ProjectUserRoleModel::TABLE.'.role', $role)
+ ->eq(ProjectModel::TABLE.'.is_private', 0)
+ ->in(ProjectModel::TABLE.'.id', $project_ids)
->columns(
- User::TABLE.'.id',
- User::TABLE.'.username',
- User::TABLE.'.name',
- Project::TABLE.'.name AS project_name',
- Project::TABLE.'.id'
+ UserModel::TABLE.'.id',
+ UserModel::TABLE.'.username',
+ UserModel::TABLE.'.name',
+ ProjectModel::TABLE.'.name AS project_name',
+ ProjectModel::TABLE.'.id'
);
}
@@ -87,7 +87,7 @@ class ProjectPermission extends Base
public function isEverybodyAllowed($project_id)
{
return $this->db
- ->table(Project::TABLE)
+ ->table(ProjectModel::TABLE)
->eq('id', $project_id)
->eq('is_everybody_allowed', 1)
->exists();
@@ -107,7 +107,7 @@ class ProjectPermission extends Base
}
return in_array(
- $this->projectUserRole->getUserRole($project_id, $user_id),
+ $this->projectUserRoleModel->getUserRole($project_id, $user_id),
array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER, Role::PROJECT_VIEWER)
);
}
@@ -122,8 +122,8 @@ class ProjectPermission extends Base
*/
public function isAssignable($project_id, $user_id)
{
- return $this->user->isActive($user_id) &&
- in_array($this->projectUserRole->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER));
+ return $this->userModel->isActive($user_id) &&
+ in_array($this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER));
}
/**
@@ -136,7 +136,7 @@ class ProjectPermission extends Base
*/
public function isMember($project_id, $user_id)
{
- return in_array($this->projectUserRole->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER, Role::PROJECT_VIEWER));
+ return in_array($this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER, Role::PROJECT_VIEWER));
}
/**
@@ -148,7 +148,7 @@ class ProjectPermission extends Base
*/
public function getActiveProjectIds($user_id)
{
- return array_keys($this->projectUserRole->getActiveProjectsByUser($user_id));
+ return array_keys($this->projectUserRoleModel->getActiveProjectsByUser($user_id));
}
/**
@@ -160,7 +160,7 @@ class ProjectPermission extends Base
*/
public function duplicate($project_src_id, $project_dst_id)
{
- return $this->projectUserRole->duplicate($project_src_id, $project_dst_id) &&
- $this->projectGroupRole->duplicate($project_src_id, $project_dst_id);
+ return $this->projectUserRoleModel->duplicate($project_src_id, $project_dst_id) &&
+ $this->projectGroupRoleModel->duplicate($project_src_id, $project_dst_id);
}
}
diff --git a/app/Model/ProjectUserRole.php b/app/Model/ProjectUserRoleModel.php
index 05f96c6e..a0df0cfa 100644
--- a/app/Model/ProjectUserRole.php
+++ b/app/Model/ProjectUserRoleModel.php
@@ -8,10 +8,10 @@ use Kanboard\Core\Security\Role;
/**
* Project User Role
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class ProjectUserRole extends Base
+class ProjectUserRoleModel extends Base
{
/**
* SQL table name
@@ -29,7 +29,7 @@ class ProjectUserRole extends Base
*/
public function getActiveProjectsByUser($user_id)
{
- return $this->getProjectsByUser($user_id, array(Project::ACTIVE));
+ return $this->getProjectsByUser($user_id, array(ProjectModel::ACTIVE));
}
/**
@@ -40,19 +40,19 @@ class ProjectUserRole extends Base
* @param array $status
* @return array
*/
- public function getProjectsByUser($user_id, $status = array(Project::ACTIVE, Project::INACTIVE))
+ public function getProjectsByUser($user_id, $status = array(ProjectModel::ACTIVE, ProjectModel::INACTIVE))
{
$userProjects = $this->db
- ->hashtable(Project::TABLE)
+ ->hashtable(ProjectModel::TABLE)
->beginOr()
->eq(self::TABLE.'.user_id', $user_id)
- ->eq(Project::TABLE.'.is_everybody_allowed', 1)
+ ->eq(ProjectModel::TABLE.'.is_everybody_allowed', 1)
->closeOr()
- ->in(Project::TABLE.'.is_active', $status)
+ ->in(ProjectModel::TABLE.'.is_active', $status)
->join(self::TABLE, 'project_id', 'id')
- ->getAll(Project::TABLE.'.id', Project::TABLE.'.name');
+ ->getAll(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name');
- $groupProjects = $this->projectGroupRole->getProjectsByUser($user_id, $status);
+ $groupProjects = $this->projectGroupRoleModel->getProjectsByUser($user_id, $status);
$projects = $userProjects + $groupProjects;
asort($projects);
@@ -70,7 +70,7 @@ class ProjectUserRole extends Base
*/
public function getUserRole($project_id, $user_id)
{
- $projectInfo = $this->db->table(Project::TABLE)
+ $projectInfo = $this->db->table(ProjectModel::TABLE)
->eq('id', $project_id)
->columns('owner_id', 'is_everybody_allowed')
->findOne();
@@ -82,7 +82,7 @@ class ProjectUserRole extends Base
$role = $this->db->table(self::TABLE)->eq('user_id', $user_id)->eq('project_id', $project_id)->findOneColumn('role');
if (empty($role)) {
- $role = $this->projectGroupRole->getUserRole($project_id, $user_id);
+ $role = $this->projectGroupRoleModel->getUserRole($project_id, $user_id);
}
return $role;
@@ -98,11 +98,11 @@ class ProjectUserRole extends Base
public function getUsers($project_id)
{
return $this->db->table(self::TABLE)
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', self::TABLE.'.role')
- ->join(User::TABLE, 'id', 'user_id')
+ ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', self::TABLE.'.role')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->eq('project_id', $project_id)
- ->asc(User::TABLE.'.username')
- ->asc(User::TABLE.'.name')
+ ->asc(UserModel::TABLE.'.username')
+ ->asc(UserModel::TABLE.'.name')
->findAll();
}
@@ -116,10 +116,10 @@ class ProjectUserRole extends Base
public function getAllUsers($project_id)
{
$userMembers = $this->getUsers($project_id);
- $groupMembers = $this->projectGroupRole->getUsers($project_id);
+ $groupMembers = $this->projectGroupRoleModel->getUsers($project_id);
$members = array_merge($userMembers, $groupMembers);
- return $this->user->prepareList($members);
+ return $this->userModel->prepareList($members);
}
/**
@@ -134,7 +134,7 @@ class ProjectUserRole extends Base
$users = array();
$userMembers = $this->getUsers($project_id);
- $groupMembers = $this->projectGroupRole->getUsers($project_id);
+ $groupMembers = $this->projectGroupRoleModel->getUsers($project_id);
$members = array_merge($userMembers, $groupMembers);
foreach ($members as $user) {
@@ -157,22 +157,22 @@ class ProjectUserRole extends Base
*/
public function getAssignableUsers($project_id)
{
- if ($this->projectPermission->isEverybodyAllowed($project_id)) {
- return $this->user->getActiveUsersList();
+ if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) {
+ return $this->userModel->getActiveUsersList();
}
$userMembers = $this->db->table(self::TABLE)
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name')
- ->join(User::TABLE, 'id', 'user_id')
- ->eq(User::TABLE.'.is_active', 1)
+ ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name')
+ ->join(UserModel::TABLE, 'id', 'user_id')
+ ->eq(UserModel::TABLE.'.is_active', 1)
->eq(self::TABLE.'.project_id', $project_id)
->in(self::TABLE.'.role', array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER))
->findAll();
- $groupMembers = $this->projectGroupRole->getAssignableUsers($project_id);
+ $groupMembers = $this->projectGroupRoleModel->getAssignableUsers($project_id);
$members = array_merge($userMembers, $groupMembers);
- return $this->user->prepareList($members);
+ return $this->userModel->prepareList($members);
}
/**
@@ -198,7 +198,7 @@ class ProjectUserRole extends Base
}
if ($everybody) {
- $users = array(User::EVERYBODY_ID => t('Everybody')) + $users;
+ $users = array(UserModel::EVERYBODY_ID => t('Everybody')) + $users;
}
return $users;
diff --git a/app/Model/RememberMeSession.php b/app/Model/RememberMeSessionModel.php
index e3f2f132..f6c8d648 100644
--- a/app/Model/RememberMeSession.php
+++ b/app/Model/RememberMeSessionModel.php
@@ -8,10 +8,10 @@ use Kanboard\Core\Security\Token;
/**
* Remember Me Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class RememberMeSession extends Base
+class RememberMeSessionModel extends Base
{
/**
* SQL table name
diff --git a/app/Model/Setting.php b/app/Model/SettingModel.php
index 38af22e0..5b2ee54f 100644
--- a/app/Model/Setting.php
+++ b/app/Model/SettingModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Application Settings
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-abstract class Setting extends Base
+abstract class SettingModel extends Base
{
/**
* SQL table name
diff --git a/app/Model/Subtask.php b/app/Model/SubtaskModel.php
index 1d53d6de..b63cf0a1 100644
--- a/app/Model/Subtask.php
+++ b/app/Model/SubtaskModel.php
@@ -9,10 +9,10 @@ use Kanboard\Event\SubtaskEvent;
/**
* Subtask Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Subtask extends Base
+class SubtaskModel extends Base
{
/**
* SQL table name
@@ -96,20 +96,20 @@ class Subtask extends Base
*/
public function getUserQuery($user_id, array $status)
{
- return $this->db->table(Subtask::TABLE)
+ return $this->db->table(SubtaskModel::TABLE)
->columns(
- Subtask::TABLE.'.*',
- Task::TABLE.'.project_id',
- Task::TABLE.'.color_id',
- Task::TABLE.'.title AS task_name',
- Project::TABLE.'.name AS project_name'
+ SubtaskModel::TABLE.'.*',
+ TaskModel::TABLE.'.project_id',
+ TaskModel::TABLE.'.color_id',
+ TaskModel::TABLE.'.title AS task_name',
+ ProjectModel::TABLE.'.name AS project_name'
)
- ->subquery($this->subtaskTimeTracking->getTimerQuery($user_id), 'timer_start_date')
+ ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($user_id), 'timer_start_date')
->eq('user_id', $user_id)
- ->eq(Project::TABLE.'.is_active', Project::ACTIVE)
- ->in(Subtask::TABLE.'.status', $status)
- ->join(Task::TABLE, 'id', 'task_id')
- ->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
+ ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE)
+ ->in(SubtaskModel::TABLE.'.status', $status)
+ ->join(TaskModel::TABLE, 'id', 'task_id')
+ ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE)
->callback(array($this, 'addStatusName'));
}
@@ -127,11 +127,11 @@ class Subtask extends Base
->eq('task_id', $task_id)
->columns(
self::TABLE.'.*',
- User::TABLE.'.username',
- User::TABLE.'.name'
+ UserModel::TABLE.'.username',
+ UserModel::TABLE.'.name'
)
- ->subquery($this->subtaskTimeTracking->getTimerQuery($this->userSession->getId()), 'timer_start_date')
- ->join(User::TABLE, 'id', 'user_id')
+ ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->asc(self::TABLE.'.position')
->callback(array($this, 'addStatusName'))
->findAll();
@@ -151,9 +151,9 @@ class Subtask extends Base
return $this->db
->table(self::TABLE)
->eq(self::TABLE.'.id', $subtask_id)
- ->columns(self::TABLE.'.*', User::TABLE.'.username', User::TABLE.'.name')
- ->subquery($this->subtaskTimeTracking->getTimerQuery($this->userSession->getId()), 'timer_start_date')
- ->join(User::TABLE, 'id', 'user_id')
+ ->columns(self::TABLE.'.*', UserModel::TABLE.'.username', UserModel::TABLE.'.name')
+ ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date')
+ ->join(UserModel::TABLE, 'id', 'user_id')
->callback(array($this, 'addStatusName'))
->findOne();
}
@@ -345,7 +345,7 @@ class Subtask extends Base
*/
public function hasSubtaskInProgress($user_id)
{
- return $this->config->get('subtask_restriction') == 1 &&
+ return $this->configModel->get('subtask_restriction') == 1 &&
$this->db->table(self::TABLE)
->eq('status', self::STATUS_INPROGRESS)
->eq('user_id', $user_id)
@@ -383,7 +383,7 @@ class Subtask extends Base
{
return $this->db->transaction(function (Database $db) use ($src_task_id, $dst_task_id) {
- $subtasks = $db->table(Subtask::TABLE)
+ $subtasks = $db->table(SubtaskModel::TABLE)
->columns('title', 'time_estimated', 'position')
->eq('task_id', $src_task_id)
->asc('position')
@@ -392,7 +392,7 @@ class Subtask extends Base
foreach ($subtasks as &$subtask) {
$subtask['task_id'] = $dst_task_id;
- if (! $db->table(Subtask::TABLE)->save($subtask)) {
+ if (! $db->table(SubtaskModel::TABLE)->save($subtask)) {
return false;
}
}
@@ -411,7 +411,7 @@ class Subtask extends Base
{
$subtask = $this->getById($subtask_id);
- $task_id = $this->taskCreation->create(array(
+ $task_id = $this->taskCreationModel->create(array(
'project_id' => $project_id,
'title' => $subtask['title'],
'time_estimated' => $subtask['time_estimated'],
diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTrackingModel.php
index 8b5d2545..062e594a 100644
--- a/app/Model/SubtaskTimeTracking.php
+++ b/app/Model/SubtaskTimeTrackingModel.php
@@ -6,12 +6,12 @@ use DateTime;
use Kanboard\Core\Base;
/**
- * Subtask timesheet
+ * Subtask time tracking
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class SubtaskTimeTracking extends Base
+class SubtaskTimeTrackingModel extends Base
{
/**
* SQL table name
@@ -37,7 +37,7 @@ class SubtaskTimeTracking extends Base
$user_id,
$this->db->escapeIdentifier('end'),
$this->db->escapeIdentifier('subtask_id'),
- Subtask::TABLE.'.id'
+ SubtaskModel::TABLE.'.id'
);
}
@@ -58,14 +58,14 @@ class SubtaskTimeTracking extends Base
self::TABLE.'.end',
self::TABLE.'.start',
self::TABLE.'.time_spent',
- Subtask::TABLE.'.task_id',
- Subtask::TABLE.'.title AS subtask_title',
- Task::TABLE.'.title AS task_title',
- Task::TABLE.'.project_id',
- Task::TABLE.'.color_id'
+ SubtaskModel::TABLE.'.task_id',
+ SubtaskModel::TABLE.'.title AS subtask_title',
+ TaskModel::TABLE.'.title AS task_title',
+ TaskModel::TABLE.'.project_id',
+ TaskModel::TABLE.'.color_id'
)
- ->join(Subtask::TABLE, 'id', 'subtask_id')
- ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE)
+ ->join(SubtaskModel::TABLE, 'id', 'subtask_id')
+ ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE)
->eq(self::TABLE.'.user_id', $user_id);
}
@@ -87,16 +87,16 @@ class SubtaskTimeTracking extends Base
self::TABLE.'.start',
self::TABLE.'.time_spent',
self::TABLE.'.user_id',
- Subtask::TABLE.'.task_id',
- Subtask::TABLE.'.title AS subtask_title',
- Task::TABLE.'.project_id',
- User::TABLE.'.username',
- User::TABLE.'.name AS user_fullname'
+ SubtaskModel::TABLE.'.task_id',
+ SubtaskModel::TABLE.'.title AS subtask_title',
+ TaskModel::TABLE.'.project_id',
+ UserModel::TABLE.'.username',
+ UserModel::TABLE.'.name AS user_fullname'
)
- ->join(Subtask::TABLE, 'id', 'subtask_id')
- ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE)
- ->join(User::TABLE, 'id', 'user_id', self::TABLE)
- ->eq(Task::TABLE.'.id', $task_id);
+ ->join(SubtaskModel::TABLE, 'id', 'subtask_id')
+ ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE)
+ ->join(UserModel::TABLE, 'id', 'user_id', self::TABLE)
+ ->eq(TaskModel::TABLE.'.id', $task_id);
}
/**
@@ -117,17 +117,17 @@ class SubtaskTimeTracking extends Base
self::TABLE.'.start',
self::TABLE.'.time_spent',
self::TABLE.'.user_id',
- Subtask::TABLE.'.task_id',
- Subtask::TABLE.'.title AS subtask_title',
- Task::TABLE.'.project_id',
- Task::TABLE.'.color_id',
- User::TABLE.'.username',
- User::TABLE.'.name AS user_fullname'
+ SubtaskModel::TABLE.'.task_id',
+ SubtaskModel::TABLE.'.title AS subtask_title',
+ TaskModel::TABLE.'.project_id',
+ TaskModel::TABLE.'.color_id',
+ UserModel::TABLE.'.username',
+ UserModel::TABLE.'.name AS user_fullname'
)
- ->join(Subtask::TABLE, 'id', 'subtask_id')
- ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE)
- ->join(User::TABLE, 'id', 'user_id', self::TABLE)
- ->eq(Task::TABLE.'.project_id', $project_id)
+ ->join(SubtaskModel::TABLE, 'id', 'subtask_id')
+ ->join(TaskModel::TABLE, 'id', 'task_id', SubtaskModel::TABLE)
+ ->join(UserModel::TABLE, 'id', 'user_id', self::TABLE)
+ ->eq(TaskModel::TABLE.'.project_id', $project_id)
->asc(self::TABLE.'.id');
}
@@ -250,10 +250,10 @@ class SubtaskTimeTracking extends Base
*/
public function updateSubtaskTimeSpent($subtask_id, $time_spent)
{
- $subtask = $this->subtask->getById($subtask_id);
+ $subtask = $this->subtaskModel->getById($subtask_id);
// Fire the event subtask.update
- return $this->subtask->update(array(
+ return $this->subtaskModel->update(array(
'id' => $subtask['id'],
'time_spent' => $subtask['time_spent'] + $time_spent,
'task_id' => $subtask['task_id'],
@@ -272,7 +272,7 @@ class SubtaskTimeTracking extends Base
$values = $this->calculateSubtaskTime($task_id);
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('id', $task_id)
->update($values);
}
@@ -287,7 +287,7 @@ class SubtaskTimeTracking extends Base
public function calculateSubtaskTime($task_id)
{
return $this->db
- ->table(Subtask::TABLE)
+ ->table(SubtaskModel::TABLE)
->eq('task_id', $task_id)
->columns(
'SUM(time_spent) AS time_spent',
diff --git a/app/Model/Swimlane.php b/app/Model/SwimlaneModel.php
index 8efe68da..87591b99 100644
--- a/app/Model/Swimlane.php
+++ b/app/Model/SwimlaneModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Swimlanes
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Swimlane extends Base
+class SwimlaneModel extends Base
{
/**
* SQL table name
@@ -99,7 +99,7 @@ class Swimlane extends Base
public function getDefault($project_id)
{
$result = $this->db
- ->table(Project::TABLE)
+ ->table(ProjectModel::TABLE)
->eq('id', $project_id)
->columns('id', 'default_swimlane', 'show_default_swimlane')
->findOne();
@@ -169,7 +169,7 @@ class Swimlane extends Base
->findAll();
$default_swimlane = $this->db
- ->table(Project::TABLE)
+ ->table(ProjectModel::TABLE)
->eq('id', $project_id)
->eq('show_default_swimlane', 1)
->findOneColumn('default_swimlane');
@@ -197,7 +197,7 @@ class Swimlane extends Base
public function getList($project_id, $prepend = false, $only_active = false)
{
$swimlanes = array();
- $default = $this->db->table(Project::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane');
+ $default = $this->db->table(ProjectModel::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane');
if ($prepend) {
$swimlanes[-1] = t('All swimlanes');
@@ -224,7 +224,7 @@ class Swimlane extends Base
*/
public function create($values)
{
- if (! $this->project->exists($values['project_id'])) {
+ if (! $this->projectModel->exists($values['project_id'])) {
return 0;
}
@@ -257,7 +257,7 @@ class Swimlane extends Base
public function updateDefault(array $values)
{
return $this->db
- ->table(Project::TABLE)
+ ->table(ProjectModel::TABLE)
->eq('id', $values['id'])
->update(array(
'default_swimlane' => $values['default_swimlane'],
@@ -275,7 +275,7 @@ class Swimlane extends Base
public function enableDefault($project_id)
{
return $this->db
- ->table(Project::TABLE)
+ ->table(ProjectModel::TABLE)
->eq('id', $project_id)
->update(array(
'show_default_swimlane' => 1,
@@ -292,7 +292,7 @@ class Swimlane extends Base
public function disableDefault($project_id)
{
return $this->db
- ->table(Project::TABLE)
+ ->table(ProjectModel::TABLE)
->eq('id', $project_id)
->update(array(
'show_default_swimlane' => 0,
@@ -373,7 +373,7 @@ class Swimlane extends Base
$this->db->startTransaction();
// Tasks should not be assigned anymore to this swimlane
- $this->db->table(Task::TABLE)->eq('swimlane_id', $swimlane_id)->update(array('swimlane_id' => 0));
+ $this->db->table(TaskModel::TABLE)->eq('swimlane_id', $swimlane_id)->update(array('swimlane_id' => 0));
if (! $this->db->table(self::TABLE)->eq('id', $swimlane_id)->remove()) {
$this->db->cancelTransaction();
diff --git a/app/Model/TaskAnalytic.php b/app/Model/TaskAnalyticModel.php
index bf118b4e..3d6fe8a8 100644
--- a/app/Model/TaskAnalytic.php
+++ b/app/Model/TaskAnalyticModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Task Analytic
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskAnalytic extends Base
+class TaskAnalyticModel extends Base
{
/**
* Get the time between date_creation and date_completed or now if empty
@@ -50,8 +50,8 @@ class TaskAnalytic extends Base
public function getTimeSpentByColumn(array $task)
{
$result = array();
- $columns = $this->column->getList($task['project_id']);
- $sums = $this->transition->getTimeSpentByTask($task['id']);
+ $columns = $this->columnModel->getList($task['project_id']);
+ $sums = $this->transitionModel->getTimeSpentByTask($task['id']);
foreach ($columns as $column_id => $column_title) {
$time_spent = isset($sums[$column_id]) ? $sums[$column_id] : 0;
diff --git a/app/Model/TaskCreation.php b/app/Model/TaskCreationModel.php
index 2abfd95c..3800f831 100644
--- a/app/Model/TaskCreation.php
+++ b/app/Model/TaskCreationModel.php
@@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent;
/**
* Task Creation
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskCreation extends Base
+class TaskCreationModel extends Base
{
/**
* Create a task
@@ -22,18 +22,18 @@ class TaskCreation extends Base
*/
public function create(array $values)
{
- if (! $this->project->exists($values['project_id'])) {
+ if (! $this->projectModel->exists($values['project_id'])) {
return 0;
}
$position = empty($values['position']) ? 0 : $values['position'];
$this->prepare($values);
- $task_id = $this->db->table(Task::TABLE)->persist($values);
+ $task_id = $this->db->table(TaskModel::TABLE)->persist($values);
if ($task_id !== false) {
if ($position > 0 && $values['position'] > 1) {
- $this->taskPosition->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false);
+ $this->taskPositionModel->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false);
}
$this->fireEvents($task_id, $values);
@@ -57,11 +57,11 @@ class TaskCreation extends Base
$this->helper->model->resetFields($values, array('date_started', 'creator_id', 'owner_id', 'swimlane_id', 'date_due', 'score', 'category_id', 'time_estimated'));
if (empty($values['column_id'])) {
- $values['column_id'] = $this->column->getFirstColumnId($values['project_id']);
+ $values['column_id'] = $this->columnModel->getFirstColumnId($values['project_id']);
}
if (empty($values['color_id'])) {
- $values['color_id'] = $this->color->getDefaultColor();
+ $values['color_id'] = $this->colorModel->getDefaultColor();
}
if (empty($values['title'])) {
@@ -76,7 +76,7 @@ class TaskCreation extends Base
$values['date_creation'] = time();
$values['date_modification'] = $values['date_creation'];
$values['date_moved'] = $values['date_creation'];
- $values['position'] = $this->taskFinder->countByColumnAndSwimlaneId($values['project_id'], $values['column_id'], $values['swimlane_id']) + 1;
+ $values['position'] = $this->taskFinderModel->countByColumnAndSwimlaneId($values['project_id'], $values['column_id'], $values['swimlane_id']) + 1;
}
/**
@@ -90,14 +90,14 @@ class TaskCreation extends Base
{
$event = new TaskEvent(array('task_id' => $task_id) + $values);
- $this->logger->debug('Event fired: '.Task::EVENT_CREATE_UPDATE);
- $this->logger->debug('Event fired: '.Task::EVENT_CREATE);
+ $this->logger->debug('Event fired: '.TaskModel::EVENT_CREATE_UPDATE);
+ $this->logger->debug('Event fired: '.TaskModel::EVENT_CREATE);
- $this->dispatcher->dispatch(Task::EVENT_CREATE_UPDATE, $event);
- $this->dispatcher->dispatch(Task::EVENT_CREATE, $event);
+ $this->dispatcher->dispatch(TaskModel::EVENT_CREATE_UPDATE, $event);
+ $this->dispatcher->dispatch(TaskModel::EVENT_CREATE, $event);
if (! empty($values['description'])) {
- $this->userMention->fireEvents($values['description'], Task::EVENT_USER_MENTION, $event);
+ $this->userMentionModel->fireEvents($values['description'], TaskModel::EVENT_USER_MENTION, $event);
}
}
}
diff --git a/app/Model/TaskDuplication.php b/app/Model/TaskDuplicationModel.php
index 56457a01..9a4613e2 100644
--- a/app/Model/TaskDuplication.php
+++ b/app/Model/TaskDuplicationModel.php
@@ -10,10 +10,10 @@ use Kanboard\Event\TaskEvent;
/**
* Task Duplication
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskDuplication extends Base
+class TaskDuplicationModel extends Base
{
/**
* Fields to copy when duplicating a task
@@ -63,19 +63,19 @@ class TaskDuplication extends Base
{
$values = $this->copyFields($task_id);
- if ($values['recurrence_status'] == Task::RECURRING_STATUS_PENDING) {
+ if ($values['recurrence_status'] == TaskModel::RECURRING_STATUS_PENDING) {
$values['recurrence_parent'] = $task_id;
- $values['column_id'] = $this->column->getFirstColumnId($values['project_id']);
+ $values['column_id'] = $this->columnModel->getFirstColumnId($values['project_id']);
$this->calculateRecurringTaskDueDate($values);
$recurring_task_id = $this->save($task_id, $values);
if ($recurring_task_id > 0) {
$parent_update = $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('id', $task_id)
->update(array(
- 'recurrence_status' => Task::RECURRING_STATUS_PROCESSED,
+ 'recurrence_status' => TaskModel::RECURRING_STATUS_PROCESSED,
'recurrence_child' => $recurring_task_id,
));
@@ -128,22 +128,22 @@ class TaskDuplication extends Base
*/
public function moveToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null)
{
- $task = $this->taskFinder->getById($task_id);
+ $task = $this->taskFinderModel->getById($task_id);
$values = array();
$values['is_active'] = 1;
$values['project_id'] = $project_id;
$values['column_id'] = $column_id !== null ? $column_id : $task['column_id'];
- $values['position'] = $this->taskFinder->countByColumnId($project_id, $values['column_id']) + 1;
+ $values['position'] = $this->taskFinderModel->countByColumnId($project_id, $values['column_id']) + 1;
$values['swimlane_id'] = $swimlane_id !== null ? $swimlane_id : $task['swimlane_id'];
$values['category_id'] = $category_id !== null ? $category_id : $task['category_id'];
$values['owner_id'] = $owner_id !== null ? $owner_id : $task['owner_id'];
$this->checkDestinationProjectValues($values);
- if ($this->db->table(Task::TABLE)->eq('id', $task['id'])->update($values)) {
+ if ($this->db->table(TaskModel::TABLE)->eq('id', $task['id'])->update($values)) {
$this->container['dispatcher']->dispatch(
- Task::EVENT_MOVE_PROJECT,
+ TaskModel::EVENT_MOVE_PROJECT,
new TaskEvent(array_merge($task, $values, array('task_id' => $task['id'])))
);
}
@@ -161,34 +161,34 @@ class TaskDuplication extends Base
public function checkDestinationProjectValues(array &$values)
{
// Check if the assigned user is allowed for the destination project
- if ($values['owner_id'] > 0 && ! $this->projectPermission->isUserAllowed($values['project_id'], $values['owner_id'])) {
+ if ($values['owner_id'] > 0 && ! $this->projectPermissionModel->isUserAllowed($values['project_id'], $values['owner_id'])) {
$values['owner_id'] = 0;
}
// Check if the category exists for the destination project
if ($values['category_id'] > 0) {
- $values['category_id'] = $this->category->getIdByName(
+ $values['category_id'] = $this->categoryModel->getIdByName(
$values['project_id'],
- $this->category->getNameById($values['category_id'])
+ $this->categoryModel->getNameById($values['category_id'])
);
}
// Check if the swimlane exists for the destination project
if ($values['swimlane_id'] > 0) {
- $values['swimlane_id'] = $this->swimlane->getIdByName(
+ $values['swimlane_id'] = $this->swimlaneModel->getIdByName(
$values['project_id'],
- $this->swimlane->getNameById($values['swimlane_id'])
+ $this->swimlaneModel->getNameById($values['swimlane_id'])
);
}
// Check if the column exists for the destination project
if ($values['column_id'] > 0) {
- $values['column_id'] = $this->column->getColumnIdByTitle(
+ $values['column_id'] = $this->columnModel->getColumnIdByTitle(
$values['project_id'],
- $this->column->getColumnTitleById($values['column_id'])
+ $this->columnModel->getColumnTitleById($values['column_id'])
);
- $values['column_id'] = $values['column_id'] ?: $this->column->getFirstColumnId($values['project_id']);
+ $values['column_id'] = $values['column_id'] ?: $this->columnModel->getFirstColumnId($values['project_id']);
}
return $values;
@@ -203,7 +203,7 @@ class TaskDuplication extends Base
public function calculateRecurringTaskDueDate(array &$values)
{
if (! empty($values['date_due']) && $values['recurrence_factor'] != 0) {
- if ($values['recurrence_basedate'] == Task::RECURRING_BASEDATE_TRIGGERDATE) {
+ if ($values['recurrence_basedate'] == TaskModel::RECURRING_BASEDATE_TRIGGERDATE) {
$values['date_due'] = time();
}
@@ -211,10 +211,10 @@ class TaskDuplication extends Base
$subtract = $values['recurrence_factor'] < 0;
switch ($values['recurrence_timeframe']) {
- case Task::RECURRING_TIMEFRAME_MONTHS:
+ case TaskModel::RECURRING_TIMEFRAME_MONTHS:
$interval = 'P' . $factor . 'M';
break;
- case Task::RECURRING_TIMEFRAME_YEARS:
+ case TaskModel::RECURRING_TIMEFRAME_YEARS:
$interval = 'P' . $factor . 'Y';
break;
default:
@@ -239,7 +239,7 @@ class TaskDuplication extends Base
*/
private function copyFields($task_id)
{
- $task = $this->taskFinder->getById($task_id);
+ $task = $this->taskFinderModel->getById($task_id);
$values = array();
foreach ($this->fields_to_duplicate as $field) {
@@ -259,10 +259,10 @@ class TaskDuplication extends Base
*/
private function save($task_id, array $values)
{
- $new_task_id = $this->taskCreation->create($values);
+ $new_task_id = $this->taskCreationModel->create($values);
if ($new_task_id) {
- $this->subtask->duplicate($task_id, $new_task_id);
+ $this->subtaskModel->duplicate($task_id, $new_task_id);
}
return $new_task_id;
diff --git a/app/Model/TaskExternalLink.php b/app/Model/TaskExternalLinkModel.php
index f77a72bf..220b9c6f 100644
--- a/app/Model/TaskExternalLink.php
+++ b/app/Model/TaskExternalLinkModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Task External Link Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskExternalLink extends Base
+class TaskExternalLinkModel extends Base
{
/**
* SQL table name
@@ -31,10 +31,10 @@ class TaskExternalLink extends Base
$types = $this->externalLinkManager->getTypes();
$links = $this->db->table(self::TABLE)
- ->columns(self::TABLE.'.*', User::TABLE.'.name AS creator_name', User::TABLE.'.username AS creator_username')
+ ->columns(self::TABLE.'.*', UserModel::TABLE.'.name AS creator_name', UserModel::TABLE.'.username AS creator_username')
->eq('task_id', $task_id)
->asc('title')
- ->join(User::TABLE, 'id', 'creator_id')
+ ->join(UserModel::TABLE, 'id', 'creator_id')
->findAll();
foreach ($links as &$link) {
diff --git a/app/Model/TaskFile.php b/app/Model/TaskFileModel.php
index 45a3b97f..21d319b0 100644
--- a/app/Model/TaskFile.php
+++ b/app/Model/TaskFileModel.php
@@ -5,10 +5,10 @@ namespace Kanboard\Model;
/**
* Task File Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskFile extends File
+class TaskFileModel extends FileModel
{
/**
* SQL table name
diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinderModel.php
index fed3a580..8b636e28 100644
--- a/app/Model/TaskFinder.php
+++ b/app/Model/TaskFinderModel.php
@@ -8,10 +8,10 @@ use Kanboard\Core\Base;
/**
* Task Finder model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskFinder extends Base
+class TaskFinderModel extends Base
{
/**
* Get query for project user overview
@@ -28,27 +28,27 @@ class TaskFinder extends Base
}
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->columns(
- Task::TABLE.'.id',
- Task::TABLE.'.title',
- Task::TABLE.'.date_due',
- Task::TABLE.'.date_started',
- Task::TABLE.'.project_id',
- Task::TABLE.'.color_id',
- Task::TABLE.'.priority',
- Task::TABLE.'.time_spent',
- Task::TABLE.'.time_estimated',
- Project::TABLE.'.name AS project_name',
- Column::TABLE.'.title AS column_name',
- User::TABLE.'.username AS assignee_username',
- User::TABLE.'.name AS assignee_name'
+ TaskModel::TABLE.'.id',
+ TaskModel::TABLE.'.title',
+ TaskModel::TABLE.'.date_due',
+ TaskModel::TABLE.'.date_started',
+ TaskModel::TABLE.'.project_id',
+ TaskModel::TABLE.'.color_id',
+ TaskModel::TABLE.'.priority',
+ TaskModel::TABLE.'.time_spent',
+ TaskModel::TABLE.'.time_estimated',
+ ProjectModel::TABLE.'.name AS project_name',
+ ColumnModel::TABLE.'.title AS column_name',
+ UserModel::TABLE.'.username AS assignee_username',
+ UserModel::TABLE.'.name AS assignee_name'
)
- ->eq(Task::TABLE.'.is_active', $is_active)
- ->in(Project::TABLE.'.id', $project_ids)
- ->join(Project::TABLE, 'id', 'project_id')
- ->join(Column::TABLE, 'id', 'column_id', Task::TABLE)
- ->join(User::TABLE, 'id', 'owner_id', Task::TABLE);
+ ->eq(TaskModel::TABLE.'.is_active', $is_active)
+ ->in(ProjectModel::TABLE.'.id', $project_ids)
+ ->join(ProjectModel::TABLE, 'id', 'project_id')
+ ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE)
+ ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE);
}
/**
@@ -61,7 +61,7 @@ class TaskFinder extends Base
public function getUserQuery($user_id)
{
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->columns(
'tasks.id',
'tasks.title',
@@ -77,11 +77,11 @@ class TaskFinder extends Base
'projects.name AS project_name',
'columns.title AS column_title'
)
- ->join(Project::TABLE, 'id', 'project_id')
- ->join(Column::TABLE, 'id', 'column_id')
- ->eq(Task::TABLE.'.owner_id', $user_id)
- ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN)
- ->eq(Project::TABLE.'.is_active', Project::ACTIVE);
+ ->join(ProjectModel::TABLE, 'id', 'project_id')
+ ->join(ColumnModel::TABLE, 'id', 'column_id')
+ ->eq(TaskModel::TABLE.'.owner_id', $user_id)
+ ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
+ ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE);
}
/**
@@ -93,15 +93,15 @@ class TaskFinder extends Base
public function getExtendedQuery()
{
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->columns(
- '(SELECT COUNT(*) FROM '.Comment::TABLE.' WHERE task_id=tasks.id) AS nb_comments',
- '(SELECT COUNT(*) FROM '.TaskFile::TABLE.' WHERE task_id=tasks.id) AS nb_files',
- '(SELECT COUNT(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id) AS nb_subtasks',
- '(SELECT COUNT(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id AND status=2) AS nb_completed_subtasks',
- '(SELECT COUNT(*) FROM '.TaskLink::TABLE.' WHERE '.TaskLink::TABLE.'.task_id = tasks.id) AS nb_links',
- '(SELECT COUNT(*) FROM '.TaskExternalLink::TABLE.' WHERE '.TaskExternalLink::TABLE.'.task_id = tasks.id) AS nb_external_links',
- '(SELECT DISTINCT 1 FROM '.TaskLink::TABLE.' WHERE '.TaskLink::TABLE.'.task_id = tasks.id AND '.TaskLink::TABLE.'.link_id = 9) AS is_milestone',
+ '(SELECT COUNT(*) FROM '.CommentModel::TABLE.' WHERE task_id=tasks.id) AS nb_comments',
+ '(SELECT COUNT(*) FROM '.TaskFileModel::TABLE.' WHERE task_id=tasks.id) AS nb_files',
+ '(SELECT COUNT(*) FROM '.SubtaskModel::TABLE.' WHERE '.SubtaskModel::TABLE.'.task_id=tasks.id) AS nb_subtasks',
+ '(SELECT COUNT(*) FROM '.SubtaskModel::TABLE.' WHERE '.SubtaskModel::TABLE.'.task_id=tasks.id AND status=2) AS nb_completed_subtasks',
+ '(SELECT COUNT(*) FROM '.TaskLinkModel::TABLE.' WHERE '.TaskLinkModel::TABLE.'.task_id = tasks.id) AS nb_links',
+ '(SELECT COUNT(*) FROM '.TaskExternalLinkModel::TABLE.' WHERE '.TaskExternalLinkModel::TABLE.'.task_id = tasks.id) AS nb_external_links',
+ '(SELECT DISTINCT 1 FROM '.TaskLinkModel::TABLE.' WHERE '.TaskLinkModel::TABLE.'.task_id = tasks.id AND '.TaskLinkModel::TABLE.'.link_id = 9) AS is_milestone',
'tasks.id',
'tasks.reference',
'tasks.title',
@@ -132,24 +132,24 @@ class TaskFinder extends Base
'tasks.recurrence_child',
'tasks.time_estimated',
'tasks.time_spent',
- User::TABLE.'.username AS assignee_username',
- User::TABLE.'.name AS assignee_name',
- User::TABLE.'.email AS assignee_email',
- User::TABLE.'.avatar_path AS assignee_avatar_path',
- Category::TABLE.'.name AS category_name',
- Category::TABLE.'.description AS category_description',
- Column::TABLE.'.title AS column_name',
- Column::TABLE.'.position AS column_position',
- Swimlane::TABLE.'.name AS swimlane_name',
- Project::TABLE.'.default_swimlane',
- Project::TABLE.'.name AS project_name'
+ UserModel::TABLE.'.username AS assignee_username',
+ UserModel::TABLE.'.name AS assignee_name',
+ UserModel::TABLE.'.email AS assignee_email',
+ UserModel::TABLE.'.avatar_path AS assignee_avatar_path',
+ CategoryModel::TABLE.'.name AS category_name',
+ CategoryModel::TABLE.'.description AS category_description',
+ ColumnModel::TABLE.'.title AS column_name',
+ ColumnModel::TABLE.'.position AS column_position',
+ SwimlaneModel::TABLE.'.name AS swimlane_name',
+ ProjectModel::TABLE.'.default_swimlane',
+ ProjectModel::TABLE.'.name AS project_name'
)
- ->join(User::TABLE, 'id', 'owner_id', Task::TABLE)
- ->left(User::TABLE, 'uc', 'id', Task::TABLE, 'creator_id')
- ->join(Category::TABLE, 'id', 'category_id', Task::TABLE)
- ->join(Column::TABLE, 'id', 'column_id', Task::TABLE)
- ->join(Swimlane::TABLE, 'id', 'swimlane_id', Task::TABLE)
- ->join(Project::TABLE, 'id', 'project_id', Task::TABLE);
+ ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE)
+ ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id')
+ ->join(CategoryModel::TABLE, 'id', 'category_id', TaskModel::TABLE)
+ ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE)
+ ->join(SwimlaneModel::TABLE, 'id', 'swimlane_id', TaskModel::TABLE)
+ ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE);
}
/**
@@ -164,11 +164,11 @@ class TaskFinder extends Base
public function getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id = 0)
{
return $this->getExtendedQuery()
- ->eq(Task::TABLE.'.project_id', $project_id)
- ->eq(Task::TABLE.'.column_id', $column_id)
- ->eq(Task::TABLE.'.swimlane_id', $swimlane_id)
- ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN)
- ->asc(Task::TABLE.'.position')
+ ->eq(TaskModel::TABLE.'.project_id', $project_id)
+ ->eq(TaskModel::TABLE.'.column_id', $column_id)
+ ->eq(TaskModel::TABLE.'.swimlane_id', $swimlane_id)
+ ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
+ ->asc(TaskModel::TABLE.'.position')
->findAll();
}
@@ -180,12 +180,12 @@ class TaskFinder extends Base
* @param integer $status_id Status id
* @return array
*/
- public function getAll($project_id, $status_id = Task::STATUS_OPEN)
+ public function getAll($project_id, $status_id = TaskModel::STATUS_OPEN)
{
return $this->db
- ->table(Task::TABLE)
- ->eq(Task::TABLE.'.project_id', $project_id)
- ->eq(Task::TABLE.'.is_active', $status_id)
+ ->table(TaskModel::TABLE)
+ ->eq(TaskModel::TABLE.'.project_id', $project_id)
+ ->eq(TaskModel::TABLE.'.is_active', $status_id)
->findAll();
}
@@ -197,12 +197,12 @@ class TaskFinder extends Base
* @param array $status
* @return array
*/
- public function getAllIds($project_id, array $status = array(Task::STATUS_OPEN))
+ public function getAllIds($project_id, array $status = array(TaskModel::STATUS_OPEN))
{
return $this->db
- ->table(Task::TABLE)
- ->eq(Task::TABLE.'.project_id', $project_id)
- ->in(Task::TABLE.'.is_active', $status)
+ ->table(TaskModel::TABLE)
+ ->eq(TaskModel::TABLE.'.project_id', $project_id)
+ ->in(TaskModel::TABLE.'.is_active', $status)
->findAllByColumn('id');
}
@@ -214,24 +214,24 @@ class TaskFinder extends Base
*/
public function getOverdueTasksQuery()
{
- return $this->db->table(Task::TABLE)
+ return $this->db->table(TaskModel::TABLE)
->columns(
- Task::TABLE.'.id',
- Task::TABLE.'.title',
- Task::TABLE.'.date_due',
- Task::TABLE.'.project_id',
- Task::TABLE.'.creator_id',
- Task::TABLE.'.owner_id',
- Project::TABLE.'.name AS project_name',
- User::TABLE.'.username AS assignee_username',
- User::TABLE.'.name AS assignee_name'
+ TaskModel::TABLE.'.id',
+ TaskModel::TABLE.'.title',
+ TaskModel::TABLE.'.date_due',
+ TaskModel::TABLE.'.project_id',
+ TaskModel::TABLE.'.creator_id',
+ TaskModel::TABLE.'.owner_id',
+ ProjectModel::TABLE.'.name AS project_name',
+ UserModel::TABLE.'.username AS assignee_username',
+ UserModel::TABLE.'.name AS assignee_name'
)
- ->join(Project::TABLE, 'id', 'project_id')
- ->join(User::TABLE, 'id', 'owner_id')
- ->eq(Project::TABLE.'.is_active', 1)
- ->eq(Task::TABLE.'.is_active', 1)
- ->neq(Task::TABLE.'.date_due', 0)
- ->lte(Task::TABLE.'.date_due', mktime(23, 59, 59));
+ ->join(ProjectModel::TABLE, 'id', 'project_id')
+ ->join(UserModel::TABLE, 'id', 'owner_id')
+ ->eq(ProjectModel::TABLE.'.is_active', 1)
+ ->eq(TaskModel::TABLE.'.is_active', 1)
+ ->neq(TaskModel::TABLE.'.date_due', 0)
+ ->lte(TaskModel::TABLE.'.date_due', mktime(23, 59, 59));
}
/**
@@ -254,7 +254,7 @@ class TaskFinder extends Base
*/
public function getOverdueTasksByProject($project_id)
{
- return $this->getOverdueTasksQuery()->eq(Task::TABLE.'.project_id', $project_id)->findAll();
+ return $this->getOverdueTasksQuery()->eq(TaskModel::TABLE.'.project_id', $project_id)->findAll();
}
/**
@@ -266,7 +266,7 @@ class TaskFinder extends Base
*/
public function getOverdueTasksByUser($user_id)
{
- return $this->getOverdueTasksQuery()->eq(Task::TABLE.'.owner_id', $user_id)->findAll();
+ return $this->getOverdueTasksQuery()->eq(TaskModel::TABLE.'.owner_id', $user_id)->findAll();
}
/**
@@ -278,7 +278,7 @@ class TaskFinder extends Base
*/
public function getProjectId($task_id)
{
- return (int) $this->db->table(Task::TABLE)->eq('id', $task_id)->findOneColumn('project_id') ?: 0;
+ return (int) $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->findOneColumn('project_id') ?: 0;
}
/**
@@ -290,7 +290,7 @@ class TaskFinder extends Base
*/
public function getById($task_id)
{
- return $this->db->table(Task::TABLE)->eq('id', $task_id)->findOne();
+ return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->findOne();
}
/**
@@ -303,7 +303,7 @@ class TaskFinder extends Base
*/
public function getByReference($project_id, $reference)
{
- return $this->db->table(Task::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne();
+ return $this->db->table(TaskModel::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne();
}
/**
@@ -378,11 +378,11 @@ class TaskFinder extends Base
*/
public function getICalQuery()
{
- return $this->db->table(Task::TABLE)
- ->left(User::TABLE, 'ua', 'id', Task::TABLE, 'owner_id')
- ->left(User::TABLE, 'uc', 'id', Task::TABLE, 'creator_id')
+ return $this->db->table(TaskModel::TABLE)
+ ->left(UserModel::TABLE, 'ua', 'id', TaskModel::TABLE, 'owner_id')
+ ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id')
->columns(
- Task::TABLE.'.*',
+ TaskModel::TABLE.'.*',
'ua.email AS assignee_email',
'ua.name AS assignee_name',
'ua.username AS assignee_username',
@@ -399,10 +399,10 @@ class TaskFinder extends Base
* @param array $status List of status id
* @return integer
*/
- public function countByProjectId($project_id, array $status = array(Task::STATUS_OPEN, Task::STATUS_CLOSED))
+ public function countByProjectId($project_id, array $status = array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED))
{
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('project_id', $project_id)
->in('is_active', $status)
->count();
@@ -419,7 +419,7 @@ class TaskFinder extends Base
public function countByColumnId($project_id, $column_id)
{
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('project_id', $project_id)
->eq('column_id', $column_id)
->eq('is_active', 1)
@@ -438,7 +438,7 @@ class TaskFinder extends Base
public function countByColumnAndSwimlaneId($project_id, $column_id, $swimlane_id)
{
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('project_id', $project_id)
->eq('column_id', $column_id)
->eq('swimlane_id', $swimlane_id)
@@ -455,7 +455,7 @@ class TaskFinder extends Base
*/
public function exists($task_id)
{
- return $this->db->table(Task::TABLE)->eq('id', $task_id)->exists();
+ return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->exists();
}
/**
@@ -468,9 +468,9 @@ class TaskFinder extends Base
public function getProjectToken($task_id)
{
return $this->db
- ->table(Task::TABLE)
- ->eq(Task::TABLE.'.id', $task_id)
- ->join(Project::TABLE, 'id', 'project_id')
- ->findOneColumn(Project::TABLE.'.token');
+ ->table(TaskModel::TABLE)
+ ->eq(TaskModel::TABLE.'.id', $task_id)
+ ->join(ProjectModel::TABLE, 'id', 'project_id')
+ ->findOneColumn(ProjectModel::TABLE.'.token');
}
}
diff --git a/app/Model/TaskLink.php b/app/Model/TaskLinkModel.php
index 9c5b3ca3..45225e35 100644
--- a/app/Model/TaskLink.php
+++ b/app/Model/TaskLinkModel.php
@@ -8,11 +8,11 @@ use Kanboard\Event\TaskLinkEvent;
/**
* TaskLink model
*
- * @package model
+ * @package Kanboard\Model
* @author Olivier Maridat
* @author Frederic Guillot
*/
-class TaskLink extends Base
+class TaskLinkModel extends Base
{
/**
* SQL table name
@@ -49,7 +49,7 @@ class TaskLink extends Base
*/
public function getOppositeTaskLink(array $task_link)
{
- $opposite_link_id = $this->link->getOppositeLinkId($task_link['link_id']);
+ $opposite_link_id = $this->linkModel->getOppositeLinkId($task_link['link_id']);
return $this->db->table(self::TABLE)
->eq('opposite_task_id', $task_link['task_id'])
@@ -72,31 +72,31 @@ class TaskLink extends Base
->columns(
self::TABLE.'.id',
self::TABLE.'.opposite_task_id AS task_id',
- Link::TABLE.'.label',
- Task::TABLE.'.title',
- Task::TABLE.'.is_active',
- Task::TABLE.'.project_id',
- Task::TABLE.'.column_id',
- Task::TABLE.'.color_id',
- Task::TABLE.'.time_spent AS task_time_spent',
- Task::TABLE.'.time_estimated AS task_time_estimated',
- Task::TABLE.'.owner_id AS task_assignee_id',
- User::TABLE.'.username AS task_assignee_username',
- User::TABLE.'.name AS task_assignee_name',
- Column::TABLE.'.title AS column_title',
- Project::TABLE.'.name AS project_name'
+ LinkModel::TABLE.'.label',
+ TaskModel::TABLE.'.title',
+ TaskModel::TABLE.'.is_active',
+ TaskModel::TABLE.'.project_id',
+ TaskModel::TABLE.'.column_id',
+ TaskModel::TABLE.'.color_id',
+ TaskModel::TABLE.'.time_spent AS task_time_spent',
+ TaskModel::TABLE.'.time_estimated AS task_time_estimated',
+ TaskModel::TABLE.'.owner_id AS task_assignee_id',
+ UserModel::TABLE.'.username AS task_assignee_username',
+ UserModel::TABLE.'.name AS task_assignee_name',
+ ColumnModel::TABLE.'.title AS column_title',
+ ProjectModel::TABLE.'.name AS project_name'
)
->eq(self::TABLE.'.task_id', $task_id)
- ->join(Link::TABLE, 'id', 'link_id')
- ->join(Task::TABLE, 'id', 'opposite_task_id')
- ->join(Column::TABLE, 'id', 'column_id', Task::TABLE)
- ->join(User::TABLE, 'id', 'owner_id', Task::TABLE)
- ->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
- ->asc(Link::TABLE.'.id')
- ->desc(Column::TABLE.'.position')
- ->desc(Task::TABLE.'.is_active')
- ->asc(Task::TABLE.'.position')
- ->asc(Task::TABLE.'.id')
+ ->join(LinkModel::TABLE, 'id', 'link_id')
+ ->join(TaskModel::TABLE, 'id', 'opposite_task_id')
+ ->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE)
+ ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE)
+ ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE)
+ ->asc(LinkModel::TABLE.'.id')
+ ->desc(ColumnModel::TABLE.'.position')
+ ->desc(TaskModel::TABLE.'.is_active')
+ ->asc(TaskModel::TABLE.'.position')
+ ->asc(TaskModel::TABLE.'.id')
->findAll();
}
@@ -132,7 +132,7 @@ class TaskLink extends Base
private function fireEvents(array $events)
{
foreach ($events as $event) {
- $event['project_id'] = $this->taskFinder->getProjectId($event['task_id']);
+ $event['project_id'] = $this->taskFinderModel->getProjectId($event['task_id']);
$this->container['dispatcher']->dispatch(self::EVENT_CREATE_UPDATE, new TaskLinkEvent($event));
}
}
@@ -152,7 +152,7 @@ class TaskLink extends Base
$this->db->startTransaction();
// Get opposite link
- $opposite_link_id = $this->link->getOppositeLinkId($link_id);
+ $opposite_link_id = $this->linkModel->getOppositeLinkId($link_id);
$values = array(
'task_id' => $task_id,
@@ -204,7 +204,7 @@ class TaskLink extends Base
$opposite_task_link = $this->getOppositeTaskLink($task_link);
// Get opposite link
- $opposite_link_id = $this->link->getOppositeLinkId($link_id);
+ $opposite_link_id = $this->linkModel->getOppositeLinkId($link_id);
// Update the original task link
$values = array(
@@ -248,7 +248,7 @@ class TaskLink extends Base
$this->db->startTransaction();
$link = $this->getById($task_link_id);
- $link_id = $this->link->getOppositeLinkId($link['link_id']);
+ $link_id = $this->linkModel->getOppositeLinkId($link['link_id']);
$this->db->table(self::TABLE)->eq('id', $task_link_id)->remove();
diff --git a/app/Model/TaskMetadata.php b/app/Model/TaskMetadataModel.php
index d9d024bf..dc3f56ec 100644
--- a/app/Model/TaskMetadata.php
+++ b/app/Model/TaskMetadataModel.php
@@ -5,10 +5,10 @@ namespace Kanboard\Model;
/**
* Task Metadata
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskMetadata extends Metadata
+class TaskMetadataModel extends MetadataModel
{
/**
* Get the table
diff --git a/app/Model/Task.php b/app/Model/TaskModel.php
index bdb55c46..b0e7772a 100644
--- a/app/Model/Task.php
+++ b/app/Model/TaskModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Task model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Task extends Base
+class TaskModel extends Base
{
/**
* SQL table name
@@ -90,11 +90,11 @@ class Task extends Base
*/
public function remove($task_id)
{
- if (! $this->taskFinder->exists($task_id)) {
+ if (! $this->taskFinderModel->exists($task_id)) {
return false;
}
- $this->taskFile->removeAll($task_id);
+ $this->taskFileModel->removeAll($task_id);
return $this->db->table(self::TABLE)->eq('id', $task_id)->remove();
}
@@ -126,8 +126,8 @@ class Task extends Base
public function getRecurrenceStatusList()
{
return array(
- Task::RECURRING_STATUS_NONE => t('No'),
- Task::RECURRING_STATUS_PENDING => t('Yes'),
+ TaskModel::RECURRING_STATUS_NONE => t('No'),
+ TaskModel::RECURRING_STATUS_PENDING => t('Yes'),
);
}
@@ -140,9 +140,9 @@ class Task extends Base
public function getRecurrenceTriggerList()
{
return array(
- Task::RECURRING_TRIGGER_FIRST_COLUMN => t('When task is moved from first column'),
- Task::RECURRING_TRIGGER_LAST_COLUMN => t('When task is moved to last column'),
- Task::RECURRING_TRIGGER_CLOSE => t('When task is closed'),
+ TaskModel::RECURRING_TRIGGER_FIRST_COLUMN => t('When task is moved from first column'),
+ TaskModel::RECURRING_TRIGGER_LAST_COLUMN => t('When task is moved to last column'),
+ TaskModel::RECURRING_TRIGGER_CLOSE => t('When task is closed'),
);
}
@@ -155,8 +155,8 @@ class Task extends Base
public function getRecurrenceBasedateList()
{
return array(
- Task::RECURRING_BASEDATE_DUEDATE => t('Existing due date'),
- Task::RECURRING_BASEDATE_TRIGGERDATE => t('Action date'),
+ TaskModel::RECURRING_BASEDATE_DUEDATE => t('Existing due date'),
+ TaskModel::RECURRING_BASEDATE_TRIGGERDATE => t('Action date'),
);
}
@@ -169,9 +169,9 @@ class Task extends Base
public function getRecurrenceTimeframeList()
{
return array(
- Task::RECURRING_TIMEFRAME_DAYS => t('Day(s)'),
- Task::RECURRING_TIMEFRAME_MONTHS => t('Month(s)'),
- Task::RECURRING_TIMEFRAME_YEARS => t('Year(s)'),
+ TaskModel::RECURRING_TIMEFRAME_DAYS => t('Day(s)'),
+ TaskModel::RECURRING_TIMEFRAME_MONTHS => t('Month(s)'),
+ TaskModel::RECURRING_TIMEFRAME_YEARS => t('Year(s)'),
);
}
@@ -212,10 +212,10 @@ class Task extends Base
*/
public function duplicate($src_project_id, $dst_project_id)
{
- $task_ids = $this->taskFinder->getAllIds($src_project_id, array(Task::STATUS_OPEN, Task::STATUS_CLOSED));
+ $task_ids = $this->taskFinderModel->getAllIds($src_project_id, array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED));
foreach ($task_ids as $task_id) {
- if (! $this->taskDuplication->duplicateToProject($task_id, $dst_project_id)) {
+ if (! $this->taskDuplicationModel->duplicateToProject($task_id, $dst_project_id)) {
return false;
}
}
diff --git a/app/Model/TaskModification.php b/app/Model/TaskModificationModel.php
index 7e0ea8b2..762af2c5 100644
--- a/app/Model/TaskModification.php
+++ b/app/Model/TaskModificationModel.php
@@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent;
/**
* Task Modification
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskModification extends Base
+class TaskModificationModel extends Base
{
/**
* Update a task
@@ -23,10 +23,10 @@ class TaskModification extends Base
*/
public function update(array $values, $fire_events = true)
{
- $original_task = $this->taskFinder->getById($values['id']);
+ $original_task = $this->taskFinderModel->getById($values['id']);
$this->prepare($values);
- $result = $this->db->table(Task::TABLE)->eq('id', $original_task['id'])->update($values);
+ $result = $this->db->table(TaskModel::TABLE)->eq('id', $original_task['id'])->update($values);
if ($fire_events && $result) {
$this->fireEvents($original_task, $values);
@@ -52,10 +52,10 @@ class TaskModification extends Base
unset($event_data['changes']['date_modification']);
if ($this->isFieldModified('owner_id', $event_data['changes'])) {
- $events[] = Task::EVENT_ASSIGNEE_CHANGE;
+ $events[] = TaskModel::EVENT_ASSIGNEE_CHANGE;
} elseif (! empty($event_data['changes'])) {
- $events[] = Task::EVENT_CREATE_UPDATE;
- $events[] = Task::EVENT_UPDATE;
+ $events[] = TaskModel::EVENT_CREATE_UPDATE;
+ $events[] = TaskModel::EVENT_UPDATE;
}
foreach ($events as $event) {
diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPositionModel.php
index 5b794795..9fdb8f7d 100644
--- a/app/Model/TaskPosition.php
+++ b/app/Model/TaskPositionModel.php
@@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent;
/**
* Task Position
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskPosition extends Base
+class TaskPositionModel extends Base
{
/**
* Move a task to another column or to another position
@@ -31,9 +31,9 @@ class TaskPosition extends Base
return false;
}
- $task = $this->taskFinder->getById($task_id);
+ $task = $this->taskFinderModel->getById($task_id);
- if ($task['is_active'] == Task::STATUS_CLOSED) {
+ if ($task['is_active'] == TaskModel::STATUS_CLOSED) {
return true;
}
@@ -132,7 +132,7 @@ class TaskPosition extends Base
*/
private function saveTaskPositions($project_id, $task_id, $position, $column_id, $swimlane_id)
{
- $tasks_ids = $this->db->table(Task::TABLE)
+ $tasks_ids = $this->db->table(TaskModel::TABLE)
->eq('is_active', 1)
->eq('swimlane_id', $swimlane_id)
->eq('project_id', $project_id)
@@ -169,7 +169,7 @@ class TaskPosition extends Base
$now = time();
- return $this->db->table(Task::TABLE)->eq('id', $task_id)->update(array(
+ return $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array(
'date_moved' => $now,
'date_modification' => $now,
));
@@ -187,7 +187,7 @@ class TaskPosition extends Base
*/
private function saveTaskPosition($task_id, $position, $column_id, $swimlane_id)
{
- $result = $this->db->table(Task::TABLE)->eq('id', $task_id)->update(array(
+ $result = $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array(
'position' => $position,
'column_id' => $column_id,
'swimlane_id' => $swimlane_id,
@@ -226,14 +226,14 @@ class TaskPosition extends Base
);
if ($task['swimlane_id'] != $new_swimlane_id) {
- $this->logger->debug('Event fired: '.Task::EVENT_MOVE_SWIMLANE);
- $this->dispatcher->dispatch(Task::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data));
+ $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_SWIMLANE);
+ $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data));
} elseif ($task['column_id'] != $new_column_id) {
- $this->logger->debug('Event fired: '.Task::EVENT_MOVE_COLUMN);
- $this->dispatcher->dispatch(Task::EVENT_MOVE_COLUMN, new TaskEvent($event_data));
+ $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_COLUMN);
+ $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_COLUMN, new TaskEvent($event_data));
} elseif ($task['position'] != $new_position) {
- $this->logger->debug('Event fired: '.Task::EVENT_MOVE_POSITION);
- $this->dispatcher->dispatch(Task::EVENT_MOVE_POSITION, new TaskEvent($event_data));
+ $this->logger->debug('Event fired: '.TaskModel::EVENT_MOVE_POSITION);
+ $this->dispatcher->dispatch(TaskModel::EVENT_MOVE_POSITION, new TaskEvent($event_data));
}
}
}
diff --git a/app/Model/TaskStatus.php b/app/Model/TaskStatusModel.php
index 4ba13a60..4d573f0e 100644
--- a/app/Model/TaskStatus.php
+++ b/app/Model/TaskStatusModel.php
@@ -8,10 +8,10 @@ use Kanboard\Event\TaskEvent;
/**
* Task Status
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class TaskStatus extends Base
+class TaskStatusModel extends Base
{
/**
* Return true if the task is closed
@@ -22,7 +22,7 @@ class TaskStatus extends Base
*/
public function isClosed($task_id)
{
- return $this->checkStatus($task_id, Task::STATUS_CLOSED);
+ return $this->checkStatus($task_id, TaskModel::STATUS_CLOSED);
}
/**
@@ -34,7 +34,7 @@ class TaskStatus extends Base
*/
public function isOpen($task_id)
{
- return $this->checkStatus($task_id, Task::STATUS_OPEN);
+ return $this->checkStatus($task_id, TaskModel::STATUS_OPEN);
}
/**
@@ -46,8 +46,8 @@ class TaskStatus extends Base
*/
public function close($task_id)
{
- $this->subtask->closeAll($task_id);
- return $this->changeStatus($task_id, Task::STATUS_CLOSED, time(), Task::EVENT_CLOSE);
+ $this->subtaskModel->closeAll($task_id);
+ return $this->changeStatus($task_id, TaskModel::STATUS_CLOSED, time(), TaskModel::EVENT_CLOSE);
}
/**
@@ -59,7 +59,7 @@ class TaskStatus extends Base
*/
public function open($task_id)
{
- return $this->changeStatus($task_id, Task::STATUS_OPEN, 0, Task::EVENT_OPEN);
+ return $this->changeStatus($task_id, TaskModel::STATUS_OPEN, 0, TaskModel::EVENT_OPEN);
}
/**
@@ -85,10 +85,10 @@ class TaskStatus extends Base
public function closeTasksBySwimlaneAndColumn($swimlane_id, $column_id)
{
$task_ids = $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('swimlane_id', $swimlane_id)
->eq('column_id', $column_id)
- ->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN)
+ ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
->findAllByColumn('id');
$this->closeMultipleTasks($task_ids);
@@ -106,12 +106,12 @@ class TaskStatus extends Base
*/
private function changeStatus($task_id, $status, $date_completed, $event)
{
- if (! $this->taskFinder->exists($task_id)) {
+ if (! $this->taskFinderModel->exists($task_id)) {
return false;
}
$result = $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('id', $task_id)
->update(array(
'is_active' => $status,
@@ -121,7 +121,7 @@ class TaskStatus extends Base
if ($result) {
$this->logger->debug('Event fired: '.$event);
- $this->dispatcher->dispatch($event, new TaskEvent(array('task_id' => $task_id) + $this->taskFinder->getById($task_id)));
+ $this->dispatcher->dispatch($event, new TaskEvent(array('task_id' => $task_id) + $this->taskFinderModel->getById($task_id)));
}
return $result;
@@ -138,7 +138,7 @@ class TaskStatus extends Base
private function checkStatus($task_id, $status)
{
return $this->db
- ->table(Task::TABLE)
+ ->table(TaskModel::TABLE)
->eq('id', $task_id)
->eq('is_active', $status)
->count() === 1;
diff --git a/app/Model/Timezone.php b/app/Model/TimezoneModel.php
index de426e79..8b3e895a 100644
--- a/app/Model/Timezone.php
+++ b/app/Model/TimezoneModel.php
@@ -10,7 +10,7 @@ use Kanboard\Core\Base;
* @package Kanboard\Model
* @author Frederic Guillot
*/
-class Timezone extends Base
+class TimezoneModel extends Base
{
/**
* Get available timezones
@@ -43,7 +43,7 @@ class Timezone extends Base
return $this->sessionStorage->user['timezone'];
}
- return $this->config->get('application_timezone', 'UTC');
+ return $this->configModel->get('application_timezone', 'UTC');
}
/**
diff --git a/app/Model/Transition.php b/app/Model/TransitionModel.php
index 2bc622b0..a4a58472 100644
--- a/app/Model/Transition.php
+++ b/app/Model/TransitionModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* Transition
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class Transition extends Base
+class TransitionModel extends Base
{
/**
* SQL table name
@@ -71,17 +71,17 @@ class Transition extends Base
->columns(
'src.title as src_column',
'dst.title as dst_column',
- User::TABLE.'.name',
- User::TABLE.'.username',
+ UserModel::TABLE.'.name',
+ UserModel::TABLE.'.username',
self::TABLE.'.user_id',
self::TABLE.'.date',
self::TABLE.'.time_spent'
)
->eq('task_id', $task_id)
->desc('date')
- ->join(User::TABLE, 'id', 'user_id')
- ->join(Column::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src')
- ->join(Column::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst')
+ ->join(UserModel::TABLE, 'id', 'user_id')
+ ->join(ColumnModel::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src')
+ ->join(ColumnModel::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst')
->findAll();
}
@@ -106,12 +106,12 @@ class Transition extends Base
return $this->db->table(self::TABLE)
->columns(
- Task::TABLE.'.id',
- Task::TABLE.'.title',
+ TaskModel::TABLE.'.id',
+ TaskModel::TABLE.'.title',
'src.title as src_column',
'dst.title as dst_column',
- User::TABLE.'.name',
- User::TABLE.'.username',
+ UserModel::TABLE.'.name',
+ UserModel::TABLE.'.username',
self::TABLE.'.user_id',
self::TABLE.'.date',
self::TABLE.'.time_spent'
@@ -121,10 +121,10 @@ class Transition extends Base
->eq(self::TABLE.'.project_id', $project_id)
->desc('date')
->desc(self::TABLE.'.id')
- ->join(Task::TABLE, 'id', 'task_id')
- ->join(User::TABLE, 'id', 'user_id')
- ->join(Column::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src')
- ->join(Column::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst')
+ ->join(TaskModel::TABLE, 'id', 'task_id')
+ ->join(UserModel::TABLE, 'id', 'user_id')
+ ->join(ColumnModel::TABLE.' as src', 'id', 'src_column_id', self::TABLE, 'src')
+ ->join(ColumnModel::TABLE.' as dst', 'id', 'dst_column_id', self::TABLE, 'dst')
->findAll();
}
}
diff --git a/app/Model/UserLocking.php b/app/Model/UserLockingModel.php
index ccaf402c..1d4d994c 100644
--- a/app/Model/UserLocking.php
+++ b/app/Model/UserLockingModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* User Locking Model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class UserLocking extends Base
+class UserLockingModel extends Base
{
/**
* Get the number of failed login for the user
@@ -21,7 +21,7 @@ class UserLocking extends Base
*/
public function getFailedLogin($username)
{
- return (int) $this->db->table(User::TABLE)
+ return (int) $this->db->table(UserModel::TABLE)
->eq('username', $username)
->findOneColumn('nb_failed_login');
}
@@ -35,7 +35,7 @@ class UserLocking extends Base
*/
public function resetFailedLogin($username)
{
- return $this->db->table(User::TABLE)
+ return $this->db->table(UserModel::TABLE)
->eq('username', $username)
->update(array(
'nb_failed_login' => 0,
@@ -52,7 +52,7 @@ class UserLocking extends Base
*/
public function incrementFailedLogin($username)
{
- return $this->db->table(User::TABLE)
+ return $this->db->table(UserModel::TABLE)
->eq('username', $username)
->increment('nb_failed_login', 1);
}
@@ -66,7 +66,7 @@ class UserLocking extends Base
*/
public function isLocked($username)
{
- return $this->db->table(User::TABLE)
+ return $this->db->table(UserModel::TABLE)
->eq('username', $username)
->neq('lock_expiration_date', 0)
->gte('lock_expiration_date', time())
@@ -83,7 +83,7 @@ class UserLocking extends Base
*/
public function lock($username, $duration = 15)
{
- return $this->db->table(User::TABLE)
+ return $this->db->table(UserModel::TABLE)
->eq('username', $username)
->update(array(
'lock_expiration_date' => time() + $duration * 60
diff --git a/app/Model/UserMention.php b/app/Model/UserMentionModel.php
index 42b81840..cdb9949e 100644
--- a/app/Model/UserMention.php
+++ b/app/Model/UserMentionModel.php
@@ -8,10 +8,10 @@ use Kanboard\Event\GenericEvent;
/**
* User Mention
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class UserMention extends Base
+class UserMentionModel extends Base
{
/**
* Get list of mentioned users
@@ -25,7 +25,7 @@ class UserMention extends Base
$users = array();
if (preg_match_all('/@([^\s]+)/', $content, $matches)) {
- $users = $this->db->table(User::TABLE)
+ $users = $this->db->table(UserModel::TABLE)
->columns('id', 'username', 'name', 'email', 'language')
->eq('notifications_enabled', 1)
->neq('id', $this->userSession->getId())
@@ -47,13 +47,13 @@ class UserMention extends Base
public function fireEvents($content, $eventName, GenericEvent $event)
{
if (empty($event['project_id'])) {
- $event['project_id'] = $this->taskFinder->getProjectId($event['task_id']);
+ $event['project_id'] = $this->taskFinderModel->getProjectId($event['task_id']);
}
$users = $this->getMentionedUsers($content);
foreach ($users as $user) {
- if ($this->projectPermission->isMember($event['project_id'], $user['id'])) {
+ if ($this->projectPermissionModel->isMember($event['project_id'], $user['id'])) {
$event['mention'] = $user;
$this->dispatcher->dispatch($eventName, $event);
}
diff --git a/app/Model/UserMetadata.php b/app/Model/UserMetadataModel.php
index 491c1575..e931d3ba 100644
--- a/app/Model/UserMetadata.php
+++ b/app/Model/UserMetadataModel.php
@@ -2,15 +2,13 @@
namespace Kanboard\Model;
-use Kanboard\Core\Base;
-
/**
* User Metadata
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class UserMetadata extends Metadata
+class UserMetadataModel extends MetadataModel
{
/**
* Get the table
diff --git a/app/Model/User.php b/app/Model/UserModel.php
index cbfca0ac..f7a051c5 100644
--- a/app/Model/User.php
+++ b/app/Model/UserModel.php
@@ -10,10 +10,10 @@ use Kanboard\Core\Security\Role;
/**
* User model
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class User extends Base
+class UserModel extends Base
{
/**
* SQL table name
@@ -86,7 +86,7 @@ class User extends Base
{
return $this->userSession->isAdmin() || // Avoid SQL query if connected
$this->db
- ->table(User::TABLE)
+ ->table(UserModel::TABLE)
->eq('id', $user_id)
->eq('role', Role::APP_ADMIN)
->exists();
@@ -212,7 +212,7 @@ class User extends Base
$listing = $this->prepareList($users);
if ($prepend) {
- return array(User::EVERYBODY_ID => t('Everybody')) + $listing;
+ return array(UserModel::EVERYBODY_ID => t('Everybody')) + $listing;
}
return $listing;
@@ -321,38 +321,38 @@ class User extends Base
*/
public function remove($user_id)
{
- $this->avatarFile->remove($user_id);
+ $this->avatarFileModel->remove($user_id);
return $this->db->transaction(function (Database $db) use ($user_id) {
// All assigned tasks are now unassigned (no foreign key)
- if (! $db->table(Task::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) {
+ if (! $db->table(TaskModel::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) {
return false;
}
// All assigned subtasks are now unassigned (no foreign key)
- if (! $db->table(Subtask::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) {
+ if (! $db->table(SubtaskModel::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) {
return false;
}
// All comments are not assigned anymore (no foreign key)
- if (! $db->table(Comment::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) {
+ if (! $db->table(CommentModel::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) {
return false;
}
// All private projects are removed
- $project_ids = $db->table(Project::TABLE)
+ $project_ids = $db->table(ProjectModel::TABLE)
->eq('is_private', 1)
- ->eq(ProjectUserRole::TABLE.'.user_id', $user_id)
- ->join(ProjectUserRole::TABLE, 'project_id', 'id')
- ->findAllByColumn(Project::TABLE.'.id');
+ ->eq(ProjectUserRoleModel::TABLE.'.user_id', $user_id)
+ ->join(ProjectUserRoleModel::TABLE, 'project_id', 'id')
+ ->findAllByColumn(ProjectModel::TABLE.'.id');
if (! empty($project_ids)) {
- $db->table(Project::TABLE)->in('id', $project_ids)->remove();
+ $db->table(ProjectModel::TABLE)->in('id', $project_ids)->remove();
}
// Finally remove the user
- if (! $db->table(User::TABLE)->eq('id', $user_id)->remove()) {
+ if (! $db->table(UserModel::TABLE)->eq('id', $user_id)->remove()) {
return false;
}
});
diff --git a/app/Model/UserNotificationFilter.php b/app/Model/UserNotificationFilterModel.php
index d885da04..112ba290 100644
--- a/app/Model/UserNotificationFilter.php
+++ b/app/Model/UserNotificationFilterModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* User Notification Filter
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class UserNotificationFilter extends Base
+class UserNotificationFilterModel extends Base
{
/**
* SQL table name
@@ -54,7 +54,7 @@ class UserNotificationFilter extends Base
*/
public function getSelectedFilter($user_id)
{
- return $this->db->table(User::TABLE)->eq('id', $user_id)->findOneColumn('notifications_filter');
+ return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->findOneColumn('notifications_filter');
}
/**
@@ -67,7 +67,7 @@ class UserNotificationFilter extends Base
*/
public function saveFilter($user_id, $filter)
{
- return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array(
+ return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array(
'notifications_filter' => $filter,
));
}
diff --git a/app/Model/UserNotification.php b/app/Model/UserNotificationModel.php
index ef90bb63..d77526f6 100644
--- a/app/Model/UserNotification.php
+++ b/app/Model/UserNotificationModel.php
@@ -8,10 +8,10 @@ use Kanboard\Core\Translator;
/**
* User Notification
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class UserNotification extends Base
+class UserNotificationModel extends Base
{
/**
* Send notifications to people
@@ -25,7 +25,7 @@ class UserNotification extends Base
$users = $this->getUsersWithNotificationEnabled($event_data['task']['project_id'], $this->userSession->getId());
foreach ($users as $user) {
- if ($this->userNotificationFilter->shouldReceiveNotification($user, $event_data)) {
+ if ($this->userNotificationFilterModel->shouldReceiveNotification($user, $event_data)) {
$this->sendUserNotification($user, $event_name, $event_data);
}
}
@@ -47,15 +47,15 @@ class UserNotification extends Base
if (! empty($user['language'])) {
Translator::load($user['language']);
} else {
- Translator::load($this->config->get('application_language', 'en_US'));
+ Translator::load($this->configModel->get('application_language', 'en_US'));
}
- foreach ($this->userNotificationType->getSelectedTypes($user['id']) as $type) {
- $this->userNotificationType->getType($type)->notifyUser($user, $event_name, $event_data);
+ foreach ($this->userNotificationTypeModel->getSelectedTypes($user['id']) as $type) {
+ $this->userNotificationTypeModel->getType($type)->notifyUser($user, $event_name, $event_data);
}
// Restore locales
- $this->language->loadCurrentLanguage();
+ $this->languageModel->loadCurrentLanguage();
}
/**
@@ -68,7 +68,7 @@ class UserNotification extends Base
*/
public function getUsersWithNotificationEnabled($project_id, $exclude_user_id = 0)
{
- if ($this->projectPermission->isEverybodyAllowed($project_id)) {
+ if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) {
return $this->getEverybodyWithNotificationEnabled($exclude_user_id);
}
@@ -94,7 +94,7 @@ class UserNotification extends Base
*/
public function enableNotification($user_id)
{
- return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 1));
+ return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 1));
}
/**
@@ -106,7 +106,7 @@ class UserNotification extends Base
*/
public function disableNotification($user_id)
{
- return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 0));
+ return $this->db->table(UserModel::TABLE)->eq('id', $user_id)->update(array('notifications_enabled' => 0));
}
/**
@@ -126,12 +126,12 @@ class UserNotification extends Base
$this->disableNotification($user_id);
}
- $filter = empty($values['notifications_filter']) ? UserNotificationFilter::FILTER_BOTH : $values['notifications_filter'];
+ $filter = empty($values['notifications_filter']) ? UserNotificationFilterModel::FILTER_BOTH : $values['notifications_filter'];
$project_ids = empty($values['notification_projects']) ? array() : array_keys($values['notification_projects']);
- $this->userNotificationFilter->saveFilter($user_id, $filter);
- $this->userNotificationFilter->saveSelectedProjects($user_id, $project_ids);
- $this->userNotificationType->saveSelectedTypes($user_id, $types);
+ $this->userNotificationFilterModel->saveFilter($user_id, $filter);
+ $this->userNotificationFilterModel->saveSelectedProjects($user_id, $project_ids);
+ $this->userNotificationTypeModel->saveSelectedTypes($user_id, $types);
}
/**
@@ -143,9 +143,9 @@ class UserNotification extends Base
*/
public function readSettings($user_id)
{
- $values = $this->db->table(User::TABLE)->eq('id', $user_id)->columns('notifications_enabled', 'notifications_filter')->findOne();
- $values['notification_types'] = $this->userNotificationType->getSelectedTypes($user_id);
- $values['notification_projects'] = $this->userNotificationFilter->getSelectedProjects($user_id);
+ $values = $this->db->table(UserModel::TABLE)->eq('id', $user_id)->columns('notifications_enabled', 'notifications_filter')->findOne();
+ $values['notification_types'] = $this->userNotificationTypeModel->getSelectedTypes($user_id);
+ $values['notification_projects'] = $this->userNotificationFilterModel->getSelectedProjects($user_id);
return $values;
}
@@ -160,27 +160,27 @@ class UserNotification extends Base
private function getProjectUserMembersWithNotificationEnabled($project_id, $exclude_user_id)
{
return $this->db
- ->table(ProjectUserRole::TABLE)
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter')
- ->join(User::TABLE, 'id', 'user_id')
- ->eq(ProjectUserRole::TABLE.'.project_id', $project_id)
- ->eq(User::TABLE.'.notifications_enabled', '1')
- ->eq(User::TABLE.'.is_active', 1)
- ->neq(User::TABLE.'.id', $exclude_user_id)
+ ->table(ProjectUserRoleModel::TABLE)
+ ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter')
+ ->join(UserModel::TABLE, 'id', 'user_id')
+ ->eq(ProjectUserRoleModel::TABLE.'.project_id', $project_id)
+ ->eq(UserModel::TABLE.'.notifications_enabled', '1')
+ ->eq(UserModel::TABLE.'.is_active', 1)
+ ->neq(UserModel::TABLE.'.id', $exclude_user_id)
->findAll();
}
private function getProjectGroupMembersWithNotificationEnabled($project_id, $exclude_user_id)
{
return $this->db
- ->table(ProjectGroupRole::TABLE)
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter')
- ->join(GroupMember::TABLE, 'group_id', 'group_id', ProjectGroupRole::TABLE)
- ->join(User::TABLE, 'id', 'user_id', GroupMember::TABLE)
- ->eq(ProjectGroupRole::TABLE.'.project_id', $project_id)
- ->eq(User::TABLE.'.notifications_enabled', '1')
- ->neq(User::TABLE.'.id', $exclude_user_id)
- ->eq(User::TABLE.'.is_active', 1)
+ ->table(ProjectGroupRoleModel::TABLE)
+ ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter')
+ ->join(GroupMemberModel::TABLE, 'group_id', 'group_id', ProjectGroupRoleModel::TABLE)
+ ->join(UserModel::TABLE, 'id', 'user_id', GroupMemberModel::TABLE)
+ ->eq(ProjectGroupRoleModel::TABLE.'.project_id', $project_id)
+ ->eq(UserModel::TABLE.'.notifications_enabled', '1')
+ ->neq(UserModel::TABLE.'.id', $exclude_user_id)
+ ->eq(UserModel::TABLE.'.is_active', 1)
->findAll();
}
@@ -194,11 +194,11 @@ class UserNotification extends Base
private function getEverybodyWithNotificationEnabled($exclude_user_id)
{
return $this->db
- ->table(User::TABLE)
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', User::TABLE.'.email', User::TABLE.'.language', User::TABLE.'.notifications_filter')
+ ->table(UserModel::TABLE)
+ ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter')
->eq('notifications_enabled', '1')
- ->neq(User::TABLE.'.id', $exclude_user_id)
- ->eq(User::TABLE.'.is_active', 1)
+ ->neq(UserModel::TABLE.'.id', $exclude_user_id)
+ ->eq(UserModel::TABLE.'.is_active', 1)
->findAll();
}
}
diff --git a/app/Model/UserNotificationType.php b/app/Model/UserNotificationTypeModel.php
index d84cc690..0f377220 100644
--- a/app/Model/UserNotificationType.php
+++ b/app/Model/UserNotificationTypeModel.php
@@ -2,15 +2,13 @@
namespace Kanboard\Model;
-use Kanboard\Core\Base;
-
/**
* User Notification Type
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class UserNotificationType extends NotificationType
+class UserNotificationTypeModel extends NotificationTypeModel
{
/**
* SQL table name
diff --git a/app/Model/UserUnreadNotification.php b/app/Model/UserUnreadNotificationModel.php
index f3fcd601..6c930eef 100644
--- a/app/Model/UserUnreadNotification.php
+++ b/app/Model/UserUnreadNotificationModel.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Base;
/**
* User Unread Notification
*
- * @package model
+ * @package Kanboard\Model
* @author Frederic Guillot
*/
-class UserUnreadNotification extends Base
+class UserUnreadNotificationModel extends Base
{
/**
* SQL table name
@@ -112,6 +112,6 @@ class UserUnreadNotification extends Base
private function unserialize(&$event)
{
$event['event_data'] = json_decode($event['event_data'], true);
- $event['title'] = $this->notification->getTitleWithoutAuthor($event['event_name'], $event['event_data']);
+ $event['title'] = $this->notificationModel->getTitleWithoutAuthor($event['event_name'], $event['event_data']);
}
}