config = $config; $query = "SELECT sem_tree_id FROM sem_tree WHERE studip_object_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute([$this->config->range_id]); $this->root_id = $statement->fetchColumn(); $this->start_item_id = ($start_item_id) ? $start_item_id : $this->root_id; $this->param = "range_id={$this->config->range_id}&module=Semlecturetree&config_id={$this->config->id}&"; parent::__construct($this->start_item_id, $sem_number); } function showSemTree ($start_id = null) { echo "\nconfig->getAttributes("Main", "table") . ">"; echo "\n". $this->getSemPath() . "\n"; $this->showContent($this->start_item_id); echo "\n"; if ($this->tree->getNumKids($this->start_item_id)) { echo "\n"; echo $this->showKids($this->start_item_id); echo "\n"; } if ($this->config->getAttributes("TreeBackLink", "image") || $this->config->getAttributes("TreeBackLink", "linktext")) { echo "\n"; echo $this->backLink($this->start_item_id) . "\n"; } echo "\n"; } function showKids ($item_id) { $num_kids = $this->tree->getNumKids($item_id); $kids = $this->tree->getKids($item_id); $attributes_a = $this->config->getAttributes("TreeKids", "a"); $attributes_font = $this->config->getAttributes("TreeKids", "font"); $attributes_td = $this->config->getAttributes("TreeKids", "td"); echo "\nconfig->getAttributes("TreeKids", "table") . ">"; for ($i = 0; $i < $num_kids; ++$i){ $num_entries = $this->tree->getNumEntries($kids[$i],true); echo "\n"; echo "getSelf("{$this->param}start_item_id={$kids[$i]}", false)); echo "\"$attributes_a>"; echo htmlReady($this->tree->tree_data[$kids[$i]]['name']); echo " ($num_entries)"; echo ""; echo "\n"; } echo "
\n"; } function backLink ($item_id) { if ($item_id != $this->root_id){ echo "config->getAttributes("TreeBackLink", "table") . ">\n"; echo "config->getAttributes("TreeBackLink", "td") . ">"; if ($image = $this->config->getValue("TreeBackLink", "image")) { echo "getSelf("{$this->param}start_item_id={$this->tree->tree_data[$item_id]['parent_id']}", false)) . "\">"; echo " "; } if ($link_text = $this->config->getValue("TreeBackLink", "linktext")) { echo "getSelf("{$this->param}start_item_id={$this->tree->tree_data[$item_id]['parent_id']}", false)) . "\">"; echo "config->getAttributes("TreeBackLink", "font"); echo ">$link_text"; } echo "
\n"; } } function showContent ($item_id, $num_all_entries = 0) { echo "config->getAttributes("TreeLevelName", "table"); echo ">\nconfig->getAttributes("TreeLevelName", "td") . ">"; echo "config->getAttributes("TreeLevelName", "font") . ">"; echo htmlReady($this->tree->tree_data[$item_id]['name']) ."\n"; echo "\n"; echo "config->getAttributes("TreeLevelContent", "table"); echo ">\nconfig->getAttributes("TreeLevelContent", "td") . ">"; echo "config->getAttributes("TreeLevelContent", "font") . ">"; echo formatReady($this->tree->tree_data[$item_id]['info'], TRUE, TRUE) ."\n"; } function getSemPath ($start_id = null) { $delimiter = $this->config->getValue("TreePath", "delimiter"); $attributes_a = $this->config->getAttributes("TreePath", "a"); $ret = "config->getAttributes("TreePath", "table") . ">\n"; $ret .= "config->getAttributes("TreePath", "td") . ">"; $ret .= "config->getAttributes("TreePath", "td") . ">"; $parents = $this->tree->getParents($this->start_item_id); $parents_root[] = $this->tree->getParents($this->root_id); if (is_array($parents)) { $parents = array_diff($parents, $parents_root); while ($parent = array_pop($parents)) { $ret .= $delimiter; $ret .= "getSelf("{$this->param}start_item_id=".$parent,false)); $ret .= "\"$attributes_a>" . htmlReady($this->tree->tree_data[$parent]["name"]) . ""; } } if ($this->start_item_id != $this->root_id) $ret .= $delimiter; $ret .= htmlReady($this->tree->tree_data[$this->start_item_id]["name"]); $ret .= "
\n"; return $ret; } } ?>