本文整理汇总了PHP中ilObjTest::getTestResult方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest::getTestResult方法的具体用法?PHP ilObjTest::getTestResult怎么用?PHP ilObjTest::getTestResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjTest
的用法示例。
在下文中一共展示了ilObjTest::getTestResult方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFilteredTestResult
protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
{
global $ilDB, $ilPluginAdmin;
$table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
$table_gui->initFilter();
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
$questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
$questionList->setParentObjIdsFilter(array($this->object->getId()));
$questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
foreach ($table_gui->getFilterItems() as $item) {
if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
$v = $item->getValue();
if (is_array($v) && count($v) && !(int) $v[0]) {
continue;
}
$taxId = substr($item->getPostVar(), strlen('tax_'));
$questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
} elseif ($item->getValue() !== false) {
$questionList->addFieldFilter($item->getPostVar(), $item->getValue());
}
}
$questionList->load();
$filteredTestResult = array();
$resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
foreach ($resultData as $resultItemKey => $resultItemValue) {
if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
continue;
}
if (!$questionList->isInList($resultItemValue['qid'])) {
continue;
}
$filteredTestResult[] = $resultItemValue;
}
return $filteredTestResult;
}
示例2: initTestResultData
private function initTestResultData($activeId, $pass)
{
$testResults = $this->testOBJ->getTestResult($activeId, $pass, true);
foreach ($testResults as $key => $result) {
if ($key === 'pass' || $key === 'test') {
continue;
}
$this->reachedPointsByQuestion[$result['qid']] = $result['reached'];
}
}
示例3: recalculatePasses
/**
* @param $userdata
* @param $active_id
*/
public function recalculatePasses($userdata, $active_id)
{
require_once './Modules/Test/classes/class.ilTestEvaluationGUI.php';
// Below!
require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
require_once './Modules/Test/classes/class.ilTestArchiver.php';
$passes = $userdata->getPasses();
foreach ($passes as $pass => $passdata) {
if (is_object($passdata)) {
$this->recalculatePass($passdata, $active_id, $pass);
if ($this->test->getEnableArchiving()) {
// requires out of the loop!
$test_evaluation_gui = new ilTestEvaluationGUI($this->test);
$result_array = $this->test->getTestResult($active_id, $pass);
$overview = $test_evaluation_gui->getPassListOfAnswers($result_array, $active_id, $pass, true, false, false, true);
$filename = ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->test->getId() . '-' . $active_id . '-' . $pass . '.pdf';
ilTestPDFGenerator::generatePDF($overview, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
$archiver = new ilTestArchiver($this->test->getId());
$archiver->handInTestResult($active_id, $pass, $filename);
unlink($filename);
}
}
}
}
示例4: show
public function show()
{
require_once 'class.ilTestEvaluationGUI.php';
require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php';
global $ilUser;
$template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test");
$this->ilCtrl->setParameter($this, "skipfinalstatement", 1);
$template->setVariable("FORMACTION", $this->ilCtrl->getFormAction($this->testOutputGUI, 'redirectBack') . '&reviewed=1');
$template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next"));
$template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous"));
if ($this->test->getListOfQuestionsEnd()) {
$template->setVariable("CANCEL_CMD", 'outQuestionSummary');
} else {
$template->setVariable("CANCEL_CMD", 'backFromSummary');
}
$active = $this->test->getActiveIdOfUser($ilUser->getId());
$testevaluationgui = new ilTestEvaluationGUI($this->test);
$results = $this->test->getTestResult($active, $this->testSession->getPass());
$results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $this->testSession->getPass(), false, false, false, false);
if ($this->test->getShowExamviewPdf()) {
$template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
global $ilSetting;
$inst_id = $ilSetting->get('inst_id', null);
$path = ilUtil::getWebspaceDir() . '/assessment/' . $this->testOutputGUI->object->getId() . '/exam_pdf';
if (!is_dir($path)) {
ilUtil::makeDirParents($path);
}
$filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $this->testSession->getPass() . '.pdf';
require_once 'class.ilTestPDFGenerator.php';
ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
$template->setVariable("PDF_FILE_LOCATION", $filename);
} else {
$template->setCurrentBlock('prevent_double_form_subm');
$template->touchBlock('prevent_double_form_subm');
$template->parseCurrentBlock();
}
if ($this->test->getShowExamviewHtml()) {
if ($this->test->getListOfQuestionsEnd()) {
$template->setVariable("CANCEL_CMD_BOTTOM", 'outQuestionSummary');
} else {
$template->setVariable("CANCEL_CMD_BOTTOM", 'backFromSummary');
}
$template->setVariable("BUTTON_CONTINUE_BOTTOM", $this->lng->txt("btn_next"));
$template->setVariable("BUTTON_BACK_BOTTOM", $this->lng->txt("btn_previous"));
$template->setVariable('HTML_REVIEW', $results_output);
}
$this->tpl->setVariable($this->getContentBlockName(), $template->get());
}
示例5: getResultsOfUserOutput
/**
* Output of the pass overview for a test called by a test participant
*
* @access public
*/
function getResultsOfUserOutput($active_id, $pass, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
{
global $ilias, $tpl;
include_once "./Services/UICore/classes/class.ilTemplate.php";
$template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test");
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$uname = $this->object->userLookupFullName($user_id, TRUE);
if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) {
if (is_null($pass)) {
$pass = $_GET["pass"];
}
}
$statement = $this->getFinalStatement($active_id);
$user_data = $this->getResultsUserdata($active_id, TRUE);
if (!is_null($pass)) {
$result_array =& $this->object->getTestResult($active_id, $pass);
$command_solution_details = "";
if ($show_pass_details) {
$detailsoverview = $this->getPassDetailsOverview($result_array, $active_id, $pass, "iltestservicegui", "getResultsOfUserOutput", $command_solution_details);
}
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$showAllAnswers = TRUE;
if ($this->object->isExecutable($user_id)) {
$showAllAnswers = FALSE;
}
if ($show_answers) {
$list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points);
}
$template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
//$template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1));
$template->setVariable("PASS_DETAILS", $detailsoverview);
$signature = $this->getResultsSignature();
$template->setVariable("SIGNATURE", $signature);
}
$template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
$template->setVariable("USER_DATA", $user_data);
$template->setVariable("USER_MARK", $statement["mark"]);
if (strlen($statement["markects"])) {
$template->setVariable("USER_MARK_ECTS", $statement["markects"]);
}
$template->parseCurrentBlock();
return $template->get();
}
示例6: getManScoringQuestionGuiList
/**
* Returns the list of answers of a users test pass and offers a scoring option
*
* @access public
* @param integer $active_id Active ID of the active user
* @param integer $pass Test pass
* @return string HTML code of the list of answers
*/
public function getManScoringQuestionGuiList($activeId, $pass)
{
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
$manScoringQuestionTypes = ilObjAssessmentFolder::_getManualScoring();
$testResultData = $this->object->getTestResult($activeId, $pass);
$manScoringQuestionGuiList = array();
foreach ($testResultData as $questionData) {
if (!isset($questionData['qid'])) {
continue;
}
if (!isset($questionData['type'])) {
throw new ilTestException('no question type given!');
}
$questionGUI = $this->object->createQuestionGUI("", $questionData['qid']);
if (!in_array($questionGUI->object->getQuestionTypeID(), $manScoringQuestionTypes)) {
continue;
}
$manScoringQuestionGuiList[$questionData['qid']] = $questionGUI;
}
return $manScoringQuestionGuiList;
}
示例7: getVirtualSequenceUserResults
public function getVirtualSequenceUserResults(ilTestVirtualSequence $virtualSequence)
{
$resultsByPass = array();
foreach ($virtualSequence->getUniquePasses() as $pass) {
$results = $this->object->getTestResult($virtualSequence->getActiveId(), $pass, false, true, true);
$resultsByPass[$pass] = $results;
}
$virtualPassResults = array();
foreach ($virtualSequence->getQuestionsPassMap() as $questionId => $pass) {
foreach ($resultsByPass[$pass] as $key => $questionResult) {
if ($key === 'test' || $key === 'pass') {
continue;
}
if ($questionResult['qid'] == $questionId) {
$questionResult['pass'] = $pass;
$virtualPassResults[$questionId] = $questionResult;
break;
}
}
}
return $virtualPassResults;
}
示例8: executeCommand
//.........这里部分代码省略.........
require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
$gui = new ilTestQuestionBrowserTableGUI($this->ctrl, $this->tpl, $ilTabs, $this->lng, $tree, $ilDB, $ilPluginAdmin, $this->object);
$gui->setWriteAccess($ilAccess->checkAccess("write", "", $this->ref_id));
$gui->init();
$this->ctrl->forwardCommand($gui);
break;
case 'iltestskilladministrationgui':
$this->prepareOutput();
$this->addHeaderAction();
require_once 'Modules/Test/classes/class.ilTestSkillAdministrationGUI.php';
$gui = new ilTestSkillAdministrationGUI($ilias, $this->ctrl, $ilAccess, $ilTabs, $this->tpl, $this->lng, $ilDB, $tree, $ilPluginAdmin, $this->object, $this->ref_id);
$this->ctrl->forwardCommand($gui);
break;
case 'iltestskillevaluationgui':
$this->prepareOutput();
$this->addHeaderAction();
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
if ($this->object->isDynamicTest()) {
require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
$dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
$dynamicQuestionSetConfig->loadFromDb();
$questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
$questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId());
$questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
} else {
$questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
$questionList->setParentObjId($this->object->getId());
$questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
}
$questionList->load();
require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
$testSessionFactory = new ilTestSessionFactory($this->object);
$testSession = $testSessionFactory->getSession();
$testResults = $this->object->getTestResult($testSession->getActiveId(), $testSession->getPass(), true);
require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
$gui = new ilTestSkillEvaluationGUI($this->ctrl, $ilTabs, $this->tpl, $this->lng, $ilDB, $this->object->getTestId(), $this->object->getRefId(), $this->object->getId());
$gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
$gui->setQuestionList($questionList);
$gui->setTestSession($testSession);
$gui->setTestResults($testResults);
$this->ctrl->forwardCommand($gui);
break;
case 'ilobjectcopygui':
$this->prepareOutput();
$this->addHeaderAction();
require_once './Services/Object/classes/class.ilObjectCopyGUI.php';
$cp = new ilObjectCopyGUI($this);
$cp->setType('tst');
$this->ctrl->forwardCommand($cp);
break;
case 'ilrepositorysearchgui':
$this->prepareOutput();
$this->addHeaderAction();
require_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
$rep_search =& new ilRepositorySearchGUI();
$rep_search->setCallback($this, 'addParticipantsObject', array());
// Set tabs
$this->ctrl->setReturn($this, 'participants');
$ret =& $this->ctrl->forwardCommand($rep_search);
$this->tabs_gui->setTabActive('participants');
break;
case 'ilpageeditorgui':
case 'iltestexpresspageobjectgui':
require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
$incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
$incompleteQuestionPurger->setOwnerId($ilUser->getId());
示例9: hideCorrectAnsweredQuestions
private function hideCorrectAnsweredQuestions(ilObjTest $testOBJ, $activeId, $pass)
{
if ($activeId > 0) {
$result = $testOBJ->getTestResult($activeId, $pass, TRUE);
foreach ($result as $sequence => $question) {
if (is_numeric($sequence)) {
if ($question['reached'] == $question['max']) {
$this->hideQuestion($question['qid']);
}
}
}
$this->saveToDb();
}
}
示例10: getResultsOfUserOutput
/**
* Output of the pass overview for a test called by a test participant
*
* @param ilTestSession|ilTestSessionDynamicQuestionSet $testSession
* @param integer $active_id
* @param integer $pass
* @param boolean $show_pass_details
* @param boolean $show_answers
* @param boolean $show_question_only
* @param boolean $show_reached_points
* @access public
*/
function getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
{
global $ilias, $tpl;
include_once "./Services/UICore/classes/class.ilTemplate.php";
$template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test");
if ($this->participantData instanceof ilTestParticipantData) {
$user_id = $this->participantData->getUserIdByActiveId($active_id);
$uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
} else {
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$uname = $this->object->userLookupFullName($user_id, TRUE);
}
if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) {
if (is_null($pass)) {
$pass = $_GET["pass"];
}
}
$user_data = $this->getResultsUserdata($testSession, $active_id, TRUE);
if (!is_null($pass)) {
$result_array =& $this->object->getTestResult($active_id, $pass);
$command_solution_details = "";
if ($show_pass_details) {
$detailsoverview = $this->getPassDetailsOverview($result_array, $active_id, $pass, $targetGUI, "getResultsOfUserOutput", $command_solution_details, $show_answers);
}
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$showAllAnswers = TRUE;
if ($this->object->isExecutable($testSession, $user_id)) {
$showAllAnswers = FALSE;
}
if ($show_answers) {
$list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, $_SESSION['tst_results_show_best_solutions'], $showAllAnswers, $show_question_only, $show_reached_points, $show_pass_details);
}
$template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
//$template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1));
$template->setVariable("PASS_DETAILS", $detailsoverview);
$signature = $this->getResultsSignature();
$template->setVariable("SIGNATURE", $signature);
if ($this->object->isShowExamIdInTestResultsEnabled()) {
$template->setCurrentBlock('exam_id_footer');
$template->setVariable('EXAM_ID_VAL', $this->object->lookupExamId($testSession->getActiveId(), $pass));
$template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
$template->parseCurrentBlock();
}
}
$template->setCurrentBlock('participant_back_anchor');
$template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
$template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
$template->parseCurrentBlock();
$template->setCurrentBlock('participant_block_id');
$template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
$template->parseCurrentBlock();
$template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
$template->setVariable("USER_DATA", $user_data);
if ($this->isGradingMessageRequired()) {
$template->setCurrentBlock('grading_message');
$template->setVariable('GRADING_MESSAGE', $this->getGradingMessage($active_id));
$template->parseCurrentBlock();
}
$template->parseCurrentBlock();
return $template->get();
}