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

Classes

Namesort descending Description
Group