ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ilSoapStructureReader\$structureObject, array, ilSoapStructureObjectFactory\getInstance(), and ilSoapStructureReader\getObject().

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