summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Core/Base.php1
-rw-r--r--app/Model/ProjectDuplicationModel.php4
-rw-r--r--app/Model/ProjectTaskDuplicationModel.php35
-rw-r--r--app/Model/TaskModel.php83
-rw-r--r--app/ServiceProvider/ClassProvider.php1
-rw-r--r--app/Template/project_creation/create.php2
-rw-r--r--app/Template/project_view/duplicate.php2
7 files changed, 72 insertions, 56 deletions
diff --git a/app/Core/Base.php b/app/Core/Base.php
index a8274152..7320aebf 100644
--- a/app/Core/Base.php
+++ b/app/Core/Base.php
@@ -86,6 +86,7 @@ use Pimple\Container;
* @property \Kanboard\Model\ProjectGroupRoleModel $projectGroupRoleModel
* @property \Kanboard\Model\ProjectNotificationModel $projectNotificationModel
* @property \Kanboard\Model\ProjectNotificationTypeModel $projectNotificationTypeModel
+ * @property \Kanboard\Model\ProjectTaskDuplicationModel $projectTaskDuplicationModel
* @property \Kanboard\Model\RememberMeSessionModel $rememberMeSessionModel
* @property \Kanboard\Model\SubtaskModel $subtaskModel
* @property \Kanboard\Model\SubtaskTimeTrackingModel $subtaskTimeTrackingModel
diff --git a/app/Model/ProjectDuplicationModel.php b/app/Model/ProjectDuplicationModel.php
index 4db8f767..f6b9683e 100644
--- a/app/Model/ProjectDuplicationModel.php
+++ b/app/Model/ProjectDuplicationModel.php
@@ -29,7 +29,7 @@ class ProjectDuplicationModel extends Base
'swimlaneModel',
'tagDuplicationModel',
'projectMetadataModel',
- 'taskModel',
+ 'projectTaskDuplicationModel',
);
}
@@ -49,7 +49,7 @@ class ProjectDuplicationModel extends Base
'swimlaneModel',
'tagDuplicationModel',
'projectMetadataModel',
- 'taskModel',
+ 'projectTaskDuplicationModel',
);
}
diff --git a/app/Model/ProjectTaskDuplicationModel.php b/app/Model/ProjectTaskDuplicationModel.php
new file mode 100644
index 00000000..5d2e1322
--- /dev/null
+++ b/app/Model/ProjectTaskDuplicationModel.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Kanboard\Model;
+
+use Kanboard\Core\Base;
+
+/**
+ * Project Task Duplication Model
+ *
+ * @package Kanboard\Model
+ * @author Frederic Guillot
+ */
+class ProjectTaskDuplicationModel extends Base
+{
+ /**
+ * Duplicate all tasks to another project
+ *
+ * @access public
+ * @param integer $src_project_id
+ * @param integer $dst_project_id
+ * @return boolean
+ */
+ public function duplicate($src_project_id, $dst_project_id)
+ {
+ $task_ids = $this->taskFinderModel->getAllIds($src_project_id, array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED));
+
+ foreach ($task_ids as $task_id) {
+ if (! $this->taskProjectDuplicationModel->duplicateToProject($task_id, $dst_project_id)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/app/Model/TaskModel.php b/app/Model/TaskModel.php
index b945ee44..5df41f3c 100644
--- a/app/Model/TaskModel.php
+++ b/app/Model/TaskModel.php
@@ -17,80 +17,80 @@ class TaskModel extends Base
*
* @var string
*/
- const TABLE = 'tasks';
+ const TABLE = 'tasks';
/**
* Task status
*
* @var integer
*/
- const STATUS_OPEN = 1;
- const STATUS_CLOSED = 0;
+ const STATUS_OPEN = 1;
+ const STATUS_CLOSED = 0;
/**
* Events
*
* @var string
*/
- const EVENT_MOVE_PROJECT = 'task.move.project';
- const EVENT_MOVE_COLUMN = 'task.move.column';
- const EVENT_MOVE_POSITION = 'task.move.position';
- const EVENT_MOVE_SWIMLANE = 'task.move.swimlane';
- const EVENT_UPDATE = 'task.update';
- const EVENT_CREATE = 'task.create';
- const EVENT_CLOSE = 'task.close';
- const EVENT_OPEN = 'task.open';
- const EVENT_CREATE_UPDATE = 'task.create_update';
+ const EVENT_MOVE_PROJECT = 'task.move.project';
+ const EVENT_MOVE_COLUMN = 'task.move.column';
+ const EVENT_MOVE_POSITION = 'task.move.position';
+ const EVENT_MOVE_SWIMLANE = 'task.move.swimlane';
+ const EVENT_UPDATE = 'task.update';
+ const EVENT_CREATE = 'task.create';
+ const EVENT_CLOSE = 'task.close';
+ const EVENT_OPEN = 'task.open';
+ const EVENT_CREATE_UPDATE = 'task.create_update';
const EVENT_ASSIGNEE_CHANGE = 'task.assignee_change';
- const EVENT_OVERDUE = 'task.overdue';
- const EVENT_USER_MENTION = 'task.user.mention';
- const EVENT_DAILY_CRONJOB = 'task.cronjob.daily';
+ const EVENT_OVERDUE = 'task.overdue';
+ const EVENT_USER_MENTION = 'task.user.mention';
+ const EVENT_DAILY_CRONJOB = 'task.cronjob.daily';
/**
* Recurrence: status
*
* @var integer
*/
- const RECURRING_STATUS_NONE = 0;
- const RECURRING_STATUS_PENDING = 1;
- const RECURRING_STATUS_PROCESSED = 2;
+ const RECURRING_STATUS_NONE = 0;
+ const RECURRING_STATUS_PENDING = 1;
+ const RECURRING_STATUS_PROCESSED = 2;
/**
* Recurrence: trigger
*
* @var integer
*/
- const RECURRING_TRIGGER_FIRST_COLUMN = 0;
- const RECURRING_TRIGGER_LAST_COLUMN = 1;
- const RECURRING_TRIGGER_CLOSE = 2;
+ const RECURRING_TRIGGER_FIRST_COLUMN = 0;
+ const RECURRING_TRIGGER_LAST_COLUMN = 1;
+ const RECURRING_TRIGGER_CLOSE = 2;
/**
* Recurrence: timeframe
*
* @var integer
*/
- const RECURRING_TIMEFRAME_DAYS = 0;
- const RECURRING_TIMEFRAME_MONTHS = 1;
- const RECURRING_TIMEFRAME_YEARS = 2;
+ const RECURRING_TIMEFRAME_DAYS = 0;
+ const RECURRING_TIMEFRAME_MONTHS = 1;
+ const RECURRING_TIMEFRAME_YEARS = 2;
/**
* Recurrence: base date used to calculate new due date
*
* @var integer
*/
- const RECURRING_BASEDATE_DUEDATE = 0;
- const RECURRING_BASEDATE_TRIGGERDATE = 1;
+ const RECURRING_BASEDATE_DUEDATE = 0;
+ const RECURRING_BASEDATE_TRIGGERDATE = 1;
/**
* Remove a task
*
* @access public
- * @param integer $task_id Task id
+ * @param integer $task_id Task id
* @return boolean
*/
public function remove($task_id)
{
- if (! $this->taskFinderModel->exists($task_id)) {
+ if (!$this->taskFinderModel->exists($task_id)) {
return false;
}
@@ -105,7 +105,7 @@ class TaskModel extends Base
* Example: "Fix bug #1234" will return 1234
*
* @access public
- * @param string $message Text
+ * @param string $message Text
* @return integer
*/
public function getTaskIdFromText($message)
@@ -179,8 +179,8 @@ class TaskModel extends Base
* Get task progress based on the column position
*
* @access public
- * @param array $task
- * @param array $columns
+ * @param array $task
+ * @param array $columns
* @return integer
*/
public function getProgress(array $task, array $columns)
@@ -201,25 +201,4 @@ class TaskModel extends Base
return round(($position * 100) / count($columns), 1);
}
-
- /**
- * Helper method to duplicate all tasks to another project
- *
- * @access public
- * @param integer $src_project_id
- * @param integer $dst_project_id
- * @return boolean
- */
- public function duplicate($src_project_id, $dst_project_id)
- {
- $task_ids = $this->taskFinderModel->getAllIds($src_project_id, array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED));
-
- foreach ($task_ids as $task_id) {
- if (! $this->taskProjectDuplicationModel->duplicateToProject($task_id, $dst_project_id)) {
- return false;
- }
- }
-
- return true;
- }
}
diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php
index 1f584fca..2d485e22 100644
--- a/app/ServiceProvider/ClassProvider.php
+++ b/app/ServiceProvider/ClassProvider.php
@@ -55,6 +55,7 @@ class ClassProvider implements ServiceProviderInterface
'ProjectNotificationModel',
'ProjectMetadataModel',
'ProjectGroupRoleModel',
+ 'ProjectTaskDuplicationModel',
'ProjectUserRoleModel',
'RememberMeSessionModel',
'SubtaskModel',
diff --git a/app/Template/project_creation/create.php b/app/Template/project_creation/create.php
index dc1bc370..d00883ba 100644
--- a/app/Template/project_creation/create.php
+++ b/app/Template/project_creation/create.php
@@ -26,7 +26,7 @@
<?= $this->form->checkbox('tagDuplicationModel', t('Tags'), 1, true) ?>
<?= $this->form->checkbox('actionModel', t('Actions'), 1, true) ?>
<?= $this->form->checkbox('swimlaneModel', t('Swimlanes'), 1, true) ?>
- <?= $this->form->checkbox('taskModel', t('Tasks'), 1, false) ?>
+ <?= $this->form->checkbox('projectTaskDuplicationModel', t('Tasks'), 1, false) ?>
</div>
<div class="form-actions">
diff --git a/app/Template/project_view/duplicate.php b/app/Template/project_view/duplicate.php
index a9680016..d66ff591 100644
--- a/app/Template/project_view/duplicate.php
+++ b/app/Template/project_view/duplicate.php
@@ -19,7 +19,7 @@
<?= $this->form->checkbox('actionModel', t('Actions'), 1, true) ?>
<?= $this->form->checkbox('swimlaneModel', t('Swimlanes'), 1, false) ?>
<?= $this->form->checkbox('projectMetadataModel', t('Metadata'), 1, false) ?>
- <?= $this->form->checkbox('taskModel', t('Tasks'), 1, false) ?>
+ <?= $this->form->checkbox('projectTaskDuplicationModel', t('Tasks'), 1, false) ?>
<div class="form-actions">
<button type="submit" class="btn btn-red"><?= t('Duplicate') ?></button>