ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLearningSequenceConditionController Class Reference

Handle Conditions within the LearningSequence Objects. More...

+ Inheritance diagram for ilLearningSequenceConditionController:
+ Collaboration diagram for ilLearningSequenceConditionController:

Public Member Functions

 isContainerConditionController (int $a_container_ref_id)
 Returns true, if the a container controls the conditions of its childrens. More...
 
 getConditionSetForRepositoryObject (int $a_container_child_ref_id)
 Returns condition set for a repository object which is children under a container that controls the conditions. More...
 
 isContainerConditionController (int $a_container_ref_id)
 Returns true, if the a container controls the conditions of its childrens. More...
 
 getConditionSetForRepositoryObject (int $a_container_child_ref_id)
 Returns condition set for a repository object which is children under a container that controls the conditions. More...
 

Protected Member Functions

 getConditionsFactory ()
 
 getDIC ()
 
 getTree ()
 
 getAccess ()
 
 getParentRefIdFor (int $child_ref_id)
 
 getSequencedItems (int $container_ref_id)
 
 applyConditionsForCurrentUser (int $container_ref_id)
 

Detailed Description

Handle Conditions within the LearningSequence Objects.

Definition at line 26 of file class.ilLearningSequenceConditionController.php.

Member Function Documentation

◆ applyConditionsForCurrentUser()

ilLearningSequenceConditionController::applyConditionsForCurrentUser ( int  $container_ref_id)
protected

Definition at line 133 of file class.ilLearningSequenceConditionController.php.

133 : bool
134 {
135 $il_access = $this->getAccess();
136 $may_edit = $il_access->checkAccess('edit_permission', '', $container_ref_id);
137 return $may_edit === false;
138 }

References getAccess().

Referenced by getConditionSetForRepositoryObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccess()

ilLearningSequenceConditionController::getAccess ( )
protected

Definition at line 96 of file class.ilLearningSequenceConditionController.php.

96 : ilAccess
97 {
98 $dic = $this->getDIC();
99 return $dic['ilAccess'];
100 }
Class ilAccessHandler Checks access for ILIAS objects.
$dic
Definition: ltiresult.php:33

References $dic, and getDIC().

Referenced by applyConditionsForCurrentUser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getConditionSetForRepositoryObject()

ilLearningSequenceConditionController::getConditionSetForRepositoryObject ( int  $a_container_child_ref_id)

Returns condition set for a repository object which is children under a container that controls the conditions.

Implements ilConditionControllerInterface.

Definition at line 39 of file class.ilLearningSequenceConditionController.php.

40 {
41 $f = $this->getConditionsFactory();
42 $conditions = [];
43
44 $container_ref_id = $this->getParentRefIdFor((int) $a_container_child_ref_id);
45
46 //for users with edit-permissions, do not apply conditions
47 if ($this->applyConditionsForCurrentUser($container_ref_id)) {
48 $sequence = $this->getSequencedItems($container_ref_id);
49
50 //find position
51 $pos = 0;
52 foreach ($sequence as $index => $item) {
53 if ($item->getRefId() === (int) $a_container_child_ref_id) {
54 $pos = $index;
55 break;
56 }
57 }
58
59 if ($pos > 0) {
60 $previous_item = $sequence[$pos - 1];
61 $post_conditions = array($previous_item->getPostCondition());
62
63 foreach ($post_conditions as $post_condition) {
64 $condition_op = $post_condition->getConditionOperator();
65 if ($condition_op !== ilLSPostConditionDB::STD_ALWAYS_OPERATOR) {
66 $conditions[] = $f->condition(
67 $f->repositoryTrigger($previous_item->getRefId()),
68 $condition_op,
69 $post_condition->getValue()
70 );
71 }
72 }
73 }
74 }
75
76 return $f->set($conditions);
77 }
Condition set Note: This object currently focuses on repository objects as targets.

References Vendor\Package\$f, applyConditionsForCurrentUser(), getConditionsFactory(), getParentRefIdFor(), getSequencedItems(), and ilLSPostConditionDB\STD_ALWAYS_OPERATOR.

+ Here is the call graph for this function:

◆ getConditionsFactory()

ilLearningSequenceConditionController::getConditionsFactory ( )
protected

Definition at line 79 of file class.ilLearningSequenceConditionController.php.

80 {
81 return $this->getDIC()->conditions()->factory();
82 }

References getDIC().

Referenced by getConditionSetForRepositoryObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDIC()

ilLearningSequenceConditionController::getDIC ( )
protected

Definition at line 84 of file class.ilLearningSequenceConditionController.php.

84 : Container
85 {
86 global $DIC;
87 return $DIC;
88 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
global $DIC
Definition: shib_login.php:26

References $DIC.

Referenced by getAccess(), getConditionsFactory(), and getTree().

+ Here is the caller graph for this function:

◆ getParentRefIdFor()

ilLearningSequenceConditionController::getParentRefIdFor ( int  $child_ref_id)
protected

Definition at line 102 of file class.ilLearningSequenceConditionController.php.

102 : int
103 {
104 $tree = $this->getTree();
105 return (int) $tree->getParentId($child_ref_id);
106 }

References getTree().

Referenced by getConditionSetForRepositoryObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSequencedItems()

ilLearningSequenceConditionController::getSequencedItems ( int  $container_ref_id)
protected
Returns
LSItem[]

Definition at line 127 of file class.ilLearningSequenceConditionController.php.

127 : array
128 {
129 $container = $this->getContainerObject($container_ref_id);
130 return $container->getLSItems();
131 }
$container
@noRector
Definition: wac.php:37

References $container.

Referenced by getConditionSetForRepositoryObject().

+ Here is the caller graph for this function:

◆ getTree()

ilLearningSequenceConditionController::getTree ( )
protected

Definition at line 90 of file class.ilLearningSequenceConditionController.php.

90 : ilTree
91 {
92 $dic = $this->getDIC();
93 return $dic['tree'];
94 }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

References $dic, and getDIC().

Referenced by getParentRefIdFor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContainerConditionController()

ilLearningSequenceConditionController::isContainerConditionController ( int  $a_container_ref_id)

Returns true, if the a container controls the conditions of its childrens.

Implements ilConditionControllerInterface.

Definition at line 31 of file class.ilLearningSequenceConditionController.php.

31 : bool
32 {
33 return true;
34 }

The documentation for this class was generated from the following file: