Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release_10' into release_10
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansenDatabay committed Jan 15, 2025
2 parents 0c54094 + 921d63d commit ae7937a
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 64 deletions.
12 changes: 2 additions & 10 deletions components/ILIAS/AccessControl/classes/class.ilRbacReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

declare(strict_types=1);

declare(strict_types=1);

/**
* class ilRbacReview
* Contains Review functions of core Rbac.
Expand Down Expand Up @@ -868,34 +866,28 @@ public function getRolesByFilter(int $a_filter = 0, int $a_user_id = 0, string $
{
$assign = "y";
switch ($a_filter) {
// all (assignable) roles
case self::FILTER_ALL:
yield from $this->getAssignableRolesGenerator(true, true, $title_filter);
return yield from $this->getAssignableRolesGenerator(true, true, $title_filter);

// all (assignable) global roles
// no break
case self::FILTER_ALL_GLOBAL:
$where = 'WHERE ' . $this->db->in('rbac_fa.rol_id', $this->getGlobalRoles(), false, 'integer') . ' ';
break;

// all (assignable) local roles
case self::FILTER_ALL_LOCAL:
case self::FILTER_INTERNAL:
case self::FILTER_NOT_INTERNAL:
$where = 'WHERE ' . $this->db->in('rbac_fa.rol_id', $this->getGlobalRoles(), true, 'integer');
break;

// all role templates
case self::FILTER_TEMPLATES:
$where = "WHERE object_data.type = 'rolt'";
$assign = "n";
break;

// only assigned roles, handled by ilObjUserGUI::roleassignmentObject()
case 0:
default:
if (!$a_user_id) {
return [];
return;
}

$where = 'WHERE ' . $this->db->in(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

declare(strict_types=1);
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -17,6 +16,10 @@
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\Refinery\Factory as Refinery;

/**
* @author Stefan Meyer <[email protected]>
* @version $Id$
Expand All @@ -25,12 +28,14 @@
class ilRoleSelectionTableGUI extends ilTable2GUI
{
protected ilRbacReview $review;
protected Refinery $refinery;

public function __construct(object $a_parent_obj, string $a_parent_cmd)
{
global $DIC;

$this->review = $DIC->rbac()->review();
$this->review = $DIC['rbacreview'];
$this->refinery = $DIC['refinery'];

parent::__construct($a_parent_obj, $a_parent_cmd);
$this->addColumn('', 'f', (string) 1);
Expand All @@ -57,10 +62,17 @@ public function parse(array $entries): void
{
$records_arr = [];
foreach ($entries as $entry) {
$role = new ilObjRole($entry['obj_id'], false);
$tmp_arr['id'] = $entry['obj_id'];
$tmp_arr['title'] = ilObjRole::_getTranslation(ilObject::_lookupTitle($entry['obj_id']));
$tmp_arr['description'] = ilObject::_lookupDescription($entry['obj_id']);
$tmp_arr['context'] = ilObject::_lookupTitle($this->review->getObjectOfRole((int) $entry['obj_id']));
$tmp_arr['title'] = $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
$role->getPresentationTitle()
);
$tmp_arr['description'] = $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
$role->getDescription()
);
$tmp_arr['context'] = $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
ilObject::_lookupTitle($this->review->getObjectOfRole((int) $entry['obj_id']))
);

$records_arr[] = $tmp_arr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getEvaluationData(): ilTestEvaluationData
$user_eval_data = new ilTestEvaluationUserData($scoring_settings);

$user_eval_data->setName(
$this->test_obj->buildName($row['usr_id'], $row['firstname'], $row['lastname'], $row['title'])
$this->test_obj->buildName($row['usr_id'], $row['firstname'], $row['lastname'], $row['title'] ?? '')
);

if ($row['login'] !== null) {
Expand Down
14 changes: 9 additions & 5 deletions components/ILIAS/Test/classes/class.ilObjTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2553,19 +2553,23 @@ public function getCompleteEvaluationData($filterby = '', $filtertext = ''): ilT
* @return string The output name of the user
* @access public
*/
public function buildName($user_id, $firstname, $lastname, $title): string
{
public function buildName(
int $user_id,
string $firstname,
string $lastname,
string $title
): string {
$name = "";
if (strlen($firstname . $lastname . $title) == 0) {
if ($firstname . $lastname . $title !== '') {
$name = $this->lng->txt('deleted_user');
} else {
if ($user_id == ANONYMOUS_USER_ID) {
$name = $lastname;
} else {
$name = trim($lastname . ", " . $firstname . " " . $title);
$name = trim($lastname . ', ' . $firstname . ' ' . $title);
}
if ($this->getAnonymity()) {
$name = $this->lng->txt("anonymous");
$name = $this->lng->txt('anonymous');
}
}
return $name;
Expand Down
14 changes: 5 additions & 9 deletions components/ILIAS/Test/classes/class.ilTestCorrectionsGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use ILIAS\Test\Logging\TestQuestionAdministrationInteractionTypes;
use ILIAS\Test\RequestDataCollector;
use ILIAS\UI\Factory as UIFactory;
use ILIAS\UI\Renderer as UIRenderer;
use ILIAS\Refinery\Factory as RefineryFactory;

/**
Expand Down Expand Up @@ -73,6 +72,7 @@ public function executeCommand()
return;
}

$this->ctrl->saveParameterByClass(self::class, 'q_id');
$command = $this->ctrl->getCmd('showQuestionList');
$this->{$command}();
}
Expand Down Expand Up @@ -186,7 +186,7 @@ protected function saveQuestion()
}

$this->main_tpl->setOnScreenMessage('success', $this->language->txt('saved_successfully'), true);
$this->ctrl->redirect($this, 'showQuestion');
$this->ctrl->redirectByClass([ilObjTestGUI::class, self::class], 'showQuestion');
}

protected function showSolution()
Expand Down Expand Up @@ -340,31 +340,27 @@ protected function setCorrectionTabsContext(assQuestionGUI $question_gui, string
$this->tabs->addTab(
'question',
$this->language->txt('tst_corrections_tab_question'),
$this->ctrl->getLinkTargetByClass(self::class, 'showQuestion')
$this->ctrl->getLinkTargetByClass([ilObjTestGUI::class, self::class], 'showQuestion')
);

$this->tabs->addTab(
'solution',
$this->language->txt('tst_corrections_tab_solution'),
$this->ctrl->getLinkTargetByClass(self::class, 'showSolution')
$this->ctrl->getLinkTargetByClass([ilObjTestGUI::class, self::class], 'showSolution')
);

if ($question_gui->isAnswerFrequencyStatisticSupported()) {
$this->tabs->addTab(
'answers',
$this->language->txt('tst_corrections_tab_statistics'),
$this->ctrl->getLinkTargetByClass(self::class, 'showAnswerStatistic')
$this->ctrl->getLinkTargetByClass([ilObjTestGUI::class, self::class], 'showAnswerStatistic')
);
}

$this->ctrl->clearParameterByClass(ilObjTestGUI::class, 'q_id');
$this->ctrl->clearParameterByClass(self::class, 'q_id');
$this->tabs->setBackTarget(
$this->language->txt('back'),
$this->ctrl->getLinkTargetByClass(ilObjTestGUI::class, 'showQuestions')
);
$this->ctrl->setParameterByClass(ilObjTestGUI::class, 'q_id', $question_gui->getObject()->getId());
$this->ctrl->setParameterByClass(self::class, 'q_id', $question_gui->getObject()->getId());

$this->tabs->activateTab($active_tab_id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public function handleCommand(
return false;

case self::ACTION_ADJUST:
$this->ctrl->setParameterByClass(\ilTestCorrectionsGUI::class, 'qid', (int) current($row_ids));
$this->redirectWithQuestionParameters(
current($row_ids),
\ilTestCorrectionsGUI::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ protected function saveStartingPoint(): void
$entries = $res->getEntries();

if ($entries === []) {
$this->tpl->setOnScreenMessage('failure', $this->lng->txt('obj_ref_id_not_exist'), true);
$this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_corresponding_roles'), true);
$form->setValuesByPost();
$this->tpl->setContent($form->getHTML());
return;
Expand Down
Loading

0 comments on commit ae7937a

Please sign in to comment.