advise.history.inc

  1. 7.x modules/advise/advise.history.inc
  2. 6.x modules/advise/advise.history.inc
  3. 4.x modules/advise/advise.history.inc
  4. 5.x modules/advise/advise.history.inc

File

modules/advise/advise.history.inc
View source
  1. <?php
  2. /*
  3. * This file is responsible for the contents / functionality of the History tab.
  4. */
  5. /**
  6. * Displays the history tab on screen.
  7. */
  8. function advise_display_history() {
  9. global $current_student_id;
  10. $student_id = $current_student_id;
  11. $db = get_global_database_handler();
  12. $rtn = "";
  13. fp_add_css(fp_get_module_path("advise") . "/css/advise.css");
  14. fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  15. $rtn .= "<table class='fp-semester-table'>";
  16. // If coming here from a save, display info here.
  17. if ($_REQUEST["adv_id_array_serialized"] != "") {
  18. $click_links = "";
  19. $advising_session_id_array = unserialize($_REQUEST["adv_id_array_serialized"]);
  20. foreach($advising_session_id_array as $term_id=>$value) {
  21. $term_id = (string) $term_id; // Make sure term_id is a standard string
  22. $aid = $advising_session_id_array[$term_id];
  23. if ($aid != "")
  24. {
  25. $term_name = get_term_description($term_id);
  26. $click_links .= "<li>
  27. <a href='javascript: popupPrintWindow(\"" . base_path() . "/advise/popup-display-summary&advising_session_id=$aid\");'>
  28. <img src='" . fp_theme_location() . "/images/popup.gif' border='0'>
  29. $term_name</a>";
  30. }
  31. }
  32. // onClick='popup_print_window(\"advise.php?window_mode=summary&advising_session_id=ADVID\");'
  33. $rtn .= "
  34. <tr>
  35. <td colspan='2' width='100%'>
  36. <div class='hypo'
  37. align='left' style='border: 1px solid black;
  38. margin: 10px 0px 10px 0px; padding: 10px;
  39. font-size: 12pt; font-weight: bold;'>
  40. " . t("You have successfully advised") . " " . $db->get_student_name($student_id) . " ($student_id).
  41. <br><span style='color: blue;'>" . t("Click
  42. to view a pop-up printable summary for:") . "
  43. <ul style='margin-top: 5px; margin-bottom: 5px;'>
  44. $click_links
  45. </ul></span></div>
  46. </td>
  47. </tr>
  48. ";
  49. }
  50. $rtn .= "<tr><td width='50%' valign='top' style='padding-right: 10px;'>";
  51. ///////////////////////////////////////////////////
  52. //////////////////////////////////////////////////
  53. ///////// Advising History
  54. ///////////////////////////////////////////////////
  55. $rtn .= fp_render_curved_line(t("Advising History"));
  56. $rtn .= "<table border='0' cellspacing='0'>";
  57. $old_session_d_t = 0;
  58. $a_count = 0;
  59. $is_empty = true;
  60. $first_style = "color: maroon; font-weight:bold;";
  61. $on_mouse_over = "onmouseover=\"style.backgroundColor='#FFFF99'\"
  62. onmouseout=\"style.backgroundColor='white'\" ";
  63. $res = db_query("SELECT * FROM advising_sessions
  64. WHERE student_id = '?'
  65. AND is_draft = '0'
  66. AND is_empty = '0'
  67. ORDER BY `posted` DESC, `term_id` DESC ", $student_id);
  68. while($cur = db_fetch_array($res)) {
  69. extract($cur, 3, "db");
  70. $dt = date("n/j/y g:ia",$db_posted);
  71. // Is this datetime within 5 seconds of the previous datetime?
  72. // If so, they were likely saved together, and are part
  73. // of the same advising session. Otherwise, this is a NEW
  74. // advising session. The if statement below is testing is this
  75. // a new advising session.
  76. $test_d_t = $db_posted;
  77. if ($old_session_d_t < ($test_d_t - 5) || $old_session_d_t > ($test_d_t + 5))
  78. {
  79. $p = "20px;";
  80. if ($a_count == 0)
  81. {
  82. $p = "10px;";
  83. }
  84. $old_session_d_t = $test_d_t;
  85. $advised_by = "<div style='padding-top: $p'>
  86. <b>" . t("Advised by") . " " . fp_get_faculty_name($db_faculty_id, false) . "</b>
  87. </div>";
  88. $rtn .= "<tr><td colspan='2' class='tenpt'>
  89. $advised_by
  90. </td>
  91. </tr>";
  92. $a_count++;
  93. }
  94. $is_empty = false;
  95. if ($a_count > 1) {
  96. $first_style = "";
  97. }
  98. $on_click = "popupPrintWindow(\"" . base_path() . "/advise/popup-display-summary&advising_session_id=$db_advising_session_id\");";
  99. $term = get_term_description($db_term_id);
  100. $rtn .= "<tr $on_mouse_over style='cursor: pointer; $first_style'
  101. onClick='$on_click'>
  102. <td valign='top' class='tenpt'
  103. style='padding-left:20px;'
  104. width='165'>
  105. $term
  106. </td>
  107. <td valign='top' class='tenpt'>
  108. $dt
  109. </td>
  110. </tr>";
  111. }
  112. $rtn .= "</table>";
  113. if ($is_empty == true) {
  114. $rtn .= "<div class='tenpt'>No advising history available.</div>";
  115. }
  116. //----------------------------------------------------------------------------------------
  117. //------------------------------ COMMENT HISTORY -----------------------------------------
  118. //----------------------------------------------------------------------------------------
  119. $rtn .= "</td><td width='50%' valign='top'>";
  120. $rtn .= fp_render_curved_line(t("Comment History"));
  121. $rtn .= "<table border='0' cellspacing='0'>";
  122. $old_term_id = "";
  123. $first_style = "first";
  124. $is_empty = true;
  125. $has_admin_category = false;
  126. $access_line = "";
  127. if (!user_has_permission("view_faculty_comments")) {
  128. $access_line = "and `access_type`='public' ";
  129. }
  130. $rtn .= "<tr><td colspan='3' class='tenpt'>
  131. <!--STARTCOM$cat_type--><div style='padding-top: 10px;'>
  132. <b>" . t("Advising Comments") . "</b>
  133. &nbsp;
  134. <a href='javascript: popupPrintWindow(\"" . base_path() . "/comments/popup-display-all-comments\");'
  135. class='nounderline'><img src='" . fp_theme_location() . "/images/popup.gif' border='0'>view/print all</a>
  136. </div><!--ENDCOM$cat_type-->
  137. </td></tr>";
  138. $res = db_query("SELECT * FROM advising_comments
  139. WHERE student_id = '?'
  140. AND delete_flag = '0'
  141. $access_line
  142. $cat_line
  143. order by `posted` desc ", $student_id);
  144. while ($cur = db_fetch_array($res))
  145. {
  146. extract($cur, 3, "db");
  147. $dt = format_date($db_posted);
  148. if ($first_style == "first")
  149. {
  150. $first_style = "color: maroon; font-weight:bold;
  151. ";
  152. }
  153. $on_click = "popupPrintWindow(\"" . base_path() . "/comments/popup-display-comment&id=$db_id\");";
  154. $rtn .= "<tr $on_mouse_over style='cursor:pointer; $first_style $extra_style'
  155. onClick='$on_click'>
  156. <td valign='top' width='165' class='tenpt'
  157. style='padding-left: 20px;'>
  158. " . fp_get_faculty_name($db_faculty_id, false) . "
  159. </td>
  160. <td valign='top' class='tenpt'>
  161. $dt$ast
  162. </td>
  163. </tr>";
  164. $is_empty = false;
  165. $first_style = "";
  166. }
  167. if ($is_empty == true) {
  168. $rtn .= "<tr><td colspan='4' class='tenpt'>
  169. <div style='padding-left: 20px;'>
  170. " . t("No @cat_type comment history available.", array("@cat_type" => $cat_type)) . "</div></td></tr>";
  171. }
  172. $rtn .= "</table>";
  173. $rtn .= "</td></tr>";
  174. $rtn .= "</table>";
  175. return $rtn;
  176. }
  177. /**
  178. * Displays the printable advising summary.
  179. */
  180. function advise_popup_display_summary() {
  181. $rtn = "";
  182. $db = get_global_database_handler();
  183. $advising_session_id = trim($_REQUEST["advising_session_id"]);
  184. $res = db_query("SELECT * FROM advising_sessions
  185. WHERE advising_session_id = '?' ", $advising_session_id);
  186. if (db_num_rows($res) > 0) {
  187. $cur = $db->db_fetch_array($res);
  188. extract($cur, 3, "db");
  189. }
  190. $dt = format_date($db_posted, "pretty");
  191. $term = get_term_description($db_term_id);
  192. $degree_plan = new DegreePlan();
  193. $degree_plan->degree_id = $db_degree_id;
  194. $degree_plan->load_descriptive_data();
  195. $degree_title = $degree_plan->get_title(true);
  196. $student = new Student($db_student_id, $db);
  197. $what_if_message = "";
  198. if ($db_is_whatif == "1") {
  199. $official_degree_plan = $student->get_degree_plan(false, true);
  200. $official_degree_plan->load_descriptive_data();
  201. $official_degree_title = $official_degree_plan->get_title(true);
  202. $what_if_message = "<b>" . t("Note:") . "</b>
  203. " . t("This advising was saved using <b>What If</b> mode
  204. for the %degree_title major. According to @initials records,
  205. the student's official major is %official.", array("%degree_title" => $degree_title, "@initials" => $GLOBALS["fp_system_settings"]["school_initials"], "%official" => $official_degree_title));
  206. }
  207. $page_is_mobile = fp_screen_is_mobile();
  208. $w = ($page_is_mobile) ? "100%" : "500";
  209. $rtn .= "<table width='$w'><td valign='top'>";
  210. if ($page_is_mobile) {
  211. }
  212. else {
  213. $rtn .= "
  214. <table class='tenpt' border='0' width='100%' cellpadding='3' cellspacing='0' style='border-width: 2px; border-style: solid; border-color: black;'>
  215. <tr height='7'>
  216. <td> </td>
  217. </tr>
  218. <tr>
  219. <td valign='top' width='15%'>" . t("Student:") . "</td>
  220. <td valign='top' width='40%'>" . $db->get_student_name($db_student_id, false) . " ($db_student_id)</td>
  221. <td valign='top' rowspan='3'>
  222. <table width='100%' cellpadding='0' cellspacing='0'>
  223. <tr height='20'>
  224. <td width='100%' valign='bottom'><hr noshade size='1' width='100%' color='black' style='margin: 0px;'></td>
  225. </tr>
  226. <tr height='20'>
  227. <td width='100%' valign='top' align='right'><span style='font-size: 8pt;'>" . t("Student signature") . "</span></td>
  228. </tr>
  229. <tr height='20'>
  230. <td width='100%' valign='bottom'><hr noshade size='1' width='100%' color='black' style='margin: 0px;'></td>
  231. </tr>
  232. <tr>
  233. <td width='100%' valign='bottom' align='right'><span style='font-size: 8pt;'>" . t("Advisor signature") . "</span></td>
  234. </tr>
  235. <tr height='7'>
  236. <td> </td>
  237. </tr>
  238. </table> ";
  239. }
  240. $rtn .= "
  241. </td>
  242. </tr>
  243. <tr>
  244. <td valign='top' width='10%'>" . t("Advisor:") . "</td>
  245. <td valign='top'>" . fp_get_faculty_name($db_faculty_id, false) . "</td>
  246. </tr>
  247. <tr>
  248. <td valign='top'>" . t("Term:") . "</td>
  249. <td valign='top'>$term</td>
  250. </tr>
  251. ";
  252. if (!$page_is_mobile) {
  253. $rtn .= "
  254. <tr>
  255. <td valign='top' colspan='2'>
  256. " . t("Alternate Term:") . " _____________________
  257. </td>
  258. </tr>";
  259. }
  260. $rtn .= "
  261. <tr>
  262. <td valign='top' colspan='4'>
  263. ";
  264. if ($degree_title != "")
  265. {
  266. $rtn .= t("Major:") . " $degree_title";
  267. }
  268. $rtn .= "
  269. </tr>
  270. </table>
  271. <div class='tenpt'><i>" . t("Submitted on") . " $dt.</i></div>
  272. <div class='tenpt'>$what_if_message</div>
  273. <br>
  274. ";
  275. $rtn .= fp_render_curved_line(t("Advised Courses"));
  276. $fp = new FlightPath($student,$degree_plan, $db);
  277. $fp->load_advising_session_from_database("","",false,false,$advising_session_id);
  278. $rtn .= "<table border='0' cellpadding='3'>
  279. <tr>
  280. <td class='tenpt' valign='top' width='25%'>
  281. <b>" . t("Course") . "</b>
  282. </td>
  283. <td class='tenpt' valign='top' width='70%'>
  284. <b>" . t("Title") . "</b>
  285. </td>
  286. <td class='tenpt' valign='top'>
  287. <b>" . t("Hours") . "</b>
  288. </td>
  289. </tr>";
  290. // Get a courseList of all the courses which are set as advised to take.
  291. $advised_courses_list = $fp->course_list_advised_courses;
  292. $advised_courses_list->load_course_descriptive_data();
  293. $advised_courses_list->sort_alphabetical_order();
  294. $advised_courses_list->reset_counter();
  295. while ($advised_courses_list->has_more()) {
  296. $course = $advised_courses_list->get_next();
  297. // set the catalogYear from the term_id.
  298. $course->term_id = $db_term_id;
  299. $course->set_catalog_year_from_term_id();
  300. $course->load_descriptive_data(false);
  301. $rtn .= "<tr>
  302. <td class='tenpt' valign='top'>
  303. $course->subject_id $course->course_num
  304. </td>
  305. <td class='tenpt' valign='top'>
  306. $course->title
  307. </td>
  308. <td class='tenpt' valign='top' align='center'>
  309. " . $course->get_hours() . "
  310. </td>
  311. </tr>
  312. ";
  313. }
  314. $rtn .= "</table>
  315. <div align='right' class='tenpt' style='padding-top: 10px; padding-right: 15px;'>
  316. <b>" . t("Total advised hours:") . " &nbsp; " . $advised_courses_list->count_hours() . "</b>
  317. </div>
  318. ";
  319. if (!$page_is_mobile) {
  320. $rtn .= "<br>";
  321. $rtn .= fp_render_curved_line(t("Alternate Courses"));
  322. $rtn .= "<div class='tenpt'>
  323. " . t("You may use this space to write in alternate courses
  324. the student should enroll in, in the event that an
  325. advised course is full or unavailable.") . "
  326. <br><br>
  327. ___________________________________________________________________ <br><br>
  328. ___________________________________________________________________
  329. </div> ";
  330. }
  331. $rtn .= "</table>";
  332. fp_set_title($db->get_student_name($db_student_id, FALSE) . " ($db_student_id) $term " . t("Advising Summary"));
  333. return $rtn;
  334. }

Functions

Namesort descending Description
advise_display_history Displays the history tab on screen.
advise_popup_display_summary Displays the printable advising summary.