function getCommentsBlock() { $article =& $this->article; switch (RSTicketsProHelper::getConfig('kb_comments')) { //RSComments case 'com_rscomments': if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_rscomments' . DS . 'helpers' . DS . 'rscomments.php')) { require_once JPATH_SITE . DS . 'components' . DS . 'com_rscomments' . DS . 'helpers' . DS . 'rscomments.php'; return '{rscomments option="com_rsticketspro" id="' . $article->id . '"}'; } break; //JComments //JComments case 'com_jcomments': if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php')) { require_once JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php'; return JComments::showComments($article->id, 'com_rsticketspro', $article->name); } break; //JomComment //JomComment case 'com_jomcomment': if (file_exists(JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php')) { require_once JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php'; return jomcomment($article->id, 'com_rsticketspro'); } break; // Facebook // Facebook case 'facebook': return '<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><div id="fb-root"></div><fb:comments href="' . RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=article&cid=' . $article->id . ':' . JFilterOutput::stringURLSafe($article->name)) . '" num_posts="5" width="700"></fb:comments>'; break; } return ''; }
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 isHot($hits) { if (empty($this->hot_hits)) { $this->hot_hits = RSTicketsProHelper::getConfig('kb_hot_hits'); } return $hits >= $this->hot_hits; }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $this->assignRef('row', $this->get('row')); $this->assign('use_editor', RSTicketsProHelper::getConfig('allow_rich_editor')); $this->assignRef('editor', JFactory::getEditor()); parent::display(); }
function _buildQuery() { $mainframe =& JFactory::getApplication(); $ticket_id = JRequest::getInt('ticket_id'); $what = RSTicketsProHelper::getConfig('show_user_info'); $query = "SELECT h.*, u." . $this->_db->getEscaped($what) . " AS user FROM #__rsticketspro_ticket_history h LEFT JOIN #__users u ON (h.user_id = u.id) WHERE h.ticket_id='" . $ticket_id . "'"; $query .= " ORDER BY h.date DESC"; return $query; }
function save() { $row = $this->getRow(); $post = JRequest::get('post'); $post['message'] = JRequest::getVar('message', '', 'post', 'none', JREQUEST_ALLOWHTML); if (!RSTicketsProHelper::getConfig('allow_rich_editor')) { $post['message'] = htmlspecialchars($post['message'], ENT_COMPAT, 'utf-8'); } $row->message = $post['message']; $row->store(); }
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 display($tpl = null) { JToolBarHelper::title('RSTickets! Pro', 'rsticketspro'); JSubMenuHelper::addEntry(JText::_('RST_BACK_TO_RSTICKETSPRO'), 'index.php?option=com_rsticketspro'); JSubMenuHelper::addEntry(JText::_('RST_KNOWLEDGEBASE'), 'index.php?option=com_rsticketspro&view=knowledgebase', true); JSubMenuHelper::addEntry(JText::_('RST_KB_CATEGORIES'), 'index.php?option=com_rsticketspro&view=kbcategories'); JSubMenuHelper::addEntry(JText::_('RST_KB_ARTICLES'), 'index.php?option=com_rsticketspro&view=kbcontent'); JSubMenuHelper::addEntry(JText::_('RST_KB_CONVERSION_RULES'), 'index.php?option=com_rsticketspro&view=kbrules'); $this->assign('code', RSTicketsProHelper::getConfig('global_register_code')); parent::display($tpl); parent::display('version'); }
function reopen() { $mainframe =& JFactory::getApplication(); $model = $this->getModel('ticket'); $url = RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=ticket&cid=' . $model->_ticket->id . ':' . JFilterOutput::stringURLSafe($model->_ticket->subject), false); $can_open = $model->is_staff ? $model->_permissions->change_ticket_status : RSTicketsProHelper::getConfig('allow_ticket_reopening'); $user = JFactory::getUser(); if ($model->_ticket->customer_id == $user->get('id')) { $can_open = RSTicketsProHelper::getConfig('allow_ticket_reopening'); } if (!$can_open) { JError::raiseWarning(500, JText::_('RST_CANNOT_REOPEN_TICKET')); $mainframe->redirect($url); } $model->reopenTicket(); $mainframe->redirect($url, JText::_('RST_TICKET_REOPENED_OK')); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $this->assign('date_format', RSTicketsProHelper::getConfig('date_format')); $this->assign('permissions', $this->get('permissions')); $this->assign('ticket_id', JRequest::getInt('ticket_id')); $task = JRequest::getCmd('task'); if ($task == 'edit') { $this->assignRef('row', $this->get('note')); } else { $this->assign('avatar', RSTicketsProHelper::getConfig('avatars')); $this->assignRef('notes', $this->get('notes')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('limitstart', JRequest::getInt('limitstart', 0)); } parent::display(); }
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 display($tpl = null) { $mainframe =& JFactory::getApplication(); JToolBarHelper::title('RSTickets! Pro', 'rsticketspro'); JSubMenuHelper::addEntry(JText::_('RST_MANAGE_TICKETS'), 'index.php?option=com_rsticketspro&view=tickets'); JSubMenuHelper::addEntry(JText::_('RST_DEPARTMENTS'), 'index.php?option=com_rsticketspro&view=departments'); JSubMenuHelper::addEntry(JText::_('RST_GROUPS'), 'index.php?option=com_rsticketspro&view=groups'); JSubMenuHelper::addEntry(JText::_('RST_STAFF_MEMBERS'), 'index.php?option=com_rsticketspro&view=staff'); JSubMenuHelper::addEntry(JText::_('RST_PRIORITIES'), 'index.php?option=com_rsticketspro&view=priorities'); JSubMenuHelper::addEntry(JText::_('RST_STATUSES'), 'index.php?option=com_rsticketspro&view=statuses'); JSubMenuHelper::addEntry(JText::_('RST_KNOWLEDGEBASE'), 'index.php?option=com_rsticketspro&view=knowledgebase'); JSubMenuHelper::addEntry(JText::_('RST_EMAIL_MESSAGES'), 'index.php?option=com_rsticketspro&view=emails'); JSubMenuHelper::addEntry(JText::_('RST_CONFIGURATION'), 'index.php?option=com_rsticketspro&view=configuration'); $mainframe->triggerEvent('onAfterTicketsMenu'); JSubMenuHelper::addEntry(JText::_('RST_UPDATES'), 'index.php?option=com_rsticketspro&view=updates'); $this->assign('code', RSTicketsProHelper::getConfig('global_register_code')); parent::display($tpl); parent::display('version'); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); JToolBarHelper::title('RSTickets! Pro', 'rsticketspro'); JSubMenuHelper::addEntry(JText::_('RST_BACK_TO_RSTICKETSPRO'), 'index.php?option=com_rsticketspro'); JSubMenuHelper::addEntry(JText::_('RST_KNOWLEDGEBASE'), 'index.php?option=com_rsticketspro&view=knowledgebase'); JSubMenuHelper::addEntry(JText::_('RST_KB_CATEGORIES'), 'index.php?option=com_rsticketspro&view=kbcategories'); JSubMenuHelper::addEntry(JText::_('RST_KB_ARTICLES'), 'index.php?option=com_rsticketspro&view=kbcontent'); JSubMenuHelper::addEntry(JText::_('RST_KB_CONVERSION_RULES'), 'index.php?option=com_rsticketspro&view=kbrules'); JSubMenuHelper::addEntry(JText::_('RST_KB_TEMPLATE'), 'index.php?option=com_rsticketspro&view=kbtemplate', true); JToolBarHelper::apply('applykbtemplate'); JToolBarHelper::save('savekbtemplate'); JToolBarHelper::cancel('cancelkbtemplate'); $editor =& JFactory::getEditor(); $this->assignRef('editor', $editor); $config = RSTicketsProHelper::getConfig(); $this->assignRef('config', $config); parent::display($tpl); }
function sendUserEmail(&$user, $password) { $mainframe =& JFactory::getApplication(); $lang = JFactory::getLanguage(); $lang->load('com_rsticketspro', JPATH_SITE); // get email sending settings $from = RSTicketsProHelper::getConfig('email_address'); $fromname = RSTicketsProHelper::getConfig('email_address_fullname'); // are we using global ? if (RSTicketsProHelper::getConfig('email_use_global')) { $config = new JConfig(); $from = $config->mailfrom; $fromname = $config->fromname; } $email = RSTicketsProHelper::getEmail('new_user_email'); $replace = array('{live_site}', '{username}', '{password}', '{email}'); $with = array(JURI::root(), $user->get('username'), $password, $user->get('email')); $email_subject = $email->subject; $email_message = str_replace($replace, $with, $email->message); JUtility::sendMail($from, $fromname, $user->get('email'), $email_subject, $email_message, 1); }
function captcha() { $captcha_enabled = RSTicketsProHelper::getConfig('captcha_enabled'); if (!$captcha_enabled) { return false; } ob_end_clean(); if ($captcha_enabled == 1) { $captcha = new JSecurImage(); $captcha_lines = RSTicketsProHelper::getConfig('captcha_lines'); if ($captcha_lines) { $captcha->num_lines = 8; } else { $captcha->num_lines = 0; } $captcha_characters = RSTicketsProHelper::getConfig('captcha_characters'); $captcha->code_length = $captcha_characters; $captcha->image_width = 30 * $captcha_characters + 50; $captcha->show(); } die; }
<?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.tooltip'); JHTML::_('behavior.modal'); ?> <?php echo RSTicketsProHelper::getConfig('global_message'); echo RSTicketsProHelper::getConfig('submit_message'); ?> <form action="<?php echo JRoute::_('index.php?option=com_rsticketspro&view=submit'); ?> " method="post" name="adminForm" id="adminForm" enctype="multipart/form-data"> <table class="admintable"> <?php if ($this->is_staff && ($this->permissions->add_ticket_customers || $this->permissions->add_ticket_staff)) { ?> <tr> <td width="150" style="width: 150px;" align="right" class="key"> </td> <td><input type="radio" name="submit_type" id="submit_type0" onclick="rst_change_submit_type();" value="1" <?php echo $this->checked_create_new_user ? 'checked="checked"' : '';
/** * Gets the challenge HTML (javascript and non-javascript version). * This is called from the browser, and the resulting reCAPTCHA HTML widget * is embedded within the HTML form it was called from. * @param string $pubkey A public key for reCAPTCHA * @param string $error The error given by reCAPTCHA (optional, default is null) * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) * @return string - The HTML to be embedded in the user's form. */ function getHTML($error = null, $use_ssl = false) { $pubkey = RSTicketsProHelper::getConfig('recaptcha_public_key'); if ($pubkey == null || $pubkey == '') { echo "To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>"; return; } $return = ' <script type="text/javascript">var RecaptchaOptions = { theme : \'' . RSTicketsProHelper::getConfig('recaptcha_theme') . '\' };</script>'; $jconfig = new JConfig(); $use_ssl = $jconfig->force_ssl == 2; if ($use_ssl) { $server = RST_RECAPTCHA_API_SECURE_SERVER; } else { $server = RST_RECAPTCHA_API_SERVER; } $errorpart = ""; if ($error) { $errorpart = "&error=" . $error; } $return .= '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> <noscript> <iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> </noscript>'; return $return; }
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(); }
</td> </tr> <tr> <td width="300" style="width: 300px;" align="right" class="key"> <span class="hasTip" title="<?php echo JText::_('RST_PREDEFINED_SUBJECTS_ADD_DESC'); ?> "> <?php echo JText::_('RST_PREDEFINED_SUBJECTS_ADD'); ?> </span> </td> <td> <?php if (!RSTicketsProHelper::getConfig('allow_predefined_subjects')) { ?> <p><?php echo JText::_('RST_PREDEFINED_SUBJECTS_ARE_DISABLED'); ?> </p> <?php } ?> <textarea name="predefined_subjects" id="predefined_subjects" cols="90" rows="10"><?php echo $this->escape($this->row->predefined_subjects); ?> </textarea> </td> </tr> </table>
function display($tpl = null) { $mainframe =& JFactory::getApplication(); JToolBarHelper::title('RSTickets! Pro', 'rsticketspro'); JSubMenuHelper::addEntry(JText::_('RST_MANAGE_TICKETS'), 'index.php?option=com_rsticketspro&view=tickets'); JSubMenuHelper::addEntry(JText::_('RST_DEPARTMENTS'), 'index.php?option=com_rsticketspro&view=departments'); JSubMenuHelper::addEntry(JText::_('RST_GROUPS'), 'index.php?option=com_rsticketspro&view=groups'); JSubMenuHelper::addEntry(JText::_('RST_STAFF_MEMBERS'), 'index.php?option=com_rsticketspro&view=staff'); JSubMenuHelper::addEntry(JText::_('RST_PRIORITIES'), 'index.php?option=com_rsticketspro&view=priorities'); JSubMenuHelper::addEntry(JText::_('RST_STATUSES'), 'index.php?option=com_rsticketspro&view=statuses'); JSubMenuHelper::addEntry(JText::_('RST_KNOWLEDGEBASE'), 'index.php?option=com_rsticketspro&view=knowledgebase'); JSubMenuHelper::addEntry(JText::_('RST_EMAIL_MESSAGES'), 'index.php?option=com_rsticketspro&view=emails'); JSubMenuHelper::addEntry(JText::_('RST_CONFIGURATION'), 'index.php?option=com_rsticketspro&view=configuration', true); $mainframe->triggerEvent('onAfterTicketsMenu'); JSubMenuHelper::addEntry(JText::_('RST_UPDATES'), 'index.php?option=com_rsticketspro&view=updates'); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); $config = RSTicketsProHelper::getConfig(); $this->assignRef('config', $config); // General $lists['allow_rich_editor'] = JHTML::_('select.booleanlist', 'allow_rich_editor', 'class="inputbox"', $config->allow_rich_editor); $lists['show_kb_search'] = JHTML::_('select.booleanlist', 'show_kb_search', 'class="inputbox"', $config->show_kb_search); $lists['show_signature'] = JHTML::_('select.booleanlist', 'show_signature', 'class="inputbox"', $config->show_signature); $lists['rsticketspro_link'] = JHTML::_('select.booleanlist', 'rsticketspro_link', 'class="inputbox"', $config->rsticketspro_link); $lists['calculate_itemids'] = JHTML::_('select.booleanlist', 'calculate_itemids', 'class="inputbox"', $config->calculate_itemids); //$lists['css_inherit'] = JHTML::_('select.booleanlist','css_inherit','class="inputbox" onclick="rst_enable_designs(this.value)"',$config->css_inherit); $designs = $this->get('designs'); //$lists['css_design'] = JHTML::_('select.genericlist', $designs, 'css_design', 'class="inputbox"'.($config->css_inherit ? ' disabled="disabled"' : ''), 'value', 'text', $config->css_design); $lists['staff_force_departments'] = JHTML::_('select.booleanlist', 'staff_force_departments', 'class="inputbox"', $config->staff_force_departments); // Tickets $rsticketspro_add_tickets = array(JHTML::_('select.option', '1', JText::_('RST_EVERYONE')), JHTML::_('select.option', '0', JText::_('RST_REGISTERED'))); $lists['rsticketspro_add_tickets'] = JHTML::_('select.genericlist', $rsticketspro_add_tickets, 'rsticketspro_add_tickets', '', 'value', 'text', $config->rsticketspro_add_tickets); $lists['show_email_link'] = JHTML::_('select.booleanlist', 'show_email_link', 'class="inputbox"', $config->show_email_link); $lists['show_ticket_info'] = JHTML::_('select.booleanlist', 'show_ticket_info', 'class="inputbox"', $config->show_ticket_info); $lists['show_ticket_voting'] = JHTML::_('select.booleanlist', 'show_ticket_voting', 'class="inputbox"', $config->show_ticket_voting); $lists['allow_ticket_closing'] = JHTML::_('select.booleanlist', 'allow_ticket_closing', 'class="inputbox"', $config->allow_ticket_closing); $lists['allow_ticket_reopening'] = JHTML::_('select.booleanlist', 'allow_ticket_reopening', 'class="inputbox"', $config->allow_ticket_reopening); $ticket_view = array(JHTML::_('select.option', 'plain', JText::_('RST_TICKET_VIEW_PLAIN')), JHTML::_('select.option', 'tabbed', JText::_('RST_TICKET_VIEW_TABBED'))); $lists['ticket_view'] = JHTML::_('select.genericlist', $ticket_view, 'ticket_view', 'class="inputbox"', 'value', 'text', $config->ticket_view); $ticket_viewing_history = array(JHTML::_('select.option', 0, JText::_('RST_TICKET_VIEWING_HISTORY_DISABLE')), JHTML::_('select.option', 1, JText::_('RST_TICKET_VIEWING_HISTORY_STAFF')), JHTML::_('select.option', 2, JText::_('RST_TICKET_VIEWING_HISTORY_CUSTOMER'))); $lists['ticket_viewing_history'] = JHTML::_('select.genericlist', $ticket_viewing_history, 'ticket_viewing_history', 'class="inputbox"', 'value', 'text', $config->ticket_viewing_history); $user_info = array(JHTML::_('select.option', 'name', JText::_('RST_NAME')), JHTML::_('select.option', 'username', JText::_('RST_USERNAME')), JHTML::_('select.option', 'email', JText::_('RST_EMAIL'))); $lists['show_user_info'] = JHTML::_('select.genericlist', $user_info, 'show_user_info', 'class="inputbox"', 'value', 'text', $config->show_user_info); // Messages direction $items = array(JHTML::_('select.option', 'ASC', JText::_('RST_MESSAGES_ASC')), JHTML::_('select.option', 'DESC', JText::_('RST_MESSAGES_DESC'))); $lists['messages_direction'] = JHTML::_('select.genericlist', $items, 'messages_direction', 'class="inputbox"', 'value', 'text', $config->messages_direction); $lists['color_whole_ticket'] = JHTML::_('select.booleanlist', 'color_whole_ticket', 'class="inputbox"', $config->color_whole_ticket); // Avatars $avatars = $this->get('avatarsavailable'); $avatars_array = array(JHTML::_('select.option', '', JText::_('RST_NO_AVATARS_COMPONENT'), 'value', 'text')); foreach ($avatars as $component => $enabled) { $avatars_array[] = JHTML::_('select.option', $component, JText::_('RST_' . strtoupper($component)), 'value', 'text', $enabled ? false : true); } $lists['avatars'] = JHTML::_('select.genericlist', $avatars_array, 'avatars', '', 'value', 'text', $config->avatars); // CAPTCHA $captcha = array(JHTML::_('select.option', 0, JText::_('No')), JHTML::_('select.option', 1, JText::_('RST_USE_BUILTIN_CAPTCHA')), JHTML::_('select.option', 2, JText::_('RST_USE_RECAPTCHA'))); $lists['captcha_enabled'] = JHTML::_('select.genericlist', $captcha, 'captcha_enabled', 'class="inputbox" onchange="rst_captcha_enable(this.value);" onclick="rst_captcha_enable(this.value);"', 'value', 'text', $config->captcha_enabled); $lists['captcha_enabled_for'] = ''; $captcha_enabled_for = explode(',', $config->captcha_enabled_for); $lists['captcha_enabled_for'] .= '<input type="checkbox" ' . ($captcha_enabled_for[0] ? 'checked="checked"' : '') . ' ' . ($config->captcha_enabled ? '' : 'disabled="disabled"') . ' name="captcha_enabled_for_unregistered" value="1" id="captcha_enabled_for0" /> <label for="captcha_enabled_for0">' . JText::_('RST_CAPTCHA_UNREGISTERED') . '</label>'; $lists['captcha_enabled_for'] .= '<input type="checkbox" ' . ($captcha_enabled_for[1] ? 'checked="checked"' : '') . ' ' . ($config->captcha_enabled ? '' : 'disabled="disabled"') . ' name="captcha_enabled_for_customers" value="1" id="captcha_enabled_for1" /> <label for="captcha_enabled_for1">' . JText::_('RST_CAPTCHA_CUSTOMERS') . '</label>'; $lists['captcha_enabled_for'] .= '<input type="checkbox" ' . ($captcha_enabled_for[2] ? 'checked="checked"' : '') . ' ' . ($config->captcha_enabled ? '' : 'disabled="disabled"') . ' name="captcha_enabled_for_staff" value="1" id="captcha_enabled_for2" /> <label for="captcha_enabled_for2">' . JText::_('RST_CAPTCHA_STAFF') . '</label>'; $lists['captcha_lines'] = JHTML::_('select.booleanlist', 'captcha_lines', 'class="inputbox"' . ($config->captcha_enabled != 1 ? ' disabled="disabled"' : ''), $config->captcha_lines); $lists['captcha_case_sensitive'] = JHTML::_('select.booleanlist', 'captcha_case_sensitive', 'class="inputbox"' . ($config->captcha_enabled != 1 ? ' disabled="disabled"' : ''), $config->captcha_case_sensitive); $themes = array(JHTML::_('select.option', 'red', JText::_('RST_RECAPTCHA_THEME_RED')), JHTML::_('select.option', 'white', JText::_('RST_RECAPTCHA_THEME_WHITE')), JHTML::_('select.option', 'blackglass', JText::_('RST_RECAPTCHA_THEME_BLACKGLASS')), JHTML::_('select.option', 'clean', JText::_('RST_RECAPTCHA_THEME_CLEAN'))); $lists['recaptcha_theme'] = JHTML::_('select.genericlist', $themes, 'recaptcha_theme', 'class="inputbox"' . ($config->captcha_enabled != 2 ? ' disabled="disabled"' : ''), 'value', 'text', $config->recaptcha_theme); // Email $lists['email_use_global'] = JHTML::_('select.booleanlist', 'email_use_global', 'class="inputbox" onclick="rst_email_enable(this.value)"', $config->email_use_global); // Autoclose $lists['autoclose_enabled'] = JHTML::_('select.booleanlist', 'autoclose_enabled', 'class="inputbox" onclick="rst_autoclose_enable(this.value);"', $config->autoclose_enabled); // Comments $lists['kb_comments'] = JHTML::_('select.genericlist', $this->get('commentoptions'), 'kb_comments', 'class="inputbox"', 'value', 'text', $config->kb_comments); // Predefined Subjects $lists['allow_predefined_subjects'] = JHTML::_('select.booleanlist', 'allow_predefined_subjects', 'class="inputbox"', $config->allow_predefined_subjects); // Time Spent $lists['enable_time_spent'] = JHTML::_('select.booleanlist', 'enable_time_spent', 'class="inputbox" onclick="rst_time_spent_enable(this.value);"', $config->enable_time_spent); $units = array(JHTML::_('select.option', 'm', JText::_('RST_TIME_UNIT_MINUTES')), JHTML::_('select.option', 'h', JText::_('RST_TIME_UNIT_HOURS')), JHTML::_('select.option', 'd', JText::_('RST_TIME_UNIT_DAYS'))); $lists['time_spent_unit'] = JHTML::_('select.genericlist', $units, 'time_spent_unit', 'class="inputbox"' . (!$config->enable_time_spent ? ' disabled="disabled"' : ''), 'value', 'text', $config->time_spent_unit); $params = array(); $params['startOffset'] = JRequest::getInt('tabposition', 0); $tabs =& JPane::getInstance('Tabs', $params, true); $this->assignRef('tabs', $tabs); $this->assignRef('editor', JFactory::getEditor()); $this->assignRef('lists', $lists); parent::display($tpl); }
function _buildQuery() { $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $this->_db->setQuery("SELECT VERSION()"); $mysql_version = $this->_db->loadResult(); $what = RSTicketsProHelper::getConfig('show_user_info'); $cusername = $what == 'username' ? 'c.username AS customer' : 'c.username'; $cname = $what == 'name' ? 'c.name AS customer' : 'c.name'; $cemail = $what == 'email' ? 'c.email AS customer' : 'c.email'; $susername = $what == 'username' ? 's.username AS staff' : 's.username'; $sname = $what == 'name' ? 's.name AS staff' : 's.name'; $semail = $what == 'email' ? 's.email AS staff' : 's.email'; $query = "SELECT t.*, {$cusername}, {$cname}, {$cemail}, {$susername}, {$sname}, {$semail}, st.name AS status, pr.name AS priority FROM #__rsticketspro_tickets t LEFT JOIN #__users c ON (t.customer_id = c.id) LEFT JOIN #__users s ON (t.staff_id = s.id) LEFT JOIN #__rsticketspro_statuses st ON (st.id = t.status_id) LEFT JOIN #__rsticketspro_priorities pr ON (pr.id = t.priority_id) WHERE 1"; $user = JFactory::getUser(); // staff member ? $this->is_staff = RSTicketsProHelper::isStaff(); if ($this->is_staff) { $departments = RSTicketsProHelper::getCurrentDepartments(); // do we have a filter set ? $show_filter = $this->params->get('show_filter'); if ($show_filter) { switch ($show_filter) { case 'show_assigned': $query .= " AND staff_id = '" . (int) $user->get('id') . "'"; break; case 'show_submitted': $query .= " AND customer_id = '" . (int) $user->get('id') . "'"; break; case 'show_both': $query .= " AND (staff_id = '" . (int) $user->get('id') . "' OR customer_id = '" . (int) $user->get('id') . "')"; break; case 'show_unassigned': $query .= " AND staff_id = 0"; break; } } // detect current permissions $this->_permissions = RSTicketsProHelper::getCurrentPermissions(); // can see unassigned tickets ? if (!$this->_permissions->see_unassigned_tickets) { $query .= " AND staff_id > 0"; } // can see other (assigned) tickets ? if (!$this->_permissions->see_other_tickets) { $query .= " AND staff_id IN (0," . (int) $user->get('id') . ")"; } $flagged = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.flagged', 'flagged', 0, 'int'); if ($flagged) { $query .= " AND flagged='1'"; } } else { $query .= " AND customer_id = '" . (int) $user->get('id') . "'"; } $priority_id = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.priority_id', 'priority_id', array(0), 'array'); JArrayHelper::toInteger($priority_id, array(0)); if ($this->params->get('default_priority') && $priority_id[0] == 0) { $default_priority = $this->params->get('default_priority'); if (is_array($default_priority)) { $default_priority = implode(',', $default_priority); } $query .= " AND priority_id IN (" . $default_priority . ")"; } $status_id = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.status_id', 'status_id', array(0), 'array'); JArrayHelper::toInteger($status_id, array(0)); if ($this->params->get('default_status') && $status_id[0] == 0) { $default_status = $this->params->get('default_status'); if (is_array($default_status)) { $default_status = implode(',', $default_status); } $query .= " AND status_id IN (" . $default_status . ")"; } // are we searching ? //$task = $mainframe->getUserStateFromRequest($option.'.ticketsfilter.rsticketspro_search', 'task', '', 'int'); $task = JRequest::getCmd('task'); if ($task == 'search') { $session = JFactory::getSession(); $session->set($option . '.ticketsfilter.rsticketspro_search', 1); } $filter_word = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.filter_word', 'filter_word', ''); if ($filter_word) { $this->setState($option . '.ticketsfilter.filter_word', $filter_word); $filter_word = str_replace('%', '\\%', $filter_word); $filter_word = str_replace(' ', '%', $filter_word); $filter_word = $this->_db->getEscaped($filter_word); if (version_compare($mysql_version, '4.1', '<')) { $this->_db->setQuery("SELECT ticket_id FROM #__rsticketspro_ticket_messages WHERE message LIKE '%" . $filter_word . "%'"); $ticket_ids = $this->_db->loadResultArray(); if (empty($ticket_ids)) { $ticket_ids = array(0); } $query .= " AND (code LIKE '%" . $filter_word . "%' OR subject LIKE '%" . $filter_word . "%' OR t.id IN (" . implode(',', $ticket_ids) . "))"; } else { $query .= " AND (code LIKE '%" . $filter_word . "%' OR subject LIKE '%" . $filter_word . "%' OR t.id IN (SELECT ticket_id FROM #__rsticketspro_ticket_messages WHERE message LIKE '%" . $filter_word . "%'))"; } } $customer = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.customer', 'customer', '', 'string'); if ($customer && is_string($customer)) { $this->setState($option . '.ticketsfilter.customer', $customer); $customer = str_replace('%', '\\%', $customer); $customer = str_replace(' ', '%', $customer); $customer = $this->_db->getEscaped($customer); $query .= " AND (c.username LIKE '%" . $customer . "%' OR c.name LIKE '%" . $customer . "%' OR c.email LIKE '%" . $customer . "%')"; } $staff = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.staff', 'staff', ''); if (($staff || $staff === '0') && !is_object($staff) && !is_array($staff)) { $this->setState($option . '.ticketsfilter.staff', $staff); $staff = str_replace('%', '\\%', $staff); $staff = str_replace(' ', '%', $staff); $staff = $this->_db->getEscaped($staff); if ($staff === '0') { $query .= " AND staff_id = 0"; } else { $query .= " AND (s.username LIKE '%" . $staff . "%' OR s.name LIKE '%" . $staff . "%' OR s.email LIKE '%" . $staff . "%')"; } } $department_id = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.department_id', 'department_id', array(0), 'array'); JArrayHelper::toInteger($department_id, array(0)); if (@$department_id[0] != 0) { $query .= " AND department_id IN (" . implode(',', $department_id) . ")"; } if ($this->is_staff && !empty($departments)) { if ($show_filter != 'show_assigned' && $show_filter != 'show_unassigned') { $query .= " AND (department_id IN (" . implode(',', $departments) . ") OR customer_id='" . $user->get('id') . "')"; } else { $query .= " AND department_id IN (" . implode(',', $departments) . ")"; } } $this->setState($option . '.ticketsfilter.department_id', $department_id); if ($priority_id) { if ($priority_id[0] != 0) { $query .= " AND priority_id IN (" . implode(',', $priority_id) . ")"; } $this->setState($option . '.ticketsfilter.priority_id', $priority_id); } if ($status_id) { if ($status_id[0] != 0) { $query .= " AND status_id IN (" . implode(',', $status_id) . ")"; } $this->setState($option . '.ticketsfilter.status_id', $status_id); } // end search check $sortColumn = $this->_db->getEscaped($this->getSortColumn()); $sortOrder = $this->_db->getEscaped($this->getSortOrder()); $query .= " ORDER BY " . $sortColumn . " " . $sortOrder; return $query; }
function getUseRecaptcha() { $captcha_enabled = RSTicketsProHelper::getConfig('captcha_enabled'); return $captcha_enabled == 2; }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); if ($mainframe->isSite()) { $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); } $row = $this->get('ticket'); $this->assignRef('row', $row); $this->assign('date_format', RSTicketsProHelper::getConfig('date_format')); $this->assign('show_ticket_info', RSTicketsProHelper::getConfig('show_ticket_info')); $this->assign('show_ticket_voting', RSTicketsProHelper::getConfig('show_ticket_voting')); $this->assign('what', RSTicketsProHelper::getConfig('show_user_info')); $this->assign('avatar', RSTicketsProHelper::getConfig('avatars')); $this->assign('show_email_link', RSTicketsProHelper::getConfig('show_email_link')); $this->assign('show_signature', RSTicketsProHelper::getConfig('show_signature')); $this->assign('show_kb_search', RSTicketsProHelper::getConfig('show_kb_search')); $this->assign('show_time_spent', RSTicketsProHelper::getConfig('enable_time_spent')); $this->assign('time_spent_unit', JText::_('RST_TIME_UNIT_' . strtoupper(RSTicketsProHelper::getConfig('time_spent_unit')))); $this->assign('permissions', $this->get('permissions')); $is_staff = RSTicketsProHelper::isStaff(); $this->assign('is_staff', $is_staff); $this->assign('can_upload', $this->get('canupload')); $this->assign('can_update', $this->get('canupdate')); $this->assign('can_update_custom_fields', $this->get('canupdatecustomfields')); $this->assign('data', $this->get('data')); $this->assign('use_editor', RSTicketsProHelper::getConfig('allow_rich_editor')); $this->assignRef('editor', JFactory::getEditor()); $editor_javascript = "document.getElementById('message').innerHTML = content.replace(/<(.*?)>/g, '');"; if ($this->use_editor) { // fix for JCE if ($this->editor->get('_name') == 'jce') { $editor_javascript = str_replace("'content'", 'content', $this->editor->setContent('message', 'content')); } elseif ($this->editor->get('_name') == 'jckeditor') { $editor_javascript = str_replace(array('(!oEditor) ', "'content'"), array('(!oEditor) ? ', 'content'), $this->editor->setContent('message', 'content')) . "\n"; } else { $editor_javascript = $this->editor->setContent('message', 'content'); } } else { $editor_javascript = str_replace('innerHTML', 'value', $editor_javascript); } $this->assign('editor_javascript', $editor_javascript); $this->assign('show_footer', $this->get('showfooter')); $this->assign('footer', $this->get('footer')); $this->assign('do_print', JRequest::getInt('print', 0)); $this->assignRef('department', $this->get('department')); if ($is_staff) { $status = RSTicketsProHelper::getStatuses(); $lists['status'] = JHTML::_('select.genericlist', $status, 'status_id', '', 'value', 'text', $row->status_id); $priority = RSTicketsProHelper::getPriorities(); $lists['priority'] = JHTML::_('select.genericlist', $priority, 'priority_id', '', 'value', 'text', $row->priority_id); $department = RSTicketsProHelper::getDepartments(); $lists['department'] = JHTML::_('select.genericlist', $department, 'department_id', '', 'value', 'text', $row->department_id); $staff = RSTicketsProHelper::getStaff(); $unassigned[] = JHTML::_('select.option', 0, JText::_('RST_UNASSIGNED')); $staff = array_merge($unassigned, $staff); $lists['staff'] = JHTML::_('select.genericlist', $staff, 'staff_id', '', 'value', 'text', $row->staff_id); $this->assignRef('lists', $lists); $this->assign('history_tickets', $this->get('HistoryTickets')); } $ticket_view = RSTicketsProHelper::getConfig('ticket_view'); $this->assign('ticket_view', $ticket_view); if ($ticket_view == 'tabbed') { jimport('joomla.html.pane'); $tabparams = array(); $tabparams['startOffset'] = JRequest::getInt('tabposition', 0); $tabs =& JPane::getInstance('Tabs', $tabparams, true); $this->assignRef('tabs', $tabs); } $model = $this->getModel(); $model->addViewingHistory(); parent::display(); }
function history($ticket, $is_staff, $attribs = null) { $ticket_viewing_history = RSTicketsProHelper::getConfig('ticket_viewing_history'); if (!$ticket_viewing_history) { return; } if ($ticket_viewing_history == 1 && !$is_staff) { return; } $url = RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=history&ticket_id=' . $ticket->id . '&tmpl=component'); $img = JHTML::_('image.site', 'history.gif', '/components/com_rsticketspro/assets/images/', null, null, JText::_('RST_TICKET_VIEW_HISTORY')); $return = '<span class="hasTip" title="' . JText::_('RST_TICKET_VIEW_HISTORY_DESC') . '" ' . $attribs . '><a href="' . $url . '" class="modal rst_view_history" rel="{handler: \'iframe\', size: {x: 600, y: 475}, closeWithOverlay: false}"> ' . JText::_('RST_TICKET_VIEW_HISTORY') . '</a></span>'; return $return; }
if ($this->params->get('show_page_title', 1)) { ?> <div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?> "><?php echo $this->escape($this->row->subject); ?> </div> <?php } } ?> <?php echo RSTicketsProHelper::getConfig('global_message'); ?> <?php if ($this->ticket_view == 'plain' || $this->do_print) { ?> <div class="rsticketspro_halfbox rsticketspro_fullbox"> <?php echo $this->loadTemplate('reply'); ?> <div id="rsticketspro_accordion"> <?php echo $this->loadTemplate('info'); ?> <?php if ($this->show_time_spent) {
/** * Validate the code to the user code * * @access private * */ function validate() { // retrieve code from session $session = JFactory::getSession(); $code = $this->getCode(); if ($code != '' && $this->isCodeExpired()) { $code = ''; } $code_entered = $this->code_entered; if (!RSTicketsProHelper::getConfig('captcha_case_sensitive')) { $code = trim(strtolower($code)); $code_entered = trim(strtolower($code_entered)); } $this->correct_code = false; if ($code != '' && $code == $code_entered) { $this->correct_code = true; $session->set('com_rsticketspro.securimage.value', ''); $session->set('com_rsticketspro.securimage.ctime', ''); } }
function _getTicket() { $cid = JRequest::getInt('cid', 0); $row =& JTable::getInstance('RSTicketsPro_Tickets', 'Table'); $row->load($cid); $this->_db->setQuery("SELECT name FROM #__rsticketspro_departments WHERE id='" . (int) $row->department_id . "'"); $row->department = $this->_db->loadResult(); $this->_db->setQuery("SELECT name FROM #__rsticketspro_statuses WHERE id='" . (int) $row->status_id . "'"); $row->status = JText::_($this->_db->loadResult()); $this->_db->setQuery("SELECT name FROM #__rsticketspro_priorities WHERE id='" . (int) $row->priority_id . "'"); $row->priority = JText::_($this->_db->loadResult()); $row->staff = JFactory::getUser($row->staff_id); $row->customer = JFactory::getUser($row->customer_id); $what = RSTicketsProHelper::getConfig('show_user_info'); $what = $this->_db->getEscaped($what); $what_sql = "u." . $what . " AS user, u.email AS email"; $messages_direction = RSTicketsProHelper::getConfig('messages_direction'); $messages_direction = $messages_direction == 'ASC' ? 'ASC' : 'DESC'; $row->messages = $this->_getList("SELECT m.*, {$what_sql} FROM #__rsticketspro_ticket_messages m LEFT JOIN #__users u ON (m.user_id=u.id) WHERE `ticket_id`='" . (int) $row->id . "' ORDER BY `date` " . $messages_direction); $row->files = array(); $files = $this->_getList("SELECT * FROM #__rsticketspro_ticket_files WHERE ticket_id='" . $cid . "'"); foreach ($files as $file) { $row->files[$file->ticket_message_id][] = $file; } $row->custom_field_values = array(); $row->custom_fields = array(); $this->_db->setQuery("SELECT v.custom_field_id, v.value, cf.type, cf.name FROM #__rsticketspro_custom_fields_values v LEFT JOIN #__rsticketspro_custom_fields cf ON (cf.id = v.custom_field_id) WHERE v.ticket_id='" . $row->id . "'"); $custom_field_values = $this->_db->loadObjectList(); foreach ($custom_field_values as $custom_field_value) { if (in_array($custom_field_value->type, array('select', 'multipleselect', 'checkbox'))) { $custom_field_value->value = explode("\n", $custom_field_value->value); } $row->custom_field_values[$custom_field_value->name] = $custom_field_value->value; } $do_print = JRequest::getInt('print', 0); $editable = false; if ($this->is_staff && $this->_permissions->update_ticket_custom_fields && !$do_print) { $editable = true; } if (JRequest::getVar('task') == 'kbconvert') { $editable = false; } $this->_db->setQuery("SELECT * FROM #__rsticketspro_custom_fields WHERE `published`='1' AND department_id='" . (int) $row->department_id . "' ORDER BY `ordering`"); $custom_fields = $this->_db->loadObjectList(); foreach ($custom_fields as $field) { $row->custom_fields[] = RSTicketsProHelper::showCustomField($field, $row->custom_field_values, $editable); } $this->_db->setQuery("SELECT COUNT(id) FROM #__rsticketspro_ticket_notes WHERE ticket_id='" . $row->id . "'"); $row->notes = $this->_db->loadResult(); $this->_ticket = $row; unset($row); }
function getConfig() { return RSTicketsProHelper::getConfig(); }