function AdvisingScreen::draw_group_select_row

6.x AdvisingScreen.php AdvisingScreen::draw_group_select_row(Group $group, $remaining_hours, $rowclass = "")

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 3857

Class

AdvisingScreen

Code

function draw_group_select_row(Group $group, $remaining_hours, $rowclass = "") 
 {

  $img_path = fp_theme_location() . "/images";


  $on_mouse_over = "
            onmouseover='$(this).addClass(\"selection_highlight\");'
            onmouseout='$(this).removeClass(\"selection_highlight\");'   ";



  $render = array();
  $render ['#id'] = 'AdvisingScreen_draw_group_select_row';
  $render ['#group'] = $group;
  $render ['#group_name'] = $group->group_name;
  $render ['#remaining_hours'] = $remaining_hours;
  $render ['#semester_num'] = $group->assigned_to_semester_num;

  $school_id = $group->school_id;

  $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;
  $render ['#degree_id'] = $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;
  }

  $dialog_title = t("Select @disp_hrs hour$s from %group_title", array('@disp_hrs' => $disp_remaining_hours, '%group_title' => $group->title));
  if ($remaining_hours > 200) {
    // Don't bother showing the remaining hours number.
    $dialog_title = t("Select additional hour$s from %group_title", array('%group_title' => $group->title));
    if ($group->group_id == DegreePlan::GROUP_ID_FOR_COURSES_ADDED) {
      $dialog_title = t("Select additional courses");
    }
  }


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

  $row_msg = t("Click") . " <span style='color:red;' class='group-select-arrows'>&gt;&gt;</span> " . t("to select @drh hour$s.", array("@drh" => $disp_remaining_hours));
  if ($remaining_hours > 200) {
    // Don't bother showing the remaining hours number.
    $row_msg = t("Click") . " <span style='color:red;' class='group-select-arrows'>&gt;&gt;</span> " . t("to select additional courses.");
  }

  $hand_class = "hand";

  if (variable_get_for_school("show_group_titles_on_view", "no", $school_id) == "yes") 
   {

    $row_msg = t("Select") . " $disp_remaining_hours " . t("hour$s from") . " $group->title.";

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

    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 = t("Click to add an additional course.");
    $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));

  $render ['#js_code'] = $js_code;



  $render ['start_group_select_row'] = array(
    'value' => "<tr class='from-render-api $rowclass'><td colspan='8' class='group-select-row-tr'>",
    'weight' => 0,
  );



  $render ['group_select_table_top'] = array(
    'value' => "<table border='0' cellpadding='0' class='table-group-select-row' cellspacing='0' >",
    'weight' => 100,
  );

  $render ['group_select_table_tr'] = array(
    'value' => "<tr class='$hand_class {$theme ["group"]["extra_classes"]} group-select-row'
          $on_mouse_over title='{$theme ["group"]["title"]}'>",
    'weight' => 200,
  );

  $render ['group_select_table_w1_1'] = array(
    'value' => "<td class='group-w1_1 w1_1' ></td>",
    'weight' => 300,
  );

  $render ['group_select_table_icon_link'] = array(
    'value' => "<td class='group-w1_2 w1_2' onClick='{$theme ["group"]["js_code"]}'>{$theme ["group"]["icon_link"]}</td>",
    'weight' => 400,
  );

  $render ['group_select_table_select_icon'] = array(
    'value' => "<td class='group-w1_3 w1_3' onClick='{$theme ["group"]["js_code"]}'>{$theme ["group"]["select_icon"]}</td>",
    'weight' => 500,
  );

  $render ['group_select_table_row_msg'] = array(
    'value' => "<td class='underline group-row-msg' onClick='{$theme ["group"]["js_code"]}'>
          {$theme ["group"]["row_msg"]}
          </td>",
    'weight' => 600,
  );


  $render ['group_select_table_bottom'] = array(
    'value' => "</tr>
                  </table>",
    'weight' => 5000,
  );



  $render ['end_group_select_row'] = array(
    'value' => "</td></tr>",
    'weight' => 9999,
  );


  return fp_render_content($render, FALSE);
}