Skip to content

Commit

Permalink
TA: QuestionList, do not check on user pref
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen committed Sep 26, 2023
1 parent 7d90bea commit 7935437
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 59 deletions.
88 changes: 36 additions & 52 deletions Modules/Test/classes/class.ilTestPlayerAbstractGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1245,64 +1245,48 @@ public function checkWorkingTimeCmd(): void

protected function showSideList($current_sequence_element): void
{
$side_list_active = $this->user->getPref('side_list_of_questions');
if (!$side_list_active) {
return;
}
if ($side_list_active) {
$questionSummaryData = $this->service->getQuestionSummaryData($this->testSequence, false);

//TODO
global $DIC;
$f = $DIC['ui.factory'];
$lng = $DIC['lng'];
$ctrl = $DIC['ilCtrl'];
$questions = [];

$active = 0;
foreach ($questionSummaryData as $idx => $row) {
$title = ilLegacyFormElementsUtil::prepareFormOutput($row['title']);
if (strlen($row['description'])) {
$description = " title=\"" . htmlspecialchars($row['description']) . "\" ";
} else {
$description = "";
}

if (!$row['disabled']) {
$ctrl->setParameter($this, 'pmode', '');
$ctrl->setParameter($this, 'sequence', $row['sequence']);
$action = $ctrl->getLinkTarget($this, ilTestPlayerCommands::SHOW_QUESTION);
$ctrl->setParameter($this, 'pmode', ilTestPlayerAbstractGUI::PRESENTATION_MODE_VIEW);
$ctrl->setParameter($this, 'sequence', $this->getCurrentSequenceElement($current_sequence_element));
}

$status = ILIAS\UI\Component\Listing\Workflow\Step::NOT_STARTED;

if ($row['worked_through']
|| $row['isAnswered']
//|| $row['sequence'] == $current_sequence_element
$questionSummaryData = $this->service->getQuestionSummaryData($this->testSequence, false);
$questions = [];
$active = 0;

foreach ($questionSummaryData as $idx => $row) {
$title = ilLegacyFormElementsUtil::prepareFormOutput($row['title']);
if (strlen($row['description'])) {
$description = " title=\"" . htmlspecialchars($row['description']) . "\" ";
} else {
$description = "";
}

) {
$status = ILIAS\UI\Component\Listing\Workflow\Step::IN_PROGRESS;
}
if (!$row['disabled']) {
$this->ctrl->setParameter($this, 'pmode', '');
$this->ctrl->setParameter($this, 'sequence', $row['sequence']);
$action = $this->ctrl->getLinkTarget($this, ilTestPlayerCommands::SHOW_QUESTION);
$this->ctrl->setParameter($this, 'pmode', ilTestPlayerAbstractGUI::PRESENTATION_MODE_VIEW);
$this->ctrl->setParameter($this, 'sequence', $this->getCurrentSequenceElement($current_sequence_element));
}

$status = ILIAS\UI\Component\Listing\Workflow\Step::NOT_STARTED;

$questions[] = $f->listing()->workflow()->step($title, $description, $action)
->withStatus($status);
$active = $row['sequence'] == $current_sequence_element ? $idx : $active;
if ($row['worked_through'] || $row['isAnswered']) {
$status = ILIAS\UI\Component\Listing\Workflow\Step::IN_PROGRESS;
}

$question_listing = $f->listing()->workflow()->linear(
$this->lng->txt('mainbar_button_label_questionlist'),
$questions
)->withActive($active);
$questions[] = $this->ui_factory->listing()->workflow()
->step($title, $description, $action)
->withStatus($status);
$active = $row['sequence'] == $current_sequence_element ? $idx : $active;
}

$question_listing = $this->ui_factory->listing()->workflow()->linear(
$this->lng->txt('mainbar_button_label_questionlist'),
$questions
)->withActive($active);


$this->global_screen->tool()->context()->current()->addAdditionalData(
ilTestPlayerLayoutProvider::TEST_PLAYER_QUESTIONLIST,
$question_listing
);
}
$this->global_screen->tool()->context()->current()->addAdditionalData(
ilTestPlayerLayoutProvider::TEST_PLAYER_QUESTIONLIST,
$question_listing
);
}

abstract protected function isQuestionSummaryFinishTestButtonRequired();
Expand Down Expand Up @@ -2207,7 +2191,7 @@ protected function getQuestionInstance(int $question_id, bool $from_cache = true
if ($from_cache && isset($this->cachedQuestionObjects[$question_id])) {
return $this->cachedQuestionObjects[$question_id];
}
$question = assQuestion::_instantiateQuestion($question_id);
$question = assQuestion::instantiateQuestion($question_id);

$ass_settings = new ilSetting('assessment');

Expand Down
7 changes: 0 additions & 7 deletions Modules/Test/classes/class.ilTestServiceGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ class ilTestServiceGUI
protected HTTPServices $http;
protected ilCtrl $ctrl;
protected ilToolbarGUI $toolbar;

/*
public ilLanguage $lng;
public ilGlobalTemplateInterface|ilTemplate $tpl;
public ilCtrl $ctrl;
*/

protected ilTabsGUI $tabs;
protected ilObjectDataCache $obj_cache;
protected ilComponentRepository $component_repository;
Expand Down

0 comments on commit 7935437

Please sign in to comment.