group = &$_SESSION['cms']['edit'][0]['group']; $this->status = $this->status (); } //*************************** // GETTER / SETTER //*************************** public function __get ($name) { switch ($name) { case "parent_edit_groups": return implode (", ", $this->status['parent_edit_groups']); case "edit_groups": return User::getEditGroups (); case "edit_users": return User::getList (); case "is_admin": return User::get ("is_admin"); default: return $this->$name; } } public function __set ($name, $value) { } private function status () { $status = array (); // Kompatibilitätspatch für ältere Versionen [START] $status['values'] = Setting::get ("list/{$this->group['parent_id']}"); // Kompatibilitätspatch für ältere Versionen [END] $status['values'] = Setting::get ("list/{$this->group['parent_id']}/{$this->group['name']}", "", $status['values']); $status['values']['desc'] = empty ($status['values']['desc']) ? 0 : 1; $status['parent_edit_groups'] = array (); foreach (array_merge (explode (',', $this->group['edit_groups']), explode (',', Group::getEditGroup ($this->group['id'])), explode (',', Setting::get ("list/{$this->group['parent_id']}/{$this->group['name']}", "edit_groups"))) as $group) { if ($group && Base::is_int ($group)) { $group = User::getList ($group); $group = $group['realname']; } if ($group) { $status['parent_edit_groups'][$group] = $group; } } $status['messages'] = array (); $ids = Setting::getIds ("list/{$this->group['parent_id']}/{$this->group['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'] = ""; // Elementname, User, letzte Änderung,... if (User::get ("is_admin")) { $status['statusbar']['value'] .= " #{$this->group['parent_id']} / {$this->group['id']}"; } return $status; } public function value ($name) { if (isset ($this->status['values'][$name])) { return $this->status['values'][$name]; } else { return ""; } } public function save ($values) { $history = new History ("config set"); $history->groupStart (); foreach ($values as $name => $value) { if ($value!="") { Setting::set ("list/{$this->group['parent_id']}/{$this->group['name']}", $name, $value); } else { Setting::del ("list/{$this->group['parent_id']}/{$this->group['name']}", $name); // Kompatibilitätspatch für ältere Versionen [START] Setting::del ("list/{$this->group['parent_id']}", $name); // Kompatibilitätspatch für ältere Versionen [END] } } $history->groupEnd(); $this->status = $this->status (); } public function undo () { $ids = Setting::getIds ("list/{$this->group['parent_id']}/{$this->group['name']}"); if ($undo = History::getFirstUndo ($ids, "config", false)) { History::restore ($undo['id']); $this->status = $this->status (); } } public function redo () { $ids = Setting::getIds ("list/{$this->group['parent_id']}/{$this->group['name']}"); if ($redo = History::getFirstRedo ($ids, "config", false)) { History::restore ($redo['id']); $this->status = $this->status (); } } public function message ($text) { return I18n::tr ("edit", "list_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'"); } } } ?>