value, ...] sono gli attributi aggiuntivi */ var $add_attributes = []; /** * @var String $uniqid_div */ var $uniqid_div = ""; /** * @var String $mode ajax|get|post */ var $mode = ""; /** * @var Bool $block_opened se è stato aperto il blocco oppure no */ var $block_opened = false; /** * @var Bool $search_opened se è stato aperto il blocco del search ?! */ var $search_opened = false; /** * @var \admin_form\ADFO_search_form $search */ var $search = false; /** * @var Bool $div_container se è stato disegnato il div che contiene tutto * (in ajax non deve essere ridisegnato) */ var $div_container = true; /** * @var string $color il colore del blocco */ var $color = 'blue'; /** * @var ADFO_list_setting[] $list_setting */ var $list_setting; /** * @param \admin_form\ADFO_model $table_model */ function __construct($post_id, $mode = null, $prefix = "") { $this->list_id = $post_id; if ($prefix == "") { $prefix = "dbp".$post_id; } $this->prefix_request = $prefix; $post = ADFO_functions_list::get_post_dbp($post_id); if ($post == false) return ''; $this->table_model = ADFO_functions_list::get_model_from_list_params($post->post_content); // i params settati nella lista $extra_params = ADFO_functions_list::get_extra_params_from_list_params(@$post->post_content['sql_filter']); if ($this->table_model) { // global non è documentata! PinaCode::set_var('global.dbp_filter_path', $prefix); PinaCode::set_var('global.dbp_id', $post_id); ADFO_functions_list::add_lookups_column($this->table_model, $post); ADFO_functions_list::add_post_type_settings($this->table_model, $post, true); ADFO_functions_list::add_post_user_column($this->table_model, $post); ADFO_functions_list::add_frontend_request_filter_to_model($this->table_model, $post, $post_id, $prefix); $this->table_model->get_list(); //print ($this->table_model->get_current_query()); $total_row = $this->table_model->get_count(); PinaCode::set_var('total_row', absint($total_row)); $this->uniqid_div = 'dbp_' . ADFO_fn::get_uniqid(); $this->table_model->update_items_with_setting($post, false); $this->table_model->check_for_filter(); $this->add_extra_params($extra_params); if (isset($post->post_content['frontend_view'])) { $this->frontend_view_setting = $post->post_content['frontend_view']; $this->no_result = (isset($post->post_content['frontend_view']['no_result_custom_text'])) ? $post->post_content["frontend_view"]['no_result_custom_text'] : ''; } $this->list_setting = $post->post_content['list_setting']; } if (!is_null($mode)) { $this->mode = $mode; } else { $this->mode = $this->get_frontend_view('table_update','get'); } $this->set_color(); } /** * uniqid_div serve come riferimento per eventuali chiamate ajax della tabella. * TODO Potrebbe essere usato anche per differenti chiamate non ajax alla stessa lista */ public function set_uniqid($uniq_id = "") { if ($uniq_id != "") { $this->uniqid_div = $uniq_id; } return $this->uniqid_div; } /** * Setta il colore generico */ public function set_color($color = '') { if ($color == "") { $this->color = $this->get_frontend_view('table_style_color', 'blue'); } else { $this->color = $color; } return $this->color; } /** * Se chiamata non stampa il div che contiene il codice */ public function hide_div_container() { $this->div_container = false; } /** * Verifica e ritorna un'impostazione di frontendview */ public function get_frontend_view($key, $default = false) { if (array_key_exists($key, $this->frontend_view_setting)) { return \wp_unslash($this->frontend_view_setting[$key]); } else { return $default; } } /** * Stampa la tabella di una lista nel frontend * @param Array $items Accetta un array di oggetti o un array di array. * @return void */ public function table( $custom_class = "", $table_sort = null) { $this->open_block(); $this->update_table_class($custom_class); if (!isset($this->table_model->items)) return; $items = $this->table_model->items; if (!is_array($items) || count ($items) == 0) return; $array_thead = array_shift($items); ?>
|
get_sort($table_sort, $value->original_table)) : ?>
name; ?>
icons($value->name_request, $value->name); ?>
|
|---|
$key), ADFO_fn::get_allowed_tag() );
?> |