psportal-murray/memberEditor.php

810 lines
32 KiB
PHP
Raw Normal View History

2019-02-18 02:40:33 +00:00
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "formUtils.php";
include_once "sql.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) &&
(returnAdminStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID'])))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* validate form data.
*/
if (isset($_POST['id']))
try
{
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
//$dbh->beginTransaction();
//$sth = $dbh->prepare("SELECT * FROM members WHERE id = ?");
$sth = $dbh->prepare($statement204);
$count = 0;
if ($sth->execute(array($_POST['id'])))
{
if ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (($row['first_name'] === $_POST['first_name']) && ($row['last_name'] === $_POST['last_name']))
{
//print_r($_POST);
if (isset($_POST['Vet_Now']) && ($_POST['Vet_Now'] === "Vet Now"))
{
//print ("Vetting...");
$stb = $dbh->prepare($statement287);
$stb->execute(array($_POST['id'], $_POST['first_name'], $_POST['last_name']));
}
else
{
/*
* All optional variable need to be checked.
*/
if (isset($_POST['current_start']))
$currStart = $_POST['current_start'];
else
if (isset($row['current_start_date']))
$currStart = $row['current_start_date'];
else
$currStart = "";
if (isset($_POST['street_address']))
$streetAddr = $_POST['street_address'];
else
if (isset($row['street_address']))
$streetAddr = $row['street_address'];
else
$streetAddr = "";
if (isset($_POST['guardian']))
$guardian = $_POST['guardian'];
else
$guardian = "";
if (isset($_POST['emergency_contact_name']))
$emergContactName = $_POST['emergency_contact_name'];
else
$emergContactName = "";
if (isset($_POST['emergency_contact_number']))
$emergContactNumber = $_POST['emergency_contact_number'];
else
$emergContactNumber = "";
if (isset($_POST['instructor']))
$instCheck = TRUE;
else
$instCheck = FALSE;
if (isset($_POST['administrator']))
$adminCheck = TRUE;
else
$adminCheck = FALSE;
if (isset($_POST['director']))
$dirCheck = TRUE;
else
$dirCheck = FALSE;
if (isset($_POST['minor']))
$minorCheck = TRUE;
else
$minorCheck = FALSE;
/*
$sth = $dbh->prepare("UPDATE members SET preferred_name = ?, nickname = ?, email = ?, expire_date = ?, " .
"current_start_date = ?, application_date = ?, status = ?, monthly_fees = ?, proto_cash = ?, " .
"minor = ?, birthdate = ?, guardian_name = ?, street_address = ?, city = ?, province = ?, " .
"postal_code = ?, phone = ?, emergency_contact_name = ?, emergency_contact_phone = ?, " .
"new_member_notes = ?, instructor = ?, administrator = ?, director = ? WHERE id = ? AND first_name = ? " .
"AND last_name = ?");
*/
//print ("curr start: " . $currStart);
$sth = $dbh->prepare($statement222);
$sth->execute(array($_POST['prefered_name'], $_POST['nick_name'], $_POST['email'], $_POST['expire'],
$currStart, $_POST['application_date'], $_POST['status'], $_POST['monthly_fees'],
$_POST['proto_cash'], $minorCheck, $_POST['birth_date'], $_POST['guardian'], $streetAddr,
$_POST['city'], $_POST['province'], $_POST['postal_code'], $_POST['phone'], $emergContactName,
$emergContactNumber, $_POST['member_notes'], $instCheck, $adminCheck,
$dirCheck, $row['id'], $row['first_name'], $row['last_name']));
}
}
}
}
}
catch (Exception $e)
{
print ("Fail! " . $e->getMessage() . "\n");
}
}
else
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
/** TODO:
* validate this input
*/
if (isset($_GET['id']))
$edit = $_GET['id'];
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateAdminNavigationBar($doc));
$_SESSION['sub_nav'] = "Admin";*/
$_SESSION['subNav'] = 1;
$body->appendChild(generateSelectedMenuBar($doc, 1));
if (isset($edit))
$body->appendChild(generateMemberEditor($doc, $edit));
$tableDiv = $doc->createElement('div');
//$tableDiv->setAttribute('display', 'block');
$tableDiv->setAttribute('class', 'FloatLeft50Div');
$table = $doc->createElement('table');
//$table.setAttribute('class'
//$table->setAttribute('class', 'FloatLeft50Div');
$thead = $doc->createElement('thead');
$tr = $doc->createElement('tr');
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('ID'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('First Name'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('Last Name'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$th->appendChild($doc->createTextNode('Vetted'));
$tr->appendChild($th);
$th = $doc->createElement('th');
$th->appendChild($doc->createTextNode('Status'));
$tr->appendChild($th);
$thead->appendChild($tr);
$table->appendChild($thead);
$tbody = $doc->createElement('tbody');
$tint = false;
$edit = NULL;
try
{
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
//$sth = $dbh->prepare("SELECT * FROM members"); /* SORT BY first_name;*/
$sth = $dbh->prepare($statement101);
$count = 0;
if ($sth->execute())
{
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (isset($_GET['id']))
if ($row['id'] === $_GET['id'])
$edit = $row;
$count++;
$tr = $doc->createElement('tr');
/*
if ($tint === true)
{
$tr->setAttribute('class', 'AlternateRow');
}*/
/*
try
{
$stg = $dbh->prepare("SELECT name FROM courses WHERE id = ?");
if ($stg->execute(array($row['course_id'])))
{
$innerRow = $stg->fetch(PDO::FETCH_ASSOC);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($innerRow['name']));
$tr->appendChild($td);
}
}
catch (Exception $f)
{
echo "Fail! " . $f->getMessage() . "\n";
}
*/
/*
$tint = !$tint;
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($course['Subject']));
$tr->appendChild($td);*/
$td = $doc->createElement('td');
$rr = $doc->createElement('a');
$rr->setAttribute('href', "memberEditor.php?id=${row['id']}");
$rr->appendChild($doc->createTextNode($row['id']));
$td->appendChild($rr);
$tr->appendChild($td);
/*
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['id']));
$tr->appendChild($td);*/
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['first_name']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['last_name'])); //$row['Confirmed']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['vetted_date'])); //$course['Open']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode(returnMemberStatusByID($row['id']))); //$course['Open']));
$tr->appendChild($td);
/* $rr = $doc->createElement('a');
$rr->setAttribute('href', "admin.php?id=${row['id']}");
$rr->appendChild($tr);*/
$tbody->appendChild($tr);
}
}
$table->appendChild($tbody);
$tableDiv->appendChild($table);
$body->appendChild($tableDiv);
}
catch (Exception $e)
{
echo "Failed!" . $e->getMessage() . "\n";
}
if (!($edit === NULL))
{
$editorDiv = $doc->createElement('div');
$editorDiv->setAttribute('id', 'MemberEditorDiv');
$titleSpan = createSpan($doc);
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode($edit['first_name'] . " " . $edit['middle_name'] . " " . $edit['last_name']));
$picture = returnPictureForMember($edit['id']);
if (!is_null($picture))
{
$img = createImg($doc, $pictureDir . $picture, $edit['first_name'] . " " . $edit['last_name'], "MemberEditorIconPicture");
$label->appendChild($img);
}
$titleSpan->appendChild($label);
$editorDiv->appendChild($titleSpan);
$form = createForm($doc, 'password-reset.php', 'GET');
$input = createHiddenInput($doc, 'id', (string)$edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createSubmitInput($doc, $text0012, $text0012, NULL, NULL);
$form->appendChild($input);
$editorDiv->appendChild($form);
$form = createForm($doc, 'addPicture.php', 'POST');
$input = createHiddenInput($doc, 'target', (string)$edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createSubmitInput($doc, 'Change Picture', 'Change Picture');
$form->appendChild($input);
$editorDiv->appendChild($form);
/*
$form = $doc->createElement('form');
$form->setAttribute('action', 'admin.php');
$form->setAttribute('method', 'post');
*/
$form = createForm($doc, 'admin.php');
$input = createHiddenInput($doc, 'id', $edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createHiddenInput($doc, 'first_name', $edit['first_name'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createHiddenInput($doc, 'last_name', $edit['last_name'], NULL, NULL, TRUE);
$form->appendChild($input);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$label = $doc->createElement('label', 'Prefered Name:');
$label->setAttribute('for', 'prefered_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'prefered_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['prefered_name']))
$input->setAttribute('value', $edit['prefered_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Nick Name:');
$label->setAttribute('for', 'nick_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'nick_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['nick_name']))
$input->setAttribute('value', $edit['nick_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'EMail Address:');
$label->setAttribute('for', 'email');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'email');
$input->setAttribute('name', 'email');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('class', 'MemberEditorInputField');
if (isset($edit['email']))
$input->setAttribute('value', $edit['email']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Expiration Date:');
$label->setAttribute('for', 'expire');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'expire');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['expire_date']))
$input->setAttribute('value', $edit['expire_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Current Start Date:');
$label->setAttribute('for', 'current_start');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'current_start');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['current_start_date']))
$input->setAttribute('value', $edit['current_start_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Application Date:');
$label->setAttribute('for', 'application_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'application_date');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['application_date']))
$input->setAttribute('value', $edit['application_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Vetted Date:');
$label->setAttribute('for', 'vetted');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$now = date_create('now');
$startDate = date_create($edit['current_start_date']); //, $dbDateFormat);
$startDate = date_add($startDate, DateInterval::createFromDateString('4 weeks'));
$expireDate = date_create($edit['expire_date']);
if (isset($edit['vetted_date']))
{
if (is_null($edit['vetted_date']))
{
if (($startDate < $now) && ($now < $expireDate))
{
$input = createSubmitInput($doc, 'Vet Now', 'Vet Now');
$fieldSetDiv->appendChild($input);
}
else
{
$input = createSubmitInput($doc, 'Not Vetable', 'Not Vetable');
$fieldSetDiv->appendChild($input);
}
}
else
{
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'vetted');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['vetted_date']))
$input->setAttribute('value', $edit['vetted_date']);
//$input->setAttribute('required', 'required');
$input->setAttribute('readonly', 'readonly');
}
$fieldSetDiv->appendChild($input);
}
else
{
if (($startDate < $now) && ($now < $expireDate))
{
$input = createSubmitInput($doc, 'Vet Now', 'Vet Now');
$fieldSetDiv->appendChild($input);
}
else
{
$input = createSubmitInput($doc, 'Not Vetable', 'Not Vetable');
$fieldSetDiv->appendChild($input);
}
}
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Status:');
$label->setAttribute('for', 'status');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'status');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['status']))
$input->setAttribute('value', $edit['status']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Monthly Fees:');
$label->setAttribute('for', 'monthly_fees');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'monthly_fees');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('step', '0.01');
$input->setAttribute('pattern', '^\d+(\.|\,)\d{2}$');
if (isset($edit['monthly_fees']))
$input->setAttribute('value', $edit['monthly_fees']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Protospace Cash:');
$label->setAttribute('for', 'proto_cash');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'proto_cash');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['proto_cash']))
$input->setAttribute('value', $edit['proto_cash']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Minor:');
$label->setAttribute('for', 'minor');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'minor');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['minor']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Birth Date:');
$label->setAttribute('for', 'birth_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'birth_date');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['birth_date']))
$input->setAttribute('value', $edit['birth_date']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Guardian:');
$label->setAttribute('for', 'guardian');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'guardian');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['guardian']))
$input->setAttribute('value', $edit['guardian']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Street Address:');
$label->setAttribute('for', 'address');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'address');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['street_address']))
$input->setAttribute('value', $edit['street_address']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'City:');
$label->setAttribute('for', 'city');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'city');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['city']))
$input->setAttribute('value', $edit['city']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Province:');
$label->setAttribute('for', 'province');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'province');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['province']))
$input->setAttribute('value', $edit['province']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Postal Code:');
$label->setAttribute('for', 'postal_code');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'postal_code');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['postal_code']))
$input->setAttribute('value', $edit['postal_code']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Phone:');
$label->setAttribute('for', 'phone');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'phone');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['phone']))
$input->setAttribute('value', $edit['phone']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Name:');
$label->setAttribute('for', 'emergency_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['emergency_contact_name']))
$input->setAttribute('value', $edit['emergency_contact_name']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Number:');
$label->setAttribute('for', 'emergency_number');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_number');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['emergency_contact_number']))
$input->setAttribute('value', $edit['emergency_contact_number']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Instructor:');
$label->setAttribute('for', 'instructor');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'instructor');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnInstructorStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Administrator:');
$label->setAttribute('for', 'administrator');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'administrator');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnAdminStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Director:');
$label->setAttribute('for', 'director');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'director');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnDirectorStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Member Notes:');
$label->setAttribute('for', 'member_notes');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'textarea');
$input->setAttribute('name', 'member_notes');
$input->setAttribute('rows', '3');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['member_notes']))
$input->setAttribute('value', $edit['member_notes']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$fieldSet->appendChild($fieldSetDiv);
$form->appendChild($fieldSet);
$input = $doc->createElement('input');
$input->setAttribute('type', 'reset');
$form->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$editorDiv->appendChild($form);
$body->appendChild($editorDiv);
}
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>