3 * Threaded messagelist layout
5 * @author Ant P <p@cpi.merseine.nu>
6 * @license file://../COPYING
9 require_once 'lib/iface.Messagelist.php';
11 class Messagelist_Threaded
implements Messagelist
17 function __construct($topicid, Messagestyle
$mo, $mpp, $page)
19 $tmp = SO2
::$DB->q('SELECT userid, mtime, topicid, replyto, score, marks, messageid, INET_NTOA(origin_ip) AS ip '.
20 'FROM messages WHERE topicid = ?', $topicid, SO2_PDO
::QOBJ
);
21 while ( $item = $tmp->fetch(PDO
::FETCH_ASSOC
) ) {
22 $this->tree
[$item['replyto']][] = $item;
25 list($this->topicid
, $this->mo
) = func_get_args();
28 public function display()
30 $this->printtree(NULL);
33 private function printtree($branch)
35 foreach ( $this->tree
[$branch] as $m ) {
36 if ( $m['score'] < SO2
::$User->cutoff
&& SO2
::$User->userid
!= $m['userid'] )
37 $m['mtext'] = sprintf(self
::MODMSG
, SO2
::$User->cutoff
);
38 $this->mo
->display($m);
40 if ( ! empty($this->tree
[$m['messageid']]) ) {
41 echo '<div class="thread">',"\n";
42 $this->printtree($m['messageid']);
49 public function pagelist()