function RenderTimeMetrics($metrics) { foreach ($metrics as $metric => $value) { $hours = floor($value); $minutes = floor(($value - $hours) * 60); $metrics[$metric] = substr('0' . $hours, 0 - strlen($hours)) . ':' . substr('0' . $minutes, -2); } RenderMetrics($metrics); }
datasets: [ { label: 'Different shift types', backgroundColor: 'rgba(25, 118, 210, 0.9)', data: [ <?php echo $typesPerStewardValues; ?> ] } ], } }); })(); </script> <?php RenderMetrics($typesPerStewardMetrics); ?> </div> <?php foreach ($stewardShifts as $steward => $shiftData) { $slug = 'steward-' . CreateSlug($steward); $hoursPerShiftType = []; $hoursPerDay = ['Friday' => 0, 'Saturday' => 0, 'Sunday' => 0]; foreach ($shiftData as $shift) { if ($shift['shiftType'] !== 'event') { continue; } if (IsIgnoredShift($shift)) { continue; }