* IP Address: 67.79.165.254 */ if (module_config::c('ticket_allow_priority', 0) || $ticket['priority'] == _TICKET_PRIORITY_STATUS_ID) { $responsive_summary = array(); ob_start(); ?> <table class="tableclass tableclass_form tableclass_full"> <tbody> <tr> <td> <?php if ($ticket['priority'] != _TICKET_PRIORITY_STATUS_ID) { echo '<p>'; _e("Current ticket position is: <strong>%s of %s</strong>.", ordinal($ticket['position']), $ticket['total_pending']); echo '<br/>'; $x = module_ticket::get_ticket_count($ticket['faq_product_id']); _e('Priority Support will change this to: <strong>%s of %s</strong>.', ordinal($x['priority'] + 1), $ticket['total_pending']); echo '<br/>'; _e('This means your question will be answered faster.'); echo '</p>'; } if ($ticket['invoice_id']) { $invoice_data = module_invoice::get_invoice($ticket['invoice_id']); if (!$invoice_data || $invoice_data['invoice_id'] != $ticket['invoice_id']) { // ticket invoice has been deleted. // unlink it from this ticket. if ($ticket['ticket_id']) { update_insert('ticket_id', $ticket['ticket_id'], 'ticket', array('invoice_id' => 0)); } echo 'invoice removed... please refresh'; } else {
public function external_hook($hook) { switch ($hook) { case 'public': $faq_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false; $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false; if ($faq_id && $hash) { $correct_hash = $this->link_open_public($faq_id, true); if ($correct_hash == $hash) { $faq = array(); if ($faq_id > 0) { $faq = $this->get_faq($faq_id); } if ($faq) { $template = module_template::get_template_by_key('faq_item'); $faq['answer'] = self::html_faq($faq['answer']); $faq['faq_back'] = $this->link_open_public(-1) . (isset($_REQUEST['faq_product_id']) ? '&faq_product_id=' . (int) $_REQUEST['faq_product_id'] : ''); $template->assign_values($faq); $template->page_title = $faq['question']; echo $template->render('pretty_html'); } else { $template = module_template::get_template_by_key('faq_list'); $data = array(); ob_start(); include 'public/faq_listing.php'; $data['listing'] = ob_get_clean(); $template->assign_values($data); $template->page_title = _l('FAQ'); echo $template->render('pretty_html'); } } } break; case 'faq_list_json': @ob_end_clean(); header("Content-type: text/javascript"); $faq_id = isset($_REQUEST['faq_id']) ? (int) $_REQUEST['faq_id'] : false; if ($faq_id > 0) { $faq = $this->get_faq($faq_id); if ($faq) { $faq['url'] = module_faq::link_open_public($faq_id, false); echo json_encode($faq); /*$template = module_template::get_template_by_key('faq_item'); $faq['answer'] = forum_text($faq['answer']); $faq['faq_back'] = $this->link_open_public(-1).(isset($_REQUEST['faq_product_id']) ? '&faq_product_id='.(int)$_REQUEST['faq_product_id'] : ''); $template->assign_values($faq); $template->page_title = $faq['question']; echo $template->replace_content();*/ } exit; } $faq_product_id = isset($_REQUEST['faq_product_id']) ? (int) $_REQUEST['faq_product_id'] : false; $faq_search = isset($_REQUEST['faq_search']) ? $_REQUEST['faq_search'] : false; $faqs = $this->get_faqs(array('faq_product_id' => $faq_product_id, 'question' => $faq_search)); $faqs_json = array(); $all_products = module_faq::get_faq_products_rel(); foreach ($faqs as $faq) { $faq = module_faq::get_faq($faq['faq_id']); $faq_products = array(); foreach ($faq['faq_product_ids'] as $faq_product_id) { $faq_products[$faq_product_id] = $all_products[$faq_product_id]; } $faqs_json[$faq['faq_id']] = array('question' => $faq['question'], 'url' => module_faq::link_open_public($faq['faq_id'], false), 'products' => $faq_products); } echo json_encode($faqs_json); exit; break; case 'ticket_list': $faq_product_id = isset($_REQUEST['faq_product_id']) ? (int) $_REQUEST['faq_product_id'] : false; @ob_end_clean(); header("Content-type: text/javascript"); if ($faq_product_id) { $product = $this->get_faq_product($faq_product_id); // find the faq items that match this product id. if ($product && $product['faq_product_id'] == $faq_product_id) { $faqs = $this->get_faqs(array('faq_product_id' => $faq_product_id)); ob_start(); $x = 0; $half = ceil(count($faqs) / 2); ?> <tr> <th> <?php _e('FAQ'); ?> </th> <td> <?php _e('Please read through the below FAQ to see if the question has already been answered'); ?> </tr> <tr> <td colspan="2"> <table width="100%" class="tableclass tableclass_full table_faq_class"> <tbody> <tr> <td width="50%" valign="top"> <ul><?php for (true; $x < $half; $x++) { $data = array_shift($faqs); $faq = module_faq::get_faq($data['faq_id']); ?> <li> <a href="<?php echo module_faq::link_open_public($data['faq_id'], false); ?> " target="_blank"><?php echo htmlspecialchars($faq['question']); ?> </a> </li> <?php } ?> </ul> </td> <td width="50%" valign="top"> <ul><?php foreach ($faqs as $data) { $faq = module_faq::get_faq($data['faq_id']); ?> <li> <a href="<?php echo module_faq::link_open_public($data['faq_id'], false); ?> " target="_blank"><?php echo htmlspecialchars($faq['question']); ?> </a> </li> <?php } ?> </ul> </td> </tr> </tbody> </table> </td> </tr> <?php $html = preg_replace('#\\s+#', ' ', ob_get_clean()); ?> $('#faq_product_area').html('<?php echo addcslashes($html, "'"); ?> '); <?php if ($product['default_type_id']) { ?> $('#ticket_type_id').val(<?php echo (int) $product['default_type_id']; ?> ); <?php } // and now we have to set the ticket position. if (module_config::c('ticket_show_position', 1)) { $new_position = module_ticket::ticket_position(false, $faq_product_id); ?> $('#ticket_position_field').html('<?php echo addcslashes(_l('%s out of %s other support tickets', ordinal($new_position['current'] + 1), $new_position['total'] + 1), "'"); ?> '); <?php if (module_config::c('ticket_allow_priority', 0)) { $c = module_ticket::get_ticket_count($faq_product_id); ?> $('#priority_ticket_position').html('<?php _e('%s out of %s', ordinal($c['priority'] + 1), $new_position['total'] + 1); ?> '); <?php } } exit; } } ?> $('#faq_product_area').html(''); <?php if (module_config::c('ticket_show_position', 1)) { $new_position = module_ticket::ticket_position(); ?> $('#ticket_position_field').html('<?php echo addcslashes(_l('%s out of %s other support tickets', ordinal($new_position['current'] + 1), $new_position['total'] + 1), "'"); ?> '); <?php if (module_config::c('ticket_allow_priority', 0)) { ?> $('#priority_ticket_position').html('<?php _e('%s out of %s', ordinal(module_ticket::ticket_count('priority') + 1), $new_position['total'] + 1); ?> '); <?php } } break; } }
$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 { include 'ticket_admin_open.php'; }