64 $this->_useIcons = $use_icons;
65 $this->_doIconCheck = $do_iconcheck;
66 $this->_statusText = array(
67 COMMENTS_PENDING =>
'<span style="text-decoration: none; font-weight: bold; color: #00ff00;">' .
_MD_COMMENTS_PENDING .
'</span>',
68 COMMENTS_ACTIVE =>
'<span style="text-decoration: none; font-weight: bold; color: #ff0000;">' .
_MD_COMMENTS_ACTIVE .
'</span>',
69 COMMENTS_HIDDEN =>
'<span style="text-decoration: none; font-weight: bold; color: #0000ff;">' .
_MD_COMMENTS_HIDDEN .
'</span>'
85 if (!isset($instance)) {
87 $instance =
new $class($tpl, $use_icons, $do_iconcheck);
99 if (isset($this->_comments)) {
100 unset($this->_comments);
102 $this->_comments =& $comments_arr;
112 foreach ($this->_comments as
$i => $comment) {
114 if (
false != $this->_useIcons) {
115 $title = $this->
_getTitleIcon($comment->getVar(
'icon')) .
' ' . $comment->getVar(
'title');
117 $title = $comment->getVar(
'title');
120 if (
false != $admin_view) {
121 $text = $comment->getVar(
'text') .
'<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' .
_MD_COMMENTS_STATUS .
': ' . $this->_statusText[$comment->getVar(
'status')] .
'<br />IP: <span style="font-weight: bold;">' . $comment->getVar(
'ip') .
'</span></div>';
124 if (COMMENTS_ACTIVE != $comment->getVar(
'status')) {
127 $text = $comment->getVar(
'text');
130 $this->_comments[
$i] = $comment;
131 $this->_tpl->append(
'comments', array(
132 'id' => $comment->getVar(
'id'),
154 $tree = $xot->getTree();
156 if (
false != $this->_useIcons) {
157 $title = $this->
_getTitleIcon($tree[$comment_id][
'obj']->getVar(
'icon')) .
' ' . $tree[$comment_id][
'obj']->getVar(
'title');
159 $title = $tree[$comment_id][
'obj']->getVar(
'title');
161 if (
false != $show_nav && $tree[$comment_id][
'obj']->getVar(
'pid') != 0) {
164 $this->_tpl->assign(
'show_threadnav',
true);
166 $this->_tpl->assign(
'show_threadnav',
false);
168 if (
false != $admin_view) {
170 $text = $tree[$comment_id][
'obj']->getVar(
'text') .
'<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' .
_MD_COMMENTS_STATUS .
': ' . $this->_statusText[$tree[$comment_id][
'obj']->getVar(
'status')] .
'<br />IP: <span style="font-weight: bold;">' . $tree[$comment_id][
'obj']->getVar(
'ip') .
'</span></div>';
173 if (COMMENTS_ACTIVE != $tree[$comment_id][
'obj']->getVar(
'status')) {
175 if (isset($tree[$comment_id][
'child']) && !empty($tree[$comment_id][
'child'])) {
176 foreach ($tree[$comment_id][
'child'] as $child_id) {
182 $text = $tree[$comment_id][
'obj']->getVar(
'text');
187 $show_replies = (count($replies) > 0) ?
true :
false;
188 $this->_tpl->append(
'comments', array(
189 'pid' => $tree[$comment_id][
'obj']->getVar(
'pid'),
190 'id' => $tree[$comment_id][
'obj']->getVar(
'id'),
191 'itemid' => $tree[$comment_id][
'obj']->getVar(
'itemid'),
192 'rootid' => $tree[$comment_id][
'obj']->getVar(
'rootid'),
197 'poster' => $this->
_getPosterArray($tree[$comment_id][
'obj']->getVar(
'uid')),
198 'replies' => $replies,
199 'show_replies' => $show_replies
216 private function _renderThreadReplies(&$thread, $key, &$replies, $prefix, $admin_view, $depth = 0, $current_prefix =
'')
219 if (
false != $this->_useIcons) {
220 $title = $this->
_getTitleIcon($thread[$key][
'obj']->getVar(
'icon')) .
' ' . $thread[$key][
'obj']->getVar(
'title');
222 $title = $thread[$key][
'obj']->getVar(
'title');
224 $title = (
false != $admin_view) ? $title .
' ' . $this->_statusText[$thread[$key][
'obj']->getVar(
'status')] : $title;
227 'prefix' => $current_prefix,
230 'root_id' => $thread[$key][
'obj']->getVar(
'rootid'),
231 'status' => $this->_statusText[$thread[$key][
'obj']->getVar(
'status')],
232 'poster' => $this->
_getPosterName($thread[$key][
'obj']->getVar(
'uid'))
234 $current_prefix .= $prefix;
236 if (isset($thread[$key][
'child']) && !empty($thread[$key][
'child'])) {
238 foreach ($thread[$key][
'child'] as $childkey) {
239 if (!$admin_view && $thread[$childkey][
'obj']->getVar(
'status') != COMMENTS_ACTIVE) {
241 if (isset($thread[$childkey][
'child']) && !empty($thread[$childkey][
'child'])) {
242 foreach ($thread[$childkey][
'child'] as $childchildkey) {
247 $this->
_renderThreadReplies($thread, $childkey, $replies, $prefix, $admin_view, $depth, $current_prefix);
263 $tree = $xot->getTree();
264 if (
false != $this->_useIcons) {
265 $title = $this->
_getTitleIcon($tree[$comment_id][
'obj']->getVar(
'icon')) .
' ' . $tree[$comment_id][
'obj']->getVar(
'title');
267 $title = $tree[$comment_id][
'obj']->getVar(
'title');
269 if (
false != $admin_view) {
270 $text = $tree[$comment_id][
'obj']->getVar(
'text') .
'<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' .
_MD_COMMENTS_STATUS .
': ' . $this->_statusText[$tree[$comment_id][
'obj']->getVar(
'status')] .
'<br />IP: <span style="font-weight: bold;">' . $tree[$comment_id][
'obj']->getVar(
'ip') .
'</span></div>';
273 if (COMMENTS_ACTIVE != $tree[$comment_id][
'obj']->getVar(
'status')) {
275 if (isset($tree[$comment_id][
'child']) && !empty($tree[$comment_id][
'child'])) {
276 foreach ($tree[$comment_id][
'child'] as $child_id) {
282 $text = $tree[$comment_id][
'obj']->getVar(
'text');
287 $this->_tpl->append(
'comments', array(
288 'pid' => $tree[$comment_id][
'obj']->getVar(
'pid'),
289 'id' => $tree[$comment_id][
'obj']->getVar(
'id'),
290 'itemid' => $tree[$comment_id][
'obj']->getVar(
'itemid'),
291 'rootid' => $tree[$comment_id][
'obj']->getVar(
'rootid'),
296 'poster' => $this->
_getPosterArray($tree[$comment_id][
'obj']->getVar(
'uid')),
297 'replies' => $replies
316 if (
false != $this->_useIcons) {
317 $title = $this->
_getTitleIcon($thread[$key][
'obj']->getVar(
'icon')) .
' ' . $thread[$key][
'obj']->getVar(
'title');
319 $title = $thread[$key][
'obj']->getVar(
'title');
321 $text = (
false != $admin_view) ? $thread[$key][
'obj']->getVar(
'text') .
'<div style="text-align:right; margin-top: 2px; margin-right: 2px;">' .
_MD_COMMENTS_STATUS .
': ' . $this->_statusText[$thread[$key][
'obj']->getVar(
'status')] .
'<br />IP: <span style="font-weight: bold;">' . $thread[$key][
'obj']->getVar(
'ip') .
'</span></div>' : $thread[$key][
'obj']->getVar(
'text');
325 'pid' => $thread[$key][
'obj']->getVar(
'pid'),
326 'itemid' => $thread[$key][
'obj']->getVar(
'itemid'),
327 'rootid' => $thread[$key][
'obj']->getVar(
'rootid'),
332 'poster' => $this->
_getPosterArray($thread[$key][
'obj']->getVar(
'uid'))
335 $prefix = $prefix + 25;
337 if (isset($thread[$key][
'child']) && !empty($thread[$key][
'child'])) {
339 foreach ($thread[$key][
'child'] as $childkey) {
340 if (!$admin_view && $thread[$childkey][
'obj']->getVar(
'status') != COMMENTS_ACTIVE) {
342 if (isset($thread[$childkey][
'child']) && !empty($thread[$childkey][
'child'])) {
343 foreach ($thread[$childkey][
'child'] as $childchildkey) {
344 $this->
_renderNestReplies($thread, $childchildkey, $replies, $prefix, $admin_view, $depth);
348 $this->
_renderNestReplies($thread, $childkey, $replies, $prefix, $admin_view, $depth);
364 $poster[
'id'] = intval($poster_id);
365 if ($poster[
'id'] > 0) {
367 if (!is_object(
$user)) {
385 $poster[
'id'] = intval($poster_id);
386 if ($poster[
'id'] > 0) {
390 if (is_object(
$user)) {
392 $poster_rank =
$user->rank();
393 $poster[
'rank_image'] = ($poster_rank[
'image'] !=
'') ? $poster_rank[
'image'] :
'blank.gif';
394 $poster[
'rank_title'] = $poster_rank[
'title'];
400 $poster[
'from'] =
$user->getVar(
'user_from');
401 $poster[
'postnum'] =
$user->getVar(
'posts');
410 $poster[
'rank_title'] =
'';
411 $poster[
'avatar'] =
'blank.gif';
412 $poster[
'regdate'] =
'';
413 $poster[
'from'] =
'';
414 $poster[
'postnum'] = 0;
415 $poster[
'status'] =
'';
429 $icon_image = htmlspecialchars(trim($icon_image));
430 if ($icon_image !=
'') {
431 if (
false != $this->_doIconCheck) {
435 return '<img src="' .
\XoopsBaseConfig::get(
'url') .
'/images/subject/' . $icon_image .
'" alt="" />';
438 return '<img src="' .
\XoopsBaseConfig::get(
'url') .
'/images/subject/' . $icon_image .
'" alt="" />';
441 return '<img src="' . XOOPS_URL .
'/images/icons/no_posticon.gif" alt="" />';
static formatTimestamp($time, $format= 'l', $timeoffset=null)
static getUnameFromId($userid, $usereal=false, $linked=false)
if($uname== ''||$pass== '') $member_handler
const _MD_COMMENTS_ACTIVE
const _MD_COMMENTS_PENDING
const _MD_COMMENTS_HIDDEN
const _MD_COMMENTS_PARENT
if($xoops->isUser()&&$isAdmin) $response
const _MD_COMMENTS_STATUS
const _MD_COMMENTS_ONLINE