{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2023 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {% set searchform_id = data['searchform_id']|default('search_' ~ rand) %}
{% if showmassiveactions %} {% endif %} {% set sorts = data['search']['sort'] %} {% for col in data['data']['cols'] %} {# construct header link (for sorting) #} {% set linkto = '' %} {% set so_no_sort = col['searchopt']['nosort'] ?? false %} {% set meta = col['meta'] ?? false %} {% set sort_order = 'nosort' %} {% set sort_num = '' %} {% set can_sort = not meta and not no_sort and not so_no_sort %} {% if can_sort %} {% for sort_opt in sorts %} {% if sort_opt == col['id'] %} {% set sort_order = data['search']['order'][loop.index0]|default('ASC') %} {% set sort_num = loop.index %} {% endif %} {% endfor %} {% endif %} {% set col_name = col['name'] %} {# prefix by group name (corresponding to optgroup in dropdown) if exists #} {% if col['groupname'] is defined %} {% set groupname = (col['groupname']['name'] ?? col['groupname']) %} {% set col_name = __('%1$s - %2$s')|format(groupname, col['name']) %} {% endif %} {# Not main itemtype, prefix col_name by secondary itemtype #} {% if not itemtype == col['itemtype'] %} {% set col_name = __('%1$s - %2$s')|format(col['itemtype']|itemtype_name, col_name) %} {% endif %} {% endfor %} {# display itemtype in AllAssets #} {% if union_search_type[itemtype] is defined %} {% endif %} {% if count == 0 %} {% else %} {% for rowkey, row in data['data']['rows'] %} {% if showmassiveactions %} {% endif %} {% for col in data['data']['cols'] %} {% set colkey = col['itemtype'] ~ '_' ~ col['id'] %} {# showItem function returns "" #} {% if col['meta'] is defined %} {{ showItem(0, row[colkey]['displayname'], 0, 0,)|raw }} {% else %} {{ showItem(0, row[colkey]['displayname'], 0, 0, call('Search::displayConfigItem', [itemtype, col['id'], row]))|raw }} {% endif %} {% endfor %} {# display itemtype in AllAssets #} {% if union_search_type[itemtype] is defined %} {% endif %} {% endfor %} {% endif %}
{% set sort_icon = sort_order == 'ASC' ? 'fas fa-sort-up' : (sort_order == 'DESC' ? 'fas fa-sort-down' : '') %} {{ col_name }} {% if can_sort %} {{ sorts|length > 1 ? sort_num : '' }} {% endif %} {{ __('Item type') }}
{# disable massiveaction checkbox for some specific cases #} {% if itemtype == 'Entity' and not has_access_to_entity(row['id']) %} {% elseif itemtype == 'User' and not can_view_all_entities() and not has_access_to_user_entities(row['id']) %} {% elseif item is instanceof('CommonDBTM') and item.maybeRecursive() and not has_access_to_entity(row['entities_id']) %} {% else %} {% if item is instanceof('CommonDBTM') and call(itemtype ~ '::isMassiveActionAllowed', [row['id']]) %} {% set checked = session('glpimassiveactionselected')[itemtype][row['id']] ?? false %} {% endif %} {% endif %}
... {{ row['TYPE']|itemtype_name }}