function getKasiPlan($semesters, $sid) { //$plannerId = 1; //echo $semesters; //echo $sid; $AllCourse = array(); $selectedCourse = array(); $creditsList = array(); //$result=getPlannerBySid($sid,$plannerId); //while($row=mysql_fetch_array($result)){ // array_push($AllCourse,$row); //} $major = mysql_fetch_array(getStudentById($sid))['major']; $result = getAllSubjectsByMajor($major); while ($row = mysql_fetch_array($result)) { array_push($creditsList, $row); $listid = $row['listid']; $subResult = getListByListID($listid); while ($subRow = mysql_fetch_array($subResult)) { array_push($AllCourse, $subRow); } } // return $AllCourse; session_start(); $_SESSION['creditsList'] = $creditsList; $returnResult = array(); for ($i = 0; $i < $semesters; $i++) { $eachLevel = array(); // echo "xx<br>"; foreach ($AllCourse as $key => $value) { $row = mysql_fetch_array(getCourseById($value['cid'])); $value['offerTime'] = $row['offerTime']; if (checkPrerequisites($value['cid'], $selectedCourse)) { if ($i == 0) { $value[5] = "true"; $value['available'] = "true"; } else { $value[5] = "false"; $value['available'] = "false"; } array_push($eachLevel, $value); //array_push($selectedCourse, $value['cid']); unset($AllCourse[$key]); } } foreach ($eachLevel as $value) { array_push($selectedCourse, $value['cid']); for ($ii = 0; $ii < count($creditsList); $ii++) { if ($creditsList[$ii]['listid'] == $value['listid']) { $creditsList[$ii]['credits'] -= $value['credits']; break; } } } // print_r($eachLevel); array_push($returnResult, $eachLevel); // echo "<br>"; } $flag = true; for ($i = 0; $i < count($creditsList); $i++) { // echo $creditsList[$i]['credits']."<br>"; if ($creditsList[$i]['credits'] > 0) { $flag = false; } } if ($flag == true) { session_start(); $_SESSION['semesters'] = $returnResult; // $_SESSION['creditsList']=$creditsList; return $returnResult; } else { session_start(); $_SESSION['semesters'] = "error"; // $_SESSION['creditsList']=$creditsList; return "error"; } }
<?php /** * Created by PhpStorm. * User: Liu * Date: 10/9/2015 * Time: 11:40 PM */ include_once "studentView.php"; include_once "../model/getCourse.php"; include_once "../model/getOffering.php"; $cid = $_GET['cid']; $result = getCourseById($cid); $row = mysql_fetch_array($result); echo "<br/>"; echo "<br/>"; echo "<br/>"; $lab = $row['lab']; //will do it later; $sid = "1"; echo "<br/>"; $result = getOfferingByCid($cid); ?> <form action="displaySelectResult.php" method="post"> <div style="position:relative; left:100px"> <?php echo $row['cid']; ?> <table border="1"> <tr height="45"> <th>Class Number</th>
<?php /** * Created by PhpStorm. * User: Liu * Date: 2015/12/8 * Time: 18:23 */ include_once "getCourse.php"; $cid = $_GET['cid']; $response = "xxx"; $row = mysql_fetch_array(getCourseById($cid)); $response = "<p style='font-weight: bolder'>" . $row['title'] . "</p>" . $row['description'] . "<br> <span style='font-weight: bold'>Offered: </span>" . $row['offerTime']; echo $response;
$result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); $Course_Date->modify('+1 day'); $Course_Date->setTime(8, 30); } if ($result == true) { getSuccessCreateResponse('Dates Inserted Successfully', $Student_Cost); } else { getErrorResponse("Date add Failed!"); } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'ADD') { $StudentNo = $_REQUEST['StudentNo']; $Receipt_No = getnextReceiptNo(); $Course_No = $_REQUEST['Course_No']; $Salesperson_No = strtoupper($_REQUEST['Salesperson_No']); $Course_Details = getCourseById($Course_No); $Lessons = getCourseDetails($Course_No); $GST_Amt = getCourseGSTAmt($Course_Details["Course_Cost"]); $Student_Cost = $Course_Details["Course_Cost"]; if ($Course_Details["Ex_GST"] == "YES") { $Student_Cost = $Student_Cost + $GST_Amt; } $first_row = true; for ($i = 0; $i < count($Lessons); $i++) { $query = 'insert into Course_Bookings (StudentNo, Receipt_No, Booking_Date, Course_No, Lesson_No, Balance, Salesperson_No) values (' . $StudentNo . ', ' . $Receipt_No . ', now(),' . $Course_No . ', ' . $Lessons[$i] . ', '; if ($first_row == true) { $query = $query . $Course_Details["Course_Cost"] . ', "' . $Salesperson_No . '")'; $first_row = false; } else { $query = $query . '0, "' . $Salesperson_No . '")'; }