Esempio n. 1
0
 static function loadUser($userid)
 {
     if (empty(self::$user_perms[$userid])) {
         $user_data = SupportUsers::getUser($userid);
         if (!$user_data) {
             $perms = new stdClass();
         } else {
             $perms = $user_data->rules;
         }
         if (!is_object($perms)) {
             $perms = new stdClass();
         }
         if (!property_exists($perms, "support_admin")) {
             $perms->support_admin = new stdClass();
         }
         self::mergeSet($perms, "support_admin", "support_admin_misc");
         self::mergeSet($perms, "support_admin", "support_admin_ticket");
         self::mergeSet($perms, "support_admin", "support_admin_ticket_cc");
         self::mergeSet($perms, "support_admin", "support_admin_ticket_other");
         self::mergeSet($perms, "support_admin", "support_admin_ticket_una");
         self::mergeSet($perms, "support_admin", "view_products");
         self::mergeSet($perms, "support_admin", "view_departments");
         self::mergeSet($perms, "support_admin", "view_categories");
         self::mergeSet($perms, "support_admin", "assign_products");
         self::mergeSet($perms, "support_admin", "assign_departments");
         self::mergeSet($perms, "support_admin", "assign_categories");
         self::$user_perms[$userid] = $perms;
     }
     return self::$user_perms[$userid];
 }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 function setdefault()
 {
     $sigid = FSS_Input::getInt('sigid');
     SupportUsers::updateSingleSetting("default_sig", $sigid);
     $mainframe = JFactory::getApplication();
     $link = JRoute::_('index.php?option=com_fss&view=admin_support&layout=signature&tmpl=component', false);
     $mainframe->redirect($link);
 }
Esempio n. 4
0
 function getLimits()
 {
     $mainframe = JFactory::getApplication();
     $limit = $mainframe->getUserStateFromRequest('global.list.limit_ticket', 'limit', SupportUsers::getSetting('per_page'), 'int');
     $limitstart = FSS_Input::getInt('limitstart');
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->limit = $limit;
     $this->limitstart = $limitstart;
 }
Esempio n. 5
0
 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 loadHandlerDetails()
 {
     $this->handler_details = array();
     foreach ($this->handlers as $handler_id) {
         $handler = SupportUsers::getHandler($handler_id, false, false);
         $handler->open_tickets = 0;
         $handler->status_count = 0;
         if ($handler) {
             $this->handler_details[] = $handler;
         }
     }
 }
Esempio n. 7
0
 function in()
 {
     $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 = 0;
     SupportUsers::updateUserSettings($values, $user_id);
     JFactory::getApplication()->redirect(FSSRoute::_("index.php?option=com_fss&view=admin_support&layout=listhandlers", false));
 }
Esempio n. 8
0
 function ticket_status_id()
 {
     // update status in ticket
     // redirect if the config is set to
     $ticketid = FSS_Input::getInt('ticketid');
     $ticket_status_id = FSS_Input::getInt('ticket_status_id');
     if ($ticketid < 1) {
         exit;
     }
     if ($ticket_status_id < 1) {
         exit;
     }
     $link = FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticketid, false);
     // check permission for new status
     $statuss = SupportHelper::getStatuss();
     $new_status = $statuss[$ticket_status_id];
     if ($new_status->is_closed && !$this->view->can_Close()) {
         JFactory::getApplication()->redirect($link);
         exit;
     }
     $ticket = new SupportTicket();
     if ($ticket->Load($ticketid)) {
         $old_st = $ticket->getStatus();
         $ticket->updateStatus($ticket_status_id);
         $new_st = $ticket->getStatus();
         // if we have closed the ticket, and return on close is set, then we should do a redirect dependant on the setting
         if ($new_st->is_closed && SupportUsers::getSetting("return_on_close")) {
             $link = SupportHelper::parseRedirectType($old_st->id, SupportUsers::getSetting("return_on_close"));
         }
         if ($new_st->is_closed && !$old_st->is_closed) {
             // SEND CLOSED EMAIL HERE!
             if (!FSS_Settings::get('support_email_on_close_no_dropdown')) {
                 FSS_EMail::Admin_Close($ticket, $ticket->title, '', array());
             }
         }
     }
     JFactory::getApplication()->redirect($link);
     exit;
 }
Esempio n. 9
0
 static function AssignHandler($prodid, $deptid, $catid, $force = false)
 {
     //echo "Assigning hander for $prodid, $deptid, $catid<br>";
     $admin_id = 0;
     $assignuser = FSS_Settings::get('support_autoassign');
     if ($assignuser == 1 || $force) {
         $okusers = SupportUsers::getHandlersTicket($prodid, $deptid, $catid);
         if (count($okusers) > 0) {
             $count = count($okusers);
             $picked = mt_rand(0, $count - 1);
             $admin_id = $okusers[$picked];
         } else {
             // no users found
             $fallback = FSS_Settings::get('support_handler_fallback');
             if ($fallback != "" && $fallback > 0) {
                 $user = JFactory::getUser($fallback);
                 if ($user) {
                     $admin_id = $user->id;
                 }
             }
         }
     }
     return $admin_id;
 }
Esempio n. 10
0
<?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;
$def_sig = SupportUsers::getSetting("default_sig");
?>
<select name="signature" id="signature">
	<optgroup label="<?php 
echo JText::_('Signatures');
?>
:">
		<?php 
foreach (SupportCanned::GetAllSigs(null) as $sig) {
    ?>
			<?php 
    if ($sig_txt == "") {
        $sig_txt = $sig->content;
    }
    ?>
			<option value="<?php 
    echo $sig->id;
    ?>
" 
				<?php 
    if ($sig->id == $def_sig) {
        echo "selected";
Esempio n. 11
0
 function HandleAuthor()
 {
     $db = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     if (!FSS_Permission::auth("core.edit.state", $this->getAsset())) {
         exit;
     }
     $asset = $this->getAsset();
     $users = SupportUsers::usersWithPerm($asset, "core.edit.own");
     $users2 = SupportUsers::usersWithPerm($asset, "core.edit");
     $uids = array();
     foreach ($users as $uid => $user) {
         $uids[$uid] = (int) $uid;
     }
     foreach ($users2 as $uid => $user) {
         $uids[$uid] = (int) $uid;
     }
     // build query
     $qry = "SELECT * FROM #__users";
     $where = array();
     $where[] = "id IN (" . implode(", ", $uids) . ")";
     $limitstart = FSS_Input::getInt('limitstart', 0);
     $mainframe = JFactory::getApplication();
     $limit = $mainframe->getUserStateFromRequest('users.limit', 'limit', 10, 'int');
     $search = FSS_Input::getString('search', '');
     $db = JFactory::getDBO();
     if ($search != "") {
         $where[] = "(username LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' OR name LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' OR email LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%')";
     }
     if (count($where) > 0) {
         $qry .= " WHERE " . implode(" AND ", $where);
     }
     // Sort ordering
     $qry .= " ORDER BY name ";
     // get max items
     //echo $qry."<br>";
     $db->setQuery($qry);
     $db->query();
     $maxitems = $db->getNumRows();
     // select picked items
     $db->setQuery($qry, $limitstart, $limit);
     $this->users = $db->loadObjectList();
     // build pagination
     $this->pagination = new JPaginationEx($maxitems, $limitstart, $limit);
     $this->search = $search;
     include $this->tmplpath . DS . "user.php";
 }
Esempio n. 12
0
 function doOpenTicket()
 {
     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->userid = $userid;
     $this->email = '';
     $this->admin_create = 0;
     $session = JFactory::getSession();
     if (FSS_Input::getInt('admincreate') > 0) {
         $session->Set("admin_create", FSS_Input::getInt('admincreate'));
         if ($session->Get("admin_create") == 1 && FSS_Input::getInt('user_id') > 0) {
             $session->Set('admin_create_user_id', FSS_Input::getInt('user_id'));
         } else {
             if ($session->Get("admin_create") == 2 && (FSS_Input::getString('admin_create_email') || FSS_Input::getString('admin_create_name'))) {
                 $session->Set('ticket_email', FSS_Input::getEMail('admin_create_email'));
                 $session->Set('ticket_name', FSS_Input::getString('admin_create_name'));
             }
         }
     }
     if ($session->Get("admin_create") == 1) {
         $this->admin_create = 1;
         $model = $this->getModel();
         $this->user = $model->getUser($session->Get('admin_create_user_id'));
     } else {
         if ($session->Get("admin_create") == 2) {
             $this->unreg_email = $session->Get('ticket_email');
             $this->unreg_name = $session->Get('ticket_name');
             $this->admin_create = 2;
         }
     }
     if (FSS_Settings::Get('support_only_admin_open') && $this->admin_create < 1) {
         return $this->noPermission("Access Denied", "CREATING_NEW_TICKETS_BY_USERS_IS_CURRENTLY_DISABLED");
     }
     // store in session and data for an unregistered ticket
     $type = FSS_Input::getCmd('type');
     if ($type == "without") {
         $email = FSS_Input::getEMail('email');
         $name = FSS_Input::getString('name');
         if ($name == "") {
             $name = $email;
         }
         if ($email != "") {
             $session->Set('ticket_email', $email);
             $session->Set('ticket_name', $name);
         }
     }
     if (!$this->ValidateUser('open')) {
         return;
     }
     // defaults for blank ticket
     $ticket['priid'] = FSS_Input::getInt('priid', FSS_Settings::get('support_default_priority'));
     $ticket['body'] = FSS_Input::GetString('body');
     $ticket['subject'] = FSS_Input::GetString('subject');
     $ticket['handler'] = FSS_Input::getInt('handler', 0);
     $this->ticket = $ticket;
     $errors['subject'] = '';
     $errors['body'] = '';
     $errors['cat'] = '';
     $errors['captcha'] = '';
     $this->errors = $errors;
     $prodid = FSS_Input::getInt('prodid');
     // prod id not set, should we display product list???
     if ($prodid < 1) {
         $this->products = $this->get('Products');
         if (count($this->products) > 1) {
             $this->search = "";
             $pagination = $this->get('ProdPagination');
             $this->pagination = $pagination;
             $this->limit = $this->get("ProdLimit");
             parent::display("product");
             return;
         } else {
             if (count($this->products) == 1) {
                 $prodid = $this->products[0]['id'];
                 JRequest::setVar('prodid', $prodid);
                 //echo "Setting prodid to $prodid<br>";
             }
         }
     }
     $this->assign('prodid', $prodid);
     $deptid = FSS_Input::getInt('deptid');
     // dept id not set, should we display department list?
     if ($deptid < 1) {
         $this->search = "";
         $this->depts = $this->get('Departments');
         $this->limit = $this->get("ProdLimit");
         if (count($this->depts) > 1) {
             $this->pagination = $this->get('DeptPagination');
             $this->product = $this->get('Product');
             parent::display("department");
             return;
         } else {
             if (count($this->depts) == 1) {
                 $deptid = $this->depts[0]['id'];
                 JRequest::setVar('deptid', $deptid);
                 //echo "Setting deptid to $deptid<br>";
             }
         }
     }
     $what = FSS_Input::getCmd('what');
     // done with ticket, try and save, if not, display any errors
     if ($what == "add") {
         if ($this->saveTicket()) {
             $message = FSS_Helper::HelpText("support_open_thanks", true);
             if ($message != "") {
                 FSS_Helper::enqueueMessage($message, "success");
             }
             //exit;
             if ($this->admin_create > 0) {
                 $link = 'index.php?option=com_fss&view=admin_support&Itemid=' . FSS_Input::getInt('Itemid', '') . '&ticketid=' . $this->ticketid;
                 $mainframe->redirect(FSSRoute::_($link, false));
             } else {
                 // need to set the session info that will display the ticket to the user here!
                 $link = 'index.php?option=com_fss&view=ticket&layout=view&Itemid=' . FSS_Input::getInt('Itemid', '') . '&ticketid=' . $this->ticketid;
                 $mainframe->redirect(FSSRoute::_($link, false));
             }
             return;
         } else {
             //echo "Error saving ticket<br>";
         }
     }
     // load handlers if required. This depends on what product and department have been selected
     if (FSS_Settings::get('support_choose_handler') != "none") {
         $allow_no_auto = 0;
         if ($this->admin_create > 0) {
             $allow_no_auto = 1;
             $this->autohandlers = SupportUsers::getHandlersTicket($prodid, $deptid, 0);
         }
         $handlers = SupportUsers::getHandlersTicket($prodid, $deptid, 0, $allow_no_auto);
         /**
          * I DONT KNOW IF THIS IS A GOOD CHANGE OR NOT, BUT IT MAKES IT CONSISTANT EVERYWHERE I THINK 
          **/
         // if the hide super users checkbox is tickets, hide them all from the dropdown
         if (FSS_Settings::get('support_hide_super_users')) {
             foreach ($handlers as $offset => $handler) {
                 $fssuser = SupportUsers::getUser($handler);
                 $juser = JFactory::getUser($handler);
                 if ($juser->get('isRoot') && $userid != $juser->id) {
                     unset($handlers[$offset]);
                 }
             }
         }
         if (count($handlers) == 0) {
             $handlers[] = 0;
         }
         $qry = "SELECT * FROM #__users WHERE id IN (" . implode(", ", $handlers) . ")";
         $db = JFactory::getDBO();
         $db->setQuery($qry);
         $handlers = $db->loadAssocList();
         $this->handlers = array();
         $h = array();
         $h['id'] = 0;
         $h['name'] = JText::_('AUTO_ASSIGN');
         $this->handlers[] = $h;
         if (is_array($handlers)) {
             foreach ($handlers as $handler) {
                 $this->handlers[] = $handler;
             }
         }
     }
     $this->assign('deptid', $deptid);
     $this->product = $this->get('Product');
     $this->dept = $this->get('Department');
     $this->cats = $this->get('Cats');
     $this->pris = $this->get('Priorities');
     $this->support_user_attach = FSS_Settings::get('support_user_attach');
     $this->fields = FSSCF::GetCustomFields(0, $prodid, $deptid);
     // load in captch and display if needed
     $this->sortCaptchaType();
     $captcha = new FSS_Captcha();
     $this->captcha = $captcha->GetCaptcha('support_captcha_type');
     parent::display();
 }
Esempio n. 13
0
 static function Ticket_To_Admins($mailer, &$ticket)
 {
     // add the actual assigned ticket handler
     if ($ticket['admin_id'] > 0) {
         $mailer->AddUserAddress($ticket['admin_id'], null, 'addTo', 'Admin: Ticket Admin ID');
     } else {
         // no assigned handler, so use the unassigned email list
         $mailer->AddMultiAddress(FSS_Settings::get('support_email_unassigned'), 'addTo', 'Admin: Unassigned ticket setting');
     }
     // if email all admins is set
     if (FSS_Settings::get('support_email_all_admins') && !(FSS_Settings::get('support_email_all_admins_only_unassigned') && $ticket['admin_id'] > 0)) {
         // Build a list of all available ticket handlers
         $mailer->AddUserAddress(SupportUsers::getHandlersTicket($ticket['prod_id'], $ticket['ticket_dept_id'], $ticket['ticket_cat_id'], FSS_Settings::get('support_email_all_admins_ignore_auto'), FSS_Settings::get('support_email_all_admins_can_view'), true), null, 'addTo', 'Admin: All admins setting');
     }
     // any cc emails need adding
     $mailer->AddMultiAddress(FSS_Settings::get('support_email_admincc'), 'addTo', 'Admin: CC all setting');
     // any admins that are cc'd on the ticket
     $db = JFactory::getDBO();
     $qry = "SELECT user_id FROM #__fss_ticket_cc as c LEFT JOIN #__users as u ON c.user_id = u.id WHERE ticket_id = " . $ticket['id'] . " AND isadmin = 1";
     $db->setQuery($qry);
     $mailer->AddUserAddress($db->loadObjectList(), 'user_id', 'addTo', 'Admin: CCd on ticket');
 }
Esempio n. 14
0
 function save($task)
 {
     $permissions = JRequest::getVar('jform');
     $this->clean_post($permissions, "com_fss");
     $this->clean_post($permissions, "faq");
     $this->clean_post($permissions, "kb");
     $this->clean_post($permissions, "glossary");
     $this->clean_post($permissions, "announce");
     $this->clean_post($permissions, "support_user");
     $this->clean_post($permissions, "support_admin");
     $this->clean_post($permissions, "support_admin_misc");
     $this->clean_post($permissions, "support_admin_ticket");
     $this->clean_post($permissions, "support_admin_ticket_cc");
     $this->clean_post($permissions, "support_admin_ticket_other");
     $this->clean_post($permissions, "support_admin_ticket_una");
     $this->clean_post($permissions, "view_products");
     $this->clean_post($permissions, "view_departments");
     $this->clean_post($permissions, "view_categories");
     $this->clean_post($permissions, "assign_products");
     $this->clean_post($permissions, "assign_departments");
     $this->clean_post($permissions, "assign_categories");
     $this->clean_post($permissions, "reports");
     $this->clean_post($permissions, "groups");
     $this->clean_post($permissions, "moderation");
     foreach ($permissions as $set => $values) {
         if (count($values) == 0) {
             unset($permissions[$set]);
         }
     }
     $db = JFactory::getDBO();
     $user_id = JRequest::getVar('user_id');
     SupportUsers::updateUserPermissions($permissions, $user_id);
     if ($task == "save") {
         $url = JRoute::_('index.php?option=com_fss&view=fusers', false);
     } else {
         if ($task == "save2new") {
             $url = JRoute::_('index.php?option=com_fss&controller=fuser&task=edit', false);
         } else {
             $url = JRoute::_('index.php?option=com_fss&controller=fuser&task=edit&cid[]=' . $user_id, false);
         }
     }
     $app = JFactory::getApplication();
     $app->redirect($url);
 }
Esempio n. 15
0
 function ConvertUsers()
 {
     $db = JFactory::getDBO();
     $log = "";
     if (FSS_Helper::TableExists("#__fss_user")) {
         $qry = "SELECT * FROM #__fss_user";
         $db->setQuery($qry);
         $users = $db->loadObjectList();
         foreach ($users as $user) {
             $sigid = 0;
             if ($user->signature != "") {
                 // change sig!
                 $qry = "INSERT INTO #__fss_ticket_fragments (description, content, type, params) VALUES (";
                 $qry .= "'Personal', ";
                 $qry .= "'" . FSSJ3Helper::getEscaped($db, $user->signature) . "', ";
                 $qry .= "1, '" . FSSJ3Helper::getEscaped($db, json_encode(array('userid' => $user->id))) . "')";
                 $db->setQuery($qry);
                 $db->Query();
                 $sigid = $db->insertid();
                 $qry = "UPDATE #__fss_user SET signature = '' WHERE id = " . $user->id;
                 $db->setQuery($qry);
                 $db->Query();
                 $log .= "Converting signature for user id {$user->id}\n";
             }
             if ($user->settings != "" && substr($user->settings, 0, 1) != "{") {
                 // eg: per_page=15|group_products=0|group_departments=1|group_cats=0|group_group=0|group_pri=0|return_on_reply=1|return_on_close=0|reverse_order=1
                 $settings = explode("|", $user->settings);
                 $result = new stdClass();
                 foreach ($settings as $setting) {
                     list($setting, $value) = explode("=", $setting);
                     $result->{$setting} = $value;
                 }
                 $result->default_sig = $sigid;
                 SupportUsers::updateUserSettings($result, $user->user_id);
                 $qry = "UPDATE #__fss_user SET settings = '' WHERE id = " . $user->id;
                 $log .= "Converting settings for user id {$user->id}\n";
                 $db->setQuery($qry);
                 $db->Query();
             }
             // convert user permissions here!
             $rules = new stdClass();
             if ($user->mod_kb) {
                 $rules->moderation = new stdClass();
                 $rules->moderation->{'fss.mod.all'} = 1;
             }
             if ($user->reports) {
                 $rules->reports = new stdClass();
                 $rules->reports->{'fss.reports'} = 1;
                 $rules->reports->{'fss.reports.all'} = 1;
             }
             if ($user->groups) {
                 $rules->groups = new stdClass();
                 $rules->groups->{'fss.groups'} = 1;
             }
             if ($user->support) {
                 $rules->support_admin = new stdClass();
                 $rules->support_admin->{'fss.handler'} = 1;
             }
             if ($user->autoassignexc) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.dontassign'} = 1;
             }
             if (!$user->seeownonly) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.seeunassigned'} = 1;
                 $rules->support_admin->{'fss.handler.seeothers'} = 1;
             }
             if ($user->assignperms) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.assign.separate'} = 1;
             }
             if ($user->allprods) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.view.products'} = 1;
             } else {
                 $qry = "SELECT * FROM #__fss_user_prod WHERE user_id = " . (int) $user->id;
                 $db->setQuery($qry);
                 $rows = $db->loadObjectList();
                 $rules->view_products = new stdClass();
                 foreach ($rows as $row) {
                     $key = 'fss.handler.view.product.' . $row->prod_id;
                     $rules->view_products->{$key} = 1;
                 }
             }
             if ($user->alldepts) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.view.departments'} = 1;
             } else {
                 $qry = "SELECT * FROM #__fss_user_dept WHERE user_id = " . (int) $user->id;
                 $db->setQuery($qry);
                 $rows = $db->loadObjectList();
                 $rules->view_departments = new stdClass();
                 foreach ($rows as $row) {
                     $key = 'fss.handler.view.department.' . $row->ticket_dept_id;
                     $rules->view_departments->{$key} = 1;
                 }
             }
             if ($user->allcats) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.view.categories'} = 1;
             } else {
                 $qry = "SELECT * FROM #__fss_user_cat WHERE user_id = " . (int) $user->id;
                 $db->setQuery($qry);
                 $rows = $db->loadObjectList();
                 $rules->view_categories = new stdClass();
                 foreach ($rows as $row) {
                     $key = 'fss.handler.view.category.' . $row->ticket_cat_id;
                     $rules->view_categories->{$key} = 1;
                 }
             }
             if ($user->allprods_a) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.assign.products'} = 1;
             } else {
                 $qry = "SELECT * FROM #__fss_user_prod_a WHERE user_id = " . (int) $user->id;
                 $db->setQuery($qry);
                 $rows = $db->loadObjectList();
                 $rules->assign_products = new stdClass();
                 foreach ($rows as $row) {
                     $key = 'fss.handler.assign.product.' . $row->prod_id;
                     $rules->assign_products->{$key} = 1;
                 }
             }
             if ($user->alldepts_a) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.assign.departments'} = 1;
             } else {
                 $qry = "SELECT * FROM #__fss_user_dept_a WHERE user_id = " . (int) $user->id;
                 $db->setQuery($qry);
                 $rows = $db->loadObjectList();
                 $rules->assign_departments = new stdClass();
                 foreach ($rows as $row) {
                     $key = 'fss.handler.assign.department.' . $row->ticket_dept_id;
                     $rules->assign_departments->{$key} = 1;
                 }
             }
             if ($user->allcats_a) {
                 if (!isset($rules->support_admin)) {
                     $rules->support_admin = new stdClass();
                 }
                 $rules->support_admin->{'fss.handler.assign.categories'} = 1;
             } else {
                 $qry = "SELECT * FROM #__fss_user_cat_a WHERE user_id = " . (int) $user->id;
                 $db->setQuery($qry);
                 $rows = $db->loadObjectList();
                 $rules->assign_categories = new stdClass();
                 foreach ($rows as $row) {
                     $key = 'fss.handler.assign.category.' . $row->ticket_cat_id;
                     $rules->assign_categories->{$key} = 1;
                 }
             }
             if ($user->artperm > 0) {
                 $sets = array("faq", "kb", "announce", "glossary");
                 foreach ($sets as $set) {
                     $rules->{$set} = new stdClass();
                     switch ($user->artperm) {
                         case 3:
                             $rules->{$set}->{'core.edit.state'} = 1;
                         case 2:
                             $rules->{$set}->{'core.edit'} = 1;
                         case 1:
                             $rules->{$set}->{'core.edit.own'} = 1;
                             $rules->{$set}->{'core.create'} = 1;
                     }
                 }
             }
             SupportUsers::updateUserPermissions($rules, $user->user_id);
         }
     }
     if ($log == "") {
         $log = "All ok!";
     }
     return $log;
 }
Esempio n. 16
0
 static function getHandlers($explicit = false, $use_out_of_office = true)
 {
     // HOW! - There has to be a better way that this!
     $key = 0;
     if ($explicit) {
         $key = 1;
     }
     if ($use_out_of_office) {
         $key += 2;
     }
     if (empty(self::$all_handlers)) {
         self::$all_handlers = array();
     }
     if (!array_key_exists($key, self::$all_handlers)) {
         if ($use_out_of_office) {
             $users = self::usersWithPerm("support_admin", "fss.handler", $explicit);
             self::$all_handlers[$key] = array();
             foreach ($users as $user) {
                 if (!empty($user->settings) && !empty($user->settings->out_of_office) && $user->settings->out_of_office) {
                     continue;
                 }
                 self::$all_handlers[$key][] = $user;
             }
         } else {
             self::$all_handlers[$key] = self::usersWithPerm("support_admin", "fss.handler", $explicit);
         }
     }
     if (FSS_Settings::get('support_hide_super_users')) {
         foreach (self::$all_handlers[$key] as $user_id => $user) {
             $user = JFactory::getUser($user->id);
             if ($user->get('isRoot')) {
                 unset(self::$all_handlers[$key][$user_id]);
             }
         }
     }
     return self::$all_handlers[$key];
 }
Esempio n. 17
0
 /**
  * Assign a new handler to the ticket
  * 
  * handler_id = the FSS User ID of the ticket handler
  * 
  * Type:
  * 
  * define("TICKET_ASSIGN_FORWARD", 0);
  * define("TICKET_ASSIGN_TOOK_OWNER", 1);
  * define("TICKET_ASSIGN_UNASSIGNED", 2);
  * define("TICKET_ASSIGN_ASSIGNED", 3);
  * 
  * if handler_id is 0, then type gets set to 2 and ticket becomes unassigned 
  **/
 function assignHandler($handler_id, $type = TICKET_ASSIGN_FORWARD)
 {
     if ($handler_id == $this->admin_id) {
         return true;
     }
     $qry = "UPDATE #__fss_ticket_ticket SET admin_id = {$handler_id} WHERE id = {$this->id}";
     $db = JFactory::getDBO();
     $db->setQuery($qry);
     $db->Query();
     if ($handler_id == 0) {
         $type = TICKET_ASSIGN_UNASSIGNED;
     }
     // update last_update
     $this->updateLastUpdated();
     // add audit note
     if ($type == TICKET_ASSIGN_FORWARD) {
         $this->addAuditNote("Forwarded to handler '" . SupportUsers::getUserName($handler_id) . "'");
     } else {
         if ($type == TICKET_ASSIGN_TOOK_OWNER) {
             $this->addAuditNote("Handler '" . SupportUsers::getUserName($handler_id) . "' took ownership of the ticket");
         } else {
             if ($type == TICKET_ASSIGN_UNASSIGNED) {
                 $this->addAuditNote("Ticket set as unassigned");
             } else {
                 if ($type == TICKET_ASSIGN_ASSIGNED) {
                     $this->addAuditNote("Ticket assigned to '" . SupportUsers::getUserName($handler_id) . "'");
                 }
             }
         }
     }
     // change this object
     $this->admin_id = $handler_id;
     SupportActions::DoAction_Ticket("assignHandler", $this, array('handler' => $handler_id, 'type' => $type));
 }
Esempio n. 18
0
if (SupportUsers::getSetting('reports_separator') == "") {
    echo " SELECTED";
}
?>
 ><?php 
echo JText::_('DEFAULT');
?>
</option>
				<option value="," <?php 
if (SupportUsers::getSetting('reports_separator') == ",") {
    echo " SELECTED";
}
?>
 >,</option>
				<option value=";" <?php 
if (SupportUsers::getSetting('reports_separator') == ";") {
    echo " SELECTED";
}
?>
 >;</option>
			</select>
		</div>
	</div>

</div>
</form>

<?php 
include JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . '_powered.php';
echo FSS_Helper::PageStyleEnd();
?>
Esempio n. 19
0
 function saveReply()
 {
     $this->removeDraft(FSS_Input::getInt('draft'));
     // get posted data
     $ticketid = FSS_Input::getInt('ticketid');
     $reply_type = FSS_Input::getCmd('reply_type');
     $user_message = FSS_Input::getBBCode('body');
     $handler_message = FSS_Input::getBBCode('body2');
     $subject = FSS_Input::getString('subject');
     // load ticket
     $ticket = new SupportTicket();
     if (!$ticket->load($ticketid)) {
         exit;
     }
     // set up some variables
     $user_id = JFactory::getUser()->id;
     $handler_id = $user_id;
     $old_st = $ticket->getStatus();
     $action_name = "";
     $action_params = array();
     $message_id = 0;
     $files_private = 0;
     // add signatures to messages
     if (FSS_Input::getInt('signature')) {
         if ($user_message) {
             $user_message .= SupportCanned::AppendSig(FSS_Input::getInt('signature'), $ticket);
         }
         if ($handler_message) {
             $handler_message .= SupportCanned::AppendSig(FSS_Input::getInt('signature'), $ticket);
         }
     }
     $extra_time = 0;
     $timestart = 0;
     $timeend = 0;
     if (FSS_Settings::Get('time_tracking') != "") {
         if (FSS_Settings::get('time_tracking_type') == 'se') {
             $timestart = strtotime("1970-01-01 " . FSS_Input::getString('timetaken_start'));
             $timeend = strtotime("1970-01-01 " . FSS_Input::getString('timetaken_end'));
             $extra_time = (int) (($timeend - $timestart) / 60);
         } elseif (FSS_Settings::get('time_tracking_type') == 'tm') {
             $timestart = strtotime(FSS_Input::getString('timetaken_start'));
             $timeend = strtotime(FSS_Input::getString('timetaken_end'));
             $extra_time = (int) (($timeend - $timestart) / 60);
         } else {
             $extra_time = (int) (FSS_Input::getInt('timetaken_hours') * 60 + FSS_Input::getInt('timetaken_mins'));
         }
     }
     // different reply types
     switch ($reply_type) {
         case 'reply':
             // post reply to user
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
             } elseif ($extra_time > 0) {
                 // no message, add time if needed
                 $ticket->addTime($extra_time, "", true, $timestart, $timeend);
             }
             // update status
             $new_status = FSS_Input::getInt('reply_status');
             $ticket->updateStatus($new_status);
             // reassign ticket if needed
             if (FSS_Settings::get('support_assign_reply') == 1 && FSS_Input::getInt('dontassign') == 0) {
                 $ticket->assignHandler($handler_id, TICKET_ASSIGN_TOOK_OWNER);
             } elseif (FSS_Settings::get('support_autoassign') == 3 && $ticket->admin_id == 0 && FSS_Input::getInt('dontassign') == 0) {
                 $ticket->assignHandler($handler_id, TICKET_ASSIGN_ASSIGNED);
             }
             // call SupportActions handler for admin reply
             $action_name = "Admin_Reply";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'status' => $new_status);
             break;
         case 'private':
             // add message to ticket
             if ($handler_message) {
                 $message_id = $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
             } else {
                 if ($extra_time > 0) {
                     $ticket->addTime($extra_time, "", true, $timestart, $timeend);
                 }
             }
             $files_private = 1;
             // call support actions for private comment
             $action_name = "Admin_Private";
             $action_params = array('subject' => $subject, 'handler_message' => $handler_message);
             break;
         case 'user':
             // update user on ticket
             $new_user_id = FSS_Input::getInt("user_id");
             $ticket->updateUser($new_user_id);
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
             } else {
                 if ($extra_time > 0) {
                     $ticket->addTime($extra_time, "", true, $timestart, $timeend);
                     $extra_time = 0;
                 }
             }
             $action_name = "Admin_ForwardUser";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'user_id' => $new_user_id);
             //
             break;
         case 'product':
             $new_handler_id = FSS_Input::getInt('new_handler');
             // update product and department
             $new_product_id = FSS_Input::getInt("new_product_id");
             $new_department_id = FSS_Input::getInt("new_department_id");
             $ticket->updateProduct($new_product_id);
             $ticket->updateDepartment($new_department_id);
             /**
              * -2 - Auto Assign
              * -1 - Unchanged
              * 0 - Unassigned
              * X - Hander
              **/
             if ($new_handler_id == -1) {
                 //$ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD);
             } else {
                 if ($new_handler_id == 0) {
                     $ticket->assignHandler(0, -1);
                 } else {
                     if ($new_handler_id > 0) {
                         $ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD);
                     } else {
                         if ($new_handler_id == -2) {
                             // auto assign new handler
                             $admin_id = FSS_Ticket_Helper::AssignHandler($new_product_id, $new_department_id, $ticket->ticket_cat_id, true);
                             $ticket->assignHandler($admin_id, TICKET_ASSIGN_FORWARD);
                         }
                     }
                 }
             }
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($handler_message) {
                 $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($extra_time > 0) {
                 $ticket->addTime($extra_time, "", true, $timestart, $timeend);
             }
             $action_name = "Admin_ForwardProduct";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'handler_message' => $handler_message, 'product_id' => $new_product_id, 'department_id' => $new_department_id);
             break;
         case 'handler':
             $new_handler_id = FSS_Input::getInt('new_handler');
             if ($new_handler_id == -2) {
                 // auto assign new handler
                 $admin_id = FSS_Ticket_Helper::AssignHandler($ticket->prod_id, $ticket->ticket_dept_id, $ticket->ticket_cat_id, true);
                 $ticket->assignHandler($admin_id, TICKET_ASSIGN_FORWARD);
             } else {
                 if ($new_handler_id != -1) {
                     $ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD);
                 }
             }
             // update status
             $new_status = FSS_Input::getCmd('reply_status');
             $ticket->updateStatus($new_status);
             if ($user_message) {
                 $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($handler_message) {
                 $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend);
                 $ticket->addTime($extra_time);
                 $extra_time = 0;
             }
             if ($extra_time > 0) {
                 $ticket->addTime($extra_time, "", true, $timestart, $timeend);
             }
             $action_name = "Admin_ForwardHandler";
             $action_params = array('subject' => $subject, 'user_message' => $user_message, 'handler_message' => $handler_message, 'handler_id' => $new_handler_id);
             break;
     }
     // add posted files
     $files = $ticket->addFilesFromPost($message_id, -1, $files_private);
     $ticket->stripImagesFromMessage($message_id);
     $action_params['files'] = $files;
     // call action handler
     SupportActions::DoAction($action_name, $ticket, $action_params);
     // Redirect to new page
     $link = FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticket->id, false);
     $new_st = $ticket->getStatus();
     if ($reply_type == "reply") {
         if ($new_st->is_closed && SupportUsers::getSetting("return_on_close")) {
             $link = SupportHelper::parseRedirectType($old_st->id, SupportUsers::getSetting("return_on_close"));
         } else {
             if (SupportUsers::getSetting("return_on_reply")) {
                 $link = SupportHelper::parseRedirectType($old_st->id, SupportUsers::getSetting("return_on_reply"));
             }
         }
     }
     JFactory::getApplication()->redirect($link);
 }
Esempio n. 20
0
    ?>

		</ul>
	</li>
	<?php 
}
?>

	<?php 
echo FSS_GUIPlugins::output("adminSupportTabs_End");
?>

</ul>

<?php 
$values = SupportUsers::getAllSettings();
if (!empty($values->out_of_office) && $values->out_of_office) {
    ?>
<div class="alert alert-warning">
	<div class="pull-right">
		<a class="btn btn-default" href="<?php 
    echo FSSRoute::_("index.php?option=com_fss&view=admin_support&layout=outofoffice", false);
    ?>
"><?php 
    echo JText::_('SET_AS_AVAILABLE');
    ?>
</a>
	</div>
	<h4>
		<?php 
    echo JText::_('YOU_ARE_CURRENT_UNAVAILABLE');
Esempio n. 21
0
 static function GetAllSigs($ticket)
 {
     if (empty(self::$all_sigs)) {
         $userid = JFactory::getUser()->id;
         $db = JFactory::getDBO();
         $query = 'SELECT * FROM #__fss_ticket_fragments WHERE type = 1';
         $db->setQuery($query);
         $rows = $db->loadObjectList();
         self::$all_sigs = array();
         foreach ($rows as $row) {
             $row->params = json_decode($row->params, true);
             if (is_string($row->params)) {
                 $row->params = array();
             }
             $row->default = 0;
             $row->personal = 0;
             if (isset($row->params['userid'])) {
                 if ($row->params['userid'] > 0 && $userid != $row->params['userid']) {
                     continue;
                 }
                 $row->personal = 1;
             }
             self::$all_sigs[] = $row;
         }
         $qry = "SELECT * FROM #__fss_users WHERE user_id = {$userid}";
         $db->setQuery($qry);
         $user = $db->loadObject();
         if ($user) {
             $settings = json_decode($user->settings, true);
         }
         $def_sig = SupportUsers::getSetting('default_sig');
         $ds = 0;
         if ($def_sig > 0) {
             foreach (self::$all_sigs as &$sig) {
                 if ($sig->id == $def_sig) {
                     $sig->default = 1;
                 }
             }
         }
     }
     return self::$all_sigs;
 }
Esempio n. 22
0
 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();
 }
Esempio n. 23
0
		<div class="controls">
			<select name="batch_handler">
				<option value=""><?php 
    echo JText::_('UNCHANGED');
    ?>
</option>
				<optgroup label="<?php 
    echo JText::_('NEW_HANDLER_');
    ?>
">
					<option value="0"><?php 
    echo JText::_('UNASSIGNED__TICKET_HEADER');
    ?>
</option>
					<?php 
    $handlers = SupportUsers::getHandlers(false, true);
    foreach ($handlers as $handler) {
        echo "<option value='{$handler->id}'>{$handler->name} ({$handler->username})</option>";
    }
    ?>
	
				</optgroup>
			</select>
		</div>
	</div>

	<!--<div class="control-group">
		<label class="control-label"><?php 
    echo JText::_("Send EMails");
    ?>
</label>
Esempio n. 24
0
 function display($tpl = null)
 {
     global $mainframe;
     $document = JFactory::getDocument();
     //JHTML::_( 'behavior.mootools' );
     //$document->addStyleSheet( JURI::base() . 'components/com_fss/assets/slimbox/slimbox.css' );
     //$document->addScript( JURI::base() .'components/com_fss/assets/slimbox/slimbox.js');
     $item = $this->get('Data');
     $isNew = $item->id < 1;
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     JToolBarHelper::title(JText::_('TICKET_EMAIL_ACCOUNT') . ': <small><small>[ ' . $text . ' ]</small></small>', 'fss_emailaccounts');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::save2new();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', 'Close');
     }
     FSSAdminHelper::DoSubToolbar();
     $db = JFactory::getDBO();
     $combo = array();
     $combo[] = JHTML::_('select.option', 'pop3', JText::_('POP3'), 'id', 'value');
     $combo[] = JHTML::_('select.option', 'imap', JText::_('IMAP'), 'id', 'value');
     $lists['type'] = JHTML::_('select.genericlist', $combo, 'type', 'class="inputbox" size="1" ', 'id', 'value', $item->type);
     $combo = array();
     $combo[] = JHTML::_('select.option', 'markread', JText::_('MARK_EMAIL_AS_READ'), 'id', 'value');
     $combo[] = JHTML::_('select.option', 'delete', JText::_('DELETE_EMAIL'), 'id', 'value');
     $lists['onimport'] = JHTML::_('select.genericlist', $combo, 'onimport', 'class="inputbox" size="1" ', 'id', 'value', $item->onimport);
     $combo = array();
     $combo[] = JHTML::_('select.option', 'registered', JText::_('REGISTERED_USERS_ONLY'), 'id', 'value');
     $combo[] = JHTML::_('select.option', 'everyone', JText::_('EVERYONE'), 'id', 'value');
     $lists['newticketsfrom'] = JHTML::_('select.genericlist', $combo, 'newticketsfrom', 'class="inputbox" size="1" ', 'id', 'value', $item->newticketsfrom);
     $query = 'SELECT id, title' . ' FROM #__fss_prod' . ' ORDER BY title';
     $db->setQuery($query);
     $sections_prod_id = $db->loadObjectList();
     $prods = array();
     $prods[] = JHTML::_('select.option', '', JText::_('NO_PRODUCT'), 'id', 'title');
     $sections_prod_id = array_merge($prods, $sections_prod_id);
     $lists['prod_id'] = JHTML::_('select.genericlist', $sections_prod_id, 'prod_id', 'class="inputbox" size="1" ', 'id', 'title', intval($item->prod_id));
     $query = 'SELECT id, title' . ' FROM #__fss_ticket_dept' . ' ORDER BY title';
     $db->setQuery($query);
     $sections_dept_id = $db->loadObjectList();
     $prods = array();
     $prods[] = JHTML::_('select.option', '', JText::_('NO_DEPARTMENT'), 'id', 'title');
     $sections_dept_id = array_merge($prods, $sections_dept_id);
     $lists['dept_id'] = JHTML::_('select.genericlist', $sections_dept_id, 'dept_id', 'class="inputbox" size="1" ', 'id', 'title', intval($item->dept_id));
     $query = 'SELECT id, title' . ' FROM #__fss_ticket_cat ' . ' ORDER BY title';
     $db->setQuery($query);
     $sections_cat_id = $db->loadObjectList();
     $prods = array();
     $prods[] = JHTML::_('select.option', '', JText::_('NO_CATEGORY'), 'id', 'title');
     $sections_cat_id = array_merge($prods, $sections_cat_id);
     $lists['cat_id'] = JHTML::_('select.genericlist', $sections_cat_id, 'cat_id', 'class="inputbox" size="1" ', 'id', 'title', intval($item->cat_id));
     $query = 'SELECT id, title' . ' FROM #__fss_ticket_pri' . ' ORDER BY id';
     $db->setQuery($query);
     $sections_pri_id = $db->loadObjectList();
     $lists['pri_id'] = JHTML::_('select.genericlist', $sections_pri_id, 'pri_id', 'class="inputbox" size="1" ', 'id', 'title', intval($item->pri_id));
     $sections_handler = SupportUsers::getHandlers();
     $prods = array();
     $prods[] = JHTML::_('select.option', '', JText::_('LEAVE_UNASSIGNED'), 'id', 'name');
     $prods[] = JHTML::_('select.option', '-1', JText::_('AUTO_ASSIGN'), 'id', 'name');
     $sections_handler = array_merge($prods, $sections_handler);
     $lists['handler'] = JHTML::_('select.genericlist', $sections_handler, 'handler', 'class="inputbox" size="1" ', 'id', 'name', intval($item->handler));
     $combo = array();
     $combo[] = JHTML::_('select.option', '0', JText::_('UNSET'), 'id', 'value');
     $combo[] = JHTML::_('select.option', '1', JText::_('USE_TLS'), 'id', 'value');
     $combo[] = JHTML::_('select.option', '2', JText::_('DONT_USE_TLS'), 'id', 'value');
     $lists['usetls'] = JHTML::_('select.genericlist', $combo, 'usetls', 'class="inputbox" size="1" ', 'id', 'value', $item->usetls);
     $this->item = $item;
     $this->lists = $lists;
     parent::display($tpl);
 }
Esempio n. 25
0
 static function &getTicketCount($foradmin = true, $current_handler_only = false)
 {
     $key = 0;
     if ($foradmin) {
         $key += 1;
     }
     if ($current_handler_only) {
         $key += 2;
     }
     if (empty(self::$counts)) {
         self::$counts = array();
     }
     if (!array_key_exists($key, self::$counts)) {
         $db = JFactory::getDBO();
         $query = "SELECT count( * ) AS count, ticket_status_id FROM #__fss_ticket_ticket as t WHERE 1 ";
         $query .= " AND " . SupportUsers::getAdminWhere();
         if ($foradmin) {
             $query .= " AND " . SupportSource::admin_list_sql();
         } else {
             $query .= " AND " . SupportSource::user_list_sql();
         }
         if ($current_handler_only) {
             $query .= " AND admin_id = " . JFactory::getUser()->id;
         }
         $query .= " GROUP BY ticket_status_id";
         $db->setQuery($query);
         $rows = $db->loadAssocList();
         $out = array();
         FSS_Ticket_Helper::GetStatusList();
         foreach (FSS_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 = FSS_Ticket_Helper::GetStatusID("def_archive");
         $out['archived'] = 0;
         if (array_key_exists($archived, $out)) {
             $out['archived'] = $out[$archived];
         }
         $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed", true);
         $out['allopen'] = 0;
         foreach ($allopen as $id) {
             if (array_key_exists($id, $out)) {
                 $out['allopen'] += $out[$id];
             }
         }
         $allclosed = FSS_Ticket_Helper::GetClosedStatus();
         $out['allclosed'] = 0;
         foreach ($allclosed as $id) {
             if (array_key_exists($id, $out)) {
                 $out['allclosed'] += $out[$id];
             }
         }
         $all = FSS_Ticket_Helper::GetStatusIDs("def_archive", true);
         $out['all'] = 0;
         foreach ($all as $id) {
             if (array_key_exists($id, $out)) {
                 $out['all'] += $out[$id];
             }
         }
         self::$counts[$key] = $out;
     }
     return self::$counts[$key];
 }
Esempio n. 26
0
    function grouping($type, $name, $ticket)
    {
        if (empty($this->group_nest)) {
            $this->group_nest = array();
            $this->group_nest['prod'] = 0;
            $this->group_nest['dept'] = 0;
            $this->group_nest['cat'] = 0;
            $this->group_nest['group'] = 0;
            $this->group_nest['pri'] = 0;
            $base = 0;
            if (SupportUsers::getSetting("group_products")) {
                $this->group_nest['prod'] = $base;
                $base++;
            }
            if (SupportUsers::getSetting("group_departments")) {
                $this->group_nest['dept'] = $base;
                $base++;
            }
            if (SupportUsers::getSetting("group_cats")) {
                $this->group_nest['cat'] = $base;
                $base++;
            }
            if (SupportUsers::getSetting("group_group")) {
                $this->group_nest['group'] = $base;
                $base++;
            }
            if (SupportUsers::getSetting("group_pri")) {
                $this->group_nest['pri'] = $base;
                $base++;
            }
        }
        if ($name == "") {
            if ($type == "prod") {
                $name = JText::_('NO_PRODUCT');
            }
            if ($type == "dept") {
                $name = JText::_('NO_DEPARTMENT');
            }
            if ($type == "cat") {
                $name = JText::_('NO_CATEGORY');
            }
            if ($type == "group") {
                $name = JText::_('NO_GROUP');
            }
        }
        $style = "style='padding-left: " . 16 * $this->group_nest[$type] . "px;'";
        ?>

	<div class="fss_ticket_grouping" <?php 
        echo $style;
        ?>
>
		<img src='<?php 
        echo JURI::root(true);
        ?>
/components/com_fss/assets/images/support/<?php 
        echo $type;
        ?>
.png' width="16" height="16">
		<?php 
        echo $name;
        ?>
	</div>

<?php 
    }
Esempio n. 27
0
 function showUserIn()
 {
     FSS_Helper::AddSCEditor();
     $this->handlers = SupportUsers::getHandlers(false, true);
     $this->_display("in");
 }
Esempio n. 28
0
 function outputCSV()
 {
     if (ob_get_level() > 0) {
         ob_end_clean();
     }
     $report_name = $this->report->title . " " . date("Y-m-d H.i.s");
     header('Content-Encoding: UTF-8');
     header("Content-type: text/csv; charset=UTF-8");
     header("Content-Disposition: attachment; filename=" . $report_name . ".csv");
     header("Pragma: no-cache");
     header("Expires: 0");
     $sep = FSS_Settings::get('reports_separator');
     if (SupportUsers::getSetting('reports_separator') != "") {
         $sep = SupportUsers::getSetting('reports_separator');
     }
     echo "";
     $outline = array();
     foreach ($this->report->field as $field) {
         $outline[] = $field->text;
     }
     $fp = fopen('php://output', 'w');
     fputcsv($fp, $outline, $sep);
     foreach ($this->report->data as $row) {
         $outline = array();
         foreach ($this->report->field as $field) {
             $name = $field->name;
             $value = $row->{$name};
             if (isset($field->format)) {
                 if ($field->format == "date") {
                     if ($value != "" && $value != "0000-00-00" && $value != "0000-00-00 00:00:00") {
                         $format = "Y-m-d";
                         if (isset($field->dateformat)) {
                             $format = $field->dateformat;
                         }
                         if (substr($format, 0, 5) == "DATE_") {
                             $format = JText::_($format);
                         }
                         $jdate = new JDate($value);
                         $value = $jdate->format($format);
                     } elseif (isset($field->blank)) {
                         $value = $field->blank;
                     }
                 } else {
                     if ($field->format == "messagetime") {
                         if ($value < 1) {
                             $value = "";
                         } else {
                             if ($value > 0 && $value < 86400 * 10) {
                                 $value = date("H:i", $value);
                             } else {
                                 $format = "Y-m-d";
                                 if (isset($field->dateformat)) {
                                     $format = $field->dateformat;
                                 }
                                 if (substr($format, 0, 5) == "DATE_") {
                                     $format = JText::_($format);
                                 }
                                 $jdate = new JDate($value);
                                 $value = $jdate->format($format);
                             }
                         }
                     } else {
                         if ($field->format == "hm") {
                             $val = $value;
                             $mins = $val % 60;
                             $hrs = floor($val / 60);
                             $value = sprintf("%d:%02d", $hrs, $mins);
                         } else {
                             if ($field->format == "bbcode") {
                                 $value = preg_replace("/\\[img\\]data(.*)\\[\\/img\\]/i", "", $value);
                                 //$value = FSS_Helper::ParseBBCode($value, null, true, true);
                             }
                         }
                     }
                 }
             }
             $outline[] = $value;
         }
         //echo implode($sep, $outline) . "\n";
         fputcsv($fp, $outline, $sep);
     }
     fclose($fp);
     exit;
 }