name = "[Personenliste]"; $this->allowedChildObjects = array("person", "separator"); $this->buttonPublish = true; $this->buttonPreview = true; $this->editable = USER_GROUP; } /** @see CmsObject::load() */ //----------------------------------------------- function load($path=array()){ //----------------------------------------------- parent::load($path); if(!$this->classId){ return; } $query = sprintf("SELECT * FROM bruckm_personlist WHERE id = %d", $this->classId); $result = dbQuery($query); $line = mysqli_fetch_array($result, MYSQLI_ASSOC); $this->template = $line['template']; } /** @see Page::doSave() */ //---------------------------------------------- function doSave(){ //---------------------------------------------- $query = sprintf("UPDATE bruckm_personlist SET template = %s WHERE id = %d", sqlstring($this->template), sqlnum($this->classId)); dbQuery($query); parent::doSave(); } /** @see Page::doCreate() */ //---------------------------------------------- function doCreate(){ //---------------------------------------------- $query = sprintf("INSERT INTO bruckm_personlist (template) VALUES (%s)", sqlstring($this->template)); dbQuery($query); $this->classId = mysql_insert_id(); parent::doCreate(); } /** @see Page::doDelete() */ //----------------------------------------------- function doDelete(){ //----------------------------------------------- parent::doDelete(); $query = sprintf("DELETE FROM bruckm_personlist WHERE id = %d LIMIT 1", $this->classId); dbQuery($query); } /** @see Page::install() */ //----------------------------------------------- function install(){ //----------------------------------------------- $query = sprintf("CREATE TABLE IF NOT EXISTS bruckm_personlist ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, template VARCHAR(100) NOT NULL, PRIMARY KEY (id) )"); dbQuery($query); } /** @see CmsObject::update() */ //----------------------------------------------- function update(){ //----------------------------------------------- parent::update(); if(isset($_POST['template'])){ $this->template = $_POST['template']; } } /** @see CmsObject::doPrintClassContent() */ //----------------------------------------------- function doPrintClassContent(){ //----------------------------------------------- $t = new Template(CMS_TEMPLATE_DIR."stdpage.html"); $templates = ""; $templateFiles = array(); $dir = opendir(TEMPLATE_DIR); while($file = readdir($dir)){ if(is_file(TEMPLATE_DIR.$file)){ $templateFiles[] = $file; } } sort($templateFiles); foreach($templateFiles as $file){ if($file == $this->template){ $templates .= ""; } else{ $templates .= "\n"; } } $t->setVar("TEMPLATES", $templates); if($_SESSION['userlevel'] == USER_ADMIN){ $t->setVar("TEMPLATE_DISABLED", ""); } else{ $t->setVar("TEMPLATE_DISABLED", "disabled=\"disabled\""); } return $t->toString(); } /** @see CmsObject::publish() */ //--------------------------------------------- function doPublish(){ //--------------------------------------------- $t = new Template(TEMPLATE_DIR.$this->template); $content = "