Public Member Functions | |
ilSCORMTree ($a_id=0) | |
Constructor. | |
getChilds ($a_node_id, $a_order="", $a_direction="ASC") | |
get child nodes of given node public |
Definition at line 35 of file class.ilSCORMTree.php.
ilSCORMTree::getChilds | ( | $ | a_node_id, | |
$ | a_order = "" , |
|||
$ | a_direction = "ASC" | |||
) |
get child nodes of given node public
integer | node_id | |
string | sort order of returned childs, optional (possible values: 'title','desc','last_update' or 'type') | |
string | sort direction, optional (possible values: 'DESC' or 'ASC'; defalut is 'ASC') |
Reimplemented from ilTree.
Definition at line 59 of file class.ilSCORMTree.php.
References $q, $row, ilTree::buildJoin(), and ilTree::fetchNodeData().
{ if (!isset($a_node_id)) { $message = get_class($this)."::getChilds(): No node_id given!"; $this->ilErr->raiseError($message,$this->ilErr->WARNING); } // init childs $childs = array(); // number of childs $count = 0; // init order_clause $order_clause = ""; // set order_clause if sort order parameter is given if (!empty($a_order)) { $order_clause = "ORDER BY ".$a_order." ".$a_direction; } else { $order_clause = "ORDER BY ".$this->table_tree.".lft"; } //666 $q = "SELECT * FROM ".$this->table_tree." ". $this->buildJoin(). "WHERE parent = '".$a_node_id."' ". "AND ".$this->table_tree.".".$this->tree_pk." = '".$this->tree_id."' ". $order_clause; $r = $this->ilDB->query($q); $count = $r->numRows(); if ($count > 0) { while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC)) { $childs[] = $this->fetchNodeData($row); } // mark the last child node (important for display) $childs[$count - 1]["last"] = true; return $childs; } else { return $childs; } }
ilSCORMTree::ilSCORMTree | ( | $ | a_id = 0 |
) |
Constructor.
int | $a_id tree id (= SCORM Learning Module Object ID) public |
Definition at line 44 of file class.ilSCORMTree.php.
References ilTree::ilTree(), ilTree::setTableNames(), and ilTree::setTreeTablePK().
{ parent::ilTree($a_id); $this->setTableNames('scorm_tree','scorm_object'); $this->setTreeTablePK('slm_id'); }