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_display_search in modules/student_search/student_search.module

File

modules/student_search/student_search.module, line 586

Code

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


  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...  
    $student_id = $adv_array [0]["student_id"];
    $first_name = $adv_array [0]["first_name"];
    $last_name = $adv_array [0]["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") . " <font color='blue'>$first_name $last_name</font> ($student_id).  
          &nbsp; " . t("Please wait...") . "
        </div>";
    $bool_redirect_one = TRUE;
  }


  $rtn .= fp_render_curved_line($title);

  $rtn .= "<table width='100%' align='left'
            border='0' cellpadding='0' cellspacing='0'>";

  // Do not show headers at all if mobile
  if (!fp_screen_is_mobile()) {
    $rtn .= "
      <td width='5%' valign='top'>&nbsp; </td>
      <td width='12%' valign='top' class='tenpt'><b>" . t("CWID") . "</b></td>
      <td width='15%' valign='top' class='tenpt'><b>" . t("First Name") . "</b></td>
      <td width='20%' valign='top' class='tenpt'><b>" . t("Last Name") . "</b></td>
      <td width='15%' valign='top' class='tenpt'><b>" . t("Major Code") . "</b></td>
      <td width='10%' valign='top' class='tenpt'><b>" . t("Rank") . "</b></td>
      <td width='15%' valign='top' class='tenpt'><b>" . t("Catalog Year") . "</b></td>
      ";
  }

  $rtn .= "
    </tr>";

  for ($t = 0; $t < count($adv_array); $t++) 
   {
    $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"];
    $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"];
    $degree_id = $adv_array [$t]["degree_id"];
    $rank = $adv_array [$t]["rank"];
    $catalog_year = $adv_array [$t]["catalog_year"];
    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=\"style.backgroundColor='#FFFF99'\"
               onmouseout=\"style.backgroundColor='white'\"
                ";
    if ($screen->page_is_mobile) {
      $on_mouse = ""; // Causes problems on mobile devices.
    }

    // Build up the URL we want to go to when we click this row.
    $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&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\")' -->

    $rtn .= "
      <tr height='19'>
          <td colspan='7'>
          <table border='0' 
                  $on_mouse  
                  onClick='showUpdate(true); window.location=\"$url\"; '                 
                   width='100%' >
                  <tr height='20'>
                    <td width='5%' class='hand'>$advised_image</td>  
                <td width='12%' class='hand'><font size='2'>$student_id</font></td>
                  <td width='15%' class='hand'><font size='2'>$first_name </font></td>
                <td width='20%' class='hand'><font size='2'>$last_name </font></td>    
              <td width='15%' class='hand'><font size='2'>$major</td>
                <td width='10%' class='hand'><font size='2'>$rank</td>
                <td width='15%' class='hand'><font size='2'>$catalog_year</td>
                 </tr>
                  </table>   
            </td> 
         </tr>
         ";
  }


  $rtn .= "</table>";



  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('window.location=\"$url\";', 0);
        });

        </script>";

  }




  // Required to make the changeTab function work...
  $rtn .= "<form id='mainform' method='POST'>
      <input type='hidden' id='scrollTop'>
      <input type='hidden' id='performAction' name='performAction'>
      <input type='hidden' id='advisingWhatIf' name='advisingWhatIf'>
      <input type='hidden' id='currentStudentID' name='currentStudentID'>
      <input type='hidden' id='advisingStudentID' name='advisingStudentID'>
      <input type='hidden' id='advisingMajorCode' name='advisingMajorCode'>
      <input type='hidden' id='whatIfMajorCode' name='whatIfMajorCode'>
      <input type='hidden' id='whatIfTrackCode' name='whatIfTrackCode'>
      <input type='hidden' id='advisingLoadActive' name='advisingLoadActive'>
      <input type='hidden' id='clearSession' name='clearSession'>
      </form>";


  return $rtn;
}