Changeset View
Changeset View
Standalone View
Standalone View
plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
Show First 20 Lines • Show All 501 Lines • ▼ Show 20 Lines | public function count_tasks($lists = null) | ||||
$lists = explode(',', $lists); | $lists = explode(',', $lists); | ||||
} | } | ||||
$today_date = new DateTime('now', $this->plugin->timezone); | $today_date = new DateTime('now', $this->plugin->timezone); | ||||
$today = $today_date->format('Y-m-d'); | $today = $today_date->format('Y-m-d'); | ||||
$tomorrow_date = new DateTime('now + 1 day', $this->plugin->timezone); | $tomorrow_date = new DateTime('now + 1 day', $this->plugin->timezone); | ||||
$tomorrow = $tomorrow_date->format('Y-m-d'); | $tomorrow = $tomorrow_date->format('Y-m-d'); | ||||
$counts = array('all' => 0, 'flagged' => 0, 'today' => 0, 'tomorrow' => 0, 'overdue' => 0, 'nodate' => 0, 'mytasks' => 0); | $counts = array('all' => 0, 'today' => 0, 'tomorrow' => 0, 'later' => 0, 'overdue' => 0); | ||||
foreach ($lists as $list_id) { | foreach ($lists as $list_id) { | ||||
if (!$folder = $this->get_folder($list_id)) { | if (!$folder = $this->get_folder($list_id)) { | ||||
continue; | continue; | ||||
} | } | ||||
foreach ($folder->select(array(array('tags','!~','x-complete'))) as $record) { | foreach ($folder->select(array(array('tags','!~','x-complete'))) as $record) { | ||||
$rec = $this->_to_rcube_task($record, $list_id, false); | $rec = $this->_to_rcube_task($record, $list_id, false); | ||||
if ($this->is_complete($rec)) // don't count complete tasks | if ($this->is_complete($rec)) // don't count complete tasks | ||||
continue; | continue; | ||||
$counts['all']++; | $counts['all']++; | ||||
if ($rec['flagged']) | |||||
$counts['flagged']++; | |||||
if (empty($rec['date'])) | if (empty($rec['date'])) | ||||
$counts['nodate']++; | $counts['later']++; | ||||
else if ($rec['date'] == $today) | else if ($rec['date'] == $today) | ||||
$counts['today']++; | $counts['today']++; | ||||
else if ($rec['date'] == $tomorrow) | else if ($rec['date'] == $tomorrow) | ||||
$counts['tomorrow']++; | $counts['tomorrow']++; | ||||
else if ($rec['date'] < $today) | else if ($rec['date'] < $today) | ||||
$counts['overdue']++; | $counts['overdue']++; | ||||
if ($this->plugin->is_attendee($rec) !== false) | else if ($rec['date'] > $tomorrow) | ||||
$counts['mytasks']++; | $counts['later']++; | ||||
} | } | ||||
} | } | ||||
// avoid session race conditions that will loose temporary subscriptions | // avoid session race conditions that will loose temporary subscriptions | ||||
$this->plugin->rc->session->nowrite = true; | $this->plugin->rc->session->nowrite = true; | ||||
return $counts; | return $counts; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,178 Lines • Show Last 20 Lines |