Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions components/ILIAS/soap/classes/class.ilSoapTestAdministration.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ public function removeTestResults(string $sid, int $test_ref_id, array $a_user_i
);
}

/** @var ilObjTest|null $tst */
if (!$tst = ilObjectFactory::getInstanceByRefId($test_ref_id, false)) {
return $this->raiseError('No test found for id: ' . $test_ref_id, 'Client');
}
Expand All @@ -575,10 +576,9 @@ public function removeTestResults(string $sid, int $test_ref_id, array $a_user_i
$a_user_ids = $a_user_ids['item'];
}

$accessFilter = $this->getAccessResultsUserFilter($test_ref_id);
$part = new ilTestParticipantData($GLOBALS['DIC']['ilDB'], $GLOBALS['DIC']['lng']);
$part->setParticipantAccessFilter(
ilTestParticipantAccessFilter::getManageParticipantsUserFilter($test_ref_id)
);
$part->setParticipantAccessFilter($accessFilter);
$part->setUserIdsFilter((array) $a_user_ids);
$part->load($tst->getTestId());
$tst->removeTestResults($part);
Expand Down Expand Up @@ -606,8 +606,9 @@ public function getTestResults(string $sid, int $test_ref_id, bool $sum_only)
global $DIC;

$rbacsystem = $DIC['rbacsystem'];
$tree = $DIC['tree'];
$ilLog = $DIC['ilLog'];
$il_user = $DIC['ilUser'];
$il_lng = $DIC['lng'];
$il_db = $DIC['ilDB'];

if (ilObject::_isInTrash($test_ref_id)) {
return $this->raiseError(
Expand Down Expand Up @@ -651,8 +652,13 @@ public function getTestResults(string $sid, int $test_ref_id, bool $sum_only)
$test_obj = new ilObjTest($obj_id, false);
$participants = $test_obj->getTestParticipants();

$accessFilter = ilTestParticipantAccessFilter::getAccessResultsUserFilter($test_ref_id);
$participantList = new ilTestParticipantList($test_obj);
$accessFilter = $this->getAccessResultsUserFilter($test_ref_id);
$participantList = new ilTestParticipantList(
$test_obj,
$il_user,
$il_lng,
$il_db,
);
$participantList->initializeFromDbRows($participants);
$participantList = $participantList->getAccessFilteredList($accessFilter);
$participantList = $participantList->getScoredParticipantList();
Expand Down Expand Up @@ -730,4 +736,15 @@ protected function getTestAccess(int $refId): ilTestAccess
$testId = ilObjTestAccess::_getTestIDFromObjectID(ilObject::_lookupObjectId($refId));
return new ilTestAccess($refId, $testId);
}

private function getAccessResultsUserFilter(int $ref_id): \Closure
{
global $DIC;

$ilAccess = $DIC['ilAccess'];

$factory = new ilTestParticipantAccessFilterFactory($ilAccess);

return $factory->getAccessResultsUserFilter($ref_id);
}
}