protected function setFilterVisibility() { if ($this->part !== 'admin') { return null; } $this->setIntFilter('active'); $this->get_questions_params['active'] = $this->params->active; $this->fields['active'] = array($this->form_id . '_active', __('c_c_action_visibility'), form::select(array('active', $this->form_id . '_active'), array_merge(array(__('c_c_action_all_visibility') => 2), module_faq::getQuestionsStatuses(true)), $this->params->active)); }
</tr> </tbody> <tbody id="faq_product_area"> </tbody> </table> <script type="text/javascript"> var ajax_faq_xhr = false; var dofaqcheck = function(){ // post to server for authentication. try{ajax_faq_xhr.abort();}catch(err){} ajax_faq_xhr = $.ajax({ url: '<?php echo module_faq::link_external_faq_ticket(); ?> ', data: { faq_product_id: this.value }, type: "POST", dataType: 'script' }); }; $(function(){ $('#faq_product_id').change(dofaqcheck).keyup(dofaqcheck); <?php if ($current_faq_product_id) { ?> $('#faq_product_id').change();
} echo ' ' . htmlspecialchars($create_user['email']); } })); $fieldset_data['elements'][] = array('title' => _l('Type/Department'), 'fields' => array(array('type' => 'select', 'name' => 'ticket_type_id', 'value' => $ticket['ticket_type_id'], 'options' => module_ticket::get_types(), 'blank' => module_ticket::can_edit_tickets(), 'options_array_id' => 'name'))); if (class_exists('module_faq', false) && module_config::c('ticket_faq_link', 1) && module_faq::get_faq_products() > 0) { $fieldset_data['elements'][] = array('title' => _l('Product'), 'fields' => array(function () use($ticket, $ticket_id) { if (module_ticket::can_edit_tickets()) { echo print_select_box(module_faq::get_faq_products_rel(), 'faq_product_id', $ticket['faq_product_id']); _h('Use this to link a ticket to a product. Set products in Settings > FAQ. This allows you to have different FAQ items for different products. Users are shown the FAQ items before submitting a support ticket.'); } else { echo friendly_key(module_faq::get_faq_products_rel(), $ticket['faq_product_id']); } // show a button that does a jquery popup with the list of faq items and an option to create new one. //if(module_faq::can_i('edit','FAQ')){ echo ' '; echo popup_link('<a href="' . module_faq::link_open_list($ticket['faq_product_id']) . '">' . _l('FAQ') . '</a>', array('force' => true, 'width' => 1100, 'height' => 600)); //} })); } if (module_config::c('ticket_support_accounts', 1) && module_ticket::get_accounts_rel()) { $fieldset_data['elements'][] = array('title' => _l('Account'), 'fields' => array(array('type' => module_ticket::can_edit_tickets() ? 'select' : 'html', 'name' => 'ticket_account_id', 'value' => module_ticket::can_edit_tickets() ? $ticket['ticket_account_id'] : friendly_key(module_ticket::get_accounts_rel(), $ticket['ticket_account_id']), 'options' => module_ticket::get_accounts_rel()))); } $fieldset_data['elements'][] = array('title' => _l('Status'), 'fields' => array(array('type' => module_ticket::can_edit_tickets() ? 'select' : 'html', 'name' => 'status_id', 'value' => module_ticket::can_edit_tickets() ? $ticket['status_id'] : friendly_key(module_ticket::get_statuses(), $ticket['status_id']), 'options' => module_ticket::get_statuses()))); if (module_ticket::can_edit_tickets() || module_config::c('ticket_allow_priority_selection', 0)) { $priorities = module_ticket::get_ticket_priorities(); if (!module_ticket::can_edit_tickets() && isset($priorities[_TICKET_PRIORITY_STATUS_ID]) && $ticket['priority'] != _TICKET_PRIORITY_STATUS_ID) { unset($priorities[_TICKET_PRIORITY_STATUS_ID]); } $fieldset_data['elements'][] = array('title' => _l('Priority'), 'fields' => array(array('type' => 'select', 'name' => 'priority', 'value' => $ticket['priority'], 'blank' => false, 'options' => $priorities))); } $fieldset_data['extra_settings'] = array('owner_table' => 'ticket', 'owner_key' => 'ticket_id', 'owner_id' => $ticket['ticket_id'], 'layout' => 'table_row', 'allow_new' => module_extra::can_i('create', 'Tickets'), 'allow_edit' => module_extra::can_i('edit', 'Tickets'));
}); $columns['ticket_staff'] = array('title' => 'Staff', 'callback' => function ($ticket) { echo module_user::link_open($ticket['assigned_user_id'], true); }); if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers') && module_config::c('ticket_list_show_customer', 1)) { $columns['ticket_customer'] = array('title' => 'Customer', 'callback' => function ($ticket) { echo module_customer::link_open($ticket['customer_id'], true); }); } $columns['ticket_contact'] = array('title' => 'Contact', 'callback' => function ($ticket) { echo module_user::link_open($ticket['user_id'], true, array(), true); }); if (class_exists('module_faq', false) && module_config::c('ticket_show_product_list', 1)) { $columns['ticket_product'] = array('title' => 'Product', 'callback' => function ($ticket) { if ($ticket['faq_product_id']) { $faq_product = module_faq::get_faq_product($ticket['faq_product_id']); echo $faq_product && isset($faq_product['name']) ? htmlspecialchars($faq_product['name']) : ''; } }); } if (class_exists('module_envato', false)) { $columns['ticket_envato'] = array('title' => _l('Envato%s', module_config::c('envato_show_ticket_earning', 0) ? ' (' . dollar($envato_count * 0.7) . ')' : ''), 'callback' => function ($ticket) { $items = module_envato::get_items_by_ticket($ticket['ticket_id']); foreach ($items as $item) { echo '<a href="' . $item['url'] . '">' . htmlspecialchars($item['name']) . '</a> '; } }); } if (class_exists('module_group', false) && module_config::c('ticket_enable_groups', 1) && module_group::groups_enabled()) { $columns['ticket_group'] = array('title' => 'Group', 'callback' => function ($ticket) { // find the groups for this customer.
<?php /** * Copyright: dtbaker 2012 * 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 (!module_config::can_i('view', 'Settings') || !module_faq::can_i('edit', 'FAQ')) { redirect_browser(_BASE_HREF); } $module->page_title = 'FAQ Settings'; $links = array(array("name" => 'FAQ Products', 'm' => 'faq', 'p' => 'faq_products', 'force_current_check' => true, 'order' => 1, 'menu_include_parent' => 1, 'allow_nesting' => 1, 'args' => array('faq_id' => false, 'faq_product_id' => false)), array("name" => 'Questions & Answers', 'm' => 'faq', 'p' => 'faq_questions', 'force_current_check' => true, 'order' => 2, 'menu_include_parent' => 1, 'allow_nesting' => 1, 'args' => array('faq_id' => false, 'faq_product_id' => false)), array("name" => 'Settings', 'm' => 'faq', 'p' => 'faq_settings_basic', 'force_current_check' => true, 'order' => 3, 'menu_include_parent' => 1, 'allow_nesting' => 1, 'args' => array('faq_id' => false, 'faq_product_id' => false)));
</form> <?php } else { $header = array('title' => _l('FAQ Product'), 'type' => 'h2', 'main' => true, 'button' => array()); if (module_faq::can_i('create', 'FAQ')) { $header['button'] = array('url' => module_faq::link_open_faq_product('new'), 'title' => _l('Add New Product'), 'type' => 'add'); } print_heading($header); /** START TABLE LAYOUT **/ $table_manager = module_theme::new_table_manager(); $columns = array(); $columns['product_name'] = array('title' => _l('Product Name'), 'callback' => function ($data) { echo module_faq::link_open_faq_product($data['faq_product_id'], true); }, 'cell_class' => 'row_action'); $columns['department'] = array('title' => _l('Default Type/Department'), 'callback' => function ($data) use($types) { echo isset($types[$data['default_type_id']]) ? htmlspecialchars($types[$data['default_type_id']]['name']) : ''; }); if (class_exists('module_envato', false)) { $columns['envato'] = array('title' => _l('Envato Item'), 'callback' => function ($data) use($all_items_rel) { $linked_items = explode('|', $data['envato_item_ids']); foreach ($linked_items as $id => $linked_item) { if (!strlen(trim($linked_item))) { unset($linked_items[$id]); } if (isset($all_items_rel[$linked_item])) { $linked_items[$id] = $all_items_rel[$linked_item]; } }
public static function api_filter_faq($hook, $response, $endpoint, $method) { $response['faq'] = true; switch ($method) { case 'list_products': $faq_products = module_faq::get_faq_products(); $types = module_ticket::get_types(); if (class_exists('module_envato', false)) { $all_items = module_envato::get_envato_items(); $all_items_rel = array(); foreach ($all_items as $all_item) { $all_items_rel[$all_item['item_id']] = $all_item; } } foreach ($faq_products as $faq_product_id => $faq_product) { $faq_products[$faq_product_id]['default_type'] = isset($types[$faq_product['default_type_id']]) ? $types[$faq_product['default_type_id']] : false; if (class_exists('module_envato', false)) { $linked_items = explode('|', $faq_product['envato_item_ids']); foreach ($linked_items as $id => $linked_item) { if (!strlen(trim($linked_item))) { unset($linked_items[$id]); } if (isset($all_items_rel[$linked_item])) { $linked_items[$id] = $all_items_rel[$linked_item]; } } $faq_products[$faq_product_id]['envato_items'] = $linked_items; } } $response['faq_products'] = $faq_products; break; } return $response; }
echo isset($search['faq_product_id']) ? (int) $search['faq_product_id'] : ''; ?> "><?php echo htmlspecialchars($faq['question']); ?> </a> </td> <?php if ($show_product) { ?> <td> <?php $items = array(); foreach ($faq['faq_product_ids'] as $faq_product_id) { if (module_faq::can_i('edit', 'FAQ')) { $items[] = module_faq::link_open_faq_product($faq_product_id, true); } else { $items[] = $products[$faq_product_id]; } } echo implode(', ', $items); ?> </td> <?php } ?> </tr> <?php } ?> </tbody>
} ?> </td> <td> <?php foreach ($faq['faq_product_ids'] as $faq_product_id) { echo module_faq::link_open_faq_product($faq_product_id, true) . " "; } ?> </td> <?php //if(module_faq::can_i('edit','FAQ')){ ?> <td> <a href="<?php echo str_replace('display_mode=iframe', '', module_faq::link_open_public($faq_id, false)); ?> " target="_blank" onclick="window.parent.jQuery('#new_ticket_message').val(window.parent.jQuery('#new_ticket_message').val() + $(this).attr('href')); window.parent.jQuery('.ui-dialog-content').dialog('close'); return false;"><?php _e('Insert Link'); ?> </a> </td> <?php //} ?> </tr> <?php } ?> </tbody> </table>
</form> <?php } else { $header = array('title' => _l('FAQs'), 'type' => 'h2', 'main' => true, 'button' => array()); if (module_faq::can_i('create', 'FAQ')) { $header['button'] = array('url' => module_faq::link_open('new'), 'title' => _l('Add New FAQ'), 'type' => 'add'); } print_heading($header); $products = module_faq::get_faq_products_rel(); /** START TABLE LAYOUT **/ $table_manager = module_theme::new_table_manager(); $columns = array(); $columns['question'] = array('title' => _l('Question'), 'callback' => function ($faq) { echo module_faq::link_open($faq['faq_id'], true); }, 'cell_class' => 'row_action'); $columns['linked_products'] = array('title' => _l('Linked FAQ Products'), 'callback' => function ($faq) { $faq = module_faq::get_faq($faq['faq_id']); foreach ($faq['faq_product_ids'] as $faq_product_id) { echo module_faq::link_open_faq_product($faq_product_id, true) . " "; } }); $table_manager->set_id('faq_list'); $table_manager->set_columns($columns); $table_manager->set_rows($faqs); $table_manager->pagination = true; $table_manager->print_table(); /** END TABLE LAYOUT **/ }
$c = array(); $customers = module_customer::get_customers(); foreach ($customers as $customer) { $c[$customer['customer_id']] = $customer['customer_name']; } module_config::print_settings_form(array(array('key' => 'faq_ticket_show_product_selection', 'default' => 1, 'type' => 'checkbox', 'description' => 'Show product selection on ticket submit form.'))); ?> <?php print_heading('FAQ Embed'); ?> <p> <?php _e('Place this in an iframe on your website, or as a link on your website, and people can view FAQ tickets.'); ?> </p> <p><a href="<?php echo module_faq::link_open_public(-1); ?> ?show_search=1&show_header=1&show_product=1" target="_blank"><?php echo module_faq::link_open_public(-1); ?> ?show_search=1&show_header=1&show_product=1</a></p> <?php print_heading('FAQ WordPress Plugin'); ?> <p> You can use this basic WordPress plugin to embed FAQ items onto your WordPress blog. Some PHP knowledge is required, this is a slightly advanced technique. https://github.com/dtbaker/ucm-wordpress </p>
public static function get_replace_fields($ticket_id, $ticket_data = array()) { if (!$ticket_data) { $ticket_data = module_ticket::get_ticket($ticket_id); } $staff_user_id = $ticket_data['assigned_user_id'] ? $ticket_data['assigned_user_id'] : module_config::c('ticket_default_user_id', 1); $to = module_user::get_user($staff_user_id); //$ticket_data['assigned_user_id']); $ticket_data['staff_name'] = $to['name'] . ' ' . $to['last_name']; $ticket_data['ticket_number'] = module_ticket::ticket_number($ticket_data['ticket_id']); $ticket_contact = module_user::get_user($ticket_data['user_id'], false); $ticket_data['contact_name'] = (isset($ticket_contact['name']) ? $ticket_contact['name'] . ' ' : '') . (isset($ticket_contact['last_name']) ? $ticket_contact['last_name'] : ''); $ticket_data['contact_fname'] = isset($ticket_contact['name']) ? $ticket_contact['name'] : ''; $ticket_data['contact_lname'] = isset($ticket_contact['last_name']) ? $ticket_contact['last_name'] : ''; // addition. find all extra keys for this ticket and add them in. // we also have to find any EMPTY extra fields, and add those in as well. if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) { $all_extra_fields = module_extra::get_defaults('ticket'); foreach ($all_extra_fields as $e) { $ticket_data[$e['key']] = _l('N/A'); } // and find the ones with values: $extras = module_extra::get_extras(array('owner_table' => 'ticket', 'owner_id' => $ticket_id)); foreach ($extras as $e) { $ticket_data[$e['extra_key']] = $e['extra']; } } if (isset($ticket_data['faq_product_id']) && (int) $ticket_data['faq_product_id'] > 0) { $ticket_data['faq_product'] = friendly_key(module_faq::get_faq_products_rel(), $ticket_data['faq_product_id']); } else { $ticket_data['faq_product'] = _l('N/A'); } // find any extra keys (defined in the db for ticket submission, not the module_extra extra keys) $extras = module_ticket::get_ticket_extras_keys(); if (count($extras)) { foreach ($extras as $extra) { $key = strtolower($extra['key']); if (!isset($ticket_data[$key])) { $ticket_data[$key] = isset($ticket_data['extra_data'][$extra['ticket_data_key_id']]) ? $ticket_data['extra_data'][$extra['ticket_data_key_id']]['value'] : ''; } } } return $ticket_data; }
array_unshift($links, array("name" => _l('All'), 'm' => 'ticket', 'p' => 'ticket_admin', 'default_page' => 'ticket_admin_open', 'order' => 1, 'menu_include_parent' => 0, 'allow_nesting' => 0, 'current' => !$showing_ticket && !isset($_REQUEST['faq_product_id']), 'args' => array('faq_product_id' => false, 'ticket_id' => false))); $product_tickets = module_ticket::get_tickets(array('faq_product_id' => '0', 'status_id' => '<' . _TICKET_STATUS_RESOLVED_ID)); $link_name = _l('No Product') . " <span class='menu_label'>" . mysql_num_rows($product_tickets) . '</span>'; $ticket_count = module_ticket::get_ticket_count(0); if ($ticket_count && $ticket_count['priority'] > 0) { $link_name .= " <span class='menu_label important'>" . $ticket_count['priority'] . "</span> "; // $link_name .= ' <em>+ '.$ticket_count['priority'].'</em>'; } //$link_name .= '</span>'; array_unshift($links, array("name" => $link_name, 'm' => 'ticket', 'p' => 'ticket_admin', 'default_page' => 'ticket_admin_open', 'order' => 2, 'menu_include_parent' => 0, 'allow_nesting' => 0, 'current' => !$showing_ticket && isset($_REQUEST['faq_product_id']) && $_REQUEST['faq_product_id'] == 0, 'args' => array('faq_product_id' => 0, 'ticket_id' => false))); /*if(!$showing_ticket && (!isset($_REQUEST['faq_product_id']) || !$_REQUEST['faq_product_id'])){ // hack for search to work correctly. $_REQUEST['search'] = isset($_REQUEST['search']) ? $_REQUEST['search'] : array(); $_REQUEST['search']['faq_product_id'] = 0; }*/ $products = module_faq::get_faq_products_rel(); $order = 3; foreach ($products as $product_id => $product_name) { $ticket_count = module_ticket::get_ticket_count($product_id); if (!$ticket_count || !$ticket_count['count']) { continue; } $link_name = htmlspecialchars($product_name) . " <span class='menu_label'>" . $ticket_count['count'] . '</span>'; if ($ticket_count && $ticket_count['priority'] > 0) { $link_name .= " <span class='menu_label important'>" . $ticket_count['priority'] . "</span> "; //$link_name .= ' <em>+ '.$ticket_count['priority'].'</em>'; } //$link_name .= '</span>'; array_unshift($links, array("name" => $link_name, 'm' => 'ticket', 'p' => 'ticket_admin', 'default_page' => 'ticket_admin_open', 'order' => ++$order, 'menu_include_parent' => 0, 'allow_nesting' => 0, 'current' => isset($_REQUEST['faq_product_id']) && $_REQUEST['faq_product_id'] == $product_id, 'args' => array('faq_product_id' => $product_id, 'ticket_id' => false))); } } else {