Skip to content

Commit

Permalink
Eoxia#77 [Dashboard] add: name on graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-kilyan committed Oct 17, 2024
1 parent 6a8c366 commit 1abf05c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions class/shortener.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,22 @@ public function setCategories($categories): string
*/
public function load_dashboard(): array
{
$getNbShortenerByStatus = self::getNbShortenerByStatus();
$getNbShortenerByElementType = self::getNbShortenerByElementType();
global $user, $langs;

$array['graphs'] = [$getNbShortenerByStatus, $getNbShortenerByElementType];
$confName = strtoupper($this->module) . '_DASHBOARD_CONFIG';
$dashboardConfig = json_decode($user->conf->$confName);
$array = ['graphs' => [], 'disabledGraphs' => []];

if (empty($dashboardConfig->graphs->ShortenerRepartitionStatus->hide)) {
$array['graphs'][] = $this->getNbShortenerByStatus();
} else {
$array['disabledGraphs']['ShortenerRepartitionStatus'] = $langs->transnoentities('ShortenerRepartition', dol_strtolower($langs->transnoentities('Status')));
}
if (empty($dashboardConfig->graphs->ShortenerRepartitionElementType->hide)) {
$array['graphs'][] = $this->getNbShortenerByElementType();
} else {
$array['disabledGraphs']['ShortenerRepartitionElementType'] = $langs->transnoentities('ShortenerRepartition', dol_strtolower($langs->transnoentities('ElementType')));
}

return $array;
}
Expand All @@ -309,6 +321,7 @@ public function getNbShortenerByStatus(): array

// Graph Title parameters
$array['title'] = $langs->transnoentities('ShortenerRepartition', dol_strtolower($langs->transnoentities('Status')));
$array['name'] = 'ShortenerRepartitionStatus';
$array['picto'] = $this->picto;

// Graph parameters
Expand Down Expand Up @@ -362,6 +375,7 @@ public function getNbShortenerByElementType(): array

// Graph Title parameters
$array['title'] = $langs->transnoentities('ShortenerRepartition', dol_strtolower($langs->transnoentities('ElementType')));
$array['name'] = 'ShortenerRepartitionElementType';
$array['picto'] = $this->picto;

// Graph parameters
Expand Down

0 comments on commit 1abf05c

Please sign in to comment.