status = $this->status (); } //*************************** // GETTER / SETTER //*************************** public function __get ($name) { switch ($name) { case "may_set_online": return Ticket::getEditRight () & Base::MODE_ONLINE; case "may_edit": return Ticket::getEditRight () & Base::MODE_EDIT; case "changesList": return $this->status['values']; case "status": $status = $this->status; foreach ($status['values'] as $key => $row) { $status['values'][$key] = $row['status']; } return $status; default: return $this->$name; } } public function __set ($name, $value) { } private function status () { $status = array (); $status['values'] = array (); foreach (Group::getEditList () as $row) { $status['values'][$row['id']] = $row; if (!Ticket::useTickets () && ($row['status'] & Base::STATUS_ONLINE)) { // online stehende Gruppen aus Liste entfernen unset ($status['values'][$row['id']]); } else { $status['values'][$row['id']]['status'] = ($row['status'] & Base::STATUS_ONLINE) ? "online" : "offline"; $status['values'][$row['id']]['removed'] = ($row['status'] & Base::STATUS_ERASED); $status['values'][$row['id']]['title'] = $row['username'] . (User::get ('is_admin') ? (" #" . $row['online_id']) : ""); if (isset ($row['element_name'])) { $status['values'][$row['id']]['name'] .= " ({$row['element_name']})"; } } } $status['messages'] = array (); $status['may_set_online'] = $this->may_set_online; $status['may_edit'] = $this->may_edit; $status['quickbar']['disabledButtons']['online'] = true; $status['quickbar']['disabledButtons']['offline'] = true; $status['quickbar']['disabledButtons']['delete'] = true; $status['statusbar']['value'] = ""; // Elementname, User, letzte Änderung,... if (User::get ("is_admin")) { $status['statusbar']['value'] .= ""; } return $status; } public function del ($id) { $group = new Group (array ('id' => $id)); $group->remove (); $this->status = $this->status (); } public function online ($id) { $group = new Group (array ('id' => $id)); $group->setStatus (Base::STATUS_ONLINE); $this->status = $this->status (); } public function offline ($id) { $group = new Group (array ('id' => $id)); $group->setStatus (Base::STATUS_OFFLINE); $this->status = $this->status (); } public function message ($text) { return I18n::tr ("edit", "show_changes/$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'"); } } } ?>