forked from albsierra/codetest
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathusage-student.php
More file actions
26 lines (23 loc) · 834 Bytes
/
usage-student.php
File metadata and controls
26 lines (23 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once('initTsugi.php');
include('views/dao/menu.php');
$main = new \CT\CT_Main($_SESSION["ct_id"]);
$exercises = $main->getExercises();
$students = \CT\CT_User::getUsersWithAnswers($_SESSION["ct_id"]);
$studentAndDate = array();
foreach($students as $student) {
$studentAndDate[$student->getUserId()] = new DateTime($student->getMostRecentAnswerDate($_SESSION["ct_id"]));
}
// Sort students by mostRecentDate desc
arsort($studentAndDate);
$totalExercises = count($exercises);
$usages = CT\CT_Usage::getUsages($exercises, $students);
echo $twig->render('usage/usage-student.php.twig', array(
'OUTPUT' => $OUTPUT,
'help' => $help(),
'menu' => $menu,
'exercises' => $exercises,
'totalExercises' => $totalExercises,
'students' => $main->getStudentsOrderedByDate(),
'usages' => $usages,
));