Changeset View
Changeset View
Standalone View
Standalone View
plugins/tasklist/drivers/database/tasklist_database_driver.php
Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | function count_tasks($lists = null) | ||||
$result = $this->rc->db->query(sprintf( | $result = $this->rc->db->query(sprintf( | ||||
"SELECT task_id, flagged, date FROM " . $this->db_tasks . " | "SELECT task_id, flagged, date FROM " . $this->db_tasks . " | ||||
WHERE tasklist_id IN (%s) | WHERE tasklist_id IN (%s) | ||||
AND del=0 AND NOT " . self::IS_COMPLETE_SQL, | AND del=0 AND NOT " . self::IS_COMPLETE_SQL, | ||||
join(',', $list_ids) | join(',', $list_ids) | ||||
)); | )); | ||||
$counts = array('all' => 0, 'flagged' => 0, 'today' => 0, 'tomorrow' => 0, 'overdue' => 0, 'nodate' => 0); | $counts = array('all' => 0, 'today' => 0, 'tomorrow' => 0, 'overdue' => 0, 'later' => 0); | ||||
while ($result && ($rec = $this->rc->db->fetch_assoc($result))) { | while ($result && ($rec = $this->rc->db->fetch_assoc($result))) { | ||||
$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']++; | ||||
else if ($rec['date'] > $tomorrow) | |||||
$counts['later']++; | |||||
} | } | ||||
return $counts; | return $counts; | ||||
} | } | ||||
/** | /** | ||||
* Get all task records matching the given filter | * Get all task records matching the given filter | ||||
* | * | ||||
▲ Show 20 Lines • Show All 572 Lines • Show Last 20 Lines |