function student_search_display_my_advisees

6.x student_search.module student_search_display_my_advisees($bool_only_return_adv_array = FALSE, $use_cwid = NULL, $force_school_id = NULL, $limit = 20)
4.x student_search.module student_search_display_my_advisees()
5.x student_search.module student_search_display_my_advisees()

Displays this user's advisees, if there are any assigned.

2 calls to student_search_display_my_advisees()
system_display_dashboard_page in modules/system/system.module
This is the "dashboard" page for FlightPath, which replaces the "main" page from FP 5.
system_render_advising_snapshop_for_iframe in modules/system/system.module
This is meant to be a widget which shows in the dashboard of the advising user, within an iframe, since it can take a while to load.

File

modules/student_search/student_search.module, line 327

Code

function student_search_display_my_advisees($bool_only_return_adv_array = FALSE, $use_cwid = NULL, $force_school_id = NULL, $limit = 20) {
  global $user, $pager_total_items;
  $rtn = "";


  fp_set_title('');

  $_SESSION ["student_search_last_tab"] = "my-advisees";

  if ($use_cwid == NULL) {
    $faculty_cwid = $user->cwid;
  }
  else {
    $faculty_cwid = $use_cwid;
  }


  // Get all the school ids this user is allowed to search.
  $school_ids = student_search_get_school_ids_user_is_allowed_to_search();
  $school_id_list = join(",", $school_ids);

  if ($force_school_id != NULL) {
    $school_id_list = intval($force_school_id);
  }


  $query = "SELECT u.user_id, f_name, u.cwid, l_name, major_code, rank_code, a.catalog_year, priority_value, u.school_id
              FROM (users u, students a, advisor_student c, student_degrees d)    
              LEFT JOIN student_priority ON (student_priority.student_id = u.cwid)
              WHERE 
                 c.faculty_id = :faculty_cwid
                 AND c.student_id = a.cwid
                 AND c.student_id = d.student_id                 
                 AND u.cwid = a.cwid                 
                 AND u.school_id IN ($school_id_list)
                 AND u.is_student = 1
                 AND u.is_disabled = 0                 
                 AND rank_code IN %RANKIN%
                    %EXTRA_STUDENTSEARCH_CONDITIONS%                                             
              GROUP BY u.cwid
              %ORDERBY%              
              ";

  $adv_array = student_search_query_advisees($query, array(":faculty_cwid" => $faculty_cwid), $limit, $bool_only_return_adv_array);

  if ($bool_only_return_adv_array) {
    return $adv_array;
  }


  $s = (count($adv_array) == 1) ? "" : "s";
  $rtn .= "<div class='student-search-my-advisees'>" . student_search_render_advisees($adv_array, t("My Advisees Results") . " &nbsp; ({$pager_total_items [0]} " . t("student$s") . ")") . "</div>";

  return $rtn;
}