Monthly widget fixes

main
Yasen Pramatarov 2024-08-09 11:53:58 +03:00
parent 0f868f07e2
commit c915bcba9e
2 changed files with 8 additions and 35 deletions

View File

@ -31,9 +31,6 @@ $from_time = $fromMonth->format('Y-m-d');
$until_time = $thisMonth->format('Y-m-d');
$widget['records'] = array();
//$widget['table_headers'] = array();
//$widget['table_records_conferences'] = array();
//$widget['table_records_participants'] = array();
// loop 1 year in the past
$i = 0;
@ -45,17 +42,14 @@ while ($fromMonth < $thisMonth) {
$from_time = $fromMonth->format('Y-m-d');
$until_time = $untilMonth->format('Y-m-d');
// $searchConferenceNumber = $conference->conferenceNumber($fromMonth->format('Y-m-d'), $untilMonth->format('Y-m-d'));
// $searchParticipantNumber = $participant->participantNumber($fromMonth->format('Y-m-d'), $untilMonth->format('Y-m-d'));
$searchConferenceNumber = $conference->conferenceNumber($from_time, $until_time);
$searchParticipantNumber = $participant->participantNumber($from_time, $until_time);
// pretty format for displaying the month in the widget
$month = $fromMonth->format('F Y');
// populate the records
$widget['records'][$i] = array(
// 'fromMonth' => $fromMonth,
// 'untilMonth' => $untilMonth,
'from_time' => $from_time,
'until_time' => $until_time,
'table_headers' => $month,
@ -63,27 +57,10 @@ while ($fromMonth < $thisMonth) {
'participants' => $searchParticipantNumber[0]['participants'],
);
// $widget['records'][$i]['fromMonth'] = $fromMonth;
// $widget['records'][$i]['untilMonth'] = $untilMonth;
// populate the table
// array_push($widget['records'][$i]['table_headers'], $month);
// if (isset($searchConferenceNumber[0]['conferences'])) {
// array_push($widget['records'][$i]['table_records_conferences'], $searchConferenceNumber[0]['conferences']);
// } else {
// array_push($widget['records'][$i]['table_records_conferences'], '0');
// }
// if (isset($searchParticipantNumber[0]['participants'])) {
// array_push($widget['records'][$i]['table_records_participants'], $searchParticipantNumber[0]['participants']);
// } else {
// array_push($widget['records'][$i]['table_records_participants'], '0');
// }
$i++;
// move everything one month in future
$untilMonth->add(new DateInterval('P1M'));
$fromMonth->add(new DateInterval('P1M'));
$i++;
}
$time_range_specified = true;

View File

@ -34,11 +34,7 @@
<tbody>
<tr>
<td>conferences</td>
<?php foreach ($widget['records'] as $record) {
print_r($record);
// $from_time = $record['fromMonth']->format('Y-m-d');
// $until_time = $record['untilMonth']->format('Y-m-d');
?>
<?php foreach ($widget['records'] as $record) { ?>
<td><?php if (!empty($record['conferences'])) { ?>
<a href="?page=conferences&from_time=<?= $record['from_time'] ?>&until_time=<?= $record['until_time'] ?>"><?= htmlspecialchars($record['conferences']) ?></a> <?php } else { ?>
0<?php } ?>
@ -47,11 +43,11 @@ print_r($record);
</tr>
<tr>
<td>participants</td>
<?php foreach ($widget['records'] as $record) {
// $from_time = $record['fromMonth']->format('Y-m-d');
// $until_time = $record['untilMonth']->format('Y-m-d');
?>
<td><?= !empty($record['participants']) ? '<a href="?page=participants&from_time=$from_time&until_time=$until_time">' . htmlspecialchars($record['participants']) . '</a>' : '0'; ?></td>
<?php foreach ($widget['records'] as $record) { ?>
<td><?php if (!empty($record['participants'])) { ?>
<a href="?page=participants&from_time=<?= $record['from_time'] ?>&until_time=<?= $record['until_time'] ?>"><?= htmlspecialchars($record['participants']) ?></a> <?php } else { ?>
0<?php } ?>
</td>
<?php } ?>
</tr>
</tbody>