static function &getTicketCount() { FST_Ticket_Helper::getAdminPermissions(); if (empty(FST_Ticket_Helper::$counts)) { $db = JFactory::getDBO(); $query = "SELECT count( * ) AS count, ticket_status_id FROM #__fst_ticket_ticket WHERE 1 "; $query .= FST_Ticket_Helper::$_perm_where; $query .= " GROUP BY ticket_status_id"; $db->setQuery($query); $rows = $db->loadAssocList(); $out = array(); FST_Ticket_Helper::GetStatusList(); foreach (FST_Ticket_Helper::$status_list as $status) { $out[$status->id] = 0; } if (count($rows) > 0) { foreach ($rows as $row) { $out[$row['ticket_status_id']] = $row['count']; } } // work out counts for allopen, closed, all, archived $archived = FST_Ticket_Helper::GetStatusID("def_archive"); $out['archived'] = 0; if (array_key_exists($archived, $out)) { $out['archived'] = $out[$archived]; } $allopen = FST_Ticket_Helper::GetStatusIDs("is_closed", true); $out['allopen'] = 0; foreach ($allopen as $id) { if (array_key_exists($id, $out)) { $out['allopen'] += $out[$id]; } } $allclosed = FST_Ticket_Helper::GetClosedStatus(); $out['allclosed'] = 0; foreach ($allclosed as $id) { if (array_key_exists($id, $out)) { $out['allclosed'] += $out[$id]; } } $all = FST_Ticket_Helper::GetStatusIDs("def_archive", true); $out['all'] = 0; foreach ($all as $id) { if (array_key_exists($id, $out)) { $out['all'] += $out[$id]; } } FST_Ticket_Helper::$counts = $out; } return FST_Ticket_Helper::$counts; }
function display($tpl = null) { JHTML::_('behavior.modal', 'a.fst_modal'); $user = JFactory::getUser(); $this->userid = $user->get('id'); // remove any admin open stuff $_SESSION['admin_create'] = 0; $_SESSION['admin_create_user_id'] = 0; $_SESSION['ticket_email'] = ""; $_SESSION['ticket_name'] = ""; // set up permissions $mainframe = JFactory::getApplication(); $aparams = $mainframe->getPageParameters('com_fst'); $this->permission = FST_Ticket_Helper::getAdminPermissions(); $model = $this->getModel(); $model->_perm_where = FST_Ticket_Helper::$_perm_where; // sort layout $layout = JRequest::getVar('layout', JRequest::getVar('_layout', '')); $this->assignRef('layout', $layout); // return $this->displayModerate(); // }
static function getUserSetting($setting) { if (empty(FST_Helper::$_permissions)) { FST_Ticket_Helper::getAdminPermissions(); } if (empty(FST_Helper::$user_defaults)) { FST_Helper::getUserDefaults(); } if (array_key_exists('settings', FST_Ticket_Helper::$_permissions) && is_array(FST_Ticket_Helper::$_permissions['settings']) && array_key_exists($setting, FST_Ticket_Helper::$_permissions['settings'])) { return FST_Ticket_Helper::$_permissions['settings'][$setting]; } if (array_key_exists($setting, FST_Helper::$user_defaults)) { return FST_Helper::$user_defaults[$setting]; } return 0; }
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); }
function &getTicket($ticketid) { $db = JFactory::getDBO(); $query = "SELECT t.*, u.name, u.username, p.title as product, d.title as dept, c.title as cat, s.title as status, "; $query .= "s.color as scolor, s.id as sid, pr.title as pri, pr.color as pcolor, pr.id as pid"; $query .= " , pr.translation as ptl, d.translation as dtr, s.translation as str, c.translation as ctr, p.translation as prtr"; $query .= " FROM #__fst_ticket_ticket as t "; $query .= " LEFT JOIN #__users as u ON t.user_id = u.id "; $query .= " LEFT JOIN #__fst_prod as p ON t.prod_id = p.id "; $query .= " LEFT JOIN #__fst_ticket_dept as d ON t.ticket_dept_id = d.id "; $query .= " LEFT JOIN #__fst_ticket_cat as c ON t.ticket_cat_id = c.id "; $query .= " LEFT JOIN #__fst_ticket_status as s ON t.ticket_status_id = s.id "; $query .= " LEFT JOIN #__fst_ticket_pri as pr ON t.ticket_pri_id = pr.id "; $query .= " WHERE t.id = '" . FSTJ3Helper::getEscaped($db, $ticketid) . "' "; FST_Ticket_Helper::getAdminPermissions(); $query .= FST_Ticket_Helper::$_perm_where; //echo $query . "<br>"; $db->setQuery($query); $rows = $db->loadAssoc(); return $rows; }
function __construct($identifier, $itemid = -1, &$itemlist = null) { $this->uid = mt_rand(1000, 9999); if (JRequest::getVar('uid') > 0) { $this->uid = JRequest::getVar('uid'); } /*$this->use_comments = FST_Settings::get('announce_comments_allow'); if (!$this->use_comments) return;*/ $this->identifier = $identifier; $this->_permissions = FST_Ticket_Helper::getAdminPermissions(); $this->use_email = FST_Settings::get('commnents_use_email'); //FSJ_Settings::GetComponentSetting( fsj_get_com(), 'comments_email', 1 ); $this->use_website = FST_Settings::get('commnents_use_website'); //FSJ_Settings::GetComponentSetting( fsj_get_com(), 'comments_website', 1 ); $this->tmplpath = JPATH_SITE . DS . 'components' . DS . 'com_fst' . DS . 'tmpl' . DS . 'comments'; $this->dest_email = FST_Settings::get('email_on_comment'); $this->itemid = $itemid; $this->itemlist = $itemlist; $this->post = array(); $this->post['name'] = $this->GetName(); $this->post['email'] = ''; $this->post['website'] = ''; $this->post['body'] = ''; $this->post['created'] = 'now'; $this->post['ident'] = $identifier; $this->post['itemid'] = $itemid; $this->errors = array(); $this->errors['name'] = ''; $this->errors['email'] = ''; $this->errors['website'] = ''; $this->errors['body'] = ''; $this->errors['captcha'] = ''; $this->errors['itemid'] = ''; // text templates $this->add_a_comment = JText::_("ADD_A_COMMENT"); $this->post_comment = JText::_("POST_COMMENT"); $this->comments_hide_add = FST_Settings::get('comments_hide_add'); if (FST_Settings::get('comments_who_can_add') == "registered") { if ($this->_permissions['userid'] == 0) { $this->can_add = 0; } } $captcha = new FST_Captcha(); $this->captcha = $captcha->GetCaptcha(); // set up moderation $commod = FST_Settings::get('comments_moderate'); $this->moderate = 0; if ($commod == "all") { $this->moderate = 1; } elseif ($commod == "guests") { if ($this->_permissions['userid'] == 0) { $this->moderate = 1; } } elseif ($commod == "registered") { if ($this->_permissions['mod_kb'] == 0) { $this->moderate = 1; } } // determine template and if its custom or not $this->IncludeTemplates(); $this->template = "comments_general"; $this->template_type = 3; if (FST_Settings::get('comments_general_use_custom')) { $this->template_type = 2; } if ($this->handler) { $this->template = "comments_" . $this->handler->GetName(); $this->template_type = 3; if (FST_Settings::get('comments_' . $this->handler->GetName() . '_use_custom')) { $this->template_type = 2; } } //print_p($this); //exit; }