* Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!$ticket_safe) { die('failed'); } $ticket_id = (int) $_REQUEST['ticket_id']; $ticket = module_ticket::get_ticket($ticket_id); if ($ticket['subject']) { $module->page_title = _l('Ticket: ' . htmlspecialchars($ticket['subject'])); } $admins_rel = module_ticket::get_ticket_staff_rel(); if (isset($admins_rel[module_security::get_loggedin_id()])) { $admins_rel[module_security::get_loggedin_id()] .= ' (me)'; } // work out if this user is an "administrator" or a "customer" // a user will have "edit" capabilities for tickets if they are an administrator // a user will only have "view" Capabilities for tickets if they are a "customer" // this will decide what options they have on the page (ie: assigning tickets to people) if ($ticket_id > 0 && $ticket && $ticket['ticket_id'] == $ticket_id) { if (class_exists('module_security', false)) { /*module_security::check_page(array( 'module' => $module->module_name, 'feature' => 'edit', ));*/ // we want to do our own special type of form modification here // so we don't pass it off to "check_page" which will hide all input boxes.
$fieldset_data['elements'][] = array('title' => 'Type/Department', 'fields' => array(array('type' => 'text', 'name' => 'name', 'value' => $ticket_type['name']))); $fieldset_data['elements'][] = array('title' => 'Public', 'fields' => array(array('type' => 'select', 'name' => 'public', 'value' => $ticket_type['public'], 'options' => get_yes_no(), 'help' => 'If this is public this option will display in the public ticket submission form.'))); $fieldset_data['elements'][] = array('title' => 'Default Staff', 'fields' => array(array('type' => 'select', 'name' => 'default_user_id', 'value' => $ticket_type['default_user_id'], 'options' => module_ticket::get_ticket_staff_rel()))); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); $form_actions = array('class' => 'action_bar action_bar_center action_bar_single', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')), array('type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete'), 'onclick' => "return confirm('" . _l('Really delete this record?') . "');"))); echo module_form::generate_form_actions($form_actions); ?> </form> <?php } else { print_heading(array('title' => 'Ticket Types/Departments', 'type' => 'h2', 'main' => true, 'button' => array('url' => module_ticket::link_open_type('new'), 'title' => 'Add New Type', 'type' => 'add'))); $staff = module_ticket::get_ticket_staff_rel(); /** START TABLE LAYOUT **/ $table_manager = module_theme::new_table_manager(); $columns = array(); $columns['type'] = array('title' => _l('Type/Department'), 'callback' => function ($ticket_type) { echo module_ticket::link_open_type($ticket_type['ticket_type_id'], true); }, 'cell_class' => 'row_action'); $columns['public'] = array('title' => _l('Public'), 'callback' => function ($ticket_type) { $yn = get_yes_no(); echo _l($yn[$ticket_type['public']]); }); $columns['staff'] = array('title' => _l('Staff'), 'callback' => function ($ticket_type) use($staff) { echo isset($staff[$ticket_type['default_user_id']]) ? $staff[$ticket_type['default_user_id']] : _l('Default'); }); $table_manager->set_id('ticket_type_list'); $table_manager->set_columns($columns);
<form action="" method="<?php echo _DEFAULT_FORM_METHOD; ?> "> <input type="hidden" name="customer_id" value="<?php echo isset($_REQUEST['customer_id']) ? (int) $_REQUEST['customer_id'] : ''; ?> "> <?php module_form::print_form_auth(); $search_bar = array('elements' => array('ticket_id' => array('title' => _l('Number:'), 'field' => array('type' => 'text', 'name' => 'search[ticket_id]', 'value' => isset($search['ticket_id']) ? $search['ticket_id'] : '', 'size' => 5)), 'name' => array('title' => _l('Subject:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : '', 'size' => 10)), 'ticket_content' => array('title' => _l('Message:'), 'field' => array('type' => 'text', 'name' => 'search[ticket_content]', 'value' => isset($search['ticket_content']) ? $search['ticket_content'] : '', 'size' => 10)), 'contact' => array('title' => _l('Contact:'), 'field' => array('type' => 'text', 'name' => 'search[contact]', 'value' => isset($search['contact']) ? $search['contact'] : '', 'size' => 10)), 'date' => array('title' => _l('Date:'), 'fields' => array(array('type' => 'date', 'name' => 'search[date_from]', 'value' => isset($search['date_from']) ? $search['date_from'] : ''), _l('to'), array('type' => 'date', 'name' => 'search[date_to]', 'value' => isset($search['date_to']) ? $search['date_to'] : ''))), 'type' => array('title' => _l('Type:'), 'field' => array('type' => 'select', 'name' => 'search[ticket_type_id]', 'value' => isset($search['ticket_type_id']) ? $search['ticket_type_id'] : '', 'options' => module_ticket::get_types(), 'options_array_id' => 'name')), 'Status' => array('title' => _l('Status:'), 'field' => array('type' => 'select', 'name' => 'search[status_id]', 'value' => isset($search['status_id']) ? $search['status_id'] : '', 'options' => $search_statuses, 'blank' => _l('All'))), 'Priority' => array('title' => _l('Priority:'), 'field' => array('type' => 'select', 'name' => 'search[priority]', 'value' => isset($search['priority']) ? $search['priority'] : '', 'options' => module_ticket::get_ticket_priorities())), 'Staff' => array('title' => _l('Staff:'), 'field' => array('type' => 'select', 'name' => 'search[assigned_user_id]', 'value' => isset($search['assigned_user_id']) ? $search['assigned_user_id'] : '', 'options' => module_ticket::get_ticket_staff_rel())))); if (class_exists('module_faq', false) && module_config::c('ticket_show_product_list', 1)) { $search_bar['elements']['Product'] = array('title' => _l('Product:'), 'field' => array('type' => 'select', 'name' => 'search[faq_product_id]', 'value' => isset($search['faq_product_id']) ? $search['faq_product_id'] : '', 'options' => module_faq::get_faq_products_rel())); } if (class_exists('module_envato', false)) { $search_bar['elements']['envato'] = array('title' => _l('Envato:'), 'field' => array('type' => 'select', 'name' => 'search[envato_item_id]', 'value' => isset($search['envato_item_id']) ? $search['envato_item_id'] : '', 'options' => array(-1 => 'No product') + module_envato::get_envato_items_rel())); } echo module_form::search_bar($search_bar); if (class_exists('module_envato', false) && module_config::c('envato_show_ticket_earning', 0)) { $item_ticket_count = array(); $envato_count = module_cache::get('ticket', 'envato_ticket_earning'); //if($envato_count===false){ while ($ticket = mysql_fetch_assoc($tickets)) { $items = module_envato::get_items_by_ticket($ticket['ticket_id']); if (count($items)) { foreach ($items as $item_id => $item) {
public static function get_reply_rate() { // cached? $rate = module_cache::get('ticket', 'ticket_count_rate'); if ($rate === false) { $rate = array('daily' => 0, 'weekly' => 0); // how many messages were replied to by the admin in the last week? $admins_rel = module_ticket::get_ticket_staff_rel(); if (count($admins_rel)) { $sql = "SELECT COUNT(*) AS c FROM `" . _DB_PREFIX . "ticket_message` WHERE from_user_id IN (" . implode(', ', array_keys($admins_rel)) . ") AND message_time >= " . (int) strtotime('-7 days'); $res = qa1($sql); $rate['weekly'] = $res['c']; $rate['daily'] = ceil($res['c'] / 7); module_cache::put('ticket', 'ticket_count_rate', $rate); } } return $rate; }