<?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)));
public function process() { if ('save_faq_product' == $_REQUEST['_process']) { if (!module_faq::can_i('edit', 'FAQ')) { die('No perms to save faq.'); } if (isset($_POST['envato_item_ids'])) { $_POST['envato_item_ids'] = implode('|', $_POST['envato_item_ids']); } $faq_product_id = update_insert('faq_product_id', $_REQUEST['faq_product_id'], 'faq_product', $_POST); if (isset($_REQUEST['butt_del'])) { // deleting ticket type all together if (module_form::confirm_delete('customer_id', _l("Really delete FAQ Product?"), self::link_open_faq_product($_REQUEST['faq_product_id']))) { delete_from_db('faq_product', 'faq_product_id', $_REQUEST['faq_product_id']); set_message('FAQ Product deleted successfully.'); redirect_browser($this->link_open_faq_product(false)); } } set_message('FAQ Product saved successfully'); redirect_browser($this->link_open_faq_product($faq_product_id)); } else { if ('save_faq' == $_REQUEST['_process']) { if (!module_faq::can_i('edit', 'FAQ')) { die('No perms to save faq.'); } if (isset($_REQUEST['new_product_name']) && strlen(trim($_REQUEST['new_product_name']))) { $faq_product_id = update_insert('faq_product_id', false, 'faq_product', array('name' => trim($_REQUEST['new_product_name']))); if (!isset($_REQUEST['faq_product_ids'])) { $_REQUEST['faq_product_ids'] = array(); } $_REQUEST['faq_product_ids'][] = $faq_product_id; } $faq_id = update_insert('faq_id', $_REQUEST['faq_id'], 'faq', $_POST); delete_from_db('faq_product_rel', 'faq_id', $faq_id); if (isset($_REQUEST['faq_product_ids']) && is_array($_REQUEST['faq_product_ids'])) { foreach ($_REQUEST['faq_product_ids'] as $faq_product_id) { if ((int) $faq_product_id > 0) { $sql = "INSERT INTO `" . _DB_PREFIX . "faq_product_rel` SET faq_id = " . (int) $faq_id . ", faq_product_id = " . (int) $faq_product_id; query($sql); } } } if (isset($_REQUEST['butt_del'])) { // deleting ticket type all together if (module_form::confirm_delete('customer_id', _l("Really delete FAQ item?"), self::link_open($_REQUEST['faq_id']))) { delete_from_db('faq', 'faq_id', $_REQUEST['faq_id']); delete_from_db('faq_product_rel', 'faq_id', $_REQUEST['faq_id']); set_message('FAQ deleted successfully.'); redirect_browser($this->link_open(false)); } } set_message('FAQ saved successfully'); redirect_browser($this->link_open($faq_id)); } } }
<?php })); } 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_product_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_faq_product(false) . "';"))); echo module_form::generate_form_actions($form_actions); ?> </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']);
&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(); 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 } ?>