. */ include("./include/include.php"); include_once("./include/Fee.php"); include_once("./include/Appl.php"); include_once("./include/Persons.php"); $Accepted_image = array(); $Accepted_text = array(); $Accepted_image['-'] = "./image/minus.gif"; $Accepted_text['-'] = "Waiting list"; $Accepted_image['yes'] = "./image/check.gif"; $Accepted_text['yes'] = "Accepted, not confirmed"; $Accepted_image['pending'] = "./image/pending.png"; $Accepted_text['pending'] = "Accepted, confirmation pending"; $Accepted_image['confirmed'] = "./image/confirm.gif"; $Accepted_text['confirmed'] = "Accepted and confirmed"; $Accepted_image['no'] = "./image/nocheck.gif"; $Accepted_text['no'] = "Rejected"; $Accepted_image['cancel'] = "./image/cancel.gif"; $Accepted_text['cancel'] = "Canceled"; $Accepted_image['arrived'] = "./image/arrived.gif"; $Accepted_text['arrived'] = "Registered arrival"; // Check if menu should be hidden if( isset($_REQUEST['menu']) AND in_array($_REQUEST['menu'], array("hide", "show")) ) { $_SESSION['register_menu'] = $_REQUEST['menu']; } if( !isset($_SESSION['register_menu']) ) $_SESSION['register_menu'] = "show"; admin_header($_SESSION['register_menu']=="hide"); if( !in_array("application_register", $_SESSION['sess_functions']) ) { echoln("You are not authorized to see this page."); }else { /// Load variables /// $BodyCode = get_var('bodycode'); $PersonID = get_int('personid'); /// Handle quick registration /// if( $_SERVER['REQUEST_METHOD']=="POST" AND isset($_POST['jumpid']) AND preg_match("/^[0-9]+-([0-9]+)$/", $_POST['jumpid'], $matches) ) { $query = "SELECT `PersonID`, `BodyCode` FROM `persons` WHERE `PersonID`=".addslashes($matches[1]); if( $res=doquery($query) AND $row = mysql_fetch_array($res) ) { $BodyCode = $row['BodyCode']; $PersonID = $row['PersonID']; }else { echoln("Registration number not found. Quick registration not possible."); } } /// Handle registration desk /// if( $setup['RegistrationDesks']>0 AND isset($_POST['registrationdesk']) AND $_POST['registrationdesk']>=0 AND $_POST['registrationdesk']<=$setup['RegistrationDesks'] ) $_SESSION['register_desk']=intval($_POST['registrationdesk']); if( !isset($_SESSION['register_desk']) || !is_int($_SESSION['register_desk']) ) $_SESSION['register_desk']=0; /// Top bar /// // Quick registration echoln("
"); echoln("
"); echoln(" Quick register: "); echoln(" "); echoln(" "); echoln("
"); echoln(" "); echoln("
"); echoln("
"); if( $setup['RegistrationDesks']>0 ) { // select the registration desk echoln("
"); if( $_SESSION['register_desk']<1 ) echoln(" "); echoln(" "); for( $i=1; $i<=$setup['RegistrationDesks']; $i++ ) { echoln(" "); } echoln(" "); echoln(" "); echoln("
"); }else { echoln("  "); } echoln("
"); echoln("
"); if( strlen($BodyCode)!=3 ) { /// Show list with bodies /// echoln("

Register participant

"); $query = "SELECT `ab_bodies`.`BodyCode`, `ab_bodies`.`BodyName`, `ab_bodies`.`BodyNameAscii`, `BodyCategory`, COUNT(`persons`.`PersonID`) AS `number` FROM `ab_bodies`, `persons` WHERE `ab_bodies`.`BodyCode`=`persons`.`BodyCode` GROUP BY `BodyName` ORDER BY `BodyCategoryOrder`, `BodyName`"; if( $res=doquery($query) ) { $categorycurrent = ""; $categorychoice = ""; $localcurrent = ""; $localchoice = ""; $bodylist = ""; while( $row=mysql_fetch_array($res) ) { if( $categorycurrent!=$row['BodyCategory'] ) { // We reached new body category $categorycurrent = $row['BodyCategory']; $categorychoice .= "".$row['BodyCategory']." - "; $bodylistcount = 1; $bodylist .= "".$row['BodyCategory']."\"Go"; } if( $row['BodyCategory']=="Locals" ) { if( $localcurrent!=substr($row['BodyNameAscii'], 6, 1) ) { // We reached a new first letter in bodyname $localcurrent = substr($row['BodyNameAscii'], 6, 1); $localchoice .= " ".substr($row['BodyNameAscii'], 6, 1)."  "; $bodylistcount = 1; $bodylist .= "".substr($row['BodyNameAscii'], 6, 1)."\"Go"; } } $bodylist .= "".$row['BodyName']." (".$row['number'].")"; } echoln(substr($categorychoice, 0, -3)); echoln("

Locals: ".$localchoice."

"); echoln("".$bodylist."
"); }else { echoln("Failed selecting bodies"); } }else { $query = "SELECT `BodyName`, `BodyCategory` FROM `ab_bodies` WHERE `BodyCode`='".addslashes($BodyCode)."'"; if( $res = doquery($query) AND mysql_num_rows($res)==1 ) { $row = mysql_fetch_array($res); $BodyName = $row['BodyName']; $BodyCategory = $row['BodyCategory']; if( $PersonID==0 ) { /// Show list with participants for a selected body /// echoln("

Register participant - ".$BodyName." (".$BodyCategory.")

"); echoln("Jump to body selection

"); $query = "SELECT `PersonID`, `FirstName`, `LastName`, `Sex`, `Visa`, `ParticipantType`, `ParticipantOrder`, `Accepted` FROM `persons` WHERE `BodyCode`='".addslashes($BodyCode)."' ORDER BY `Accepted`, `FirstName`, `LastName`"; if( $res=doquery($query) AND mysql_num_rows($res)>0 ) { echoln(""); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); if( $setup['SetupBoardApproval']=="yes" ) echoln(" "); echoln(" "); echoln(" "); echoln(" "); $c = 1; $currentstatus = ""; while( $row = mysql_fetch_array($res) ) { if( $row['Accepted']!=$currentstatus ) { $currentstatus = $row['Accepted']; if( $setup['SetupBoardApproval']=="yes" ) echoln(" "); else echoln(" "); $c = 1; } echoln(" "); if( in_array( $row['Accepted'], preg_split("/,/", $setup['RegisterAccepted']) ) || in_array("application_registerfull", $_SESSION['sess_functions']) ) echoln(" "); else echoln(" "); echoln(" "); echoln(" "); echoln(" "); if( $setup['SetupBoardApproval']=="yes" ) { if( $row['ParticipantType']=="-" ) echoln(" "); else echoln(" "); } echoln(" "); echoln(" "); echoln(" "); } echoln("
First nameFamily nameGenderVisaParticipant typeAccepted 
=== ".$Accepted_text[ $row['Accepted'] ]." ===
=== ".$Accepted_text[ $row['Accepted'] ]." ===
".$row['FirstName']."".$row['FirstName']."".$row['LastName']."".$row['Sex']."".$row['Visa']."-".$row['ParticipantType']." (".$row['ParticipantOrder'].")\"".$Accepted_text[\"Show
"); }else { echoln("No participants found from this body."); } }else { /// Handle participant /// $query = "SELECT `PersonID` AS `_PersonID`, `FirstName` AS `_FirstName`, `LastName` AS `_LastName`, `Accepted` AS `_Accepted`, `Fee` AS `_Fee`, `FeePaid` AS `_FeePaid`, `ParticipantType` AS `_ParticipantType`, `Gym` AS `_Gym` "; $fields = ""; if( !isset($_REQUEST['_Accepted']) ) { // load extra fields for showing in application form $fields = preg_split("/,/", $setup['RegistrationFields']); }elseif( strlen($setup['CustRegistrationLinkName'])>0 AND strlen($setup['CustRegistrationLinkURL'])>0 AND preg_match_all("/%([a-zA-Z0-9_]+)%/", $setup['CustRegistrationLinkURL'], $matches) ) { // load extra fields for registration link at end of registration $fields = $matches[1]; } if( is_array($fields) ) { $linkclasses = array(); $boldclasses = array(); for( $i=0; $iget_access(false)!=Appl::ACCESS_NO ) { $linkclasses[ $class ] = $classref; if( substr($fields[$i], -1, 1)=="!" ) $boldclasses[ $class ] = true; else $boldclasses[ $class ] = false; $sql_columnname = $classref->sql_columnname(); if( preg_match("/^(.*?) AS `[a-zA-Z0-9_]+`$/", $sql_columnname, $field) ) { $query .= ", ".$field[1] . " AS `".$searchfile."`"; }else { $query .= ", ".$sql_columnname . " AS `".$searchfile."`"; } } } } } $query.= "FROM `persons` WHERE `PersonID`=".addslashes($PersonID)." AND `BodyCode`='".addslashes($BodyCode)."'"; if( $res=doquery($query) AND mysql_num_rows($res)==1 ) { $row = mysql_fetch_array($res); echoln("

Register participant - ".$BodyName." (".$BodyCategory.") - ".$row['_FirstName']." ".$row['_LastName']."

"); echoln("Jump to body selection
"); echoln("Jump to ".$BodyName."

"); if( !isset($_REQUEST['_Accepted']) ) { /// Show data and register button /// $c = 1; echoln("

"); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); if( $k = array_keys($linkclasses) ) { for( $i=0; $i".$linkclasses[ $k[$i] ]->displaytext($row[ $field ]).""); } } } echoln("
First name:".$row['_FirstName']."
Family name:".$row['_LastName']."
Accepted:\"".$Accepted_text[
Participant type:".$row['_ParticipantType']."
".$linkclasses[ $k[$i] ]->get_print_name().":
"); echoln("

\"Show"); if( in_array("application_edit", $_SESSION['sess_functions']) ) echoln("    edit"); echoln("

"); $register_allowed = true; if( $setup['RegisterFeeCheck'] ) { $feeclass = new Fee(); $fee = $feeclass->get_fee($BodyCode, $row['_ParticipantType'], $row['_Fee']); if( $fee>=0 AND $row['_FeePaid']>=0 ) { if( $fee>$row['_FeePaid'] ) { if( !in_array("application_registerfull", $_SESSION['sess_functions']) AND ($fee-$row['_FeePaid'])>$setup['RegisterMaxFeeDifference'] ) { $register_allowed = false; echoln(" Person paid € ".number_format($fee-$row['_FeePaid'], 2, ",", ".")." too less.

"); }else { echoln(" Person paid € ".number_format($fee-$row['_FeePaid'], 2, ",", ".")." too less.

"); } } }else { if( !in_array("application_registerfull", $_SESSION['sess_functions']) AND $fee>$setup['RegisterMaxFeeDifference'] ) { $register_allowed = false; echoln(" Failed fee check. Either fee is not set for this participant, or fee has not been paid.

"); }else { echoln(" Failed fee check. Either fee is not set for this participant, or fee has not been paid.

"); } } } if( !in_array( $row['_Accepted'], preg_split("/,/", $setup['RegisterAccepted']) ) && !in_array("application_registerfull", $_SESSION['sess_functions']) ) { $register_allowed = false; echoln(" You are not allowed to register participants with accepted status '".$Accepted_text[ $row['_Accepted'] ]."'.

"); } if( $row['_Accepted']=="arrived" ) { $register_allowed = false; echoln(" This person is already registered, you cannot register again.

"); }elseif( !in_array($row['_Accepted'], array("yes", "pending", "confirmed")) ) { // locking for 'register' users is done few lines above echoln(" This person is not supposed to be in front of you. This person is not accepted.

"); } if( $register_allowed ) { echoln(" "); echoln(" "); }elseif( $row['_Accepted']=="arrived" AND in_array("application_registerfull", $_SESSION['sess_functions']) ) { echoln(" "); echoln(" "); }else { echoln(" "); } echoln("

"); }else { /// Register participant /// $register_allowed = true; if( $setup['RegisterFeeCheck'] ) { $feeclass = new Fee(); $fee = $feeclass->get_fee($BodyCode, $row['_ParticipantType'], $row['_Fee']); if( $fee>=0 AND $row['_FeePaid']>=0 ) { if( $fee>$row['_FeePaid'] ) { echoln("Participant still has to pay € ".number_format($fee-$row['_FeePaid'], 2, ",", ".")."!!!

"); if( !in_array("application_registerfull", $_SESSION['sess_functions']) AND ($fee-$row['_FeePaid'])>$setup['RegisterMaxFeeDifference'] ) $register_allowed = false; } }else { if( $fee>=0 ) echoln("Participant still has to pay € ".number_format($fee, 2, ",", ".")."!!!

"); if( !in_array("application_registerfull", $_SESSION['sess_functions']) AND $fee>$setup['RegisterMaxFeeDifference'] ) $register_allowed = false; } } if( !in_array( $row['_Accepted'], preg_split("/,/", $setup['RegisterAccepted']) ) AND !in_array("application_registerfull", $_SESSION['sess_functions']) ) { $register_allowed = false; }elseif( $row['_Accepted']=="arrived" AND !in_array("application_registerfull", $_SESSION['sess_functions']) ) { $register_allowed = false; }elseif( $_POST['_Accepted']!="arrived" AND !in_array("application_registerfull", $_SESSION['sess_functions']) ) { $register_allowed = false; }elseif( !in_array($_POST['_Accepted'], array("yes", "pending", "confirmed", "-", "no", "cancel", "arrived")) ) { $register_allowed = false; } if( get_sql_date($setup['EventDateStart'])>date("Y-m-d H:i:s", strtotime("+4 days")) ) { $register_allowed = false; echoln("This function is disabled at this moment. It is unlikely people are already arriving at your event.

"); } if( $register_allowed ) { $query = "UPDATE `persons` SET `Accepted`='".addslashes($_POST['_Accepted'])."', `RegistrationDesk`=".addslashes($_SESSION['register_desk']).", `Log`=CONCAT(`Log`,'\n".date("Y-m-d H:i:s").": registered arrival, set accepted to ".addslashes($_POST['_Accepted'])." by ".addslashes($_SESSION['sess_name'])."') WHERE `PersonID`=".addslashes($PersonID); if( doquery($query) AND mysql_affected_rows()==1 ) { echoln("\"".$Accepted_text[ Participant registered successfully

"); $c = 1; echoln(""); echoln(" "); echoln(" "); echoln(" "); if( $setup['ApplShowGym'] ) echoln(" "); echoln("
First name:".$row['_FirstName']."
Family name:".$row['_LastName']."
Participant type:".$row['_ParticipantType']."
Gym:".$row['_Gym']."
"); echoln("

\"Show   "); // Custom link to be opened? if( $_POST['_Accepted']=="arrived" AND strlen($setup['CustRegistrationLinkName'])>0 AND strlen($setup['CustRegistrationLinkURL'])>0 ) { $src = array(); $repl = array(); if( $k = array_keys($linkclasses) ) { for( $i=0; $idisplaytext($row[$field]) ); } } } if( $setup['CustRegistrationLinkAutoOpen'] ) { echoln(""); } echoln("".$setup['CustRegistrationLinkName']."

"); } }else { echoln("Failed registering participant. Please try again.

"); } }else { echoln("You are not allowed to register this person.

"); } } }else { echoln("

Register participant - ".$BodyName." (".$BodyCategory.")

"); echoln("Jump to body selection

"); echoln("Failed selecting participant, not found."); } } }else { echoln("Body does not exist."); echoln("

Back

"); } } } admin_footer($_SESSION['register_menu']=="hide"); ?>