+ /** Mark the given id as read
+ * @param id MSGNUM of post
+ */
+ public function markAsRead($id)
+ {
+ if (!$this->overview[$id]->isread) {
+ $this->overview[$id]->isread = true;
+ $this->unreadnb--;
+ while (isset($id)) {
+ $this->overview[$id]->descunread--;
+ $id = $this->overview[$id]->parent;
+ }
+ }
+ }
+
+ /** Mark all unread messages as read
+ */
+ public function markAllAsRead(array &$array = null)
+ {
+ if (!$this->unreadnb) {
+ return;
+ }
+ if (is_null($array) && is_array($this->roots)) {
+ $array =& $this->roots;
+ } elseif (is_null($array)) {
+ return;
+ }
+ foreach ($array as $id) {
+ if (!$this->overview[$id]->isread) {
+ $this->markAsRead($id);
+ if (!$this->unreadnb) {
+ return;
+ }
+ }
+ if ($this->overview[$id]->descunread) {
+ $this->markAllAsRead($this->overview[$id]->children);
+ }
+ }
+ }
+