add badges

This commit is contained in:
Frédéric France 2022-09-15 20:15:40 +02:00
parent 08aa34b8db
commit 16d2f06684
2 changed files with 48 additions and 33 deletions

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* 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
@ -362,7 +363,11 @@ function show_array_last_actions_done($max = 5)
*/ */
function agenda_prepare_head() function agenda_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('actioncomm');
$h = 0; $h = 0;
$head = array(); $head = array();
@ -395,6 +400,10 @@ function agenda_prepare_head()
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = is_countable($extrafields->attributes['actioncomm']['label']) ? count($extrafields->attributes['actioncomm']['label']) : 0;
if ($nbExtrafields > 0) {
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;

View File

@ -4,6 +4,7 @@
* Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr> * Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
* Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr> * Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
* Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr> * Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
* 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
@ -21,7 +22,7 @@
/** /**
* \file hrm/lib/hrm.lib.php * \file hrm/lib/hrm.lib.php
* \ingroup hr * \ingroup hrm
* \brief Library files with common functions for Workstation * \brief Library files with common functions for Workstation
*/ */
@ -32,10 +33,15 @@
*/ */
function hrmAdminPrepareHead() function hrmAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf, $db;
$langs->load("hrm"); $langs->load("hrm");
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('hrm_evaluation');
$extrafields->fetch_name_optionals_label('hrm_job');
$extrafields->fetch_name_optionals_label('hrm_skill');
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT . "/admin/hrm.php"; $head[$h][0] = DOL_URL_ROOT . "/admin/hrm.php";
@ -50,31 +56,31 @@ function hrmAdminPrepareHead()
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php';
$head[$h][1] = $langs->trans("EvaluationsExtraFields"); $head[$h][1] = $langs->trans("EvaluationsExtraFields");
$nbExtrafields = is_countable($extrafields->attributes['hrm_evaluation']['label']) ? count($extrafields->attributes['hrm_evaluation']['label']) : 0;
if ($nbExtrafields > 0) {
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'evaluationsAttributes'; $head[$h][2] = 'evaluationsAttributes';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php'; $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php';
$head[$h][1] = $langs->trans("JobsExtraFields"); $head[$h][1] = $langs->trans("JobsExtraFields");
$nbExtrafields = is_countable($extrafields->attributes['hrm_job']['label']) ? count($extrafields->attributes['hrm_job']['label']) : 0;
if ($nbExtrafields > 0) {
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'jobsAttributes'; $head[$h][2] = 'jobsAttributes';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php';
$head[$h][1] = $langs->trans("SkillsExtraFields"); $head[$h][1] = $langs->trans("SkillsExtraFields");
$nbExtrafields = is_countable($extrafields->attributes['hrm_skill']['label']) ? count($extrafields->attributes['hrm_skill']['label']) : 0;
if ($nbExtrafields > 0) {
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'skillsAttributes'; $head[$h][2] = 'skillsAttributes';
$h++; $h++;
/*
$head[$h][0] = dol_buildpath("/workstation/admin/myobject_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'myobject_extrafields';
$h++;
*/
/*$head[$h][0] = require_once "/admin/about.php";
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;*/
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
//$this->tabs = array( //$this->tabs = array(