00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00037 class Member
00038 {
00039 var $room;
00040 var $membershipType;
00041 var $optionalChoices;
00042 var $username;
00043 var $realname;
00044 var $dateOfBirth;
00045 var $gender;
00046 var $tShirtSize;
00047 var $sharingWith;
00048
00049 var $addressStreet;
00050 var $addressStreet2;
00051 var $addressZip;
00052 var $addressCity;
00053 var $addressCountry;
00054 var $addressState;
00055 var $addressPhone;
00056
00057 var $password;
00058 var $confirmationCode;
00059 var $confirmed;
00060
00061 var $paidAmount;
00062
00063 var $parentConvention;
00064 var $id;
00065
00066 function Member( $parentConvention, $id = NULL )
00067 {
00068 $this->parentConvention = &$parentConvention;
00069 $this->id = $id;
00070
00071 if( $this->id !== NULL )
00072 $this->load();
00073 }
00074
00075 function newConfirmationCode()
00076 {
00077
00078 $this->confirmationCode = makeRandomPassword(20);
00079
00080
00081 $this->confirmed = false;
00082
00083 if($this->parentConvention->adminConfirmation)
00084 {
00085 $theDetails = "---\n";
00086 $theDetails = i18n("Username: ##0##", array($this->username)) . "\n";
00087 $theDetails = i18n("Real name: ##0##", array($this->realname)) . "\n";
00088 $theDetails = i18n("Membership type: ##0##", array($this->parentConvention->membershipTypes[$this->membershipType]->title)) . "\n";
00089 $theDetails = i18n("Address: ##0##", array($this->addressStreet)) . "\n";
00090 $theDetails = i18n("Address: ##0##", array($this->addressStreet2)) . "\n";
00091 $theDetails = i18n("Post code: ##0##", array($this->addressZip)) . "\n";
00092 $theDetails = i18n("City: ##0##", array($this->addressCity)) . "\n";
00093 $theDetails = i18n("Country: ##0##", array($this->addressCountry)) . "\n";
00094 $theDetails = i18n("State: ##0##", array($this->addressState)) . "\n";
00095 $theDetails = i18n("Phone: ##0##", array($this->addressPhone)) . "\n";
00096 $theDetails = i18n( "Email: ##0##", array( getUserInfo( $this->username, "email" ) ) ) . "\n";
00097
00098
00099 sendMessage($this->parentConvention->owner, i18n("New email address entered for user ID ##0## for ##1##", array( $this->id, $this->parentConvention->title ) ), i18n("A new email address has been entered for ##0##. Please click here to confirm: ##1## or here to view the convention details: ##2##. Below can be found the membership details:\n##0##", array( $this->realname . "(" . $this->id . ")", globalIDtoURL( "setup/modulesetup/convention/cons/" . $this->parentConvention->id . "/member/toggleconfirmed/" . $this->id ), globalIDtoURL( "setup/modulesetup/convention/cons/" . $this->parentConvention->id ), $theDetails ) ), getUserInfo($this->parentConvention->owner, "email"), "email");
00100
00101
00102 $subject = $this->parentConvention->getEmailSubject( "initial", &$this );
00103 $message = $this->parentConvention->getEmailBody( "initial", &$this );
00104 }
00105 else
00106 {
00107
00108 $subject = $this->parentConvention->getEmailSubject( "initial2", &$this );
00109 $message = $this->parentConvention->getEmailBody( "initial2", &$this );
00110 }
00111
00112 sendMessage($this->username, $subject, $message . "\n" . $this->parentConvention->emailFooter, $this->parentConvention->owner, "email");
00113
00114
00115 $this->save();
00116 }
00117
00118 function setConfirmed()
00119 {
00120 $this->confirmed = true;
00121
00122 $this->save();
00123
00124 if( $this->parentConvention->adminConfirmation )
00125 {
00126 $subject = $this->parentConvention->getEmailSubject( "confirmed", &$this );
00127 $message = $this->parentConvention->getEmailBody( "confirmed", &$this );
00128 }
00129 else
00130 {
00131 $subject = $this->parentConvention->getEmailSubject( "confirmed2", &$this );
00132 $message = $this->parentConvention->getEmailBody( "confirmed2", &$this );
00133 }
00134
00135 sendMessage($this->username, $subject, $message . "\n" . $this->parentConvention->emailFooter, $this->parentConvention->owner, "email");
00136 }
00137
00145 function generateUsername( $fromWhatNick )
00146 {
00147 global $usermanager;
00148
00149 $theUsername = strtolower( str_replace( " ", "", $fromWhatNick ) );
00150 $testUsername = $theUsername;
00151 $additionalStuff = 1;
00152
00153 while( $usermanager->userExists( $testUsername ) )
00154 {
00155 $testUsername = $theUsername . $additionalStuff;
00156 $additionalStuff++;
00157 }
00158 $theUsername = $testUsername;
00159
00160 return $theUsername;
00161 }
00162
00163 function load()
00164 {
00165 $filename = $this->parentConvention->conventionBasedir . "/members/" . $this->id . ".php";
00166
00167 if( file_exists( $filename ) )
00168 include( $filename );
00169
00170 if( is_array( $settings) )
00171 foreach( $settings as $key => $value )
00172 $this->$key = $value;
00173
00174 if( !is_array($this->sharingWith) )
00175 $this->sharingWith = array();
00176 }
00177
00178 function save()
00179 {
00180 $basedir = $this->parentConvention->conventionBasedir . "/members";
00181 if( !is_dir( $basedir ) )
00182 mkdir( $basedir );
00183
00184 $filename = $basedir . "/" . $this->id . ".php";
00185 if( file_exists( $filename ) )
00186 unlink( $filename );
00187
00188 $settings["addressCity"] = $this->addressCity;
00189 $settings["addressCountry"] = $this->addressCountry;
00190 $settings["addressPhone"] = $this->addressPhone;
00191 $settings["addressState"] = $this->addressState;
00192 $settings["addressStreet"] = $this->addressStreet;
00193 $settings["addressStreet2"] = $this->addressStreet2;
00194 $settings["addressZip"] = $this->addressZip;
00195 $settings["dateOfBirth"] = $this->dateOfBirth;
00196 $settings["confirmationCode"] = $this->confirmationCode;
00197 $settings["confirmed"] = $this->confirmed;
00198 $settings["gender"] = $this->gender;
00199 $settings["tShirtSize"] = $this->tShirtSize;
00200
00201 $settings["membershipType"] = $this->membershipType;
00202 $settings["optionalChoices"] = $this->optionalChoices;
00203 $settings["paidAmount"] = ($this->paidAmount == "") ? 0 : $this->paidAmount;
00204 $settings["password"] = $this->password;
00205 $settings["realname"] = $this->realname;
00206 $settings["room"] = $this->room;
00207 $settings["username"] = $this->username;
00208 $settings["sharingWith"] = $this->sharingWith;
00209
00210 file_put_contents( $filename, array_export( $settings, "settings" ) );
00211 }
00212
00213 function checkRoomies()
00214 {
00215 foreach( $this->sharingWith as $thisUsername => $confirmed )
00216 {
00217 $theID = null;
00218 foreach( $this->parentConvention->members as $key => $value )
00219 if( $thisUsername == $value->username )
00220 $theID = $key;
00221
00222 if( $theID == null )
00223 continue;
00224
00225 if( is_array( $this->parentConvention->members[$theID]->sharingWith ) )
00226 $this->sharingWith[$thisUsername] = array_key_exists( $this->username, $this->parentConvention->members[$theID]->sharingWith );
00227 }
00228 }
00229
00230 function renderBlock( $parentID )
00231 {
00232 $totalPayable = (float)$this->parentConvention->membershipTypes[$this->membershipType]->price;
00233 if( is_array( $this->optionalChoices ) )
00234 foreach( $this->optionalChoices as $key => $value )
00235 foreach( $this->parentConvention->optionalChoices as $key2 => $value2 )
00236 if( $value == $value2->id )
00237 $totalPayable += (float)$value2->price;
00238
00239 $remainingPayable = $totalPayable - $this->paidAmount;
00240
00241 $confirmTitle = $this->confirmed ? i18n("Confirmed") : i18n("Unconfirmed");
00242
00243 $renderedContent = "
00244 <tr>
00245 <td><label><input type=\"checkbox\" name=\"selectedMembers[" . $this->id . "]\" checked />
00246 " . $this->id . "</label></td>
00247 <td>" . $this->realname . " (<a href=\"" . globalIDtoURL( "user/" . $this->username ) . "\">" . $this->username . "</a>)</td>
00248 <td class=\"wikirightalign\">" . $remainingPayable . "</td>
00249 <td class=\"wikirightalign\">" .
00250 drawCommand( $confirmTitle, i18n("Toggle ##0##'s confirmed status to unconfirmed", array( $this->realname ) ), globalIDtoURL( "$parentID/member/toggleconfirmed/" . $this->id ) ) . " " .
00251 drawCommand( i18n("Delete"), i18n( "Delete ##0##'s registration", array($this->realname) ), globalIDtoURL( "$parentID/member/delete/" . $this->id ) ) . " " .
00252 drawCommand( i18n("Details"), i18n( "Edit ##0##'s details", array($this->realname) ), globalIDtoURL( "$parentID/member/details/" . $this->id ) ) .
00253 "</td>
00254 </tr>";
00255 return $renderedContent;
00256 }
00257
00258 function renderEditor( $admin = false )
00259 {
00260 global $globalID, $userinfo_folder, $profile_options;
00261 $splitID = explode( "/", $globalID );
00262 if( $splitID[3] == "cons" )
00263 {
00264 $theGlobalID = "setup/modulesetup/convention/cons/" . $this->parentConvention->id . "/member/details/";
00265 $thisGlobalID = $theGlobalID . $this->id;
00266 $editWhat = $splitID[8];
00267 $editHow = $splitID[9];
00268 $editWho = $splitID[10];
00269 }
00270 else if( $splitID[0] == "setup" )
00271 {
00272 $theGlobalID = "setup/modulesetup/convention/member/details/";
00273 $thisGlobalID = $theGlobalID . $this->id;
00274 $editWhat = $splitID[6];
00275 $editHow = $splitID[7];
00276 $editWho = $splitID[8];
00277 }
00278 else
00279 {
00280 $theGlobalID = "convention/member/";
00281 $thisGlobalID = substr( $theGlobalID, 0, -1 );
00282 $editWhat = $splitID[2];
00283 $editHow = $splitID[3];
00284 $editWho = $splitID[4];
00285 }
00286
00287
00288 $container = new TabWidget();
00289 $container->tabbar->addTab( i18n("Details"), globalIDtoURL( $thisGlobalID ) );
00290 $container->tabbar->addTab( i18n("Badge picture"), globalIDtoURL( $thisGlobalID . "/badgepic" ) );
00291 $container->tabbar->addTab( i18n("Room sharing"), globalIDtoURL( $thisGlobalID . "/roomsharing" ) );
00292
00293 switch( $editWhat )
00294 {
00295 case "roomsharing":
00296 $container->tabbar->setCurrent(i18n("Room sharing"));
00297
00298 if( $editHow == "remove" )
00299 {
00300 if( ! array_key_exists( $editWho, $this->sharingWith ) )
00301 header( "Location: " . globalIDtoURL( $thisGlobalID . "/roomsharing" ) );
00302
00303 $panel = new optionsPanel("removeroomie");
00304 $panel->showHeader = false;
00305 $panel->saveTitle = i18n("Confirm selection");
00306 $panel->resetTitle = i18n("Reset choices");
00307
00308 $panel->addOption( i18n("The user in question"), "", $editWho , "theusername", "label" );
00309 $panel->addOption( i18n("Check to delete"), i18n("Just leave unchecked and click Confirm selection to abort the deletion process"), 0, "confirmDelete", "checkbox" );
00310
00311 if( $panel->submitted )
00312 {
00313 if( $panel->options["confirmDelete"]["current"] == true )
00314 {
00315 unset( $this->sharingWith[$editWho] );
00316 $this->save();
00317 }
00318 header( "Location: " . globalIDtoURL( "$thisGlobalID/roomsharing" ) );
00319 }
00320
00321 $container->contents .= renderInformationBox( i18n( "Delete ##0##?", array( $editWho ) ), $panel->render(), false );
00322
00323 }
00324 else
00325 {
00326
00327 if( count( $this->sharingWith ) > 0 )
00328 {
00329
00330 if( count( $this->sharingWith ) + 1 < $this->parentConvention->averagePerRoom )
00331 $container->contents .= renderInformationBox( i18n("Room size warning"), i18n("Please note that the average room size in this convention is ##0##. You have only selected ##1## roommates, and it is thus likely that you and your roommates will be teamed up with others to fill up the rooms to capacity.", array( $this->parentConvention->averagePerRoom, count( $this->sharingWith ) ) ) );
00332 else if( count( $this->sharingWith ) + 1 > $this->parentConvention->averagePerRoom )
00333 $container->contents .= renderInformationBox( i18n("Room size warning"), i18n("Please note that the average room size in this convention is ##0##. You have selected ##1## roommates, and it is thus likely that you and your roommates will be split up into more than one room, in order to full the rooms to capacity, if no rooms exist with the correct capacity. We will, of course, attempt to place the people you wish to share room with in rooms near to eachother.", array( $this->parentConvention->averagePerRoom, count( $this->sharingWith ) ) ) );
00334
00335
00336 $this->checkRoomies();
00337
00338
00339 $table = new Table("convention-member-roomsharing", "convention-member-roomsharing", "convention-member-roomsharing");
00340 $table->newRow( null, true );
00341 $table->addColumn();
00342 $table->addColumn( "convention-member-roomsharing-confirmed" );
00343 $table->addColumn( "convention-member-roomsharing-commands" );
00344 $table->setRowContent( 0, false, i18n("Roomie"), i18n("Confirmed?"), " " );
00345
00346 foreach( $this->sharingWith as $thisUsername => $confirmed )
00347 {
00348 $table->newRow();
00349 $table->newCell( getUserInfo( $thisUsername, "name" ) );
00350 $table->newCell( $confirmed ? i18n("Yes") : "(((" . i18n("This user has not yet confirmed your roomie status by adding you as a roomie as well") . "||" . i18n("No") . ")))" );
00351 $table->newCell( drawCommand( i18n("Remove"), i18n("Remove this user from your room sharing list"), globalIDtoURL( $thisGlobalID . "/roomsharing/remove/" . $thisUsername ) ) );
00352 }
00353
00354 $container->contents .= $table->render();
00355 }
00356
00357 $panel = new optionsPanel("addroomie");
00358 $panel->showHeader = false;
00359 $panel->saveTitle = i18n("Add roomie");
00360 $panel->revertTitle = i18n("Clear name");
00361
00362
00363 $availableMembers = array();
00364 foreach( $this->parentConvention->members as $key => $member )
00365 {
00366
00367 if( $member->id != $this->id )
00368 {
00369
00370 $canShare = true;
00371 if( array_key_exists( $member->username, $this->sharingWith ) )
00372 $canShare = false;
00373
00374 if( $canShare )
00375 $availableMembers[$member->username] = getUserInfo( $member->username, "name" ) . " (" . $member->id . ")";
00376 }
00377 }
00378 asort($availableMembers);
00379
00380 $panel->addOption( i18n("Username"), i18n("Choose the roomie you want to add."), "", "username", "select", $availableMembers );
00381
00382 if( $panel->submitted )
00383 {
00384 if( !array_key_exists( $panel->options["username"]["current"], $this->sharingWith ) )
00385 {
00386 $this->sharingWith[$panel->options["username"]["current"]] = false;
00387 $this->save();
00388 header( "Location: " . globalIDtoURL( $thisGlobalID . "/roomsharing" ) );
00389 }
00390 }
00391
00392 $container->contents .= renderInformationBox( i18n("Add new roomie"), parse_page_data(
00393 "# " . i18n("Select the name of the person you wish to share a room with and select 'Add Roomie' below.") .
00394 "\n# " . i18n("Get the other person to select you on their profile.") .
00395 "\n# " . i18n("Once that is done, the person will be marked as confirmed.") .
00396 "\n* " . i18n("If you have multiple people you wish to share with you need to repeat this process. You do not need to add yourself.") . "\n---" ) . $panel->render(), false);
00397 }
00398 break;
00399 case "badgepic":
00400 $container->tabbar->setCurrent(i18n("Badge picture"));
00401
00402 if( $_POST["avatardelete"] )
00403 unlink_multiple("$userinfo_folder/" . $this->username . "/avatar*");
00404
00405 if( is_array($_FILES["uploadedfile"]) && $_POST["upload_avatar"] )
00406 {
00407 $errorHandler = new errorHandler( thisPageURL() );
00408 $continue = false;
00409 unlink_multiple("$userinfo_folder/" . $this->username . "/avatar*");
00410
00411 if ( checkImageMimetype( $_FILES['uploadedfile']['tmp_name'] ) == false )
00412 {
00413 $upload_wrongfilesuffix = true;
00414 }
00415 else
00416 {
00417 $uploadFile = "$userinfo_folder/" . $this->username . "/avatar." . checkImageMimetype( $_FILES['uploadedfile']['tmp_name'] );
00418 $thumbAvatar = "$userinfo_folder/" . $this->username . "/avatar-thumb." . checkImageMimetype( $_FILES['uploadedfile']['tmp_name'] );
00419 $continue = move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploadFile);
00420 }
00421
00422 if ($continue)
00423 {
00424 $errorHandler->handle( i18n( "Resizing ##0##", array( $filename ) ), scaleImage( $uploadFile, $uploadFile, $profile_options["avatar_maxwidth"], $profile_options["avatar_maxheight"] ) );
00425 if( !$profile_options['thumbnail_disable'] )
00426 $errorHandler->handle( i18n( "Thumbnailing ##0##", array( $filename ) ), scaleImage( $uploadFile, $thumbAvatar, $profile_options["thumbnail_width"], $profile_options["thumbnail_height"] ) );
00427
00428 chmod($uploadFile, 0664);
00429 if( file_exists( $thumbAvatar ) )
00430 chmod($thumbAvatar, 0664);
00431
00432 header("Location: " . globalIDtoURL("$thisGlobalID/badgepic") );
00433 }
00434 else
00435 {
00436 if ($upload_wrongfilesuffix)
00437 {
00438 $errorHandler->handle(
00439 i18n("Error during avatar upload"),
00440 i18n("The file is in an unknown format. The following formats are supported") . ":
00441 png (Portable Network Graphics)
00442 , jpg, jpeg (Joint Pictures Expert Group)
00443 , gif (Graphics Interchange Format)");
00444 }
00445 else
00446 {
00447 switch ($_FILES['uploadedfile']['error'])
00448 {
00449 case 1:
00450 $theError = "The uploaded file exceeds the upload_max_filesize directive in php.ini. Please contact your host and rectify this (or better yet, select a smaller file. Most often, this directive states 2MB as the maximum upload size, however as we have 1MB as the maxium here, they have obviously changed it).";
00451 break;
00452 case 2:
00453 $theError = "The uploaded file exceeds 1MB in size, and is too large to upload in this manner.";
00454 break;
00455 case 3:
00456 $theError = "The uploaded file was only partially uploaded.";
00457 break;
00458 case 4:
00459 $theError = "No file was uploaded.";
00460 break;
00461 }
00462 $errorHandler->handle(
00463 i18n("The following error occurred during upload of your avatar"),
00464 $theError);
00465 }
00466 $container->contents = $errorHandler->render();
00467 }
00468 }
00469
00470 $avatarfile = getAvatar( $this->username );
00471 $avatarthumbfile = getAvatarThumbnail( $this->username );
00472 list($avatarwidth,$avatarheight) = getimagesize($avatarthumbfile);
00473 $avatarfile = siteURL(true) . $avatarfile;
00474 $avatarthumbfile = siteURL(true) . $avatarthumbfile;
00475
00476 $container->contents .= "
00477 <table class=\"setup\">
00478 <tr class=\"setup\">
00479 <td width=\"50%\" class=\"setup\">
00480 " . i18n("Upload badge picture") . ":<br />
00481 <small class=\"comment\">" . i18n("Select a file for uploading as your badge picture. This must be one of either jpg, gif or png format, and be of smaller filesize than ##0##. The image will be resized as required.", array(ini_get("upload_max_filesize"))) . "</small>
00482 <input style=\"width: 100%\" type=\"file\" name=\"uploadedfile\" />
00483 </td>
00484 <td width=\"50%\" class=\"setup\">
00485 <div align=\"center\">
00486 <a style=\"border: none;\" href=\"$avatarfile\" target=\"_blank\"><img border=\"0\" src=\"$avatarthumbfile?x=" . (uniqid((double)microtime()*1000000,1)) . "\" width=\"$avatarwidth\" height=\"$avatarheight\" alt=\"" . i18n("##0##'s badge picture", array($this->realname )) . "\" /></a><br />
00487 </div>
00488 </td>
00489 </tr>
00490 <tr class=\"setup\">
00491 <td width=\"50%\" class=\"setup\">
00492 <div align=\"center\">
00493 <input type=\"submit\" name=\"upload_avatar\" value=\"" . i18n("Upload the picture") . "\" />
00494 </div>
00495 </td>
00496 <td width=\"50%\" class=\"setup\">
00497 <div align=\"center\">
00498 <input type=\"submit\" name=\"avatardelete\" value=\"" . i18n("Delete the picture") . "\" />
00499 </div>
00500 </td>
00501 </tr>
00502 </table>";
00503
00504 $container->contents = parse_page_data( i18n("This is the picture which will be put on your convention badge. You can upload any image here that you wish, but please remember - this is your identification at the convention, so make sure it's sane and something you want to be associated with.") . "\n---" ) . $container->contents;
00505
00506 break;
00507 default:
00508 $container->tabbar->setCurrent(i18n("Details"));
00509 $totalPayable = (float)$this->parentConvention->membershipTypes[$this->membershipType]->price;
00510 if( is_array( $this->optionalChoices ) )
00511 foreach( $this->optionalChoices as $key => $value )
00512 foreach( $this->parentConvention->optionalChoices as $key2 => $value2 )
00513 if( $value == $value2->id )
00514 (float)$totalPayable += $value2->price;
00515
00516 $remainingPayable = $totalPayable - $this->paidAmount;
00517
00518 $panel = new OptionsPanel( "member", true );
00519 $panel->showHeader = false;
00520 $panel->saveTitle = i18n("Save");
00521
00522 $panel->addHeader( i18n("Payment information"), "payment" );
00523 $panel->addOption( i18n("Total payable amount"), "", $totalPayable, "totalPayable", "label" );
00524 if( $admin )
00525 $panel->addOption( i18n("Already paid"), "", $this->paidAmount, "paidAmount", "text" );
00526 else
00527 $panel->addOption( i18n("Already paid"), "", $this->paidAmount, "paidAmount", "label" );
00528 $panel->addOption( i18n("Remaining amount"), "", $remainingPayable, "remainingPayable", "label" );
00529
00530 $panel->addHeader( i18n("User details"), "userdetails" );
00531 $spareIDs = $this->parentConvention->getSpareIDs();
00532 $spareIDs[$this->id] = $this->id;
00533 asort($spareIDs);
00534 if( $admin && count($spareIDs) > 1 )
00535 $panel->addOption( i18n("User ID"), "", $this->id, "id", "select", $spareIDs );
00536 else
00537 $panel->addOption( i18n("User ID"), "", $this->id, "id", "label" );
00538 $panel->addOption( i18n("Username"), "", $this->username, "username", "label" );
00539
00540 $panel->addHeader( i18n("Personal details"), "details" );
00541 $panel->addOption( i18n("Nickname"), i18n("The name you wish to go by at the convention."), getUserInfo( $this->username, "name" ), "nick", "text" );
00542 $panel->addOption( i18n("Name"), i18n("Your legal name, required for identification reasons. Use the name written in your passport."), $this->realname, "realname", "text" );
00543 $panel->addOption( i18n("Date of birth"), i18n("Your legal date of birth, required for identification reasons. Use the date of birth written in your passport."), $this->dateOfBirth, "dateOfBirth", "date" );
00544 $panel->addOption( i18n("Gender"), i18n("Your legal gender, required for identification reasons. Use the gender written in your passport."), $this->gender, "gender", "select", array( "m" => i18n("Male"), "f" => i18n("Female") ) );
00545 if( $this->parentConvention->requestTShirtSize )
00546 $panel->addOption( i18n("T-Shirt size"), i18n("What size T-Shirt would fit you? (We need this information to see approximately how many T-Shirts to get)"), $this->tShirtSize, "tShirtSize", "select", array( "xs" => "Extra small", "s" => "Small", "m" => "Medium", "l" => "Large", "xl" => "Extra large", "xxl" => "Extra extra large", "xxxl" => "Tripple-extra large" ) );
00547
00548 $panel->addHeader( i18n("Address"), "address" );
00549 $panel->addOption( i18n("Street address"), "", $this->addressStreet, "addressStreet", "text" );
00550 $panel->addOption( i18n("Address line 2 (optional)"), "", $this->addressStreet2, "addressStreet2", "text" );
00551 $panel->addOption( i18n("City"), "", $this->addressCity, "addressCity", "text" );
00552 $panel->addOption( i18n("Postal code/ ZIP"), "", $this->addressZip, "addressZip", "text" );
00553 $panel->addOption( i18n("County/ State (optional)"), "", $this->addressState, "addressState", "text" );
00554 $panel->addOption( i18n("Country"), "", $this->addressCountry, "addressCountry", "select", getCountryArray() );
00555 $panel->addOption( i18n("Phone number"), "", $this->addressPhone, "addressPhone", "text" );
00556 $panel->addOption( i18n("Email address"), i18n("What is your email address - required for sending out information regarding the convention, and will require confirmation before we can accept your registration!"), getUserInfo( $this->username, "email" ), "email", "text" );
00557
00558
00559 $panel->addHeader( i18n("Membership type"), "membershiptype" );
00560 foreach( $this->parentConvention->membershipTypes as $key => $value )
00561 if( $value->isAvailable() || $value->id == $this->membershipType )
00562 $membershipTypes[$value->id] = array("title" => $value->title . " (" . $conventionSettings->currency . $value->price . ")", "description" => $value->description, "adminOnly" => $value->adminOnly );
00563 if( !$membershipTypes[$this->membershipType]["adminOnly"] || isAllowed( "global_admin" ) )
00564 $panel->addOption( i18n("Membership type"), i18n("What type of membership do you want for this convention?"), $this->membershipType, "membershipType", "radio", $membershipTypes);
00565
00566
00567 $freeOptions = array();
00568 $payOptions = array();
00569 foreach( $this->parentConvention->optionalChoices as $key => $value )
00570 {
00571
00572 if( $value->isAvailable() || in_array( $value->id, $this->optionalChoices ) )
00573 {
00574 if( $value->price == 0 || $value->price == "" )
00575 $freeOptions[$key] = $value;
00576 else
00577 $payOptions[$key] = $value;
00578 }
00579 }
00580
00581 if( count( $payOptions ) > 0 )
00582 {
00583 $panel->addHeader( i18n("Optional choices - non-free"), "optionalchoicespay" );
00584 foreach( $payOptions as $key => $value )
00585 {
00586 $chosen = 0;
00587 if( is_array( $this->optionalChoices ) )
00588 $chosen = in_array($value->id, $this->optionalChoices) ? 1 : 0;
00589
00590 if( $value->adminOnly && !isAllowed("global_admin") && $chosen == 1 )
00591 {
00592 $chosen = i18n("You have been assigned this optional choice");
00593 $panel->addOption( $value->title . " (" . $conventionSettings->currency . $value->price . ")", $value->description, $chosen, "optionalchoices(" . $value->id . ")", "label" );
00594 }
00595 else
00596 $panel->addOption( $value->title . " (" . $conventionSettings->currency . $value->price . ")", $value->description, $chosen, "optionalchoices(" . $value->id . ")", "checkbox" );
00597 }
00598 }
00599 if( count( $freeOptions ) > 0 )
00600 {
00601 $panel->addHeader( i18n("Optional choices - free"), "optionalchoicesfree" );
00602 foreach( $freeOptions as $key => $value )
00603 {
00604 $chosen = 0;
00605 if( is_array( $this->optionalChoices ) )
00606 $chosen = in_array($value->id, $this->optionalChoices) ? 1 : 0;
00607
00608 if( $value->adminOnly && !isAllowed("global_admin") && $chosen == 1 )
00609 {
00610 $chosen = i18n("You have been assigned this optional choice");
00611 $panel->addOption( $value->title, $value->description, $chosen, "optionalchoices(" . $value->id . ")", "label" );
00612 }
00613 else
00614 $panel->addOption( $value->title, $value->description, $chosen, "optionalchoices(" . $value->id . ")", "checkbox" );
00615 }
00616 }
00617
00618 if( $panel->submitted )
00619 {
00620 if( $this->parentConvention->requestTShirtSize )
00621 $this->tShirtSize = $panel->options["tShirtSize"]["current"];
00622 $this->addressCity = $panel->options["addressCity"]["current"];
00623 $this->addressCountry = $panel->options["addressCountry"]["current"];
00624 $this->addressPhone = $panel->options["addressPhone"]["current"];
00625 $this->addressState = $panel->options["addressState"]["current"];
00626 $this->addressStreet = $panel->options["addressStreet"]["current"];
00627 $this->addressStreet2 = $panel->options["addressStreet2"]["current"];
00628 $this->addressZip = $panel->options["addressZip"]["current"];
00629 $this->realname = $panel->options["realname"]["current"];
00630 $this->dateOfBirth = $panel->options["dateOfBirth"]["current"];
00631
00632 $this->membershipType = $panel->options["membershipType"]["current"];
00633 $this->optionalChoices = array();
00634 foreach( $panel->options as $key => $value )
00635 if( substr( $value["name"], 0, 15 ) == "optionalchoices" && $value["current"] == 1 )
00636 $this->optionalChoices[] = extractBetweenDelimeters( $value["name"], "(", ")" );
00637
00638 saveUserInfo( $this->username, "name", $panel->getValue("nick") );
00639 if( getUserInfo( $this->username, "email" ) != $panel->options["email"]["current"] )
00640 {
00641 saveUserInfo( $this->username, "email", $panel->options["email"]["current"] );
00642 $this->newConfirmationCode();
00643 }
00644
00645 if( $admin )
00646 $this->paidAmount = $panel->options["paidAmount"]["current"];
00647
00648 if( $admin && $this->id != $panel->options["id"]["current"] )
00649 {
00650 $this->parentConvention->lock();
00651 unlink( $this->parentConvention->conventionBasedir . "/members/" . $this->id . ".php" );
00652 $this->id = $panel->options["id"]["current"];
00653 $this->parentConvention->save();
00654 $this->save();
00655 $this->parentConvention->unlock();
00656 header( "Location: " . globalIDtoURL( $theGlobalID . $this->id ) );
00657 }
00658 else
00659 {
00660 $this->save();
00661 header( "Location: " . thisPageURL() );
00662 }
00663 }
00664 $container->contents = $panel->render();
00665 }
00666
00667 return "<form enctype=\"multipart/form-data\" action=\"" . thisPageURL() . "\" method=\"post\">" . renderInformationBox( i18n("Edit your details"), i18n( "##0##You have successfully registered for ##2##. You can use the form below to track your payment status, as well as make any changes to your registration information you might need to do.##1##", array( "<p>", "</p>", $this->parentConvention->title ) ) . $container->renderTabwidget(), false ) . "</form>";
00668 }
00669
00670 function render()
00671 {
00672 if( isAllowed( "global_admin" ) )
00673 $renderedContent = $this->renderEditor(true);
00674 else if( currentUser() == $this->username )
00675 $renderedContent = $this->renderEditor();
00676 else
00677 $renderedContent = renderInformationBox( i18n("WRAUNG!"), i18n("You do NOT have the rights to get here - how did you manage that?!") );
00678
00679 return $renderedContent;
00680 }
00681
00682 }
00683 ?>