function _AdvisingScreen::draw_group_select_row

4.x _AdvisingScreen.php _AdvisingScreen::draw_group_select_row(Group $group, $remaining_hours)
5.x _AdvisingScreen.php _AdvisingScreen::draw_group_select_row(Group $group, $remaining_hours)

This draws the "blank row" for a group on the degree plan, which instructs the user to click on it to select a course from the popup.

Parameters

Group $group:

int $remaining_hours:

Return value

string

1 call to _AdvisingScreen::draw_group_select_row()
_AdvisingScreen::display_group in classes/_AdvisingScreen.php
This function displays a Group object on the degree plan. This is not the selection popup display. It will either show the group as multi rows, filled in with courses, or as a "blank row" for the user to click on.

File

classes/_AdvisingScreen.php, line 3616

Class

_AdvisingScreen

Code

function draw_group_select_row(Group $group, $remaining_hours) 
 {
  $pC = "";
  $img_path = fp_theme_location() . "/images";
  /*
		$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.
  }

  $w1_1 = $this->width_array [0];
  $w1_2 = $this->width_array [1];
  $w1_3 = $this->width_array [2];
  $w2 = $this->width_array [3];
  $w3 = $this->width_array [4];
  $w4 = $this->width_array [5];
  $w5 = $this->width_array [6];
  $w6 = $this->width_array [7];

  $s = "s";
  if ($remaining_hours < 2) 
   {
    $s = "";
  }

  $title_text = $extra_classes = "";


  // Add the name of the group to the extra-classes
  $extra_classes .= " gr-" . fp_get_machine_readable($group->group_name);



  $select_icon = "<img src='$img_path/select.gif' border='0'>";
  $icon_link = "<img src='$img_path/icons/$group->icon_filename' width='19' height='19' border='0' alt='$title_text' title='$title_text'>";

  $blank_degree_id = "";
  if ($this->bool_blank) 
   {
    $blank_degree_id = $this->degree_plan->degree_id;
  }

  $req_by_degree_id = $group->req_by_degree_id;

  $disp_remaining_hours = $remaining_hours;
  // If the group has min_hours, then the disp_remaining_hours gets that too.
  if ($group->has_min_hours_allowed()) {
    $disp_remaining_hours = ($group->min_hours_allowed - $group->hours_fulfilled) . "-" . $remaining_hours;
  }


  $js_code = "selectCourseFromGroup(\"$group->group_id\", \"$group->assigned_to_semester_num\", \"$remaining_hours\", \"$blank_degree_id\",\"$req_by_degree_id\");";

  $row_msg = "<i>Click <font color='red'>&gt;&gt;</font> to select $disp_remaining_hours hour$s.</i>";
  if ($remaining_hours > 200) {
    // Don't bother showing the remaining hours number.
    $row_msg = "<i>Click <font color='red'>&gt;&gt;</font> to select additional courses.</i>";
  }

  $hand_class = "hand";

  if ($this->bool_print || variable_get("show_group_titles_on_view", "no") == "yes") 
   {

    $row_msg = "<i>Select $disp_remaining_hours hour$s from $group->title.</i>";
    if ($remaining_hours > 200) {
      // Don't bother showing the remaining hours number.
      $row_msg = "<i>Select additional courses from $group->title.</i>";
    }

    if ($this->bool_print) {
      // In print view, disable all popups and mouseovers.
      $on_mouse_over = "";
      $js_code = "";
      $hand_class = "";
    }

  }


  if ($group->group_id == DegreePlan::GROUP_ID_FOR_COURSES_ADDED) 
   { // This is the Add a Course group.
    $row_msg = "<i>Click to add an additional course.</i>";
    $select_icon = "<span style='font-size: 16pt; color:blue;'>+</span>";
    $icon_link = "";
  }


  // Let's find out if this group contains courses which can be used in more than one degree.
  $res = intval($this->degree_plan->get_max_course_appears_in_degrees_count($group->group_id));

  if ($res > 1) {
    $extra_classes .= " contains-course-which-appears-in-mult-degrees contains-course-which-appears-in-$res-degrees";
  }


  // Just like the other times we check to theme a course row, let's give the option to theme this as well.
  $theme = array();
  $theme ["screen"] = $this;
  $theme ["degree_plan"] = $this->degree_plan;
  $theme ["student"] = $this->student;
  $theme ["group"]["group"] = $group;
  $theme ["group"]["extra_classes"] = $extra_classes;
  $theme ["group"]["icon_link"] = $icon_link;
  $theme ["group"]["select_icon"] = $select_icon;
  $theme ["group"]["js_code"] = $js_code;
  $theme ["group"]["row_msg"] = $row_msg;
  $theme ["group"]["title"] = $group->title;
  $theme ["group"]["remaining_hours"] = $remaining_hours;


  // Invoke a hook on our theme array, so other modules have a chance to change it up.   
  invoke_hook("theme_advise_group_select_row", array(&$theme));


  $pC .= "
   		<table border='0' cellpadding='0' width='100%' cellspacing='0' align='left'>
     	<tr height='20' class='$hand_class {$theme ["group"]["extra_classes"]} group-select-row'
      		$on_mouse_over title='{$theme ["group"]["title"]}'>
      		<td width='$w1_1' class='group-w1_1' align='left'>&nbsp;</td>
      		<td width='$w1_2' class='group-w1_2' align='left' onClick='{$theme ["group"]["js_code"]}'>{$theme ["group"]["icon_link"]}</td>
      		<td width='$w1_3' class='group-w1_3' align='left' onClick='{$theme ["group"]["js_code"]}'>{$theme ["group"]["select_icon"]}</td>
      		<td align='left' colspan='5' class='tenpt underline group-row-msg' onClick='{$theme ["group"]["js_code"]}'>
      		{$theme ["group"]["row_msg"]}
       				
     	</tr>
     	</table>";





  return $pC;
}