/** * Get a listing of all terms organized for presentation in a select picker * * @return array **/ public function getTermList() { $cache = new HierarchicalSimpleCache($this->getMySQL(), __CLASS__); $terms = $cache->getCache('terms'); if ($terms === false) { $_terms = $this->api_get('accounts/1/terms', ['workflow_state' => 'active']); $termsResponse = $_terms['enrollment_terms']; $terms = []; foreach ($termsResponse as $term) { $terms[$term['id']] = $term; } $cache->setCache('terms', $terms); } return $terms; }
$departments = array(); $allCourses = array(); $assessments = array(); try { $departments = $cache->getCache('departments'); $allCourses = $cache->getCache('courses'); $assessments = $cache->getcache(serialize($_REQUEST)); if (empty($departments)) { $departments = array(); foreach ($api->get("accounts/{$accountId}/sub_accounts") as $department) { // FIXME only "real" departments have numeric SIS IDs, not a reliable differentiator! if (!empty($department['sis_account_id']) && is_numeric($department['sis_account_id'])) { $departments[$department['id']] = $department; } } $cache->setCache('departments', $departments); } if (empty($allCourses) || empty($assessments)) { foreach ($departments as $department) { $cache->pushKey($department['id']); $courses = $cache->getCache('courses'); if (empty($courses)) { $courses = array(); // TODO this particular set of parameters restricts us to only current courses (no historical data) foreach ($api->get("accounts/{$department['id']}/courses", array('with_enrollments' => true, 'published' => true, 'completed' => false)) as $course) { $courses[$course['id']] = $course; } usort($courses, function ($a, $b) { if ($a['name'] == $b['name']) { return 0; }
} $schedule[$day][$color][$key] = $value; } } } uasort($schedule[$day], "compareStartTimes"); } } $minuteHeight = setMinuteHeight($schedule, $pageHeight); $key = getUniqueId(); $vars = get_defined_vars(); unset($vars['sql']); unset($vars['cache']); unset($vars['cache']); unset($vars['smarty']); $cache->setCache($key, $vars, HierarchicalSimpleCache::IMMORTAL_LIFETIME); header("Location: {$_SERVER['PHP_SELF']}?cache={$key}"); exit; } ?> <!DOCTYPE html> <html> <head> <title>Color Schedule</title> <style type="text/css"> @page { size: <?php echo $pageWidth; ?> in <?php echo $pageHeight;