Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/tasks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraimund-schluessler <raimund.schluessler@googlemail.com>2015-06-21 14:03:15 +0300
committerraimund-schluessler <raimund.schluessler@googlemail.com>2015-06-21 14:03:15 +0300
commit4843e21c44cc33794572be706a68231b4c37ea48 (patch)
tree635afd1387573190f0b093e3bf0721da13f2f2e1 /service
parenta6dc3bd3bb49f5b128aa2e8417bd1b05c315d34e (diff)
parent4715e7da509aeedcd4f9fbf1a5e4667f936552d2 (diff)
Merge pull request #199 from owncloud/ImplementPriority
Implement priority support
Diffstat (limited to 'service')
-rw-r--r--service/tasksservice.php43
1 files changed, 22 insertions, 21 deletions
diff --git a/service/tasksservice.php b/service/tasksservice.php
index e7e618dd..6f3eb79b 100644
--- a/service/tasksservice.php
+++ b/service/tasksservice.php
@@ -201,27 +201,6 @@ class TasksService {
}
/**
- * star or unstar task by id
- *
- * @param int $taskID
- * @param bool $isStarred
- */
- public function setStarred($taskID, $isStarred) {
- try {
- $vcalendar = \OC_Calendar_App::getVCalendar($taskID);
- $vtodo = $vcalendar->VTODO;
- if($isStarred) {
- $vtodo->PRIORITY = 5; // prio: medium
- } else {
- $vtodo->PRIORITY = 0;
- }
- return \OC_Calendar_Object::edit($taskID, $vcalendar->serialize());
- } catch(\Exception $e) {
- return false;
- }
- }
-
- /**
* set completeness of task in percent by id
*
* @param int $taskID
@@ -254,6 +233,28 @@ class TasksService {
}
/**
+ * set priority of task by id
+ *
+ * @param int $taskID
+ * @param int $priority
+ * @return bool
+ */
+ public function setPriority($taskID, $priority){
+ try {
+ $vcalendar = \OC_Calendar_App::getVCalendar($taskID);
+ $vtodo = $vcalendar->VTODO;
+ if($priority){
+ $vtodo->PRIORITY = (10 - $priority) % 10;
+ }else{
+ $vtodo->__unset('PRIORITY');
+ }
+ return \OC_Calendar_Object::edit($taskID, $vcalendar->serialize());
+ } catch(\Exception $e) {
+ return false;// throw new BusinessLayerException($e->getMessage());
+ }
+ }
+
+ /**
* set due date of task by id
*
* @param int $taskID