function show_theme_calendar()
{
    global $wpdb;
    $order = " ORDER BY title ASC";
    $sort["default_style"] = "manage-column column-autor sortable desc";
    $sort["sortid_by"] = "title";
    $sort["custom_style"] = "manage-column column-title sorted asc";
    $sort["1_or_2"] = "2";
    if (isset($_POST['page_number'])) {
        if (isset($_POST['order_by']) && esc_html($_POST['order_by']) != '') {
            $sort["sortid_by"] = esc_sql(esc_html(stripslashes($_POST['order_by'])));
        }
        if (isset($_POST['asc_or_desc']) && esc_html($_POST['asc_or_desc']) == 1) {
            $sort["custom_style"] = "manage-column column-title sorted asc";
            $sort["1_or_2"] = "2";
            $order = "ORDER BY " . $sort["sortid_by"] . " ASC";
        } else {
            $sort["custom_style"] = "manage-column column-title sorted desc";
            $sort["1_or_2"] = "1";
            $order = "ORDER BY " . $sort["sortid_by"] . " DESC";
        }
        if (isset($_POST['page_number']) && esc_html($_POST['page_number'])) {
            $limit = (esc_sql(esc_html(stripslashes($_POST['page_number']))) - 1) * 20;
        } else {
            $limit = 0;
        }
    } else {
        $limit = 0;
    }
    if (isset($_POST['search_events_by_title'])) {
        $search_tag = esc_sql(esc_html(stripslashes($_POST['search_events_by_title'])));
    } else {
        $search_tag = "";
    }
    if ($search_tag) {
        $where = ' WHERE title LIKE "%%' . like_escape($search_tag) . '%%"';
    } else {
        $where = '';
    }
    // get the total number of records
    $query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "spidercalendar_theme" . str_replace('%%', '%', $where);
    $total = $wpdb->get_var($query);
    $pageNav['total'] = $total;
    $pageNav['limit'] = $limit / 20 + 1;
    $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "spidercalendar_theme" . $where . " " . $order . " " . " LIMIT %d,20", $limit);
    $rows = $wpdb->get_results($query);
    html_show_theme_calendar($rows, $pageNav, $sort);
}
function spider_calendar_params()
{
    wp_enqueue_script('media-upload');
    wp_admin_css('thickbox');
    if (!function_exists('print_html_nav')) {
        require_once "nav_function/nav_html_func.php";
    }
    require_once "Themes_function.html.php";
    // add functions for vive Spider_Video_Player
    global $wpdb;
    if (isset($_GET["task"])) {
        $task = esc_html($_GET["task"]);
    } else {
        $task = "";
    }
    switch ($task) {
        case 'theme':
            html_show_theme_calendar();
            break;
        default:
            html_show_theme_calendar();
    }
}