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()
91 $rendered_gui_component = $table_gui->getHTML();
94 $txt =
$lng->txt(
'tst_corrections_incompatible_question_set_type');
96 $infoBox = $ui->factory()->messageBox()->info(
$txt);
98 $rendered_gui_component = $ui->renderer()->render($infoBox);
101 $ui->mainTemplate()->setContent($rendered_gui_component);
110 if ($form === null) {
115 $this->
DIC->ui()->mainTemplate()->setContent($form->getHTML());
124 $form->setValuesByPost();
126 if (!$form->checkInput()) {
127 $questionGUI->prepareReprintableCorrectionsForm($form);
133 $questionGUI->saveCorrectionsFormProperties($form);
134 $questionGUI->object->setPoints($questionGUI->object->getMaximumPoints());
135 $questionGUI->object->saveToDb();
138 $scoring->setPreserveManualScores(
false);
139 $scoring->setQuestionId($questionGUI->object->getId());
140 $scoring->recalculateSolutions();
142 $this->
DIC->ctrl()->redirect($this,
'showQuestion');
148 $form->setFormAction($this->
DIC->ctrl()->getFormAction($this));
149 $form->setId(
'tst_question_correction');
151 $form->setTitle($this->
DIC->language()->txt(
'tst_corrections_qst_form'));
154 $hiddenQid->setValue($questionGUI->object->getId());
155 $form->addItem($hiddenQid);
160 $scoring->setQuestionId($questionGUI->object->getId());
162 if ($scoring->getNumManualScorings()) {
163 $form->addCommandButton(
'confirmManualScoringReset', $this->
DIC->language()->txt(
'save'));
165 $form->addCommandButton(
'saveQuestion', $this->
DIC->language()->txt(
'save'));
173 foreach ($array as
$name => $value) {
174 if (
$name ==
'cmd' && !count($curPath)) {
178 if (count($curPath)) {
182 if (is_array($value)) {
183 $nextPath = array_merge($curPath, array(
$name));
186 $postVar = implode(
'', $curPath) .
$name;
199 $scoring->setQuestionId($questionGUI->object->getId());
201 $confirmation = sprintf(
202 $this->
DIC->language()->txt(
'tst_corrections_manscore_reset_warning'),
203 $scoring->getNumManualScorings(),
204 $questionGUI->object->getTitle(),
205 $questionGUI->object->getId()
209 $gui->setHeaderText($confirmation);
210 $gui->setFormAction($this->
DIC->ctrl()->getFormAction($this));
211 $gui->setCancel($this->
DIC->language()->txt(
'cancel'),
'showQuestion');
212 $gui->setConfirm($this->
DIC->language()->txt(
'confirm'),
'saveQuestion');
216 $this->
DIC->ui()->mainTemplate()->setContent($gui->getHTML());
227 $pageGUI->setEditPreview(
true);
228 $pageGUI->setEnabledTabs(
false);
230 $solutionHTML = $questionGUI->getSolutionOutput(
242 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $solutionHTML));
243 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
245 $tpl =
new ilTemplate(
'tpl.tst_corrections_solution_presentation.html',
true,
true,
'Modules/Test');
246 $tpl->setVariable(
'SOLUTION_PRESENTATION', $pageGUI->preview());
250 $this->
DIC->ui()->mainTemplate()->setContent(
$tpl->get());
252 $this->
DIC->ui()->mainTemplate()->setCurrentBlock(
"ContentStyle");
254 $this->
DIC->ui()->mainTemplate()->setVariable(
"LOCATION_CONTENT_STYLESHEET", $stylesheet);
255 $this->
DIC->ui()->mainTemplate()->parseCurrentBlock();
257 $this->
DIC->ui()->mainTemplate()->setCurrentBlock(
"SyntaxStyle");
259 $this->
DIC->ui()->mainTemplate()->setVariable(
"LOCATION_SYNTAX_STYLESHEET", $stylesheet);
260 $this->
DIC->ui()->mainTemplate()->parseCurrentBlock();
272 foreach ($questionGUI->getSubQuestionsIndex() as $subQuestionIndex) {
273 $table = $questionGUI->getAnswerFrequencyTableGUI(
275 'showAnswerStatistic',
280 $tablesHtml .= $table->getHTML() . $table->getAdditionalHtml();
284 $this->
DIC->ui()->mainTemplate()->setContent($tablesHtml);
293 $form->setValuesByPost();
295 if (!$form->checkInput()) {
296 $uid = md5($form->getInput(
'answer'));
299 $form->setFormAction($this->
DIC->ctrl()->getFormAction($this,
'addAnswerAsynch'));
301 $alert = $this->
DIC->ui()->factory()->messageBox()->failure(
302 $this->
DIC->language()->txt(
'form_input_not_valid')
305 $bodyTpl =
new ilTemplate(
'tpl.tst_corr_addanswermodal.html',
true,
true,
'Modules/TestQuestionPool');
306 $bodyTpl->setVariable(
'MESSAGE', $this->
DIC->ui()->renderer()->render($alert));
307 $bodyTpl->setVariable(
'FORM', $form->getHTML());
308 $bodyTpl->setVariable(
'BODY_UID', $uid);
317 $qid = (int) $form->getInput(
'qid');
329 $qIndex = (int) $form->getInput(
'qindex');
330 $points = (float) $form->getInput(
'points');
331 $answerOption = $form->getInput(
'answer');
333 if ($questionGUI->object->isAddableAnswerOptionValue($qIndex, $answerOption)) {
334 $questionGUI->object->addAnswerOptionValue($qIndex, $answerOption, $points);
335 $questionGUI->object->saveToDb();
339 $scoring->setPreserveManualScores(
true);
340 $scoring->recalculateSolutions();
354 $confirmation = sprintf(
355 $this->
DIC->language()->txt(
'tst_corrections_qst_remove_confirmation'),
356 $questionGUI->object->getTitle(),
357 $questionGUI->object->getId()
361 $this->
DIC->ui()->factory()->button()->standard(
362 $this->
DIC->language()->txt(
'confirm'),
363 $this->
DIC->ctrl()->getLinkTarget($this,
'performQuestionRemoval')
365 $this->
DIC->ui()->factory()->button()->standard(
366 $this->
DIC->language()->txt(
'cancel'),
367 $this->
DIC->ctrl()->getLinkTarget($this,
'showQuestionList')
371 $this->
DIC->ui()->mainTemplate()->setContent($this->
DIC->ui()->renderer()->render(
372 $this->
DIC->ui()->factory()->messageBox()->confirmation($confirmation)->withButtons($buttons)
384 $participantData->
load($this->testOBJ->getTestId());
387 $questionGUI->object->removeAllExistingSolutions();
390 $scoring->removeAllQuestionResults($questionGUI->object->getId());
393 $this->testOBJ->removeQuestion($questionGUI->object->getId());
394 $reindexedSequencePositionMap = $this->testOBJ->reindexFixedQuestionOrdering();
395 $this->testOBJ->loadQuestions();
398 $this->testOBJ->removeQuestionFromSequences(
399 $questionGUI->object->getId(),
400 $participantData->getActiveIds(),
401 $reindexedSequencePositionMap
405 $scoring->updatePassAndTestResults($participantData->getActiveIds());
411 $questionGUI->object->delete($questionGUI->object->getId());
414 if (!count($this->testOBJ->getTestQuestions())) {
415 $this->testOBJ->setOnline(
false);
416 $this->testOBJ->saveToDb(
true);
419 $this->
DIC->ctrl()->setParameter($this,
'qid',
'');
420 $this->
DIC->ctrl()->redirect($this,
'showQuestionList');
425 $this->
DIC->tabs()->clearTargets();
426 $this->
DIC->tabs()->clearSubTabs();
428 $this->
DIC->help()->setScreenIdComponent(
"tst");
429 $this->
DIC->help()->setScreenId(
"scoringadjust");
430 $this->
DIC->help()->setSubScreenId($activeTabId);
433 $this->
DIC->tabs()->setBackTarget(
434 $this->
DIC->language()->txt(
'back'),
435 $this->
DIC->ctrl()->getLinkTarget($this,
'showQuestionList')
438 $this->
DIC->tabs()->addTab(
440 $this->
DIC->language()->txt(
'tst_corrections_tab_question'),
441 $this->
DIC->ctrl()->getLinkTarget($this,
'showQuestion')
444 $this->
DIC->tabs()->addTab(
446 $this->
DIC->language()->txt(
'tst_corrections_tab_solution'),
447 $this->
DIC->ctrl()->getLinkTarget($this,
'showSolution')
451 $this->
DIC->tabs()->addTab(
453 $this->
DIC->language()->txt(
'tst_corrections_tab_statistics'),
454 $this->
DIC->ctrl()->getLinkTarget($this,
'showAnswerStatistic')
458 $this->
DIC->tabs()->activateTab($activeTabId);
466 $this->
DIC->ui()->mainTemplate()->setTitle($questionGUI->object->getTitle());
476 if (!$this->testOBJ->isTestQuestion($qId)) {
500 $question->object->setObjId($this->testOBJ->getId());
507 $solutionRows = array();
509 foreach ($this->testOBJ->getParticipants() as $activeId => $participantData) {
512 $passesSelector->loadLastFinishedPass();
514 foreach ($passesSelector->getClosedPasses() as
$pass) {
516 $solutionRows[] = $row;
521 return $solutionRows;
529 $questions = array();
531 foreach ($this->testOBJ->getTestQuestions() as $questionData) {
532 $questionGUI = $this->
getQuestion($questionData[
'question_id']);
542 $questions[] = $questionData;
572 $types = explode(
',', $setting->get(
'assessment_scoring_adjustment'));
573 require_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
575 foreach ($types as
$type) {
580 if (in_array($type, $type_def)) {
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
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...
Class ChatMainBarProvider .
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.
setQuestionRemoveRowButtonEnabled(bool $questionRemoveRowButtonEnabled)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static accessViolationRedirect()
isAnswerFreuqencyStatisticSupported()
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
setCorrectionTabsContext(assQuestionGUI $questionGUI, $activeTabId)
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
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.
Interface ilGuiQuestionScoringAdjustable.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
showQuestion(ilPropertyFormGUI $form=null)
Confirmation screen class.