/** * Enter description here... * * @return unknown */ public function render($current_user, $criteria, $template_name = '') { require_once DIR . "/includes/functions_socialgroup.php"; require_once DIR . "/includes/class_groupmessage.php"; $user = vB_Legacy_User::createFromIdCached($this->discussion->getUserId()); $item = $this->discussion->getInfo($current_user->get_field('userid')); $item = array_merge($item, $user->get_record()); $item['issearch'] = true; $group = $this->discussion->getSocialGroup(); if ($group->has_modperm('canviewdeleted', $current_user)) { $dellog = $this->discussion->getDeletionLogArray(); $item['del_username'] = $dellog['username']; $item['del_userid'] = $dellog['userid']; $item['del_reason'] = $dellog['reason']; } //I'm not sure what these are for, but they exist in the template so we should //make sure they are set. The main message display code does not appear to //set them. global $show; $show['group'] = false; global $vbulletin; $factory = new vB_Group_Bit_Factory($vbulletin); $bit = $factory->create($item, $this->discussion->getSocialGroup()->get_record()); //unfortunately the bit render can set the $show['inlinemod'] variable which we are //currently using across all templates to handle the inline mod settings. We should //probably rely on something a little less global but that's not in the cards right now. //make sure that we honor the starting value and restore it when we are done. $inlinemod = $show['inlinemod']; $bit->show_moderation_tools($inlinemod); $text = $bit->construct(); $show['inlinemod'] = $inlinemod; //todo this is ugly and invalid html. We need to get the message_list //id out of here and convert the css to use a class for that formatting //but lets wait until we figure out what the new look and feel is going //do to or for us. return $text; }
public function render($current_user, $criteria, $template_name = '') { require_once(DIR . "/includes/functions_socialgroup.php"); require_once(DIR . "/includes/class_groupmessage.php"); global $vbulletin; $user = vB_Legacy_User::createFromIdCached($this->message->getPostUserId(), FETCH_USERINFO_AVATAR); $item = $this->message->getInfo(); if (strlen($template_name)) { if ($record = vB::$vbulletin->db->query_first("SELECT gm.*, gr.groupid, disc.discussionid, starter.postuserid AS poststarterid, starter.postusername AS poststarter, disc.firstpostid, starter.title AS firsttitle, gr.groupid, gr.name AS groupname FROM " . TABLE_PREFIX . "groupmessage AS gm\n INNER JOIN " . TABLE_PREFIX . "discussion AS disc ON disc.discussionid = gm.discussionid\n INNER JOIN " . TABLE_PREFIX . "socialgroup AS gr ON gr.groupid = disc.groupid\n INNER JOIN " . TABLE_PREFIX . "groupmessage AS starter ON starter.gmid = disc.firstpostid\n WHERE gm.gmid = " . $item['gmid'] )) { $item = array_merge($item, $record); } if (!$this->bbcode_parser) { $this->bbcode_parser = new vB_BbCodeParser(vB::$vbulletin, fetch_tag_list()); } $item['previewtext'] = fetch_censored_text($this->bbcode_parser->get_preview($item['pagetext'], 200)); $template = vB_Template::create($template_name); $template->register('item', $item); $template->register('dateformat', $vbulletin->options['dateformat']); $template->register('timeformat', $vbulletin->options['default_timeformat']); return $template->render(); } $item = array_merge($item, $user->get_record()); $item['hascustom'] = $item['hascustomavatar']; $item['issearch'] = true; $group = $this->message->getDiscussion()->getSocialGroup(); if ($group->has_modperm('canviewdeleted', $current_user)) { $dellog = $this->message->getDeletionLogArray(); $item['del_username'] = $dellog['username']; $item['del_userid'] = $dellog['userid']; $item['del_reason'] = $dellog['reason']; } //I'm not sure what these are for, but they exist in the template so we should //make sure they are set. The main message display code does not appear to //set them. global $show; $show['group'] = false; $show['discussion'] = false; //If we want to create our own template, then we need $factory = new vB_Group_Bit_Factory($vbulletin); //this gets lookup up by the bit anyway. Not sure why we need to pass it. $group = array(); $bit = $factory->create($item, $group); //unfortunately the bit render can set the $show['inlinemod'] variable which we are //currently using across all templates to handle the inline mod settings. We should //probably rely on something a little less global but that's not in the cards right now. //make sure that we honor the starting value and restore it when we are done. $inlinemod = $show['inlinemod']; $bit->show_moderation_tools($inlinemod); $text = $bit->construct(); $show['inlinemod'] = $inlinemod; //todo this is ugly and invalid html. We need to get the message_list //id out of here and convert the css to use a class for that formatting //but lets wait until we figure out what the new look and feel is going //do to or for us. return $text; }