function _FlightPath::flag_outdated_substitutions
Search API
4.x _FlightPath.php | _FlightPath::flag_outdated_substitutions() |
5.x _FlightPath.php | _FlightPath::flag_outdated_substitutions() |
File
- classes/
_FlightPath.php, line 325
Class
Code
function flag_outdated_substitutions()
{
// Go through the student's substitutions and flag ones that
// do not apply to this degree plan. Also, unset any bool_substitution
// variables which were set.
$this->student->list_substitutions->reset_counter();
while ($this->student->list_substitutions->has_more())
{
$substitution = $this->student->list_substitutions->get_next();
$required_group_id = $substitution->course_requirement->assigned_to_group_id;
// First check-- does this degree even have this group ID?
$outdated_note = "";
if ($required_group_id == 0)
{
// bare degree plan.
// Does the bare degree plan list the course_requirement
// anywhere?
$bool_sub_valid = false;
$this->degree_plan->list_semesters->reset_counter();
while ($this->degree_plan->list_semesters->has_more() && $bool_sub_valid == false)
{
$sem = $this->degree_plan->list_semesters->get_next();
if ($sem->list_courses->find_match($substitution->course_requirement))
{
$bool_sub_valid = true;
}
else {
// Could not find the course requirement in question.
$bool_sub_valid = false;
$scr = $substitution->course_requirement;
$scr->load_descriptive_data();
$outdated_note = "This substitution is for the course $scr->subject_id
$scr->course_num (id: $scr->course_id) on the
bare degree plan, but the student's current degree does
not specify this course.";
}
}
}
else {
// requiredGroupID != 0. So, does this
// degree plan have a group with this id?
$bool_sub_valid = false;
if ($g = $this->degree_plan->find_group($required_group_id))
{
$bool_sub_valid = true;
}
else {
// Could not find the group in question. Add an "outdated_note"
// to the sub...
$bool_sub_valid = false;
$new_group = new Group();
$new_group->group_id = $required_group_id;
$new_group->load_descriptive_data();
$group_name = "";
if (user_has_permission("can_access_data_entry")) {
// only show if we are a data entry administrator.
$group_name = "<i>$new_group->group_name,</i>";
}
$outdated_note = "This substitution is for the group $new_group->title
(id: $new_group->group_id, $group_name $new_group->catalog_year),
but the student's current degree does not call for this
specific group.";
}
}
if ($bool_sub_valid == false)
{
// Couldn't find a match, so remove this sub!
$substitution->bool_outdated = true;
$substitution->outdated_note = $outdated_note;
$substitution->course_list_substitutions->get_first()->bool_outdated_sub = true;
$substitution->course_list_substitutions->get_first()->bool_substitution = false;
if ($substitution->course_list_substitutions->get_first()->temp_old_course_id > 0)
{ // Restore the course_id *if* it was set to 0 on purpose. (happens
// when there is a sub of a transfer to kill the transfer eqv. This will
// restore it).
$substitution->course_list_substitutions->get_first()->course_id = $substitution->course_list_substitutions->get_first()->temp_old_course_id;
}
}
}
}