Group.php

  1. 7.x classes/Group.php
  2. 6.x classes/Group.php
  3. 5.x custom/classes/Group.php

File

classes/Group.php
View source
  1. <?php
  2. class Group extends stdClass
  3. {
  4. public const GROUP_COURSE_INFINITE_REPEATS = 9999;
  5. public const GROUP_COURSE_INFINITE_REPEATS_THRESHOLD = 50;
  6. public const GROUP_MIN_HOURS_NOT_SET = -999;
  7. public $title, $icon_filename, $group_id, $requirement_type, $min_grade, $group_name;
  8. public $hours_required, $min_hours_allowed, $hours_remaining, $hours_fulfilled, $hours_fulfilled_for_credit;
  9. public $hours_required_by_type, $req_by_degree_id;
  10. public $assigned_to_semester_num, $bool_placeholder, $data_entry_comment, $public_note;
  11. public $list_courses, $list_groups, $db, $count_of_matches, $bool_winning_branch;
  12. public $catalog_year, $school_id;
  13. public $priority, $definition;
  14. //////////////////
  15. /// From the database...
  16. public $db_unassign_group_id, $db_delete_flag, $db_catalog_repeat;
  17. ///////////////
  18. /// Used with in-system logic....
  19. public $hours_assigned;
  20. public $bool_use_draft;
  21. /**
  22. * $title "Free Electives","Core Fine Arts", etc.
  23. * $icon_filename monalisa.gif, tower1.gif, etc.
  24. * $group_id ID of the group in the db table.
  25. *
  26. * $type Major, Supporting, Core, etc.
  27. * $min_grade This is if the group itself has a min grade requirement.
  28. * Ex: B,C etc.
  29. * $list_courses This is a CourseList of courses. These are
  30. * the courses which are actually required by the group.
  31. * If individual courses have their own min grade requirements,
  32. * or what have you, that only refer to this group, then they
  33. * would be put in here.
  34. * $list_groups This is a list of groups that belong within this group.
  35. * Used when you have branching. Potentially can be quite
  36. * complicated, since each group in the list can also have
  37. * subgroups.
  38. **/
  39. function __construct($group_id = "", DatabaseHandler $db = NULL, $semester_num = -1, $array_significant_courses = false, $bool_use_draft = false, $requirement_type = "")
  40. {
  41. $this->group_id = $group_id;
  42. $this->assigned_to_semester_num = $semester_num;
  43. $this->count_of_matches = 0;
  44. $this->hours_assigned = 0;
  45. $this->min_hours_allowed = Group::GROUP_MIN_HOURS_NOT_SET;
  46. $this->school_id = 0;
  47. $this->list_courses = new CourseList();
  48. $this->list_groups = new GroupList();
  49. $this->bool_use_draft = $bool_use_draft;
  50. $this->hours_required_by_type = array();
  51. $this->requirement_type = $requirement_type;
  52. // Always override if the global variable is set.
  53. if (@$GLOBALS["fp_advising"]["bool_use_draft"] == true) {
  54. $this->bool_use_draft = true;
  55. }
  56. $this->db = $db;
  57. if ($db == NULL || !is_object($db) || !is_resource($db->pdo)) {
  58. $this->db = get_global_database_handler();
  59. }
  60. if ($group_id != "")
  61. {
  62. $this->bool_placeholder = FALSE;
  63. $this->load_group(true, $array_significant_courses);
  64. $this->set_requirement_type($this->requirement_type);
  65. }
  66. }
  67. function assign_to_semester($semester_num)
  68. {
  69. $this->assigned_to_semester_num = $semester_num;
  70. $temp_i = $this->list_courses->i;
  71. $this->list_courses->reset_counter();
  72. while($this->list_courses->has_more())
  73. {
  74. $c = $this->list_courses->get_next();
  75. $c->assigned_to_semester_num = $semester_num;
  76. }
  77. $this->list_courses->i = $temp_i;
  78. }
  79. function reset_list_counters()
  80. {
  81. // Resets the counters on all groups and course lists
  82. // in this group.
  83. $this->list_courses->reset_counter();
  84. $this->list_groups->reset_counter();
  85. }
  86. function assign_min_grade($min_grade)
  87. {
  88. // Assign every course in the group to have this particular min grade.
  89. $min_grade = strtoupper($min_grade);
  90. $this->min_grade = $min_grade;
  91. $this->list_courses->assign_min_grade($min_grade);
  92. $this->list_groups->assign_min_grade($min_grade);
  93. }
  94. /**
  95. * Returns an array of course_id's in this group, as well as any sub-group (branches).
  96. * // Key = course_id, val = TRUE.
  97. */
  98. function get_course_id_array($bool_exclude_assigned_courses = FALSE) {
  99. $rtn = array();
  100. $this->list_courses->reset_counter();
  101. while($this->list_courses->has_more()) {
  102. $c = $this->list_courses->get_next();
  103. if (!$bool_exclude_assigned_courses) {
  104. $rtn[$c->course_id] = TRUE;
  105. }
  106. else {
  107. // Look to see if this course has already been assigned or not. If it has, then we
  108. // should skip it. If it has NOT, then it's OK to add.
  109. if ($c->course_list_fulfilled_by->is_empty == TRUE) {
  110. $rtn[$c->course_id] = TRUE;
  111. }
  112. else {
  113. //$c->load_descriptive_data();
  114. //fpm("Not doing $c->subject_id $c->course_num");
  115. }
  116. }
  117. }
  118. // Also get any sub-group's courses...
  119. $this->list_groups->reset_counter();
  120. while($this->list_groups->has_more()) {
  121. $g = $this->list_groups->get_next();
  122. // $rtn = array_merge($rtn, $g->get_course_id_array());
  123. // Fix by Logan Buth: https://bytetask.com/node/2456
  124. $rtn = $rtn + $g->get_course_id_array();
  125. }
  126. return $rtn;
  127. } // get_course_id_array.
  128. /**
  129. * Returns TRUE or FALSE if this group has a concept of min hours. This
  130. * is basically checking if there is a min_hours_allowed set, and if so, is it less than the hours_required.
  131. * @return boolean
  132. */
  133. function has_min_hours_allowed() {
  134. if ($this->min_hours_allowed === Group::GROUP_MIN_HOURS_NOT_SET) return FALSE;
  135. return ($this->min_hours_allowed !== Group::GROUP_MIN_HOURS_NOT_SET && $this->min_hours_allowed < $this->hours_required);
  136. }
  137. function get_hours_remaining($semester_num = -1)
  138. {
  139. // returns how many hours are left for this group.
  140. return ($this->hours_required - $this->get_fulfilled_hours(true, true, false, $semester_num));
  141. }
  142. /**
  143. * Return TRUE or FALSE if we've fulfilled the min hour allowed value, if it's set.
  144. */
  145. function get_is_min_hours_allowed_fulfilled($semester_num = -1) {
  146. // TODO: Could call this->has_min_hours_allowed() instead if these lines?
  147. if ($this->min_hours_allowed === Group::GROUP_MIN_HOURS_NOT_SET) return TRUE; // Wasn't set, so return TRUE
  148. if (floatval($this->min_hours_allowed) == 0) return TRUE; // Either wasn't set or it's set to zero, so return TRUE (possibly delete this line?)
  149. $v = $this->get_fulfilled_hours(true, true, false, $semester_num);
  150. if ($v >= $this->min_hours_allowed) return TRUE; // Our fulfilled number of hours is >= the min_hours of this group.
  151. return FALSE;
  152. }
  153. /**
  154. * We expect the group_id to be our db_group_id + _ + degree_id, to ensure
  155. * that groups are unique to a degree. Let's return just the database group_id portion (the number
  156. * which we can look up in the db groups table with.)
  157. */
  158. function get_db_group_id() {
  159. // We expect our group_id to actually be the db_group_id + _ + degree_id.
  160. $temp = explode("_", $this->group_id);
  161. $db_group_id = trim($temp[0]);
  162. return $db_group_id;
  163. }
  164. function load_group($bool_load_significant_only = true, $array_significant_courses = false, $bool_reload_missing_only = false)
  165. {
  166. $this->load_descriptive_data();
  167. if ($this->db_delete_flag == 1)
  168. {
  169. return;
  170. }
  171. $bool_significant_courses_empty = true;
  172. if (is_array($array_significant_courses))
  173. {
  174. $bool_significant_courses_empty = false;
  175. }
  176. if ($bool_reload_missing_only == true)
  177. {
  178. // We are only going to load the *missing* courses from
  179. // this group. So, begin by getting an array of what is
  180. // not missing.
  181. $array_group_requirement_ids = $this->list_courses->get_group_requirement_id_array();
  182. }
  183. $table_name = "group_requirements";
  184. if ($this->bool_use_draft) {$table_name = "draft_$table_name";}
  185. $res = db_query("SELECT * FROM `$table_name`
  186. WHERE group_id = ? ", $this->get_db_group_id());
  187. while ($cur = db_fetch_array($res))
  188. {
  189. $id = $cur["id"];
  190. $course_id = intval($cur["course_id"]);
  191. // The group requirements table doesn't have a school_id.
  192. //$this->school_id = intval($cur['school_id']);
  193. if ($cur["course_id"]*1 > 0)
  194. {
  195. if ($bool_load_significant_only == true && $bool_significant_courses_empty == false)
  196. {
  197. // If this course_id is NOT in the array of significant courses
  198. // (that the student took or has transfer credit or subs for)
  199. // then skip it. Never add it to the group.
  200. if (isset($array_significant_courses[$cur["course_id"]]) && $array_significant_courses[$cur["course_id"]] != true)
  201. {// course was not in there, so skip!
  202. continue;
  203. }
  204. }
  205. // A course is the next requirement.
  206. // Is this more than XX repeats? If so, we consider it "infinite"
  207. if ($cur['course_repeats'] <= Group::GROUP_COURSE_INFINITE_REPEATS_THRESHOLD) {
  208. // Less than XX repeats, so treat it like a normal course.
  209. for ($t = 0; $t <= $cur["course_repeats"]; $t++)
  210. { // Add in the specified repeats for this group...
  211. // This will usually only go through the loop once.
  212. $use_id = $id . "_rep_$t";
  213. if ($bool_reload_missing_only == true)
  214. {
  215. // Only load this course if it is missing from the group.
  216. // Read the reload_missing_courses() method for an explanation
  217. // of why we should want to do this.
  218. // Basically, check all the courses in the current
  219. // list_courses object for a db_group_requirement_id of $id.
  220. // Only proceed if $id was NOT found.
  221. if (@$array_group_requirement_ids[$use_id] == true)
  222. {
  223. continue;
  224. }
  225. }
  226. $course_c = new Course();
  227. $course_c->bool_use_draft = $this->bool_use_draft;
  228. $course_c->course_id = $cur["course_id"];
  229. $course_c->db_group_attributes = $cur['attributes'];
  230. $course_c->db_group_requirement_id = $use_id;
  231. $course_c->db = $this->db;
  232. $course_c->catalog_year = $this->catalog_year;
  233. $course_c->assigned_to_group_id = $this->group_id;
  234. $course_c->assigned_to_semester_num = $this->assigned_to_semester_num;
  235. $course_c->specified_repeats = $cur["course_repeats"];
  236. if ($cur["course_repeats"] > 0)
  237. {
  238. $course_c->bool_specified_repeat = true;
  239. }
  240. $course_c->min_grade = trim(strtoupper($cur["course_min_grade"]));
  241. if ($course_c->min_grade == "")
  242. { // By default, all courses have a
  243. // min grade requirement of D.
  244. $course_c->min_grade = "D";
  245. }
  246. $this->list_courses->add($course_c);
  247. } // for t <= cur['course_repeats']
  248. }
  249. else {
  250. // We are dealing with a course with "infinite" repeats.
  251. $use_id = $id . "_rep_999";
  252. if ($bool_reload_missing_only == true)
  253. {
  254. // Only load this course if it is missing from the group.
  255. // Read the reload_missing_courses() method for an explanation
  256. // of why we should want to do this.
  257. // Basically, check all the courses in the current
  258. // list_courses object for a db_group_requirement_id of $id.
  259. // Only proceed if $id was NOT found.
  260. if (@$array_group_requirement_ids[$use_id] == true)
  261. {
  262. continue;
  263. }
  264. }
  265. $course_c = new Course();
  266. $course_c->bool_use_draft = $this->bool_use_draft;
  267. $course_c->course_id = $cur["course_id"];
  268. $course_c->db_group_attributes = $cur['attributes'];
  269. $course_c->db_group_requirement_id = $use_id;
  270. $course_c->db = $this->db;
  271. $course_c->catalog_year = $this->catalog_year;
  272. $course_c->assigned_to_group_id = $this->group_id;
  273. $course_c->assigned_to_semester_num = $this->assigned_to_semester_num;
  274. $course_c->specified_repeats = Group::GROUP_COURSE_INFINITE_REPEATS;
  275. $course_c->bool_specified_repeat = true;
  276. $course_c->min_grade = trim(strtoupper($cur["course_min_grade"]));
  277. if ($course_c->min_grade == "")
  278. { // By default, all courses have a
  279. // min grade requirement of D.
  280. $course_c->min_grade = "D";
  281. }
  282. $this->list_courses->add($course_c);
  283. }
  284. } // if cur['course_id']
  285. if ($cur["child_group_id"]*1 > 0)
  286. {
  287. $temp_add_as_new_group = FALSE;
  288. // Another group is the next requirement (its a branch)
  289. if ($bool_reload_missing_only == true)
  290. { // Since we are reloading courses, this subgroup is (probably) already
  291. // part of this group, so do not re-create it, just find it
  292. // and reload it's missing courses.
  293. $temp_g = new Group();
  294. $temp_g->school_id = $this->school_id;
  295. $temp_g->bool_use_draft = $this->bool_use_draft;
  296. $temp_g->group_id = $cur["child_group_id"] . '_' . $this->req_by_degree_id;
  297. $temp_g->requirement_type = $this->requirement_type;
  298. if ($group_g = $this->list_groups->find_match($temp_g)) {
  299. $group_g->reload_missing_courses();
  300. }
  301. else {
  302. // We didn't find the child group, possibly because this is the first time we are loading it. If that is
  303. // the case, then we should just add it fresh.
  304. $temp_add_as_new_group = TRUE;
  305. }
  306. }
  307. else {
  308. $temp_add_as_new_group = TRUE;
  309. }
  310. if ($temp_add_as_new_group) {
  311. // Add this as a brand-new sub group, so create it
  312. // and add it to this group.
  313. $group_g = new Group($cur["child_group_id"] . "_" . $this->req_by_degree_id,null,$this->assigned_to_semester_num, $array_significant_courses, $this->bool_use_draft);
  314. $group_g->requirement_type = $this->requirement_type;
  315. $this->list_groups->add($group_g);
  316. }
  317. } // if child_group_id > 0
  318. } // while cur = db_fetch_array(res)
  319. // When we load this group, let's also check for any hooks.
  320. // Since this class might be used outside of FP, only do this if we know
  321. // that the bootstrap.inc file has been executed.
  322. if ($GLOBALS["fp_bootstrap_loaded"] == TRUE) {
  323. invoke_hook("group_load", array(&$this));
  324. }
  325. } // load_group
  326. function reload_missing_courses()
  327. {
  328. // This function will go through the group and reload
  329. // any courses which are missing from the group object,
  330. // but are spelled out in the database table.
  331. // This is used after we have loaded a group from
  332. // cache (because the cached group only contains
  333. // courses which the student has taken).
  334. $this->load_group(FALSE, FALSE, TRUE);
  335. }
  336. function replace_missing_course($course_id, $db_group_requirement_id="")
  337. {
  338. // replace course_id in this group, if it is missing.
  339. $table_name = "group_requirements";
  340. if ($this->bool_use_draft) {$table_name = "draft_$table_name";}
  341. // Look for all instances of this course in the group's base list...
  342. $res = db_query("SELECT `id`, course_repeats FROM `$table_name`
  343. WHERE group_id = ?
  344. AND course_id = ? ", $this->get_db_group_id(), $course_id);
  345. while ($cur = db_fetch_array($res))
  346. {
  347. $id = $cur["id"];
  348. for ($t = 0; $t <= $cur["course_repeats"]; $t++)
  349. {
  350. $course = new Course($course_id,false,$this->db, false, "", $this->bool_use_draft);
  351. $use_id = $id . "_rep_$t";
  352. // Make sure the group does not already have this requirementID...
  353. if ($this->list_courses->contains_group_requirement_id($use_id))
  354. {
  355. continue;
  356. }
  357. $course->assigned_to_group_id = $this->group_id;
  358. $course->requirement_type = $this->requirement_type;
  359. $course->db_group_requirement_id = $use_id;
  360. $course->db_group_attributes = $cur['attributes'];
  361. $course->specified_repeats = $cur["course_repeats"];
  362. if ($cur["course_repeats"] > 0)
  363. {
  364. $course->bool_specified_repeat = true;
  365. }
  366. $this->list_courses->add($course);
  367. }
  368. }
  369. // Now, go through all of the group's branches and
  370. // do the same thing.
  371. $this->list_groups->reset_counter();
  372. while($this->list_groups->has_more())
  373. {
  374. $g = $this->list_groups->get_next();
  375. $g->replace_missing_course($course_id);
  376. }
  377. }
  378. /**
  379. * Set all the courses and branches in this group to the specified degree_id.
  380. */
  381. function set_req_by_degree_id($degree_id = 0) {
  382. $this->req_by_degree_id = $degree_id;
  383. $this->list_courses->reset_counter();
  384. $this->list_courses->set_req_by_degree_id($degree_id);
  385. // go through sub-groups and do the same...
  386. $this->list_groups->reset_counter();
  387. while($this->list_groups->has_more())
  388. {
  389. $g = $this->list_groups->get_next();
  390. $g->set_req_by_degree_id($degree_id);
  391. }
  392. }
  393. /**
  394. * Sets the requirement type for the group and all its courses (including sub-groups)
  395. */
  396. function set_requirement_type($requirement_type = "") {
  397. $this->requirement_type = $requirement_type;
  398. $this->list_courses->reset_counter();
  399. $this->list_courses->set_requirement_type($requirement_type);
  400. // go through sub-groups and do the same...
  401. $this->list_groups->reset_counter();
  402. while($this->list_groups->has_more())
  403. {
  404. $g = $this->list_groups->get_next();
  405. $g->set_requirement_type($requirement_type);
  406. }
  407. }
  408. function load_descriptive_data()
  409. {
  410. $cur = null;
  411. static $group_descriptive_data_cache = array();
  412. if (isset($group_descriptive_data_cache[$this->get_db_group_id()])) {
  413. $cur = $group_descriptive_data_cache[$this->get_db_group_id()];
  414. }
  415. else {
  416. $table_name = "groups";
  417. if ($this->bool_use_draft) {$table_name = "draft_$table_name";}
  418. // Load information about the group's title, icon, etc.
  419. $res = db_query("SELECT *
  420. FROM `$table_name`
  421. WHERE group_id = ? ", $this->get_db_group_id());
  422. $cur = db_fetch_array($res);
  423. $group_descriptive_data_cache[$this->get_db_group_id()] = $cur;
  424. }
  425. if ($cur) {
  426. $this->title = trim($cur["title"]);
  427. $this->icon_filename = trim($cur["icon_filename"]);
  428. if ($this->icon_filename == "") $this->icon_filename = "major.gif"; // set a default!
  429. $this->group_name = trim($cur["group_name"]);
  430. $this->data_entry_comment = trim((string) $cur["data_entry_comment"]);
  431. $this->priority = trim($cur["priority"]);
  432. $this->definition = trim((string) $cur["definition"]);
  433. $this->db_delete_flag = trim($cur["delete_flag"]);
  434. $this->db_catalog_repeat = trim($cur["catalog_repeat"]);
  435. $this->catalog_year = trim($cur["catalog_year"]);
  436. $this->public_note = trim((string) $cur["public_note"]);
  437. $this->school_id = intval($cur["school_id"]);
  438. }
  439. if ($this->group_id == DegreePlan::GROUP_ID_FOR_COURSES_ADDED)
  440. {
  441. $this->title = "Add an Additional Course";
  442. }
  443. }
  444. function get_fulfilled_hours($bool_check_subgroups = true, $bool_count_advised = true, $bool_require_has_been_displayed = false, $only_count_semester_num = -1, $bool_ignore_enrolled = false, $bool_qpts_grades_only = FALSE, $requirement_type = "", $bool_exclude_all_transfer_credits = FALSE)
  445. {
  446. // Returns how many hours have been used by the
  447. // course fulfillments for this group...
  448. $count = 0;
  449. // if onlyCountSemesterNum != -1, then we will only count courses
  450. // who have their "assigned_to_semester_num" = $only_count_semester_num.
  451. //print_pre($this->to_string());
  452. $this->list_courses->reset_counter();
  453. while($this->list_courses->has_more())
  454. {
  455. $c = $this->list_courses->get_next();
  456. if ($only_count_semester_num != -1 && $c->assigned_to_semester_num != $only_count_semester_num)
  457. {
  458. // Only accept courses assigned to a particular semester.
  459. continue;
  460. }
  461. if (is_object($c->course_list_fulfilled_by) && !($c->course_list_fulfilled_by->is_empty))
  462. {
  463. if ($bool_ignore_enrolled == true)
  464. {
  465. // Only allow it if it has been completed.
  466. if ($c->course_list_fulfilled_by->get_first()->is_completed() == false)
  467. {
  468. continue;
  469. }
  470. }
  471. if (!$bool_require_has_been_displayed)
  472. { // The course does not have to have been displayed on the page yet.
  473. $count = $count + $c->course_list_fulfilled_by->count_credit_hours($requirement_type, false, false, $bool_qpts_grades_only, $bool_exclude_all_transfer_credits);
  474. } else {
  475. if ($c->course_list_fulfilled_by->get_first()->get_has_been_displayed() == true)
  476. {
  477. $h = $c->course_list_fulfilled_by->count_credit_hours($requirement_type, false, false, $bool_qpts_grades_only, $bool_exclude_all_transfer_credits);
  478. $count = $count + $h;
  479. }
  480. }
  481. } else if ($c->bool_advised_to_take && $bool_count_advised == true)
  482. {
  483. $h = $c->get_hours();
  484. $count = $count + $h;
  485. }
  486. }
  487. if ($bool_check_subgroups == true)
  488. {
  489. // If there are any subgroups for this group, then run
  490. // this function for each group as well.
  491. $this->list_groups->reset_counter();
  492. while($this->list_groups->has_more())
  493. {
  494. $g = $this->list_groups->get_next();
  495. $gc = $g->get_fulfilled_hours(true, $bool_count_advised, $bool_require_has_been_displayed, $only_count_semester_num, $bool_ignore_enrolled, $bool_qpts_grades_only, $requirement_type, $bool_exclude_all_transfer_credits);
  496. $count = $count + $gc;
  497. }
  498. }
  499. //if ($this->group_id == 533404) {
  500. //fpm($this);
  501. //fpm("returning $count for group $this->group_id, $this->title");
  502. //}
  503. return $count;
  504. }
  505. /**
  506. * Returns the quality points earned for all of the courses in this group
  507. *
  508. */
  509. function get_fulfilled_quality_points($bool_check_subgroups = true, $only_count_semester_num = -1, $bool_ignore_enrolled = false, $bool_require_has_been_displayed = false, $requirement_type = "", $bool_exclude_all_transfer_credits = FALSE)
  510. {
  511. $points = 0;
  512. // if onlyCountSemesterNum != -1, then we will only count courses
  513. // who have their "assigned_to_semester_num" = $only_count_semester_num.
  514. $this->list_courses->reset_counter();
  515. while($this->list_courses->has_more())
  516. {
  517. $c = $this->list_courses->get_next();
  518. if ($only_count_semester_num != -1 && $c->assigned_to_semester_num != $only_count_semester_num)
  519. {
  520. // Only accept courses assigned to a particular semester.
  521. continue;
  522. }
  523. if (is_object($c->course_list_fulfilled_by) && !($c->course_list_fulfilled_by->is_empty))
  524. {
  525. if ($bool_ignore_enrolled == true)
  526. {
  527. // Only allow it if it has been completed.
  528. if ($c->course_list_fulfilled_by->get_first()->is_completed() == false)
  529. {
  530. continue;
  531. }
  532. }
  533. $p = 0;
  534. // Are we requiring that the course has been displayed?
  535. if (!$bool_require_has_been_displayed || ($bool_require_has_been_displayed && $c->course_list_fulfilled_by->get_first()->get_has_been_displayed() == TRUE))
  536. {
  537. $p = $c->course_list_fulfilled_by->count_credit_quality_points($requirement_type, TRUE, TRUE, $bool_exclude_all_transfer_credits);
  538. }
  539. $points = $points + $p;
  540. }
  541. }
  542. if ($bool_check_subgroups == TRUE)
  543. {
  544. // If there are any subgroups for this group, then run
  545. // this function for each group as well.
  546. $this->list_groups->reset_counter();
  547. while($this->list_groups->has_more())
  548. {
  549. $g = $this->list_groups->get_next();
  550. $gp = $g->get_fulfilled_quality_points(TRUE, $only_count_semester_num, $bool_ignore_enrolled, $bool_require_has_been_displayed, $requirement_type, $bool_exclude_all_transfer_credits);
  551. $points = $points + $gp;
  552. }
  553. }
  554. return $points;
  555. }
  556. function equals(Group $group, $bool_ignore_degree_id = FALSE)
  557. {
  558. $our_group_id = $this->group_id;
  559. $test_group_id = $group->group_id;
  560. if ($bool_ignore_degree_id) {
  561. $our_group_id = $this->get_db_group_id();
  562. $test_group_id = $group->get_db_group_id();
  563. }
  564. if ($our_group_id == $test_group_id)
  565. {
  566. return true;
  567. }
  568. return false;
  569. }
  570. function to_string()
  571. {
  572. $rtn = "";
  573. $rtn .= " Group: $this->group_id | $this->title $this->catalog_year ($this->hours_required hrs req.)\n {\n";
  574. if (!$this->list_courses->is_empty)
  575. {
  576. $rtn .= $this->list_courses->to_string();
  577. }
  578. if (!$this->list_groups->is_empty)
  579. {
  580. $rtn .= $this->list_groups->to_string();
  581. }
  582. $rtn .= " } \n";
  583. return $rtn;
  584. }
  585. function find_courses(Course $course)
  586. {
  587. // Return a CourseList of all the Course objects
  588. // which are in this group that match
  589. $rtn_course_list = new CourseList();
  590. if ($obj_list = $this->list_courses->find_all_matches($course))
  591. {
  592. $obj_list->reset_counter();
  593. while($obj_list->has_more())
  594. {
  595. $c = $obj_list->get_next();
  596. $c->required_on_branch_id = $this->group_id;
  597. }
  598. $rtn_course_list->add_list($obj_list);
  599. return $rtn_course_list;
  600. }
  601. return false;
  602. }
  603. } // end class Group

Classes

Namesort descending Description
Group