Merge branch 'ent-12502-doble-filtro-en-la-lista-de-dashboards' into 'develop'
Ent 12502 doble filtro en la lista de dashboards See merge request artica/pandorafms!6692
This commit is contained in:
commit
e4b85c8095
|
@ -99,10 +99,26 @@ if ($method === 'draw') {
|
|||
|
||||
$table->data = [];
|
||||
|
||||
$where_name = '';
|
||||
if (strlen($filter['free_search']) > 0) {
|
||||
$where = 'WHERE name LIKE "%'.$filter['free_search'].'%"';
|
||||
} else {
|
||||
$where = '';
|
||||
$where_name = 'name LIKE "%'.$filter['free_search'].'%"';
|
||||
}
|
||||
|
||||
$where_group = '';
|
||||
if (empty($filter['group']) === false && $filter['group'] !== '0') {
|
||||
$where_group = sprintf('id_group = %s', $filter['group']);
|
||||
if (empty($where_name) === false) {
|
||||
$where_group = 'AND '.$where_group;
|
||||
}
|
||||
}
|
||||
|
||||
$where = '';
|
||||
if (empty($where_name) === false || empty($where_group) === false) {
|
||||
$where = sprintf(
|
||||
'WHERE %s %s',
|
||||
$where_name,
|
||||
$where_group
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM tdashboard '.$where.' ORDER BY id '.$pagination;
|
||||
|
|
|
@ -731,8 +731,7 @@ class Manager implements PublicLogin
|
|||
int $limit=-1,
|
||||
bool $favourite=false,
|
||||
bool $slideshow=false,
|
||||
string $id_user='',
|
||||
array $rowFilter=[]
|
||||
string $id_user=''
|
||||
):array {
|
||||
global $config;
|
||||
|
||||
|
@ -750,14 +749,6 @@ class Manager implements PublicLogin
|
|||
$sql_where .= 'AND td.cells_slideshow = 1';
|
||||
}
|
||||
|
||||
if (empty((int) $rowFilter['id_group']) === false) {
|
||||
$sql_where .= ' AND td.id_group = '.$rowFilter['id_group'];
|
||||
}
|
||||
|
||||
if (empty($rowFilter['name_filter']) === false) {
|
||||
$sql_where .= ' AND td.name like "%'.$rowFilter['name_filter'].'%"';
|
||||
}
|
||||
|
||||
if (empty($id_user) === true) {
|
||||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
@ -953,13 +944,6 @@ class Manager implements PublicLogin
|
|||
private function showList()
|
||||
{
|
||||
global $config;
|
||||
$id_group_filter = \get_parameter_post('id_group', '');
|
||||
$name_filter = \get_parameter_post('name', '');
|
||||
|
||||
$rowFilter = [
|
||||
'id_group' => $id_group_filter,
|
||||
'name_filter' => $name_filter,
|
||||
];
|
||||
|
||||
$limit_sql = $config['block_size'];
|
||||
|
||||
|
@ -973,7 +957,7 @@ class Manager implements PublicLogin
|
|||
$resultCopy = $this->copy();
|
||||
}
|
||||
|
||||
$dashboards = $this->getDashboards($this->offset, $limit_sql, false, false, '', $rowFilter);
|
||||
$dashboards = $this->getDashboards($this->offset, $limit_sql);
|
||||
$count = $this->getDashboardsCount();
|
||||
|
||||
View::render(
|
||||
|
|
|
@ -67,74 +67,6 @@ if (isset($resultCopy) === true) {
|
|||
);
|
||||
}
|
||||
|
||||
// Filter table.
|
||||
$filter_id_group = \get_parameter_post('id_group', '');
|
||||
$filter_name = \get_parameter_post('name', '');
|
||||
|
||||
$filterTable = new stdClass();
|
||||
$filterTable->class = 'filter-table-adv w100p';
|
||||
$filterTable->size[0] = '20%';
|
||||
$filterTable->size[1] = '20%';
|
||||
$filterTable->data = [];
|
||||
|
||||
$filterTable->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AR',
|
||||
true,
|
||||
'id_group',
|
||||
$filter_id_group,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
''
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[0][1] = html_print_label_input_block(
|
||||
__('Name'),
|
||||
html_print_input_text('name', $filter_name, '', 25, 80, true)
|
||||
);
|
||||
|
||||
$form_html = '<form id="form_dashboard_search" method="post" action="'.$urlDashboard.'">';
|
||||
$form_html .= html_print_table($filterTable, true);
|
||||
$form_html .= html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
__('Filter'),
|
||||
'uptbutton',
|
||||
false,
|
||||
[
|
||||
'icon' => 'search',
|
||||
'mode' => 'mini',
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$form_html .= '</form>';
|
||||
|
||||
ui_toggle(
|
||||
$form_html,
|
||||
'<span class="subsection_header_title">'.__('Filter').'</span>',
|
||||
'dashboard_search',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph fixed_filter_bar'
|
||||
);
|
||||
|
||||
|
||||
if (empty($dashboards) === true) {
|
||||
ui_print_info_message(
|
||||
[
|
||||
|
@ -189,15 +121,21 @@ if (empty($dashboards) === true) {
|
|||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Free search'),
|
||||
'label' => __('Name'),
|
||||
'type' => 'text',
|
||||
'class' => 'w400px',
|
||||
'class' => 'w80p',
|
||||
'id' => 'free_search',
|
||||
'name' => 'free_search',
|
||||
],
|
||||
[
|
||||
'label' => __('Group'),
|
||||
'type' => 'select_groups',
|
||||
'id' => 'group',
|
||||
'name' => 'group',
|
||||
],
|
||||
],
|
||||
],
|
||||
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar ',
|
||||
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
|
||||
'csv' => false,
|
||||
]
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue