예제 #1
0
function wpdatatables_settings()
{
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    wp_enqueue_script('wdt-colorpicker');
    $languages = array();
    foreach (glob(WDT_ROOT_PATH . 'source/lang/*.inc.php') as $lang_filename) {
        $lang_filename = str_replace(WDT_ROOT_PATH . 'source/lang/', '', $lang_filename);
        $name = ucwords(str_replace('_', ' ', $lang_filename));
        $name = str_replace('.inc.php', '', $name);
        $languages[] = array('file' => $lang_filename, 'name' => $name);
    }
    $tpl = new PDTTpl();
    $tpl->setTemplate('settings.inc.php');
    $tpl->addData('wpUseSeparateCon', get_option('wdtUseSeparateCon'));
    $tpl->addData('wpMySqlHost', get_option('wdtMySqlHost'));
    $tpl->addData('wpMySqlDB', get_option('wdtMySqlDB'));
    $tpl->addData('wpMySqlUser', get_option('wdtMySqlUser'));
    $tpl->addData('wpMySqlPwd', get_option('wdtMySqlPwd'));
    $tpl->addData('wpRenderCharts', get_option('wdtRenderCharts'));
    $tpl->addData('wpRenderFilter', get_option('wdtRenderFilter'));
    $tpl->addData('wdtTablesPerPage', get_option('wdtTablesPerPage'));
    $tpl->addData('wdtNumberFormat', get_option('wdtNumberFormat'));
    $tpl->addData('wdtDecimalPlaces', get_option('wdtDecimalPlaces'));
    $tpl->addData('wdtNumbersAlign', get_option('wdtNumbersAlign'));
    $tpl->addData('wdtTabletWidth', get_option('wdtTabletWidth'));
    $tpl->addData('wdtMobileWidth', get_option('wdtMobileWidth'));
    $tpl->addData('wdtPurchaseCode', get_option('wdtPurchaseCode'));
    $tpl->addData('wdtCustomJs', get_option('wdtCustomJs'));
    $tpl->addData('wdtCustomCss', get_option('wdtCustomCss'));
    $tpl->addData('wpDateFormat', get_option('wdtDateFormat'));
    $tpl->addData('wpTopOffset', get_option('wdtTopOffset'));
    $tpl->addData('wpLeftOffset', get_option('wdtLeftOffset'));
    $tpl->addData('languages', $languages);
    $tpl->addData('wpInterfaceLanguage', get_option('wdtInterfaceLanguage'));
    $tpl->addData('wdtFonts', wdt_get_system_fonts());
    $tpl->addData('wdtBaseSkin', get_option('wdtBaseSkin'));
    $wpFontColorSettings = get_option('wdtFontColorSettings');
    if (!empty($wpFontColorSettings)) {
        $wpFontColorSettings = unserialize($wpFontColorSettings);
    } else {
        $wpFontColorSettings = array();
    }
    // Admin JS
    $tpl->addJs(WDT_JS_PATH . 'wpdatatables/wpdatatables_admin.js');
    // Selecter
    $tpl->addJs(WDT_JS_PATH . 'selecter/jquery.fs.selecter.min.js');
    $tpl->addCss(WDT_CSS_PATH . 'jquery.fs.selecter.css');
    // Picker
    $tpl->addJs(WDT_JS_PATH . 'picker/jquery.fs.picker.min.js');
    $tpl->addCss(WDT_CSS_PATH . 'jquery.fs.picker.css');
    // Popup
    $tpl->addJs(WDT_JS_PATH . 'popup/jquery.remodal.min.js');
    $tpl->addCss(WDT_CSS_PATH . 'jquery.remodal.css');
    $tpl->addData('wdtFontColorSettings', $wpFontColorSettings);
    $settings_page = $tpl->returnData();
    $settings_page = apply_filters('wpdatatables_filter_settings_page', $settings_page);
    echo $settings_page;
    do_action('wpdatatables_settings_page');
}
 public function generateTable()
 {
     $tpl = new PDTTpl();
     if ($this->_firstOnPage && $this->scriptsEnabled) {
         $skin = get_option('wdtBaseSkin');
         if (empty($skin)) {
             $skin = 'skin1';
         }
         $renderSkin = $skin == 'skin1' ? WDT_ASSETS_PATH . 'css/wpDataTablesSkin.css' : WDT_ASSETS_PATH . 'css/wpDataTablesSkin_1.css';
         $renderSkin = apply_filters('wpdatatables_link_to_skin_css', $renderSkin, $this->getWpId());
         $cssArray = array('wpdatatables-min' => WDT_CSS_PATH . 'wpdatatables.min.css', 'wpdatatables-tabletools' => WDT_CSS_PATH . 'TableTools.css', 'wpdatatables-responsive' => WDT_ASSETS_PATH . 'css/datatables.responsive.css', 'wpdatatables-skin' => $renderSkin);
         foreach ($cssArray as $cssKey => $cssFile) {
             if (defined('DOING_AJAX') && DOING_AJAX) {
                 $tpl->addCss($cssFile);
             } else {
                 wp_enqueue_style($cssKey, $cssFile);
             }
         }
     }
     $table_content = $this->_renderWithJSAndStyles();
     $tpl->addData('wdt_output_table', $table_content);
     $tpl->setTemplate('wrap_template.inc.php');
     $return_data = $tpl->returnData();
     return $return_data;
 }