Esempio n. 1
0
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";
    }
}
Esempio n. 2
0
</div>

<div class="content_block">
    <!-- top_title -->
    <div class="top_title">
        <div class="wraper">
            <h2>Student Module    <span>This is a  page for student</span></h2>
            <ul>
                <!--                <li><a href="#">Home</a></li>-->
                <!--                <li><a href="#">Log Out</a></li>-->

                <?php 
session_start();
if ($_SESSION['sid'] != null) {
    echo "<p  style='color: #f9f8f8'>";
    $result = getStudentById($_SESSION['sid']);
    $row = mysql_fetch_array($result);
    echo "Welcome," . $row['nameF'] . " " . $row['nameL'];
    echo "</p>";
} else {
    echo "<a href='../../Login.html' style='color: #f9f8f8'>login</a>";
}
?>
            </ul>
        </div>
    </div>
    <!-- /top_title -->
    <div class="wraper">
        <!-- left_nav -->
        <div class="left_nav" style="border-left:solid 1px gray;border-right:solid 1px gray;height: 550px" >
Esempio n. 3
0
<?php

/**
 * Created by PhpStorm.
 * User: Liu
 * Date: 10/10/2015
 * Time: 1:40 AM
 */
include_once "studentView.php";
include_once "../model/getStudent.php";
include_once "../model/getStu_offering.php";
include_once "../model/getOffering.php";
include_once "../model/getMajor.php";
session_start();
$sid = $_SESSION["sid"];
$result = getStudentById($sid);
$row = mysql_fetch_array($result);
?>
<div style="position:relative; left:100px">
<table border="0" title="student info" width="300" height="100" >
    <tr>
        <td>
            <b>Name:</b>
        </td>
        <td>
            <?php 
echo $row['nameF'] . " ";
echo $row['nameL'];
?>
        </td>
    </tr>
Esempio n. 4
0
function getUntakenCourses($sid)
{
    $result = getStudentById($sid);
    $row = mysql_fetch_array($result);
    $major = $row['major'];
    $result = getAllSubjectsByMajor($major);
    $father = array();
    $son = array();
    while ($row = mysql_fetch_array($result)) {
        array_push($father, $row);
        $subResult = getCoursesExceptTaken($sid, $row['listid']);
        $subSon = array();
        while ($subRow = mysql_fetch_array($subResult)) {
            array_push($subSon, $subRow);
        }
        array_push($son, $subSon);
    }
    $returnValue = array();
    array_push($returnValue, $father);
    array_push($returnValue, $son);
    return $returnValue;
}