static function getHistorical($graderid, $groupid) { $task = new Task_Grader(); $qry = 'select ' . '(select count(id) from task where id = tg.id and status = 1) as completed, ' . '(select count(id) as total from task where id = tg.id) as total, ' . 'tg.cdate as cdate, ' . 'tg.status as status, ' . 'tg.id as id, ' . 'tg.tag as tag ' . 'from task_grader tg ' . 'where tg.graderid = ' . $graderid . ' and tg.groupid = ' . $groupid . ' order by tg.cdate desc'; $task->query($qry); $historical = array(); while ($task->fetch()) { $historical[] = array('completed' => $task->completed, 'total' => $task->total, 'cdate' => $task->cdate, 'status' => $task->status, 'id' => $task->id, 'tag' => $task->tag); } return $historical; }