function out() { $current_user = JFactory::getUser()->id; $manager = FSS_Permission::auth("fss.ticket_admin.ooo", "com_fss.support_admin", JFactory::getUser()->id); $user_id = FSS_Input::getInt('user_id'); if (!$manager && $current_user != $user_id) { return $this->cancel(); } // update the current users setting $values = SupportUsers::getAllSettings($user_id); $values->out_of_office = 1; SupportUsers::updateUserSettings($values, $user_id); $assign = FSS_Input::getCmd('assign'); $handler = FSS_Input::getInt('handler'); $body = FSS_Input::getHTML('body'); if ($assign == "auto" || $assign == "handler") { $this->loadTicketList($user_id); foreach ($this->tickets->tickets as $ticket) { if ($assign == "auto") { $handler = FSS_Ticket_Helper::AssignHandler($ticket->prod_id, $ticket->ticket_dept_id, $ticket->ticket_cat_id, true); } if ($assign == "unassigned") { $handler = 0; } $ticket->assignHandler($handler); if ($body) { $ticket->addMessage($body, "", $user_id, TICKET_MESSAGE_PRIVATE); FSS_EMail::Admin_Forward($ticket, $ticket->title, $body); } } } JFactory::getApplication()->redirect(FSSRoute::_("index.php?option=com_fss&view=admin_support&layout=listhandlers", false)); }
static function HandleTasks($view) { $task = strtolower(FSS_Input::getCmd('task')); $task = str_replace("-", "_", $task); $bits = explode(".", $task); if (count($bits) != 2) { return false; } $task_class = preg_replace("/[^a-z0-9\\_]/", '', $bits[0]); $task_ident = preg_replace("/[^a-z0-9\\_]/", '', $bits[1]); $task_file = JPATH_SITE . DS . 'components' . DS . FSS_Input::getCmd('option') . DS . 'views' . DS . FSS_Input::getCmd('view') . DS . 'task.' . $task_class . '.php'; if (!file_exists($task_file)) { //echo "No file : $task_file<br>"; return false; } require_once $task_file; $task_class_name = "Task_" . $task_class; if (!class_exists($task_class_name)) { echo "No class : {$task_class}<br>"; return false; } $task_obj = new $task_class_name(); $task_obj->view = $view; return $task_obj->execute($task_ident); }
function display($tpl = NULL) { $action = FSS_Input::getCmd('action'); if ($action == "cancel") { $mainframe = JFactory::getApplication(); $link = FSSRoute::_('index.php?option=com_fss&view=admin_support', false); $mainframe->redirect($link); return; } if ($action == "save" || $action == "apply") { $all = array('per_page', 'group_products', 'group_departments', 'group_cats', 'group_group', 'group_pri', 'return_on_reply', 'return_on_close', 'reverse_order', 'reports_separator'); $values = array(); $values = SupportUsers::getAllSettings(); foreach ($all as $setting) { $new = FSS_Input::getString($setting, 0); $values->{$setting} = $new; } SupportUsers::updateUserSettings($values); if ($action == "save") { $link = FSSRoute::_('index.php?option=com_fss&view=admin_support', false); } else { $link = FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=settings', false); } $mainframe = JFactory::getApplication(); $mainframe->redirect($link, JText::_('SETTINGS_SAVED')); return; } $this->_display(); }
function display($tpl = null) { $type = FSS_Input::getCmd('type'); if ($type) { return parent::display($type); } parent::display(); }
public function onContentPrepare($context, &$row, &$params, $page = 0) { if (is_object($row)) { if (property_exists($row, "id")) { $context .= "." . $row->id; } } else { if (is_array($row)) { if (array_key_exists("id", $row)) { $context .= "." . $row['id']; } } } FSS_Glossary::$context = $context; $ignore = FSS_Settings::Get('glossary_ignore'); $option = FSS_Input::getCmd('option'); if (trim($ignore) != "") { $ignore = explode("\n", $ignore); foreach ($ignore as $ign) { $ign = trim($ign); if ($ign == "") { continue; } if (stripos($context, $ign) !== FALSE) { return true; } if ($option) { if (stripos($option, $ign) !== FALSE) { return true; } } } } // skip plugin on freestyle components if (strpos($context, "_fss") > 0) { return true; } // Don't run this plugin when the content is being indexed if (strpos($context, 'finder.indexer') > 0) { return true; } if (is_object($row)) { if (!empty($row->noglossary)) { // skip glossary plugin on fss content return true; } //$row->text .= "\n\n\n<div style='display:none;' id='fss_glossary_context'>$context</div>\n\n\n"; return $this->_glossary($row->text, $params); } else { if (is_array($row)) { //$row['text'] .= "\n\n\n<div style='display:none;' id='fss_glossary_context'>$context</div>\n\n\n"; return $this->_glossary($row['text'], $params); } } //$row .= "<div style='display:none;' id='fss_glossary_context'>$context</div>"; return $this->_glossary($row, $params); }
function parseRequest() { $this->prodid = FSS_Input::getInt('prodid'); $this->deptid = FSS_Input::getInt('deptid'); $this->catid = FSS_Input::getInt('catid'); $this->mode = FSS_Input::getInt('mode'); $def_open = FSS_Ticket_Helper::GetStatusID("def_open"); $this->status = FSS_Input::getCmd('status', $def_open); }
function display($tpl = NULL) { // view a ticket! $this->ticketid = FSS_Input::getInt('ticketid'); $document = JFactory::getDocument(); $document->addScript(JURI::root() . 'components/com_fss/assets/js/bootstrap/bootstrap-timepicker.min.js'); $this->ticket = new SupportTicket(); if (!$this->ticket->load($this->ticketid)) { if ($this->ticket->checkExist($this->ticketid)) { return $this->_display("noperm"); } else { return JError::raiseWarning(404, JText::_('Ticket not found')); } } if ($this->ticket->merged > 0 && FSS_Input::getInt('no_redirect') != '1') { JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $this->ticket->merged . "&Itemid=" . FSS_Input::getInt('Itemid'), false)); } $reverse = JRequest::getInt('sort', null); if ($reverse !== null) { if ($reverse) { // we want messages in opposite order to normal if (SupportUsers::getSetting("reverse_order")) { $reverse = true; } else { $reverse = false; } } else { // we want messages in normal order $reverse = null; } } $this->ticket->loadAll($reverse); $this->loadMerged(); $pathway = JFactory::getApplication()->getPathway(); $pathway->addItem(JText::_("SUPPORT"), FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $this->ticket_view)); $pathway->addItem(JText::_("VIEW_TICKET") . " : " . $this->ticket->reference . " - " . $this->ticket->title); $this->assignOnOpen(); $this->tryLock(); if ($this->ticket->admin_id > 0) { $this->adminuser = SupportUsers::getUser($this->ticket->admin_id); } $this->ticket_view = $this->ticket->ticket_status_id; $this->HandleRefresh(); if (FSS_Settings::get('time_tracking') == "auto") { $session = JFactory::getSession(); $session->set('ticket_' . $this->ticket->id . "_opened", time()); } FSS_Helper::IncludeModal(); FSS_Helper::AddSCEditor(); $this->HandleRefresh(); $this->print = FSS_Input::getCmd('print'); if ($this->print) { return $this->_display("print"); } $this->_display(); }
function Display($tpl = NULL) { if (!FSS_Permission::auth("core.edit", $this->getAsset()) && !FSS_Permission::auth("core.edit.own", $this->getAsset())) { return FSS_Admin_Helper::NoPerm(); } $this->Init(); $db = JFactory::getDBO(); $this->what = FSS_Input::getCmd('what', ''); $user = JFactory::getUser(); $userid = $user->get('id'); $this->viewurl = ""; $return = FSS_Input::getString('return', ''); if ($return == 1) { JRequest::setVar('return', $_SERVER['HTTP_REFERER']); } if ($this->what == "pick") { return $this->HandlePick(); } if ($this->what == "author") { return $this->HandleAuthor(); } if ($this->what == "publish" || $this->what == "unpublish") { return $this->HandlePublish(); } if ($this->what == "cancel") { $mainframe = JFactory::getApplication(); $link = FSSRoute::_('index.php?option=com_fss&view=admin_content&type=' . $this->id, false); $return = FSS_Input::getString('return', ''); if ($return && $return != 1) { $link = $return; } $mainframe->redirect($link); } if ($this->what == "save" || $this->what == "apply" || $this->what == "savenew") { return $this->Save(); } if ($this->what == "new") { return $this->Create(); } if ($this->what == "edit") { $this->item = $this->getSingle(); $this->viewurl = $this->getArtLink(); if (FSS_Permission::auth("core.edit", $this->getAsset())) { $this->authorselect = $this->AuthorSelect($this->item); } FSS_Helper::IncludeModal(); $this->Output("form"); return; } $this->GetListFilter(); $this->data = $this->getList(); $this->Output("list"); }
function display($tpl = NULL) { $preview = FSS_Input::getCmd('preview'); if ($preview) { return $this->showPreview($preview); } FSS_Helper::IncludeModal(); $this->state = FSS_Input::getCmd('state'); $this->ticket_view = ""; $this->getLimits(); $this->pending = $this->loadPending(); $this->_display(); }
function &getAnnounces() { if (empty($this->_data)) { $query = $this->_buildQuery(); if (FSS_Input::getCmd('feed') == "rss") { $this->_db->setQuery($query, 0, 20); } else { $this->_db->setQuery($query, $this->getState('limitstart'), $this->getState('limit')); } $this->_data = $this->_db->loadAssocList(); } return $this->_data; }
function display($tpl = null) { $this->layout = FSS_Input::getCmd('layout', FSS_Input::getCmd('_layout', '')); $this->view = FSS_Input::getCmd('view', FSS_Input::getCmd('_view', '')); if (!FSS_Permission::PermAnyContent()) { return FSS_Admin_Helper::NoPerm(); } $this->type = FSS_Input::getCmd('type', ''); if ($this->type != "") { return $this->displayType(); } $this->artcounts = FSS_ContentEdit::getArticleCounts(); parent::display(); }
function process() { $posted = JRequest::get('post'); $ticket_ids = array(); foreach ($posted as $var => $value) { if (substr($var, 0, 7) == "ticket_") { $ticket_id = (int) substr($var, 7); if ($ticket_id > 0) { $ticket_ids[$ticket_id] = $ticket_id; } } } if (count($ticket_ids) == 0) { return; } $db = JFactory::getDBO(); $tickets = array(); foreach ($ticket_ids as $ticketid) { $ticket = new SupportTicket(); if ($ticket->Load($ticketid)) { $ticket->is_batch = true; $tickets[$ticketid] = $ticket; } else { unset($ticket_ids[$ticket_id]); } } $new_pri = FSS_Input::getInt('batch_priority'); if ($new_pri > 0) { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->updatePriority($new_pri); } } $new_status = FSS_Input::getInt('batch_status'); if ($new_status > 0) { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->updateStatus($new_status); } } if (FSS_Input::getString('batch_handler') != "") { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->assignHandler(FSS_Input::getInt('batch_handler')); } } $should_delete = FSS_Input::getCmd('batch_status'); if ($should_delete == "delete") { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->delete(); } } }
function display($tpl = null) { $layout = FSS_Input::getCmd('layout'); if ($layout == "support") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_support', false)); } if ($layout == "content") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_content', false)); } if ($layout == "moderate") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_moderate', false)); } if ($layout == "shortcut") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_shortcut', false)); } $can_view = false; $view = array(); if (FSS_Permission::PermAnyContent()) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_content', false); $can_view = true; } if (FSS_Permission::AdminGroups()) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_groups', false); $can_view = true; } if (FSS_Permission::auth("fss.reports", "com_fss.reports")) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_report', false); $can_view = true; } if (FSS_Permission::auth("fss.handler", "com_fss.support_admin")) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_support', false); $can_view = true; } if (FSS_Permission::CanModerate()) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_moderate', false); $can_view = true; } if (!$can_view) { return FSS_Admin_Helper::NoPerm(); } // if only 1 section visible, then view that section only if (count($view) == 1) { $mainframe = JFactory::getApplication(); $link = reset($view); $mainframe->redirect($link); } $this->comments = new FSS_Comments(null, null); $this->artcounts = FSS_ContentEdit::getArticleCounts(); parent::display(); }
function display($tpl = NULL) { $this->ticket_ids = FSS_Input::getString("ticketids"); $this->ticket_ids = explode(":", trim($this->ticket_ids)); $this->tickets = array(); foreach ($this->ticket_ids as $ticketid) { $ticket = new SupportTicket(); if ($ticket->load($ticketid)) { $ticket->loadAll(); $this->tickets[] = $ticket; } } $this->print = FSS_Input::getCmd('print'); $this->_display(); }
function display($tpl = null) { $sc = FSS_Input::getCmd('shortcut'); $status = FSS_Input::getCmd('status'); $link = "index.php?option=com_fss&view=admin"; switch ($sc) { case "create.registered": $link = "index.php?option=com_fss&view=admin_support&layout=new&type=registered"; break; case "create.unregistered": $link = "index.php?option=com_fss&view=admin_support&layout=new&type=unregistered"; break; // Lookup status from advanced tab for these! // Lookup status from advanced tab for these! case "tickets.mine": $link = "index.php?option=com_fss&view=admin_support&tickets=-1&what=search&searchtype=advanced&showbasic=1&handler=-1&status={$status}"; break; case "tickets.other": $link = "index.php?option=com_fss&view=admin_support&tickets=-1&what=search&searchtype=advanced&showbasic=1&handler=-2&status={$status}"; break; case "tickets.unassigned": $link = "index.php?option=com_fss&view=admin_support&tickets=-1&what=search&searchtype=advanced&showbasic=1&handler=-3&status={$status}"; break; case "tickets.status": $link = "index.php?option=com_fss&view=admin_support&tickets={$status}"; break; case "myadminsettings": $link = "index.php?option=com_fss&view=admin_support&layout=settings"; break; case "content.announcements": $link = "index.php?option=com_fss&view=admin_content&type=announce"; break; case "content.faqs": $link = "index.php?option=com_fss&view=admin_content&type=faqs"; break; case "content.kb": $link = "index.php?option=com_fss&view=admin_content&type=kb"; break; case "content.glossary": $link = "index.php?option=com_fss&view=admin_content&type=glossary"; break; } $link = FSSRoute::_($link, false); //$link = JRoute::_($link, false); $mainframe = JFactory::getApplication(); $mainframe->redirect($link); }
function display($tpl = NULL) { $type = FSS_Input::getCmd('type'); $session = JFactory::getSession(); $session->clear('admin_create'); $session->clear('admin_create_user_id'); $session->clear('ticket_email'); $session->clear('ticket_name'); $session->clear('ticket_reference'); if ($type == "registered") { return $this->displayRegistered(); } if ($type == "unregistered") { return $this->displayUnRegistered(); } $this->_display(); }
function init() { $user = JFactory::getUser(); $this->userid = $user->get('id'); $this->model = $this->getModel("admin_support"); if (!FSS_Permission::auth("fss.handler", "com_fss.support_admin")) { return FSS_Admin_Helper::NoPerm(); } $this->def_open = FSS_Ticket_Helper::GetStatusID('def_open'); $this->ticket_view = FSS_Input::getCmd('tickets', $this->def_open); $this->count = SupportTickets::getTicketCount(); FSS_Helper::StylesAndJS(array('calendar', 'base64')); if (Task_Helper::HandleTasks($this)) { return false; } return true; }
function display($tpl = null) { $fileid = FSS_Input::getInt('fileid'); $key = FSS_Input::getCmd('key'); $decoded = FSS_Helper::decrypt(FSS_Helper::base64url_decode($key), FSS_Helper::getEncKey("file")); if ($fileid != $decoded) { exit; } $db = JFactory::getDBO(); $sql = "SELECT * FROM #__fss_ticket_attach WHERE id = " . $fileid; $db->setQuery($sql); $attach = $db->loadObject(); $image = in_array(strtolower(pathinfo($attach->filename, PATHINFO_EXTENSION)), array('jpg', 'jpeg', 'png', 'gif')); $image_file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "support" . DS . $attach->diskfile; require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'files.php'; FSS_File_Helper::OutputImage($image_file, pathinfo($attach->filename, PATHINFO_EXTENSION)); }
static function NoPerm() { if (array_key_exists('REQUEST_URI', $_SERVER)) { $url = $_SERVER['REQUEST_URI']; //JURI::current() . "?" . $_SERVER['QUERY_STRING']; } else { $option = FSS_Input::getCmd('option', ''); $view = FSS_Input::getCmd('view', ''); $layout = FSS_Input::getCmd('layout', ''); $Itemid = FSS_Input::getInt('Itemid', 0); $url = FSSRoute::_("index.php?option=" . $option . "&view=" . $view . "&layout=" . $layout . "&Itemid=" . $Itemid); } $url = str_replace("&what=find", "", $url); $url = base64_encode($url); $return = $url; require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'views' . DS . 'admin' . DS . 'tmpl' . DS . 'noperm.php'; return false; }
function display($tpl = null) { if (FSS_Settings::Get('support_only_admin_open')) { return $this->noPermission("Access Denied", "CREATING_NEW_TICKETS_BY_USERS_IS_CURRENTLY_DISABLED"); } if (!FSS_Permission::auth("fss.ticket.open", "com_fss.support_user")) { return FSS_Helper::NoPerm(); } $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $userid = $user->get('id'); $this->assign('userid', $userid); $this->assign('email', ''); // defaults for blank ticket $this->ticket = new stdClass(); $this->ticket->prodid = FSS_Input::getInt('prodid'); $this->ticket->deptid = FSS_Input::getInt('deptid'); $this->ticket->catid = FSS_Input::getInt('catid'); $this->ticket->priid = FSS_Input::getInt('priid'); $this->ticket->subject = FSS_Input::getString('subject'); $this->ticket->body = FSS_Input::getBBCode('body'); $this->errors['subject'] = ''; $this->errors['body'] = ''; $this->errors['cat'] = ''; $what = FSS_Input::getCmd('what'); // done with ticket, try and save, if not, display any errors if ($what == "add") { if ($this->saveTicket()) { echo "Saved OK!"; exit; $link = 'index.php?option=com_fss&view=ticket&layout=view&Itemid=' . FSS_Input::getInt('Itemid') . '&ticketid=' . $this->ticketid; $mainframe->redirect($link); return; } } $this->product = $this->get('Product'); $this->dept = $this->get('Department'); $this->cats = SupportHelper::getCategories(); $this->pris = SupportHelper::getPriorities(); $this->support_user_attach = FSS_Settings::get('support_user_attach'); $this->fields = FSSCF::GetCustomFields(0, $prodid, $deptid); parent::display(); }
function getTabs() { $db = JFactory::getDBO(); if (!self::$tab_result) { $qry = "SELECT count(*) as cnt FROM #__fss_ticket_ticket WHERE source = 'email'"; $db->setQuery($qry); $cnt = $db->loadObject(); if ($cnt->cnt > 0 || FSS_Input::getCmd('layout') == "emails") { $tab = new Ticket_Source_Data(); $tab->tabname = JText::sprintf("SUP_SRC_EMAILS", $cnt->cnt); $tab->name = JText::_("SUP_SRC_EMAIL"); $tab->count = $cnt->cnt; $tab->link = "index.php?option=com_fss&view=admin_support&layout=emails"; if (FSS_Input::getCmd('layout') == "emails") { $tab->active = true; } self::$tab_result = array($tab); } else { self::$tab_result = array(); } } return self::$tab_result; }
function delete() { // load in tickets to do $ticketid = FSS_Input::getInt('ticketid'); $tickets = FSS_Input::getCmd('tickets'); $def_archive = FSS_Ticket_Helper::GetStatusID('def_archive'); if ($ticketid > 0) { $ticket = new SupportTicket(); if ($ticket->load($ticketid)) { $ticket->delete(); } } else { if ($tickets != '') { $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 100; $tickets->loadTicketsByStatus($tickets); foreach ($tickets->tickets as $ticket) { $ticket->delete(); } } } JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER']); }
$grp_open = 1; } ?> <?php $this->listRow($ticket); ?> <?php } ?> </table></div> <?php $curstatus = FSS_Input::getCmd('tickets'); if ($curstatus == -1) { $curstatus = FSS_Input::getCmd('status'); } ?> <div id="batch_form" class="form-horizontal form-condensed" style='display: none'> <div class="batch_print_hide"> <?php echo FSS_Helper::PageSubTitle("BATCH_ACTIONS"); ?> </div> <div class="batch_action_hide"> <?php echo FSS_Helper::PageSubTitle("BATCH_PRINT"); ?> </div>
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ defined('_JEXEC') or die; ?> <?php echo FSS_Helper::PageStyle(); if (FSS_Input::getCmd('type') != "bare") { ?> <?php echo FSS_Helper::PageTitle("Reports", $this->report->title); } ?> <?php if (FSS_Input::getCmd('type') == "") { ?> <div class="well well-small form-horizontal form-condensed"> <?php echo $this->report->listFilterValues(); ?> </div> <?php } ?> <?php include $this->snippet(JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'views' . DS . 'admin_report' . DS . 'snippet' . DS . '_report_table.php'); ?> <?php
function dropdown() { echo SupportCanned::CannedDropdown(FSS_Input::getCmd('elem'), false); exit; }
function SaveSettings() { return $this->encodeParams(array('field' => FSS_Input::getCmd('profile_field'), 'custom' => JRequest::getVar('profile_custom', '', 'post', 'string', JREQUEST_ALLOWRAW))); }
<?php /** * @package Freestyle Joomla * @author Freestyle Joomla * @copyright (C) 2013 Freestyle Joomla * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ defined('_JEXEC') or die; if (empty($this->view)) { $this->view = FSS_Input::getCmd('view'); } if (empty($this->layout)) { $this->layout = FSS_Input::getCmd('layout'); } ?> <ul class="nav nav-tabs"> <?php if (FSS_Permission::auth("fss.handler", "com_fss.support_admin") || FSS_Permission::PermAnyContent()) { ?> <li class="<?php if ($this->view == "admin") { echo "active"; } ?> "> <a href='<?php echo FSSRoute::_('index.php?option=com_fss&view=admin'); ?>
function display($tpl = NULL) { parent::init(); $this->plugins = $this->load_plugins(); $this->mode = FSS_Input::getcmd('mode', 'pick'); $this->usergroup = FSS_Input::getInt('usergroup'); foreach ($this->plugins as $plugin) { $plugin->mode = $this->mode; } $limitstart = FSS_Input::getInt('limitstart'); $mainframe = JFactory::getApplication(); $limit = $mainframe->getUserStateFromRequest('users.limit', 'limit', 10, 'int'); $search = FSS_Input::getString('search'); $this->lists = array(); $this->lists['order_Dir'] = FSS_Input::getCmd('filter_order_Dir'); $this->lists['order'] = FSS_Input::getCmd('filter_order'); $ticket_has_groups = false; // load in ticket if there is one $this->ticketid = FSS_Input::getInt("ticketid"); if ($this->mode == "user" || $this->mode == "admin") { $this->ticket = new SupportTicket(); $this->ticket->load($this->ticketid); $this->ticket->loadCC(); $this->ticket->loadGroups(); if (count($this->ticket->groups) > 0) { $ticket_has_groups = true; } } // ticket group, default to t if we are in user or admin mode $this->ticketgroup = null; if ($ticket_has_groups && $this->mode == "user") { $this->ticketgroup = "t"; } $this->ticketgroup = FSS_Input::getcmd('ticketgroup', $this->ticketgroup); $db = JFactory::getDBO(); $qry = "SELECT * FROM #__users "; $where = array(); if ($search != "") { $search_parts = array(); $search_parts[] = "username LIKE '%" . $db->escape($search) . "%'"; $search_parts[] = "name LIKE '%" . $db->escape($search) . "%'"; $search_parts[] = "email LIKE '%" . $db->escape($search) . "%'"; $this->searchFields($search_parts); foreach ($this->plugins as $plugin) { $ids = $plugin->search($search); if (count($ids) > 0) { $search_parts[] = "id IN ('" . implode("', '", $ids) . "')"; } } $where[] = "( " . implode(" OR ", $search_parts) . " )"; } // filter by usergroup if ($this->usergroup > 0) { $where[] = "id IN (SELECT user_id FROM #__user_usergroup_map WHERE group_id = " . $db->escape($this->usergroup) . ")"; } // filter by ticket group if ($this->ticketgroup == "t") { $group_ids = array(); $group_ids[] = 0; foreach ($this->ticket->groups as $group) { $group_ids[] = $group->id; } $where[] = "id IN (SELECT user_id FROM #__fss_ticket_group_members WHERE group_id IN (" . implode(", ", $group_ids) . "))"; } elseif ($this->ticketgroup > 0) { $where[] = "id IN (SELECT user_id FROM #__fss_ticket_group_members WHERE group_id = " . $db->escape($this->ticketgroup) . ")"; } if ($this->mode == "admin") { $handlers = SupportUsers::getHandlers(false, false); $ids = array(); $ids[] = 0; foreach ($handlers as $handler) { $ids[] = $handler->id; } $where[] = "id IN (" . implode(", ", $ids) . ")"; } // add where if (count($where) > 0) { $qry .= " WHERE " . implode(" AND ", $where); } $order = FSS_Input::getCmd('filter_order'); $dir = FSS_Input::getCmd('filter_order_Dir', 'asc'); if ($order == "username" || $order == "name" || $order == "email") { // Sort ordering $qry .= " ORDER BY {$order} {$dir} "; } else { $qry .= " ORDER BY name "; } //echo $qry . "<br>"; // get max items $db->setQuery($qry); $db->query(); $maxitems = $db->getNumRows(); // select picked items $db->setQuery($qry, $limitstart, $limit); $this->users = $db->loadObjectList(); //print_p(reset($this->users)); // build pagination $this->pagination = new JPaginationEx($maxitems, $limitstart, $limit); $this->search = $search; if ($this->mode != "admin") { // load in joomla user groups $qry = "SELECT * FROM #__usergroups ORDER BY lft"; $db->setQuery($qry); $this->groups = $db->loadObjectList(); $group_index = array(); foreach ($this->groups as &$group) { $group_index[$group->id] =& $group; if ($group->parent_id == 0) { $group->level = 0; } else { $group->level = $group_index[$group->parent_id]->level + 1; } $group->display = str_repeat("- ", $group->level) . $group->title; } array_unshift($this->groups, JHTML::_('select.option', '', JText::_("JOOMLA_USERGROUP"), 'id', 'display')); $this->jgroup_select = JHTML::_('select.genericlist', $this->groups, 'usergroup', 'class="inputbox" size="1" onchange="document.fssForm.submit( );"', 'id', 'display', $this->usergroup); // load ticket groups $qry = "SELECT * FROM #__fss_ticket_group ORDER BY groupname"; $db->setQuery($qry); $this->ticketgroups = $db->loadObjectList(); if ($this->ticketid > 0 && $ticket_has_groups) { array_unshift($this->ticketgroups, JHTML::_('select.option', 't', JText::_("CURRENT_TICKET"), 'id', 'groupname')); } array_unshift($this->ticketgroups, JHTML::_('select.option', '', JText::_("ALL_TICKET_GROUPS"), 'id', 'groupname')); $this->ticketgroup_select = JHTML::_('select.genericlist', $this->ticketgroups, 'ticketgroup', 'class="inputbox" size="1" onchange="document.fssForm.submit( );"', 'id', 'groupname', $this->ticketgroup); } $this->_display(); }
function OutputTable() { if (!$this->xml) { return; } ?> <p> <div class="pull-right"> <?php foreach ($this->xml->filters->filter as $filter) { $type = (string) $filter->attributes()->type; $field = (string) $filter->attributes()->field; $filter_id = (string) $filter->attributes()->id; $var = "filter_" . $filter_id; $value = $this->{$var}; if ($type == "lookup") { $key = (string) $filter->key; $display = (string) $filter->display; echo "<select name='filter_{$filter_id}' id='filter_{$filter_id}' onchange='jQuery(\"#fssForm\").submit()'>"; $db = JFactory::getDBO(); $db->setQuery($filter->sql); $items = $db->loadAssocList(); echo "<option value=''>" . (string) $filter->heading . "</option>"; foreach ($items as $item) { $selected = ""; if ($item[$key] == $value) { $selected = "selected='selected'"; } echo "<option value='" . $item[$key] . "' {$selected}>" . $item[$display] . "</option>"; } echo "</select>"; } } // output header ?> </div> <div class='input-append'> <input name='search' id="search" type='text' value="<?php echo htmlentities($this->search, ENT_QUOTES, "utf-8"); ?> " class="input-medium" placeholder="Search" /> <button class='btn btn-primary'>Go</button> <button" class='btn btn-default' onclick="resetForm();">Reset</button> </div> </p> <table class="table table-bordered table-condensed table-striped"> <thead> <tr> <th width="5">#</th> <?php foreach ($this->xml->displayfields->field as $field) { ?> <th><?php echo JHTML::_('grid.sort', $field->attributes()->id, $field->attributes()->sort, $this->orderdir, $this->order); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php $displayfield = (string) $this->xml->displayfield; $k = 0; for ($i = 0, $n = count($this->data); $i < $n; $i++) { $row = $this->data[$i]; ?> <tr class="<?php echo "row{$k}"; ?> "> <td> <?php echo $row->id; ?> </td> <?php foreach ($this->xml->displayfields->field as $field) { ?> <td> <?php if ($field->attributes()->link) { $link = (string) $this->xml->link; $keyfield = (string) $this->xml->keyfield; $link = FSSRoute::x(str_replace("%ID%", $row->{$keyfield}, $link), false); $link = JURI::base() . substr($link, strlen(JURI::base(true)) + 1); echo "<a href='{$link}' class='pick_link' id='pick_{$row->id}'>"; } $field_name = (string) $field->attributes()->name; if ((string) $field->attributes()->type == "yesno") { echo FSJ_Helper::GetYesNoText($row->{$field_name}); } else { echo $row->{$field_name}; } if ($field->attributes()->link) { echo "</a>"; } ?> </td> <?php } ?> <td id="title_<?php echo $row->id; ?> " style='display:none'><?php echo $row->{$displayfield}; ?> </td> </tr> <?php $k = 1 - $k; } ?> </tbody> </table> <?php echo $this->pagination->getListFooter(); ?> <input type="hidden" name="filter_order" id="filter_order" value="<?php echo $this->order; ?> " /> <input type="hidden" name="filter_order_Dir" id="filter_order_Dir" value="<?php echo $this->orderdir; ?> " /> <input type="hidden" name="boxchecked" id='boxchecked' value="0" /> <input type="hidden" name="type" id="type" value="<?php echo $this->type; ?> " /> <input type="hidden" name="editor" id="editor" value="<?php echo $this->editor; ?> " /> <input type="hidden" name="option" value="com_fss" /> <input type="hidden" name="view" value="admin_insert" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="tmpl" value="component" /> <script> function resetForm() { jQuery('#search').val(""); <?php foreach ($this->xml->filters->filter as $filter) { $type = (string) $filter->attributes()->type; $field = (string) $filter->attributes()->field; $filter_id = (string) $filter->attributes()->id; ?> jQuery('#filter_<?php echo $filter_id; ?> ').val(""); <?php } ?> jQuery('#fssForm').submit(); } function tableOrdering(field, order) { jQuery('#order').val(field); jQuery('#orderdir').val(order); jQuery('#pickRelForm').submit(); } jQuery(document).ready(function () { jQuery('.pick_link').click(function (ev) { ev.preventDefault(); var url = jQuery(this).attr('href'); var title = jQuery(this).text(); window.parent.insertLink(url, title, '<?php echo FSS_Input::getCmd('editor'); ?> '); }); }); </script> <?php }
static function forAdmin(&$parser, $ticket = null, $custom_fields = null) { $parser->Clear(); self::core($parser, $ticket, $custom_fields); if ($ticket) { $title = $ticket->getTitle(); $parser->SetVar('link', FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticket->id)); $parser->SetVar('checkbox', "<input type='checkbox' class='ticket_cb' style='display: none' id='ticket_cb_{$ticket->id}' name='ticket_{$ticket->id}'>"); $parser->SetVar('subject', "<input type='checkbox' class='ticket_cb' style='display: none' id='ticket_cb_{$ticket->id}' name='ticket_{$ticket->id}'><a href='" . FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticket->id) . "'>" . $title . "</a>"); $parser->SetVar('subject_text', $title); $cotime = FSS_Helper::GetDBTime() - strtotime($ticket->checked_out_time); if ($cotime < FSS_Settings::get('support_lock_time') && $ticket->checked_out != JFactory::getUser()->id && $ticket->checked_out > 0) { $html = "<div>" . $ticket->co_user->name . " (" . $ticket->co_user->email . ")</div>"; $parser->SetVar('lock', "<img class='fssTip' title='<b>Ticket locked</b><br />" . htmlentities($html, ENT_QUOTES, "utf-8") . "' src='" . JURI::root(true) . "/components/com_fss/assets/images/lock.png'>"); } if (!FSS_Settings::get('support_hide_tags')) { if (isset($ticket->tags) && count($ticket->tags) > 0) { $html = ""; foreach ($ticket->tags as $tag) { $html .= "<div>" . $tag . "</div>"; } $parser->SetVar('tags', "<img class='fssTip' title='" . htmlentities($html, ENT_QUOTES, "utf-8") . "' src='" . JURI::root(true) . "/components/com_fss/assets/images/tag.png'>"); } } if (isset($ticket->attach) && count($ticket->attach) > 0) { $html = ""; foreach ($ticket->attach as $attach) { $html .= "<div>" . $attach->filename . " (" . FSS_Helper::display_filesize($attach->size) . ")</div>"; } $parser->SetVar('attach', "<img class='fssTip' title='" . htmlentities($html, ENT_QUOTES, "utf-8") . "' src='" . JURI::root(true) . "/components/com_fss/assets/images/attach.png'>"); } $parser->SetVar('icons', ''); if (FSS_Settings::get('support_show_msg_counts')) { $parser->SetVar("msgcount_total", $ticket->msgcount['total']); $parser->SetVar("msgcount_user", $ticket->msgcount['0']); $parser->SetVar("msgcount_handler", $ticket->msgcount['1']); $parser->SetVar("msgcount_private", $ticket->msgcount['2']); $parser->SetVar("msgcount_draft", $ticket->msgcount['4']); $tip = "<strong>" . $ticket->msgcount['total'] . " " . JText::_('MESSAGES') . ":</strong><br>"; if ($ticket->msgcount['0'] > 0) { $tip .= $ticket->msgcount['0'] . " " . JText::_('USER') . "<br>"; } if ($ticket->msgcount['1'] > 0) { $tip .= $ticket->msgcount['1'] . " " . JText::_('HANDLER') . "<br>"; } if ($ticket->msgcount['2'] > 0) { $tip .= $ticket->msgcount['2'] . " " . JText::_('PRIVATE') . "<br>"; } if ($ticket->msgcount['4'] > 0) { $tip .= $ticket->msgcount['4'] . " " . JText::_('DRAFT') . "<br>"; } $parser->SetVar('msgcnt', "<span class='fssTip label label-default' title='" . htmlentities($tip, ENT_QUOTES, "utf-8") . "'>" . $ticket->msgcount['total'] . "</span>"); } $parser->SetVar("source", $ticket->source); $delete = "<a class='pull-right btn btn-default btn-mini' href='" . FSSRoute::_('index.php?option=com_fss&view=admin_support&task=archive.delete&tickets=' . FSS_Input::getCmd('tickets') . '&ticketid=' . $ticket->id) . "'>"; $delete .= JText::_("DELETE") . "</a>"; $parser->SetVar('deletebutton', $delete); $archive = "<a class='pull-right btn btn-default btn-mini' href='" . FSSRoute::_('index.php?option=com_fss&view=admin_support&task=archive.archive&tickets=' . FSS_Input::getCmd('tickets') . '&ticketid=' . $ticket->id) . "'>"; $archive .= JText::_("ARCHIVE") . "</a>"; $parser->SetVar('archivebutton', $archive); $handler_highlight = '<span class="fssTip label label-warning pull-right" title="' . JText::_('UNASSIGNED_TICKET') . '">' . $parser->GetVar('handlername') . '</span>'; if ($ticket->admin_id == JFactory::getUser()->id) { $handler_highlight = '<span class="fssTip label label-success pull-right" title="' . JText::_('MY_TICKET') . '">' . $parser->GetVar('handlername') . '</span>'; } else { if ($ticket->admin_id > 0) { $handler_highlight = '<span class="fssTip label label-info pull-right" title="' . JText::_('OTHER_HANDLERS_TICKET') . '">' . $parser->GetVar('handlername') . '</span>'; } } $parser->SetVar('handler_tag', $handler_highlight); $style = ""; //$trhl = " onmouseover='highlightticket({$ticket->id})' onmouseout='unhighlightticket({$ticket->id})' "; $trhl = " "; // no longer highlighting tickets! $priority = $ticket->getPriority(); if ($priority->backcolor) { $style .= "background-color: {$priority->backcolor};"; } if (FSS_Settings::get('support_entire_row')) { $style .= "cursor: pointer;"; $trhl .= " onclick='window.location=\"" . FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticket->id) . "\"' "; } $trhl .= " style='{$style}' "; $parser->SetVar('trhl', $trhl); $parser->SetVar('class', static::$rowclass . " ticket_{$ticket->id}"); if (static::$rowclass == "odd") { static::$rowclass = "even"; } else { static::$rowclass = "odd"; } } $parser->SetVar("hidehandler", FSS_Settings::get('support_hide_handler') == 1); $parser->SetVar("candelete", FSS_Settings::get('support_delete')); }