예제 #1
0
function checkPrerequisites($cid, $selectedCourse)
{
    $prerequisites = getPrerequisitesStringByCid($cid);
    //echo $prerequisites;
    $array = transPreToCNF($prerequisites);
    //print_r($array);
    // $error=array();
    $count = 0;
    $error = "";
    if ($prerequisites != null) {
        for ($i = 0; $i < count($array); $i++) {
            //1.将array[$i]中的or 解析出来,放在新数组中
            $orArray = divOrStringIntoArray($array[$i]);
            //2.将这个数组放入profile里面进行查询,返回T or F
            //print_r($orArray);
            //3. 返回F就给$error赋值,否则继续
            if (!isInStu_offering($orArray)) {
                if (!isInSelectedCourse($orArray, $selectedCourse)) {
                    $error .= echoOrString($orArray) . "\n";
                    $count++;
                }
            }
        }
    }
    if ($count != 0) {
        return $error;
    } else {
        return "true";
    }
}
예제 #2
0
파일: getPlan.php 프로젝트: ukmyjn889/test2
function checkPrerequisites($cid)
{
    $prerequisites = getPrerequisitesStringByCid($cid);
    //echo $prerequisites;
    $array = transPreToCNF($prerequisites);
    //print_r($array);
    $error = array();
    $count = 0;
    $error[$count] = null;
    if ($prerequisites != null) {
        for ($i = 0; $i < count($array); $i++) {
            //1.将array[$i]中的or 解析出来,放在新数组中
            $orArray = divOrStringIntoArray($array[$i]);
            //2.将这个数组放入profile里面进行查询,返回T or F
            //print_r($orArray);
            //3. 返回F就给$error赋值,否则继续
            if (!isInStu_offering($orArray)) {
                $error[$count] = $array[$i];
                $count++;
            }
        }
    }
    if ($count != 0) {
        return false;
    } else {
        return true;
    }
}
예제 #3
0
 * User: Liu
 * Date: 10/10/2015
 * Time: 4:36 AM
 */
include_once "studentView.php";
include_once "../model/checkPrerequisites.php";
include_once "../model/getStu_offering.php";
include_once "../model/getOffering.php";
session_start();
$sid = $_SESSION['sid'];
$cid = $_POST['cid'];
$lecOid = $_POST['lec'];
$labOid = $_POST['lab'];
$prerequisites = getPrerequisitesStringByCid($cid);
//echo $prerequisites;
$array = transPreToCNF($prerequisites);
//print_r($array);
$error = array();
$count = 0;
$error[$count] = null;
if ($prerequisites != null) {
    for ($i = 0; $i < count($array); $i++) {
        //1.将array[$i]中的or 解析出来,放在新数组中
        $orArray = divOrStringIntoArray($array[$i]);
        //2.将这个数组放入profile里面进行查询,返回T or F
        //print_r($orArray);
        //3. 返回F就给$error赋值,否则继续
        if (!isInStu_offering($orArray)) {
            $error[$count] = $array[$i];
            $count++;
        }