3 * Threaded messagelist layout
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://../COPYING
9 require_once 'lib/iface.Messagelist.php';
11 class Messagelist_Threaded
implements Messagelist
14 const Name
= 'Threaded';
21 function __construct($topicid, Messagestyle
$mo, $mpp, $page)
24 $this->msgs
= $DB->query('SELECT `messages`.`userid`, `alias`, `mtime`, `mtext`, `replyto`,
25 `score`, `marks`, `messages`.`messageid`, INET_NTOA(`origin_ip`) AS `ip`
26 FROM `message-data` NATURAL LEFT JOIN `messages` NATURAL LEFT JOIN `users`
27 WHERE `topicid` = '.$topicid);
28 list($this->topicid
, $this->mo
) = func_get_args();
31 public function display()
33 while ( $item = $this->msgs
->fetch_assoc() ) {
34 $this->tree
[$item['replyto']][] = $item;
37 $this->printtree(NULL);
40 private function printtree($branch)
42 foreach ( $this->tree
[$branch] as $m ) {
43 $this->mo
->display($m);
45 if ( ! empty($this->tree
[$m['messageid']]) ) {
46 echo '<div class="thread">',"\n";
47 $this->printtree($m['messageid']);
54 public function pagelist()