ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 

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

References getAccess().

Referenced by getConditionSetForRepositoryObject().

108  : bool
109  {
110  $il_access = $this->getAccess();
111  $may_edit = $il_access->checkAccess('edit_permission', '', $container_ref_id);
112  return $may_edit === false;
113  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccess()

ilLearningSequenceConditionController::getAccess ( )
protected

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

References getDIC().

Referenced by applyConditionsForCurrentUser().

86  {
87  $dic = $this->getDIC();
88  return $dic['ilAccess'];
89  }
+ 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.

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

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  );
58  }
59  }
60  }
61  }
62  }
63 
64  $condition_set = $f->set($conditions);
65  return $condition_set;
66  }
$index
Definition: metadata.php:60
+ Here is the call graph for this function:

◆ getConditionsFactory()

ilLearningSequenceConditionController::getConditionsFactory ( )
protected

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

References getDIC().

Referenced by getConditionSetForRepositoryObject().

69  {
70  return $this->getDIC()->conditions()->factory();
71  }
+ 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 97 of file class.ilLearningSequenceConditionController.php.

References ilObjectFactory\getInstanceByRefId().

Referenced by getSequencedItems().

98  {
99  return ilObjectFactory::getInstanceByRefId($container_ref_id);
100  }
Class ilObjLearningSequence.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDIC()

ilLearningSequenceConditionController::getDIC ( )
protected

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

References $DIC.

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

74  {
75  global $DIC;
76  return $DIC;
77  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ getParentRefIdFor()

ilLearningSequenceConditionController::getParentRefIdFor ( int  $child_ref_id)
protected

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

References $tree, and getTree().

Referenced by getConditionSetForRepositoryObject().

91  : int
92  {
93  $tree = $this->getTree();
94  return (int) $tree->getParentId($child_ref_id);
95  }
+ 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 102 of file class.ilLearningSequenceConditionController.php.

References $container, and getContainerObject().

Referenced by getConditionSetForRepositoryObject().

102  : array
103  {
104  $container = $this->getContainerObject($container_ref_id);
105  return $container->getLSItems($container_ref_id);
106  }
$container
Definition: wac.php:13
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTree()

ilLearningSequenceConditionController::getTree ( )
protected

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

References getDIC().

Referenced by getParentRefIdFor().

80  {
81  $dic = $this->getDIC();
82  return $dic['tree'];
83  }
+ 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: