<?php $db = new models\tkDatabase($GLOBALS['config']['db']); $tk_level = models\tkLesson::tk_lessons_level($db); if (isset($_POST['submit2'])) { // echo "<pre>"; // print_r($_POST); // echo "</pre>"; if (!empty($_POST['lesson_level'])) { $lesson_level = models\tkLesson::tk_get_level_id(['level' => $_POST['lesson_level']], $db); } if (isset($_POST['joins']) && isset($_POST['selections'])) { models\tkTest::tk_add_test(['lesson_level_id' => $lesson_level['id'], 'title' => $_POST['test_title'], 'questions' => implode('|', $_POST['question_body']), 'answers' => implode('|', $_POST['selections']), 'joins' => implode('|', $_POST['joins'])], $db); } elseif (!isset($_POST['joins'])) { models\tkTest::tk_add_test(['lesson_level_id' => $lesson_level['id'], 'title' => $_POST['test_title'], 'questions' => implode('|', $_POST['question_body']), 'answers' => implode('|', $_POST['selections']), 'joins' => ""], $db); } } include $GLOBALS['config']['site']['basedir'] . '/templates/tkadministrator/add_test.tmpl.php';
<?php $db = new models\tkDatabase($GLOBALS['config']['db']); $tk = models\tkTest::tk_get_test(['id' => $_GET['test_id']], $db); echo "<pre>"; print_r($tk); echo "</pre>"; include $GLOBALS['config']['site']['basedir'] . '/templates/site/test.tmpl.php';
<?php // session_destroy(); $db = new models\tkDatabase($GLOBALS['config']['db']); $tk = models\tkTest::tk_tests_list($db); // echo "<pre>"; // print_r($tk); // echo "</pre>"; include $GLOBALS['config']['site']['basedir'] . '/templates/site/tests.tmpl.php';