ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjLearningModuleAccess.php
Go to the documentation of this file.
1<?php
2
23{
24 protected static ?array $lm_set = null;
25
26 public function __construct()
27 {
28 global $DIC;
30
31 $this->access = $DIC->access();
32 }
33
37 public static function getConditionOperators(): array
38 {
39 // currently only one mode "ilConditionHandler::OPERATOR_LP"
40 // which is automatically added by condition handling, if lp is activated
41 return array();
42 }
43
44
45 public static function checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id): bool
46 {
47 return true;
48 }
49
50
51 public static function _lookupSetting(string $a_set): ?string
52 {
53 if (!is_array(self::$lm_set)) {
54 $lm_set = new ilSetting("lm");
55 self::$lm_set = $lm_set->getAll();
56 }
57
58 return self::$lm_set[$a_set] ?? null;
59 }
60
61 public static function _getCommands(): array
62 {
63 if (self::_lookupSetting("lm_starting_point") == "first") {
64 $commands = array(
65 array("permission" => "read", "cmd" => "view", "lang_var" => "show",
66 "default" => true),
67 array("permission" => "read", "cmd" => "continue", "lang_var" => "continue_work")
68 );
69 } else {
70 $commands = array(
71 array("permission" => "read", "cmd" => "continue", "lang_var" => "continue_work", "default" => true)
72 );
73 }
74 $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content");
75 $commands[] = array("permission" => "write", "cmd" => "properties", "lang_var" => "settings");
76
77 return $commands;
78 }
79
80
81 public function canBeDelivered(ilWACPath $ilWACPath): bool
82 {
83 $ilAccess = $this->access;
87 preg_match("/lm_data\\/lm_([0-9]*)\\//ui", $ilWACPath->getPath(), $results);
89 if ($ilAccess->checkAccess('read', '', $ref_id)) {
90 return true;
91 }
92 }
93
94 return false;
95 }
96}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 getConditionOperators()
Get possible conditions operators.
static _getAllReferences(int $id)
get all reference ids for object ID
ILIAS Setting Class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface for condition handling.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
canBeDelivered(ilWACPath $ilWACPath)
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$results
global $DIC
Definition: shib_login.php:26
$lm_set