- if (sizeof($this->overview[$_id]->parent)) {
- $this->overview[$this->overview[$_id]->parent]->children =
- array_diff($this->overview[$this->overview[$_id]->parent]->children, array($_id));
- if (sizeof($this->overview[$_id]->children)) {
- $this->overview[$this->overview[$_id]->parent]->children =
- array_merge($this->overview[$this->overview[$_id]->parent]->children, $this->overview[$_id]->children);
- foreach ($this->overview[$_id]->children as $c) {
- $this->overview[$c]->parent = $this->overview[$_id]->parent;
+ $overview =& $this->overview[$_id];
+ if (!$overview->isread) {
+ $this->markAsRead($_id);
+ }
+ if ($overview->parent) {
+ $p = $overview->parent;
+ $parent =& $this->overview[$p];
+ $parent->children = array_diff($parent->children, array($_id));
+ if (sizeof($overview->children)) {
+ $parent->children = array_merge($parent->children, $overview->children);
+ foreach ($overview->children as $c) {
+ $this->overview[$c]->parent = $p;