ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSCORMTree.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24require_once ("./Services/Tree/classes/class.ilTree.php");
25
34class ilSCORMTree extends ilTree
35{
36
43 function ilSCORMTree($a_id = 0)
44 {
45 parent::ilTree($a_id);
46 $this->setTableNames('scorm_tree','scorm_object');
47 $this->setTreeTablePK('slm_id');
48 }
49
58 function getChilds($a_node_id, $a_order = "", $a_direction = "ASC")
59 {
60 global $ilDB;
61
62 if (!isset($a_node_id))
63 {
64 $message = get_class($this)."::getChilds(): No node_id given!";
65 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
66 }
67
68 // init childs
69 $childs = array();
70
71 // number of childs
72 $count = 0;
73
74 // init order_clause
75 $order_clause = "";
76
77 // set order_clause if sort order parameter is given
78 if (!empty($a_order))
79 {
80 $order_clause = "ORDER BY ".$a_order." ".$a_direction;
81 }
82 else
83 {
84 $order_clause = "ORDER BY ".$this->table_tree.".lft";
85 }
86
87 //666
88
89 $r = $ilDB->queryF("
90 SELECT * FROM ".$this->table_tree." ".
91 $this->buildJoin().
92 "WHERE parent = %s ".
93 "AND ".$this->table_tree.".".$this->tree_pk." = %s ".
94 $order_clause,
95 array('integer','integer'),array($a_node_id,$this->tree_id));
96
97 $count = $ilDB->numRows($r);
98
99 if ($count > 0)
100 {
101 while ($row = $ilDB->fetchAssoc($r))
102 {
103 $childs[] = $this->fetchNodeData($row);
104 }
105
106 // mark the last child node (important for display)
107 $childs[$count - 1]["last"] = true;
108
109 return $childs;
110 }
111 else
112 {
113 return $childs;
114 }
115 }
116}
117?>
SCORM Object Tree.
ilSCORMTree($a_id=0)
Constructor.
getChilds($a_node_id, $a_order="", $a_direction="ASC")
get child nodes of given node @access public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
setTreeTablePK($a_column_name)
set column containing primary key in tree table @access public
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
fetchNodeData($a_row)
get data of parent node from tree and object_data @access private
$r
Definition: example_031.php:79
global $ilDB