function getHTML($id)
 {
     $U = new mUserdata();
     $U = $U->getUDValue("selectedDomain");
     if ($U == null) {
         $t = new HTMLTable(1);
         $t->addRow("Sie haben keine Domain ausgewählt.<br /><br />Bitte wählen Sie eine Domain im Domain-Plugin, indem Sie auf das graue Kästchen in der Liste auf der rechten Seite klicken.");
         return $t->getHTML();
     }
     $Domain = new Domain($U);
     $Domain->loadMe();
     $variables = array("domainTemplate", "contentTemplate", "naviTemplate", "pageTemplate");
     $variables["domainTemplate"] = array("TITLE", "DESCRIPTION", "NAVIGATION", "HEADER", "PAGE");
     $variables["contentTemplate"] = array("TEXT", "IMAGE", "DOWNLOADS", "CONTENTID", "HANDLER");
     $variables["naviTemplate"] = array("LINK", "URL", "TEXT");
     $variables["pageTemplate"] = array("HEADER", "CONTENT", "DOMAIN");
     $variables["dlTemplate"] = array("TEXT", "DOWNLOADS");
     #$this->setParser("html","Util::base64Parser");
     if ($this->A == null and $id != -1) {
         $this->loadMe();
     }
     if ($id == -1) {
         $this->A = $this->newAttributes();
     }
     $gui = new HTMLGUI();
     $gui->setObject($this);
     $gui->setName("Template");
     $TG = new TemplatesGUI();
     $options = $TG->getAvailableCategories();
     $gui->setType("templateType", "select");
     $gui->setOptions("templateType", array_keys($options), array_values($options));
     $gui->setInputJSEvent("templateType", "onchange", "CMSTemplate.updateVariables(this);");
     $gui->setInputJSEvent("templateType", "onkeyup", "CMSTemplate.updateVariables(this);");
     $gui->setLabel("templateType", "Typ");
     $gui->setType("html", "TextEditor64");
     $gui->setType("TemplateDomainID", "radio");
     $gui->setLabel("TemplateDomainID", "Domain");
     $gui->setOptions("TemplateDomainID", array("0", $U), array("alle", "nur " . $Domain->getA()->title));
     $gui->hideAttribute("TemplateID");
     $gui->setType("aktiv", "hidden");
     $gui->setStandardSaveButton($this, "Templates");
     $vars = "";
     foreach ($variables as $k => $v) {
         if (is_array($variables[$k])) {
             $vars .= "<p id=\"{$k}Variables\" style=\"" . ($this->A->templateType == $k ? "" : "display:none;") . "\">%%%" . implode("%%%<br />%%%", $variables[$k]) . "%%%</p>";
         }
     }
     $html = "\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tnew Draggable('TBVarsContainer',{handle:'TBVarsHandler', zindex: 2000});\n\t\t\t\toldVarSelected = '" . ($this->A->templateType != null ? $this->A->templateType : "null") . "';\n\t\t\t</script>\n\t\t\t<div \n\t\t\t\tstyle=\"position:absolute;z-index:2000;left:450px;width:200px;border-width:1px;border-style:solid;" . (isset($variables[$this->A->templateType]) ? "" : "display:none;") . "\"\n\t\t\t\tclass=\"backgroundColor0 borderColor1\"\n\t\t\t\tid=\"TBVarsContainer\"\n\t\t\t>\n\t\t\t<div class=\"cMHeader backgroundColor1\" id=\"TBVarsHandler\">Variablen:</div>\n\t\t\t<div>\n\t\t\t\t<p><small>Sie können folgende Variablen in Ihrem HTML verwenden (bitte beachen Sie Groß- und Kleinschreibung):</small></p>\n\t\t\t\t{$vars}\n\t\t\t</div>\n\t\t\t</div>";
     return $html . $gui->getEditHTML();
 }
 private function getList($pid, $SeiteID, $DomainID)
 {
     $html = "";
     $Dom = new Domain($DomainID);
     $multiLang = false;
     try {
         $test = new MultiLanguage(-1);
         $userLang = CCMultiLanguage::getUserLanguage();
         if ($userLang != null and $userLang->getID() != null and $userLang->getID() != $Dom->A("DomainDefaultSpracheID")) {
             $multiLang = true;
         }
     } catch (ClassNotFoundException $e) {
     }
     while ($C = $this->getNextEntry()) {
         if ($multiLang) {
             $mL = MultiLanguage::getTranslation($userLang->getID(), "Navigation", $C->getID(), "name");
             if ($mL == null) {
                 continue;
             }
             $C->changeA("name", $mL);
         }
         $CA = $C->getA();
         if ($this->domainURL == "") {
             $D = new Domain($C->A("DomainID"));
             $this->domainURL = $D->getA()->url;
             if ($this->domainURL == "") {
                 $this->domainURL = "none";
             }
         }
         $sub = new mNavigationGUI();
         $sub->addOrderV3("sort", "ASC");
         $sub->addAssocV3("parentID", "=", $C->getID());
         $sub->addAssocV3("t1.DomainID", "=", $DomainID);
         $sub->addAssocV3("hidden", "=", "0");
         $sub->addJoinV3("Template", "activeTemplateID", "=", "TemplateID");
         $sub->addJoinV3(" Template", "inactiveTemplateID", "=", "TemplateID");
         $sub->addJoinV3("Seite", "SeiteID", "=", "SeiteID");
         $sub->setFieldsV3(array("t2.html as activeHTML", "t3.html as inactiveHTML", "t1.name", "t1.DomainID", "t1.SeiteID", "linkURL", "linkType", "displaySub", "t4.permalink", "httpsLink"));
         $sub->lCV3();
         $sub->subNavigation($this->isSubNavigation, $this->isSubNavigationRoot);
         $subOpened = new mNavigation();
         $subOpened->addAssocV3("parentID", "=", $C->getID());
         $subOpened->addAssocV3("SeiteID", "=", $SeiteID);
         $subOpened->lCV3();
         if ($CA->linkType == "separator") {
             $html .= "<div class=\"separator\">" . $CA->name . "</div>";
         }
         /*.= "
         			<li class=\"hld\" style=\"cursor:pointer;\" onclick=\"dd('naviul_".$C->getID()."');\"><img id=\"naviul_".$C->getID()."Img\" class=\"sslico\" src=\"./$this->domainURL/images/dd.gif\" title=\"Menü ausklappen\" />".$CA->name."</li>";
         		*/
         $rootDomain = "http" . ($CA->httpsLink == "1" ? "s" : "") . "://{$_SERVER['HTTP_HOST']}";
         if ($this->isSubNavigationRoot != null) {
             $rootDomain = $this->isSubNavigationRoot;
         }
         if ($CA->linkType == "cmsPage") {
             if (!isset($CA->permalink) or $CA->permalink == "") {
                 $link = "{$rootDomain}/index.php?p=" . $CA->SeiteID . "" . (isset($_GET["d"]) ? "&d={$_GET['d']}" : "") . "";
             } else {
                 $link = $rootDomain . "/" . ($this->isSubNavigation ? "" : $Dom->A("permalinkPrefix")) . $CA->permalink;
             }
             $html .= ($CA->SeiteID == $SeiteID or $subOpened->numLoaded() > 0) ? str_replace("%%%LINK%%%", "<a href=\"{$link}\">" . $CA->name . "</a>", $CA->activeHTML) : str_replace("%%%LINK%%%", "<a href=\"{$link}\">" . $CA->name . "</a>", $CA->inactiveHTML);
             #if(!isset($CA->permalink) OR $CA->permalink == "")
             $html = str_replace("%%%URL%%%", "?p=" . $CA->SeiteID . "" . (isset($_GET["d"]) ? "&d={$_GET['d']}" : "") . "", $html);
             #else
             #	$html = str_replace("%%%URL%%%", "page-".$CA->permalink, $html);
             $html = str_replace("%%%TEXT%%%", $CA->name, $html);
         }
         if ($CA->linkType == "url") {
             $html .= str_replace("%%%LINK%%%", "<a href=\"" . $CA->linkURL . "\">" . $CA->name . "</a>", $CA->inactiveHTML);
             #"<li class=\"hl\"><a href=\"".$CA->linkURL."\">".$CA->name."</a></li>";
             $html = str_replace("%%%URL%%%", $CA->linkURL, $html);
             $html = str_replace("%%%TEXT%%%", $CA->name, $html);
         }
         if ($CA->linkType == "HTML") {
             $html .= str_replace("%%%LINK%%%", "<a href=\"" . $CA->linkURL . "\">" . $CA->name . "</a>", $CA->activeHTML);
             #"<li class=\"hl\"><a href=\"".$CA->linkURL."\">".$CA->name."</a></li>";
             $html = str_replace("%%%URL%%%", $CA->linkURL, $html);
             $html = str_replace("%%%TEXT%%%", $CA->name, $html);
         }
         if ($sub->numLoaded() > 0) {
             if ($C->A("displaySub") == "1" or $subOpened->numLoaded() > 0 or $C->A("SeiteID") == $SeiteID) {
                 if ($Dom->A("horizontalNav") == "0") {
                     $html .= "<div class=\"subcategory\">" . $sub->getCMSHTML($C->getID(), $SeiteID, $DomainID) . "</div>";
                 } else {
                     $this->horizontalNav .= "<div class=\"subcategory\">" . $sub->getCMSHTML($C->getID(), $SeiteID, $DomainID) . "</div>";
                 }
             }
         }
     }
     return $html;
 }