add numOfTasks to subect on index.php
This commit is contained in:
@@ -55,10 +55,11 @@ session_start();
|
||||
$subjects = SubjectData::getAll();
|
||||
|
||||
foreach ($subjects as $subject) {
|
||||
// receive number of exercises for all topics of a subject
|
||||
$numOfExcercises = 0;
|
||||
$numOfFiles = 0;
|
||||
$numOfTasks = 0;
|
||||
foreach ($subject->topics as $topic) {
|
||||
$numOfExcercises += count($topic->files);
|
||||
$numOfFiles += count($topic->getFiles());
|
||||
$numOfTasks += count($topic->getTasks());
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -71,14 +72,18 @@ session_start();
|
||||
<div class="flex-1">
|
||||
<h3 class="text-xl font-bold text-gray-900 mb-2"><?php echo($subject->displayName); ?></h3>
|
||||
<p class="text-gray-600 mb-4"><?php echo($subject->description); ?></p>
|
||||
<div class="grid grid-cols-2 gap-4 mb-4">
|
||||
<div class="grid grid-cols-3 gap-4 mb-4">
|
||||
<div class="text-center p-2 rounded-lg bg-gray-100">
|
||||
<div class="font-bold text-[<?php echo($subject->color); ?>]"><?php echo(count($subject->topics)); ?></div>
|
||||
<div class="text-sm text-gray-600">Themen</div>
|
||||
</div>
|
||||
<div class="text-center p-2 rounded-lg bg-gray-100">
|
||||
<div class="font-bold text-[<?php echo($subject->color); ?>]"><?php echo($numOfExcercises); ?></div>
|
||||
<div class="text-sm text-gray-600">Übungen</div>
|
||||
<div class="font-bold text-[<?php echo($subject->color); ?>]"><?php echo($numOfFiles); ?></div>
|
||||
<div class="text-sm text-gray-600">Dateien</div>
|
||||
</div>
|
||||
<div class="text-center p-2 rounded-lg bg-gray-100">
|
||||
<div class="font-bold text-[<?php echo($subject->color); ?>]"><?php echo($numOfTasks); ?></div>
|
||||
<div class="text-sm text-gray-600">Aufgaben</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user