Basic implementation event signup
This commit is contained in:
		
							
								
								
									
										25
									
								
								modules/event-participants/Controllers/class-signuppage.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								modules/event-participants/Controllers/class-signuppage.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Bdp\Modules\EventParticipants\Controllers;
 | 
			
		||||
 | 
			
		||||
use Bdp\Libs\FileAccess;
 | 
			
		||||
use function Bdp\Modules\EventParticipants\Views\registrationForm;
 | 
			
		||||
 | 
			
		||||
class EventSignupPageController
 | 
			
		||||
{
 | 
			
		||||
    public static function print_signup_page($content) : string {
 | 
			
		||||
		// Der zu ersetzende String
 | 
			
		||||
		$pattern = '/{{event-(\d+)}}/';
 | 
			
		||||
 | 
			
		||||
		if (preg_match($pattern, $content, $matches)) {
 | 
			
		||||
			if (isset($_POST['eventId'])) {
 | 
			
		||||
				$content = preg_replace($pattern,  ParticipationSignupController::saveRegistration($_POST), $content);
 | 
			
		||||
			} else {
 | 
			
		||||
				$eventId = $matches[1];
 | 
			
		||||
                $url = str_replace(get_site_url(), '', get_permalink());
 | 
			
		||||
				$content = preg_replace( $pattern, registrationForm( $eventId, $url ), $content );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return $content;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user