예제 #1
0
//QuestionCtrl::addOption(new Option(2,'Low coupling and Low Cohesion',false));
//QuestionCtrl::addOption(new Option(2,'High coupling and High Cohesion',false));
//QuestionCtrl::addOption(new Option(2,'High Coupling and Low Cohesion',false));
//QuestionCtrl::addOption(new Option(2,'Low Coupling and High Cohesion',true));
//$arr = QuestionCtrl::getQuestionsByCategory(1);
//
//foreach ($arr as $q) {
//    echo $q['id']. ' - '. $q['title'] . '<br>';
//    $opts = QuestionCtrl::getOptionsByID($q['id']);
//
//    foreach ($opts as $o) {
//        echo $o['id'] . ' - ' . $o['title'] . ' - ' . $o['isCorrect'] . '<br>';
//    }
//    echo '<br>';
//}
$q = QuestionCtrl::get(7);
?>

<h2>POST DATA</h2>
<pre>
<?php 
echo htmlspecialchars_decode($q->getOpts()[0]->getText());
echo htmlspecialchars_decode($q->getOpts()[1]->getText());
echo htmlspecialchars_decode($q->getOpts()[2]->getText());
echo htmlspecialchars_decode($q->getOpts()[3]->getText());
?>
</pre>
<!--<pre>-->
<?php 
//echo htmlspecialchars($_POST['opt4']);
?>
예제 #2
0
//echo '<br><br><br><br>';
//foreach ($_POST as $key => $value) {
//    echo $key.': '.$value.'<br>';
//}
$type = $_POST['type'];
$cate = htmlspecialchars($_POST['cate']);
$point = htmlspecialchars($_POST['point']);
$title = htmlspecialchars($_POST['title']);
$explain = htmlspecialchars($_POST['explain']);
if ($type == 'add') {
    $q_tmp = new Question($cate, $point, $title, $explain);
    $qid = QuestionCtrl::addQuestion($q_tmp);
} else {
    if ($type == 'update') {
        $qid = htmlspecialchars($_POST['qid']);
        $q_tmp = QuestionCtrl::get($qid);
        if ($title != '') {
            $q_tmp->setTitle($title);
        }
        if ($explain != '') {
            $q_tmp->setExplain($explain);
        }
        $q_tmp->setId($qid);
        QuestionCtrl::updateQuestion($q_tmp);
    }
}
if ($qid > 0) {
    foreach ($_POST as $key => $value) {
        $param_name = 'o::';
        if (substr($key, 0, strlen($param_name)) == $param_name) {
            if (strlen($value) > 0) {
예제 #3
0
        }
        $ok = '';
    }
}
$submit = 'Save';
$text = 'added';
$text_css = 'success';
$title = 'New Question';
if (isset($_GET['id']) && $_GET['id'] != '') {
    $id = $_GET['id'];
    $link = '&id=' . $id;
    $text = 'updated';
    $text_css = 'info';
    $submit = 'Update';
    $title = 'Update Question';
    $q = QuestionCtrl::get($id);
}
?>

<form action="admin.php?p=10<?php 
echo $link;
?>
" method="post" enctype="multipart/form-data" onsubmit="return postForm()">
    <input type="hidden" name="ques_id" value="<?php 
echo $id;
?>
"/>
    <h2 class="page-header"><?php 
echo $title;
?>
</h2>
예제 #4
0
 /**
  * @return bool
  * @param int $id
  */
 public static function check($id, $s)
 {
     if (QuestionCtrl::has($id)) {
         return QuestionCtrl::get($id)->checkRs($s);
     } else {
         return false;
     }
 }
예제 #5
0
require_once './controller/QuestionCtrl.php';
QuestionCtrl::init();
$b = true;
if (isset($_POST['s']) && $_POST['s'] != '') {
    $b = false;
    $s = $_POST['s'];
    $q = $_POST['q'];
    if (QuestionCtrl::check($q, $s)) {
        echo 'okkkk::' . QuestionCtrl::get($q)->getExplain() . '::';
    } else {
        echo 'wrong::' . QuestionCtrl::get($q)->getExplain() . '::' . QuestionCtrl::get($q)->getRs() . '::';
    }
} else {
    $q = isset($_GET['q']) ? $_GET['q'] : 1;
    $cont = QuestionCtrl::get($q);
}
if ($b) {
    ?>
<div class="clear-top"></div>
<div class="container">
    <h4>
        <span class="label label-warning pull-left">
            Question <?php 
    echo $q;
    ?>
 of <?php 
    echo QuestionCtrl::size();
    ?>
:
        </span>