Esempio n. 1
1
function getAnswers($qAmt, $qTopics)
{
    global $questionGenerator;
    global $qSeed;
    global $qArr;
    global $sAnsArr;
    global $ansList;
    global $sAnsCorrectness;
    global $score;
    generateQuestions($qAmt, $qTopics);
    for ($i = 0; $i < count($qArr); $i++) {
        if ($sAnsArr[$i][0] == UNANSWERED) {
            $sAnsCorrectness[$i] = false;
            $ansList[] = $questionGenerator[$qArr[$i]->qTopic]->getAnswer($qArr[$i], $sAnsArr[$i]);
            continue;
        } else {
            if ($sAnsArr[$i][0] == NO_ANSWER) {
                $sAnsArr[$i] = array();
            }
        }
        $sAnsCorrectness[$i] = $questionGenerator[$qArr[$i]->qTopic]->checkAnswer($qArr[$i], $sAnsArr[$i]);
        if ($sAnsCorrectness[$i]) {
            $ansList[] = CORRECT;
        } else {
            $ansList[] = $questionGenerator[$qArr[$i]->qTopic]->getAnswer($qArr[$i], $sAnsArr[$i]);
        }
    }
}
     $query = 'SELECT * FROM constructions WHERE con_number="' . $construction_number . '" AND active="1" AND category="' . $construction_type . '"';
     $result = mysqli_query($link, $query) or die(mysqli_error($link));
     $construction_id = 0;
     $construction_name = '';
     $construction_questions = '';
     $construction_number = 0;
     if (mysqli_num_rows($result) > 0) {
         while ($row = mysqli_fetch_object($result)) {
             $construction_id = $row->id;
             $construction_number = $row->con_number;
             $construction_name = $row->name;
             $construction_questions = $row->question_ids;
         }
         $html .= generateMenu($construction_name, $construction_number);
         $html .= '~??~??~';
         $html .= generateQuestions($construction_id, $construction_questions, $construction_number);
         echo $html;
     } else {
         echo 'Error';
         return;
     }
     mysqli_close($link);
 } else {
     if (isset($_GET['sendQuestionnaire']) && $_GET['sendQuestionnaire'] > 0) {
         $link = mysqli_connect($host, $username, $pw, $db) or die('could not connect to database');
         $sendQuestionnaire = $_GET['sendQuestionnaire'];
         $name = $_GET['name'];
         $type = $_GET['type'];
         $conNr = $_GET['conNr'];
         $answers = $_GET['answers'];
         $isConstruction = 0;
Esempio n. 3
0
generateQuestions("M");
?>
                <?php 
generateMilestones();
?>
            </section>

            <!-- Content for evaluation page -->
            <section style="margin-top: 25px;">
                <h1> Evaluation </h1>
                <textarea name="evaluation" class="rta"> <?php 
echo $evaluate;
?>
 </textarea>
                <?php 
generateQuestions("E");
?>
            </section>
        </form>

        <?php 
/* If there are no errors, update the database. */
if (!$errors && !empty($_POST)) {
    /* Insert or update project information */
    $sql = 'SELECT * from projects where id = "' . $projectid . '"';
    $result = $db->query($sql);
    if ($result && $result->num_rows > 0) {
        $row = $result->fetch_assoc();
        if ($user->id() == $row["user"]) {
            $sql = 'UPDATE projects SET ' . '        name="' . $projectname . '", ' . 'introduction="' . $introduction . '", ' . '       plan="' . $plan . '", ' . '    monitor="' . $monitor . '", ' . '   evaluate="' . $evaluate . '" ' . '   WHERE id=' . $projectid;
        } else {