Beispiel #1
0
 function ParserPopulateTicket(&$parser, $row)
 {
     $parser->Clear();
     if ($row) {
         $parser->SetVar('ref', $row['reference']);
         $parser->SetVar('subject', "<a href='" . FSFRoute::_('index.php?option=com_fsf&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", FSF_Helper::Date($row['lastupdate'], FSF_DATETIME_SHORT));
         $parser->SetVar("opened", FSF_Helper::Date($row['opened'], FSF_DATETIME_SHORT));
         $parser->SetVar("closed", FSF_Helper::Date($row['closed'], FSF_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 = FSFCF::GetValues($field);
                             if (array_key_exists("plugin", $aparams) && array_key_exists("plugindata", $aparams)) {
                                 $plugin = FSFCF::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='fsf_support_fieldname'>" . $this->customfields[$id]['description'] . "</span>";
                         if ($this->customfields[$id]['type'] == "checkbox") {
                             if ($value == "on") {
                                 $value = JText::_("Yes");
                             } else {
                                 $value = JText::_("No");
                             }
                         }
                         $parser->SetVar("custom" . $id, $value);
                         $parser->SetVar("custom_" . $id, $value);
                         $allcustom[] = $text . ": " . $value;
                     }
                 }
             }
             //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 (FSF_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_fsf/assets/images/messages.png'>";
             $icons .= "</span>";
         }
         $cotime = $this->db_time - strtotime($row['checked_out_time']);
         if ($cotime < FSF_Settings::get('support_lock_time') && $row['checked_out'] != $this->userid && $row['checked_out'] > 0) {
             $html = "<div class='fsf_user_tt'>" . $row['co_user']->name . " (" . $row['co_user']->email . ")</div>";
             $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fsf/assets/images/lock.png' title=\"" . JText::_('TICKET_LOCKED') . "::" . $html . "\">";
         } else {
             $icons .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/blank_16.png'>";
         }
         if (!FSF_Settings::get('support_hide_tags')) {
             if (isset($row['tags'])) {
                 $html = "";
                 foreach ($row['tags'] as $tag) {
                     $html .= "<div class='fsf_tag_tt'>" . $tag['tag'] . "</div>";
                 }
                 $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fsf/assets/images/tag.png' title=\"" . JText::_('TICKET_TAGS') . "::" . $html . "\">";
             } else {
                 $icons .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/blank_16.png'>";
             }
         }
         if (isset($row['attach'])) {
             $html = "<table class='fsf_attach_tt'>";
             foreach ($row['attach'] as $attach) {
                 $html .= "<tr style='border:0px;'><td nowrap style='border:0px;'>" . $attach['filename'] . "&nbsp;</td><td nowrap style='border:0px;'>&nbsp;" . FSF_Helper::display_filesize($attach['size']) . "</td></tr>";
             }
             $html .= "<table>";
             $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fsf/assets/images/attach.png' title=\"" . JText::_('TICKET_ATTACHMENTS') . "::" . $html . "\">";
         } else {
             $icons .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/blank_16.png'>";
         }
         $parser->SetVar('icons', $icons);
         $delete = "<a href='" . FSFRoute::x('index.php?option=com_fsf&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&delete=' . $row['id']) . "'>";
         $delete .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/delete_ticket.png'>";
         $delete .= JText::_("DELETE") . "</a>";
         $archive = "<a href='" . FSFRoute::x('index.php?option=com_fsf&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&archive=' . $row['id']) . "'>";
         $archive .= "<img src='" . JURI::root(true) . "/components/com_fsf/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 FSF_Settings::get('css_hl'); ?>';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '<?php echo FSF_Settings::get('css_hl'); ?>';"
         		onmouseout="$('ticket_<?php echo $ticket['id'];?>').style.background = '';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '';"*/
         $this->_permissions = FSF_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 (FSF_Settings::get('support_entire_row')) {
             $style .= "cursor: pointer;";
             $trhl .= " onclick='window.location=\"" . FSFRoute::x('&limitstart=&ticketid=' . $row['id']) . "\"' ";
         }
         $trhl .= " style='{$style}' ";
         $parser->SetVar('trhl', $trhl);
     }
     $parser->SetVar("showassigned", $this->showassigned);
     $parser->SetVar("hidehandler", FSF_Settings::get('support_hide_handler'));
     $parser->SetVar("candelete", FSF_Settings::get('support_delete'));
     $parser->SetVar("view", $this->ticket_view);
 }
Beispiel #2
0
 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 = FSFCF::GetValues($field);
         $plugin = FSFCF::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;
 }