.
*/
define("MAX_UPLOAD_SIZE", 512000); // In bytes
$columns = array();
$columns[''] = "-- please select --";
$columns['GivenName'] = "Given name";
$columns['Surname'] = "Surname (family name)";
#$columns['CSN'] = "CSN";
#$columns['DateBirth'] = "Date of birth";
#$columns['MemberSince'] = "Member since";
$columns['Fee'] = "Membership fee per year";
$columns['Other'] = "Other";
if( !isset($_SESSION['sess_uid']) && !isset($_SESSION['body_BodyCode']) ) {
include("../include/header.php");
echo " You cannot call this file directly.";
include("../include/footer.php");
exit;
}
if( !isset($setup['SetupEventType']) ) {
exit();
}
if( !is_before("EventDatePartTypeFix") && $_SESSION['sess_uid']==0 ) {
// Deadline passed, no access
echoln("It is after the deadline, you cannot upload the list of members for your body any more.");
echoln("
As the selection of participants already started, which is based upon the number of members your local has, you cannot change this number any more. Also, keep in mind ");
echoln("that this is the number of members you'll have to pay for at the Agora, and which is used to assign the amount of votes.");
echoln("
Failed processing line ".$line.". \"".$data[ $usedCols[ $usedColsKeys[$i] ] ]."\" is not a valid number, falling back to 0.
");
}
$insertQuery .= ", ".mysql_real_escape_string($value);
}else {
// This is text
$insertQuery .= ", '".mysql_real_escape_string($data[ $usedCols[ $usedColsKeys[$i] ] ])."'";
}
}
$insertQuery .= "), ";
}else {
echoln("Failed processing line ".$line.". At least one column is empty for this row.
");
}
}else {
echoln("Failed processing line ".$line.". Is it possible this line contains no data?
");
}
}
fclose($fp);
$insertQuery = substr($insertQuery, 0, -2).";";
$deleteQuery = "DELETE FROM `memberlist` WHERE `BodyCode`='".$_SESSION['body_BodyCode']."'";
$updateBodyQuery = "UPDATE `ab_bodies` SET `MemberClaimed`=".$memberCount.", `MemberClaimedBy`='".mysql_real_escape_string(isset($_SESSION['sess_name'])?$_SESSION['sess_name']:"Memberlist upload")."', `MemberLastUpdate`='" . date("Y-m-d H:i:s") . "', `MemberFeeCurrencyId`=".mysql_real_escape_string($_POST['MemberFeeCurrencyId'])." WHERE `BodyCode`='".$_SESSION['body_BodyCode']."'";
$updateOnCurrentMemberlistQuery = "UPDATE `persons` SET `MemberlistOnCurrent`='-' WHERE `BodyCode`='".$_SESSION['body_BodyCode']."'";
if(doquery($deleteQuery) && doquery($insertQuery) && doquery($updateBodyQuery) && doquery($updateOnCurrentMemberlistQuery) ) {
$step = 3;
}else {
echoln("Failed to process file. Please contact the webmaster for help.");
}
}else {
echoln("Failed opening uploaded file for processing. Please try again. If that does not help, contact the webmaster.
");
}
}
}
switch($step) {
case 1:
// Step 1: upload members list
unset($_SESSION['body_MemList']);
echoln("Step 1: upload members list
");
echoln("Instructions
");
echoln("Specifications for the members' list
");
echoln("");
echoln(" - File type: .csv
");
echoln(" - Encoding: UTF-8 or ISO-8859-1 or ASCII
");
echoln(" - Header row: optional
");
echoln(" - Delimiter: , or ;
");
echoln(" - Required fields: given name, surname and membership fee (annual fee, currency can be selected from a list)
");
echoln(" - Optional fields: -
");
echoln("
");
echoln("Instructions on how to export a members' list
");
echoln("In case you have your data stored in a database, please extract a file according to the specifications above. ");
echoln("In case you have them stored in an excel, open office or any other file type, you case easily export them by using the 'save as' function. ");
echoln("Before saving a file as .csv (comma separated values), please making sure that you have:
");
echoln("");
echoln(" - Removed all columns apart from three: given name, surname and annual membership fee (you can select the currency in the next step). Keep in mind that given name and surname have to be in a separate column, otherwise you will not be able to upload the file.;
");
echoln(" - Removed all empty rows on top of the file, leaving the first cell of the first row named as given name, under which all given names are placed, the second cell as surname, under which all surnames (family name) are placed, and the third row as membership fee, under the annual fee. (NB: the order is not important, you can select which data is in which column at upload time);
");
echoln(" - Removed all empty rows between rows with data (the first empty row should be after the data of the last member).
");
echoln("
");
echoln("You can now proceed to save the file as .csv (comma separated values). ");
echoln("
Now, let's cross-check that everything is fine! Open the file with a text editor (in windows, right click, open with, notepad)
");
echoln("");
echoln(" - Is there anything vertically before the given names? If yes, you did something wrong! Remove it!
");
echoln(" - Are given names, surnames and the membership fee separated by , or ; ? If no, you did something wrong! Use the replace function to change it to either of the two!
");
echoln(" - What is there in the file after membership fees? Nothing or ; is fine! If not, you did something wrong! Use the replace function to change it to either of the two!
");
echoln("
");
echoln("You can now proceed to upload the file!");
echoln("Upload members list
");
echoln("");
break;
case 2:
// Step 2: assign columns of uploaded file to the default columns
echoln("Step 2: choose the columns your file contained
");
echoln("Instructions
");
echoln("Below you can see a preview of your file (first 5 lines). ");
echoln("If you followed the previous instructions, you should only have three columns.");
echoln("You need to assign to them the correct type (given name, surname or membership fee). ");
echoln("For any other column that appears there (if any) select 'other'.");
echoln("
You'll have to select the currency of the fee from the dropdown. Note that in your exported file, only numbers should be stored (nu currencies).");
echoln("
Then, if your first row is 'given name' & 'surname', then click continue. ");
echoln("In case your first row includes data of members, meaning that there is no header row (titles of columns) you have to uncheck the checkbox. After unchecking, click on continue.
");
echoln("In case there is an error, follow the instructions given from the website to correct the problem. ");
echoln("You either selected something wrong in the previous step, or your file is not properly prepared!
");
echoln("When you succeed, you will see the following message: \"Successfully uploaded members list.\"
");
echoln("Choose the columns your file contained
");
if( ($fp = fopen($_SESSION['body_MemList'], "r")) !== FALSE ) {
$r = 0;
$cols = 0;
$data = array();
while( ($data[$r] = fgetcsv($fp, 4096, $_SESSION['body_MemListDelimiter'], $_SESSION['body_MemListEnclosure'])) !== FALSE ) {
$cols = max($cols, count($data[$r]));
$r++;
if( $r>=5 ) break;
}
fclose($fp);
$_SESSION['body_MemListCols'] = $cols;
echoln("");
}else {
echoln("Failed opening uploaded file for processing. Please try again. If that does not help, contact the webmaster.
");
}
break;
case 3:
// Step 3: confirmation
echoln("Step 3: confirmation
");
echoln("Successfully uploaded members list.");
echoln("The members list was successfully uploaded and processed. According to this members list, you have ".$memberCount." members. In case this is not correct, correct ");
echoln("your members list and upload it again. If this does not have the intended result, please contact the webmaster and clearly describe what is the problem.
");
echoln("Please check that the number of members mentioned is the correct. ");
echoln("The Financial Director will use this number to calculate your membership fees. ");
echoln("The Juridical Commission will use this number in order to allocate votes to your local. ");
echoln("The Network Director will use this number in your antenna criteria status.
");
if( !isset($_SESSION['sess_uid']) || $_SESSION['sess_uid']<1 ) {
echoln("If the number was not the correct one, you did something wrong with the creation of the file. ");
echoln("Have a look at it and click on edit to upload the corrected version.
");
echoln("When the number is the correct one, check the members list. ");
echoln("Here, please check that names are appearing properly (use a couple of rows as sample and check that all non-latin characters appear properly).
");
echoln("We would like to remind you that according to Article 6 of the Agora Working Format:");
echoln("
2The delegates must be members of the Antenna or Working Group since at least before the preceding Agora. ");
echoln("3This does not apply to the Antennae or Working Groups that were created after the preceding Agora.
");
echoln("This means that if a person's name is not present in the members' list that you are currently submitting, or if a person's name is not present in the members' list that you have submitted at the previous Agora, then, this person cannot be a delegate at the current Agora!
");
echoln("Back to main screen
");
}
break;
}
}
?>