Hello,
in file /application/models/Crud_model.php
find function:
=====================================================
Code:
public function get_total_duration_of_lesson_by_course_id($course_id)
{
$this->db->select('SEC_TO_TIME( SUM( TIME_TO_SEC( `duration` ) ) ) AS timeSum ');
$this->db->where('course_id', $course_id);
$query = $this->db->get('lesson')->result_array();
return $query[0]['timeSum'] . ' ' . get_phrase('hours');
}
=====================================================
and replace all by:
=====================================================
Code:
public function get_total_duration_of_lesson_by_course_id($course_id)
{
$total_duration = 0;
$lessons = $this->crud_model->get_lessons('course', $course_id)->result_array();
foreach ($lessons as $lesson) {
if ($lesson['lesson_type'] != "other" && $lesson['lesson_type'] != "text") {
$time_array = explode(':', $lesson['duration']);
$hour_to_seconds = $time_array[0] * 60 * 60;
$minute_to_seconds = $time_array[1] * 60;
$seconds = $time_array[2];
$total_duration += $hour_to_seconds + $minute_to_seconds + $seconds;
}
}
// return gmdate("H:i:s", $total_duration).' '.get_phrase('hours');
$hours = floor($total_duration / 3600);
$minutes = floor(($total_duration % 3600) / 60);
$seconds = $total_duration % 60;
return sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds) . ' ' . get_phrase('hours');
}
=====================================================