/**
  * Gets the name of the primary column.
  *
  * @since 4.3.0
  * @access protected
  *
  * @return string The name of the primary column.
  */
 protected function get_primary_column_name()
 {
     $columns = $this->get_columns();
     $default = $this->get_default_primary_column_name();
     // If the primary column doesn't exist fall back to the
     // first non-checkbox column.
     if (!isset($columns[$default])) {
         $default = FrmListHelper::get_default_primary_column_name();
     }
     /**
      * Filter the name of the primary column for the current list table.
      *
      * @since 4.3.0
      *
      * @param string $default Column name default for the specific list table, e.g. 'name'.
      * @param string $context Screen ID for specific list table, e.g. 'plugins'.
      */
     $column = apply_filters('list_table_primary_column', $default, $this->screen->id);
     if (empty($column) || !isset($columns[$column])) {
         $column = $default;
     }
     return $column;
 }
 public function pagination($which)
 {
     global $mode;
     parent::pagination($which);
     if ('top' == $which) {
         $this->view_switcher($mode);
     }
 }
示例#3
0
 public static function display_forms_list($params = false, $message = '', $page_params_ov = false, $current_page_ov = false, $errors = array())
 {
     global $wpdb, $frmdb, $frm_entry, $frm_vars;
     if (!$params) {
         $params = self::get_params();
     }
     $page_params = '&action=0&&frm_action=0&page=formidable';
     $frm_form = new FrmForm();
     if ($params['template']) {
         $default_templates = $frm_form->getAll(array('default_template' => 1));
         $all_templates = $frm_form->getAll(array('is_template' => 1), 'name');
     }
     require FrmAppHelper::plugin_path() . '/classes/helpers/FrmListHelper.php';
     $args = array('table_name' => $wpdb->prefix . 'frm_forms', 'params' => $params);
     $args['page_name'] = $params['template'] ? '-template' : '';
     $wp_list_table = new FrmListHelper($args);
     unset($args);
     $pagenum = $wp_list_table->get_pagenum();
     $wp_list_table->prepare_items();
     $total_pages = $wp_list_table->get_pagination_arg('total_pages');
     if ($pagenum > $total_pages && $total_pages > 0) {
         wp_redirect(add_query_arg('paged', $total_pages));
         die;
     }
     if (!empty($_REQUEST['s'])) {
         $page_params .= '&s=' . urlencode($_REQUEST['s']);
     }
     require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php';
 }
 function display_forms_list($params = false, $message = '', $page_params_ov = false, $current_page_ov = false, $errors = array())
 {
     global $wpdb, $frmdb, $frm_app_helper, $frm_form, $frm_entry, $frm_page_size, $frmpro_is_installed;
     if (!$params) {
         $params = $this->get_params();
     }
     if ($message == '') {
         $message = FrmAppHelper::frm_get_main_message();
     }
     $page_params = '&action=0&&frm_action=0&page=formidable';
     if ($params['template']) {
         $default_templates = $frm_form->getAll(array('default_template' => 1));
         $all_templates = $frm_form->getAll(array('is_template' => 1), 'name');
     }
     if (class_exists('WP_List_Table')) {
         require_once FRM_PATH . '/classes/helpers/FrmListHelper.php';
         $args = array('table_name' => $frmdb->forms, 'params' => $params);
         $args['page_name'] = $params['template'] ? '-template' : '';
         $wp_list_table = new FrmListHelper($args);
         unset($args);
         $pagenum = $wp_list_table->get_pagenum();
         $wp_list_table->prepare_items();
         $total_pages = $wp_list_table->get_pagination_arg('total_pages');
         if ($pagenum > $total_pages && $total_pages > 0) {
             wp_redirect(add_query_arg('paged', $total_pages));
             exit;
         }
         if (!empty($_REQUEST['s'])) {
             $page_params .= '&s=' . urlencode($_REQUEST['s']);
         }
     } else {
         $where_clause = " (status is NULL OR status = '' OR status = 'published') AND default_template=0 AND is_template = " . $params['template'];
         $form_vars = $this->get_form_sort_vars($params, $where_clause);
         $current_page = $current_page_ov ? $current_page_ov : $params['paged'];
         $page_params .= $page_params_ov ? $page_params_ov : $form_vars['page_params'];
         $sort_str = $form_vars['sort_str'];
         $sdir_str = $form_vars['sdir_str'];
         $search_str = $form_vars['search_str'];
         $record_count = $frm_app_helper->getRecordCount($form_vars['where_clause'], $frmdb->forms);
         $page_count = $frm_app_helper->getPageCount($frm_page_size, $record_count, $frmdb->forms);
         $forms = $frm_app_helper->getPage($current_page, $frm_page_size, $form_vars['where_clause'], $form_vars['order_by'], $frmdb->forms);
         $page_last_record = $frm_app_helper->getLastRecordNum($record_count, $current_page, $frm_page_size);
         $page_first_record = $frm_app_helper->getFirstRecordNum($record_count, $current_page, $frm_page_size);
     }
     require FRM_VIEWS_PATH . '/frm-forms/list.php';
 }