ILIAS  release_8 Revision v8.24
class.ilConditionUtil.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/******************************************************************************
6 *
7 * This file is part of ILIAS, a powerful learning management system
8 * published by ILIAS open source e-Learning e.V.
9 *
10 * ILIAS is licensed with the GPL-3.0,
11 * see https://www.gnu.org/licenses/gpl-3.0.en.html
12 * You should have received a copy of said license along with the
13 * source code, too.
14 *
15 * If this is not the case or you just want to try ILIAS, you'll find
16 * us at:
17 * https://www.ilias.de
18 * https://github.com/ILIAS-eLearning
19 *
20 *****************************************************************************/
21
30{
31 protected ilTree $tree;
34
36 {
37 global $DIC;
38
39 if (is_null($cond_obj_adapter)) {
40 $this->cond_obj_adapter = new ilConditionObjectAdapter();
41 }
42
43 $this->tree = $DIC->repositoryTree();
44 $this->obj_definition = $DIC["objDefinition"];
45 }
46
52 public function getValidRepositoryTriggerTypes(): array
53 {
54 return (new ilConditionHandler())->getTriggerTypes();
55 }
56
61 public function getOperatorsForRepositoryTriggerType(string $a_type): array
62 {
63 return (new ilConditionHandler())->getOperatorsByTriggerType($a_type);
64 }
65
69 public function isUnderParentControl(int $ref_id): bool
70 {
71 // check if parent takes over control of condition
72 $parent = $this->tree->getParentId($ref_id);
73 if (!$parent) {
74 return false;
75 }
76 $parent_obj_id = $this->cond_obj_adapter->getObjIdForRefId($parent);
77 $parent_type = $this->cond_obj_adapter->getTypeForObjId($parent_obj_id);
78
79 $class = $this->obj_definition->getClassName($parent_type);
80 $class_name = "il" . $class . "ConditionController";
81 $location = $this->obj_definition->getLocation($parent_type);
82 // if yes, get from parent
83 if (is_file($location . "/class." . $class_name . ".php")) {
85 $controller = new $class_name();
86 return $controller->isContainerConditionController($parent);
87 }
88 return false;
89 }
90}
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Condition utility object Wraps some ilConditionHandler methods (which will become deprecated) Depende...
__construct(ilConditionObjectAdapterInterface $cond_obj_adapter=null)
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.
ilObjectDefinition $obj_definition
parses the objects.xml it handles the xml-description of all ilias objects
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67