ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilConditionUtil.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
30 protected ilTree $tree;
33
35 {
36 global $DIC;
37
38 if (is_null($cond_obj_adapter)) {
39 $this->cond_obj_adapter = new ilConditionObjectAdapter();
40 }
41
42 $this->tree = $DIC->repositoryTree();
43 $this->obj_definition = $DIC["objDefinition"];
44 }
45
51 public function getValidRepositoryTriggerTypes(): array
52 {
53 return (new ilConditionHandler())->getTriggerTypes();
54 }
55
60 public function getOperatorsForRepositoryTriggerType(string $a_type): array
61 {
62 return (new ilConditionHandler())->getOperatorsByTriggerType($a_type);
63 }
64
68 public function isUnderParentControl(int $ref_id): bool
69 {
70 // check if parent takes over control of condition
71 $parent = $this->tree->getParentId($ref_id);
72 if (!$parent) {
73 return false;
74 }
75 $parent_obj_id = $this->cond_obj_adapter->getObjIdForRefId($parent);
76 $parent_type = $this->cond_obj_adapter->getTypeForObjId($parent_obj_id);
77
78 $class = $this->obj_definition->getClassName($parent_type);
79 $class_name = "il" . $class . "ConditionController";
80 $location = $this->obj_definition->getLocation($parent_type);
81 // if yes, get from parent
82 if (is_file($location . "/class." . $class_name . ".php")) {
84 $controller = new $class_name();
85 return $controller->isContainerConditionController($parent);
86 }
87 return false;
88 }
89}
$location
Definition: buildRTE.php:22
INTERNAL CLASS: Please do not use in consumer code.
Condition utility object Wraps some ilConditionHandler methods (which will become deprecated) Depende...
ilConditionObjectAdapterInterface $cond_obj_adapter
getValidRepositoryTriggerTypes()
Get all valid repository trigger object types This holds currently a dependency on $objDefinition and...
getOperatorsForRepositoryTriggerType(string $a_type)
Get operators for repository trigger object type.
__construct(?ilConditionObjectAdapterInterface $cond_obj_adapter=null)
ilObjectDefinition $obj_definition
parses the objects.xml it handles the xml-description of all ilias objects
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26