advise.module

  1. 6.x modules/advise/advise.module
  2. 4.x modules/advise/advise.module
  3. 5.x modules/advise/advise.module

File

modules/advise/advise.module
View source
  1. <?php
  2. function advise_menu() {
  3. $items = array();
  4. $items["admin-tools/toggle-draft"] = array(
  5. "title" => "Toggle Draft Mode",
  6. "page_callback" => "fp_render_form",
  7. "page_arguments" => array("advise_toggle_draft_form"),
  8. "access_arguments" => array("toggle_draft"),
  9. "page_settings" => array(
  10. "menu_links" => array(
  11. 0 => array(
  12. "text" => "Back to Main",
  13. "path" => "main",
  14. ),
  15. ),
  16. ),
  17. "type" => MENU_TYPE_TAB,
  18. "tab_parent" => "main",
  19. );
  20. $items["admin-tools/clear-advising-cache"] = array(
  21. "title" => "Clear advising cache",
  22. "page_callback" => "advise_perform_clear_advising_cache",
  23. "access_arguments" => array("toggle_draft"),
  24. "type" => MENU_TYPE_NORMAL_ITEM,
  25. );
  26. $items["view"] = array(
  27. "title" => "View",
  28. "page_callback" => "advise_display_view",
  29. "page_arguments" => array("view"),
  30. "access_callback" => "advise_can_access_view",
  31. "tab_family" => "system",
  32. "page_settings" => array (
  33. "display_currently_advising" => TRUE,
  34. "display_greeting" => TRUE,
  35. "page_has_search" => TRUE,
  36. ),
  37. "weight" => 30,
  38. "type" => MENU_TYPE_TAB,
  39. );
  40. $items["view/print"] = array(
  41. "title" => "View",
  42. "page_callback" => "advise_display_view",
  43. "page_arguments" => array("view"),
  44. "access_callback" => TRUE,
  45. "page_settings" => array (
  46. "display_currently_advising" => TRUE,
  47. "bool_print" => TRUE,
  48. "screen_mode" => "not_advising",
  49. ),
  50. "type" => MENU_TYPE_CALLBACK,
  51. );
  52. $items["what-if"] = array(
  53. "title" => "What If?",
  54. "page_callback" => "advise_display_view",
  55. "page_arguments" => array("what-if"),
  56. "access_callback" => "advise_can_access_view",
  57. "tab_family" => "system",
  58. "page_settings" => array (
  59. "display_currently_advising" => TRUE,
  60. "display_greeting" => TRUE,
  61. "page_has_search" => TRUE,
  62. ),
  63. "weight" => 60,
  64. "type" => MENU_TYPE_TAB,
  65. );
  66. $items["what-if/print"] = array(
  67. "title" => "What If?",
  68. "page_callback" => "advise_display_view",
  69. "page_arguments" => array("what-if"),
  70. "access_callback" => TRUE,
  71. "page_settings" => array (
  72. "display_currently_advising" => TRUE,
  73. "bool_print" => TRUE,
  74. "screen_mode" => "not_advising",
  75. ),
  76. "type" => MENU_TYPE_CALLBACK,
  77. );
  78. $items["history"] = array(
  79. "title" => "History",
  80. "page_callback" => "advise_display_history",
  81. "access_callback" => "advise_can_access_view",
  82. "tab_family" => "system",
  83. "page_settings" => array (
  84. "display_currently_advising" => TRUE,
  85. "display_greeting" => TRUE,
  86. "page_has_search" => TRUE,
  87. ),
  88. "weight" => 40,
  89. "type" => MENU_TYPE_TAB,
  90. "file" => menu_get_module_path("advise") . "/advise.history.inc",
  91. );
  92. // My popups....
  93. $items["advise/popup-display-summary"] = array(
  94. "title" => "Advising Summary",
  95. "page_callback" => "advise_popup_display_summary",
  96. "access_callback" => "advise_user_can_view_advising_session_access_callback",
  97. "page_settings" => array(
  98. "page_is_popup" => TRUE,
  99. "page_hide_report_error" => TRUE,
  100. "bool_print" => TRUE,
  101. ),
  102. "type" => MENU_TYPE_CALLBACK,
  103. "file" => menu_get_module_path("advise") . "/advise.history.inc",
  104. );
  105. $items["advise/popup-change-term"] = array(
  106. "title" => "Change advising term",
  107. "page_callback" => "advise_display_popup_change_term",
  108. "access_arguments" => array("can_advise_students"),
  109. "page_settings" => array(
  110. "page_is_popup" => TRUE,
  111. "page_hide_report_error" => TRUE,
  112. ),
  113. "type" => MENU_TYPE_CALLBACK,
  114. );
  115. $items["advise/popup-change-track"] = array(
  116. "title" => "Change advising track",
  117. "page_callback" => "advise_display_popup_change_track",
  118. "access_arguments" => array("access_logged_in_content"),
  119. "page_settings" => array(
  120. "page_is_popup" => TRUE,
  121. "page_hide_report_error" => TRUE,
  122. ),
  123. "type" => MENU_TYPE_CALLBACK,
  124. );
  125. $items["advise/popup-course-description"] = array(
  126. "title" => "Description",
  127. "page_callback" => "advise_display_popup_course_description",
  128. "access_callback" => TRUE,
  129. "page_settings" => array(
  130. "page_is_popup" => TRUE,
  131. "page_hide_report_error" => TRUE,
  132. ),
  133. "weight" => 10,
  134. );
  135. $items["advise/popup-substitute-selected"] = array(
  136. "title" => "Substitute",
  137. "page_callback" => "advise_display_popup_substitute_selected",
  138. "access_arguments" => array("can_substitute"),
  139. "page_settings" => array(
  140. "page_is_popup" => TRUE,
  141. "page_hide_report_error" => TRUE,
  142. ),
  143. "weight" => 10,
  144. );
  145. $items["advise/popup-group-select"] = array(
  146. "title" => "Select",
  147. "page_callback" => "advise_display_popup_group_select",
  148. "access_callback" => TRUE,
  149. "page_settings" => array(
  150. "page_is_popup" => TRUE,
  151. "page_hide_report_error" => TRUE,
  152. ),
  153. "weight" => 10,
  154. );
  155. // Toolbox...
  156. $items["advise/popup-toolbox/transfers"] = array(
  157. "title" => "Transfers",
  158. "page_callback" => "advise_display_popup_toolbox_transfers",
  159. "access_arguments" => array("can_substitute"),
  160. "page_settings" => array(
  161. "page_is_popup" => TRUE,
  162. "page_hide_report_error" => TRUE,
  163. ),
  164. "weight" => 10,
  165. "type" => MENU_TYPE_TAB,
  166. "tab_family" => "advise-toolbox",
  167. "file" => menu_get_module_path("advise") . "/advise.toolbox.inc",
  168. );
  169. $items["advise/popup-toolbox/substitutions"] = array(
  170. "title" => "Substitutions",
  171. "page_callback" => "advise_display_popup_toolbox_substitutions",
  172. "access_arguments" => array("can_substitute"),
  173. "page_settings" => array(
  174. "page_is_popup" => TRUE,
  175. "page_hide_report_error" => TRUE,
  176. ),
  177. "weight" => 20,
  178. "type" => MENU_TYPE_TAB,
  179. "tab_family" => "advise-toolbox",
  180. "file" => menu_get_module_path("advise") . "/advise.toolbox.inc",
  181. );
  182. $items["advise/popup-toolbox/moved"] = array(
  183. "title" => "Moved",
  184. "page_callback" => "advise_display_popup_toolbox_moved",
  185. "access_arguments" => array("can_substitute"),
  186. "page_settings" => array(
  187. "page_is_popup" => TRUE,
  188. "page_hide_report_error" => TRUE,
  189. ),
  190. "weight" => 30,
  191. "type" => MENU_TYPE_TAB,
  192. "tab_family" => "advise-toolbox",
  193. "file" => menu_get_module_path("advise") . "/advise.toolbox.inc",
  194. );
  195. $items["advise/popup-toolbox/courses"] = array(
  196. "title" => "Courses",
  197. "page_callback" => "advise_display_popup_toolbox_courses",
  198. "access_arguments" => array("can_substitute"),
  199. "page_settings" => array(
  200. "page_is_popup" => TRUE,
  201. "page_hide_report_error" => TRUE,
  202. ),
  203. "weight" => 40,
  204. "type" => MENU_TYPE_TAB,
  205. "tab_family" => "advise-toolbox",
  206. "file" => menu_get_module_path("advise") . "/advise.toolbox.inc",
  207. );
  208. return $items;
  209. }
  210. /**
  211. * Used by the menu to determine if the user can see the View tab.
  212. */
  213. function advise_can_access_view() {
  214. global $current_student_id, $user;
  215. // must be logged in first...
  216. if (!user_has_permission("access_logged_in_content")) return FALSE;
  217. if ($current_student_id != "") return TRUE;
  218. return FALSE;
  219. }
  220. function advise_toggle_draft_form() {
  221. $form = array();
  222. $form["mark" . $m++] = array(
  223. "value" => "<p>" . t("By turning Draft Mode on, you will be able
  224. to view degree plans which are still in 'Draft' mode
  225. in both the regular View tab, as well as the Blank Degrees module,
  226. if enabled.") . "</p>",
  227. );
  228. $form["draft"] = array(
  229. "type" => "radios",
  230. "label" => t("Enable Draft Mode?"),
  231. "options" => array("yes" => t("Yes"), "no" => t("No")),
  232. "value" => $_SESSION["fp_draft_mode"],
  233. );
  234. $form["submit"] = array(
  235. "type" => "submit",
  236. "value" => t("Submit"),
  237. "prefix" => "<hr>",
  238. );
  239. $form["#redirect"] = array(
  240. "path" => "main",
  241. "query" => "",
  242. );
  243. return $form;
  244. }
  245. function advise_toggle_draft_form_submit($form, $form_state) {
  246. fp_add_message(t("Draft mode successfully updated."));
  247. $_SESSION["fp_draft_mode"] = $form_state["values"]["draft"];
  248. }
  249. /**
  250. * Lets the user change the track for this major.
  251. */
  252. function advise_display_popup_change_track() {
  253. global $degree_plan, $student;
  254. $rtn = "";
  255. advise_init_screen();
  256. fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  257. $degree_plan->load_descriptive_data();
  258. $rtn .= fp_render_curved_line(t("Select a Degree Option"));
  259. $rtn .= "<div class='tenpt'>
  260. " . t("This major has one or more degree options, which affects which courses are required.
  261. Please select a degree option (or track) from the list below.") . "
  262. <br><br>
  263. " . t("If you are unsure of what to do, simply close this window.");
  264. $rtn .= "<br><br><b>" . $degree_plan->title . "</b> " . t("degree options:") . "</div><!--DEFAULT-->
  265. <ul>";
  266. // Get the list of available tracks for this student.
  267. if (!$tracks = $degree_plan->get_available_tracks())
  268. {
  269. $rtn .= "<li>" . t("This major has no degree options.") . "</li>";
  270. }
  271. // Is there a "default" message for all tracks, which will override
  272. // any other track descriptions?
  273. // We need to look through all the tracks for the
  274. // characters: "DEFAULT:"
  275. // If we find this, then this is the default description
  276. // which applies to all the tracks, and it should be displayed
  277. // at the top.
  278. $bool_default_description = false;
  279. for ($t = 0; $t < count($tracks); $t++)
  280. {
  281. $temp = explode(" ~~ ", $tracks[$t]);
  282. $track_code = trim($temp[0]);
  283. $track_title = trim($temp[1]);
  284. $track_description = trim($temp[2]);
  285. if (strstr($track_description, "DEFAULT:")) {
  286. // Yes! We found a default message.
  287. $bool_default_description = true;
  288. $track_description = filter_markup(trim(str_replace("DEFAULT:", "", $track_description)));
  289. $track_description = "<div style='padding-top: 10px;' class='tenpt'>$track_description</div>";
  290. $rtn = str_replace("<!--DEFAULT-->",$track_description, $rtn);
  291. break;
  292. }
  293. }
  294. for ($t = 0; $t < count($tracks); $t++)
  295. {
  296. $temp = explode(" ~~ ", $tracks[$t]);
  297. $track_code = trim($temp[0]);
  298. $track_title = trim($temp[1]);
  299. $track_description = "";
  300. // If this is the current track_code, mark it as such.
  301. if ($student->array_settings["track_code"] == $track_code
  302. && $student->array_settings["major_code"] == $degree_plan->major_code)
  303. {
  304. $track_title .= " <b>(" . t("current") . ")</b>";
  305. }
  306. if ($bool_default_description == false)
  307. {
  308. $track_description = filter_markup(trim($temp[2]));
  309. if ($track_description != "")
  310. {
  311. $track_description = " - $track_description";
  312. }
  313. }
  314. $temp_tc = $track_code;
  315. if ($temp_tc == "")
  316. {
  317. $temp_tc = "none";
  318. }
  319. $link = fp_get_js_confirm_link(t("Are you sure you wish to change degree options?"), "opener.changeTrack(\"$temp_tc\"); window.close(); ", $track_title);
  320. if ($GLOBALS["fp_advising"]["advising_what_if"] == "yes") {
  321. $link = "<a href='javascript: popupChangeWhatIfTrack(\"$temp_tc\", \"" . t("Are you sure you wish to change degree options?") . "\");'>$track_title</a>";
  322. }
  323. $rtn .= "<li class='tenpt' style='padding:3px;'>
  324. $link $track_description</li>";
  325. }
  326. $rtn .= "</ul>";
  327. return $rtn;
  328. }
  329. /**
  330. * This popup allows the advisor to change the advising term.
  331. */
  332. function advise_display_popup_change_term() {
  333. $rtn = "";
  334. fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  335. $current_term_id = $_REQUEST["advising_term_id"];
  336. $current_term = get_term_description($current_term_id);
  337. $rtn .= fp_render_curved_line(t("Select an Advising Term"));
  338. $rtn .= "<div>
  339. " . t("You may advise this student for future semesters. Please select which
  340. advising term you would like to advise for from the list below. If you
  341. are unsure, simply close this window and continue to advise for the current
  342. term of %current_term.", array("%current_term" => $current_term)) . "
  343. </div>";
  344. $rtn .= "<ul>";
  345. $temp = explode(",", variable_get("available_advising_term_ids", "0"));
  346. for ($t = 0; $t < count($temp); $t++) {
  347. $term_id = trim($temp[$t]);
  348. $term_desc = get_term_description($term_id);
  349. if ($term_id == $current_term_id) {
  350. $term_desc = "<b>$term_desc</b> - " . t("current");
  351. }
  352. $link = fp_get_js_confirm_link(t("Are you sure you wish to change advising terms?"), "opener.changeTerm(\"$term_id\"); window.close(); ", $term_desc);
  353. $rtn .= "<li class='tenpt' style='padding:3px;'>$link</li>";
  354. }
  355. $rtn .= "</ul>";
  356. return $rtn;
  357. }
  358. /**
  359. * This is an access callback. Can the user view the advising session specified
  360. * in the REQUEST?
  361. */
  362. function advise_user_can_view_advising_session_access_callback() {
  363. global $user;
  364. if (user_has_permission("view_any_advising_session")) {
  365. return TRUE;
  366. }
  367. if (user_has_permission("view_own_advising_session")) {
  368. // The user is only allowed to view their OWN advising sessions.
  369. // So, make sure this advising session belongs to them!
  370. $advising_session_id = $_REQUEST["advising_session_id"];
  371. // make sure this belongs to $user->cwid;
  372. // First, what was the student's CWID associated with that advising_session_id?
  373. $res = db_query("SELECT student_id FROM advising_sessions
  374. WHERE advising_session_id = '?' ", $advising_session_id);
  375. $cur = db_fetch_array($res);
  376. if ($user->cwid == $cur["student_id"]) {
  377. return TRUE;
  378. }
  379. }
  380. return FALSE;
  381. }
  382. function advise_display_popup_group_select() {
  383. global $current_student_id, $fp, $screen, $degree_plan;
  384. $rtn = "";
  385. advise_init_screen();
  386. fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  387. $settings = fp_get_system_settings();
  388. $blank_degree_id = trim($_GET["blank_degree_id"]);
  389. $course_id = trim($_GET["course_id"]);
  390. $group_id = trim(addslashes($_GET["group_id"]));
  391. $group_hours_remaining = trim(addslashes($_GET["group_hours_remaining"]));
  392. $semester_num = trim(addslashes($_GET["semester_num"]));
  393. $perform_action2 = $_REQUEST["perform_action2"];
  394. // If this is a "blank" degree, make sure we set the degree_id correctly.
  395. if($blank_degree_id != "") {
  396. $degree_plan = new DegreePlan($blank_degree_id);
  397. $fp->degree_plan = $degree_plan;
  398. $screen->degree_plan = $degree_plan;
  399. $screen->bool_blank = TRUE;
  400. }
  401. if (!$group = $degree_plan->find_placeholder_group($group_id, $semester_num)) {
  402. fpm("Could not find group $group_id in semester $semester_num.");
  403. }
  404. if ($group_id == -88) {
  405. // This is the Add a Course group. We must initialize it, as it
  406. // does not exist yet.
  407. // We need to populate this group now.
  408. $group->list_courses = $fp->get_all_courses_in_catalog_year($settings["current_catalog_year"]);
  409. $group->title = "Add an Additional Course";
  410. $group->list_courses->assign_group_id($group_id);
  411. $group->list_courses->load_course_descriptive_data();
  412. }
  413. if ($course_id != "") {
  414. // Meaning, a course_id was specified, so make sure
  415. // it is "selected" inside the group and branches.
  416. $course = new Course();
  417. $course->course_id = $course_id;
  418. $temp_course_list = $group->find_courses($course);
  419. if (!$temp_course_list) {
  420. $temp_course_list = $degree_plan->find_courses($course_id, $group_id, $semester_num);
  421. }
  422. if ($temp_course_list) {
  423. $temp_course_list->reset_counter();
  424. while($temp_course_list->has_more()) {
  425. $temp_course = $temp_course_list->get_next();
  426. $temp_course->bool_selected = true;
  427. //$temp_course->assigned_to_semester_num = $semester_num;
  428. }
  429. }
  430. }
  431. if ($perform_action2 == "" || $perform_action2 == "select") {
  432. if ($group) {
  433. $rtn .= $screen->display_popup_group_select($group, $group_hours_remaining);
  434. }
  435. // Create the tabs for the page...
  436. $tab_array = array();
  437. $tab_array[0]["title"] = "Description";
  438. $tab_array[0]["on_click"] = "popupDescribeSelected(\"$group_id\",\"$semester_num\",\"0\",\"\",\"group_hours_remaining=$group_hours_remaining&blank_degree_id=$blank_degree_id\");";
  439. $tab_array[1]["title"] = "Select";
  440. $tab_array[1]["active"] = true;
  441. // If we are allowed to substitute....
  442. if (user_has_permission("can_substitute") && $group_id != -88 && !$screen->bool_blank) {
  443. $tab_array[2]["title"] = "Substitute";
  444. $tab_array[2]["on_click"] = "popupSubstituteSelected(\"0\",\"$group_id\",\"$semester_num\",\"group_hours_remaining=$group_hours_remaining\");";
  445. }
  446. }
  447. if ($perform_action2 == "describe_course") {
  448. $rtn .= $screen->display_popup_course_description($course_id,null,$group, true);
  449. // Create the tabs for the page...
  450. $tab_array = array();
  451. $tab_array[0]["title"] = "Description";
  452. $tab_array[0]["active"] = true;
  453. $tab_array[1]["title"] = "Select";
  454. $subject = trim($_GET["selected_subject"]);
  455. $tab_array[1]["on_click"] = "popupBackToGroupSelect(\"$course_id\",\"$group_id\",\"$semester_num\",\"selected_subject=$subject&group_hours_remaining=$group_hours_remaining&blank_degree_id=$blank_degree_id\");";
  456. // If we are allowed to substitute....
  457. if (user_has_permission("can_substitute") && $group_id != -88 && !$screen->bool_blank) {
  458. $tab_array[2]["title"] = "Substitute";
  459. $tab_array[2]["on_click"] = "popupSubstituteSelected(\"$course_id\",\"$group_id\",\"$semester_num\",\"group_hours_remaining=$group_hours_remaining\");";
  460. }
  461. }
  462. if ($tab_array) {
  463. fp_set_page_tabs($tab_array);
  464. }
  465. return $rtn;
  466. }
  467. function advise_display_popup_substitute_selected() {
  468. global $current_student_id, $fp, $screen;
  469. $rtn = "";
  470. advise_init_screen();
  471. fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  472. $sub_decimals_allowed = variable_get("sub_hours_decimals_allowed", 2);
  473. // Add our allowed substitution decimals as a js setting for later use.
  474. fp_add_js(array("subDecimalsAllowed" => $sub_decimals_allowed), "setting");
  475. $course_id = trim($_GET["course_id"]);
  476. $group_id = trim(addslashes($_GET["group_id"]));
  477. $semester_num = trim(addslashes($_GET["semester_num"]));
  478. $group_hours_remaining = trim(addslashes($_GET["group_hours_remaining"]));
  479. $rtn .= $screen->display_popup_substitute($course_id, $group_id, $semester_num, $group_hours_remaining);
  480. return $rtn;
  481. }
  482. function advise_display_popup_course_description() {
  483. global $current_student_id, $screen;
  484. $rtn = "";
  485. advise_init_screen();
  486. fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  487. $data_string = trim($_GET["data_string"]);
  488. $course = new Course();
  489. if ($data_string != "")
  490. {
  491. $course->load_course_from_data_string($data_string);
  492. }
  493. $rtn .= $screen->display_popup_course_description("", $course);
  494. // Create the tabs for the page...
  495. $tab_array = array();
  496. $tab_array[0]["title"] = "Description";
  497. $tab_array[0]["active"] = true;
  498. if (user_has_permission("can_substitute") && !$screen->bool_blank) {
  499. if ($course->bool_substitution != true && $course->grade == "") {
  500. // By checking grade, we are making sure this course has NOT already
  501. // been taken by the student. In other words, verify that this course
  502. // is an unfulfilled requirement on the degree plan ONLY.
  503. $extra_vars = "hours_avail=$course->max_hours";
  504. $tab_array[1]["title"] = "Substitute";
  505. $tab_array[1]["on_click"] = "popupSubstituteSelected(\"$course->course_id\",\"$course->assigned_to_group_id\",\"$course->assigned_to_semester_num\",\"$extra_vars\");";
  506. // I WAS WRONG!!!!!
  507. // I don't see any reason to make this a javascript function. I'm going to make it a simple URL link.
  508. // window.location = "' . $script_filename . '?windowMode=popup&performAction=substituteSelected&course_id=" + course_id + "&group_id=" + group_id + "&semester_num=" + semester_num + "&current_student_id=" + csid + "&" + extraVars;
  509. //$tab_array[1]["on_click"] = "window.location = \"" . base_path() . "/advise/popup-substitute-selected&window_mode=popup&course_id=$course->course_id&group_id=$course->assigned_to_group_id&semester_num=$course->assigned_to_semester_num&current_student_id=$current_student_id&hours_avail=$course->max_hours\"";
  510. }
  511. }
  512. fp_set_page_tabs($tab_array);
  513. //$screen->page_tabs = $screen->draw_tabs($tab_array);
  514. return $rtn;
  515. }
  516. /**
  517. * Implementation of hook_perm
  518. */
  519. function advise_perm() {
  520. $perms = array();
  521. $perms["view_any_advising_session"] = array(
  522. "title" => t("View any advising session"),
  523. "description" => t("The user is allowed to view any advising sessions for any user.
  524. For example, the user is an advisor."),
  525. );
  526. $perms["view_own_advising_session"] = array(
  527. "title" => t("View own advising session"),
  528. "description" => t("The user is allowed to view their own advising sessions.
  529. For example, the user is a student."),
  530. );
  531. $perms["can_advise_students"] = array(
  532. "title" => t("Can advise students"),
  533. "description" => t("The user is allowed to advise other students,
  534. by clicking a checkbox next to a course, or by selecting
  535. a course from an elective group."),
  536. );
  537. $perms["can_substitute"] = array(
  538. "title" => t("Can substitute"),
  539. "description" => t("The user is allowed to substitute courses on a student's
  540. degree plan."),
  541. );
  542. $perms["toggle_draft"] = array(
  543. "title" => t("Toggle draft mode"),
  544. "description" => t("The user toggle 'draft' mode, so they can view draft degree plans
  545. in FlightPath."),
  546. );
  547. return $perms;
  548. }
  549. /**
  550. * This is the page which actually displays the "view" for the user
  551. * to see their advising session, or for an advisor to advise them.
  552. *
  553. */
  554. function advise_display_view($view = "view") {
  555. global $user, $fp, $degree_plan, $screen;
  556. $rtn = "";
  557. if ($view == "what-if") {
  558. $GLOBALS["fp_advising"]["advising_what_if"] = "yes";
  559. $_REQUEST["advising_what_if"] = "yes";
  560. }
  561. else {
  562. $GLOBALS["fp_advising"]["advising_what_if"] = "no";
  563. $_REQUEST["advising_what_if"] = "no";
  564. }
  565. // Initialize everything we need to initialize for this advising session.
  566. advise_init_screen();
  567. fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  568. // If we are on a print screen, we need to go out of our
  569. // way to set the screen mode, so we don't display certain things
  570. // when we go to draw the screen.
  571. if (strstr($_REQUEST["q"], "/print")) {
  572. $screen->bool_print = TRUE;
  573. $screen->screen_mode = "not_advising";
  574. }
  575. if ($GLOBALS["fp_advising"]["advising_what_if"] == "yes" && $GLOBALS["fp_advising"]["what_if_major_code"] == "") {
  576. // We are in WhatIf, but we have not selected a major, so give
  577. // the user a selection screen.
  578. $screen->screen_mode = "not_advising";
  579. $rtn .= advise_display_what_if_selection();
  580. }
  581. else {
  582. // This is a normal advising screen. Either View or WhatIf.
  583. //$page_content .= $screen->display_view_options();
  584. $screen->build_screen_elements();
  585. $form_token = md5("advise_display_view" . fp_token());
  586. $rtn .= "<form id='mainform' method='POST' action='" . base_path() . "/$view'>
  587. <input type='hidden' name='form_token' value='$form_token'>
  588. <table class='fp-semester-table'>";
  589. $rtn .= $screen->display_screen();
  590. $rtn .= "</table>";
  591. // Add in the required "advising variables"
  592. $rtn .= $screen->get_hidden_advising_variables("save_draft");
  593. $rtn .= "</form>";
  594. // Figure out what the page's sub-tabs should be, and set them.
  595. $tab_array = array();
  596. $tab_array[0]["title"] = "Display by Year";
  597. $tab_array[0]["active"] = ($screen->view != "type");
  598. $tab_array[0]["on_click"] = "changeView(\"year\");";
  599. $tab_array[1]["title"] = "Display by Type";
  600. $tab_array[1]["active"] = ($screen->view == "type");
  601. $tab_array[1]["on_click"] = "changeView(\"type\");";
  602. if (!fp_screen_is_mobile()) {
  603. $tab_array[2]["title"] = "Print";
  604. $tab_array[2]["type"] = "link";
  605. $tab_array[2]["active"] = FALSE;
  606. $tab_array[2]["on_click"] = "popupPrintWindow(\"" . base_path() . "/$view/print&advising_view=$screen->view\");";
  607. }
  608. fp_set_page_sub_tabs($tab_array);
  609. watchdog("view_by_$screen->view", "", array(), WATCHDOG_DEBUG);
  610. }
  611. // If we are in WhatIf mode, let's write something special to
  612. // the log.
  613. if ($GLOBALS["fp_advising"]["advising_what_if"] == "yes" && $GLOBALS["fp_advising"]["what_if_major_code"] != "")
  614. {
  615. $log_action .= "_whatif";
  616. $log_extra = $GLOBALS["fp_advising"]["what_if_major_code"] . " " . $GLOBALS["fp_advising"]["what_if_track_code"];
  617. }
  618. // print_pre($student->list_courses_taken->toString());
  619. // Should we re-cache the course inventory? If there have been any changes
  620. // to it, then we will see that in a GLOBALS variable...
  621. if ($GLOBALS["cache_course_inventory"] == true)
  622. {
  623. $_SESSION["fp_cache_course_inventory"] = serialize($GLOBALS["fp_course_inventory"]);
  624. }
  625. return $rtn;
  626. }
  627. /**
  628. * Displays the pulldown select list for picking a new What If degree.
  629. * Returns HTML.
  630. *
  631. * @return string
  632. */
  633. function advise_display_what_if_selection($bool_undergrad_only = TRUE) {
  634. global $screen, $current_student_id;
  635. $rtn = "";
  636. if ($screen->bool_print) {
  637. return "";
  638. }
  639. $db = get_global_database_handler();
  640. $rtn .= "<form action='" . base_path() . "/what-if' id='mainform' method='POST'>";
  641. $rtn .= fp_render_curved_line("What if I change my major to...");
  642. $rtn .= "<br>
  643. Major: <select name='what_if_major_code' class='what-if-selector'>
  644. <option value=''>Please select a major</option>
  645. <option value=''>------------------------------</option>\n
  646. ";
  647. $settings = fp_get_system_settings();
  648. $current_catalog_year = $settings["current_catalog_year"];
  649. //$bool_use_draft = $GLOBALS["fp_advising"]["bool_use_draft"];
  650. $bool_use_draft = FALSE; // leave as false for now. Because you can't select
  651. // degree options, and if you click submit it really does
  652. // save it. Better to just use blank degrees.
  653. if ($degree_array = $db->get_degrees_in_catalog_year($current_catalog_year, false, $bool_use_draft, $bool_undergrad_only)) {
  654. foreach($degree_array as $major_code => $value) {
  655. if (trim($value["title"]) == ""){continue;}
  656. $rtn .= "<option value='$major_code'>{$value["title"]}</option> \n";
  657. }
  658. }
  659. $rtn .= "</select>
  660. <br><br>";
  661. $rtn .= "
  662. <div align='right'>
  663. " . fp_render_button("Try It Out!", "showUpdate(true);submitForm();") . "
  664. </div>
  665. <br><br>
  666. <div class='hypo tenpt'>
  667. <b>Important Notice:</b> What If displays degree plans
  668. from the most recent catalog year ($current_catalog_year-" . ($current_catalog_year + 1) . "),
  669. as any major change would place the student into the
  670. most recent catalog.
  671. </div>";
  672. // Include only certain variables, so we don't overwrite our selection of what_if_major_code.
  673. $rtn .= "
  674. <input type='hidden' name='load_from_cache' value='no'>
  675. <input type='hidden' name='window_mode' value='screen'>
  676. <input type='hidden' id='scroll_top'>
  677. <input type='hidden' id='perform_action' name='perform_action'>
  678. <input type='hidden' id='advising_what_if' name='advising_what_if' value='yes'>
  679. <input type='hidden' id='current_student_id' name='current_student_id' value='$current_student_id'>
  680. ";
  681. $rtn .= "</form>
  682. ";
  683. return $rtn;
  684. }
  685. /**
  686. * Takes various variables from the REQUEST and stores them in our advising_session_variables table for more convenient use later on.
  687. */
  688. function advise_init_advising_variables($bool_ignore_what_if_variables = FALSE) {
  689. global $user;
  690. $vars = array();
  691. $student = null;
  692. // The current student ID is what we append to all session variables
  693. // dealing with the current student. We do this so that we will
  694. // keep session variables unique, so that we can have more than one
  695. // window open at a time, with multiple students.
  696. // Therefor, this should never go into the session.
  697. // Annoyingly, we must pass carry this around on each page in the system.
  698. $vars["current_student_id"] = $_REQUEST["current_student_id"];
  699. if ($vars["current_student_id"] == "")
  700. {
  701. $vars["current_student_id"] = $_REQUEST["advising_student_id"];
  702. }
  703. $csid = $vars["current_student_id"];
  704. // Get the student ID.
  705. $vars["advising_student_id"] = $_REQUEST["advising_student_id"];
  706. if ($vars["advising_student_id"] == "")
  707. {
  708. $vars["advising_student_id"] = $_SESSION["advising_student_id$csid"];
  709. if ($vars["advising_student_id"] == "")
  710. { // Default value...
  711. $vars["advising_student_id"] = $csid;
  712. }
  713. }
  714. // Should we load from the Draft advising session? or the active?
  715. $vars["advising_load_active"] = $_REQUEST["advising_load_active"];
  716. if ($vars["advising_load_active"] == "")
  717. { // values will either be "yes" or "" (any other value than "yes" is
  718. // considered to be negative.
  719. // Default value...
  720. $vars["advising_load_active"] = "";
  721. }
  722. // Get the major_code.
  723. $vars["advising_major_code"] = $_REQUEST["advising_major_code"];
  724. if ($vars["advising_major_code"] == "")
  725. {
  726. $vars["advising_major_code"] = $_SESSION["advising_major_code$csid"];
  727. if ($vars["advising_major_code"] == "")
  728. { // Default value...
  729. if (!$student) $student = new Student($csid);
  730. $vars["advising_major_code"] = $student->major_code;
  731. }
  732. }
  733. // Get the track_code.
  734. $vars["advising_track_code"] = $_REQUEST["advising_track_code"];
  735. if ($vars["advising_track_code"] == "")
  736. {
  737. $vars["advising_track_code"] = $_SESSION["advising_track_code$csid"];
  738. if ($vars["advising_track_code"] == "")
  739. { // Default value...
  740. if (!$student) $student = new Student($csid);
  741. $vars["advising_track_code"] = $student->track_code;
  742. }
  743. }
  744. // Update the student's settings?
  745. $vars["advising_update_student_settings_flag"] = $_REQUEST["advising_update_student_settings_flag"];
  746. // Make it only come from the POST, for safety.
  747. if ($vars["advising_update_student_settings_flag"] == "")
  748. {
  749. $vars["advising_update_student_settings_flag"] = $_SESSION["advising_update_student_settings_flag$csid"];
  750. if ($vars["advising_update_student_settings_flag"] == "")
  751. { // Default value...
  752. }
  753. }
  754. // Update the logged-in user's settings?
  755. $vars["fp_update_user_settings_flag"] = $_REQUEST["fp_update_user_settings_flag"];
  756. // Make it only come from the POST, for safety.
  757. if ($vars["fp_update_user_settings_flag"] == "")
  758. {
  759. $vars["fp_update_user_settings_flag"] = $_SESSION["fp_update_user_settings_flag$csid"];
  760. if ($vars["fp_update_user_settings_flag"] == "")
  761. { // Default value...
  762. }
  763. }
  764. $settings = fp_get_system_settings();
  765. $vars["advising_term_id"] = $_REQUEST["advising_term_id"]; // Get it from the GET or POST.
  766. if ($vars["advising_term_id"] == "")
  767. {
  768. // Set to the default advising term.
  769. $vars["advising_term_id"] = $_SESSION["advising_term_id$csid"];
  770. if ($vars["advising_term_id"] == "")
  771. {
  772. // default value:
  773. $vars["advising_term_id"] = $settings["advising_term_id"];
  774. if ($vars["advising_term_id"] == "") {
  775. // It's STILL blank?! Just use 0 then.
  776. $vars["advising_term_id"] = "0";
  777. }
  778. }
  779. }
  780. // Are we currently in WhatIf mode?
  781. $vars["advising_what_if"] = $_REQUEST["advising_what_if"]; // Get it from the GET or POST.
  782. if ($vars["advising_what_if"] == "")
  783. {
  784. // Will equal "yes" if we ARE in whatIf mode.
  785. $vars["advising_what_if"] = $_SESSION["advising_what_if$csid"];
  786. if ($vars["advising_what_if"] == "")
  787. {
  788. // Default value:
  789. $vars["advising_what_if"] = "no";
  790. }
  791. }
  792. $vars["what_if_major_code"] = $_REQUEST["what_if_major_code"]; // Get it from the GET or POST.
  793. if ($vars["what_if_major_code"] == "")
  794. {
  795. // Will equal "yes" if we ARE in whatIf mode.
  796. $vars["what_if_major_code"] = $_SESSION["what_if_major_code$csid"];
  797. if ($vars["what_if_major_code"] == "")
  798. {
  799. // Default value:
  800. $vars["what_if_major_code"] = "";
  801. }
  802. }
  803. $vars["what_if_track_code"] = $_REQUEST["what_if_track_code"]; // Get it from the GET or POST.
  804. if ($vars["what_if_track_code"] == "")
  805. {
  806. // Will equal "yes" if we ARE in whatIf mode.
  807. $vars["what_if_track_code"] = $_SESSION["what_if_track_code$csid"];
  808. if ($vars["what_if_track_code"] == "")
  809. {
  810. // Default value:
  811. $vars["what_if_track_code"] = "";
  812. }
  813. }
  814. if ($vars["what_if_major_code"] == "none")
  815. {
  816. $vars["what_if_major_code"] = "";
  817. }
  818. if ($vars["what_if_track_code"] == "none")
  819. {
  820. $vars["what_if_track_code"] = "";
  821. }
  822. if ($vars["advising_track_code"] == "none")
  823. {
  824. $vars["advising_track_code"] = "";
  825. }
  826. // Settings... (from the database)
  827. $vars["setting_available_advising_term_ids"] = $settings["available_advising_term_ids"];
  828. $vars["setting_advising_term_id"] = $settings["advising_term_id"];
  829. $vars["setting_current_catalog_year"] = $settings["current_catalog_year"];
  830. $vars["setting_current_draft_catalog_year"] = $settings["current_draft_catalog_year"];
  831. // Are we in Print View?
  832. $vars["print_view"] = $_REQUEST["print_view"];
  833. // Should we try to load from the cache?
  834. $vars["load_from_cache"] = $_REQUEST["load_from_cache"];
  835. if ($vars["load_from_cache"] == "")
  836. {
  837. // By default, attempt to load from cache.
  838. $vars["load_from_cache"] = "yes";
  839. }
  840. // What "view" are we in? View by Year or by Type?
  841. // Not the same as printView. printView should work regardless
  842. // of our advising_view.
  843. $vars["advising_view"] = $_REQUEST["advising_view"];
  844. if ($vars["advising_view"] == "")
  845. {
  846. $vars["advising_view"] = $_SESSION["advising_view$csid"];
  847. }
  848. // Place values into session.
  849. $_SESSION["advising_student_id$csid"] = $vars["advising_student_id"];
  850. $_SESSION["advising_student_id"] = $vars["advising_student_id"]; // used ONLY in the error report popup!
  851. $_SESSION["advising_major_code$csid"] = $vars["advising_major_code"];
  852. $_SESSION["advising_track_code$csid"] = $vars["advising_track_code"];
  853. $_SESSION["advising_term_id$csid"] = $vars["advising_term_id"];
  854. $_SESSION["advising_what_if$csid"] = $vars["advising_what_if"];
  855. $_SESSION["what_if_major_code$csid"] = $vars["what_if_major_code"];
  856. $_SESSION["what_if_track_code$csid"] = $vars["what_if_track_code"];
  857. $_SESSION["advising_view$csid"] = $vars["advising_view"];
  858. if ($bool_ignore_what_if_variables == true)
  859. {
  860. $vars["advising_what_if"] = "";
  861. $vars["what_if_major_code"] = "";
  862. $vars["what_if_track_code"] = "";
  863. }
  864. // Are we in draft mode?
  865. if ($_SESSION["fp_draft_mode"] == "yes")
  866. {
  867. $vars["bool_use_draft"] = true;
  868. } else {
  869. $vars["bool_use_draft"] = false;
  870. }
  871. $GLOBALS["fp_advising"] = $vars;
  872. }
  873. /**
  874. * Implementation of hook_init
  875. */
  876. function advise_init() {
  877. global $current_student_id, $user, $screen;
  878. $current_student_id = $_REQUEST["current_student_id"];
  879. // Since this user doesn't have permission to view any sessions,
  880. // he can only view his own.
  881. if (!user_has_permission("view_any_advising_session")) {
  882. $current_student_id = $user->cwid;
  883. $_REQUEST["current_student_id"] = $current_student_id;
  884. $_REQUEST["advising_load_active"] = "yes";
  885. }
  886. // Is draft mode enabled?
  887. if ($_SESSION["fp_draft_mode"] == "yes") {
  888. fp_add_message("<b>" . t("Draft mode") . "</b> " . t("is currently enabled, however, substitutions and advisings will
  889. still be saved normally."), "status", TRUE);
  890. }
  891. }
  892. /**
  893. * Implementation of hook_clear_cache
  894. * Called by other modules, this function will take care of clearing
  895. * anything this module has cached.
  896. */
  897. function advise_clear_cache() {
  898. foreach ($_SESSION as $key => $value) {
  899. if (strstr($key, "cache_")) {
  900. $_SESSION[$key] = FALSE;
  901. }
  902. }
  903. fp_add_message(t("Advising cache has been cleared."));
  904. }
  905. /**
  906. * From menu hook. Clear just the advising cache.
  907. *
  908. */
  909. function advise_perform_clear_advising_cache() {
  910. advise_clear_cache();
  911. fp_goto("<front>");
  912. }
  913. function advise_init_screen() {
  914. global $degree_plan, $student, $fp, $window_mode, $user, $current_student_id, $screen;
  915. $db = get_global_database_handler();
  916. // Insert our advising vars into the GLOBALS array for easy use later.
  917. advise_init_advising_variables();
  918. $perform_action = trim(addslashes($_REQUEST["perform_action"]));
  919. if ($_REQUEST["clear_session"] == "yes") {
  920. //advise_save_advising_variables_to_db();
  921. // reload our advising vars into the GLOBALS array for easy use later.
  922. //$GLOBALS["fp_advising"] = advise_load_advising_variables_from_db($current_student_id, $user->id);
  923. }
  924. // Insert our advising vars into the GLOBALS array for easy use later.
  925. //$GLOBALS["fp_advising"] = advise_load_advising_variables_from_db($current_student_id, $user->id);
  926. $bool_what_if = false;
  927. $csid = $current_student_id;
  928. $cache = $_SESSION["cache_fp$csid"];
  929. if ($GLOBALS["fp_advising"]["advising_what_if"] == "yes") {
  930. $major_code = $GLOBALS["fp_advising"]["what_if_major_code"];
  931. $track_code = $GLOBALS["fp_advising"]["what_if_track_code"];
  932. $bool_what_if = true;
  933. $cache = $_SESSION["cache_what_if$csid"];
  934. }
  935. $bool_draft = true;
  936. //fpm($GLOBALS["fp_advising"]);
  937. if ($GLOBALS["fp_advising"]["advising_load_active"] == "yes") {
  938. // If we are loading from Active, then rebuild the cache as well.
  939. $bool_draft = false;
  940. $GLOBALS["fp_advising"]["load_from_cache"] = "no";
  941. }
  942. ///////////////////////
  943. /// Disable student data Caching....
  944. //$GLOBALS["load_from_cache"] = "no";
  945. // Attempt to load the course inventory cache...
  946. if ($course_inventory = unserialize($_SESSION["fp_cache_course_inventory"])) {
  947. $GLOBALS["fp_course_inventory"] = $course_inventory;
  948. }
  949. $bool_loaded = FALSE;
  950. if ($GLOBALS["fp_advising"]["load_from_cache"] == "yes" && $cache != "" && $fp = unserialize($cache)) {
  951. $bool_loaded = TRUE;
  952. $fp->db = get_global_database_handler();
  953. $student = $fp->student;
  954. if ($student->student_id == "") $bool_loaded = FALSE;
  955. $degree_plan = $fp->degree_plan;
  956. $student->db = get_global_database_handler();
  957. $degree_plan->db = get_global_database_handler();
  958. }
  959. if (!$bool_loaded) {
  960. $fp = new FlightPath();
  961. $fp->init();
  962. $student = $fp->student;
  963. $degree_plan = $fp->degree_plan;
  964. $GLOBALS["fp_advising"]["load_from_cache"] = "no";
  965. $bool_loaded = TRUE;
  966. }
  967. // Should we update the USER settings for anything?
  968. if ($GLOBALS["fp_advising"]["fp_update_user_settings_flag"] != "") {
  969. if (!$db->update_user_settings_from_post($user->id)) {
  970. fp_add_message(t("Unable to update user settings. Please try again later."));
  971. }
  972. }
  973. // If the form has been saved, this token is expected. This protects
  974. // against XSS attacks.
  975. $form_token = md5("advise_display_view" . fp_token());
  976. if ($perform_action == "save_draft") {
  977. if ($_REQUEST["form_token"] != $form_token) {
  978. die(t("Sorry, but you have encountered an error. A form submission was flagged
  979. as possibly being an invalid or forged submission. This may constitute a bug
  980. in the system. Please report this error to your Systems Administrator."));
  981. }
  982. // Save, then reload the student.
  983. $adv_id_array = $fp->save_advising_session_from_post(0,true);
  984. // Look for hook_save_advising_session()...
  985. invoke_hook("save_advising_session", $adv_id_array);
  986. $bool_draft = TRUE; // load draft, since we just saved it (and changed something)
  987. //fpm("saved draft");
  988. }
  989. if ($perform_action == "save_active") {
  990. if ($_REQUEST["form_token"] != $form_token) {
  991. die(t("Sorry, but you have encountered an error. A form submission was flagged
  992. as possibly being an invalid or forged submission. This may constitute a bug
  993. in the system. Please report this error to your Systems Administrator."));
  994. }
  995. // Save, then go to the history screen.
  996. $adv_id_array = $fp->save_advising_session_from_post(0,false);
  997. // Look for hook_save_advising_session()...
  998. invoke_hook("save_advising_session", $adv_id_array);
  999. // Use an fp_goto command here to go to the History screen
  1000. // Serialize the adv_id_array so we can send it along in our fp_goto command...
  1001. $adv_id_serialized = serialize($adv_id_array);
  1002. fp_goto("history", "adv_id_array_serialized=" . urlencode($adv_id_serialized));
  1003. return;
  1004. }
  1005. // Is the user trying to view "by type" or by year?
  1006. if ($GLOBALS["fp_advising"]["advising_view"] == "type") {
  1007. $screen = new AdvisingScreenTypeView("", $fp);
  1008. $screen->view = "type";
  1009. }
  1010. else {
  1011. // Default advising view. "View by Year"
  1012. $screen = new AdvisingScreen("", $fp);
  1013. $screen->view = "year";
  1014. }
  1015. if ($_REQUEST["bool_blank"] == "true" || $_REQUEST["blank_degree_id"] != "") {
  1016. $screen->bool_blank = TRUE;
  1017. }
  1018. if ($bool_what_if == true && $GLOBALS["fp_advising"]["what_if_major_code"] == "") {
  1019. // In other words, we are on the WhatIf tab, but we have not
  1020. // selected a major. So, just exit out. We will give the user
  1021. // a display_screen later.
  1022. return;
  1023. }
  1024. if ($GLOBALS["fp_advising"]["load_from_cache"] != "yes") {
  1025. // do not load from cache....
  1026. $student->load_student();
  1027. $student->load_student_substitutions();
  1028. $student->load_unassignments();
  1029. $student->list_courses_taken->sort_alphabetical_order();
  1030. $student->list_courses_taken->sort_most_recent_first();
  1031. // print_pre($student->list_courses_taken->toString());
  1032. $fp->flag_outdated_substitutions();
  1033. // We shouldn't supply the advising_term_id, so that it will load all terms available.
  1034. //$fp->load_advising_session_from_database(0,"",$bool_what_if,$bool_draft,0);
  1035. $fp->assign_courses_to_semesters(); // bare degree plan. not groups.
  1036. $fp->assign_courses_to_groups();
  1037. }
  1038. else {
  1039. }
  1040. if ($GLOBALS["fp_advising"]["save_to_cache"] != "no" && $window_mode != "popup") {
  1041. if ($bool_what_if == false) {
  1042. // NOT in whatIf mode. Normal.
  1043. $_SESSION["cache_fp$csid"] = serialize($fp);
  1044. }
  1045. else {
  1046. // We are in WhatIf mode.
  1047. $_SESSION["cache_what_if$csid"] = serialize($fp);
  1048. }
  1049. }
  1050. // We shouldn't supply the advising_term_id, so that it will load all terms available.
  1051. $fp->load_advising_session_from_database(0,"",$bool_what_if,$bool_draft,0);
  1052. // Once we have loaded the advising session, we should always try to load
  1053. // from draft from then on out.
  1054. $GLOBALS["fp_advising"]["advising_load_active"] = "";
  1055. }
  1056. /**
  1057. * This is a hook which developers may use to add custom blocks (or perform other operations)
  1058. * onto the advising View or What If screen.
  1059. *
  1060. * This is called AFTER the AdvisingScreen class has called it's build_screen_elements()
  1061. * function, which draws the various semester blocks, footnotes, etc, onto the screen.
  1062. *
  1063. * This gives other modules a chance to alter the screen, or to add a custom block to the
  1064. * bottom of the screen. Note that the $screen element is sent by reference. Any changes
  1065. * you make to it will be instant; there is no need to return anything.
  1066. *
  1067. * To see how these blocks are best set up, look at AdvisingScreen->build_excess_credit(), or
  1068. * AdvisingScreen->displaySemester() for inspiration.
  1069. *
  1070. * @param AdvisingScreen &$screen
  1071. */
  1072. function hook_advise_build_screen_elements(&$screen) {
  1073. $html = "";
  1074. $html .= $screen->draw_semester_box_top("Sample", TRUE); // pass TRUE to hide the "headers"
  1075. $html .= "<tr><td colspan='8'>"; // required after the top!
  1076. ////////////////
  1077. // The content...
  1078. $html .= "<b>Hello World!</b>";
  1079. ///////////////////
  1080. // All done, time to tidy up...
  1081. $html .= "</td></tr>"; // required before the bottom!
  1082. $html .= $screen->draw_semester_box_bottom();
  1083. // Add to the screen as a "semester block".
  1084. $screen->add_to_screen($html);
  1085. }

Functions

Namesort descending Description
advise_can_access_view Used by the menu to determine if the user can see the View tab.
advise_clear_cache Implementation of hook_clear_cache Called by other modules, this function will take care of clearing anything this module has cached.
advise_display_popup_change_term This popup allows the advisor to change the advising term.
advise_display_popup_change_track Lets the user change the track for this major.
advise_display_popup_course_description
advise_display_popup_group_select
advise_display_popup_substitute_selected
advise_display_view This is the page which actually displays the "view" for the user to see their advising session, or for an advisor to advise them.
advise_display_what_if_selection Displays the pulldown select list for picking a new What If degree. Returns HTML.
advise_init Implementation of hook_init
advise_init_advising_variables Takes various variables from the REQUEST and stores them in our advising_session_variables table for more convenient use later on.
advise_init_screen
advise_menu
advise_perform_clear_advising_cache From menu hook. Clear just the advising cache.
advise_perm Implementation of hook_perm
advise_toggle_draft_form
advise_toggle_draft_form_submit
advise_user_can_view_advising_session_access_callback This is an access callback. Can the user view the advising session specified in the REQUEST?
hook_advise_build_screen_elements This is a hook which developers may use to add custom blocks (or perform other operations) onto the advising View or What If screen.