示例#1
0
 /**
  * Outputs a comment wrapped in template for ajax purposes
  *
  * @version     1.0
  * @since       0.8.0
  */
 function getLastComment($id)
 {
     $objTPL = coreObj::getTPL();
     $objSQL = coreObj::getDBO();
     $objUser = coreObj::getUser();
     $objTime = coreObj::getTime();
     //set the template for the comments
     $objTPL->set_filenames(array('ajComments' => 'modules/core/template/comments/ajaxComments.tpl'));
     $commentQuery = $objSQL->queryBuilder()->select('*')->from('#__comments')->where('id', '=', $id)->limit(1)->build();
     $comments = $objSQL->fetchAll($commentQuery);
     if (is_array($comments) && count($comments) > 0) {
         $objTPL->assign_block_vars('comment', array('ID' => $comments['id'], 'cID' => 'comment-' . $comments['id'], 'ROW' => $i % 2 ? 'row_color2' : 'row_color1', 'ALT_ROW' => $i % 2 ? 'row_color1' : 'row_color2', 'AUTHOR' => $objUser->profile($comments['author']), 'POSTED' => $objTime->mk_time($comments['timestamp']), 'POST' => contentParse($comments['comment'])));
         if (User::$IS_ADMIN || User::$IS_MOD || User::$IS_ONLINE && ($objUser->get('id') == $comments['author'] || $objUser->get('id') == $this->author_id)) {
             $objTPL->assign_block_vars('comment.functions', array('URL' => $this->aURL[0] . '?mode=deleteComment&id=' . $comments['id']));
         }
     }
     $this->objTPL->parse('ajComments', false);
     return $this->objTPL->get_html('ajComments');
 }