_Student.php

Classes

NameDescription
_Student

File

classes/_Student.php
View source
  1. <?php
  2. class _Student
  3. {
  4. public $student_id, $name, $major_code, $gpa, $cumulative_hours, $catalog_year;
  5. public $list_courses_taken, $list_courses_advised, $list_courses_added, $db, $rank;
  6. public $list_standardized_tests, $list_substitutions;
  7. public $list_transfer_eqvs_unassigned;
  8. public $array_settings, $array_significant_courses, $array_hide_grades_terms;
  9. function __construct($student_id = "", DatabaseHandler $db = NULL)
  10. {
  11. $this->student_id = $student_id;
  12. $this->array_hide_grades_terms = array();
  13. $this->array_significant_courses = array(); // array of course_ids
  14. // the student has taken, or has subs for (or transfer eqv's).
  15. // used later to help speed up assignCoursesToList in FlightPath.
  16. $this->db = $db;
  17. if ($db == NULL)
  18. {
  19. $this->db = get_global_database_handler();
  20. }
  21. // Go ahead and load and assemble
  22. // all information in the database on this student.
  23. $this->load_student();
  24. }
  25. /**
  26. * This is a stub function. If you are planning on hiding course grades
  27. * for a term at a time, you should override this method in /custom/classes
  28. * and place that logic here.
  29. *
  30. * For example,
  31. * at ULM, students cannot see their final grades for a term until they
  32. * have completed their course evaluations for every course they took that
  33. * term, OR, until 2 weeks have passed.
  34. *
  35. *
  36. *
  37. */
  38. function determine_terms_to_hide_grades()
  39. {
  40. return;
  41. }
  42. function load_student()
  43. {
  44. $this->list_transfer_eqvs_unassigned = new CourseList();
  45. $this->list_courses_taken = new CourseList();
  46. $this->list_courses_added = new CourseList();
  47. $this->list_substitutions = new SubstitutionList();
  48. $this->list_standardized_tests = new ObjList();
  49. $this->array_settings = array();
  50. if ($this->student_id != "")
  51. {
  52. $this->determine_terms_to_hide_grades();
  53. $this->load_transfer_eqvs_unassigned();
  54. $this->load_courses_taken();
  55. $this->load_student_data();
  56. $this->load_test_scores();
  57. $this->load_settings();
  58. $this->load_significant_courses();
  59. //$this->load_unassignments();
  60. //$this->load_student_substitutions();
  61. // If we are supposed to set cumulative hours and gpa, perform that
  62. // operation now.
  63. if (variable_get("calculate_cumulative_hours_and_gpa", FALSE)) {
  64. $arr = $this->calculate_cumulative_hours_and_gpa();
  65. $this->cumulative_hours = $arr["cumulative_total_hours"];
  66. $this->gpa = $arr["cumulative_gpa"];
  67. }
  68. }
  69. // When we load this student, let's also check for any hooks relating
  70. // to loading this student.
  71. // Since this class might be used outside of FP, only do this if we know
  72. // that the bootstrap.inc file has been executed.
  73. if ($GLOBALS["fp_bootstrap_loaded"] == TRUE) {
  74. invoke_hook("student_load", array(&$this));
  75. }
  76. }
  77. function load_significant_courses()
  78. {
  79. // This will attempt to add as much to the array_significant_courses
  80. // as we can, which was not previously determined.
  81. // For example: courses we were advised to take and/or
  82. // substitutions.
  83. // Now, when this gets called, it's actually *before* we
  84. // write any subs or advisings to the database, so what we
  85. // actually need to do is go through the POST
  86. // and add any course_id's we find.
  87. // In the future, perhaps it would be more efficient
  88. // to have just one POST variable to look at, perhaps
  89. // comma-seperated.
  90. // Look in the database of advised courses for ANY course advised in
  91. // the range of advisingTermIDs.
  92. $advising_term_ids = variable_get("available_advising_term_ids", "0");;
  93. $temp = explode(",",$advising_term_ids);
  94. foreach ($temp as $term_id)
  95. {
  96. $term_id = trim($term_id);
  97. $res = $this->db->db_query("SELECT * FROM advising_sessions a,
  98. advised_courses b
  99. WHERE a.student_id='?'
  100. AND a.advising_session_id = b.advising_session_id
  101. AND a.term_id = '?'
  102. AND a.is_draft = '0' ", $this->student_id, $term_id);
  103. while ($cur = $this->db->db_fetch_array($res))
  104. {
  105. $this->array_significant_courses[$cur["course_id"]] = true;
  106. }
  107. }
  108. // Now, look for any course which a substitution might have been
  109. // performed for...
  110. $res = $this->db->db_query("SELECT * FROM student_substitutions
  111. WHERE student_id='?' ", $this->student_id);
  112. while ($cur = $this->db->db_fetch_array($res)) {
  113. $this->array_significant_courses[$cur["required_course_id"]] = true;
  114. }
  115. }
  116. function load_significant_courses_from_list_courses_taken() {
  117. // Build the array_significant_courses
  118. // entriely from list_courses_taken.
  119. $this->list_courses_taken->reset_counter();
  120. while($this->list_courses_taken->has_more())
  121. {
  122. $c = $this->list_courses_taken->get_next();
  123. $this->array_significant_courses[$c->course_id] = true;
  124. }
  125. }
  126. function load_settings() {
  127. // This will load & set up the array_settings variable for this
  128. // student.
  129. $res = $this->db->db_query("SELECT * FROM student_settings
  130. WHERE
  131. student_id='?' ", $this->student_id);
  132. $cur = $this->db->db_fetch_array($res);
  133. if ($arr = unserialize($cur["settings"])) {
  134. $this->array_settings = $arr;
  135. }
  136. }
  137. function load_transfer_eqvs_unassigned()
  138. {
  139. $res = $this->db->db_query("SELECT * FROM student_unassign_transfer_eqv
  140. WHERE
  141. student_id='?'
  142. AND delete_flag='0'
  143. ORDER BY id ", $this->student_id);
  144. while($cur = $this->db->db_fetch_array($res))
  145. {
  146. extract ($cur, 3, "db");
  147. $new_course = new Course();
  148. $new_course->bool_transfer = true;
  149. $new_course->course_id = $db_transfer_course_id;
  150. $new_course->db_unassign_transfer_id = $db_id;
  151. $this->list_transfer_eqvs_unassigned->add($new_course);
  152. }
  153. }
  154. function init_semester_courses_added()
  155. {
  156. // The "Add a Course" box on screen is really just a
  157. // semester, with the number -88, with a single group,
  158. // also numbered -88.
  159. $this->semester_courses_added = new Semester(-88);
  160. $this->semester_courses_added->title = "Courses Added by Advisor";
  161. // Now, we want to add the Add a Course group...
  162. $g = new Group();
  163. $g->group_id = -88;
  164. // Since it would take a long time during page load, we will
  165. // leave this empty of courses for now. It doesn't matter anyway,
  166. // as we will not be checking this group for course membership
  167. // anyway. We only need to load it in the popup.
  168. $g->hours_required = 99999; // Nearly infinite selections may be made.
  169. $g->assigned_to_semester_num = -88;
  170. $g->title = "Add an Additional Course";
  171. $this->semester_courses_added->list_groups->add($g);
  172. }
  173. function load_unassignments()
  174. {
  175. // Load courses which have been unassigned from groups
  176. // or the bare degree plan.
  177. $res = $this->db->db_query("SELECT * FROM student_unassign_group
  178. WHERE
  179. student_id='?'
  180. AND delete_flag='0' ", $this->student_id);
  181. while($cur = $this->db->db_fetch_array($res))
  182. {
  183. extract ($cur, 3, "db");
  184. if ($taken_course = $this->list_courses_taken->find_specific_course($db_course_id, $db_term_id, (bool) $db_transfer_flag, true))
  185. {
  186. // Add the group_id to this courses' list of unassigned groups.
  187. $new_group = new Group();
  188. $new_group->group_id = $db_group_id;
  189. $new_group->db_unassign_group_id = $db_id;
  190. $taken_course->group_list_unassigned->add($new_group);
  191. }
  192. }
  193. }
  194. function load_test_scores()
  195. {
  196. // If the student has any scores (from standardized tests)
  197. // then load them here.
  198. $st = null;
  199. $res = db_query("
  200. SELECT * FROM student_tests
  201. WHERE
  202. student_id = '?'
  203. ORDER BY date_taken DESC ", $this->student_id);
  204. while($cur = db_fetch_array($res)) {
  205. $c++;
  206. extract($cur, 3, "db");
  207. // Get the test's description, if available.
  208. $res2 = db_query("SELECT * FROM standardized_tests
  209. WHERE test_id = '?'
  210. AND category_id = '?'
  211. ORDER BY position", $db_test_id, $db_category_id);
  212. $cur2 = db_fetch_array($res2);
  213. $db_test_description = trim($cur2["test_description"]);
  214. $db_category_description = trim($cur2["category_description"]);
  215. // Did we find anything in the table? If not, just use the codes themselves
  216. if ($db_test_description == "") $db_test_description = t("Test code:") . " " . $db_test_id;
  217. if ($db_category_description == "") $db_category_description = $db_category_id;
  218. if (!(($db_date_taken . $db_test_id) == $old_row))
  219. {
  220. // We are at a new test. Add the old test to our list.
  221. if ($st != null) {
  222. $this->list_standardized_tests->add($st);
  223. }
  224. $st = new StandardizedTest();
  225. $st->test_id = $db_test_id;
  226. $st->date_taken = $db_date_taken;
  227. $st->description = $db_test_description;
  228. $old_row = $db_date_taken . $db_test_id;
  229. }
  230. $st->categories[$db_position . $c]["description"] = $db_category_description;
  231. $st->categories[$db_position . $c]["category_id"] = $db_category_id;
  232. $st->categories[$db_position . $c]["score"] = $db_score;
  233. }
  234. // Add the last one created.
  235. if ($st != null) {
  236. $this->list_standardized_tests->add($st);
  237. }
  238. }
  239. function load_student_substitutions()
  240. {
  241. // Load the substitutions which have been made for
  242. // this student.
  243. // Meant to be called AFTER load_courses_taken.
  244. $this->list_substitutions = new SubstitutionList();
  245. $res = $this->db->db_query("SELECT * FROM
  246. student_substitutions
  247. WHERE student_id='?'
  248. AND delete_flag='0' ", $this->student_id);
  249. while($cur = $this->db->db_fetch_array($res))
  250. {
  251. $sub_id = $cur["id"];
  252. $sub_course_id = $cur["sub_course_id"];
  253. $sub_term_id = $cur["sub_term_id"];
  254. $sub_bool_transfer = (bool) $cur["sub_transfer_flag"];
  255. $sub_hours = $cur["sub_hours"] * 1;
  256. $sub_remarks = trim($cur["sub_remarks"]);
  257. $faculty_id = $cur["faculty_id"];
  258. if (strstr($sub_term_id, "9999"))
  259. {
  260. // was an unknown semester. Let's set it lower so
  261. // it doesn't screw up my sorting.
  262. $sub_term_id = 11111;
  263. }
  264. // Okay, look to see if we can find the course specified by this
  265. // courseSubstitution within the list of courses which the student
  266. // has taken. If the subHours is less than the hours_awarded for the
  267. // particular course, it means the course has been split up!
  268. if($taken_course = $this->list_courses_taken->find_specific_course($sub_course_id, $sub_term_id, $sub_bool_transfer, true))
  269. {
  270. // If this takenCourse is a transfer credit, then we want to remove
  271. // any automatic eqv it may have set.
  272. // We can do this easily by setting its course_id to 0.
  273. if ($sub_bool_transfer == true)
  274. {
  275. $taken_course->temp_old_course_id = $taken_course->course_id;
  276. $taken_course->course_id = 0;
  277. }
  278. if ($sub_hours == 0)
  279. { // If none specified, assume its the full amount.
  280. $sub_hours = $taken_course->hours_awarded;
  281. }
  282. if (($taken_course->hours_awarded > $sub_hours))
  283. {
  284. // Okay, now this means that the course which we are
  285. // using in the substitution-- the course which the student
  286. // has actually taken-- is being split up in the substitution.
  287. // We are only using a portion of its hours.
  288. // We MUST round, because if there is a decimal place, we might run into
  289. // trouble. Because, for example, 2.001 - 2 actually gets .00009999999 instead of .001.
  290. // The most decimals we can have is 4, so let's round to 6 decimal places, just to give
  291. // us some breathing room. That should take care of us without losing too much precision.
  292. $remaining_hours = round(($taken_course->hours_awarded - $sub_hours), 6);
  293. // Create a clone of the course with the leftover hours, and add
  294. // it back into the list_courses_taken.
  295. $new_course_string = $taken_course->to_data_string();
  296. $new_course = new Course();
  297. $new_course->load_course_from_data_string($new_course_string);
  298. $new_course->bool_substitution_split = true;
  299. $new_course->bool_substitution_new_from_split = true;
  300. $new_course->subject_id = $taken_course->subject_id;
  301. $new_course->course_num = $taken_course->course_num;
  302. $new_course->hours_awarded = $remaining_hours;
  303. if (is_object($new_course->course_transfer))
  304. {
  305. $new_course->course_transfer->hours_awarded = $remaining_hours;
  306. }
  307. $taken_course->bool_substitution_split = true;
  308. $taken_course->hours_awarded = $sub_hours;
  309. if (is_object($taken_course->course_transfer))
  310. {
  311. $taken_course->course_transfer->hours_awarded = $sub_hours;
  312. }
  313. // Add the newCourse back into the student's list_courses_taken.
  314. $this->list_courses_taken->add($new_course);
  315. }
  316. $taken_course->substitution_hours = $sub_hours;
  317. $taken_course->bool_substitution = true;
  318. $taken_course->display_status = "completed";
  319. $taken_course->db_substitution_id = $sub_id;
  320. $substitution = new Substitution();
  321. if ($cur["required_course_id"] > 0)
  322. {
  323. $course_requirement = new Course($cur["required_course_id"]);
  324. $this->array_significant_courses[$course_requirement->course_id] = true;
  325. } else {
  326. // This is a group addition!
  327. $course_requirement = new Course($sub_course_id, $sub_bool_transfer);
  328. $this->array_significant_courses[$sub_course_id] = true;
  329. $substitution->bool_group_addition = true;
  330. }
  331. $course_requirement->assigned_to_group_id = $cur["required_group_id"];
  332. $course_requirement->assigned_to_semester_num = $cur["required_semester_num"];
  333. $taken_course->assigned_to_group_id = $cur["required_group_id"];
  334. $taken_course->assigned_to_semester_num = $cur["required_semester_num"];
  335. $substitution->course_requirement = $course_requirement;
  336. $substitution->course_list_substitutions->add($taken_course);
  337. $substitution->remarks = $sub_remarks;
  338. $substitution->faculty_id = $faculty_id;
  339. $this->list_substitutions->add($substitution);
  340. }
  341. }
  342. }
  343. /**
  344. * This loads a student's personal data, like name and so forth.
  345. *
  346. */
  347. function load_student_data()
  348. {
  349. $this->cumulative_hours = $this->db->get_student_cumulative_hours($this->student_id);
  350. $this->gpa = $this->db->get_student_gpa($this->student_id);
  351. $this->rank = $this->get_rank_description($this->db->get_student_rank($this->student_id));
  352. $this->major_code = $this->db->get_student_major_from_db($this->student_id);
  353. $this->catalog_year = $this->db->get_student_catalog_year($this->student_id);
  354. $this->name = $this->db->get_student_name($this->student_id);
  355. }
  356. /**
  357. * This function will look at the courses which the student has taken, to calculate
  358. * the cumulative hours and gpa, rather than just load them from the db table.
  359. *
  360. * It will then return the values in an assoc array for later use. For example, you
  361. * may want to set $this->cumulative_hours and $this->gpa to them.
  362. *
  363. */
  364. function calculate_cumulative_hours_and_gpa() {
  365. $cumulative_hours = 0;
  366. $cumulative_points = 0;
  367. $cumulative_total_hours = $this->list_courses_taken->count_credit_hours("", FALSE, TRUE, FALSE);
  368. $cumulative_quality_hours = $this->list_courses_taken->count_credit_hours("", FALSE, TRUE, TRUE);
  369. $cumulative_quality_points = $this->list_courses_taken->count_credit_quality_points("", FALSE, TRUE);
  370. $cgpa = FALSE;
  371. if ($cumulative_quality_hours > 0) {
  372. $cgpa = fp_truncate_decimals($cumulative_quality_points / $cumulative_quality_hours, 3);
  373. }
  374. fpm("This student: <b>$cumulative_total_hours total hours</b>,
  375. $cumulative_quality_hours qual hours, $cumulative_quality_points cpoints. <b>gpa: $cgpa</b>");
  376. return array(
  377. "cumulative_total_hours" => $cumulative_total_hours,
  378. "cumulative_quality_hours" => $cumulative_quality_hours,
  379. "cumulative_quality_points" => $cumulative_quality_points,
  380. "cumulative_gpa" => $cgpa,
  381. );
  382. }
  383. /**
  384. * Given a rank_code like FR, SO, etc., get the english
  385. * description. For example: Freshman, Sophomore, etc.
  386. *
  387. */
  388. function get_rank_description($rank_code = "") {
  389. // TODO: Maybe this should be a setting somewhere instead of hard-coded?
  390. $rank_array = array(
  391. "FR"=>t("Freshman"),
  392. "SO"=>t("Sophomore"),
  393. "JR"=>t("Junior"),
  394. "SR"=>t("Senior"),
  395. "PR"=>t("Professional"),
  396. );
  397. return $rank_array[$rank_code];
  398. }
  399. /**
  400. * Returns a student's degree plan object.
  401. *
  402. */
  403. function get_degree_plan($bool_load_full = true, $bool_ignore_settings = false)
  404. {
  405. $t_major_code = $this->get_major_and_track_code($bool_ignore_settings);
  406. $degree_id = $this->db->get_degree_id($t_major_code, $this->catalog_year);
  407. if ($bool_load_full)
  408. {
  409. $degree_plan = new DegreePlan($degree_id, $this->db);
  410. } else {
  411. $degree_plan = new DegreePlan();
  412. $degree_plan->degree_id = $degree_id;
  413. $degree_plan->load_descriptive_data();
  414. }
  415. return $degree_plan;
  416. }
  417. /**
  418. * Enter description here...
  419. * Returns the major code and trackCode, if it exists in this form:
  420. * MAJOR|CONC_TRACK
  421. * Though usually it will be:
  422. * MAJR|_TRCK
  423. * Asumes you have already called "load_settings()";
  424. */
  425. function get_major_and_track_code($bool_ignore_settings = false)
  426. {
  427. $rtn = "";
  428. $major_code = "";
  429. if ($this->array_settings["major_code"] != "")
  430. { // If they have settings saved, use those...
  431. if ($this->array_settings["track_code"] != "")
  432. {
  433. // if it does NOT have a | in it already....
  434. if (!strstr($this->array_settings["major_code"], "|"))
  435. {
  436. $rtn = $this->array_settings["major_code"] . "|_" . $this->array_settings["track_code"];
  437. } else {
  438. // it DOES have a | already, so we join with just a _. This would
  439. // be the case if we have a track AND an concentration.
  440. $rtn = $this->array_settings["major_code"] . "_" . $this->array_settings["track_code"];
  441. }
  442. } else {
  443. $rtn = $this->array_settings["major_code"];
  444. }
  445. $major_code = $this->array_settings["major_code"];
  446. } else {
  447. $rtn = $this->major_code;
  448. }
  449. if ($bool_ignore_settings == true) {
  450. $rtn = $this->major_code;
  451. }
  452. return $rtn;
  453. }
  454. function load_courses_taken($bool_load_transfer_credits = true)
  455. {
  456. $retake_grades = csv_to_array($GLOBALS["fp_system_settings"]["retake_grades"]);
  457. $not_released_grades_terms = csv_to_array(variable_get("not_released_grades_terms"));
  458. // This will create and load the list_courses_taken list.
  459. // contains SQL queries to fully create the list_courses_taken.
  460. $res = $this->db->db_query("SELECT * FROM student_courses
  461. WHERE
  462. student_id = '?' ", $this->student_id);
  463. while($cur = $this->db->db_fetch_array($res)) {
  464. // Create a course object for this course...
  465. $is_transfer = false;
  466. $course_id = $this->db->get_course_id($cur["subject_id"], $cur["course_num"]);
  467. if (!$course_id) {
  468. fpm("Course not found while trying to load student data: {$cur["subject_id"]} {$cur["course_num"]}");
  469. continue;
  470. }
  471. // Are these grades (terms) not released yet?
  472. if (in_array($cur["term_id"], $not_released_grades_terms)) {
  473. $cur["grade"] = "";
  474. }
  475. $new_course = new Course();
  476. $new_course->course_id = $course_id;
  477. // Load descriptive data for this course from the catalog (so we can get min, max, and repeat hours)
  478. $new_course->load_descriptive_data();
  479. // Now, over-write whatever we got from the descriptive data with what the course was called
  480. // when the student took it.
  481. $new_course->subject_id = $cur["subject_id"];
  482. $new_course->course_num = $cur["course_num"];
  483. $new_course->grade = $cur["grade"];
  484. $new_course->term_id = $cur["term_id"];
  485. // Is this grade supposed to be hidden from students (and this user is probably
  486. // a student)
  487. if (in_array($new_course->term_id, $this->array_hide_grades_terms)
  488. && !user_has_permission("can_advise_students"))
  489. {
  490. $new_course->bool_hide_grade = true;
  491. }
  492. $new_course->hours_awarded = $cur["hours_awarded"] * 1;
  493. $new_course->display_status = "completed";
  494. $new_course->bool_taken = true;
  495. // Was this course worth 0 hours but they didn't fail it?
  496. // If so, we need to set it to actually be 1 hour, and
  497. // indicate this is a "ghost hour."
  498. if (!in_array($new_course->grade, $retake_grades)
  499. && $new_course->hours_awarded == 0)
  500. {
  501. $new_course->hours_awarded = 1;
  502. $new_course->bool_ghost_hour = TRUE;
  503. }
  504. // Now, add the course to the list_courses_taken...
  505. $this->list_courses_taken->add($new_course);
  506. $this->array_significant_courses[$course_id] = true;
  507. }
  508. if ($bool_load_transfer_credits == false) {
  509. return;
  510. }
  511. // Tranfer credits? Get those too...
  512. $res = $this->db->db_query("
  513. SELECT *
  514. FROM student_transfer_courses a,
  515. transfer_courses b
  516. WHERE a.transfer_course_id = b.transfer_course_id
  517. AND a.student_id = '?' ", $this->student_id);
  518. while($cur = $this->db->db_fetch_array($res))
  519. {
  520. $transfer_course_id = $cur['transfer_course_id'];
  521. $institution_id = $cur["institution_id"];
  522. $new_course = new Course();
  523. // Find out if this course has an eqv.
  524. if ($course_id = $this->get_transfer_course_eqv($transfer_course_id, false))
  525. {
  526. $new_course = new Course($course_id);
  527. $this->array_significant_courses[$course_id] = true;
  528. }
  529. $t_course = new Course();
  530. $t_course->subject_id = $cur['subject_id'];
  531. $t_course->course_num = $cur['course_num'];
  532. $t_course->course_id = $transfer_course_id;
  533. $t_course->bool_transfer = true;
  534. $t_course->institution_id = $institution_id;
  535. $new_course->bool_transfer = true;
  536. $new_course->course_transfer = $t_course;
  537. $new_course->grade = $cur['grade'];
  538. $t_course->grade = $cur['grade'];
  539. $new_course->hours_awarded = $cur['hours_awarded'] * 1;
  540. $t_course->hours_awarded = $cur['hours_awarded'] * 1;
  541. // Was this course worth 0 hours but they didn't fail it?
  542. // If so, we need to set it to actually be 1 hour, and
  543. // indicate this is a "ghost hour."
  544. if (!in_array($new_course->grade, $retake_grades)
  545. && $new_course->hours_awarded == 0)
  546. {
  547. $new_course->hours_awarded = 1;
  548. $new_course->bool_ghost_hour = TRUE;
  549. $t_course->hours_awarded = 1;
  550. $t_course->bool_ghost_hour = TRUE;
  551. }
  552. $new_course->bool_taken = true;
  553. $t_course->bool_taken = true;
  554. $new_course->term_id = $cur['term_id'];
  555. if (strstr($new_course->term_id, "9999")) {
  556. // was an unknown semester. Let's set it lower so
  557. // it doesn't screw up my sorting.
  558. $new_course->term_id = 11111;
  559. }
  560. $t_course->term_id = $new_course->term_id;
  561. $new_course->display_status = "completed";
  562. $this->list_courses_taken->add($new_course);
  563. }
  564. // print_pre($this->list_courses_taken->to_string());
  565. }
  566. /**
  567. * Find a transfer eqv for this student, for this course in question.
  568. *
  569. */
  570. function get_transfer_course_eqv($transfer_course_id, $bool_ignore_unassigned = false, $require_valid_term_id = "")
  571. {
  572. // First, make sure that this transfer course hasn't
  573. // been unassigned. Do this by checking through
  574. // the student's courseListUnassignedTransferEQVs.
  575. $temp_course = new Course();
  576. $temp_course->course_id = $transfer_course_id;
  577. if ($bool_ignore_unassigned == false && $this->list_transfer_eqvs_unassigned->find_match($temp_course)) {
  578. // The transfer course in question has had its eqv removed,
  579. // so skip it!
  580. return false;
  581. }
  582. $valid_term_line = "";
  583. if ($require_valid_term_id != "") {
  584. // We are requesting eqv's only from a particular valid term, so, amend
  585. // the query.
  586. $valid_term_line = "AND valid_term_id = $require_valid_term_id ";
  587. }
  588. // Does the supplied transfer course ID have an eqv?
  589. $res = $this->db->db_query("
  590. SELECT * FROM transfer_eqv_per_student
  591. WHERE transfer_course_id = '?'
  592. AND student_id = '?'
  593. AND broken_id = '0'
  594. $valid_term_line ", $transfer_course_id, $this->student_id);
  595. if ($cur = $this->db->db_fetch_array($res)) {
  596. return $cur['local_course_id'];
  597. }
  598. return false;
  599. }
  600. function to_string() {
  601. $rtn = "Student Information:\n";
  602. $rtn .= " Courses Taken:\n";
  603. $rtn .= $this->list_courses_taken->to_string();
  604. return $rtn;
  605. }
  606. } // end class Student