function return_exercise_block($personal_course_list) { $exercise_list = array(); if (!empty($personal_course_list)) { foreach ($personal_course_list as $course_item) { $course_code = $course_item['c']; $session_id = $course_item['id_session']; $exercises = ExerciseLib::get_exercises_to_be_taken($course_code, $session_id); foreach ($exercises as $exercise_item) { $exercise_item['course_code'] = $course_code; $exercise_item['session_id'] = $session_id; $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); $exercise_list[] = $exercise_item; } } if (!empty($exercise_list)) { $exercise_list = ArrayClass::msort($exercise_list, 'tms'); $my_exercise = $exercise_list[0]; $url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?exerciseId=' . $my_exercise['id'] . '&cidReq=' . $my_exercise['course_code'] . '&id_session=' . $my_exercise['session_id']); $this->tpl->assign('exercise_url', $url); $this->tpl->assign('exercise_end_date', api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT)); } } }