function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (!RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_permissions = RSTicketsProHelper::getCurrentPermissions(); if (!$this->_permissions->add_ticket_customers && !$this->_permissions->add_ticket_staff) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.users.limit', $limit); $this->setState($option . '.users.limitstart', $limitstart); $this->_query = $this->_buildQuery(); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $this->assignRef('user', JFactory::getUser()); $login_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $Itemid = JRequest::getInt('Itemid'); $return = base64_encode(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=dashboard' . ($Itemid ? '&Itemid=' . $Itemid : ''), false)); $login_link = JRoute::_('index.php?option=' . $login_option . '&view=login' . ($Itemid ? '&Itemid=' . $Itemid : '') . '&return=' . $return); $this->assignRef('login_link', $login_link); $this->assignRef('categories', $this->get('categories')); $this->assignRef('tickets', $this->get('tickets')); $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); JHTML::_('behavior.mootools'); $doc =& JFactory::getDocument(); if (RSTicketsProHelper::isJ16() || JPluginHelper::isEnabled('system', 'mtupgrade')) { $doc->addScript(JURI::root(true) . '/components/com_rsticketspro/assets/js/more.js'); } if (RSTicketsProHelper::isJ16()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display($tpl); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $ticket_viewing_history = RSTicketsProHelper::getConfig('ticket_viewing_history'); if (!$ticket_viewing_history) { JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_HISTORY')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if ($ticket_viewing_history == 1 && !RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_HISTORY')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.history.limit', $limit); $this->setState($option . '.history.limitstart', $limitstart); $this->_query = $this->_buildQuery(); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css'); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (!RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_CUSTOMER_CANNOT_VIEW_SEARCHES')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $task = JRequest::getVar('task'); if ($task == 'edit' || $task == 'save' || $task == 'search') { $this->_getSearch(); } $filter_order = $mainframe->getUserStateFromRequest($option . '.searches.filter_order', 'filter_order', 'ordering'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.searches.filter_order_Dir', 'filter_order_Dir', 'ASC'); $this->setState($option . '.searches.filter_order', $filter_order); $this->setState($option . '.searches.filter_order_Dir', $filter_order_Dir); $this->_query = $this->_buildQuery(); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); if ($mainframe->isSite()) { $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); } $this->assign('signature', RSTicketsProHelper::getSignature()); $this->assignRef('editor', JFactory::getEditor()); $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link')); $this->assign('footer', RSTicketsProHelper::getFooter()); if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (!RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_CANNOT_CHANGE_SIGNATURE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); $this->_db->setQuery("SELECT id FROM #__rsticketspro_staff WHERE user_id='" . (int) $user->get('id') . "' LIMIT 1"); if (!$this->_db->loadResult()) { JError::raiseWarning(500, JText::_('RST_CANNOT_CHANGE_SIGNATURE_MUST_BE_STAFF')); $referer = @$_SERVER['HTTP_REFERER']; if (empty($referer)) { $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } else { $mainframe->redirect($referer); } } }
function sort($title, $order, $direction = 'asc', $selected = 0, $task = null, $new_direction = 'asc') { if (RSTicketsProHelper::isJ16()) { $onclick = 'onclick="Joomla.tableOrdering(\'' . $order . '\',\'' . $direction . '\',\'' . $task . '\');"'; $correct_onclick = 'onclick="Joomla.tableOrdering(\'' . $order . '\',\'' . $direction . '\',\'' . $task . '\'); return false;"'; $html = JHTML::_('grid.sort', $title, $order, $direction, $selected, $task, $new_direction); $html = str_replace($onclick, $correct_onclick, $html); return $html; } return JHTML::_('grid.sort', $title, $order, $direction, $selected, $task); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); if (!$mainframe->isAdmin()) { $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); } $data = $this->get('data'); $this->assignRef('data', $data); $this->assignRef('custom_fields', $this->get('customfields')); $user = JFactory::getUser(); $this->assign('is_logged', !$user->get('guest')); $this->assign('is_staff', RSTicketsProHelper::isStaff()); $this->assign('permissions', RSTicketsProHelper::getCurrentPermissions()); $this->assignRef('user', $user); $this->assign('use_editor', RSTicketsProHelper::getConfig('allow_rich_editor')); $this->assignRef('editor', JFactory::getEditor()); $show_please_select = true; $lists['priorities'] = JHTML::_('select.genericlist', RSTicketsProHelper::getPriorities($show_please_select), 'priority_id', '', 'value', 'text', @$data['priority_id'], 'submit_priority'); $lists['departments'] = JHTML::_('select.genericlist', RSTicketsProHelper::getDepartments($show_please_select), 'department_id', 'onchange="rst_show_custom_fields(this.value); rst_show_priority(this.value); rst_show_upload(this.value); rst_show_subject(this.value);"', 'value', 'text', @$data['department_id']); $lists['subject'] = JHTML::_('select.genericlist', RSTicketsProHelper::getSubjects(@$data['department_id'], $show_please_select), 'subject', '', 'value', 'text', @$data['subject'], 'submit_subject'); $this->assignRef('lists', $lists); $this->assignRef('departments', $this->get('departments')); $this->assign('can_upload', $this->get('canupload')); $this->assign('use_captcha', $this->get('usecaptcha')); $this->assign('use_builtin', $this->get('usebuiltin')); $this->assign('use_recaptcha', $this->get('userecaptcha')); if ($this->get('userecaptcha') && $mainframe->isSite()) { $this->assign('show_recaptcha', JReCAPTCHA::getHTML($this->get('recaptchaerror'))); } $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link')); $this->assign('footer', RSTicketsProHelper::getFooter()); $this->assign('use_predefined_subjects', RSTicketsProHelper::getConfig('allow_predefined_subjects')); if ($mainframe->isAdmin()) { $this->assign('checked_create_new_user', JRequest::getVar('submit_type', 1) == 1); $this->assign('checked_existing_user', JRequest::getVar('submit_type', 1) == 2); } if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $this->_db = JFactory::getDBO(); $this->_getIsStaff(); if ($this->is_staff) { $this->_getPermissions(); $departments = RSTicketsProHelper::getCurrentDepartments(); } $this->_getTicket(); if (!$this->is_staff && $this->_ticket->customer_id != $user->get('id')) { JError::raiseWarning(500, JText::_('RST_CUSTOMER_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if ($this->is_staff) { // staff - check if belongs to department only if he is not the customer if ($this->_ticket->customer_id != $user->get('id') && !in_array($this->_ticket->department_id, $departments)) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if (RSTicketsProHelper::getConfig('staff_force_departments') && !in_array($this->_ticket->department_id, $departments)) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if (!$this->_permissions->see_unassigned_tickets && $this->_ticket->staff_id == 0) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if (!$this->_permissions->see_other_tickets && $this->_ticket->staff_id > 0 && $this->_ticket->staff_id != $user->get('id')) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } } if ($mainframe->isSite()) { $pathway =& $mainframe->getPathway(); $pathway->addItem('[' . $this->_ticket->code . '] ' . $this->_ticket->subject, ''); } $document =& JFactory::getDocument(); $document->setTitle('[' . $this->_ticket->code . '] ' . $this->_ticket->subject, ''); $this->_setData(); $this->_processData(); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); if ($mainframe->isSite()) { $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); } $departments = RSTicketsProHelper::getDepartments(); $lists['departments'] = JHTML::_('select.genericlist', $departments, 'department_id[]', 'size="5" multiple="multiple"', 'value', 'text', $departments); $lists['statuses'] = JHTML::_('select.genericlist', RSTicketsProHelper::getStatuses(), 'status_id[]', 'size="5" multiple="multiple"', 'value', 'text', RSTicketsProHelper::getStatuses()); $lists['priorities'] = JHTML::_('select.genericlist', RSTicketsProHelper::getPriorities(), 'priority_id[]', 'size="5" multiple="multiple"', 'value', 'text', RSTicketsProHelper::getPriorities()); $ordering = array(); $ordering[] = JHTML::_('select.option', 'date', JText::_('Default')); $ordering[] = JHTML::_('select.option', 'last_reply', JText::_('RST_TICKET_LAST_REPLY')); $ordering[] = JHTML::_('select.option', 'subject', JText::_('RST_TICKET_SUBJECT')); $ordering[] = JHTML::_('select.option', 'status', JText::_('RST_TICKET_STATUS')); $ordering[] = JHTML::_('select.option', 'priority', JText::_('RST_TICKET_PRIORITY')); $ordering[] = JHTML::_('select.option', 'replies', JText::_('RST_TICKET_REPLIES')); $lists['ordering'] = JHTML::_('select.genericlist', $ordering, 'filter_order', '', 'value', 'text'); $ordering_dir = array(); $ordering_dir[] = JHTML::_('select.option', 'DESC', JText::_('DESC')); $ordering_dir[] = JHTML::_('select.option', 'ASC', JText::_('ASC')); $lists['ordering_dir'] = JHTML::_('select.genericlist', $ordering_dir, 'filter_order_Dir', '', 'value', 'text'); $this->assign('is_staff', RSTicketsProHelper::isStaff()); $this->assign('permissions', RSTicketsProHelper::getCurrentPermissions()); $this->assign('is_advanced', JRequest::getVar('advanced', false)); $this->assignRef('lists', $lists); $this->assign('itemid', $this->get('itemid')); $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link')); $this->assign('footer', RSTicketsProHelper::getFooter()); if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; if ($mainframe->isAdmin()) { $data = "staff_itemid=\n"; $data .= "customer_itemid=\n"; jimport('joomla.html.parameter'); $this->params = new JParameter($data); } else { $this->params = $mainframe->getParams('com_rsticketspro'); } $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); if ($mainframe->isSite()) { $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); } if ($mainframe->isSite()) { $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('RST_MANAGE_SEARCHES'), RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=searches')); } $task = JRequest::getVar('task'); if ($task == 'edit' || $task == 'save') { $row = $this->get('search'); $this->assignRef('row', $row); if ($mainframe->isSite()) { $pathway->addItem($row->name, ''); } $lists['default'] = JHTML::_('select.booleanlist', 'default', '', $row->default); $this->assignRef('lists', $lists); } else { $this->assignRef('searches', $this->get('searches')); $this->assignRef('pagination', $this->get('pagination')); } if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $this->is_staff = RSTicketsProHelper::isStaff(); if (!$this->is_staff) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $permissions = RSTicketsProHelper::getCurrentPermissions(); $message = $this->getRow(); // can update his own replies if (!$permissions->update_ticket_replies && $message->user_id == $user->get('id')) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } // can update customer replies $is_customer = !RSTicketsProHelper::isStaff($message->user_id); if (!$permissions->update_ticket_replies_customers && $is_customer) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } // can update staff replies $is_other_staff = !$is_customer && $message->user_id != $user->get('id'); if (!$permissions->update_ticket_replies_staff && $is_other_staff) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css'); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); $this->assignRef('article', $this->get('article')); if (RSTicketsProHelper::isJ16()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display($tpl); }
function __construct() { parent::__construct(); $this->_db = JFactory::getDBO(); $this->_query = $this->_buildQuery(); $document =& JFactory::getDocument(); jimport('joomla.plugin.helper'); if (JPluginHelper::isEnabled('system', 'mtupgrade') || RSTicketsProHelper::isJ16()) { $document->addScript(JURI::base() . 'components/com_rsticketspro/assets/js/rainbow12.js'); } else { $document->addScript(JURI::base() . 'components/com_rsticketspro/assets/js/rainbow.js'); } $document->addStyleSheet(JURI::base() . 'components/com_rsticketspro/assets/css/colorpicker.css'); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; // Get pagination request variables $limit = $mainframe->getUserStateFromRequest($option . '.priorities.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . '.priorities.limitstart', 'limitstart', 0, 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.priorities.limit', $limit); $this->setState($option . '.priorities.limitstart', $limitstart); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); $layout = $this->getLayout(); if ($layout == 'results') { $this->assignRef('items', $this->get('results')); $this->assignRef('pagination', $this->get('resultspagination')); $this->assignRef('word', $this->get('resultsword')); } else { $this->assignRef('categories', $this->get('categories')); $this->assignRef('items', $this->get('content')); $this->assignRef('pagination', $this->get('contentpagination')); $this->assignRef('sortColumn', $this->get('sortcolumn')); $this->assignRef('sortOrder', $this->get('sortorder')); $filter_word = $this->get('filterword'); $this->assignRef('filter_word', $filter_word); $this->assign('category', $this->get('category')); $this->assign('cid', JRequest::getInt('cid')); } if (RSTicketsProHelper::isJ16()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display($tpl); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $this->_db = JFactory::getDBO(); $user = JFactory::getUser(); if ($mainframe->isSite() && !RSTicketsProHelper::getConfig('rsticketspro_add_tickets') && $user->get('guest')) { $Itemid = JRequest::getInt('Itemid'); $Itemid = $Itemid ? '&Itemid=' . $Itemid : ''; JError::raiseWarning(500, JText::_('RST_CANNOT_SUBMIT_TICKET')); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $link = base64_encode(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=submit' . $Itemid, false)); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (RSTicketsProHelper::isStaff()) { $permissions = RSTicketsProHelper::getCurrentPermissions(); if (!$permissions->add_ticket && !$permissions->add_ticket_customers && !$permissions->add_ticket_staff) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_SUBMIT_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } } $this->_setData(); $this->_processData(); }
function getCommentOptions() { $db =& JFactory::getDBO(); $supported_components = array('RSComments' => 'com_rscomments', 'JComments' => 'com_jcomments', 'Jom Comment' => 'com_jomcomment'); $comments = array(); $comments[] = JHTML::_('select.option', '0', JText::_('RST_KB_COMMENTS_DISABLED')); $comments[] = JHTML::_('select.option', 'facebook', JText::_('RST_FACEBOOK_COMMENTS')); foreach ($supported_components as $name => $item) { $disabled = true; $path = JPATH_ADMINISTRATOR . DS . 'components' . DS . $item; if (file_exists($path)) { if (RSTicketsProHelper::isJ16()) { $db->setQuery("SELECT `enabled` FROM #__extensions WHERE `type` = 'component' AND `element`='" . $item . "' LIMIT 1"); } else { $db->setQuery("SELECT `enabled` FROM #__components WHERE `name`='" . $name . "' LIMIT 1"); } if ($db->loadResult()) { $disabled = false; } } $comments[] = JHTML::_('select.option', $item, $name, 'value', 'text', $disabled); } return $comments; }
else RSTSearch.slideOut(); } } xmlHttp.open("GET", url, true); xmlHttp.send(null); } function rsticketspro_close() { RSTSearch.slideOut(); } </script> <?php if (RSTicketsProHelper::isJ16()) { ?> <?php if ($this->params->get('show_page_heading', 1)) { ?> <h1><?php echo $this->escape($this->params->get('page_heading', $this->params->get('page_title'))); ?> </h1> <?php } ?> <?php } else { ?> <?php
?> ) <br /> <a href="<?php echo JRoute::_('index.php?option=com_rsticketspro&view=ticket&cid=' . $item->id); ?> "><?php echo $this->escape($item->subject); ?> </a> <?php echo JHTML::_('rsticketsproicon.notify', $this->is_staff, $item); ?> </td> <td><a href="<?php echo JRoute::_(RSTicketsProHelper::isJ16() ? 'index.php?option=com_users&view=user&task=user.edit&id=' . $item->customer_id : 'index.php?option=com_users&view=user&task=edit&cid[]=' . $item->customer_id); ?> "><?php echo $this->escape($item->customer); ?> </a></td> <td class="rst_priority_cell"><?php echo JText::_($item->priority); ?> </td> <td><?php echo JText::_($item->status); ?> </td> <td><?php echo $item->staff_id ? $this->escape($item->staff) : '<em>' . JText::_('RST_UNASSIGNED') . '</em>';
function deletemessage() { $mainframe =& JFactory::getApplication(); $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $is_staff = RSTicketsProHelper::isStaff(); if (!$is_staff) { JError::raiseWarning(500, JText::_('RST_CANNOT_DELETE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $permissions = RSTicketsProHelper::getCurrentPermissions(); $cid = JRequest::getInt('cid'); $message =& JTable::getInstance('RSTicketsPro_Ticket_Messages', 'Table'); $message->load($cid); // can update his own replies if (!$permissions->delete_ticket_replies && $message->user_id == $user->get('id')) { JError::raiseWarning(500, JText::_('RST_CANNOT_DELETE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } // can update customer replies $is_customer = !RSTicketsProHelper::isStaff($message->user_id); if (!$permissions->delete_ticket_replies_customers && $is_customer) { JError::raiseWarning(500, JText::_('RST_CANNOT_DELETE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } // can update staff replies $is_other_staff = !$is_customer && $message->user_id != $user->get('id'); if (!$permissions->delete_ticket_replies_staff && $is_other_staff) { JError::raiseWarning(500, JText::_('RST_CANNOT_DELETE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db->setQuery("DELETE FROM #__rsticketspro_ticket_messages WHERE id='" . $cid . "' LIMIT 1"); $this->_db->query(); $this->_db->setQuery("UPDATE #__rsticketspro_tickets SET `replies`=`replies`-1 WHERE `id`='" . $message->ticket_id . "'"); $this->_db->query(); $this->_db->setQuery("SELECT `replies` FROM #__rsticketspro_tickets WHERE `id`='" . $message->ticket_id . "'"); if ($this->_db->loadResult() < 0) { $this->_db->setQuery("UPDATE #__rsticketspro_tickets SET `replies`=0 WHERE `id`='" . $message->ticket_id . "'"); $this->_db->query(); } $ticket_id = $message->ticket_id; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=ticket&cid=' . $ticket_id, false), JText::_('RST_DELETE_TICKET_MESSAGE_OK')); }
<?php /** * @version 2.0.0 * @package RSTickets! Pro 2.0.0 * @copyright (C) 2010 www.rsjoomla.com * @license GPL, http://www.gnu.org/licenses/gpl-2.0.html */ defined('_JEXEC') or die('Restricted access'); JHTML::_('behavior.mootools'); JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal'); $doc =& JFactory::getDocument(); if (!RSTicketsProHelper::isJ16() && !JPluginHelper::isEnabled('system', 'mtupgrade')) { ?> <script type="text/javascript"> Element.extend({ get: function(prop){ return this.getProperty(prop); theprop = this.getAttribute(prop); alert(theprop); return theprop; }, getAllPrevious: function(match, nocash){ return walk(this, 'previousSibling', null, match, true, nocash); }, getAllNext: function(match, nocash){ return walk(this, 'nextSibling', null, match, true, nocash); },
function display($tpl = null) { $mainframe =& JFactory::getApplication(); if ($mainframe->isSite()) { $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); } $this->assign('date_format', RSTicketsProHelper::getConfig('date_format')); $this->assign('permissions', $this->get('permissions')); $this->assign('is_staff', RSTicketsProHelper::isStaff()); $this->assignRef('tickets', $this->get('tickets')); $this->assignRef('pagination', $this->get('pagination')); $staff = RSTicketsProHelper::getStaff(); $unassigned = array(); $unassigned[] = JHTML::_('select.option', -1, JText::_('RST_UNCHANGED')); $unassigned[] = JHTML::_('select.option', 0, JText::_('RST_UNASSIGNED')); $staff = array_merge($unassigned, $staff); $lists['staff'] = JHTML::_('select.genericlist', $staff, 'bulk_staff_id', '', 'value', 'text'); $priority = RSTicketsProHelper::getPriorities(); $unchanged = array(); $unchanged[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED')); $priority = array_merge($unchanged, $priority); $lists['priority'] = JHTML::_('select.genericlist', $priority, 'bulk_priority_id', '', 'value', 'text'); $status = RSTicketsProHelper::getStatuses(); $unchanged = array(); $unchanged[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED')); $status = array_merge($unchanged, $status); $lists['status'] = JHTML::_('select.genericlist', $status, 'bulk_status_id', '', 'value', 'text'); $delete = array(); $delete[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED')); $delete[] = JHTML::_('select.option', 1, JText::_('RST_DELETE_SELECTED')); $lists['delete'] = JHTML::_('select.genericlist', $delete, 'bulk_delete', 'onchange="rst_disable_bulk(this.value);" onclick="rst_disable_bulk(this.value);"', 'value', 'text', ''); $notify = array(); $notify[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED')); $notify[] = JHTML::_('select.option', 1, JText::_('RST_NOTIFY_SELECTED')); $lists['notify'] = JHTML::_('select.genericlist', $notify, 'bulk_notify', '', 'value', 'text', ''); $this->assignRef('lists', $lists); $this->assignRef('sortColumn', $this->get('sortColumn')); $this->assignRef('sortOrder', $this->get('sortOrder')); $this->assignRef('limitstart', JRequest::getInt('limitstart', 0)); $this->assign('is_searching', $this->get('searching')); $searches = $this->get('searches'); $this->assign('searches', $searches); $this->assign('has_searches', !empty($searches)); $this->assign('predefined_search', $this->get('predefinedsearch')); $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link')); $this->assign('footer', RSTicketsProHelper::getFooter()); $this->assignRef('priorityColors', $this->get('prioritycolors')); $this->assign('colorWholeTicket', RSTicketsProHelper::getConfig('color_whole_ticket')); if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $this->_db = JFactory::getDBO(); // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.tickets.limit', $limit); $this->setState($option . '.tickets.limitstart', $limitstart); // hack for backend management if ($mainframe->isAdmin()) { $data = "orderby=date\n"; $data .= "direction=desc\n"; jimport('joomla.html.parameter'); $this->params = new JParameter($data); } else { $this->params = $mainframe->getParams('com_rsticketspro'); } switch ($this->params->get('orderby')) { default: $sortColumn = 'date'; $sortOrder = 'DESC'; break; case 'last_reply': $sortColumn = 'last_reply'; $sortOrder = 'DESC'; break; case 'subject': $sortColumn = 'subject'; $sortOrder = 'ASC'; break; case 'status': $sortColumn = 'status'; $sortOrder = 'DESC'; break; case 'priority': $sortColumn = 'priority'; $sortOrder = 'DESC'; break; case 'replies': $sortColumn = 'replies'; $sortOrder = 'DESC'; break; } if ($this->params->get('direction')) { $sortOrder = $this->params->get('direction'); } $filter_order = $mainframe->getUserStateFromRequest($option . '.tickets.filter_order', 'filter_order', $sortColumn); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.tickets.filter_order_Dir', 'filter_order_Dir', $sortOrder); $this->setState($option . '.tickets.filter_order', $filter_order); $this->setState($option . '.tickets.filter_order_Dir', $filter_order_Dir); $this->_query = $this->_buildQuery(); }
/** * This method should handle any login logic and report back to the subject * * @access public * @param array holds the user data * @param array extra options * @return boolean True on success * @since 1.5 */ function onLoginUser($user, $options = array()) { // Initialize variables $success = true; jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsticketspro' . DS . 'helpers' . DS . 'rsticketspro.php')) { return $success; } require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsticketspro' . DS . 'helpers' . DS . 'rsticketspro.php'; $session =& JFactory::getSession(); if (RSTicketsProHelper::isJ16()) { jimport('joomla.user.helper'); if (isset($user['username'])) { $user_id = JUserHelper::getUserId($user['username']); $logged_user = JFactory::getUser($user_id); } else { $logged_user = JFactory::getUser(); } } else { $logged_user = JFactory::getUser(); } $db = JFactory::getDBO(); $user_id = $logged_user->get('id'); // is staff $db->setQuery("SELECT group_id FROM #__rsticketspro_staff WHERE user_id='" . (int) $user_id . "'"); $group_id = $db->loadResult(); $is_staff = !empty($group_id); if (!$is_staff) { if (RSTicketsProHelper::isJ16()) { $admin_groups = RSTicketsProHelper::getAdminGroups(); $user_groups = $logged_user->getAuthorisedGroups(); foreach ($user_groups as $user_group_id) { if (in_array($user_group_id, $admin_groups)) { $is_staff = true; break; } } } else { $is_staff = $logged_user->get('gid') == 23 || $logged_user->get('gid') == 25 || $logged_user->get('gid') == 24; } } $session->set('rsticketspro.is_staff', $is_staff); // permissions and department if ($is_staff) { // permissions if ($group_id) { $db->setQuery("SELECT * FROM #__rsticketspro_groups WHERE id='" . (int) $group_id . "'"); $permissions = $db->loadObject(); } else { // JTable::getInstance('RSTicketsPro_Groups','Table'); $permissions = new stdClass(); $permissions->name = ''; $permissions->add_ticket = 1; $permissions->add_ticket_customers = 1; $permissions->add_ticket_staff = 1; $permissions->update_ticket = 1; $permissions->update_ticket_custom_fields = 1; $permissions->delete_ticket = 1; $permissions->answer_ticket = 1; $permissions->update_ticket_replies = 1; $permissions->update_ticket_replies_customers = 1; $permissions->update_ticket_replies_staff = 1; $permissions->delete_ticket_replies_customers = 1; $permissions->delete_ticket_replies_staff = 1; $permissions->delete_ticket_replies = 1; $permissions->assign_tickets = 1; $permissions->change_ticket_status = 1; $permissions->see_unassigned_tickets = 1; $permissions->see_other_tickets = 1; $permissions->move_ticket = 1; $permissions->view_notes = 1; $permissions->add_note = 1; $permissions->update_note = 1; $permissions->update_note_staff = 1; $permissions->delete_note = 1; $permissions->delete_note_staff = 1; } $session->set('rsticketspro.permissions', $permissions); $db->setQuery("SELECT department_id FROM #__rsticketspro_staff_to_department WHERE user_id='" . (int) $user_id . "'"); $departments = $db->loadResultArray(); if (empty($departments)) { $db->setQuery("SELECT id FROM #__rsticketspro_departments"); $departments = $db->loadResultArray(); } $session->set('rsticketspro.departments', $departments); // searches $db->setQuery("SELECT * FROM #__rsticketspro_searches WHERE user_id='" . (int) $user_id . "' AND `default`='1'"); $search = $db->loadObject(); if (!empty($search)) { $params = unserialize(base64_decode($search->params)); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $session->set($option . '.ticketsfilter.rsticketspro_search', 1); $mainframe->setUserState($option . '.ticketsfilter.rsticketspro_search', '1'); $mainframe->setUserState($option . '.ticketsfilter.filter_word', $params['filter_word']); $mainframe->setUserState($option . '.ticketsfilter.customer', $params['customer']); $mainframe->setUserState($option . '.ticketsfilter.staff', $params['staff']); $mainframe->setUserState($option . '.ticketsfilter.department_id', $params['department_id']); $mainframe->setUserState($option . '.ticketsfilter.priority_id', $params['priority_id']); $mainframe->setUserState($option . '.ticketsfilter.status_id', $params['status_id']); $mainframe->setUserState($option . '.ticketsfilter.predefined_search', $search->id); } } return $success; }
function getCurrentDate($date = null) { $config = new JConfig(); if (RSTicketsProHelper::isJ16()) { $config = JFactory::getConfig(); date_default_timezone_set($config->get('offset')); $unix = $date; } else { $date = JFactory::getDate($date, -$config->offset); $unix = $date->toUnix(); } return $unix; }