function requiredcourses($student_details) { $predatabase = studentcurriculum($student_details['student_id']); $req_databasename = $predatabase . "_req_courses"; $foundation_databasename = $predatabase . "_foundation_courses"; $prereq_databasename = $predatabase . "_prereq_courses"; $stu_completed = completedcourses($student_details['student_id']); $stu_foundation = select_foundation($student_details['student_id']); $all_req = getRequiredCourses($req_databasename); $totalElective = completedElective($student_details['student_id']); $req_set = courseset($student_details['student_id'], $req_databasename); $foundation_set = courseset($student_details['student_id'], $foundation_databasename); //print_r($foundation_set); //$all_foundation= getFoundationCourses($foundation_databasename); $all_req_loop = sizeof($all_req); $stu_req = ""; $stu_req_foundation = ""; $temp = ""; $t = 0; $req_count = 0; $stu_foundation_count = 0; $stu_completed_temp = $stu_completed; //echo "$totalElective"; for ($i = 0; $i < $all_req_loop; $i++) { for ($j = 0; $j < sizeof($stu_completed); $j++) { if (!empty($all_req[$i]['course_code']) && $totalElective != 0) { if (strpos($all_req[$i]['course_code'], "GCIS ELE") !== false) { $totalElective--; unset($all_req[$i]); break 1; } } if (!empty($all_req[$i]['course_code'])) { if ($all_req[$i]['course_code'] == $stu_completed[$j]['course_code']) { unset($all_req[$i]); break 1; } elseif ($all_req[$i]['course_set'] != 0) { if (in_array($all_req[$i]['course_set'], $req_set)) { unset($all_req[$i]); break 1; } } } } if (!empty($all_req[$i]['course_code'])) { $prereq_count = 0; $stu_req[$req_count]['course_code'] = $all_req[$i]['course_code']; if (empty($stu_req[$req_count]['course_code'])) { $stu_req[$req_count]['course_type'] = "REQUIRED"; } $stu_req[$req_count]['credit'] = $all_req[$i]['credit']; $stu_req[$req_count]['course_ava'] = $all_req[$i]['course_ava']; $stu_req[$req_count]['course_set'] = $all_req[$i]['course_set']; $all_prereq = studentprereqsubject($prereq_databasename, $stu_req[$req_count]['course_code']); $all_prereq2 = $all_prereq; $all_prereq_loop = sizeof($all_prereq); /*print_r($all_prereq); echo "<pre>";*/ //echo $all_prereq_loop; for ($a = 0; $a < $all_prereq_loop; $a++) { //echo $a; //echo "all prerew course code ".$all_prereq[$a]['course_code']."<br>"; for ($b = 0; $b < sizeof($stu_completed); $b++) { if (!empty($all_prereq[$a]['course_code'])) { if ($all_prereq[$a]['course_code'] == $stu_completed[$b]['course_code']) { unset($all_prereq[$a]); break 1; } } } if (!empty($all_prereq[$a]['course_code'])) { //echo "<br><br>$prereq_count<br><br> "; //echo $all_prereq[$a]['course_code']; $stu_req[$req_count]['prereq'][$prereq_count]['course_code'] = $all_prereq[$a]['course_code']; $stu_req[$req_count]['prereq'][$prereq_count]['set'] = $all_prereq[$a]['course_set']; $prereq_count++; unset($all_prereq[$a]); } } unset($all_req[$i]); $req_count++; } } $loop = sizeof($stu_req); $orgroup = array(); for ($d = 0; $d < $loop; $d++) { //echo "<pre> $d";print_r($stu_req); if (!empty($stu_req[$d])) { if (array_key_exists('prereq', $stu_req[$d])) { $loop2 = sizeof($stu_req[$d]['prereq']); //print_r($stu_req[$d]['prereq']); for ($e = 0; $e < $loop2; $e++) { //echo "<br> ".$stu_req[$d]['prereq'][$e]['set']; if ($stu_req[$d]['prereq'][$e]['set'] == 3) { //echo "number 3 <br> "; } elseif ($stu_req[$d]['prereq'][$e]['set'] == 1) { // echo "number 1 <br> "; } elseif ($stu_req[$d]['prereq'][$e]['set'] == 2 || $stu_req[$d]['prereq'][$e]['set'] == 0) { // echo "number 2 and 0<br> "; //echo $stu_req[$d]['prereq'][$e]['course_code']; $prereq_group = studentprereqsubject($prereq_databasename, $stu_req[$d]['course_code']); if (!empty($prereq_group)) { $loop3 = sizeof($prereq_group); $g = 0; for ($f = 0; $f < $loop3; $f++) { if ($prereq_group[$f]['course_set'] == 3 || $prereq_group[$f]['course_set'] == 1) { // echo $prereq_group[$f]['course_code']."3 or 1 set <br>" ; } elseif ($prereq_group[$f]['course_set'] == 0 || $prereq_group[$f]['course_set'] == 2) { if ($f == 0) { if ($prereq_group[$f]['course_set'] == 2) { $orgroup[$d]['req_course_code'] = $stu_req[$d]['course_code']; $orgroup[$d][$g]['course_code'] = $prereq_group[$f]['course_code']; $g++; } } else { if ($prereq_group[$f - 1]['course_set'] == 2 && $prereq_group[$f]['course_set'] == 2) { $orgroup[$d]['req_course_code'] = $stu_req[$d]['course_code']; $orgroup[$d][$g]['course_code'] = $prereq_group[$f]['course_code']; $g++; } elseif ($prereq_group[$f - 1]['course_set'] == 2 || $prereq_group[$f]['course_set'] == 0) { $orgroup[$d]['req_course_code'] = $stu_req[$d]['course_code']; $orgroup[$d][$g]['course_code'] = $prereq_group[$f]['course_code']; $g++; } } } } } //echo"d =$d e=$e". $stu_req[$d]['prereq'][$e]['course_code']."<pre>";; //echo "student".$stu_req[$d]['prereq'][$e]['course_code']."<br>"; if (!empty($orgroup[$d])) { /*echo "orgroup <pre>"; print_r($orgroup[$d]); echo "student prereq list <pre>"; print_r($stu_req[$d]['prereq']);*/ //echo "<pre>".$stu_req[$d]['prereq'][$e]['course_code']; //print_r(array_column($orgroup[$d],'course_code')); //print_r($orgroup[$d]); $loop4 = sizeof($orgroup[$d]); for ($g = 0; $g < $loop4; $g++) { $loop5 = sizeof($stu_completed_temp); for ($h = 0; $h < $loop5; $h++) { if (!empty($orgroup[$d][$g]['course_code'])) { if ($stu_completed_temp[$h]['course_code'] == $orgroup[$d][$g]['course_code']) { unset($stu_req[$d]['prereq'][$e]); } } } /*if(in_array($stu_req[$d]['prereq'][$e]['course_code'],array_column($orgroup[$d],'course_code'))){ //unset($stu_req[$d]['prereq'][$e]); //echo "yes is in array ".$stu_req[$d]['prereq'][$e]['course_code']."<br>"; } else{ unset($stu_req[$d]['prereq'][$e]); }*/ } } } } } } } /*echo "stu_foundation"; print_r($stu_foundation);*/ $all_foundation_loop = sizeof($stu_foundation); for ($i = 0; $i < $all_foundation_loop; $i++) { for ($j = 0; $j < sizeof($stu_completed); $j++) { if (!empty($stu_foundation[$i]['course_code'])) { if ($stu_foundation[$i]['course_code'] == $stu_completed[$j]['course_code']) { unset($stu_foundation[$i]); break 1; } elseif ($stu_foundation[$i]['course_set'] != 0) { if (in_array($stu_foundation[$i]['course_set'], $foundation_set)) { //echo "deadepool"; unset($stu_foundation[$i]); break 1; } } } } if (!empty($stu_foundation[$i]['course_code'])) { if ($stu_foundation[$i]['course_status'] == "REQ") { $foundation_details = getFoundationCourseFromCoursecode($foundation_databasename, $stu_foundation[$i]['course_code']); $stu_req_foundation[$stu_foundation_count]['course_code'] = $foundation_details[0]['course_code']; if (!empty($stu_req[$req_count]['course_code'])) { $stu_req_foundation[$stu_foundation_count]['course_type'] = "FOUNDATION"; } $stu_req_foundation[$stu_foundation_count]['credit'] = $foundation_details[0]['credit']; $stu_req_foundation[$stu_foundation_count]['course_ava'] = $foundation_details[0]['course_ava']; $stu_req_foundation[$stu_foundation_count]['course_set'] = $foundation_details[0]['course_set']; $stu_foundation_count++; } unset($all_req[$i]); } } /*echo "<pre>"; print_r($stu_req[0]['prereq']);*/ /*echo "orgroup <pre>"; print_r($orgroup);*/ $result['foundation'] = $stu_req_foundation; $result['required'] = $stu_req; /*echo "student req <pre>"; print_r($result);*/ return $result; }
include 'includes/function.php'; //include('includes/session_define.php'); include 'includes/session_define.php'; include 'includes/header.php'; include 'includes/menu.php'; if (!isset($_SESSION['student_list'])) { redirect_to("add_student_details.php"); } //echo "<pre>"; //print_r($_SESSION['student_list']); $values = $_SESSION['student_list']; $predatabase = studentcurriculum($values[0]['student_id']); $req_databasename = $predatabase . "_req_courses"; $foundation_database = $predatabase . "_foundation_courses"; $number_of_student = sizeof($values); $all_req = getRequiredCourses($req_databasename); $all_foundation = getFoundationCourses($foundation_database); //print_r($all_req); //echo "number of student $number_of_student"; ?> <div id="page" class="container"> <div id="add_student_wrapper"> <div id="add_student_title"> <?php $next_semester = next_semester(); ?> <h1> Multiple Student Report For <?php echo $next_semester[1] . " "; ?>