ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSoapLMStructureReader Class Reference
+ Inheritance diagram for ilSoapLMStructureReader:
+ Collaboration diagram for ilSoapLMStructureReader:

Public Member Functions

 __construct ($object)
 
 _parseStructure ()
 
- Public Member Functions inherited from ilSoapStructureReader
 __construct (&$object)
 
 getStructureObject ()
 
 _parseStructure ()
 
 isValid ()
 
 getObject ()
 read access to parent object More...
 

Additional Inherited Members

- Data Fields inherited from ilSoapStructureReader
 $object
 
 $structureObject
 

Detailed Description

Definition at line 37 of file class.ilSoapLMStructureReader.php.

Constructor & Destructor Documentation

◆ __construct()

ilSoapLMStructureReader::__construct (   $object)
Parameters
object$object

Definition at line 44 of file class.ilSoapLMStructureReader.php.

References ilSoapStructureReader\$object.

45  {
46  parent::__construct($object);
47  }

Member Function Documentation

◆ _parseStructure()

ilSoapLMStructureReader::_parseStructure ( )

Definition at line 49 of file class.ilSoapLMStructureReader.php.

References $i, $nodes, ilSoapStructureReader\$structureObject, ilSoapStructureObjectFactory\getInstance(), and ilSoapStructureReader\getObject().

50  {
51  // get all child nodes in LM
52  $ctree =&$this->object->getLMTree();
53 
54  $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
55 
56  $currentParentStructureObject = $this->structureObject;
57  $currentParent = 1;
58 
59  $parents = array();
60  $parents [$currentParent]= $currentParentStructureObject;
61 
62  $lastStructureObject = null;
63  $lastNode = null;
64  $i =0;
65  foreach ($nodes as $node) {
66 
67  // only pages and chapters
68  if ($node["type"] == "st" || $node["type"] == "pg") {
69  // print_r($node);
70  // echo $node["parent"]."<br>";
71  // echo $node["obj_id"]."<br>";
72  // echo $node["title"]."<br>";
73  // print_r($parents);
74  // echo "<br>";
75 
76  // parent has changed, to build a tree
77  if ($currentParent != $node["parent"]) {
78  // did we passed this parent before?
79 
80  if (array_key_exists($node["parent"], $parents)) {
81  // echo "current_parent:".$currentParent."\n";
82  // echo "parent:".$node["parent"]."\n";
83  // // yes, we did, so use the known parent object
84  // print_r($parents);
85  $currentParentStructureObject = $parents[$node["parent"]];
86 
87  // print_r($currentParentStructureObject);
88 //
89 // die();
90  } else {
91  // no, we did not, so use the last inserted structure as new parent
92  if ($lastNode["type"] != "pg") {
93  $parents[$lastNode["child"]] = $lastStructureObject;
94  $currentParentStructureObject = $lastStructureObject;
95  }
96  }
97  $i++;
98  $currentParent = $lastNode["child"];
99  }
100 
101  $lastNode = $node;
102 
103  $lastStructureObject = ilSoapStructureObjectFactory::getInstance($node["obj_id"], $node["type"], $node["title"], $node["description"], $this->getObject()->getRefId());
104 
105  $currentParentStructureObject->addStructureObject($lastStructureObject);
106  }
107  }
108 
109  // print_r($this->structureObject);
110 //
111 // die();
112  }
getObject()
read access to parent object
$i
Definition: disco.tpl.php:19
getInstance($objId, $type, $title, $description, $parentRefId)
+ Here is the call graph for this function:

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