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 FieldOutput(&$field, &$fieldvalues, $context) { $value = ""; if (count($fieldvalues) > 0) { foreach ($fieldvalues as $fieldvalue) { if ($fieldvalue['field_id'] == $field['id']) { $value = $fieldvalue['value']; break; } } } if ($field['type'] == "plugin") { $aparams = FSTCF::GetValues($field); $plugin = FSTCF::get_plugin($aparams['plugin']); $value = $plugin->Display($value, $aparams['plugindata'], $context, $field['id']); } if ($field['type'] == "area") { $value = str_replace("\n", "<br />", $value); } if ($field['type'] == "checkbox") { if ($value == "on") { return "Yes"; } return "No"; } return $value; }