} catch (Exception $e) { handleAjaxExceptions($e); } } break; default: if (isset($_GET['confirm'])) { //The user specified himself the size of the test if ($test->options['user_configurable']) { //Get the size of the test, so that we can verify that the value specified is at most equal to it $test->getQuestions(); //This way the test's questions are populated, and we will be needing this information if (empty($test->options['random_test'])) { $test->options['random_pool'] && $test->options['random_pool'] <= sizeof($test->questions) ? $questionsNumber = $test->options['random_pool'] : ($questionsNumber = sizeof($test->questions)); } else { $questionsNumber = $test->getNumQuestionsForRandomTests(); } //Assigning the 'user_configurable' value to the 'random_pool' option gives us a test instance with the appropriate number of questions if (is_numeric($_GET['user_configurable']) && $_GET['user_configurable'] <= $questionsNumber && $_GET['user_configurable'] > 0) { $test->options['random_pool'] = $_GET['user_configurable']; } else { if (!isset($_GET['user_configurable']) || !$_GET['user_configurable']) { eF_redirect(basename($_SERVER['PHP_SELF']) . "?view_unit=" . $_GET['view_unit'] . '&message=' . urlencode(_MUSTSPECIFYQUESTIONNUMBER)); exit; } else { if ($_GET['user_configurable'] > $questionsNumber || $_GET['user_configurable'] <= 0) { eF_redirect(basename($_SERVER['PHP_SELF']) . "?view_unit=" . $_GET['view_unit'] . '&message=' . urlencode(_MUSTSPECIFYVALUEFROM . ' 1 ' . _TO . ' ' . $questionsNumber)); exit; } else { eF_redirect(basename($_SERVER['PHP_SELF']) . "?view_unit=" . $_GET['view_unit'] . '&message=' . urlencode(_INVALIDFIELDDATA)); exit;
if (!$skillgap_tests) { $currentUnit = new EfrontUnit($test['content_ID']); $tests[$key]['linked_to'] = $currentUnit['linked_to'] ? true : false; } //@todo: change this call $doneTests = EfrontStats::getDoneTestsPerTest(false, $test['id']); $tests[$key]['average_score'] = $doneTests[$test['id']]['average_score']; $tests[$key]['options'] = unserialize($test['options']); if ($tests[$key]['options']['random_pool'] > 0) { if ($tests[$key]['questions_num'] > $tests[$key]['options']['random_pool']) { $tests[$key]['questions_num'] = $tests[$key]['options']['random_pool']; } } if (!empty($tests[$key]['options']['random_test'])) { $testObj = new EfrontTest($test['id']); $tests[$key]['questions_num'] = $testObj->getNumQuestionsForRandomTests(); } // If somehow the general threshold value is not set if (!isset($tests[$key]['options']['general_threshold'])) { $tests[$key]['options']['general_threshold'] = 50; $newOptions = serialize($tests[$key]['options']); eF_updateTableData("tests", array("options" => $newOptions), "id = '" . $test['id'] . "'"); } } $smarty->assign("T_QUESTIONTYPESTRANSLATIONS", Question::$questionTypes); $smarty->assign("T_TESTS", $tests); //pr($questions); exit; if (isset($_GET['ajax']) && $_GET['ajax'] == 'questionsTable') { isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE); if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) { $sort = $_GET['sort'];