foreach ($courses as $course) {
     /* ...and figure out their _original_ course SIS ID... */
     $sections = $toolbox->api_get("courses/{$course['id']}/sections");
     foreach ($sections as $section) {
         $sis_course_id = isset($parentCourses[$section['sis_section_id']]) ? $parentCourses[$section['sis_section_id']] : false;
         if ($sis_course_id === false) {
             $parentCourse = $course;
             if (!empty($section['nonxlist_course_id'])) {
                 $parentCourse = $toolbox->api_get("courses/{$section['nonxlist_course_id']}");
             }
             $sis_course_id = $parentCourse['sis_course_id'];
             $parentCourses[$section['sis_section_id']] = $sis_course_id;
         }
         /* ...figure out the proper block color... */
         if (preg_match("/({$colors})/i", $sis_course_id, $match)) {
             $color = sm::get(strtolower($match[1]))->dark()->value();
             /* ...and set it for all enrolled users. */
             $enrollments = $toolbox->api_get("sections/{$section['id']}/enrollments", array('state' => 'active'));
             $users = 0;
             foreach ($enrollments as $enrollment) {
                 if ($enrollment['user']['name'] !== 'Test Student' && !isset($colorAssignments[$enrollment['user']['id']][$course['id']])) {
                     $response = $toolbox->api_put("users/{$enrollment['user']['id']}/colors/course_{$course['id']}", array('hexcode' => $color));
                     $colorAssignments[$enrollment['user']['id']][$course['id']] = $response['hexcode'];
                     $users++;
                 }
             }
             $notification = "<a href=\"{$_SESSION[CANVAS_INSTANCE_URL]}/courses/{$course['id']}/sections/{$section['id']}\">{$section['name']}</a> <span style=\"color: #{$color};\"><span class=\"glyphicon glyphicon-calendar\"></span></span> ({$users} / " . $enrollments->count() . " users)";
             if ($users > 0) {
                 $affected[] = $notification;
             } else {
                 $unaffected[] = $notification;
Example #2
0
;
                border-color: <?php 
echo col::get(col::STMARKS_BLUE)->dark();
?>
;
            }

            .<?php 
echo ALL_SCHOOL;
?>
.busy input, .<?php 
echo SM_SATURDAY;
?>
.busy input {
                color: <?php 
echo col::get(col::STMARKS_BLUE)->text();
?>
;
            }

            .<?php 
echo X_BLOCK;
?>
.busy, .<?php 
echo CO_CURRICULAR;
?>
.busy {
                background: #ddd;
            }

            .<?php