url_tree // [view_title] => URL Tree // // [singular_name_of_the_listed_records] => URL Tree // [plural_name_of_the_listed_records] => URL Tree // // [page_header] => array( // 'method' => 'standard' // ) // // [page_footer] => array( // 'method' => 'standard' // ) // // [view_records_table] => Array( // // [column_defs] => Array( // // [0] => Array( // [base_slug] => tree // [label] => Tree // [question_sortable] => // [raw_value_from] => Array( // [method] => data-table // [instance] => tree // ) // [display_treatments] => // ) // // [1] => Array( // [base_slug] => action // [label] => Action // [question_sortable] => // [raw_value_from] => Array( // [method] => data-table // [instance] => actions // ) // [display_treatments] => // ) // // ) // // [get_table_data_function_name] => "[\\some_namespace_name\\]get_table_data" // // [table_header_before_iframe] => array( // 'method' => 'button-add-dataset' , // 'instance' => 'projects' // ) // [table_footer_after_iframe] => array( // 'method' => 'none' // ) // // [table_header_in_iframe] => array( // 'method' => 'none' // ) // [table_footer_in_iframe] => array( // 'method' => 'none' // ) // // [rows_per_page] => 10 // [default_data_field_slug_to_orderby] => // [default_order] => // [action_separator] => // // ) // // ) // // ------------------------------------------------------------------------- //pr( $selected_views_definition ) ; // ========================================================================= // VIEW_RECORDS_TABLE ? // ========================================================================= if ( ! array_key_exists( 'view_records_table' , $selected_views_definition ) ) { return << Array( // [base_slug] => tree // [label] => Projects / Categories / URLs // [question_sortable] => // [raw_value_from] => Array( // [method] => data-table // [instance] => tree // ) // [display_treatments] => // ) // // [1] => Array( // [base_slug] => add // [label] => Add // [question_sortable] => // [raw_value_from] => Array( // [method] => data-table // [instance] => add // ) // [display_treatments] => // ) // // [2] => Array( // [base_slug] => actions // [label] => Action // [question_sortable] => // [raw_value_from] => Array( // [method] => data-table // [instance] => actions // ) // [display_treatments] => // ) // // ) // // ------------------------------------------------------------------------- //pr( $view_records_table['column_defs'] ) ; // ========================================================================= // CHECK/DEFAULT the individual COLUMN DEFS... // ========================================================================= $total_widths_in_percent_so_far = 0 ; $number_columns_with_unspecified_width = 0 ; // ------------------------------------------------------------------------- $allowed_haligns = array( 'left' , 'center' , 'right' ) ; $allowed_valigns = array( 'top' , 'middle' , 'bottom' ) ; // ------------------------------------------------------------------------- foreach ( $view_records_table['column_defs'] as $this_index => $this_column_def ) { // --------------------------------------------------------------------- $column_number = $this_index + 1 ; // ===================================================================== // BASE_SLUG ? // ===================================================================== // --------------------------------------------------------------------- // If NOT specified, we try to default it from the "instance" in:- // // 'raw_value_from' => array( // 'method' => 'data-table' , // 'instance' => "" // ) // // But if this ISN'T possible, it's a FATAL error. // --------------------------------------------------------------------- if ( ! array_key_exists( 'base_slug' , $this_column_def ) || $this_column_def['base_slug'] === NULL ) { // ----------------------------------------------------------------- if ( array_key_exists( 'raw_value_from' , $this_column_def ) && is_array( $this_column_def['raw_value_from'] ) && array_key_exists( 'method' , $this_column_def['raw_value_from'] ) && in_array( $this_column_def['raw_value_from']['method'] , array( 'data-table' ) , TRUE ) && array_key_exists( 'instance' , $this_column_def['raw_value_from'] ) && is_string( $this_column_def['raw_value_from']['instance'] ) && trim( $this_column_def['raw_value_from']['instance'] ) !== '' && \greatKiwi_byFernTec_adSwapper_local_v0x1x210_stringUtils\ctype_varname( $this_column_def['raw_value_from']['instance'] ) && strlen( $this_column_def['raw_value_from']['instance'] ) <= 64 ) { $view_records_table['column_defs'][ $this_index ]['base_slug'] = $this_column_def['raw_value_from']['instance'] ; } else { return << 64 ) { return << 'data-table' , // 'instance' => "" // ) // // But if:- // $this_column_def['raw_value_from'] // // ISN'T specified, we'll try to default it from:- // $this_column_def['base_slug'] // // Though if this ISN'T possible, it's a FATAL error. // --------------------------------------------------------------------- if ( ! array_key_exists( 'raw_value_from' , $this_column_def ) || $this_column_def['raw_value_from'] === NULL ) { // ----------------------------------------------------------------- $view_records_table['column_defs'][ $this_index ]['raw_value_from'] = array( 'method' => 'data-table' , 'instance' => $view_records_table['column_defs'][ $this_index ]['base_slug'] ) ; // ----------------------------------------------------------------- } else { // ----------------------------------------------------------------- if ( ! is_array( $this_column_def['raw_value_from'] ) ) { return << 64 ) { return << 0 ) { $view_records_table['column_defs'][ $this_index ]['data_field_slug_to_display'] = $view_records_table['column_defs'][ $this_index ]['base_slug'] . '_display' ; } else { $view_records_table['column_defs'][ $this_index ]['data_field_slug_to_display'] = $view_records_table['column_defs'][ $this_index ]['base_slug'] ; } // ===================================================================== // DATA_FIELD_SLUG_TO_SORT_BY ? // ===================================================================== if ( $view_records_table['column_defs'][ $this_index ]['question_sortable'] && count( $view_records_table['column_defs'][ $this_index ]['sort_treatments'] ) > 0 ) { $view_records_table['column_defs'][ $this_index ]['data_field_slug_to_sort_by'] = $view_records_table['column_defs'][ $this_index ]['base_slug'] . '_sort' ; } else { $view_records_table['column_defs'][ $this_index ]['data_field_slug_to_sort_by'] = $view_records_table['column_defs'][ $this_index ]['base_slug'] ; } // ===================================================================== // HEADER_HALIGN ? // ===================================================================== if ( isset( $this_column_def['header_halign'] ) ) { if ( ! in_array( $this_column_def['header_halign'] , $allowed_haligns , TRUE ) ) { return << 100 ) { return << 100 ) { return << 0 ) { // --------------------------------------------------------------------- // min column width is 1%... // --------------------------------------------------------------------- $leftover_width_required = $number_columns_with_unspecified_width ; $leftover_width_available = 100 - $total_widths_in_percent_so_far ; // --------------------------------------------------------------------- if ( $leftover_width_required > $leftover_width_available ) { $leftover_width_available = round( $leftover_width_available , 1 ) ; return << $this_column_def ) { if ( $this_column_def['width_in_percent'] == 0 ) { $view_records_table['column_defs'][ $this_index ]['width_in_percent'] = $leftover_width_per_column ; $total_widths_in_percent_so_far += $leftover_width_per_column ; } } // --------------------------------------------------------------------- } // ------------------------------------------------------------------------- if ( $total_widths_in_percent_so_far < 98 || $total_widths_in_percent_so_far > 102 ) { return << 255 ) { return << 'none' // ) // // --OR-- // // $view_records_table['table_header_before_iframe'] = array( // 'method' => 'button-add-dataset-record' , // 'instance' => 'projects' // ) // // ------------------------------------------------------------------------- if ( isset( $view_records_table['table_header_before_iframe'] ) ) { // --------------------------------------------------------------------- if ( ! is_array( $view_records_table['table_header_before_iframe'] ) ) { return << 64 || ! \greatKiwi_byFernTec_adSwapper_local_v0x1x210_stringUtils\ctype_alphanumeric_underscore_dash( $view_records_table['table_header_before_iframe']['method'] ) ) { return << 'none' ) ; // --------------------------------------------------------------------- } // ========================================================================= // TABLE_FOOTER_AFTER_IFRAME ? // ========================================================================= // ------------------------------------------------------------------------- // Here we should have (eg):- // // $view_records_table['table_footer_after_iframe'] = array( // 'method' => 'none' // ) // // --OR-- // // $view_records_table['table_footer_after_iframe'] = array( // 'method' => 'button-add-dataset-record' , // 'instance' => 'projects' // ) // // ------------------------------------------------------------------------- if ( isset( $view_records_table['table_footer_after_iframe'] ) ) { // --------------------------------------------------------------------- if ( ! is_array( $view_records_table['table_footer_after_iframe'] ) ) { return << 64 || ! \greatKiwi_byFernTec_adSwapper_local_v0x1x210_stringUtils\ctype_alphanumeric_underscore_dash( $view_records_table['table_footer_after_iframe']['method'] ) ) { return << 'none' ) ; // --------------------------------------------------------------------- } // ========================================================================= // TABLE_HEADER_IN_IFRAME ? // ========================================================================= // ------------------------------------------------------------------------- // Here we should have (eg):- // // $view_records_table['table_header_in_iframe'] = array( // 'method' => 'none' // ) // // --OR-- // // $view_records_table['table_header_in_iframe'] = array( // 'method' => 'button-add-dataset-record' , // 'instance' => 'projects' // ) // // ------------------------------------------------------------------------- if ( isset( $view_records_table['table_header_in_iframe'] ) ) { // --------------------------------------------------------------------- if ( ! is_array( $view_records_table['table_header_in_iframe'] ) ) { return << 64 || ! \greatKiwi_byFernTec_adSwapper_local_v0x1x210_stringUtils\ctype_alphanumeric_underscore_dash( $view_records_table['table_header_in_iframe']['method'] ) ) { return << 'none' ) ; // --------------------------------------------------------------------- } // ========================================================================= // TABLE_FOOTER_IN_IFRAME ? // ========================================================================= // ------------------------------------------------------------------------- // Here we should have (eg):- // // $view_records_table['table_footer_in_iframe'] = array( // 'method' => 'none' // ) // // --OR-- // // $view_records_table['table_footer_in_iframe'] = array( // 'method' => 'button-add-dataset-record' , // 'instance' => 'projects' // ) // // ------------------------------------------------------------------------- if ( isset( $view_records_table['table_footer_in_iframe'] ) ) { // --------------------------------------------------------------------- if ( ! is_array( $view_records_table['table_footer_in_iframe'] ) ) { return << 64 || ! \greatKiwi_byFernTec_adSwapper_local_v0x1x210_stringUtils\ctype_alphanumeric_underscore_dash( $view_records_table['table_footer_in_iframe']['method'] ) ) { return << 'none' ) ; // --------------------------------------------------------------------- } // ========================================================================= // ROWS_PER_PAGE ? // ========================================================================= if ( isset( $view_records_table['rows_per_page'] ) ) { // --------------------------------------------------------------------- if ( ! is_numeric( $view_records_table['rows_per_page'] ) || trim( $view_records_table['rows_per_page'] ) === '' || ! ctype_digit( (string) $view_records_table['rows_per_page'] ) ) { return << 'xxx' || ''/NULL (means orderby FIRST available data field) // --------------------------------------------------------------------- foreach ( $view_records_table['column_defs'] as $this_index => $this_column_def ) { if ( $this_column_def['question_sortable'] ) { $view_records_table['default_data_field_slug_to_orderby'] = $this_column_def['data_field_slug_to_sort_by'] ; break ; } } // --------------------------------------------------------------------- } // ========================================================================= // DEFAULT_ORDER ? // ========================================================================= if ( ! isset( $view_records_table['default_order'] ) ) { // --------------------------------------------------------------------- // default_order // => 'asc' OR 'desc' OR ''/NULL (means default to "asc") // --------------------------------------------------------------------- $view_records_table['default_order'] = 'asc' ; // --------------------------------------------------------------------- } // ========================================================================= // ACTION_SEPARATOR ? // ========================================================================= if ( ! isset( $view_records_table['action_separator'] ) ) { // --------------------------------------------------------------------- // action_separator // => '    ' // --------------------------------------------------------------------- $view_records_table['action_separator'] = '    ' ; // --------------------------------------------------------------------- } // ========================================================================= // SUCCESS! // ========================================================================= // $view_records_table['checked_defaulted_ok'] = TRUE ; // ------------------------------------------------------------------------- return $view_records_table ; // ========================================================================= // That's that! // ========================================================================= } // ============================================================================= // That's that! // =============================================================================