本文整理汇总了PHP中Test::getAllQuestions方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::getAllQuestions方法的具体用法?PHP Test::getAllQuestions怎么用?PHP Test::getAllQuestions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::getAllQuestions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
function test()
{
$item_id = $_GET['id'];
$test = new Test();
$test->createFromItem($item_id);
$test->questions = $test->getAllQuestions();
$this->set('test', $test);
$this->set('page_title', 'SlideWiki - List of questions for ' . $test->title);
$this->set('page_keywords', 'SlideWiki, questions');
}
示例2: test
function test()
{
$item_id = $_GET['id'];
if (isset($_GET['show_answers'])) {
$show_answers = $_GET['show_answers'];
} else {
$show_answers = 2;
}
$test = new Test();
$test->createFromItem($item_id);
$test->questions = $test->getAllQuestions();
$content = '';
$content .= '<h2>List of questions for ' . $test->title . ' course</h2>';
$questions = $test->questions;
if (count($questions)) {
$content .= '<ol>';
for ($i = 0; $i < count($questions); $i++) {
$content .= '<li>' . $questions[$i]->question . '<br/>';
if ($show_answers) {
foreach ($questions[$i]->answers as $answer) {
if ($show_answers == '2') {
if ($answer['is_right'] == 'yes') {
$content .= '☑ ';
} else {
$content .= '☐ ';
}
} else {
$content .= '☐ ';
}
$content .= $answer['answer'] . '<br/>';
}
}
$content .= '</li>';
}
$content .= '</ol>';
}
$content = '<page style="font-family: freeserif"><br />' . $content . '</page>';
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
//$html2pdf->pdf->SetDisplayMode('real');
$html2pdf->writeHTML($content);
$html2pdf->Output('utf8.pdf');
}
示例3: test
function test()
{
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
$id = 0;
}
if (isset($_GET['type'])) {
$type = $_GET['type'];
} else {
$type = 'auto';
}
if ($type == 'manual' || $type == 'user') {
$type = 'list';
}
$this->set('test_id', $id);
$this->set('type', $type);
if (isset($_GET['limit'])) {
$limit = $_GET['limit'];
} else {
$limit = 0;
}
$this->set('limit', $limit);
if (isset($_GET['mode'])) {
$mode = $_GET['mode'];
} else {
$mode = 1;
}
$this->set('mode', $mode);
$questions = array();
$user_id = $this->getCurrentUserID();
if (isset($_GET['type']) && $type == 'list') {
$test = new QList();
$test->createFromID($id, $limit, $mode);
$questions = $test->questions;
$test->getMaxForUser($user_id);
$attempt = $test->evaluation($limit, $mode, $user_id);
$this->set('test_title', $test->title);
} else {
$test = new Test();
$test->createFromItem($id, $limit, $mode);
$this->set('test_title', $test->title);
$slug_title = $test->sluggify($test->title);
$this->set('slug_title', $slug_title);
//$this->set('deck_slides', $deck->slides);
$attempt = $test->evaluation($limit, $mode, $user_id);
$test->getMaxForUser($user_id);
$questions = $test->getAllQuestions($mode);
}
$this->set('test', json_encode($test));
$this->set('questions', $questions);
$count = count($questions);
$this->set('count', $count);
$this->set('attempt', $attempt);
}