Array( // <== "dataset_slug" // [dataset_slug] => projects // [dataset_name_singular] => project // [dataset_name_plural] => projects // [dataset_title_singular] => Project // [dataset_title_plural] => Projects // [basepress_dataset_handle] => array(...) // ... // ) // // ... // // ) // // NOTE! // ===== // The returned widget be the widget requested proper. Or it may be just // (eg;) a header, error message and footer. // // RETURNS:- // $page_html STRING // ------------------------------------------------------------------------- // ========================================================================= // Init. // ========================================================================= $ns = __NAMESPACE__ ; $fn = __FUNCTION__ ; // ========================================================================= // CHECK and DEFAULT the "DATASET RECORDS TABLE" (definition) (from which // we create the WP LIST TABLE to display the records in)... // ========================================================================= require_once( dirname( __FILE__ ) . '/check-and-default-dataset-records-table.php' ) ; // ------------------------------------------------------------------------- // check_and_default_dataset_records_table( // $dataset_manager_home_page_title , // $caller_apps_includes_dir , // $all_application_dataset_definitions , // $selected_datasets_dmdd , // $dataset_records , // $dataset_title , // $dataset_slug , // $question_front_end // ) // - - - - - - - - - - - - - - - - - - - - - - - // Checks for:- // $selected_datasets_dmdd['dataset_records_table'] // // defaulting it and it's members as necessary. // // RETURNS:- // On SUCCESS! // - - - - - - // ARRAY $dataset_records_table // // On FAILURE! // - - - - - - // $error_message STRING // ------------------------------------------------------------------------- $result = check_and_default_dataset_records_table( $dataset_manager_home_page_title , $caller_apps_includes_dir , $all_application_dataset_definitions , $selected_datasets_dmdd , $dataset_records , $dataset_title , $dataset_slug , $question_front_end ) ; // ------------------------------------------------------------------------- if ( is_string( $result ) ) { return standard_dataset_manager_error( $dataset_manager_home_page_title , $result , $caller_apps_includes_dir , $question_front_end ) ; } // ------------------------------------------------------------------------- $selected_datasets_dmdd['dataset_records_table'] = $result ; // ========================================================================= // Create the arguments required by:- // // get_wordpress_table_for_dataset( // $dataset_slug_singular , // $dataset_slug_plural , // $column_titles_by_name , // $sortable_columns , // $default_orderby , // $default_order , // $rows_per_page , // $table_data // ) // // These arguments are created from the specified dataset's:- // -- Standard Dataset Manager dataset definition, and; // -- It's dataset records. // ========================================================================= // ------------------------------------------------------------------------- // A Standard Dataset Manager dataset definition is like (eg):- // // $selected_datasets_dmdd = Array( // // [dataset_slug] => projects // [dataset_name_singular] => project // [dataset_name_plural] => projects // [dataset_title_singular] => Project // [dataset_title_plural] => Projects // [basepress_dataset_handle] => Array( // [nice_name] => researchAssistant_byFernTec_projects // [unique_key] => d2562b23-3c20-4368-92c4-2b6cd...200c9a66 // [version] => 0.1 // ) // // [dataset_records_table] => Array( // // [column_defs] => Array( // // [0] => Array( // [base_slug] => title // [label] => Project Title // [question_sortable] => 1 // [raw_value_from] => Array( // [method] => array-storage-field-slug // [instance] => title // ) // // [display_treatments] => Array() // [sort_treatments] => Array() // // [data_field_slug_to_display] => title // [data_field_slug_to_sort_by] => title // [header_halign] => center // [header_valign] => middle // [data_halign] => center // [data_valign] => middle // [width_in_percent] => 50 // ) // // [1] => Array( // [base_slug] => action // [label] => Action // [question_sortable] => // [raw_value_from] => Array( // [method] => special-type // [instance] => action // ) // // [display_treatments] => Array() // [sort_treatments] => Array() // // [data_field_slug_to_display] => action // [data_field_slug_to_sort_by] => action // [header_halign] => center // [header_valign] => middle // [data_halign] => center // [data_valign] => middle // [width_in_percent] => 50 // ) // // ) // // [rows_per_page] => 10 // [default_data_field_slug_to_orderby] => title // [default_order] => asc // [actions] => Array( // [edit] => edit // [delete] => delete // ) // [action_separator] => // [checked_defaulted_ok] => 1 // // ) // // [zebra_form] => Array(...) // // [array_storage_record_structure] => Array(...) // // [array_storage_key_field_slug] => key // // ) // // ------------------------------------------------------------------------- //pr( $selected_datasets_dmdd ) ; // ------------------------------------------------------------------------- // The dataset's records are like (eg):- // // $dataset_records = Array( // // [0] => Array( // [datetime_created_UTC] => 1387428878 // [datetime_last_modified_UTC] => 1387428878 // [key] => 52b27c0e89913 // [title] => Project 1 // [notes_slash_comments] => // ) // // ... // // ) // // ------------------------------------------------------------------------- //pr( $dataset_records ) ; // ========================================================================= // dataset_slug_singular // ========================================================================= $dataset_slug_singular = 'record' ; // ------------------------------------------------------------------------- if ( isset( $selected_datasets_dmdd['dataset_name_singular'] ) && is_string( $selected_datasets_dmdd['dataset_name_singular'] ) ) { if ( trim( $selected_datasets_dmdd['dataset_name_singular'] ) !== '' ) { $dataset_slug_singular = trim( $selected_datasets_dmdd['dataset_name_singular'] ) ; } } // ========================================================================= // dataset_slug_plural // ========================================================================= $dataset_slug_plural = 'records' ; // ------------------------------------------------------------------------- if ( isset( $selected_datasets_dmdd['dataset_name_plural'] ) && is_string( $selected_datasets_dmdd['dataset_name_plural'] ) ) { if ( trim( $selected_datasets_dmdd['dataset_name_plural'] ) !== '' ) { $dataset_slug_plural = trim( $selected_datasets_dmdd['dataset_name_plural'] ) ; } } // ========================================================================= // GET the DATASET RECORDS to be displayed... // ========================================================================= require_once( dirname( __FILE__ ) . '/get-dataset-records-table-data.php' ) ; // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x211_standardDatasetManager\ // get_dataset_records_table_data( // $selected_datasets_dmdd , // $dataset_records , // $dataset_slug , // $dataset_title , // $question_front_end , // $caller_apps_includes_dir , // $data_for // ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Gets the:- // $table_data // // for the specified dataset and it's data. // // $data_for must be one of:- // o 'wp-list-table' // o 'dhtmlx-grid' // // RETURNS // o On SUCCESS // - - - - - // # $data_for = 'wp-list-table' // array( // ARRAY $table_data , // ARRAY $data_field_slugs_for_column_sorting , // STRING $support_javascript // ) // # $data_for = 'dhtmlx-grid' // array( // ARRAY $table_data , // ARRAY $sort_data , // ARRAY $data_field_slugs_for_column_sorting , // STRING $support_javascript // ) // // Where:- // $support_javascript // is the Javascript required (for things like "DELETE this // record? ARE YOU SURE?" confirmation, etc), // // o On FAILURE // - - - - - // $error_message STRING // ------------------------------------------------------------------------- $data_for = 'wp-list-table' ; // ------------------------------------------------------------------------- $result = get_dataset_records_table_data( $all_application_dataset_definitions , $selected_datasets_dmdd , $dataset_records , $dataset_slug , $dataset_title , $question_front_end , $caller_apps_includes_dir , $data_for ) ; // ------------------------------------------------------------------------- if ( is_string( $result ) ) { return standard_dataset_manager_error( $dataset_manager_home_page_title , $result , $caller_apps_includes_dir , $question_front_end ) ; } // ------------------------------------------------------------------------- list( $table_data , $data_field_slugs_for_column_sorting , $support_javascript ) = $result ; // ------------------------------------------------------------------------- // Here we should have (eg):- // // $table_data = Array( // // [0] => Array( // [question_disabled_display] => no // [question_disabled] => // [image_url_display] => Ad Swapper Happy Dogs Ad 2 Png // [image_url] => http://localhost/plugdev/wp-content/uploads/2015/02/ad-swapper-happy-dogs-ad-2.png // [link_url_display] => http://www.nzkc.org.nz/ // [link_url] => http://www.nzkc.org.nz/ // [special_type] => // [width_x_height] => 861 x 494 // [action] => edit delete // ) // // ... // // ) // // ------------------------------------------------------------------------- //\greatKiwi_byFernTec_adSwapper_local_v0x1x211_testDebug\pr( // $table_data , // '$table_data' // ) ; // ========================================================================= // column_titles_by_name // sortable_columns // ========================================================================= // ------------------------------------------------------------------------- // Here we should have (eg):- // // $selected_datasets_dmdd['dataset_records_table'] = array( // // [column_defs] => Array( // // [0] => Array( // [base_slug] => title // [label] => Project Title // [question_sortable] => 1 // [raw_value_from] => Array( // [method] => array-storage-field-slug // [instance] => title // ) // // [display_treatments] => Array() // [sort_treatments] => Array() // // [data_field_slug_to_display] => title // [data_field_slug_to_sort_by] => title // [header_halign] => center // [header_valign] => middle // [data_halign] => center // [data_valign] => middle // [width_in_percent] => 50 // ) // // [1] => Array( // [base_slug] => action // [label] => Action // [question_sortable] => // [raw_value_from] => Array( // [method] => special-type // [instance] => action // ) // // [display_treatments] => Array() // [sort_treatments] => Array() // // [data_field_slug_to_display] => action // [data_field_slug_to_sort_by] => action // [header_halign] => center // [header_valign] => middle // [data_halign] => center // [data_valign] => middle // [width_in_percent] => 50 // ) // // ) // // [rows_per_page] => 10 // [default_data_field_slug_to_orderby] => title // [default_order] => asc // [actions] => Array( // [edit] => edit // [delete] => delete // ) // [action_separator] => // [checked_defaulted_ok] => 1 // // ) // // ------------------------------------------------------------------------- $column_titles_by_name = array() ; $sortable_columns = array() ; // ------------------------------------------------------------------------- if ( isset( $selected_datasets_dmdd['dataset_records_table']['column_defs'] ) && is_array( $selected_datasets_dmdd['dataset_records_table']['column_defs'] ) && count( $selected_datasets_dmdd['dataset_records_table']['column_defs'] ) > 0 ) { // --------------------------------------------------------------------- $column_titles_by_name = array() ; // --------------------------------------------------------------------- foreach ( $selected_datasets_dmdd['dataset_records_table']['column_defs'] as $column_index => $this_column ) { // ----------------------------------------------------------------- // Here we should have (eg):- // // $this_column = array( // [base_slug] => title // [label] => Project Title // [label_function] => NULL // [question_sortable] => 1 // [raw_value_from] => Array( // [method] => array-storage-field-slug // [instance] => title // ) // // [display_treatments] => Array() // [sort_treatments] => Array() // // [data_field_slug_to_display] => title // [data_field_slug_to_sort_by] => title // [header_halign] => center // [header_valign] => middle // [data_halign] => center // [data_valign] => middle // [width_in_percent] => 50 // ) // // ----------------------------------------------------------------- // ================================================================= // If a "label_function" was specified, then create/override the // "label"... // ================================================================= if ( array_key_exists( 'label_function' , $this_column ) && is_array( $this_column['label_function'] ) && array_key_exists( 'name_incl_namespace' , $this_column['label_function'] ) && is_string( $this_column['label_function']['name_incl_namespace'] ) && trim( $this_column['label_function']['name_incl_namespace'] ) !== '' ) { // ----------------------------------------------------------------- // Here we should have (eg):- // // $this_column = array( // ... // [label_function] => Array( // [name_incl_namespace] => \greatKiwi...adSwapperAvailableSites\get_label_4_display_this_sites_ads_on_your_site_column // [extra_args] => // ) // ... // ) // // ----------------------------------------------------------------- //\greatKiwi_byFernTec_adSwapper_local_v0x1x211_testDebug\pr( // $this_column , // '$this_column' // ) ; // ----------------------------------------------------------------- if ( ! function_exists( $this_column['label_function']['name_incl_namespace'] ) ) { $ln = __LINE__ - 2 ; $safe_column_slug = htmlentities( $this_column['base_slug'] ) ; $col_number = $column_index + 1 ; $msg = <<( // $core_plugapp_dirs , // $all_application_dataset_definitions , // $selected_datasets_dmdd , // $dataset_records , // $dataset_title , // $dataset_slug , // $question_front_end , // $table_data , // $this_column , // $extra_args // ) // - - - - - - - - - - - - - - - - - - - - - - - // RETURNS // On SUCCESS // $column_label STRING // // On FAILURE // ARRAY( $error_message STRING ) // ------------------------------------------------------------------------- $result = $this_column['label_function']['name_incl_namespace']( $core_plugapp_dirs , $all_application_dataset_definitions , $selected_datasets_dmdd , $dataset_records , $dataset_title , $dataset_slug , $question_front_end , $table_data , $this_column , $label_fn_extra_args ) ; // ----------------------------------------------------------------- if ( is_array( $result ) ) { return standard_dataset_manager_error( $dataset_manager_home_page_title , $result[0] , $caller_apps_includes_dir , $question_front_end ) ; } // ----------------------------------------------------------------- $this_column['label'] = $result ; // ----------------------------------------------------------------- } // ------------------------------------------------------------- $column_titles_by_name[ $this_column['data_field_slug_to_display'] ] = $this_column['label'] ; // ------------------------------------------------------------- // $sortable_columns should be like (eg):- // // $sortable_columns = array( // '' => array( '' , TRUE/FALSE ) // ... // ) // // Where TRUE/FALSE indicates whether or not the table data is // already sorted on this column (use FALSE unless you're sure). // ------------------------------------------------------------- if ( $this_column['question_sortable'] === TRUE ) { // ------------------------------------------------------- $sortable_columns[ $this_column['data_field_slug_to_display'] ] = array( $this_column['data_field_slug_to_sort_by'] , FALSE ) ; // --------------------------------------------------------- } // ----------------------------------------------------------------- } // --------------------------------------------------------------------- } elseif ( count( $dataset_records ) > 0 ) { // --------------------------------------------------------------------- foreach ( $dataset_records[0] as $name => $value ) { $column_titles_by_name[ $name ] = to_title( $name ) ; } // --------------------------------------------------------------------- } //pr( $column_titles_by_name ) ; // ========================================================================= // default_orderby // ========================================================================= //$data_field_slugs_for_column_sorting = array() ; $default_orderby = '' ; // ------------------------------------------------------------------------- if ( isset( $selected_datasets_dmdd['dataset_records_table']['default_data_field_slug_to_orderby'] ) && is_string( $selected_datasets_dmdd['dataset_records_table']['default_data_field_slug_to_orderby'] ) && in_array( $selected_datasets_dmdd['dataset_records_table']['default_data_field_slug_to_orderby'] , $data_field_slugs_for_column_sorting , TRUE ) ) { $default_orderby = $selected_datasets_dmdd['dataset_records_table']['default_data_field_slug_to_orderby'] ; } elseif ( count( $dataset_records ) > 0 ) { $temp = array_keys( $dataset_records[0] ) ; if ( in_array( $temp[0] , $data_field_slugs_for_column_sorting , TRUE ) ) { $default_orderby = $temp[0] ; } } // ========================================================================= // default_order // ========================================================================= $default_order = '' ; // ------------------------------------------------------------------------- if ( isset( $selected_datasets_dmdd['dataset_records_table']['default_order'] ) && is_string( $selected_datasets_dmdd['dataset_records_table']['default_order'] ) && in_array( strtolower( $selected_datasets_dmdd['dataset_records_table']['default_order'] ) , array( 'asc' , 'desc' ) , TRUE ) ) { $default_order = strtolower( $selected_datasets_dmdd['dataset_records_table']['default_order'] ) ; } else { $default_order = 'asc' ; } // ========================================================================= // rows_per_page // ========================================================================= $rows_per_page = 10 ; // ------------------------------------------------------------------------- if ( array_key_exists( 'rows_per_page' , $selected_datasets_dmdd['dataset_records_table'] ) && is_scalar( $selected_datasets_dmdd['dataset_records_table']['rows_per_page'] ) && ctype_digit( (string) $selected_datasets_dmdd['dataset_records_table']['rows_per_page'] ) && $selected_datasets_dmdd['dataset_records_table']['rows_per_page'] > 0 ) { $rows_per_page = $selected_datasets_dmdd['dataset_records_table']['rows_per_page'] ; } // ========================================================================= // Get the SELECTED PAGE VARIANT (if there is one)... // ========================================================================= $selected_page_variant = NULL ; // ------------------------------------------------------------------------- if ( array_key_exists( 'pv' , $_GET ) && array_key_exists( 'page_variants' , $selected_datasets_dmdd['dataset_records_table'] ) && trim( $_GET['pv'] ) !== '' && \greatKiwi_byFernTec_adSwapper_local_v0x1x211_stringUtils\ctype_alphanumeric_underscore_dash( $_GET['pv'] ) && is_array( $selected_datasets_dmdd['dataset_records_table']['page_variants'] ) && array_key_exists( $_GET['pv'] , $selected_datasets_dmdd['dataset_records_table']['page_variants'] ) && is_array( $selected_datasets_dmdd['dataset_records_table']['page_variants'][ $_GET['pv'] ] ) && count( $selected_datasets_dmdd['dataset_records_table']['page_variants'][ $_GET['pv'] ] ) > 0 ) { $selected_page_variant = $selected_datasets_dmdd['dataset_records_table']['page_variants'][ $_GET['pv'] ] ; } // ========================================================================= // GET the HTML for the WordPress Admin "List Table" - which HTML displays // the dataset's records... // ========================================================================= require_once( dirname( __FILE__ ) . '/manage-dataset-wp-list-table-inner.php' ) ; // ------------------------------------------------------------------------- // get_wordpress_table_for_dataset( // $dataset_slug_singular , // $dataset_slug_plural , // $column_titles_by_name , // $sortable_columns , // $default_orderby , // $default_order , // $rows_per_page , // $table_data // ) // - - - - - - - - - - - - - - - - - - // $sortable_columns should be like (eg):- // // $sortable_columns = array( // '' => array( '' , TRUE/FALSE ) // ... // ) // // Where TRUE/FALSE indicates whether or not the table data is already // sorted on this column (use FALSE unless you're sure). // // RETURNS // $body_content STRING // ------------------------------------------------------------------------- $dataset_table = get_wordpress_table_for_dataset( $dataset_slug_singular , $dataset_slug_plural , $column_titles_by_name , $sortable_columns , $default_orderby , $default_order , $rows_per_page , $table_data ) ; // ========================================================================= // Get the Custom Page Header HTML... // ========================================================================= $custom_page_header_html = '' ; // ------------------------------------------------------------------------- if ( array_key_exists( 'custom_page_header_function' , $selected_datasets_dmdd['dataset_records_table'] ) && is_string( $selected_datasets_dmdd['dataset_records_table']['custom_page_header_function'] ) && trim( $selected_datasets_dmdd['dataset_records_table']['custom_page_header_function'] ) !== '' ) { // --------------------------------------------------------------------- if ( ! function_exists( $selected_datasets_dmdd['dataset_records_table']['custom_page_header_function'] ) ) { $msg = <<( // $core_plugapp_dirs , // $all_application_dataset_definitions , // $selected_datasets_dmdd , // $dataset_records , // $dataset_title , // $dataset_slug , // $question_front_end , // $table_data // ) ; // - - - - - - - - - - - - - - - - - - - - - - - - - - - // RETURNS // On SUCCESS // $custom_dataset_records_table_page_header_html STRING // // On FAILURE // array( $error_message STRING ) // --------------------------------------------------------------------- $custom_page_header_html = $selected_datasets_dmdd['dataset_records_table']['custom_page_header_function']( $core_plugapp_dirs , $all_application_dataset_definitions , $selected_datasets_dmdd , $dataset_records , $dataset_title , $dataset_slug , $question_front_end , $table_data ) ; // --------------------------------------------------------------------- if ( is_array( $custom_page_header_html ) ) { return standard_dataset_manager_error( $dataset_manager_home_page_title , $custom_page_header_html[0] , $caller_apps_includes_dir , $question_front_end ) ; } // --------------------------------------------------------------------- } // ========================================================================= // Get the FILTER TOOLBAR HTML... // ========================================================================= require_once( dirname( __FILE__ ) . '/filtering-ui.php' ) ; // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x211_standardDatasetManager\ // question_get_filter_toolbar( // $core_plugapp_dirs , // $all_application_dataset_definitions , // $selected_datasets_dmdd , // $dataset_records , // $dataset_title , // $dataset_slug , // $question_front_end , // $table_data // ) // - - - - - - - - - - - - - - - - - - - - - - - // $table_data is the data to be displayed in the "Dataset Records Table". // And was created AFTER any filtering (of the dataset records that the // Dataset Records Table is displaying) was applied. // // RETURNS // On SUCCESS // $toolbar_html STRING // (possibly the empty string, if NO filter toolbar) // // On FAILURE // array( $error_message STRING ) // ------------------------------------------------------------------------- $filter_toolbar_html = question_get_filter_toolbar( $core_plugapp_dirs , $all_application_dataset_definitions , $selected_datasets_dmdd , $dataset_records , $dataset_title , $dataset_slug , $question_front_end , $table_data ) ; // ------------------------------------------------------------------------- if ( is_array( $filter_toolbar_html ) ) { return standard_dataset_manager_error( $dataset_manager_home_page_title , $filter_toolbar_html[0] , $caller_apps_includes_dir , $question_front_end ) ; } // ========================================================================= // Get the HTML for the TOP BUTTON ROW... // ========================================================================= $top_buttons_html = '' ; $top_buttons_expander_html = '' ; // ------------------------------------------------------------------------- $standard_left_margin = 'margin-left:1.5em; ' ; $left_margin = '' ; // ------------------------------------------------------------------------- //\greatKiwi_byFernTec_adSwapper_local_v0x1x211_testDebug\pr( $selected_datasets_dmdd ) ; if ( isset( $selected_datasets_dmdd['dataset_records_table']['buttons'] ) && is_array( $selected_datasets_dmdd['dataset_records_table']['buttons'] ) ) { // --------------------------------------------------------------------- // Here we should have (eg):- // // $selected_datasets_dmdd['dataset_records_table']['buttons'] = array( // array( // 'type' => 'add_record' // ) , // array( // 'type' => 'custom' , // 'title' => 'Clone Built-In Layout' , // 'get_button_html_function_name' => '\\' . __NAMESPACE__ . '\\get_clone_built_in_layout_button_html' , // 'extra_args' => NULL // ) , // array( // 'type' => 'custom' , // 'title' => 'Clone Custom Layout' , // 'get_button_html_function_name' => '\\' . __NAMESPACE__ . '\\get_clone_custom_layout_button_html' , // 'extra_args' => NULL // ) // array( // 'type' => 'delete_all_records' // ) // array( // 'type' => 'show_orphaned_records' // ) // ) // // --------------------------------------------------------------------- foreach ( $selected_datasets_dmdd['dataset_records_table']['buttons'] as $this_button_index => $this_button_data ) { // ----------------------------------------------------------------- $this_button_number = $this_button_index + 1 ; // ----------------------------------------------------------------- if ( $this_button_data['type'] === 'add_record' ) { // ============================================================= // "ADD RECORD" BUTTON ? // ============================================================= if ( array_key_exists( 'max_records' , $selected_datasets_dmdd ) ) { // ----------------------------------------------------------------- if ( ! is_numeric( $selected_datasets_dmdd['max_records'] ) || ! \ctype_digit( (string) $selected_datasets_dmdd['max_records'] ) ) { $php_int_max = number_format( PHP_INT_MAX ) ; $msg = <<Add {$selected_datasets_dmdd['dataset_title_singular']} EOT; // ----------------------------------------------------------------- } else { // ----------------------------------------------------------------- $add_record_button = '' ; // ----------------------------------------------------------------- } // --------------------------------------------------------------------- $top_buttons_html .= $add_record_button ; $left_margin = $standard_left_margin ; // --------------------------------------------------------------------- } elseif ( $this_button_data['type'] === 'delete_all_records' ) { // ============================================================= // "DELETE ALL RECORDS" BUTTON ? // ============================================================= require_once( dirname( __FILE__ ) . '/get-dataset-urls.php' ) ; // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x211_standardDatasetManager\get_delete_record_url( // $caller_apps_includes_dir , // $question_front_end , // $dataset_slug = NULL , // $record_key = NULL , // $view_title = FALSE , // $return_to = FALSE , // $view_slug = FALSE // ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Returns the "delete-record" URL. // // If $dataset_slug is NULL, then we use:- // $_GET['dataset_slug'] // // If $record_key:- // // o Is NULL, then we use:- // $_GET['record_key'] // // (if it's valid) // // o Is "all", then we're deleting ALL the dataset's records. // // RETURNS // o On SUCCESS! // - - - - - - // STRING $url // // o On FAILURE! // - - - - - - // ARRAY( $error_message STRING ) // ------------------------------------------------------------------------- $dataset_slug = NULL ; $record_key = 'all' ; // --------------------------------------------------------------------- $url = get_delete_record_url( $caller_apps_includes_dir , $question_front_end , $dataset_slug , $record_key ) ; // --------------------------------------------------------------------- if ( is_array( $url ) ) { return standard_dataset_manager_error( $dataset_manager_home_page_title , $url[0] , $caller_apps_includes_dir , $question_front_end ) ; } // --------------------------------------------------------------------- $dataset_title_singular = trim( $selected_datasets_dmdd['dataset_title_singular'] ) ; // --------------------------------------------------------------------- $delete_all_records_button = <<Delete All Records EOT; // ------------------------------------------------------------- $top_buttons_html .= $delete_all_records_button ; $left_margin = $standard_left_margin ; // ------------------------------------------------------------- /* } elseif ( $this_button_data['type'] === 'show_orphaned_records' ) { // ============================================================= // "SHOW ORPHANED RECORDS" BUTTON ? // ============================================================= if ( count( $orphaned_record_indices ) > 0 ) { // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x211_standardDatasetManager\get_orphaned_records_table_html( // $all_application_dataset_definitions , // $caller_apps_includes_dir , // $selected_datasets_dmdd , // $dataset_records , // $dataset_slug , // $dataset_title , // $question_front_end , // $orphaned_record_indices , // $data_for // ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Returns the HTML for a table to display/delete the orphaned records in // the dataset. // // $data_for must be one of:- // o 'wp-list-table' // o 'dhtmlx-grid' // // RETURNS // o On SUCCESS // - - - - - // (Possibly empty) $orphaned_records_html STRING // // o On FAILURE // - - - - - // array( $error_message STRING ) // ------------------------------------------------------------------------- if ( $question_front_end ) { $data_for = 'dhtmlx-grid' ; } else { $data_for = 'wp-list-table' ; } // --------------------------------------------------------- $orphaned_records_html = get_orphaned_records_table_html( $all_application_dataset_definitions , $caller_apps_includes_dir , $selected_datasets_dmdd , $dataset_records , $dataset_slug , $dataset_title , $question_front_end , $orphaned_record_indices , $data_for ) ; // --------------------------------------------------------- if ( is_array( $orphaned_records_html ) ) { return standard_dataset_manager_error( $dataset_manager_home_page_title , $orphaned_records_html[0] , $caller_apps_includes_dir , $question_front_end ) ; } // --------------------------------------------------------- if ( $orphaned_records_html !== '' ) { // ----------------------------------------------------- $onclick = <<Show Orphaned {$record_type} EOT; // ----------------------------------------------------- $top_buttons_html .= $orphaned_records_button ; $left_margin = $standard_left_margin ; // ----------------------------------------------------- $top_buttons_expander_html .= <<