|
1229 | 1229 | echo MyStudents::getBlockForClasses($student_id);
|
1230 | 1230 | echo '</div></div>';
|
1231 | 1231 |
|
| 1232 | +$theoreticalTimeEnabled = api_get_configuration_value('display_theoretical_time'); |
1232 | 1233 | $exportCourseList = [];
|
1233 | 1234 | $lpIdList = [];
|
1234 | 1235 | if (empty($details)) {
|
1235 | 1236 | $csv_content[] = [];
|
1236 |
| - $csv_content[] = [ |
1237 |
| - get_lang('Session'), |
1238 |
| - get_lang('Course'), |
1239 |
| - get_lang('Time'), |
1240 |
| - get_lang('Progress'), |
1241 |
| - get_lang('Score'), |
1242 |
| - get_lang('AttendancesFaults'), |
1243 |
| - get_lang('Evaluations'), |
1244 |
| - ]; |
| 1237 | + if($theoreticalTimeEnabled) { |
| 1238 | + $csv_content[] = [ |
| 1239 | + get_lang('Session'), |
| 1240 | + get_lang('Course'), |
| 1241 | + get_lang('Time'), |
| 1242 | + get_lang('Progress'), |
| 1243 | + get_lang('Score'), |
| 1244 | + get_lang('TheoreticalTime'), |
| 1245 | + get_lang('AttendancesFaults'), |
| 1246 | + get_lang('Evaluations'), |
| 1247 | + ]; |
| 1248 | + } else { |
| 1249 | + $csv_content[] = [ |
| 1250 | + get_lang('Session'), |
| 1251 | + get_lang('Course'), |
| 1252 | + get_lang('Time'), |
| 1253 | + get_lang('Progress'), |
| 1254 | + get_lang('Score'), |
| 1255 | + get_lang('AttendancesFaults'), |
| 1256 | + get_lang('Evaluations'), |
| 1257 | + ]; |
| 1258 | + } |
1245 | 1259 |
|
1246 | 1260 | $attendance = new Attendance();
|
1247 | 1261 | $extraFieldValueSession = new ExtraFieldValue('session');
|
|
1281 | 1295 | <th>'.get_lang('Course').'</th>
|
1282 | 1296 | <th>'.get_lang('Time').'</th>
|
1283 | 1297 | <th>'.get_lang('Progress').' '.Display::return_icon('info3.gif', get_lang('progressBasedOnVisiblesLPsInEachCourse'), [], ICON_SIZE_TINY).' </th>
|
1284 |
| - <th>'.get_lang('Score').'</th> |
1285 |
| - <th>'.get_lang('AttendancesFaults').'</th> |
| 1298 | + <th>'.get_lang('Score').'</th>'; |
| 1299 | + if($theoreticalTimeEnabled) { |
| 1300 | + echo '<th>'.get_lang('TheoreticalTime').'</th>'; |
| 1301 | + } |
| 1302 | + echo '<th>'.get_lang('AttendancesFaults').'</th> |
1286 | 1303 | <th>'.get_lang('Evaluations').'</th>
|
1287 | 1304 | <th>'.get_lang('Details').'</th>
|
1288 | 1305 | </tr>';
|
1289 | 1306 | echo '</thead>';
|
1290 | 1307 | echo '<tbody>';
|
1291 | 1308 |
|
1292 |
| - $csvRow = [ |
1293 |
| - '', |
1294 |
| - get_lang('Course'), |
1295 |
| - get_lang('Time'), |
1296 |
| - get_lang('Progress'), |
1297 |
| - get_lang('Score'), |
1298 |
| - get_lang('AttendancesFaults'), |
1299 |
| - get_lang('Evaluations'), |
1300 |
| - get_lang('Details'), |
1301 |
| - ]; |
| 1309 | + if($theoreticalTimeEnabled) { |
| 1310 | + $csvRow = [ |
| 1311 | + '', |
| 1312 | + get_lang('Course'), |
| 1313 | + get_lang('Time'), |
| 1314 | + get_lang('Progress'), |
| 1315 | + get_lang('Score'), |
| 1316 | + get_lang('TheoreticalTime'), |
| 1317 | + get_lang('AttendancesFaults'), |
| 1318 | + get_lang('Evaluations'), |
| 1319 | + get_lang('Details'), |
| 1320 | + ]; |
| 1321 | + } else { |
| 1322 | + $csvRow = [ |
| 1323 | + '', |
| 1324 | + get_lang('Course'), |
| 1325 | + get_lang('Time'), |
| 1326 | + get_lang('Progress'), |
| 1327 | + get_lang('Score'), |
| 1328 | + get_lang('AttendancesFaults'), |
| 1329 | + get_lang('Evaluations'), |
| 1330 | + get_lang('Details'), |
| 1331 | + ]; |
| 1332 | + } |
1302 | 1333 |
|
1303 | 1334 | $exportCourseList[$sId][] = $csvRow;
|
1304 | 1335 |
|
|
1310 | 1341 | $gradeBookTotal = [0, 0];
|
1311 | 1342 | $totalCourses = count($courses);
|
1312 | 1343 | $scoreDisplay = ScoreDisplay::instance();
|
| 1344 | + $theoreticalTime = 0; |
| 1345 | + $totalTheoreticalTime = 0; |
1313 | 1346 |
|
1314 | 1347 | foreach ($courses as $courseId) {
|
1315 | 1348 | $courseInfoItem = api_get_course_info_by_id($courseId);
|
|
1416 | 1449 | $totalScore += $score;
|
1417 | 1450 | }
|
1418 | 1451 |
|
| 1452 | + if($theoreticalTimeEnabled) { |
| 1453 | + $theoreticalTime = CourseManager::get_course_extra_field_value('theoretical_time', $courseCodeItem); |
| 1454 | + if (is_numeric($theoreticalTime) && (float)$theoreticalTime != 0) { |
| 1455 | + $totalTheoreticalTime += (float)$theoreticalTime; |
| 1456 | + $hours = floor($theoreticalTime / 60); |
| 1457 | + $minutes = $theoreticalTime % 60; |
| 1458 | + $theoreticalTimeDisplay = sprintf('%02d:%02d', $hours, $minutes); |
| 1459 | + } else { |
| 1460 | + $theoreticalTimeDisplay = '00:00'; |
| 1461 | + } |
| 1462 | + } |
| 1463 | + |
1419 | 1464 | $progress = empty($progress) ? '0%' : $progress.'%';
|
1420 | 1465 | $score = empty($score) ? '0%' : $score.'%';
|
1421 | 1466 |
|
1422 |
| - $csvRow = [ |
1423 |
| - $session_name, |
1424 |
| - $courseInfoItem['title'], |
1425 |
| - $time_spent_on_course, |
1426 |
| - $progress, |
1427 |
| - $score, |
1428 |
| - $attendances_faults_avg, |
1429 |
| - $scoretotal_display, |
1430 |
| - ]; |
| 1467 | + if($theoreticalTimeEnabled) { |
| 1468 | + $csvRow = [ |
| 1469 | + $session_name, |
| 1470 | + $courseInfoItem['title'], |
| 1471 | + $time_spent_on_course, |
| 1472 | + $progress, |
| 1473 | + $score, |
| 1474 | + $theoreticalTimeDisplay, |
| 1475 | + $attendances_faults_avg, |
| 1476 | + $scoretotal_display, |
| 1477 | + ]; |
| 1478 | + } else { |
| 1479 | + $csvRow = [ |
| 1480 | + $session_name, |
| 1481 | + $courseInfoItem['title'], |
| 1482 | + $time_spent_on_course, |
| 1483 | + $progress, |
| 1484 | + $score, |
| 1485 | + $attendances_faults_avg, |
| 1486 | + $scoretotal_display, |
| 1487 | + ]; |
| 1488 | + } |
1431 | 1489 |
|
1432 | 1490 | $csv_content[] = $csvRow;
|
1433 | 1491 | $exportCourseList[$sId][] = $csvRow;
|
|
1440 | 1498 | </td>
|
1441 | 1499 | <td>'.$time_spent_on_course.'</td>
|
1442 | 1500 | <td>'.$progress.'</td>
|
1443 |
| - <td>'.$score.'</td> |
1444 |
| - <td>'.$attendances_faults_avg.'</td> |
| 1501 | + <td>'.$score.'</td>'; |
| 1502 | + if($theoreticalTimeEnabled) { |
| 1503 | + echo '<td>'.$theoreticalTimeDisplay.'</td>'; |
| 1504 | + } |
| 1505 | + echo '<td>'.$attendances_faults_avg.'</td> |
1445 | 1506 | <td>'.$scoretotal_display.'</td>';
|
1446 | 1507 | if (!empty($coachId)) {
|
1447 | 1508 | echo '<td width="10"><a href="'.api_get_self().'?student='.$student_id
|
|
1470 | 1531 | <th>'.get_lang('Total').'</th>
|
1471 | 1532 | <th>'.$totalTimeFormatted.'</th>
|
1472 | 1533 | <th>'.$totalProgressFormatted.'</th>
|
1473 |
| - <th>'.$totalScoreFormatted.'</th> |
1474 |
| - <th>'.$totalAttendanceFormatted.'</th> |
| 1534 | + <th>'.$totalScoreFormatted.'</th>'; |
| 1535 | + if($theoreticalTimeEnabled) { |
| 1536 | + $totalHours = floor($totalTheoreticalTime / 60); |
| 1537 | + $totalMinutes = $totalTheoreticalTime % 60; |
| 1538 | + $totalTheoreticalTimeDisplay = sprintf('%02d:%02d', $totalHours, $totalMinutes); |
| 1539 | + echo '<td>'.$totalTheoreticalTimeDisplay.'</td>'; |
| 1540 | + } |
| 1541 | + echo '<th>'.$totalAttendanceFormatted.'</th> |
1475 | 1542 | <th>'.$totalEvaluations.'</th>
|
1476 | 1543 | <th></th>
|
1477 | 1544 | </tr>';
|
1478 | 1545 |
|
1479 |
| - $csvRow = [ |
1480 |
| - get_lang('Total'), |
1481 |
| - '', |
1482 |
| - $totalTimeFormatted, |
1483 |
| - $totalProgressFormatted, |
1484 |
| - $totalScoreFormatted, |
1485 |
| - $totalAttendanceFormatted, |
1486 |
| - $totalEvaluations, |
1487 |
| - '', |
1488 |
| - ]; |
| 1546 | + if($theoreticalTimeEnabled) { |
| 1547 | + $csvRow = [ |
| 1548 | + get_lang('Total'), |
| 1549 | + '', |
| 1550 | + $totalTimeFormatted, |
| 1551 | + $totalProgressFormatted, |
| 1552 | + $totalScoreFormatted, |
| 1553 | + $totalTheoreticalTimeDisplay, |
| 1554 | + $totalAttendanceFormatted, |
| 1555 | + $totalEvaluations, |
| 1556 | + '', |
| 1557 | + ]; |
| 1558 | + } else { |
| 1559 | + $csvRow = [ |
| 1560 | + get_lang('Total'), |
| 1561 | + '', |
| 1562 | + $totalTimeFormatted, |
| 1563 | + $totalProgressFormatted, |
| 1564 | + $totalScoreFormatted, |
| 1565 | + $totalAttendanceFormatted, |
| 1566 | + $totalEvaluations, |
| 1567 | + '', |
| 1568 | + ]; |
| 1569 | + } |
1489 | 1570 |
|
1490 | 1571 | $csv_content[] = $csvRow;
|
1491 | 1572 | $exportCourseList[$sId][] = $csvRow;
|
|
0 commit comments