0) { $post = ADFO_functions_list::get_post_dbp($id); if ($post == false) { _e('Something is wrong, call the site administrator', 'admin_form'); return; } else { $list_title = $post->post_title; $description = PinaCode::execute_shortcode($post->post_excerpt); $sql = @$post->post_content['sql']; if ($sql == "") { $link = admin_url("admin.php?page=admin_form§ion=list-sql-edit&dbp_id=".$id); $msg_error = ''.__('Something is wrong, call the site administrator', 'admin_form').""; } // questo aggiunge i filtri del setting $table_model = ADFO_functions_list::get_model_from_list_params($post->post_content); $list_of_columns = ADFO_fn::get_all_columns(); if ($table_model->sql_type() == "multiqueries") { // NON GESTISCO MULTIQUERY NELLE LISTE $msg_error = __('No Multiquery permitted in list', 'admin_form'); } else if ($table_model->sql_type() == "select") { // SEARCH in all columns //print "action: ".$action ; $search = ADFO_fn::get_request('search', false, 'remove_slashes'); if ($search && $search != "" && in_array($action, ['search','order','limit_start','change_limit'])) { // TODO se รจ search deve rimuovere prima tutti i where!!!! $schemas = $table_model->get_schema(); $filter =[] ; //[[op:'', column:'',value:'' ], ... ]; foreach ($schemas as $schema) { if ($schema->orgtable != "" && $schema->table != "" && $schema->name != "") { $filter[] = ['op'=>'LIKE', 'column'=> '`'.esc_attr($schema->table).'`.`'.esc_attr($schema->orgname).'`', 'value' =>$search]; } } if (count($filter) > 0) { $table_model->list_add_where($filter, 'OR'); } //print ("

".$table_model->get_current_query()."

"); } else { $_REQUEST['search'] = ''; } ADFO_fn::set_open_form(); // cancello le righe selezionate! if ($action == "delete_rows" && isset($_REQUEST["remove_ids"]) && is_array($_REQUEST["remove_ids"])) { $ids = ADFO_fn::sanitize_absint_recursive($_REQUEST["remove_ids"]); $result_delete = ADFO_fn::delete_rows($ids, '', $id); if ($result_delete['error'] != "") { $msg_error = $result_delete; } else { $msg = __('The data has been removed.', 'admin_form'); } } $extra_params = ADFO_functions_list::get_extra_params_from_list_params(@$post->post_content['sql_filter']); //var_dump ($extra_params); //die; if ( ADFO_fn::get_request('filter.limit', 0) == 0) { if (isset($post->post_content['sql_limit']) && (int)$post->post_content['sql_limit'] > 0) { $sql_limit = (int)$post->post_content['sql_limit']; } else { $sql_limit = 100; } $_REQUEST['filter']['limit'] = absint($sql_limit); $table_model->list_add_limit(0, $sql_limit); } if ( ADFO_fn::get_request('filter.sort.field', '') == '') { if (isset($post->post_content['sql_order']['sort']) && isset($post->post_content['sql_order']['field'])) { $_REQUEST['sort']['field'] = $post->post_content['sql_order']['field']; $table_model->list_add_order($post->post_content['sql_order']['field'], $post->post_content['sql_order']['sort']); } } ADFO_functions_list::add_lookups_column($table_model, $post); ADFO_fn::add_request_filter_to_model($table_model, $this->max_show_items); //PinaCode::set_var('global.dbp_filter_path', "dbp".$id); //ADFO_functions_list::add_frontend_request_filter_to_model($table_model, $post->post_content , $id); $table_items = $table_model->get_list(); //print "

".$table_model->get_current_query()."

"; $table_model->update_items_with_setting($post); ADFO_fn::items_add_action($table_model, $id); $table_model->check_for_filter(); ADFO_fn::remove_hide_columns($table_model); $html_table = new ADFO_html_table(); $html_table->add_table_class('dbp-table-admin-menu'); // TODO Devo rimettere i dati sulla tabella per paginazione ecc... $html_table->add_extra_params($extra_params); //var_dump($table_model->items); $html_content = $html_table->template_render($table_model); // lo uso nel template //print (get_class($table_model) ); ADFO_fn::set_close_form(); } else { $msg_error = __('Something is wrong, call the site administrator', 'admin_form'); } } } else { $msg_error = __('Something is wrong, call the site administrator', 'admin_form'); } require(dirname( __FILE__ ) . "/partials/af-page-admin-menu.php"); //print "OK dbp LIST ADMIN"; } }