/** * Render comments in nested view * * Danger: Recursive! * * @param integer $comment_id Always "0" when called by client. * @param boolean $admin_view */ public function renderNestView($comment_id = 0, $admin_view = FALSE) { $xot = new icms_ipf_Tree($this->_comments, 'com_id', 'com_pid', 'com_rootid'); $tree =& $xot->getTree(); if (FALSE != $this->_useIcons) { $title = $this->_getTitleIcon($tree[$comment_id]['obj']->getVar('com_icon')) . ' ' . $tree[$comment_id]['obj']->getVar('com_title'); } else { $title = $tree[$comment_id]['obj']->getVar('com_title'); } if (FALSE != $admin_view) { $text = $tree[$comment_id]['obj']->getVar('com_text') . '<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' . _CM_STATUS . ': ' . $this->_statusText[$tree[$comment_id]['obj']->getVar('com_status')] . '<br />IP: <span style="font-weight: bold;">' . $tree[$comment_id]['obj']->getVar('com_ip') . '</span></div>'; } else { // skip this comment if it is not active and continue on processing its child comments instead if (XOOPS_COMMENT_ACTIVE != $tree[$comment_id]['obj']->getVar('com_status')) { // if there are any child comments, display them as root comments if (isset($tree[$comment_id]['child']) && !empty($tree[$comment_id]['child'])) { foreach ($tree[$comment_id]['child'] as $child_id) { $this->renderNestView($child_id, $admin_view); } } return; } else { $text = $tree[$comment_id]['obj']->getVar('com_text'); } } $replies = array(); $this->_renderNestReplies($tree, $comment_id, $replies, 25, $admin_view); $this->_tpl->append('comments', array('pid' => $tree[$comment_id]['obj']->getVar('com_pid'), 'id' => $tree[$comment_id]['obj']->getVar('com_id'), 'itemid' => $tree[$comment_id]['obj']->getVar('com_itemid'), 'rootid' => $tree[$comment_id]['obj']->getVar('com_rootid'), 'title' => $title, 'text' => $text, 'date_posted' => formatTimestamp($tree[$comment_id]['obj']->getVar('com_created'), 'm'), 'date_modified' => formatTimestamp($tree[$comment_id]['obj']->getVar('com_modified'), 'm'), 'poster' => $this->_getPosterArray($tree[$comment_id]['obj']->getVar('com_uid')), 'replies' => $replies)); }
public function __construct(&$objectArr, $myId, $parentId, $rootId = null) { parent::__construct($objectArr, $myId, $parentId, $rootId); $this->_deprecated = icms_core_Debug::setDeprecated('icms_ipf_Tree', sprintf(_CORE_REMOVE_IN_VERSION, '1.4')); }
if (count($errs) > 0) { include ICMS_ROOT_PATH . '/header.php'; icms_core_Message::error($errs); include ICMS_ROOT_PATH . '/footer.php'; exit; } redirect_header($redirect_page . '=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode, 1, _CM_COMDELETED); break; case 'delete_all': $comment_handler = icms::handler('icms_data_comment'); $comment =& $comment_handler->get($com_id); $com_rootid = $comment->getVar('com_rootid'); // get all comments posted later within the same thread $thread_comments =& $comment_handler->getThread($com_rootid, $com_id); // construct a comment tree $xot = new icms_ipf_Tree($thread_comments, 'com_id', 'com_pid', 'com_rootid'); $child_comments =& $xot->getAllChild($com_id); // add itself here $child_comments[$com_id] =& $comment; $msgs = array(); $deleted_num = array(); $member_handler = icms::handler('icms_member'); foreach (array_keys($child_comments) as $i) { if (!$comment_handler->delete($child_comments[$i])) { $msgs[] = _CM_COMDELETENG . ' (ID: ' . icms_conv_nr2local($child_comments[$i]->getVar('com_id')) . ')'; } else { $msgs[] = _CM_COMDELETED . ' (ID: ' . icms_conv_nr2local($child_comments[$i]->getVar('com_id')) . ')'; // store poster ID and deleted post number into array for later use $poster_id = $child_comments[$i]->getVar('com_uid'); if ($poster_id > 0) { $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : $deleted_num[$poster_id] + 1;