ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLearningSequenceConditionController Class Reference

Handle Conditions within the LearningSequence Objects. More...

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

Public Member Functions

 isContainerConditionController ($a_container_ref_id)
 Returns true, if the a container controls the conditions of its childrens.
Parameters
int$a_container_ref_idref id of a container
Returns
bool
More...
 
 getConditionSetForRepositoryObject ($a_container_child_ref_id)
 Returns condition set for a repository object which is children under a container that controls the conditions.
Parameters
int$a_container_child_ref_idref if of children object
Returns
ilConditionSet
More...
 
 isContainerConditionController ($a_container_ref_id)
 Returns true, if the a container controls the conditions of its childrens. More...
 
 getConditionSetForRepositoryObject ($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)
 
 getContainerObject (int $container_ref_id)
 
 getSequencedItems (int $container_ref_id)
 
 applyConditionsForCurrentUser (int $container_ref_id)
 

Detailed Description

Handle Conditions within the LearningSequence Objects.

Author
Nils Haagen nils..nosp@m.haag.nosp@m.en@co.nosp@m.ncep.nosp@m.ts-an.nosp@m.d-tr.nosp@m.ainin.nosp@m.g.de

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

Member Function Documentation

◆ applyConditionsForCurrentUser()

ilLearningSequenceConditionController::applyConditionsForCurrentUser ( int  $container_ref_id)
protected

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

109 : bool
110 {
111 $il_access = $this->getAccess();
112 $may_edit = $il_access->checkAccess('edit_permission', '', $container_ref_id);
113 return $may_edit === false;
114 }

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 86 of file class.ilLearningSequenceConditionController.php.

87 {
88 $dic = $this->getDIC();
89 return $dic['ilAccess'];
90 }
$dic
Definition: result.php:13

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 (   $a_container_child_ref_id)

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

Parameters
int$a_container_child_ref_idref if of children object
Returns
ilConditionSet

Implements ilConditionControllerInterface.

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

24 {
25 $f = $this->getConditionsFactory();
26 $conditions = [];
27
28 $container_ref_id = $this->getParentRefIdFor((int) $a_container_child_ref_id);
29
30 //for users with edit-permissions, do not apply conditions
31 if ($this->applyConditionsForCurrentUser($container_ref_id)) {
32 $sequence = $this->getSequencedItems($container_ref_id);
33
34 //find position
35 foreach ($sequence as $index => $item) {
36 if ($item->getRefId() === (int) $a_container_child_ref_id) {
37 $pos = $index;
38 break;
39 }
40 }
41
42 if ($pos > 0) {
43 $previous_item = $sequence[$pos - 1];
44 $post_conditions = array($previous_item->getPostCondition());
45
46 if (count($post_conditions) > 0) {
47 foreach ($post_conditions as $post_condition) {
48 $operator = false;
49 $condition_op = $post_condition->getConditionOperator();
50 if ($condition_op === 'learning_progress') {
51 $condition_op = 'learningProgress';
52 }
53 if ($condition_op !== \ilLSPostConditionDB::STD_ALWAYS_OPERATOR) {
54 $conditions[] = $f->condition(
55 $f->repositoryTrigger($previous_item->getRefId()),
56 $f->operator()->$condition_op(),
57 $post_condition->getValue()
58 );
59 }
60 }
61 }
62 }
63 }
64
65 $condition_set = $f->set($conditions);
66 return $condition_set;
67 }
$index
Definition: metadata.php:128

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

+ Here is the call graph for this function:

◆ getConditionsFactory()

ilLearningSequenceConditionController::getConditionsFactory ( )
protected

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

70 {
71 return $this->getDIC()->conditions()->factory();
72 }

References getDIC().

Referenced by getConditionSetForRepositoryObject().

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

◆ getContainerObject()

ilLearningSequenceConditionController::getContainerObject ( int  $container_ref_id)
protected

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

99 {
100 return ilObjectFactory::getInstanceByRefId($container_ref_id);
101 }
Class ilObjLearningSequence.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id

References ilObjectFactory\getInstanceByRefId().

Referenced by getSequencedItems().

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

◆ getDIC()

ilLearningSequenceConditionController::getDIC ( )
protected

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

75 {
76 global $DIC;
77 return $DIC;
78 }
$DIC
Definition: xapitoken.php:46

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 92 of file class.ilLearningSequenceConditionController.php.

92 : int
93 {
94 $tree = $this->getTree();
95 return (int) $tree->getParentId($child_ref_id);
96 }

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

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

103 : array
104 {
105 $container = $this->getContainerObject($container_ref_id);
106 return $container->getLSItems($container_ref_id);
107 }
$container
Definition: wac.php:13

References $container, and getContainerObject().

Referenced by getConditionSetForRepositoryObject().

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

◆ getTree()

ilLearningSequenceConditionController::getTree ( )
protected

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

81 {
82 $dic = $this->getDIC();
83 return $dic['tree'];
84 }

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 (   $a_container_ref_id)

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

Parameters
int$a_container_ref_idref id of a container
Returns
bool

Implements ilConditionControllerInterface.

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

15 : bool
16 {
17 return true;
18 }

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