Hello Everyone,
I am using New plugin: Custom reports for Total time spent on particular courses.
But it is displaying in 1 days, 2o hours
So, Can anyone tell me how can display course dedication time in Hours only.
Vinit
Hi Vinit,
unfortunatelly you can configure it, you can change the source code:
this file:
Look for the format_time function, if you change this line with:
return $totaldedication/3600;
you will get the dedication in hours
Hello Juan,
I mean to say, instead of 1 day, 20 hours it shold display 44 hours.
So I made new function in moodlelib.php
function format_hours_time($totalsecs){
$totalsecs = abs($totalsecs);
$hours = floor($totalsecs/HOURSECS);
$remainder = $totalsecs - ($hours*HOURSECS);
$mins = floor($remainder/MINSECS);
$secs = $remainder - ($mins*MINSECS);
$ss = ($secs == 1) ? 'Second' : 'Seconds';
$sm = ($mins == 1) ? 'Minute' : 'Minutes';
$sh = ($hours == 1) ? 'Hour' : 'Hours';
$ohours = '';
$omins = '';
$osecs = '';
if ($hours) $ohours = $hours .' '. $sh;
if ($mins) $omins = $mins .' '. $sm;
if ($secs) $osecs = $secs .' '. $ss;
if ($hours) return trim($ohours .' '. $omins);
if ($mins) return trim($omins .' '. $osecs);
if ($secs) return $osecs;
return get_string('now');
}
And called this function.
Thank you very much.
Vinit