diff --git a/school.d/default.inc b/school.d/default.inc
--- a/school.d/default.inc
+++ b/school.d/default.inc
@@ -74,6 +74,12 @@ function default_registration_html(Page
$link_text = $school['name'] . '\'s website';
}
+ $synonyms = array();
+ foreach ($courses as $course)
+ foreach ($course as $course_slot)
+ foreach ($course_slot as $section)
+ $synonyms[] = $section->getSynonym();
+
$html = ''
. '
' . PHP_EOL
. ' Enter these codes into ' . htmlentities($school['name']) . '\'s online course registration' . PHP_EOL
@@ -81,10 +87,19 @@ function default_registration_html(Page
. ' to register for classes:' . PHP_EOL
. '
' . PHP_EOL
. ' ' . PHP_EOL;
- foreach ($courses as $course)
- foreach ($course as $course_slot)
- foreach ($course_slot as $section)
- $html .= ' - ' . htmlentities($section->getSynonym()) . '
' . PHP_EOL;
+ foreach ($synonyms as $synonym)
+ $html .= ' - ' . htmlentities($synonym) . '
' . PHP_EOL;
$html .= '
' . PHP_EOL;
- return $html;
+ $ret = array('html' => $html);
+
+ if (!empty($school['webadvisor_url']))
+ {
+ $webadvisor_register_url = 'webadvisor.php?school=' . $school['id'] . '§ions=' . implode(',', $synonyms);
+ $ret['html'] = ''
+ . ' Automatically register
' . PHP_EOL
+ . $ret['html'];
+ $ret['location'] = page::uri_resolve($webadvisor_register_url);
+ }
+
+ return $ret;
}