editable = true; if ($this->mode != self::MODE_PAGE_TOP && $this->mode != self::MODE_CONTENT_TOP) $this->mode = self::MODE_PAGE_TOP; if ($status != self::STATUS_DISABLED && $status != self::STATUS_ENABLED && $status != self::STATUS_DELETED) $this->status = self::STATUS_DELETED; else $this->status = $status; } public function jsonSerialize() : array { $json = array( 'parent' => 'announcement-' . abs($this->id), 'id' => $this->editable ? -$this->id : $this->id, 'mode' => $this->mode, 'status' => $this->status, 'name' => $this->name, 'text' => (string)$this->text // force LocString to naive string for display ); if ($this->style) $json['style'] = $this->style; return $json; } public function __toString() : string { if ($this->status == self::STATUS_DELETED) return ''; return "new Announcement(".Util::toJSON($this).");\n"; } } ?>