ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjLearningModuleAccess.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Modules/LearningModule/classes/class.ilObjContentObjectAccess.php");
6include_once './Services/AccessControl/interfaces/interface.ilConditionHandling.php';
7require_once('./Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php');
8require_once('./Services/Object/classes/class.ilObject2.php');
9
20{
21
25 public function __construct()
26 {
27 global $DIC;
28 parent::__construct();
29
30 $this->access = $DIC->access();
31 }
32
33
34 protected static $lm_set = null;
35
39 public static function getConditionOperators()
40 {
41 // currently only one mode "ilConditionHandler::OPERATOR_LP"
42 // which is automatically added by condition handling, if lp is activated
43 return array();
44 }
45
46
57 public static function checkCondition($a_trigger_obj_id, $a_operator, $a_value, $a_usr_id)
58 {
59 return true;
60 }
61
62
67 public static function _lookupSetting($a_set)
68 {
69 if (!is_array(self::$lm_set)) {
70 $lm_set = new ilSetting("lm");
71 self::$lm_set = $lm_set->getAll();
72 }
73
74 return self::$lm_set[$a_set];
75 }
76
89 public static function _getCommands()
90 {
91 if (self::_lookupSetting("lm_starting_point") == "first") {
92 $commands = array(
93 array("permission" => "read", "cmd" => "view", "lang_var" => "show",
94 "default" => true),
95 array("permission" => "read", "cmd" => "continue", "lang_var" => "continue_work")
96 );
97 } else {
98 $commands = array(
99 array("permission" => "read", "cmd" => "continue", "lang_var" => "continue_work", "default" => true)
100 );
101 }
102 $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content");
103 $commands[] = array("permission" => "write", "cmd" => "properties", "lang_var" => "settings");
104
105 return $commands;
106 }
107
108
114 public function canBeDelivered(ilWACPath $ilWACPath)
115 {
116 $ilAccess = $this->access;
120 preg_match("/lm_data\\/lm_([0-9]*)\\//ui", $ilWACPath->getPath(), $results);
121 foreach (ilObject2::_getAllReferences($results[1]) as $ref_id) {
122 if ($ilAccess->checkAccess('read', '', $ref_id)) {
123 return true;
124 }
125 }
126
127 return false;
128 }
129}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjContentObjectAccess.
Class ilObjLearningModuleAccess.
static checkCondition($a_trigger_obj_id, $a_operator, $a_value, $a_usr_id)
check condition
static getConditionOperators()
Get possible conditions operators.
static _getAllReferences($a_id)
get all reference ids of object
ILIAS Setting Class.
Class ilWACPath.
Interface for condition handling.
Class ilWACCheckingClass.
canBeDelivered(ilWACPath $ilWACPath)
global $DIC
Definition: saml.php:7
$lm_set
$results
Definition: svg-scanner.php:47