add badges

This commit is contained in:
Frédéric France 2022-09-15 21:43:57 +02:00
parent 79c66ac19e
commit 196c1c2c4a

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -160,7 +161,12 @@ function ecm_prepare_head_fm($object)
*/ */
function ecm_admin_prepare_head() function ecm_admin_prepare_head()
{ {
global $langs, $conf; global $langs, $conf, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('ecm_files');
$extrafields->fetch_name_optionals_label('ecm_directories');
$langs->load("ecm"); $langs->load("ecm");
$h = 0; $h = 0;
@ -173,11 +179,19 @@ function ecm_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/admin/ecm_files_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/ecm_files_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsEcmFiles"); $head[$h][1] = $langs->trans("ExtraFieldsEcmFiles");
$nbExtrafields = is_countable($extrafields->attributes['ecm_files']['label']) ? count($extrafields->attributes['ecm_files']['label']) : 0;
if ($nbExtrafields > 0) {
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_ecm_files'; $head[$h][2] = 'attributes_ecm_files';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/ecm_directories_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/ecm_directories_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsEcmDirectories"); $head[$h][1] = $langs->trans("ExtraFieldsEcmDirectories");
$nbExtrafields = is_countable($extrafields->attributes['ecm_directories']['label']) ? count($extrafields->attributes['ecm_directories']['label']) : 0;
if ($nbExtrafields > 0) {
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_ecm_directories'; $head[$h][2] = 'attributes_ecm_directories';
$h++; $h++;