- $cnt = 0;
-
- $this->tree = array();
- $this->table = array();
-
- while ($this->notice->fetch()) {
-
- $cnt++;
-
- $id = $this->notice->id;
- $notice = clone($this->notice);
-
- $this->table[$id] = $notice;
-
- if (is_null($notice->reply_to)) {
- $this->tree['root'] = array($notice->id);
- } else if (array_key_exists($notice->reply_to, $this->tree)) {
- $this->tree[$notice->reply_to][] = $notice->id;
- } else {
- $this->tree[$notice->reply_to] = array($notice->id);
- }
- }
-
- return $cnt;
- }
-
- /**
- * Shows a notice plus its list of children.
- *
- * @param integer $id ID of the notice to show
- *
- * @return void
- */
- function showNoticePlus($id)
- {
- $notice = $this->table[$id];
-
- // We take responsibility for doing the li
-
- $this->out->elementStart('li', array('class' => 'hentry notice',
- 'id' => 'notice-' . $id));
-
- $item = $this->newListItem($notice);
- $item->show();
-
- if (array_key_exists($id, $this->tree)) {
- $children = $this->tree[$id];
-
- $this->out->elementStart('ol', array('class' => 'notices'));
-
- sort($children);
-
- foreach ($children as $child) {
- $this->showNoticePlus($child);
- }
-
- $this->out->elementEnd('ol');
- }
-
- $this->out->elementEnd('li');