true, 'text' => ''.html_print_image( 'images/logs@svg.svg', true, [ 'title' => __('GIS Maps list'), 'class' => 'main_menu_icon invert_filter', ] ).'', ]; // Header. ui_print_standard_header( __('List of GIS maps'), 'images/op_gis.png', false, '', false, $buttons, [ [ 'link' => '', 'label' => __('Topology maps'), ], [ 'link' => '', 'label' => __('GIS Maps'), ], ] ); $own_info = get_user_info($config['id_user']); if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'MM')) { $display_default_column = true; } else { $display_default_column = false; } $edit_gis_maps = false; if (check_acl($config['id_user'], 0, 'MW') || check_acl($config['id_user'], 0, 'MM')) { $edit_gis_maps = true; } if (is_ajax()) { $action = get_parameter('action'); $id_map = get_parameter('id_map'); // Set to not default the actual default map $returnOperationDB = db_process_sql_update('tgis_map', ['default_map' => 0], ['default_map' => 1]); // Set default the new default map $returnOperationDB = db_process_sql_update('tgis_map', ['default_map' => 1], ['id_tgis_map' => $id_map]); if ($returnOperationDB === false) { $data['correct'] = false; } else { $data['correct'] = true; } echo json_encode($data); return; } $action = get_parameter('action'); switch ($action) { case 'delete_map': $idMap = get_parameter('map_id'); $result = gis_delete_map($idMap); ui_print_result_message( $result, __('Successfully deleted'), __('Could not be deleted') ); break; } $maps = gis_get_maps(); $table = new stdClass(); $table->width = '100%'; $table->class = 'info_table'; $table->head = []; $table->head['name'] = __('Name'); $table->head['group'] = __('Group'); if ($edit_gis_maps) { if ($display_default_column) { $table->head['default'] = __('Default'); } $table->head['op'] = ''.__('Op.').''; } $table->headstyle = []; $table->headstyle['name'] = 'text-align: left;'; $table->headstyle['group'] = 'text-align: center;'; if ($edit_gis_maps) { if ($display_default_column) { $table->headstyle['default'] = 'text-align: center;'; } $table->headstyle['op'] = 'text-align: center;'; } $table->size = []; $table->size['name'] = '80%'; $table->size['group'] = '30'; if ($edit_gis_maps) { if ($display_default_column) { $table->size['default'] = '30'; } $table->size['op'] = '60'; } $table->align = []; $table->align['name'] = 'left'; $table->align['group'] = 'center'; if ($edit_gis_maps) { if ($display_default_column) { $table->align['default'] = 'center'; } $table->align['op'] = 'center'; } $table->data = []; $rowPair = true; $iterator = 0; if ($maps !== false) { foreach ($maps as $map) { if (!check_acl($config['id_user'], $map['group_id'], 'MR') && !check_acl($config['id_user'], $map['group_id'], 'MW') && !check_acl($config['id_user'], $map['group_id'], 'MM') ) { continue; } if ($rowPair) { $table->rowclass[$iterator] = 'rowPair'; } else { $table->rowclass[$iterator] = 'rowOdd'; } $rowPair = !$rowPair; $iterator++; $data = []; $data['name'] = ''.$map['map_name'].' '; $data['group'] = ui_print_group_icon($map['group_id'], true); $data['default'] = ''; $data['op'] = ''; if (check_acl_restricted_all($config['id_user'], $map['group_id'], 'MW') || check_acl_restricted_all($config['id_user'], $map['group_id'], 'MM') ) { if (check_acl_restricted_all($config['id_user'], 0, 'MM')) { $checked = false; if ($map['default_map']) { $checked = true; $defaultMapId = $map['id_tgis_map']; } $data['default'] = html_print_radio_button_extended('default_map', $map['id_tgis_map'], '', $checked, false, 'setDefault('.$map['id_tgis_map'].');', '', true); } $table->cellclass[]['op'] = 'table_action_buttons'; $data['op'] = ''.html_print_image('images/edit.svg', true, ['title' => __('Edit')]).''.''.html_print_image('images/delete.svg', true, ['title' => __('Delete'), 'class' => 'invert_filter main_menu_icon']).''; } array_push($table->data, $data); } } if (!empty($table->data)) { html_print_table($table); } else { echo '
'.__('No maps found').'
'; } if ($edit_gis_maps) { echo '
'; html_print_input_hidden('action', 'new_map'); $ActionButton = html_print_submit_button( __('Create'), 'create', false, [ 'class' => 'sub ok submitButton', 'icon' => 'next', ], true ); echo '
'.html_print_action_buttons($ActionButton, ['type' => 'form_action'], true).'
'; echo '
'; } unset($table); ?>