static function getMilestonesInfo($mid) { if (self::$info_cache == null) { self::$info_cache = array(); // completed $rows = DB::executeAll("select count(object_id) as row_count, milestone_id from " . TABLE_PREFIX . "project_tasks use index (completed_on) where completed_on > '0000-00-00' group by milestone_id;"); if (is_array($rows)) { foreach ($rows as $row) { if (array_var($row, 'milestone_id') > 0) { if (!isset(self::$info_cache[$row['milestone_id']])) { self::$info_cache[$row['milestone_id']] = array(); } self::$info_cache[$row['milestone_id']]['tc'] = array_var($row, 'row_count'); } } } // all milestone tasks $rows = DB::executeAll("select count(object_id) as row_count, milestone_id from " . TABLE_PREFIX . "project_tasks use index (milestone_id) group by milestone_id;"); if (is_array($rows)) { foreach ($rows as $row) { if (array_var($row, 'milestone_id') > 0) { if (!isset(self::$info_cache[$row['milestone_id']])) { self::$info_cache[$row['milestone_id']] = array(); } self::$info_cache[$row['milestone_id']]['tnum'] = array_var($row, 'row_count'); } } } } return array_var(self::$info_cache, $mid); }