Basic implementation event signup
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Reqeust;
|
||||
|
||||
|
||||
use Bdp\Libs\CommonModel;
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AnwesenheitRequest {
|
||||
public static function send(CommonModel $participant) {
|
||||
$anreise = \DateTime::createFromFormat('Y-m-d', $participant->anreise);
|
||||
$abreise = \DateTime::createFromFormat('Y-m-d', $participant->abreise);
|
||||
|
||||
$cmpd = date_diff($anreise, $abreise);
|
||||
$days = $cmpd->d;
|
||||
|
||||
if ($days== 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return $days;
|
||||
}
|
||||
}
|
13
modules/event-participants/Requests/class-bathrequest.php
Normal file
13
modules/event-participants/Requests/class-bathrequest.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Reqeust;
|
||||
|
||||
|
||||
use Bdp\Libs\CommonModel;
|
||||
|
||||
class BathRequest {
|
||||
public static function send(CommonModel $participant) {
|
||||
return ($participant->badeerlaubnis == 'complete' || kompass_is_fullaged( $participant->geburtsdatum ) )
|
||||
? 'Schwimmer*in' :
|
||||
( $participant->badeerlaubnis == 'partial' ? '<b>Nicht</b>schwimmmer*in' : 'Keine Badeerlaubnis' );
|
||||
}
|
||||
}
|
53
modules/event-participants/Requests/class-eatingrequest.php
Normal file
53
modules/event-participants/Requests/class-eatingrequest.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Reqeust;
|
||||
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class EatingRequest {
|
||||
public static function send(array $participantList, string $eatingHabit, \DateTime $date) {
|
||||
$participantCount = [ '1' => 0, '2' => 0, '3' => 0 ];
|
||||
|
||||
foreach ($participantList as $participant) {
|
||||
if ( $participant->essgewohnheit !== $eatingHabit ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$anreise = \DateTime::createFromFormat( 'Y-m-d', $participant->anreise );
|
||||
$abreise = \DateTime::createFromFormat( 'Y-m-d', $participant->abreise );
|
||||
|
||||
if ( $anreise->getTimestamp() < $date->getTimestamp() && $abreise->getTimestamp() > $date->getTimestamp() ) {
|
||||
$participantCount['1']++;
|
||||
$participantCount['2']++;
|
||||
$participantCount['3']++;
|
||||
} elseif ( $anreise->getTimestamp() == $date->getTimestamp() ) { // Anreisetag
|
||||
if ( $participant->anreise_essen == 3 ) {
|
||||
$participantCount['1']++;
|
||||
$participantCount['2']++;
|
||||
$participantCount['3']++;
|
||||
} elseif ( $participant->anreise_essen == 2 ) {
|
||||
$participantCount['2']++;
|
||||
$participantCount['3']++;
|
||||
} elseif ( $participant->anreise_essen == 1 ) {
|
||||
$participantCount['3']++;
|
||||
}
|
||||
} elseif ( $abreise->getTimestamp() == $date->getTimestamp() ) { // Abreisetag
|
||||
if ( $participant->abreise_essen == 3 ) {
|
||||
$participantCount['1']++;
|
||||
$participantCount['2']++;
|
||||
$participantCount['3']++;
|
||||
} elseif ( $participant->abreise_essen == 2 ) {
|
||||
$participantCount['1']++;
|
||||
$participantCount['2']++;
|
||||
} elseif ( $participant->abreise_essen == 1 ) {
|
||||
$participantCount['1']++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $participantCount;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user