Group.php

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

Classes

Namesort descending Description
Group