Added some class="" to pagelist code
[specialops2.git] / lib / class.Messagelist_Threaded.php
blob41d8a9fe65718eae549372c1aa3616807e330d68
1 <?php
2 /**
3 * Threaded messagelist layout
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://../COPYING
7 * @version $Id$
8 */
9 require_once 'lib/iface.Messagelist.php';
11 class Messagelist_Threaded implements Messagelist
13 const ID = 1;
14 const Name = 'Threaded';
16 protected $tree;
17 protected $msgs;
18 protected $topicid;
19 protected $mo;
21 function __construct($topicid, Messagestyle $mo, $mpp, $page)
23 global $DB;
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']);
48 echo "</div>\n";
53 // Not implemented
54 public function pagelist()
56 return null;