function show_theme_calendar_widget() { 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']) && $_POST['order_by'] != '') { $sort["sortid_by"] = esc_sql($_POST['order_by']); } if (isset($_POST['asc_or_desc']) && $_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 ($_POST['page_number']) { $limit = ($_POST['page_number'] - 1) * 20; } else { $limit = 0; } } else { $limit = 0; } if (isset($_POST['search_events_by_title'])) { $search_tag = $_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_widget_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_widget_theme" . $where . " " . $order . " " . " LIMIT %d,20", $limit); $rows = $wpdb->get_results($query); html_show_theme_calendar_widget($rows, $pageNav, $sort); }
function spider_widget_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 "widget_Themes_function.html.php"; global $wpdb; if (isset($_GET["task"])) { $task = esc_html($_GET["task"]); } else { $task = ""; } switch ($task) { case 'theme': html_show_theme_calendar_widget(); break; default: html_show_theme_calendar_widget(); } }