summaryrefslogtreecommitdiff
path: root/app/Model/SubtaskTimeTracking.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-04-09 22:42:17 -0400
committerFrederic Guillot <fred@kanboard.net>2016-04-09 22:42:17 -0400
commit11858be4e8d5aba983700c6cba1c4d0a33ea8e9d (patch)
tree38427e86d52185df95e2b891e4bcd50aeb56eeb9 /app/Model/SubtaskTimeTracking.php
parent42813d702d1c3e5659301bc771f8dbb37a6d15cd (diff)
Filter refactoring
Diffstat (limited to 'app/Model/SubtaskTimeTracking.php')
-rw-r--r--app/Model/SubtaskTimeTracking.php88
1 files changed, 0 insertions, 88 deletions
diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php
index b766b542..be04ee1b 100644
--- a/app/Model/SubtaskTimeTracking.php
+++ b/app/Model/SubtaskTimeTracking.php
@@ -146,94 +146,6 @@ class SubtaskTimeTracking extends Base
}
/**
- * Get user calendar events
- *
- * @access public
- * @param integer $user_id
- * @param string $start ISO-8601 format
- * @param string $end
- * @return array
- */
- public function getUserCalendarEvents($user_id, $start, $end)
- {
- $hook = 'model:subtask-time-tracking:calendar:events';
- $events = $this->getUserQuery($user_id)
- ->addCondition($this->getCalendarCondition(
- $this->dateParser->getTimestampFromIsoFormat($start),
- $this->dateParser->getTimestampFromIsoFormat($end),
- 'start',
- 'end'
- ))
- ->findAll();
-
- if ($this->hook->exists($hook)) {
- $events = $this->hook->first($hook, array(
- 'user_id' => $user_id,
- 'events' => $events,
- 'start' => $start,
- 'end' => $end,
- ));
- }
-
- return $this->toCalendarEvents($events);
- }
-
- /**
- * Get project calendar events
- *
- * @access public
- * @param integer $project_id
- * @param integer $start
- * @param integer $end
- * @return array
- */
- public function getProjectCalendarEvents($project_id, $start, $end)
- {
- $result = $this
- ->getProjectQuery($project_id)
- ->addCondition($this->getCalendarCondition(
- $this->dateParser->getTimestampFromIsoFormat($start),
- $this->dateParser->getTimestampFromIsoFormat($end),
- 'start',
- 'end'
- ))
- ->findAll();
-
- return $this->toCalendarEvents($result);
- }
-
- /**
- * Convert a record set to calendar events
- *
- * @access private
- * @param array $rows
- * @return array
- */
- private function toCalendarEvents(array $rows)
- {
- $events = array();
-
- foreach ($rows as $row) {
- $user = isset($row['username']) ? ' ('.($row['user_fullname'] ?: $row['username']).')' : '';
-
- $events[] = array(
- 'id' => $row['id'],
- 'subtask_id' => $row['subtask_id'],
- 'title' => t('#%d', $row['task_id']).' '.$row['subtask_title'].$user,
- 'start' => date('Y-m-d\TH:i:s', $row['start']),
- 'end' => date('Y-m-d\TH:i:s', $row['end'] ?: time()),
- 'backgroundColor' => $this->color->getBackgroundColor($row['color_id']),
- 'borderColor' => $this->color->getBorderColor($row['color_id']),
- 'textColor' => 'black',
- 'url' => $this->helper->url->to('task', 'show', array('task_id' => $row['task_id'], 'project_id' => $row['project_id'])),
- 'editable' => false,
- );
- }
-
- return $events;
- }
-
- /**
* Return true if a timer is started for this use and subtask
*
* @access public