Esempio n. 1
0
/*****************************************/
include "config.php";
include "../config.php";
// Clean the data, make sure it only contains possible session information
if (preg_match('/^[a-z0-9]+$/', $_GET["session"])) {
    $session = $_GET["session"];
} else {
    $session = 0;
}
// ************************************************************
// Main Program Logic
// ************************************************************
$moodleId = getMoodleIdFromSession($session);
if (isStudent($moodleId)) {
    if (inCurrentCourse($moodleId) == 1) {
        $studentNumber = getStudentNumber($moodleId);
        $results = checkSurveyStatus($studentNumber);
    } else {
        $results = "0";
    }
} else {
    $results = "0";
}
echo $results;
// **************************************************************
// Supporting Functions
// **************************************************************
function getStudentNumber($moodleId)
{
    // Gets the WOSC Student ID number from the Moodle Database.
    global $CFG;
include "../config.php";
// Clean the data, make sure it only contains possible session information
if (preg_match('/^[a-z0-9]+$/', $_GET["session"])) {
    $session = $_GET["session"];
} else {
    $session = 0;
}
// ************************************************************
// Main Program Logic
// ************************************************************
global $LIME;
$jsonString = new StdClass();
$moodleId = getMoodleIdFromSession($session);
$jsonString->studentSurvey = 0;
$jsonString->nursingSurvey = 0;
$jsonString->studentNumber = str_replace('-', '', getStudentNumber($moodleId));
if (isStudent($moodleId)) {
    //	$jsonString->debug = $jsonString->debug . " & " . "is student";
    if (inCurrentCourse($moodleId) == 1 && $LIME->surveystatus == 1) {
        if (checkSurveyStatus($jsonString->studentNumber)) {
            $tc = getCurrentCourseFilter();
            $tc = substr($tc, 2);
            $jsonString->studentSurvey = $tc;
        }
    }
}
if (inNursingCourse($moodleId) && $LIME->nurse_surveystatus == 1) {
    #                $jsonString->debug = $jsonString->debug . " & " . " is In NursinCourse";
    //echo hasTakenNursingSurvey($jsonString->studentNumber);
    if (hasTakenNursingSurvey($jsonString->studentNumber) == false) {
        $jsonString->nursingSurvey = getNursingCourse($moodleId);