Esempio n. 1
0
    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;
        }
    }
Esempio n. 2
0
}
?>
        <tbody>
        <?php 
$c = 0;
$products = module_faq::get_faq_products_rel();
foreach ($faqs as $data) {
    $faq = module_faq::get_faq($data['faq_id']);
    ?>
        <tr class="<?php 
    echo $c++ % 2 ? "odd" : "even";
    ?>
">
            <td nowrap="">
                <a href="<?php 
    echo module_faq::link_open_public($data['faq_id'], false);
    ?>
&faq_product_id=<?php 
    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();
Esempio n. 3
0
		                    <a href="<?php 
            echo module_faq::link_open_faq_product($faq_product_id, false);
            ?>
">(edit)</a>
		                    <br/>
		                </div>
	                <?php 
        }
        ?>
	                <div>
	                    <input type="checkbox" name="new_product_go" value="1"> <input type="text" name="new_product_name"> (new)
	                </div>
			        <?php 
    }));
    if ($faq_id > 0) {
        $fieldset_data['elements'][] = array('title' => 'Public Link', 'fields' => array(array('type' => 'html', 'value' => '<a href="' . module_faq::link_open_public($faq_id) . '" target="_blank">' . _l('Open') . '</a>')));
    }
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
    $form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')), array('ignore' => !(int) $faq_id, 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . $module->link_open(false) . "';")));
    echo module_form::generate_form_actions($form_actions);
    ?>



	</form>

	<?php 
} else {
    $header = array('title' => _l('FAQs'), 'type' => 'h2', 'main' => true, 'button' => array());
    if (module_faq::can_i('create', 'FAQ')) {
Esempio n. 4
0
        }
        ?>
                </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>
Esempio n. 5
0
$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>