Basic implementation event signup
This commit is contained in:
		
							
								
								
									
										32
									
								
								modules/event-participants/Models/class-eventparticipant.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								modules/event-participants/Models/class-eventparticipant.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace Bdp\Modules\EventParticipants\Models;
 | 
			
		||||
 | 
			
		||||
use Bdp\Libs\CommonModel;
 | 
			
		||||
use Bdp\Modules\EventParticipants\Controllers\MainController;
 | 
			
		||||
 | 
			
		||||
class EventParticipant extends CommonModel {
 | 
			
		||||
	public static function loadById(int $event_id) {
 | 
			
		||||
		return parent::load_by_id('kompass_veranstaltungen_teilis', $event_id);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static function list_for_event(int $event_id) : array {
 | 
			
		||||
		global $dbHandler;
 | 
			
		||||
 | 
			
		||||
		$data = $dbHandler->readFromDb('kompass_veranstaltungen_teilis', ['eventId' => $event_id]);
 | 
			
		||||
		$return = [];
 | 
			
		||||
		foreach ($data as $participant) {
 | 
			
		||||
            $part = EventParticipant::loadById($participant->id);
 | 
			
		||||
			$return[] = $part;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return $return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function get_group() : CommonModel {
 | 
			
		||||
		return EventGroup::load_by_id(MainController::KOMPASS_EVENTS_GROUPS, $this->gruppe_id);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function __construct() {
 | 
			
		||||
		$this->_tablename = 'kompass_veranstaltungen_teilis';
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user