diff --git a/register_participants.php b/register_participants.php index eae27ed..3bffc02 100644 --- a/register_participants.php +++ b/register_participants.php @@ -24,6 +24,9 @@ '".$config['dates']['regopen']."' AND NOW()<'".$config['dates']['regclose']."') AS datecheck"); + $datecheck=mysql_fetch_object($q); + if($_POST['action']=="new") { $q=mysql_query("SELECT email,num,id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND year=".$config['FAIRYEAR']); @@ -137,59 +140,79 @@ echo "
"; } } + $showform=true; if($allownew) { - $regnum=0; - //now create the new registration record, and assign a random/unique registration number to then. - do + if($datecheck->datecheck==0) { - //random number between - //100000 and 999999 (six digit integer) - $regnum=rand(100000,999999); - $q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']); - }while(mysql_num_rows($q)>0); + echo error(i18n("Registration is closed. You can not create a new account")); + $showform=false; + echo "Back to Participant Registration Login Page"; - //actually insert it - mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES (". - "'$regnum',". - "'".$_SESSION['email']."',". - "NOW(),". - "'new',". - $config['FAIRYEAR']. - ")"); + } + else + { + $regnum=0; + //now create the new registration record, and assign a random/unique registration number to then. + do + { + //random number between + //100000 and 999999 (six digit integer) + $regnum=rand(100000,999999); + $q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']); + }while(mysql_num_rows($q)>0); + + //actually insert it + mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES (". + "'$regnum',". + "'".$_SESSION['email']."',". + "NOW(),". + "'new',". + $config['FAIRYEAR']. + ")"); - $mailbody= "A new registration account has been created for you.\n". - "To access your registration account, please enter\n". - "enter the following registration number into the\n". - "registration website:\n". - "\n". - "Registration Number: $regnum\n". - "\n"; - mail($_SESSION['email'],i18n("Registration for %1",array(i18n($config['fairname']))),$mailbody); + $mailbody= "A new registration account has been created for you.\n". + "To access your registration account, please enter\n". + "enter the following registration number into the\n". + "registration website:\n". + "\n". + "Registration Number: $regnum\n". + "\n"; + mail($_SESSION['email'],i18n("Registration for %1",array(i18n($config['fairname']))),$mailbody); - echo i18n("You have been identified as a new registrant. An email has been sent to %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email'])); - echo ""; + echo i18n("You have been identified as a new registrant. An email has been sent to %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email'])); + echo ""; + } } - echo "
"; - echo i18n("Registration Number:"); - echo ""; - echo ""; - echo ""; - echo "
"; - echo i18n("If you have lost or forgotten your registration number, please click here to resend it to your email address"); + if($showform) + { + echo "
"; + echo i18n("Registration Number:"); + echo ""; + echo ""; + echo ""; + echo "
"; + echo i18n("If you have lost or forgotten your registration number, please click here to resend it to your email address"); + } } else { //Lets check the date - if we are AFTER 'regopen' and BEFORE 'regclose' then we can login //otherwise, registration is closed - no logins! - $q=mysql_query("SELECT (NOW()>'".$config['dates']['regopen']."' AND NOW()<'".$config['dates']['regclose']."') AS datecheck"); - $r=mysql_fetch_object($q); //this will return 1 if its between the dates, 0 otherwise. - if($r->datecheck==1) + if($datecheck->datecheck==0) + { + echo notice(i18n("Registration for the %1 %2 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($config['FAIRYEAR'],$config['fairname']))); + echo i18n("Please enter your email address to login"); + echo "
"; + echo "
"; + $buttontext=i18n("Login"); + } + else { echo i18n("Please enter your email address to :"); @@ -198,22 +221,19 @@ echo "
  • ".i18n("Continue a previously started registration")."
  • "; echo "
  • ".i18n("Modify an existing registration")."
  • "; echo ""; - echo i18n("Please enter a valid email address. We will be emailing you information which you will need to complete the registration process!"); + echo i18n("You must enter a valid email address. We will be emailing you information which you will need to complete the registration process!"); echo "
    "; echo "
    "; + $buttontext=i18n("Begin"); + } - ?> -
    - - : - -
    - +
    + + : + +
    + diff --git a/register_participants_main.php b/register_participants_main.php index 87923c6..a7708e2 100644 --- a/register_participants_main.php +++ b/register_participants_main.php @@ -180,12 +180,26 @@ echo ""; - echo ""; - echo ""; - $num++; - } - echo "
    "; { echo ""; echo ""; + if(registrationFormsReceived()) { - echo ""; + $q=mysql_query("SELECT (NOW()>'".$config['dates']['specawardregopen']."' AND NOW()<'".$config['dates']['specawardregclose']."') AS datecheck"); + $r=mysql_fetch_object($q); + //this will return 1 if its between the dates, 0 otherwise. + if($r->datecheck==1) + { + echo ""; + } + else + { + echo ""; + + } + + $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."'"); $project=mysql_fetch_object($q); - $nominatedawards=getSpecialAwardsNominatedForProject($project->id); + $nominatedawards=getSpecialAwardsNominatedForProject($project->id); $num=count($nominatedawards); if($num) { @@ -218,7 +232,7 @@ echo "
    ".i18n("Special Award Nominations")."
    ".i18n("Self-nominate for special awards")."
    ".i18n("Self-nominate for special awards")."
    ".error(i18n("Special award self-nomination is only available from %1 to %2",array($config['dates']['specawardregopen'],$config['dates']['specawardregclose'])),"inline")."
    "; } - + echo "
    "; { echo "
    ".error(i18n("We must receive your signature form before you can nominate yourself for special awards"),"inline")."
    "; } diff --git a/register_participants_spawards.php b/register_participants_spawards.php index bb7e1fe..4d44c6d 100644 --- a/register_participants_spawards.php +++ b/register_participants_spawards.php @@ -60,33 +60,75 @@ echo mysql_error(); //send the header send_header("Participant Registration - Self-Nomination for Special Awards"); + ?> + + + << ".i18n("Back to Participant Registration Summary")."
    "; echo "
    "; + echo notice(i18n("Special award self-nomination is only available from %1 to %2. Please make sure you complete your nominations between these dates. You may apply to a maximum of %3 special awards.",array($config['dates']['specawardregopen'],$config['dates']['specawardregclose'],$config['maxspecialawardsperproject']))); + +$q=mysql_query("SELECT (NOW()>'".$config['dates']['specawardregopen']."' AND NOW()<'".$config['dates']['specawardregclose']."') AS datecheck"); +$r=mysql_fetch_object($q); +//this will return 1 if its between the dates, 0 otherwise. +if($r->datecheck==1) + $readonly=false; +else + $readonly=true; + if($_POST['action']=="save") { - //FIXME: check the date when they have to have this in by and dont let them submit after that date -// if(registrationFormsReceived()) -// { -// echo error(i18n("Cannot make changes to forms once they have been received by the fair")); -// } -// else -// { - //first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them - mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND year='".$config['FAIRYEAR']."'"); - $count=0; - foreach($_POST['spaward'] AS $spaward) + //this will return 1 if its between the dates, 0 otherwise. + if(!$readonly) + { + $num=count($_POST['spaward']); + if($num>$config['maxspecialawardsperproject']) { - mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,year) VALUES (". - "'$spaward', ". - "'$project->id', ". - "'".$config['FAIRYEAR']."')"); - echo mysql_error(); - $count++; + echo error(i18n("You can only apply to %1 special awards. You have selected %2",array($config['maxspecialawardsperproject'],$num))); } - echo happy(i18n("Successfully registered for %1 special awards",array($count))); -// } + else + { + mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND year='".$config['FAIRYEAR']."'"); + + foreach($_POST['spaward'] AS $spaward) + { + mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,year) VALUES (". + "'$spaward', ". + "'$project->id', ". + "'".$config['FAIRYEAR']."')"); + echo mysql_error(); + } + if($num) + echo happy(i18n("Successfully registered for %1 special awards",array($num))); + } + } + else + { + echo error(i18n("Special award self-nomination is only available from %1 to %2",array($config['dates']['specawardregopen'],$config['dates']['specawardregclose']))); + + } } @@ -99,11 +141,11 @@ if($newstatus!="complete") } else if($newstatus=="complete") { - echo happy(i18n("Safety Awards Self-Nomination Complete")); + echo happy(i18n("Special Awards Self-Nomination Complete")); } - echo "
    \n"; + echo "\n"; echo "\n"; echo "\n"; @@ -134,7 +176,7 @@ else if($newstatus=="complete") { echo ""; @@ -144,24 +186,8 @@ else if($newstatus=="complete") echo ""; } echo "
    "; if(in_array($eaward['id'],$nominatedawards_list)) $ch="checked=\"checked\""; else $ch=""; - echo ""; + echo ""; echo ""; echo "".$eaward['name'].""; echo "
    "; - /* - $num=1; - while($r=mysql_fetch_object($q)) - { - echo "
    $num. ".i18n($r->question).""; - if($r->type=="check") - { - if($safetyanswers[$r->id]=="checked") $ch="checked=\"checked\""; else $ch=""; - echo "id]\" value=\"checked\" />"; - } - echo "
    "; - */ - echo "\n"; + if(!$readonly) + echo "\n"; echo "";