# Lifter002: TODO
# Lifter003: TEST
# Lifter007: TODO
# Lifter010: TODO
class ExternSemLectureTree extends StudipSemTreeViewSimple {
var $config;
var $param;
var $root_id;
function __construct(&$config, $start_item_id = "", $sem_number = FALSE)
{
$this->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 "\n
config->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 "\n\n";
}
function backLink ($item_id) {
if ($item_id != $this->root_id){
echo "\n";
}
}
function showContent ($item_id, $num_all_entries = 0) {
echo "config->getAttributes("TreeLevelName", "table");
echo ">\n| config->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 ">\n| config->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;
}
}
?>
|