Exemple #1
0
 /**
  * Make a menu from the categories list
  *
  * @param  string  $fieldName Name of the member variable from the node objects that should be used as the title for the options.
  * @param  integer $key       ID of the object to display as the root of select options
  * @return string  HTML select box
  */
 public function getUlMenu($fieldName, $key = 0)
 {
     include_once XOOPS_ROOT_PATH . '/class/tree.php';
     $items = $this->getAllCategories(new oledrion_parameters());
     $treeObject = new XoopsObjectTree($items, 'cat_cid', 'cat_pid');
     $tree = $treeObject->getTree();
     $ret = '';
     $this->_makeLi($fieldName, $key, $ret, $tree);
     if (xoops_trim($ret) != '') {
         $ret = substr($ret, 0, -6);
     }
     return $ret;
 }
 /**
  * Render comments in nested view
  *
  * Danger: Recursive!
  *
  * @param integer $comment_id Always "0" when called by client.
  * @param boolean $admin_view
  */
 function renderNestView($comment_id = 0, $admin_view = false)
 {
     include_once $GLOBALS['xoops']->path('class/tree.php');
     $xot = new XoopsObjectTree($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));
 }
 /**
  * Render comments in nested view
  * Danger: Recursive!
  *
  * @param integer $comment_id Always "0" when called by client.
  * @param boolean $admin_view
  *
  * @return void
  */
 public function renderNestView($comment_id = 0, $admin_view = false)
 {
     $xot = new XoopsObjectTree($this->comments, 'id', 'pid', 'rootid');
     $tree = $xot->getTree();
     $image = false != $this->useIcons ? $this->getTitleIcon($tree[$comment_id]['obj']->getVar('icon')) : '';
     $title = $tree[$comment_id]['obj']->getVar('title');
     if (false != $admin_view) {
         $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>';
     } else {
         // skip this comment if it is not active and continue on processing its child comments instead
         if (Comments::STATUS_ACTIVE != $tree[$comment_id]['obj']->getVar('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('text');
         }
     }
     $replies = array();
     $this->renderNestReplies($tree, $comment_id, $replies, 25, $admin_view);
     $this->tpl->append('comments', array('pid' => $tree[$comment_id]['obj']->getVar('pid'), 'id' => $tree[$comment_id]['obj']->getVar('id'), 'itemid' => $tree[$comment_id]['obj']->getVar('itemid'), 'rootid' => $tree[$comment_id]['obj']->getVar('rootid'), 'image' => $image, 'title' => $title, 'text' => $text, 'date_posted' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('created'), 'm'), 'date_modified' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('modified'), 'm'), 'poster' => $this->getPosterArray($tree[$comment_id]['obj']->getVar('uid')), 'replies' => $replies));
 }