function _AdvisingScreen::draw_popup_group_select_course_row
Search API
4.x _AdvisingScreen.php | _AdvisingScreen::draw_popup_group_select_course_row(Course $course, $group_hours_remaining = 0) |
5.x _AdvisingScreen.php | _AdvisingScreen::draw_popup_group_select_course_row(Course $course, $group_hours_remaining = 0) |
Used in the group selection popup, this will display a course with a radio button next to it, so the user can select it.
Parameters
Course $course:
int $group_hours_remaining:
Return value
string
1 call to _AdvisingScreen::draw_popup_group_select_course_row()
- _AdvisingScreen::display_popup_group_select_course_list in classes/
_AdvisingScreen.php - Accepts a CourseList object and draws it out to the screen. Meant to be called by display_popup_group_select();
File
- classes/
_AdvisingScreen.php, line 4487
Class
Code
function draw_popup_group_select_course_row(Course $course, $group_hours_remaining = 0)
{
// Display a course itself...
$pC = "";
$w1_1 = $this->popup_width_array [0];
$w1_2 = $this->popup_width_array [1];
$w1_3 = $this->popup_width_array [2];
$w2 = $this->popup_width_array [3];
$w3 = $this->popup_width_array [4];
$w4 = $this->popup_width_array [5];
$w5 = $this->popup_width_array [6];
$w6 = $this->popup_width_array [7];
$title_text = "";
$icon_html = "";
$pts = "";
if ($course->name_equals('MUAL 265')) {
fpm($course);
}
$theme ["icon"] = array();
$theme = array();
$theme ["screen"] = $this;
$theme ["student"] = $this->student;
$theme ["degree_plan"] = $this->degree_plan;
$theme ["from_group_select"] = TRUE;
//Setting in Configure School Settings:
$show_repeat_information = (variable_get("group_list_course_show_repeat_information", "yes") == "yes");
if ($course->subject_id == "")
{
// Lacking course's display data, so reload it from the DB.
$course->load_course($course->course_id);
}
$subject_id = $course->subject_id;
$course_num = $course->course_num;
$hours = $course->get_catalog_hours();
$display_status = $course->display_status;
$db_group_requirement_id = $course->db_group_requirement_id;
$grade = $course->grade;
$repeats = $course->specified_repeats;
if ($repeats > 0 && $show_repeat_information)
{
$w3 = "15%";
}
$course_id = $course->course_id;
//$group_id = $course->assigned_to_group_id;
$group_id = $course->get_first_assigned_to_group_id();
$semester_num = $course->assigned_to_semester_num;
$req_by_degree_id = $course->req_by_degree_id;
$min_var_hours = "";
$var_hour_icon = " ";
if ($course->has_variable_hours() == true)
{
$var_hour_icon = "<img src='" . fp_theme_location() . "/images/var_hour.gif'
title='" . t("This course has variable hours.") . "'
alt='" . t("This course has variable hours.") . "'>";
$min_var_hours = $course->min_hours;
// Does the var hours actually start at zero?
if ($course->bool_ghost_min_hour) {
$min_var_hours = 0;
}
}
$checked = "";
if ($course->bool_selected == true)
{
$checked = " checked='checked' ";
}
$blank_degree_id = "";
if ($this->bool_blank)
{
$blank_degree_id = $this->degree_plan->degree_id;
}
//$serializedCourse = urlencode(serialize($course));
$js_code = "popupDescribeSelected(\"$group_id\",\"$semester_num\",\"$course_id\",\"$subject_id\",\"req_by_degree_id=$req_by_degree_id&group_hours_remaining=$group_hours_remaining&db_group_requirement_id=$db_group_requirement_id&blank_degree_id=$blank_degree_id\");";
/*
$on_mouse_over = " onmouseover=\"style.backgroundColor='#FFFF99'\"
onmouseout=\"style.backgroundColor='white'\" ";
*/
$on_mouse_over = "
onmouseover='$(this).addClass(\"selection_highlight\");'
onmouseout='$(this).removeClass(\"selection_highlight\");'
";
if ($this->page_is_mobile) {
$on_mouse_over = ""; // Causes problems for some mobile devices.
}
$hand_class = "hand";
$extra_style = $extra_classes = $extra_css = $extra_html = "";
// Add the name of the course to the extra-classes
$extra_classes .= " cr-" . fp_get_machine_readable($course->subject_id . " " . $course->course_num);
// Check to see if the course is in our required_courses_id_array for more than one degree.
if (isset($this->degree_plan->required_course_id_array [$course->course_id])) {
if (count($this->degree_plan->required_course_id_array [$course->course_id]) > 1) {
// Add a new classname for this course...
$extra_classes .= " course-appears-in-mult-degrees course-appears-in-" . count($this->degree_plan->required_course_id_array [$course->course_id]) . "-degrees";
}
}
// Assemble theme array elements for the course itself.
$theme ["course"] = array(
"course" => $course,
"course_id" => $course->course_id,
"js_code" => $js_code,
"subject_id" => $subject_id,
"course_num" => $course_num,
"display_status" => $display_status,
"extra_classes" => $extra_classes,
"hours" => $hours,
"var_hour_icon" => $var_hour_icon,
"grade" => $grade,
"pts" => $pts,
"title" => $title_text,
"extra_html" => $extra_html,
);
$op_on_click_function = "adviseSelectCourseFromGroupPopup";
$theme ["op"] = array(
"display_status" => $display_status,
"extra_css" => $extra_css,
"onclick" => array(
"function" => $op_on_click_function,
"arguments" => array(""),
),
"checked" => $checked,
"hidden_field" => "<input type='hidden' name='$course_id" . "_subject'
id='$course_id" . "_subject' value='$subject_id'>
<input type='hidden' name='$course_id" . "_db_group_requirement_id'
id='$course_id" . "_db_group_requirement_id' value='$db_group_requirement_id'>
<input type='hidden' name='$course_id" . "_req_by_degree_id' id='$course_id" . "_req_by_degree_id' value='$req_by_degree_id'>
<input type='hidden' name='$course_id" . "_min_var_hours' id='$course_id" . "_min_var_hours' value='$min_var_hours'>
",
);
$theme ["course"]["js_code"] = $js_code;
// Invoke a hook on our theme array, so other modules have a chance to change it up.
invoke_hook("theme_advise_course_row", array(&$theme));
/////////////////////////////////
// Actually draw out our $theme array now....
// The checkbox & hidden element....
$op = $hid = "";
if (isset($theme ["op"]) && count($theme ["op"]) > 0) {
$onclick = "";
$onclick = $theme ["op"]["onclick"]["function"] . "(\"" . join("\",\"", $theme ["op"]["onclick"]["arguments"]) . "\")";
$checked = $theme ["op"]["checked"];
$hid = $theme ["op"]["hidden_field"];
$op = "<input type='radio' name='course' class='cb-course' id='cb-course-$course_id' value='$course_id' $checked onClick='return $onclick;' $extra_css>";
}
// The icon....
$icon_html = "";
if (isset($theme ["icon"]) && count($theme ["icon"]) > 0) {
$icon_html = "<img class='advising-course-row-icon'
src='{$theme ["icon"]["location"]}/{$theme ["icon"]["filename"]}' width='14' height='14' border='0' alt='{$theme ["icon"]["title"]}' title='{$theme ["icon"]["title"]}'>";
}
if ($course->bool_unselectable == true)
{
// Cannot be selected, so remove that ability!
$hand_class = "";
$on_mouse_over = "";
$js_code = "";
$op = $op_on_click_function = "";
$extra_style = "style='font-style: italic; color:gray;'";
}
//////////////////////////////////////
//////////////////////////////////////
// Actually draw the row's HTML
//////////////////////////////////////
$js_code = $theme ["course"]["js_code"];
$pC .= "
<table border='0' cellpadding='0' width='100%' cellspacing='0' align='left' class='group-course-row'>
<tr height='20' class='$hand_class {$theme ["course"]["display_status"]} {$theme ["course"]["extra_classes"]}'
$on_mouse_over title='{$theme ["course"]["title"]}'>
<td width='$w1_1' class='group-w1_1' align='left'>$op$hid<span onClick='$js_code'>$icon_html</span></td>
<td width='$w1_2' class='group-w1_2' align='left' onClick='$js_code'> </td>
<td width='$w1_3' class='group-w1_3' align='left' onClick='$js_code'> </td>
<td align='left' width='$w2' class='tenpt underline group-w2'
onClick='$js_code' $extra_style>
{$theme ["course"]["subject_id"]}</td>
<td class='tenpt underline group-w3' $extra_style width='$w3' align='left'
onClick='$js_code'>
{$theme ["course"]["course_num"]}</td>
";
if ($repeats > 0 && $repeats < 20 && $show_repeat_information)
{
$pC .= "
<td class='tenpt underline group-may-repeat' style='color: gray;'
onClick='$js_code' colspan='3'>
<i>" . t("May take up to") . " <span style='color: blue;'>" . ($repeats + 1) . "</span> " . t("times.") . "</i>
</td>
";
}
else if ($repeats > 0 && $repeats >= 20 && $show_repeat_information) {
$pC .= "
<td class='tenpt underline group-may-repeat' style='color: gray;'
onClick='$js_code' colspan='3'>
<i>" . t("May be repeated for credit.") . "</i>
</td>
";
}
else if ($theme ["course"]["extra_html"] != "") {
$pC .= "
<td class='tenpt underline' class='group-w4' width='$w4' onClick='$js_code' $extra_style>{$theme ["course"]["hours"]} {$theme ["course"]["var_hour_icon"]}</td>
<td class='tenpt underline group-course-extra-html'
onClick='$js_code' colspan='10'>
{$theme ["course"]["extra_html"]}
</td>
";
}
else {
$pC .= "
<td class='tenpt underline' class='group-w4' width='$w4' onClick='$js_code' $extra_style>{$theme ["course"]["hours"]} {$theme ["course"]["var_hour_icon"]}</td>
<td class='tenpt underline' class='group-w5' width='$w5' onClick='$js_code'>{$theme ["course"]["grade"]} </td>
<td class='tenpt underline' class='group-w6' width='$w6' onClick='$js_code'>{$theme ["course"]["pts"]} </td>
";
}
$pC .= "
</tr>
</table>";
return $pC;
}