コード例 #1
0
ファイル: result.php プロジェクト: rmit-s3443163-quan-do/its
<?php

/**
 * Created by PhpStorm.
 * User: JayDz
 * Date: 10/07/15
 * Time: 12:02 AM
 */
require_once './controller/QuestionCtrl.php';
$pre = QuestionCtrl::getRes(1);
$post = QuestionCtrl::getRes(2);
$pre_total = 0;
$pre_mark = 0;
$pre_correct = 0;
foreach ($pre as $p) {
    $pre_total += $p->getPoint();
    $pre_mark += $p->getMark();
    if ($p->getMark() > 0) {
        $pre_correct++;
    }
}
$post_total = 0;
$post_mark = 0;
$post_correct = 0;
foreach ($post as $p) {
    $post_total += $p->getPoint();
    $post_mark += $p->getMark();
    if ($p->getMark() > 0) {
        $post_correct++;
    }
}
コード例 #2
0
/**
 * Created by PhpStorm.
 * User: JayDz
 * Date: 10/07/15
 * Time: 12:02 AM
 */
require_once './controller/QuestionCtrl.php';
$done4 = QuestionCtrl::isDone(4);
$c = 1;
if (isset($_GET['c']) && $_GET['c'] != '') {
    $c = $_GET['c'];
    if ($c != 1 && $c != 2) {
        $c = 1;
    }
}
$arr = QuestionCtrl::getRes($c);
$total = 0;
$mark = 0;
$correct = 0;
foreach ($arr as $p) {
    $total += $p->getPoint();
    $mark += $p->getMark();
    if ($p->getMark() > 0) {
        $correct++;
    }
}
$q_arr = QuestionCtrl::getQuestionsByCategory($c);
$type = 'Pre-Test Result';
if ($c == 2) {
    $type = 'Post-Test Result';
}