function ParserPopulateTicket(&$parser, $row) { $parser->Clear(); if ($row) { $parser->SetVar('ref', $row['reference']); $parser->SetVar('subject', "<a href='" . FSTRoute::_('index.php?option=com_fst&view=admin&layout=support&ticketid=' . $row['id']) . "'>" . $row['title'] . "</a>"); $parser->SetVar("status", "<span style='color:" . $row['color'] . ";'>" . $row['status'] . "</span>"); if ($row['user_id'] == 0) { $name = $row['unregname'] . " (" . JText::_("UNREG") . ")"; } else { $name = $row['name']; } $parser->SetVar("name", $name); $parser->SetVar("lastactivity", FST_Helper::Date($row['lastupdate'], FST_DATETIME_SHORT)); $parser->SetVar("opened", FST_Helper::Date($row['opened'], FST_DATETIME_SHORT)); $parser->SetVar("closed", FST_Helper::Date($row['closed'], FST_DATETIME_SHORT)); $parser->SetVar("department", $row['department']); $parser->SetVar("category", $row['category']); $parser->SetVar("product", $row['product']); $parser->SetVar("priority", "<span style='color:" . $row['pricolor'] . ";'>" . $row['priority'] . "</span>"); $groups = implode(", ", $row['groups']); $parser->SetVar('groups', $groups); $parser->SetVar('deletebutton', 'deletebutton'); $parser->SetVar('archivebutton', 'archivebutton'); if (array_key_exists("custom", $row)) { $allcustom = array(); if (count($row['custom']) > 0) { foreach ($row['custom'] as $id => $value) { if (array_key_exists($id, $this->customfields)) { $field = $this->customfields[$id]; if ($field['type'] == "plugin") { $aparams = FSTCF::GetValues($field); if (array_key_exists("plugin", $aparams) && array_key_exists("plugindata", $aparams)) { $plugin = FSTCF::get_plugin($aparams['plugin']); $value = $plugin->Display($value, $aparams['plugindata'], array('ticketid' => $row['id'], 'userid' => $row['user_id'], 'ticket' => $row), $field['id']); } } $text = "<span class='fst_support_fieldname'>" . $this->customfields[$id]['description'] . "</span>"; if ($this->customfields[$id]['type'] == "checkbox") { if ($value == "on") { $text .= ": " . JText::_("Yes"); } else { $text .= ": " . JText::_("No"); } } else { $text .= ": " . $value; } $parser->SetVar("custom" . $id, $text); $allcustom[] = $text; } } } //echo "All custom : " . implode(", ",$allcustom) . "<br>"; $parser->SetVar("custom", implode(", ", $allcustom)); } if ($row['assigned'] == '') { $parser->SetVar('handlername', JText::_("UNASSIGNED")); } else { $parser->SetVar('handlername', $row['assigned']); } $parser->SetVar('username', $row['username']); $parser->SetVar('email', $row['useremail']); $parser->SetVar('handlerusername', $row['handlerusername']); $parser->SetVar('handleremail', $row['handleremail']); $icons = ""; if (FST_Settings::get('support_show_msg_counts')) { $icons .= "<span>"; $icons .= "<span style='font-weight:normal;top:-2px;position:relative;padding-right:2px;'>" . $row['msgcount']['total'] . "</span><span style='font-weight:normal;top:-2px;position:relative;padding-right:2px;'>x</span><img src='" . JURI::root(true) . "/components/com_fst/assets/images/messages.png'>"; $icons .= "</span>"; } $cotime = $this->db_time - strtotime($row['checked_out_time']); if ($cotime < FST_Settings::get('support_lock_time') && $row['checked_out'] != $this->userid && $row['checked_out'] > 0) { $html = "<div class='fst_user_tt'>" . $row['co_user']->name . " (" . $row['co_user']->email . ")</div>"; $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fst/assets/images/lock.png' title=\"" . JText::_('TICKET_LOCKED') . "::" . $html . "\">"; } else { $icons .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/blank_16.png'>"; } if (!FST_Settings::get('support_hide_tags')) { if (isset($row['tags'])) { $html = ""; foreach ($row['tags'] as $tag) { $html .= "<div class='fst_tag_tt'>" . $tag['tag'] . "</div>"; } $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fst/assets/images/tag.png' title=\"" . JText::_('TICKET_TAGS') . "::" . $html . "\">"; } else { $icons .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/blank_16.png'>"; } } if (isset($row['attach'])) { $html = "<table class='fst_attach_tt'>"; foreach ($row['attach'] as $attach) { $html .= "<tr style='border:0px;'><td nowrap style='border:0px;'>" . $attach['filename'] . " </td><td nowrap style='border:0px;'> " . FST_Helper::display_filesize($attach['size']) . "</td></tr>"; } $html .= "<table>"; $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fst/assets/images/attach.png' title=\"" . JText::_('TICKET_ATTACHMENTS') . "::" . $html . "\">"; } else { $icons .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/blank_16.png'>"; } $parser->SetVar('icons', $icons); $delete = "<a href='" . FSTRoute::x('index.php?option=com_fst&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&delete=' . $row['id']) . "'>"; $delete .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/delete_ticket.png'>"; $delete .= JText::_("DELETE") . "</a>"; $archive = "<a href='" . FSTRoute::x('index.php?option=com_fst&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&archive=' . $row['id']) . "'>"; $archive .= "<img src='" . JURI::root(true) . "/components/com_fst/assets/images/archive_ticket.png'>"; $archive .= JText::_("ARCHIVE") . "</a>"; $parser->SetVar('archivebutton', $archive); $parser->SetVar('deletebutton', $delete); // TODO: trhl /*id='ticket_<?php echo $ticket['id'];?>' onmouseover="$('ticket_<?php echo $ticket['id'];?>').style.background = '<?php echo FST_Settings::get('css_hl'); ?>';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '<?php echo FST_Settings::get('css_hl'); ?>';" onmouseout="$('ticket_<?php echo $ticket['id'];?>').style.background = '';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '';"*/ $this->_permissions = FST_Ticket_Helper::getAdminPermissions(); $type = "unassigned"; if ($row['admin_id'] == $this->_permissions['id']) { $type = "mine"; } else { if ($row['admin_id'] > 0) { $type = "other"; } } $style = ""; if (array_key_exists($row['ticket_pri_id'], $this->priorities)) { $pri = $this->priorities[$row['ticket_pri_id']]; if ($pri['backcolor']) { $style .= "background-color: {$pri['backcolor']};"; } } $handler_highlight = "ticket_type_{$type}"; $parser->SetVar('handler_highlight', $handler_highlight); $trhl = " class='ticket_{$row['id']} ' onmouseover='highlightticket({$row['id']})' onmouseout='unhighlightticket({$row['id']})' "; if (FST_Settings::get('support_entire_row')) { $style .= "cursor: pointer;"; $trhl .= " onclick='window.location=\"" . FSTRoute::x('&limitstart=&ticketid=' . $row['id']) . "\"' "; } $trhl .= " style='{$style}' "; $parser->SetVar('trhl', $trhl); } $parser->SetVar("showassigned", $this->showassigned); $parser->SetVar("hidehandler", FST_Settings::get('support_hide_handler')); $parser->SetVar("candelete", FST_Settings::get('support_delete')); $parser->SetVar("view", $this->ticket_view); }
static function ParseMessageRows(&$messages, $ishtml) { $template = FST_EMail::Get_Template('messagerow'); $result = ""; foreach ($messages as &$message) { $vars = array(); //print_p($message); if ($message['name']) { $vars[] = FST_EMail::BuildVar('name', $message['name']); $vars[] = FST_EMail::BuildVar('email', $message['email']); $vars[] = FST_EMail::BuildVar('username', $message['username']); } else { $vars[] = FST_EMail::BuildVar('name', 'Unknown'); $vars[] = FST_EMail::BuildVar('email', 'Unknown'); $vars[] = FST_EMail::BuildVar('username', 'Unknown'); } $vars[] = FST_EMail::BuildVar('subject', $message['subject']); $vars[] = FST_EMail::BuildVar('posted', FST_Helper::Date($message['posted'])); $message['body'] = FST_Helper::ParseBBCode($message['body']); if ($ishtml) { $message['body'] = str_replace("\n", "<br>\n", $message['body']); $vars[] = FST_EMail::BuildVar('body', $message['body'] . "<br />"); } else { $vars[] = FST_EMail::BuildVar('body', $message['body'] . "\n"); } $result .= FST_EMail::ParseText($template['body'], $vars); } return $result; }
$custom = array(); if ($this->customfields) { foreach ($this->customfields as &$field) { if (array_key_exists('custom_' . $field['id'], $this->comment)) { $val = $this->comment['custom_' . $field['id']]; $this->parser->SetVar('custom_' . $field['id'], trim($val)); if (strlen(trim($val)) > 0) { $custom[] = $val; } } } } $this->parser->SetVar('divid', "fst_comment_{$this->uid}_{$this->comment['id']}"); if (count($custom) > 0) { $this->parser->SetVar('custom', implode(", ", $custom)); } else { $this->parser->SetVar('custom', ""); } $this->comment['body'] = str_replace("\n", "<br />", $this->comment['body']); $this->parser->SetVar('created_nice', FST_Helper::Date($this->comment['created'], FST_DATETIME_SHORT)); $this->parser->SetVar('date', FST_Helper::Date($this->comment['created'], FST_DATE_SHORT)); $this->parser->SetVar('modcolor', $modcolor); $this->parser->SetVar('moderation', $moderation); $this->parser->AddVars($this->comment); if ($this->opt_max_length > 0) { if (strlen($this->comment['body']) > $this->opt_max_length) { $this->parser->SetVar('body', substr($this->comment['body'], 0, $this->opt_max_length) . "..."); } } //print_p($this->parser); echo $this->parser->Parse();
<td> <a href="<?php echo $link; ?> "><?php $body = strip_tags($row->body); if (strlen($body) > 250) { $body = substr($body, 0, 250) . "..."; } echo $body; ?> </a> </td> <td> <?php echo FST_Helper::Date($row->added, FST_DATETIME_MID); ?> </td> <td align="center"> <a href="#" class="modchage" id="comment_<?php echo $row->id; ?> " current='<?php echo $row->published; ?> '> <?php echo $published; ?> </a> </td>