status = $this->status (); } //*************************** // GETTER / SETTER //*************************** public function __get ($name) { switch ($name) { case "dotId": return $_REQUEST['id']; case "is_admin": return User::get ("is_admin"); default: return $this->$name; } } public function __set ($name, $value) { } private function status () { $status = array (); $status['values'] = Setting::get ("system"); $status['messages'] = array (); $status['questions']['trashHistory'] = I18n::tr ("edit", "system_settings/trash history?", "trash history?"); $status['questions']['trashOffline'] = I18n::tr ("edit", "system_settings/trash offline?", "trash offline?"); $ids = Setting::getIds ("system"); $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'] .= ""; } return $status; } public function value ($name) { if (isset ($this->status['values'][$name])) { return $this->status['values'][$name]; } else { return ""; } } public function trashHistory () { History::del ("config"); History::del ("i18n"); History::del ("ticket"); History::del ("timer"); History::del ("user"); History::create ("group"); History::create ("element"); $this->status['messages'][] = array ('type' => "ready", 'text' => I18n::tr ("edit", "system_settings/trash history completed", "trash history completed")); } public function trashOffline () { $historyTime = Setting::get ("system", "historyTime"); $deleteOldOffline = Setting::get ("system", "deleteOldOffline"); Setting::set ("system", "historyTime", "0"); Setting::set ("system", "deleteOldOffline", true); History::cleanUp (true); Setting::set ("system", "historyTime", $historyTime); Setting::set ("system", "deleteOldOffline", $deleteOldOffline); $this->status['messages'][] = array ('type' => "ready", 'text' => I18n::tr ("edit", "system_settings/trash offline completed", "trash offline completed")); } public function save ($values) { $history = new History ("config set"); $history->groupStart (); foreach ($values as $name => $value) { Setting::set ("system", $name, $value); if ($name == "historyTime") { History::cleanUp (true); } } $history->groupEnd(); $this->status = $this->status (); } public function undo () { $ids = Setting::getIds ("system"); if ($undo = History::getFirstUndo ($ids, "config", false)) { History::restore ($undo['id']); $this->status = $this->status (); } } public function redo () { $ids = Setting::getIds ("system"); if ($redo = History::getFirstRedo ($ids, "config", false)) { History::restore ($redo['id']); $this->status = $this->status (); } } public function message ($text) { return I18n::tr ("edit", "system_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'"); } } } ?>