refactor topic and subject editor #89
@@ -55,10 +55,11 @@ session_start();
|
|||||||
$subjects = SubjectData::getAll();
|
$subjects = SubjectData::getAll();
|
||||||
|
|
||||||
foreach ($subjects as $subject) {
|
foreach ($subjects as $subject) {
|
||||||
// receive number of exercises for all topics of a subject
|
$numOfFiles = 0;
|
||||||
$numOfExcercises = 0;
|
$numOfTasks = 0;
|
||||||
foreach ($subject->topics as $topic) {
|
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">
|
<div class="flex-1">
|
||||||
<h3 class="text-xl font-bold text-gray-900 mb-2"><?php echo($subject->displayName); ?></h3>
|
<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>
|
<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="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="font-bold text-[<?php echo($subject->color); ?>]"><?php echo(count($subject->topics)); ?></div>
|
||||||
<div class="text-sm text-gray-600">Themen</div>
|
<div class="text-sm text-gray-600">Themen</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center p-2 rounded-lg bg-gray-100">
|
<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="font-bold text-[<?php echo($subject->color); ?>]"><?php echo($numOfFiles); ?></div>
|
||||||
<div class="text-sm text-gray-600">Übungen</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user