19 declare(strict_types=1);
60 $this->db = $DIC[
'ilDB'];
61 $this->
user = $DIC[
'ilUser'];
62 $this->
lng = $DIC[
'lng'];
63 $this->rbac_system = $DIC[
'rbacsystem'];
64 $this->
access = $DIC[
'ilAccess'];
77 return !$can_it->isOk() || $can_it->value();
84 ),
new Error(
'Not a known path.'));
100 $is_admin = $this->rbac_system->checkAccessOfUser(
$user_id,
'write', $ref_id)
101 || $this->rbac_system->checkAccessOfUser(
$user_id,
'score_anon', $ref_id);
105 if (!$is_admin && !$is_online) {
109 switch ($permission) {
151 public static function checkCondition(
int $a_trigger_obj_id,
string $a_operator,
string $a_value,
int $a_usr_id):
bool 154 $test_result_repository = TestDIC::dic()[
'results.data.repository'];
156 switch ($a_operator) {
158 return $test_result_repository->isPassed($a_usr_id, $a_trigger_obj_id);
161 return $test_result_repository->isFailed($a_usr_id, $a_trigger_obj_id);
164 return $test_result_repository->hasFinished($a_usr_id, $a_trigger_obj_id);
167 return !$test_result_repository->hasFinished($a_usr_id, $a_trigger_obj_id);
177 $DIC->language()->loadLanguageModule(
'assessment');
180 [
"permission" =>
"write",
"cmd" =>
"questionsTabGateway",
"lang_var" =>
"tst_edit_questions"],
181 [
"permission" =>
"write",
"cmd" =>
"ILIAS\Test\Settings\MainSettings\SettingsMainGUI::showForm",
"lang_var" =>
"settings"],
182 [
"permission" =>
"read",
"cmd" =>
"ILIAS\Test\Presentation\TestScreenGUI::testScreen",
"lang_var" =>
"tst_run",
"default" =>
true],
183 [
"permission" =>
"score_anon",
"cmd" =>
"ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI::showManScoringByQuestionParticipantsTable",
"lang_var" =>
"manscoring",
"default" =>
true],
202 $db = $DIC->database();
204 "SELECT complete FROM tst_tests WHERE obj_fi=%s",
208 return $result->numRows() > 0 && (bool) $db->
fetchAssoc($result)[
'complete'];
221 $ilDB = $DIC[
'ilDB'];
223 $result =
$ilDB->queryF(
224 "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
228 if ($result->numRows()) {
229 $row =
$ilDB->fetchAssoc($result);
230 $test_id = $row[
"test_id"];
245 $ilDB = $DIC[
'ilDB'];
248 SELECT DISTINCT t.obj_fi 250 INNER JOIN tst_rnd_quest_set_qpls r 251 ON t.test_id = r.test_fi 255 $result =
$ilDB->queryF($query, [
'integer'], [$qpl_id]);
258 while ($row =
$ilDB->fetchAssoc($result)) {
259 $tests[] = $row[
'obj_fi'];
276 $ilDB = $DIC[
'ilDB'];
278 $result_active =
$ilDB->queryF(
279 'SELECT * FROM tst_active WHERE active_id = %s',
283 $row_active =
$ilDB->fetchAssoc($result_active);
284 $importname = $row_active[
'importname'];
286 if ($importname !==
null 287 && $importname !==
'') {
288 return $importname .
' (' . $lng->
txt(
'imported') .
')';
297 $result_test =
$ilDB->queryF(
298 "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
300 [$row_active[
'test_fi']]
302 $row_test =
$ilDB->fetchAssoc($result_test);
303 $obj_id = $row_test[
"obj_fi"];
306 return $lng->
txt(
"anonymous");
309 if ($uname[
'firstname'] . $uname[
'lastname'] ===
'') {
310 return $lng->
txt(
'deleted_user');
313 return trim($uname[
'lastname'] .
', ' . $uname[
'firstname']);
325 $ilDB = $DIC[
'ilDB'];
327 $result =
$ilDB->queryF(
328 'SELECT user_fi FROM tst_active WHERE active_id = %s',
332 $row =
$ilDB->fetchAssoc($result);
333 return $row[
'user_fi'];
342 $ilAccess = $DIC[
'ilAccess'];
344 $t_arr = explode(
"_", $target);
346 if ($t_arr[0] !=
"tst" || ((
int) $t_arr[1]) <= 0) {
350 if ($ilAccess->checkAccess(
"read",
"", (
int) $t_arr[1]) ||
351 $ilAccess->checkAccess(
"visible",
"", (
int) $t_arr[1])) {
371 $ilDB = $DIC[
'ilDB'];
372 $ilUser = $DIC[
'ilUser'];
381 $test_session = $test_session_factory->getSessionByUserId($user_id);
383 return $test_obj->canShowTestResults($test_session);
386 public static function _preloadData(array $obj_ids, array $ref_ids): void
391 self::$certificate_preloader->preLoad($DIC[
'ilUser']->
getId(), $obj_ids);
393 ->getSettingsResultSummaryByObjIds($obj_ids);
399 if (self::$certificate_preloader ===
null 400 || !self::$certificate_preloader->isPreloaded($user_id, $obj_id)
401 || !isset(self::$settings_result_summaries_by_obj_id[$obj_id])
402 || self::$settings_result_summaries_by_obj_id[$obj_id]->getScoreReporting()
403 === ScoreReportingTypes::SCORE_REPORTING_DISABLED) {
407 $score_reporting = self::$settings_result_summaries_by_obj_id[$obj_id]->getScoreReporting();
408 if ($score_reporting === ScoreReportingTypes::SCORE_REPORTING_IMMIDIATLY) {
412 if ($score_reporting === ScoreReportingTypes::SCORE_REPORTING_DATE
const string OPERATOR_FINISHED
const IL_NO_OBJECT_ACCESS
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
fetchAssoc(ilDBStatement $statement)
except(callable $f)
Feed the error into a callable and replace this with the result or do nothing if this is a value...
static ilCertificateObjectsForUserPreloader $certificate_preloader
static _getTestIDFromObjectID(int $object_id)
Returns the ILIAS test id for a given object id.
static _lookupName(int $a_user_id)
lookup user name
Interface for condition handling.
const string OPERATOR_NOT_FINISHED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupAnonymity($a_obj_id)
static getBypassActivationCheckForPermissions()
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
showCertificateFor(int $user_id, int $obj_id)
canBeDelivered(ilWACPath $ilWACPath)
static _getRandomTestsForQuestionPool(int $qpl_id)
Get all tests using a question pool for random selection.
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...
static array $settings_result_summaries_by_obj_id
const string OPERATOR_FAILED
findMatch(string $path, array $array)
isPermitted(string $path)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
queryF(string $query, array $types, array $values)
static _checkGoto(string $target)
check whether goto script will succeed
static getConditionOperators()
Get possible conditions operators.
static _isOffline(int $obj_id)
returns the objects's OFFline status
const string OPERATOR_PASSED
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _preloadData(array $obj_ids, array $ref_ids)
ilRbacSystem $rbac_system
static lookupCreationComplete(int $a_obj_id)
__construct(Container $dic, ilPlugin $plugin)
static visibleUserResultExists(int $test_obj_id, int $user_id)
static _getParticipantId(int $active_id)
Get user id for active id.
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition for a specific user and object
static _getParticipantData(int $active_id)
Retrieves a participant name from active id.