status = $this->status (); } //*************************** // GETTER / SETTER //*************************** public function __get ($name) { switch ($name) { case "timers": return Timer::getList (-1); case "may_set_online": return Ticket::getEditRight () & Base::MODE_ONLINE; case "may_edit": return Ticket::getEditRight () & Base::MODE_EDIT; default: return $this->$name; } } public function __set ($name, $value) { } private function status () { $status = array (); $status['values'] = Ticket::get (Ticket::selected ()); $status['messages'] = array (); $status['delQuestion'] = I18n::tr ("edit", "set_ticket/del this Ticket?", "del this Ticket?"); $status['quickbar']['disabledButtons']['save'] = true; if (!History::getFirstUndo ($status['values']['id'], "ticket", false)) { $status['quickbar']['disabledButtons']['undo'] = true; } if (!History::getFirstRedo ($status['values']['id'], "ticket", false)) { $status['quickbar']['disabledButtons']['redo'] = true; } $status['statusbar']['value'] = ""; // Elementname, User, letzte Änderung,... if (User::get ("is_admin")) { $status['statusbar']['value'] .= " #{$status['values']['id']}"; } return $status; } public function save ($values) { $history = new History ("ticket set"); $history->groupStart (); if (isset ($values['name']) && $values['name']) { Ticket::setName (Ticket::selected (), $values['name']); } if (isset ($values['timer_id']) && $this->may_set_online) { Ticket::setTimer (Ticket::selected (), $values['timer_id']); } $history->groupEnd(); $this->status = $this->status (); } public function undo () { if ($undo = History::getFirstUndo ($this->status['values']['id'], "ticket", false)) { History::restore ($undo['id']); $this->status = $this->status (); } } public function redo () { if ($redo = History::getFirstRedo ($this->status['values']['id'], "ticket", false)) { History::restore ($redo['id']); $this->status = $this->status (); } } public function del () { Ticket::del ($this->status['values']['id']); Ticket::selected (-1); Group::setEditMode (0, Base::MODE_ONLINE); } public function message ($text) { return I18n::tr ("edit", "set_ticket/$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'"); } } } ?>