function student_search_render_advisees

6.x student_search.module student_search_render_advisees($adv_array, $title)
4.x student_search.module student_search_render_advisees($adv_array, $title)
5.x student_search.module student_search_render_advisees($adv_array, $title)
4 calls to student_search_render_advisees()
student_search_display_majors_search in modules/student_search/student_search.module
Display the majors search sub-tab, where we can select a major and see the students assigned to it.
student_search_display_my_advisees in modules/student_search/student_search.module
Displays this user's advisees, if there are any assigned.
student_search_display_my_majors in modules/student_search/student_search.module
Displays students belonging to the current user's major code.
student_search_search_form in modules/student_search/student_search.module

File

modules/student_search/student_search.module, line 1237

Code

function student_search_render_advisees($adv_array, $title) {
  $rtn = "";

  fp_add_css(fp_get_module_path("student_search") . "/css/student_search.css");
  fp_add_css(fp_get_module_path('student_profile') . '/css/style.css');

  $bool_redirect_one = FALSE;

  if (count($adv_array) == 1 && @$_REQUEST ["did_search"] == "true") 
   {
    // Since there was only 1 result, we want to redirect this person directly.
    // Draw this person's name...  
    $details = reset($adv_array);
    $student_id = $details ["student_id"];
    $first_name = $details ["first_name"];
    $last_name = $details ["last_name"];

    $rtn .= "<div class='hypo' style='border: 1px solid black;
              margin: 10px 0px 10px 0px; padding: 10px; 
              font-size: 12pt; font-weight: bold;'>
        " . t("Loading") . " $first_name $last_name ($student_id).  
          &nbsp; " . t("Please wait...") . "
        </div>";
    $bool_redirect_one = TRUE;
  }


  $rtn .= fp_render_section_title($title, "search-results");


  $table_headers = student_search_get_advisee_table_headers();

  $rtn .= "<table border='0' class='advisee-search-results-table'>";
  // Draw our our table headers, with links....
  $rtn .= theme_table_header_sortable($table_headers);

  $db = get_global_database_handler();

  foreach ($adv_array as $t => $details) {

    $student_id = $adv_array [$t]["student_id"];
    $first_name = $adv_array [$t]["first_name"];
    $last_name = $adv_array [$t]["last_name"];
    $major = $adv_array [$t]["major"];
    $school_id = $adv_array [$t]["school_id"];
    $priority_value = floatval($adv_array [$t]["priority_value"]);

    $advising_what_if = @$adv_array [$t]["advising_what_if"];
    $what_if_major_code = @$adv_array [$t]["what_if_major_code"];
    $what_if_track_code = @$adv_array [$t]["what_if_track_code"];
    $what_if_catalog_year = @$adv_array [$t]["what_if_catalog_year"];
    $degree_id = @$adv_array [$t]["degree_id"];
    $rank = @$adv_array [$t]["rank"];
    $catalog_year = @$adv_array [$t]["catalog_year"];

    // There is no $screen variable-- old code?
    //if ($screen->page_is_mobile) {
    //  $catalog_year = get_shorter_catalog_year_range($catalog_year, false, true);
    //}

    $advising_session_id = $adv_array [$t]["advising_session_id"];
    $advised_image = $adv_array [$t]["advised_image"];



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




    // Build up the URL we want to go to when we click this row.

    $path = 'student-select';

    /*
    $path = "view";
    $advising_what_if = "no";
    if ($what_if_major_code != "") {
      $path = "what-if";
      $advising_what_if = "yes";            
    }
    */

    // Add in the query part.
    $query = "";
    $query .= "advising_student_id=$student_id&current_student_id=$student_id&advising_major_code=$major&advising_what_if=$advising_what_if";
    $query .= "&what_if_major_code=$what_if_major_code&what_if_track_code=$what_if_track_code&what_if_catalog_year=$what_if_catalog_year&advising_load_active=yes&clear_session=yes";

    $url = fp_url($path, $query);

    // old onCLick:
    //<!-- onClick='selectStudent(\"$student_id\",\"$major\",\"$what_if_major_code\",\"$what_if_track_code\")' -->

    $disp_major = "";
    $temp = csv_to_array($major);
    foreach ($temp as $code) {
      $csscode = fp_get_machine_readable($code);
      // Was this a track code or not?  Meaning, did it contain |_
      $is_track = "no";
      if (strstr($code, "|_")) {
        $is_track = "yes";
      }

      $disp_major .= "<div class='ss-major-code ss-major-code-$csscode ss-major-code-is-track-$is_track'>$code</div>";
    }


    $student_name = "<span class='student-first-name student-fnf'>$first_name</span><span class='student-last-name'>$last_name</span>";


    $priority = t("N/A");
    if ($priority_value > 0) {
      $temp = student_priority_get_student_academic_priority_label($priority_value);
      $machine = $temp ['machine'];
      $label = $temp ['label'];
      $priority = "<span class='profile-priority-bar priority-$machine'><span class='desc'>$label</desc></span>";
    }


    $rtn .= "
      <tr class='search-result-row' $on_mouse  onClick='showUpdate(true); window.location=\"$url\"; '>
          
            <td class='ss-advised-image'>$advised_image</td>  
            <td class='ss-student-id'>$student_id</td>
            <td class='ss-student-name'>$student_name</td>";
    if (module_enabled("schools")) {
      $rtn .= "<td class='ss-student-school'>" . schools_get_school_code_for_id($school_id) . "</td>";
    }
    $rtn .= "
            <td class='ss-student-major'>$disp_major</td>
            <td class='ss-student-rank'>$rank</td>
            <td class='ss-student-catalog-year'>$catalog_year</td>
            <td class='ss-student-priority-value'>$priority</td>
           
         </tr>
         ";

  } // for t advisee array


  $rtn .= "</table>";

  $rtn .= theme_pager();

  if ($bool_redirect_one) {
    // There was only one result, and it was a search, so we want to redirect
    // this person.
    // We will use the URL we created in the foreach loop above.  It will still contain exactly
    // what we need.
    $rtn .= "<script type='text/javascript'>
        
        $(document).ready(function() {
          setTimeout('fp_show_loading(\"" . t("Loading...") . "\");window.location=\"$url\";', 0);
        });

        </script>";

  }





  return $rtn;
}