make add/remove starter buttons date sensitive
This commit is contained in:
@@ -18,9 +18,10 @@ class eventPlaner
|
||||
'wardship' => 'vormundschaft'
|
||||
];
|
||||
|
||||
// request coming starts from the db
|
||||
private static function getComingStarts($sinceDate = null, $userId = null)
|
||||
{
|
||||
$userId = $userId ?? $_SESSION['user']['userId'];
|
||||
$userId = $userId ?? participo::getSessionUserId();
|
||||
$sinceDate = $sinceDate ?? new DateTime();
|
||||
|
||||
$params = [
|
||||
@@ -91,7 +92,7 @@ class eventPlaner
|
||||
$ret = dbConnector::query($query);
|
||||
$events = [];
|
||||
foreach ($ret as $event) {
|
||||
array_push($events, event::fromArray($event));
|
||||
array_push($events, event::fromDbArray($event));
|
||||
}
|
||||
return $events;
|
||||
}
|
||||
@@ -108,39 +109,4 @@ class eventPlaner
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// inserting html code
|
||||
|
||||
/** Generate the htmlCode for the list of upcoming starts of
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function htmlComingStarts()
|
||||
{
|
||||
$comingStarts = self::getComingStarts();
|
||||
$htmlTable = null;
|
||||
if ($comingStarts) {
|
||||
$htmlTable = '<table>'
|
||||
. '<thead><tr><th>Datum</th><th>Veranstaltung</th><th>Starter</th><th></th></tr></thead>'
|
||||
. '<tbody>';
|
||||
foreach ($comingStarts as $s) {
|
||||
$eventDeadline = DateTime::createFromFormat('Y-m-d', $s['deadline']);
|
||||
$eventDate = DateTime::createFromFormat('Y-m-d', $s['eventDate']);
|
||||
$today = new DateTime();
|
||||
$htmlTable .= '<tr>'
|
||||
. '<td>' . getHtmlSquareDate($eventDate) . '</td>'
|
||||
. '<td>' . $s['eventName'] . '</td>'
|
||||
. '<td>' . $s['userName'] . ', ' . $s['userFirstname'] . '</td>'
|
||||
. '<td>' . ($eventDeadline >= $today ? Event::getHtmlRemoveStarterForm($s['eventId'], $s['userId']) : '') . '</td>'
|
||||
// . '<td>' . $eventDeadline->format('Y-m-d') . ' <= ' . $today->format('Y-m-d') . ': ' . ($eventDeadline <= $today ? 'true' : 'false') . '</td>'
|
||||
. '</tr>';
|
||||
}
|
||||
$htmlTable .= '</tbody></table>';
|
||||
echo('<h2 id="comingStarts">Aktuelle Einschreibungen</h2>');
|
||||
echo($htmlTable);
|
||||
} else {
|
||||
echo('<div>Keine Meldungen zu bevorstehenden Events<div>');
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user