Index: trunk/extensions/LiquidThreads/LqtFunctions.php |
— | — | @@ -139,17 +139,36 @@ |
140 | 140 | } |
141 | 141 | |
142 | 142 | function lqtDumpThreadData( $writer, &$out, $row, $title ) { |
| 143 | + $editedStati = array( Threads::EDITED_NEVER => 'never', |
| 144 | + Threads::EDITED_HAS_REPLY => 'has-reply', |
| 145 | + Threads::EDITED_BY_AUTHOR => 'by-author', |
| 146 | + Threads::EDITED_BY_OTHERS => 'by-others' ); |
| 147 | + $threadTypes = array( Threads::TYPE_NORMAL => 'normal', |
| 148 | + Threads::TYPE_MOVED => 'moved', |
| 149 | + Threads::TYPE_DELETED => 'deleted' ); |
143 | 150 | // Is it a thread |
144 | 151 | if ( $row->thread_id ) { |
145 | 152 | $thread = new Thread( $row ); |
146 | 153 | $threadInfo = "\n"; |
147 | | - $threadInfo .= Xml::element( 'ThreadSubject', null, $thread->subject() ) . "\n"; |
| 154 | + $attribs = array(); |
| 155 | + $attribs['ThreadSubject'] = $thread->subject(); |
148 | 156 | if ($thread->hasSuperThread()) { |
149 | | - $threadInfo .= Xml::element( 'ThreadParent', null, $thread->superThread()->id() ) . "\n"; |
| 157 | + $attribs['ThreadParent'] = $thread->superThread()->id(); |
150 | 158 | } |
151 | | - $threadInfo .= Xml::element( 'ThreadAncestor', null, $thread->topmostThread()->id() ) . "\n"; |
152 | | - $threadInfo .= Xml::element( 'ThreadPage', null, $thread->article()->getId() ) . "\n"; |
| 159 | + $attribs['ThreadAncestor'] = $thread->topmostThread()->id(); |
| 160 | + $attribs['ThreadPage'] = $thread->article()->getId(); |
| 161 | + $attribs['ThreadID'] = $thread->id(); |
| 162 | + if ( $thread->hasSummary() ) { |
| 163 | + $attribs['ThreadSummaryPage'] = $thread->summary()->getId(); |
| 164 | + } |
| 165 | + $attribs['ThreadAuthor'] = $thread->author()->getName(); |
| 166 | + $attribs['ThreadEditStatus'] = $editedStati[$thread->editedness()]; |
| 167 | + $attribs['ThreadType'] = $threadTypes[$thread->type()]; |
153 | 168 | |
| 169 | + foreach( $attribs as $key => $value ) { |
| 170 | + $threadInfo .= "\t".Xml::element( $key, null, $value ) . "\n"; |
| 171 | + } |
| 172 | + |
154 | 173 | $out .= Xml::tags( 'DiscussionThreading', null, $threadInfo ) . "\n"; |
155 | 174 | } |
156 | 175 | |