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()
118 $rendered_gui_component = $table_gui->getHTML();
121 $txt =
$lng->txt(
'tst_corrections_incompatible_question_set_type');
123 $infoBox = $ui->
factory()->messageBox()->info(
$txt);
125 $rendered_gui_component = $ui->
renderer()->render($infoBox);
128 $ui->
mainTemplate()->setContent($rendered_gui_component);
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()
237 $gui->setHeaderText($confirmation);
238 $gui->setFormAction($this->
ctrl->getFormAction($this));
239 $gui->setCancel($this->
language->txt(
'cancel'),
'showQuestion');
240 $gui->setConfirm($this->
language->txt(
'confirm'),
'saveQuestion');
244 $this->
ui->mainTemplate()->setContent($gui->getHTML());
249 $questionGUI = $this->
getQuestion((
int) $this->testrequest->raw(
'qid'));
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);
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(
371 $this->
ctrl->getLinkTarget($this,
'performQuestionRemoval')
373 $this->
ui->factory()->button()->standard(
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)) {
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
RequestInterface $request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
database()
Get interface to the Database.
buildQuestionCorrectionForm(assQuestionGUI $questionGUI)
addHiddenItemsFromArray(ilConfirmationGUI $gui, $array, $curPath=array())
Abstract basic class which is to be extended by the concrete assessment question type classes...
static getQuestionTypeByTypeId($type_id)
tabs()
Get interface to the tabs.
getTestId()
Gets the database id of the additional test data.
addHiddenItem(string $a_post_var, string $a_value)
setQuestionRemoveRowButtonEnabled(bool $questionRemoveRowButtonEnabled)
static accessViolationRedirect()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Customizing of pimple-DIC for ILIAS.
isAnswerFrequencyStatisticSupported()
static instantiateQuestionGUI(int $a_question_id)
Provides fluid interface to RBAC services.
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
setCorrectionTabsContext(assQuestionGUI $questionGUI, $activeTabId)
setRenderPageContainer(bool $a_val)
renderer()
Get a renderer for UI components.
RefineryFactory $refinery
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
language()
Get interface to the i18n service.
getSolutions(assQuestion $question)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
allowedInAdjustment(\assQuestionGUI $question_object)
Returns if the question type is allowed for adjustments in the global test administration.
static getSyntaxStylePath()
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...
confirmManualScoringReset()
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
supportsAdjustment(\assQuestionGUI $question_object)
Returns if the given question object support scoring adjustment.
__construct(Container $DIC, ilObjTest $testOBJ)
ilTestCorrectionsGUI constructor.
InternalRequestService $testrequest
populatePageTitleAndDescription(assQuestionGUI $questionGUI)
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...
factory()
Get the factory that crafts UI components.
ctrl()
Get the interface to the control structure.
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
ui()
Get the interface to get services from UI framework.
mainTemplate()
Get the ILIAS main template.
showQuestion(ilPropertyFormGUI $form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...