group_number = $_SESSION['cms']['edit'][0]['group_number']; $this->name = $_SESSION['cms']['edit'][0]['activ_name']; $this->group = &$_SESSION['cms']['edit'][0]['group']; if ($names = Setting::get ("group/{$this->group['name']}/{$_SESSION['cms']['style']}{$_SESSION['cms']['edit'][0]['name']}", "names")) { foreach (explode (",", $names) as $name) { $this->tabs[$name] = I18n::tr ("dot", $name); } } else if ($this->name) { $this->tabs[$this->name] = I18n::tr ("dot", $this->name); } $this->status = $this->status (); } //*************************** // GETTER / SETTER //*************************** public function __get ($name) { switch ($name) { case "dotId": return $_REQUEST['id']; case "is_admin": return User::get ("is_admin"); case "types": return array ('text', 'textarea', 'html', 'image', 'file', 'link', 'select', 'selectmultiple', 'date'); case "symbols": return array ('', 'new', 'html', 'textarea', 'text', 'image', 'file', 'select', 'selectmultiple', 'link', 'pdf', 'doc', 'date', 'border', 'key'); case "links": return array ('this', 'child', 'popup', 'http', 'file', 'mailto'); case "tags": return array ('h1', 'h2', 'h3', 'p', 'br', 'hr', 'table', 'a', 'img', 'align', 'small', 'blockquote', 'pre', 'ol', 'ul', 'strong', 'em', 'u', 'color', 'strike'); default: return $this->$name; } } public function __set ($name, $value) { } private function status () { $status = array (); $status['name'] = I18n::tr ("dot", $this->name); $status['parent_id'] = $this->group['parent_id']; $status['values'] = Setting::get ("group/{$this->group['name']}/{$_SESSION['cms']['style']}{$this->name}"); $status['messages'] = array (); $ids = Setting::getIds ("group/{$this->group['name']}/{$_SESSION['cms']['style']}{$this->name}"); $status['quickbar']['disabledButtons']['save'] = true; if (!History::getFirstUndo ($ids, "config", false)) { $status['quickbar']['disabledButtons']['undo'] = true; } if (!History::getFirstRedo ($ids, "config", false)) { $status['quickbar']['disabledButtons']['redo'] = true; } $status['statusbar']['value'] = "{$this->group['name']} / {$status['name']}"; // Elementname, User, letzte Ă„nderung,... if (User::get ("is_admin")) { $status['statusbar']['value'] .= " – #{$this->group_number} ({$this->group['id']})"; } $status['first'] = $_SESSION['cms']['edit'][0]['activ_name'] == $_SESSION['cms']['edit'][0]['name']; return $status; } public function value ($name) { if (isset ($this->status['values'][$name])) { return $this->status['values'][$name]; } else { return ""; } } public function save ($values) { // Leere initialwerte $history = new History ("config set"); $history->groupStart (); foreach ($values as $name => $value) { if (!isset ($this->status['values'])) { Setting::set ("group/{$this->group['name']}/{$_SESSION['cms']['style']}{$this->name}", $name, ""); } } $history->groupEnd(); // Werte speichern $history = new History ("config set"); $history->groupStart (); foreach ($values as $name => $value) { Setting::set ("group/{$this->group['name']}/{$_SESSION['cms']['style']}{$this->name}", $name, $value); } $history->groupEnd(); $this->status = $this->status (); } public function undo () { $ids = Setting::getIds ("group/{$this->group['name']}/{$_SESSION['cms']['style']}{$this->name}"); if ($undo = History::getFirstUndo ($ids, "config", false)) { History::restore ($undo['id']); $this->status = $this->status (); } } public function redo () { $ids = Setting::getIds ("group/{$this->group['name']}/{$_SESSION['cms']['style']}{$this->name}"); if ($redo = History::getFirstRedo ($ids, "config", false)) { History::restore ($redo['id']); $this->status = $this->status (); } } public function message ($text) { return I18n::tr ("edit", "element_settings/$text", $text); } // Wandelt das gegebene Array/Text in eine Form um, die direkt einer JavaScript Variablen zugewiesen werden kann public function toJavaScript ($value) { if (is_array ($value)) { $values = array (); foreach ($value as $key => $val) { $values[] = "'$key':".$this->toJavaScript ($val); } return "{".implode (",", $values)."}"; } else { $value = Database::escape ($value); return ($value===true) ? "true" : (($value===false) ? "false" : "'$value'"); } } } ?>