ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\StudyProgramme\Assignment\Node Class Reference
+ Inheritance diagram for ILIAS\StudyProgramme\Assignment\Node:
+ Collaboration diagram for ILIAS\StudyProgramme\Assignment\Node:

Public Member Functions

 __construct ($id)
 
 setSubnodes (array $subnodes)
 
 withContainer (Node $node)
 this is only used internally - do not use apart from constructing the tree! More...
 
 withSubnode ($node)
 
 getSubnodes ()
 
 getSubnode (string $id)
 
 getPath ()
 
 findSubnodePath (string $id, ?Node $node=null)
 
 getId ()
 

Protected Member Functions

 getContainer ()
 

Protected Attributes

array $subnodes = []
 
Node $container = null
 
string $id
 
int $current_points = 0
 

Detailed Description

Definition at line 23 of file Node.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\StudyProgramme\Assignment\Node::__construct (   $id)

Definition at line 32 of file Node.php.

References ILIAS\StudyProgramme\Assignment\Node\$id.

33  {
34  $this->id = $id;
35  }

Member Function Documentation

◆ findSubnodePath()

ILIAS\StudyProgramme\Assignment\Node::findSubnodePath ( string  $id,
?Node  $node = null 
)

Definition at line 89 of file Node.php.

References ILIAS\StudyProgramme\Assignment\Node\$id.

89  : ?array
90  {
91  if (!$node) {
92  $node = $this;
93  }
94  if ($node->getId() == $id) {
95  return $node->getPath();
96  }
97  foreach ($node->getSubnodes() as $subnode) {
98  $result = $this->findSubnodePath($id, $subnode);
99  if ($result) {
100  return $result;
101  }
102  }
103 
104  return null;
105  }
findSubnodePath(string $id, ?Node $node=null)
Definition: Node.php:89

◆ getContainer()

ILIAS\StudyProgramme\Assignment\Node::getContainer ( )
protected

Definition at line 57 of file Node.php.

References ILIAS\StudyProgramme\Assignment\Node\$container.

57  : ?Node
58  {
59  return $this->container;
60  }

◆ getId()

ILIAS\StudyProgramme\Assignment\Node::getId ( )

◆ getPath()

ILIAS\StudyProgramme\Assignment\Node::getPath ( )

Definition at line 79 of file Node.php.

References ILIAS\StudyProgramme\Assignment\Node\getId().

Referenced by invalidate(), and markProgressesFailedForExpiredDeadline().

79  : array
80  {
81  $ret = [$this->getId()];
82  $node = $this;
83  while ($node = $node->getContainer()) {
84  $ret[] = $node->getId();
85  }
86  return array_reverse($ret);
87  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubnode()

ILIAS\StudyProgramme\Assignment\Node::getSubnode ( string  $id)

Definition at line 74 of file Node.php.

References ILIAS\StudyProgramme\Assignment\Node\$id.

74  : ?Node
75  {
76  return $this->subnodes[$id];
77  }

◆ getSubnodes()

ILIAS\StudyProgramme\Assignment\Node::getSubnodes ( )

Definition at line 69 of file Node.php.

Referenced by ilStudyProgrammeUserTable\completionByToCollection(), ilPRGProgress\getAchievedPointsOfChildren(), and ilPRGProgress\getPossiblePointsOfRelevantChildren().

69  : array
70  {
71  return array_values($this->subnodes);
72  }
+ Here is the caller graph for this function:

◆ setSubnodes()

ILIAS\StudyProgramme\Assignment\Node::setSubnodes ( array  $subnodes)

Definition at line 37 of file Node.php.

38  {
39  if ($this->subnodes !== []) {
40  throw new \Exception("Use 'setSubnodes' during construction only", 1);
41  }
42  foreach ($subnodes as $subnode) {
43  $this->subnodes[$subnode->getId()] = $subnode->withContainer($this);
44  }
45  return $this;
46  }

◆ withContainer()

ILIAS\StudyProgramme\Assignment\Node::withContainer ( Node  $node)

this is only used internally - do not use apart from constructing the tree!

Definition at line 51 of file Node.php.

51  : self
52  {
53  $this->container = $node;
54  return $this;
55  }

◆ withSubnode()

ILIAS\StudyProgramme\Assignment\Node::withSubnode (   $node)

Definition at line 62 of file Node.php.

63  {
64  $clone = clone $this;
65  $clone->subnodes[$node->getId()] = $node->withContainer($this);
66  return $clone;
67  }

Field Documentation

◆ $container

Node ILIAS\StudyProgramme\Assignment\Node::$container = null
protected

Definition at line 26 of file Node.php.

Referenced by ILIAS\StudyProgramme\Assignment\Node\getContainer().

◆ $current_points

int ILIAS\StudyProgramme\Assignment\Node::$current_points = 0
protected

Definition at line 30 of file Node.php.

◆ $id

◆ $subnodes

array ILIAS\StudyProgramme\Assignment\Node::$subnodes = []
protected

Definition at line 25 of file Node.php.

Referenced by ilStudyProgrammeProgressTreeTest\build().


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