Example #1
0
        if (strpos($key, "_ELECT") !== FALSE and $val != '---') {
            array_push($coursesToTake, $val);
        }
    }
}
$degree = $_SESSION['degree'];
$term = $_SESSION['registering_semester'];
$year_status = $_SESSION['registering_year'];
//get database object
$db = new Database("sysc4504");
$formattedCoursesToTake = "(";
foreach ($coursesToTake as $course) {
    $formattedCoursesToTake = $formattedCoursesToTake . "'" . $course . "',";
}
$formattedCoursesToTake = rtrim($formattedCoursesToTake, ",") . ")";
$courses_array = $db->getNameSectionPairs($formattedCoursesToTake, $term);
$t1 = pickCourses($coursesToTake[0], $coursesToTake, array(), $courses_array);
$maxLength = 0;
foreach ($t1 as $solution) {
    if (sizeof($solution) > $maxLength) {
        $maxLength = sizeof($solution);
    }
}
//only get the largest solutions
$updatedSolutions = array();
foreach ($t1 as $solution) {
    if (sizeof($solution) == $maxLength) {
        array_push($updatedSolutions, $solution);
    }
}
/*