23use Psr\Http\Message\RequestInterface;
55 $this->database =
$DIC->database();
60 $this->
ui = $DIC->
ui();
62 $this->request =
$DIC->http()->request();
64 $this->testrequest =
$DIC->test()->internal()->request();
70 if (!$this->testAccess->checkCorrectionsAccess()) {
74 $this->testrequest->isset(
'eqid') && (
int) $this->testrequest->raw(
'eqid')
75 && $this->testrequest->isset(
'eqpl') && (
int) $this->testrequest->raw(
'eqpl')
77 $this->
ctrl->setParameter($this,
'qid', (
int) $this->testrequest->raw(
'eqid'));
78 $this->
ctrl->redirect($this,
'showQuestion');
80 if ($this->testrequest->isset(
'removeQid') && (
int) $this->testrequest->raw(
'removeQid')) {
81 $this->
ctrl->setParameter($this,
'qid', (
int) $this->testrequest->raw(
'removeQid'));
82 $this->
ctrl->redirect($this,
'confirmQuestionRemoval');
85 if ((
int) $this->testrequest->raw(
'qid')
86 && !$this->checkQuestion((
int) $this->testrequest->raw(
'qid'))) {
90 $this->
ctrl->saveParameter($this,
'qid');
92 switch ($this->
ctrl->getNextClass($this)) {
95 $command = $this->
ctrl->getCmd(
'showQuestionList');
106 if ($this->testOBJ->isFixedTest()) {
110 $this->testOBJ->getRefId()
113 $table_gui->setQuestionRemoveRowButtonEnabled(
true);
118 $rendered_gui_component = $table_gui->getHTML();
121 $txt =
$lng->txt(
'tst_corrections_incompatible_question_set_type');
125 $rendered_gui_component =
$ui->
renderer()->render($infoBox);
133 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
137 if ($form ===
null) {
142 $this->
ui->mainTemplate()->setContent($form->getHTML());
147 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
151 $form->setValuesByPost();
153 if (!$form->checkInput()) {
154 $questionGUI->prepareReprintableCorrectionsForm($form);
160 $questionGUI->saveCorrectionsFormProperties($form);
161 $questionGUI->object->setPoints($questionGUI->object->getMaximumPoints());
162 $questionGUI->object->saveToDb();
165 $scoring->setPreserveManualScores(
false);
166 $scoring->setQuestionId($questionGUI->object->getId());
167 $scoring->recalculateSolutions();
169 $this->
ui->mainTemplate()->setOnScreenMessage(
'success', $this->
language->txt(
'saved_successfully'),
true);
170 $this->
ctrl->redirect($this,
'showQuestion');
176 $form->setFormAction($this->
ctrl->getFormAction($this));
177 $form->setId(
'tst_question_correction');
179 $form->setTitle($this->
language->txt(
'tst_corrections_qst_form'));
182 $hiddenQid->setValue($questionGUI->object->getId());
183 $form->addItem($hiddenQid);
188 $scoring->setQuestionId($questionGUI->object->getId());
190 if ($scoring->getNumManualScorings()) {
191 $form->addCommandButton(
'confirmManualScoringReset', $this->
language->txt(
'save'));
193 $form->addCommandButton(
'saveQuestion', $this->
language->txt(
'save'));
201 foreach ($array as
$name => $value) {
202 if (
$name ==
'cmd' && !count($curPath)) {
206 if (count($curPath)) {
210 if (is_array($value)) {
211 $nextPath = array_merge($curPath, array(
$name));
214 $postVar = implode(
'', $curPath) .
$name;
222 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
227 $scoring->setQuestionId($questionGUI->object->getId());
229 $confirmation = sprintf(
230 $this->
language->txt(
'tst_corrections_manscore_reset_warning'),
231 $scoring->getNumManualScorings(),
232 $questionGUI->object->getTitleForHTMLOutput(),
233 $questionGUI->object->getId()
244 $this->
ui->mainTemplate()->setContent($gui->
getHTML());
249 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
254 $pageGUI->setRenderPageContainer(
false);
255 $pageGUI->setEditPreview(
true);
256 $pageGUI->setEnabledTabs(
false);
258 $solutionHTML = $questionGUI->getSolutionOutput(
270 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $solutionHTML));
271 $pageGUI->setPresentationTitle($questionGUI->object->getTitleForHTMLOutput());
273 $tpl =
new ilTemplate(
'tpl.tst_corrections_solution_presentation.html',
true,
true,
'Modules/Test');
274 $tpl->setVariable(
'SOLUTION_PRESENTATION', $pageGUI->preview());
278 $this->
ui->mainTemplate()->setContent(
$tpl->get());
280 $this->
ui->mainTemplate()->setCurrentBlock(
"ContentStyle");
282 $this->
ui->mainTemplate()->setVariable(
"LOCATION_CONTENT_STYLESHEET", $stylesheet);
283 $this->
ui->mainTemplate()->parseCurrentBlock();
285 $this->
ui->mainTemplate()->setCurrentBlock(
"SyntaxStyle");
287 $this->
ui->mainTemplate()->setVariable(
"LOCATION_SYNTAX_STYLESHEET", $stylesheet);
288 $this->
ui->mainTemplate()->parseCurrentBlock();
293 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
300 foreach ($questionGUI->getSubQuestionsIndex() as $subQuestionIndex) {
301 $table = $questionGUI->getAnswerFrequencyTableGUI(
303 'showAnswerStatistic',
308 $tablesHtml .= $table->getHTML() . $table->getAdditionalHtml();
312 $this->
ui->mainTemplate()->setContent($tablesHtml);
317 $form_builder =
new ilAddAnswerFormBuilder($this, $this->
ui->factory(), $this->refinery, $this->language, $this->ctrl);
319 $form = $form_builder->buildAddAnswerForm()
320 ->withRequest($this->request);
322 $data = $form->getData();
323 $question_id =
$data[
'question_id'];
326 $this->
ui->mainTemplate()->setOnScreenMessage(
'failure', $this->
language->txt(
'form_input_not_valid'));
333 $question_index =
$data[
'question_index'];
334 $answer_value =
$data[
'answer_value'];
335 $points =
$data[
'points'];
338 $this->
ui->mainTemplate()->setOnScreenMessage(
'failure', $this->
language->txt(
'err_no_numeric_value'));
343 if ($question_gui->object->isAddableAnswerOptionValue($question_index, $answer_value)) {
344 $question_gui->object->addAnswerOptionValue($question_index, $answer_value, $points);
345 $question_gui->object->saveToDb();
349 $scoring->setPreserveManualScores(
true);
350 $scoring->recalculateSolutions();
352 $this->
ui->mainTemplate()->setOnScreenMessage(
'success', $this->
language->txt(
'saved_successfully'));
360 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
362 $confirmation = sprintf(
363 $this->
language->txt(
'tst_corrections_qst_remove_confirmation'),
364 $questionGUI->object->getTitleForHTMLOutput(),
365 $questionGUI->object->getId()
369 $this->
ui->factory()->button()->standard(
370 $this->language->txt(
'confirm'),
371 $this->ctrl->getLinkTarget($this,
'performQuestionRemoval')
373 $this->ui->factory()->button()->standard(
374 $this->language->txt(
'cancel'),
375 $this->ctrl->getLinkTarget($this,
'showQuestionList')
379 $this->
ui->mainTemplate()->setContent($this->
ui->renderer()->render(
380 $this->ui->factory()->messageBox()->confirmation($confirmation)->withButtons($buttons)
386 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
390 $participantData->load($this->testOBJ->getTestId());
393 $questionGUI->object->removeAllExistingSolutions();
396 $scoring->removeAllQuestionResults($questionGUI->object->getId());
399 $this->testOBJ->removeQuestion($questionGUI->object->getId());
400 $reindexedSequencePositionMap = $this->testOBJ->reindexFixedQuestionOrdering();
401 $this->testOBJ->loadQuestions();
404 $this->testOBJ->removeQuestionFromSequences(
405 $questionGUI->object->getId(),
406 $participantData->getActiveIds(),
407 $reindexedSequencePositionMap
411 $scoring->updatePassAndTestResults($participantData->getActiveIds());
417 $questionGUI->object->delete($questionGUI->object->getId());
420 if (!count($this->testOBJ->getTestQuestions())) {
421 $this->testOBJ->setOnline(
false);
422 $this->testOBJ->saveToDb(
true);
425 $this->
ctrl->setParameter($this,
'qid',
'');
426 $this->
ctrl->redirect($this,
'showQuestionList');
431 $this->
tabs->clearTargets();
432 $this->
tabs->clearSubTabs();
434 $this->
help->setScreenIdComponent(
"tst");
435 $this->
help->setScreenId(
"scoringadjust");
436 $this->
help->setSubScreenId($activeTabId);
439 $this->
tabs->setBackTarget(
441 $this->ctrl->getLinkTarget($this,
'showQuestionList')
446 $this->
language->txt(
'tst_corrections_tab_question'),
447 $this->ctrl->getLinkTarget($this,
'showQuestion')
452 $this->
language->txt(
'tst_corrections_tab_solution'),
453 $this->ctrl->getLinkTarget($this,
'showSolution')
459 $this->
language->txt(
'tst_corrections_tab_statistics'),
460 $this->ctrl->getLinkTarget($this,
'showAnswerStatistic')
464 $this->
tabs->activateTab($activeTabId);
472 $this->
ui->mainTemplate()->setTitle($questionGUI->object->getTitleForHTMLOutput());
482 if (!$this->testOBJ->isTestQuestion($qId)) {
506 $question->object->setObjId($this->testOBJ->getId());
513 $solutionRows = array();
515 foreach ($this->testOBJ->getParticipants() as $activeId => $participantData) {
517 $passesSelector->setActiveId($activeId);
518 $passesSelector->loadLastFinishedPass();
520 foreach ($passesSelector->getClosedPasses() as $pass) {
522 $solutionRows[] = $row;
527 return $solutionRows;
535 $questions = array();
537 foreach ($this->testOBJ->getTestQuestions() as $questionData) {
538 $questionGUI = $this->
getQuestion($questionData[
'question_id']);
548 $questions[] = $questionData;
578 $types = explode(
',', $setting->get(
'assessment_scoring_adjustment'));
579 require_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
581 foreach ($types as
$type) {
586 if (in_array(
$type, $type_def)) {
Customizing of pimple-DIC for ILIAS.
language()
Get interface to the i18n service.
ui()
Get the interface to get services from UI framework.
ctrl()
Get the interface to the control structure.
tabs()
Get interface to the tabs.
Provides fluid interface to RBAC services.
renderer()
Get a renderer for UI components.
mainTemplate()
Get the ILIAS main template.
factory()
Get the factory that crafts UI components.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
isAnswerFrequencyStatisticSupported()
Abstract basic class which is to be extended by the concrete assessment question type classes.
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
static instantiateQuestionGUI(int $a_question_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormAction(string $a_form_action)
setCancel(string $a_txt, string $a_cmd, string $a_id='')
setHeaderText(string $a_headertext)
setConfirm(string $a_txt, string $a_cmd, string $a_id='')
addHiddenItem(string $a_post_var, string $a_value)
Class ilCtrl provides processing control methods.
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
static getQuestionTypeByTypeId($type_id)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static getSyntaxStylePath()
static accessViolationRedirect()
getTestId()
Gets the database id of the additional test data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
populatePageTitleAndDescription(assQuestionGUI $questionGUI)
supportsAdjustment(\assQuestionGUI $question_object)
Returns if the given question object support scoring adjustment.
__construct(Container $DIC, ilObjTest $testOBJ)
ilTestCorrectionsGUI constructor.
allowedInAdjustment(\assQuestionGUI $question_object)
Returns if the question type is allowed for adjustments in the global test administration.
confirmManualScoringReset()
showQuestion(ilPropertyFormGUI $form=null)
getSolutions(assQuestion $question)
addHiddenItemsFromArray(ilConfirmationGUI $gui, $array, $curPath=array())
buildQuestionCorrectionForm(assQuestionGUI $questionGUI)
RequestInterface $request
setCorrectionTabsContext(assQuestionGUI $questionGUI, $activeTabId)
RefineryFactory $refinery
InternalRequestService $testrequest
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl