45 if (!$this->testAccess->checkCorrectionsAccess()) {
49 if (isset(
$_GET[
'eqid']) && (
int)
$_GET[
"eqid"] && isset(
$_GET[
'eqpl']) && (
int)
$_GET[
"eqpl"]) {
50 $this->
DIC->ctrl()->setParameter($this,
'qid', (
int) $_GET[
"eqid"]);
51 $this->
DIC->ctrl()->redirect($this,
'showQuestion');
54 if (isset($_GET[
'removeQid']) && (
int) $_GET[
'removeQid']) {
55 $this->
DIC->ctrl()->setParameter($this,
'qid', (
int) $_GET[
'removeQid']);
56 $this->
DIC->ctrl()->redirect($this,
'confirmQuestionRemoval');
59 if ((
int) $_GET[
'qid'] && !$this->
checkQuestion((
int) $_GET[
'qid'])) {
63 $this->
DIC->ctrl()->saveParameter($this,
'qid');
65 switch ($this->
DIC->ctrl()->getNextClass($this)) {
68 $command = $this->
DIC->ctrl()->getCmd(
'showQuestionList');
77 $ui = $this->
DIC->ui();
79 if ($this->testOBJ->isFixedTest()) {
83 $this->testOBJ->getRefId()
87 $table_gui->setQuestionRemoveRowButtonEnabled(
true);
92 $rendered_gui_component = $table_gui->getHTML();
95 $txt =
$lng->txt(
'tst_corrections_incompatible_question_set_type');
97 $infoBox = $ui->factory()->messageBox()->info(
$txt);
99 $rendered_gui_component = $ui->renderer()->render($infoBox);
102 $ui->mainTemplate()->setContent($rendered_gui_component);
111 if (
$form === null) {
116 $this->
DIC->ui()->mainTemplate()->setContent(
$form->getHTML());
125 $form->setValuesByPost();
127 if (!
$form->checkInput()) {
128 $questionGUI->prepareReprintableCorrectionsForm(
$form);
134 $questionGUI->saveCorrectionsFormProperties(
$form);
135 $questionGUI->object->setPoints($questionGUI->object->getMaximumPoints());
136 $questionGUI->object->saveToDb();
139 $scoring->setPreserveManualScores(
false);
140 $scoring->setQuestionId($questionGUI->object->getId());
141 $scoring->recalculateSolutions();
143 $this->
DIC->ctrl()->redirect($this,
'showQuestion');
149 $form->setFormAction($this->
DIC->ctrl()->getFormAction($this));
150 $form->setId(
'tst_question_correction');
152 $form->setTitle($this->
DIC->language()->txt(
'tst_corrections_qst_form'));
155 $hiddenQid->setValue($questionGUI->object->getId());
156 $form->addItem($hiddenQid);
161 $scoring->setQuestionId($questionGUI->object->getId());
163 if ($scoring->getNumManualScorings()) {
164 $form->addCommandButton(
'confirmManualScoringReset', $this->
DIC->language()->txt(
'save'));
166 $form->addCommandButton(
'saveQuestion', $this->
DIC->language()->txt(
'save'));
174 foreach ($array as
$name => $value) {
175 if (
$name ==
'cmd' && !count($curPath)) {
179 if (count($curPath)) {
183 if (is_array($value)) {
184 $nextPath = array_merge($curPath, array(
$name));
187 $postVar = implode(
'', $curPath) .
$name;
200 $scoring->setQuestionId($questionGUI->object->getId());
202 $confirmation = sprintf(
203 $this->
DIC->language()->txt(
'tst_corrections_manscore_reset_warning'),
204 $scoring->getNumManualScorings(),
205 $questionGUI->object->getTitle(),
206 $questionGUI->object->getId()
210 $gui->setHeaderText($confirmation);
211 $gui->setFormAction($this->
DIC->ctrl()->getFormAction($this));
212 $gui->setCancel($this->
DIC->language()->txt(
'cancel'),
'showQuestion');
213 $gui->setConfirm($this->
DIC->language()->txt(
'confirm'),
'saveQuestion');
217 $this->
DIC->ui()->mainTemplate()->setContent($gui->getHTML());
228 $pageGUI->setEditPreview(
true);
229 $pageGUI->setEnabledTabs(
false);
231 $solutionHTML = $questionGUI->getSolutionOutput(
243 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $solutionHTML));
244 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
246 $tpl =
new ilTemplate(
'tpl.tst_corrections_solution_presentation.html',
true,
true,
'Modules/Test');
247 $tpl->setVariable(
'SOLUTION_PRESENTATION', $pageGUI->preview());
251 $this->
DIC->ui()->mainTemplate()->setContent(
$tpl->get());
252 $this->
DIC->ui()->mainTemplate()->addCss(
'Modules/Test/templates/default/ta.css');
254 $this->
DIC->ui()->mainTemplate()->setCurrentBlock(
"ContentStyle");
256 $this->
DIC->ui()->mainTemplate()->setVariable(
"LOCATION_CONTENT_STYLESHEET", $stylesheet);
257 $this->
DIC->ui()->mainTemplate()->parseCurrentBlock();
259 $this->
DIC->ui()->mainTemplate()->setCurrentBlock(
"SyntaxStyle");
261 $this->
DIC->ui()->mainTemplate()->setVariable(
"LOCATION_SYNTAX_STYLESHEET", $stylesheet);
262 $this->
DIC->ui()->mainTemplate()->parseCurrentBlock();
274 foreach ($questionGUI->getSubQuestionsIndex() as $subQuestionIndex) {
275 $table = $questionGUI->getAnswerFrequencyTableGUI(
277 'showAnswerStatistic',
282 $tablesHtml .=
$table->getHTML() .
$table->getAdditionalHtml();
286 $this->
DIC->ui()->mainTemplate()->setContent($tablesHtml);
287 $this->
DIC->ui()->mainTemplate()->addCss(
'Modules/Test/templates/default/ta.css');
296 $form->setValuesByPost();
298 if (!
$form->checkInput()) {
299 $uid = md5(
$form->getInput(
'answer'));
302 $form->setFormAction($this->
DIC->ctrl()->getFormAction($this,
'addAnswerAsynch'));
304 $alert = $this->
DIC->ui()->factory()->messageBox()->failure(
305 $this->
DIC->language()->txt(
'form_input_not_valid')
308 $bodyTpl =
new ilTemplate(
'tpl.tst_corr_addanswermodal.html',
true,
true,
'Modules/TestQuestionPool');
309 $bodyTpl->setVariable(
'MESSAGE', $this->
DIC->ui()->renderer()->render($alert));
310 $bodyTpl->setVariable(
'FORM',
$form->getHTML());
311 $bodyTpl->setVariable(
'BODY_UID', $uid);
320 $qid = (int)
$form->getInput(
'qid');
332 $qIndex = (int)
$form->getInput(
'qindex');
333 $points = (float)
$form->getInput(
'points');
334 $answerOption =
$form->getInput(
'answer');
336 if ($questionGUI->object->isAddableAnswerOptionValue($qIndex, $answerOption)) {
337 $questionGUI->object->addAnswerOptionValue($qIndex, $answerOption, $points);
338 $questionGUI->object->saveToDb();
342 $scoring->setPreserveManualScores(
true);
343 $scoring->recalculateSolutions();
357 $confirmation = sprintf(
358 $this->
DIC->language()->txt(
'tst_corrections_qst_remove_confirmation'),
359 $questionGUI->object->getTitle(),
360 $questionGUI->object->getId()
364 $this->
DIC->ui()->factory()->button()->standard(
365 $this->
DIC->language()->txt(
'confirm'),
366 $this->
DIC->ctrl()->getLinkTarget($this,
'performQuestionRemoval')
368 $this->
DIC->ui()->factory()->button()->standard(
369 $this->
DIC->language()->txt(
'cancel'),
370 $this->
DIC->ctrl()->getLinkTarget($this,
'showQuestionList')
374 $this->
DIC->ui()->mainTemplate()->setContent($this->
DIC->ui()->renderer()->render(
375 $this->
DIC->ui()->factory()->messageBox()->confirmation($confirmation)->withButtons($buttons)
387 $participantData->
load($this->testOBJ->getTestId());
390 $questionGUI->object->removeAllExistingSolutions();
393 $scoring->removeAllQuestionResults($questionGUI->object->getId());
396 $this->testOBJ->removeQuestion($questionGUI->object->getId());
397 $reindexedSequencePositionMap = $this->testOBJ->reindexFixedQuestionOrdering();
398 $this->testOBJ->loadQuestions();
401 $this->testOBJ->removeQuestionFromSequences(
402 $questionGUI->object->getId(),
403 $participantData->getActiveIds(),
404 $reindexedSequencePositionMap
408 $scoring->updatePassAndTestResults($participantData->getActiveIds());
414 $questionGUI->object->delete($questionGUI->object->getId());
417 if (!count($this->testOBJ->getTestQuestions())) {
418 $this->testOBJ->setOnline(
false);
419 $this->testOBJ->saveToDb(
true);
422 $this->
DIC->ctrl()->setParameter($this,
'qid',
'');
423 $this->
DIC->ctrl()->redirect($this,
'showQuestionList');
428 $this->
DIC->tabs()->clearTargets();
429 $this->
DIC->tabs()->clearSubTabs();
431 $this->
DIC->tabs()->setBackTarget(
432 $this->
DIC->language()->txt(
'back'),
433 $this->
DIC->ctrl()->getLinkTarget($this,
'showQuestionList')
436 $this->
DIC->tabs()->addTab(
438 $this->
DIC->language()->txt(
'tst_corrections_tab_question'),
439 $this->
DIC->ctrl()->getLinkTarget($this,
'showQuestion')
442 $this->
DIC->tabs()->addTab(
444 $this->
DIC->language()->txt(
'tst_corrections_tab_solution'),
445 $this->
DIC->ctrl()->getLinkTarget($this,
'showSolution')
449 $this->
DIC->tabs()->addTab(
451 $this->
DIC->language()->txt(
'tst_corrections_tab_statistics'),
452 $this->
DIC->ctrl()->getLinkTarget($this,
'showAnswerStatistic')
456 $this->
DIC->tabs()->activateTab($activeTabId);
464 $this->
DIC->ui()->mainTemplate()->setTitle($questionGUI->object->getTitle());
474 if (!$this->testOBJ->isTestQuestion($qId)) {
498 $question->object->setObjId($this->testOBJ->getId());
505 $solutionRows = array();
507 foreach ($this->testOBJ->getParticipants() as $activeId => $participantData) {
510 $passesSelector->loadLastFinishedPass();
512 foreach ($passesSelector->getClosedPasses() as
$pass) {
514 $solutionRows[] =
$row;
519 return $solutionRows;
527 $questions = array();
529 foreach ($this->testOBJ->getTestQuestions() as $questionData) {
530 $questionGUI = $this->
getQuestion($questionData[
'question_id']);
540 $questions[] = $questionData;
570 $types = explode(
',', $setting->get(
'assessment_scoring_adjustment'));
571 require_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
573 foreach ($types as
$type) {
578 if (in_array($type, $type_def)) {
setQuestionTitleLinksEnabled(bool $questionTitleLinksEnabled)
addHiddenItem($a_post_var, $a_value)
Add hidden item.
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)
getTestId()
Gets the database id of the additional test data.
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static accessViolationRedirect()
isAnswerFreuqencyStatisticSupported()
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
setCorrectionTabsContext(assQuestionGUI $questionGUI, $activeTabId)
if(isset($_POST['submit'])) $form
special template class to simplify handling of ITX/PEAR
Interface ilObjAnswerScoringAdjustable.
getSolutions(assQuestion $question)
allowedInAdjustment(\assQuestionGUI $question_object)
Returns if the question type is allowed for adjustments in the global test administration.
setRenderPageContainer($a_val)
Set render page container.
getQuestionType()
Returns the question type string.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
Basic GUI class for assessment questions.
confirmManualScoringReset()
supportsAdjustment(\assQuestionGUI $question_object)
Returns if the given question object support scoring adjustment.
populatePageTitleAndDescription(assQuestionGUI $questionGUI)
__construct(\ILIAS\DI\Container $DIC, ilObjTest $testOBJ)
ilTestCorrectionsGUI constructor.
Interface ilObjQuestionScoringAdjustable.
getRefId()
get reference id public
Interface ilGuiAnswerScoringAdjustable.
if(empty($password)) $table
Interface ilGuiQuestionScoringAdjustable.
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
showQuestion(ilPropertyFormGUI $form=null)
Confirmation screen class.