/** * Recurse down tree creating list_items, called from moodle_list::list_from_records * * @param array $records * @param array $children * @param integer $thisrecordid */ function create_children(&$records, &$children, $thisrecordid) { //keys where value is $thisrecordid $thischildren = array_keys($children, $thisrecordid); if (count($thischildren)) { foreach ($thischildren as $child) { $thisclass = get_class($this); $newlistitem =& new $thisclass($records[$child], $this->children, $this->attributes); $this->children->add_item($newlistitem); $newlistitem->create_children($records, $children, $records[$child]->id); } } }