Example #1
0
 /**
  * Render the comments in flat view
  *
  * @param boolean $admin_view
  **/
 function renderFlatView($admin_view = false, $modlink = '', $itemlink = '')
 {
     $count = count($this->_comments);
     for ($i = 0; $i < $count; $i++) {
         if (false != $this->_useIcons) {
             $title = $this->_getTitleIcon($this->_comments[$i]->getVar('com_icon')) . '&nbsp;' . $this->_comments[$i]->getVar('com_title');
         } else {
             $title = $this->_comments[$i]->getVar('com_title');
         }
         $poster = $this->_getPosterArray($this->_comments[$i]->getVar('com_uid'));
         if (false != $admin_view) {
             $text = $this->_getText($this->_comments[$i]->getVar('com_text'), $this->_comments[$i]->getVar('com_pid')) . '<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' . _MA_MYCOM_STATUS . ': ' . $this->_statusText[$this->_comments[$i]->getVar('com_status')] . '<br />IP: <span style="font-weight: bold;">' . $this->_comments[$i]->getVar('com_ip') . '</span></div>';
         } else {
             // hide comments that are not active
             if (MYCOM_ACTIVE != $this->_comments[$i]->getVar('com_status')) {
                 continue;
             } else {
                 $text = $this->_getText($this->_comments[$i]->getVar('com_text'), $this->_comments[$i]->getVar('com_pid'));
             }
         }
         $array[0] = $this->_comments[$i]->getVar('com_itemid');
         $item = mycomments_plugin_execute($this->_comments[$i]->getVar('dirname'), $array, 'iteminfo');
         $this->_tpl->append('comments', array('id' => $this->_comments[$i]->getVar('com_id'), 'title' => $title, 'text' => $text, 'date_posted' => formatTimestamp($this->_comments[$i]->getVar('com_created'), 'm'), 'date_modified' => formatTimestamp($this->_comments[$i]->getVar('com_modified'), 'm'), 'item_link' => $item[0]['link'], 'item_title' => $item[0]['title'], 'module_link' => XOOPS_URL . '/modules/' . $this->_comments[$i]->getVar('dirname'), 'module_name' => $this->_comments[$i]->getVar('name'), 'editcomment_link' => XOOPS_URL . '/modules/' . $this->_comments[$i]->getVar('dirname') . '/comment_edit.php?com_itemid=' . $this->_comments[$i]->getVar('com_itemid'), 'deletecomment_link' => XOOPS_URL . '/modules/' . $this->_comments[$i]->getVar('dirname') . '/comment_delete.php?com_itemid=' . $this->_comments[$i]->getVar('com_itemid'), 'replycomment_link' => XOOPS_URL . '/modules/' . $this->_comments[$i]->getVar('dirname') . '/comment_reply.php?com_itemid=' . $this->_comments[$i]->getVar('com_itemid'), 'poster' => $poster));
     }
 }
Example #2
0
}
$module_handler =& xoops_gethandler('module');
$comments_handler =& xoops_getmodulehandler('comment');
$criteria = new CriteriaCompo(new Criteria('hascomments', 1));
if ($mid > 0) {
    $criteria->add(new Criteria('mid', $mid), 'AND');
}
$modules =& $module_handler->getObjects($criteria, true);
unset($criteria);
$criteria = new CriteriaCompo();
$criteria2 = new CriteriaCompo();
foreach ($modules as $moduleid => $module) {
    //for comments recieved
    if ($view == 0) {
        $items = array();
        $items = mycomments_plugin_execute($module->getVar('dirname'), $uid, 'useritems');
        if (is_array($items) && count($items) > 0) {
            $items = '(' . implode(',', $items) . ')';
            $dirname = $module->getVar('dirname');
            ${$dirname} = new CriteriaCompo(new Criteria('com_modid', $moduleid));
            ${$dirname}->add(new Criteria('com_itemid', $items, 'IN'), 'AND');
            $criteria->add(${$dirname}, 'OR');
        } else {
            //ugly fix, sorry
            $criteria->add(new CriteriaCompo(new Criteria('1', 2)), 'OR');
        }
        unset($items);
        //for comments sent
    } else {
        $items = array();
        $items = mycomments_get_plugin_info($module->getVar('dirname'), 'useritems');