summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-05-10 13:45:09 -0400
committerFrederic Guillot <fred@kanboard.net>2015-05-10 13:45:09 -0400
commit94a5b12e68fc5e5f6aee7bf1d6d25427421aba7a (patch)
treeaa1f86e9fd134ec60534446948dcd2d54e02e5f7 /app/Controller
parent98aab0d99465b40907bbc1f1108ea20db290e036 (diff)
parentec24efa2d9599eaf6cbc39da25cffeaff555ba3c (diff)
Merge pull-request #847 (recurring tasks)
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Board.php17
-rw-r--r--app/Controller/Task.php60
2 files changed, 77 insertions, 0 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index f539a77c..e92cfe37 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -350,4 +350,21 @@ class Board extends Base
'redirect' => 'board',
)));
}
+
+ /**
+ * Get recurrence information on mouseover
+ *
+ * @access public
+ */
+ public function recurrence()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->template->render('board/recurrence', array(
+ 'task' => $task,
+ 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(),
+ 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(),
+ 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(),
+ )));
+ }
}
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 866ef774..060a478c 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -81,6 +81,9 @@ class Task extends Base
'date_format' => $this->config->get('application_date_format'),
'date_formats' => $this->dateParser->getAvailableFormats(),
'title' => $task['project_name'].' &gt; '.$task['title'],
+ 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(),
+ 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(),
+ 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(),
)));
}
@@ -444,6 +447,63 @@ class Task extends Base
}
/**
+ * Edit recurrence form
+ *
+ * @access public
+ */
+ public function recurrence()
+ {
+ $task = $this->getTask();
+ $ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
+
+ if ($this->request->isPost()) {
+
+ $values = $this->request->getValues();
+
+ list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values);
+
+ if ($valid) {
+
+ if ($this->taskModification->update($values)) {
+ $this->session->flash(t('Task updated successfully.'));
+ }
+ else {
+ $this->session->flashError(t('Unable to update your task.'));
+ }
+
+ if ($ajax) {
+ $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
+ }
+ else {
+ $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'&project_id='.$task['project_id']);
+ }
+ }
+ }
+ else {
+ $values = $task;
+ $errors = array();
+ }
+
+ $params = array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'task' => $task,
+ 'ajax' => $ajax,
+ 'recurrence_status_list' => $this->task->getRecurrenceStatusList(),
+ 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(),
+ 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(),
+ 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(),
+ );
+
+ if ($ajax) {
+ $this->response->html($this->template->render('task/edit_recurrence', $params));
+ }
+ else {
+ $this->response->html($this->taskLayout('task/edit_recurrence', $params));
+ }
+ }
+
+ /**
* Move a task to another project
*
* @access public