Add person management
parent
5e37ad192b
commit
99d749e644
@ -1,368 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
redirectIfNotLoggedIn();
|
||||
$user = new User($_SESSION['uid']);
|
||||
if (!$user->hasPermission("HACHEPORTAL_EDIT")) {
|
||||
header("Location: ./app.php?msg=no_permission");
|
||||
die();
|
||||
}
|
||||
|
||||
$editing = false;
|
||||
if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']])) {
|
||||
$family = new Family();
|
||||
$family->setExpires(strtotime("+1 year"));
|
||||
} else {
|
||||
$famid = $VARS['id'];
|
||||
$family = (new Family())->load($famid);
|
||||
$editing = true;
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="action.php" method="post" id="editform">
|
||||
|
||||
<div class="card">
|
||||
|
||||
<h3 class="card-header d-flex">
|
||||
<div>
|
||||
<?php
|
||||
if ($editing) {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php $Strings->build("Editing Family", ['family' => "<span id=\"name_title\">" . htmlentities($family->getName()) . "</span>"]); ?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php $Strings->get("Adding Family"); ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<a href="./app.php?page=families" class="ml-auto btn btn-outline-info btn-sm">
|
||||
<i class="fas fa-times"></i> <?php $Strings->get("Cancel"); ?>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<h4><i class="fas fa-info fa-fw"></i> Basic Information</h4>
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
$textboxes = [
|
||||
[
|
||||
"label" => "Family Name (Last Name)",
|
||||
"icon" => "fas fa-users",
|
||||
"name" => "familyname",
|
||||
"maxlength" => 100,
|
||||
"value" => $family->getName(),
|
||||
"error" => "Enter a last name."
|
||||
],
|
||||
[
|
||||
"label" => "Father's Name",
|
||||
"icon" => "fas fa-male",
|
||||
"name" => "fathername",
|
||||
"maxlength" => 255,
|
||||
"value" => $family->getFather(),
|
||||
"error" => "Enter the father's name."
|
||||
],
|
||||
[
|
||||
"label" => "Mother's Name",
|
||||
"icon" => "fas fa-female",
|
||||
"name" => "mothername",
|
||||
"maxlength" => 255,
|
||||
"value" => $family->getMother(),
|
||||
"error" => "Enter the mother's name."
|
||||
],
|
||||
[
|
||||
"label" => "Street Address",
|
||||
"icon" => "fas fa-home",
|
||||
"name" => "streetaddress",
|
||||
"maxlength" => 500,
|
||||
"value" => $family->getAddress(),
|
||||
"error" => "Enter an address."
|
||||
],
|
||||
[
|
||||
"label" => "City",
|
||||
"icon" => "fas fa-city",
|
||||
"name" => "city",
|
||||
"maxlength" => 255,
|
||||
"width" => 3,
|
||||
"value" => $family->getCity(),
|
||||
"error" => "Enter a city."
|
||||
],
|
||||
[
|
||||
"label" => "State",
|
||||
"icon" => "fas fa-flag",
|
||||
"name" => "state",
|
||||
"type" => "select",
|
||||
"value" => $family->getState(),
|
||||
"error" => "Select a state.",
|
||||
"options" => [
|
||||
'MT' => 'Montana',
|
||||
'AL' => 'Alabama',
|
||||
'AK' => 'Alaska',
|
||||
'AZ' => 'Arizona',
|
||||
'AR' => 'Arkansas',
|
||||
'CA' => 'California',
|
||||
'CO' => 'Colorado',
|
||||
'CT' => 'Connecticut',
|
||||
'DE' => 'Delaware',
|
||||
'DC' => 'District of Columbia',
|
||||
'FL' => 'Florida',
|
||||
'GA' => 'Georgia',
|
||||
'HI' => 'Hawaii',
|
||||
'ID' => 'Idaho',
|
||||
'IL' => 'Illinois',
|
||||
'IN' => 'Indiana',
|
||||
'IA' => 'Iowa',
|
||||
'KS' => 'Kansas',
|
||||
'KY' => 'Kentucky',
|
||||
'LA' => 'Louisiana',
|
||||
'ME' => 'Maine',
|
||||
'MD' => 'Maryland',
|
||||
'MA' => 'Massachusetts',
|
||||
'MI' => 'Michigan',
|
||||
'MN' => 'Minnesota',
|
||||
'MS' => 'Mississippi',
|
||||
'MO' => 'Missouri',
|
||||
'MT' => 'Montana',
|
||||
'NE' => 'Nebraska',
|
||||
'NV' => 'Nevada',
|
||||
'NH' => 'New Hampshire',
|
||||
'NJ' => 'New Jersey',
|
||||
'NM' => 'New Mexico',
|
||||
'NY' => 'New York',
|
||||
'NC' => 'North Carolina',
|
||||
'ND' => 'North Dakota',
|
||||
'OH' => 'Ohio',
|
||||
'OK' => 'Oklahoma',
|
||||
'OR' => 'Oregon',
|
||||
'PA' => 'Pennsylvania',
|
||||
'RI' => 'Rhode Island',
|
||||
'SC' => 'South Carolina',
|
||||
'SD' => 'South Dakota',
|
||||
'TN' => 'Tennessee',
|
||||
'TX' => 'Texas',
|
||||
'UT' => 'Utah',
|
||||
'VT' => 'Vermont',
|
||||
'VA' => 'Virginia',
|
||||
'WA' => 'Washington',
|
||||
'WV' => 'West Virginia',
|
||||
'WI' => 'Wisconsin',
|
||||
'WY' => 'Wyoming'
|
||||
],
|
||||
"width" => 2
|
||||
],
|
||||
[
|
||||
"label" => "ZIP/Postal Code",
|
||||
"icon" => "fas fa-mail-bulk",
|
||||
"name" => "zip",
|
||||
"maxlength" => 10,
|
||||
"width" => 3,
|
||||
"value" => $family->getZip(),
|
||||
"error" => "Enter a valid 5 or 9 digit ZIP code.",
|
||||
"pattern" => "[0-9]{5}(-?[0-9]{4})?"
|
||||
],
|
||||
[
|
||||
"label" => "Phone Number",
|
||||
"icon" => "fas fa-phone",
|
||||
"name" => "phone",
|
||||
"width" => 3,
|
||||
"maxlength" => 10,
|
||||
"type" => "tel",
|
||||
"pattern" => "[0-9]{10}",
|
||||
"value" => $family->getPhone(),
|
||||
"error" => "Enter a valid ten-digit phone number."
|
||||
],
|
||||
[
|
||||
"label" => "Email",
|
||||
"icon" => "fas fa-at",
|
||||
"name" => "email",
|
||||
"maxlength" => 255,
|
||||
"type" => "email",
|
||||
"value" => $family->getEmail(),
|
||||
"error" => "Enter an email address."
|
||||
],
|
||||
[
|
||||
"label" => "Newsletter Preference",
|
||||
"icon" => "fas fa-newspaper",
|
||||
"name" => "newsletter_method",
|
||||
"type" => "select",
|
||||
"value" => $family->getNewsletter(),
|
||||
"error" => "Choose an option.",
|
||||
"options" => [
|
||||
"1" => "Email ($25)",
|
||||
"2" => "Paper ($35)",
|
||||
"3" => "Email and Paper ($35)"
|
||||
]
|
||||
],
|
||||
[
|
||||
"label" => "Membership Expiration",
|
||||
"icon" => "fas fa-calendar",
|
||||
"name" => "date",
|
||||
"type" => "date",
|
||||
"width" => 3,
|
||||
"value" => date("Y-m-d", $family->getExpires()),
|
||||
"error" => "Choose a valid date."
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($textboxes as $item) {
|
||||
?>
|
||||
|
||||
<div class="col-12 col-md-<?php echo (empty($item['width']) ? "4" : $item['width']); ?>">
|
||||
<div class="form-group mb-3">
|
||||
<label class="mb-0"><?php echo $item['label']; ?>:</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="<?php echo $item['icon']; ?>"></i></span>
|
||||
</div>
|
||||
<?php if (empty($item['type']) || $item['type'] != "select") { ?>
|
||||
<input type="<?php echo (empty($item['type']) ? "text" : $item['type']); ?>"
|
||||
name="<?php echo $item['name']; ?>"
|
||||
class="form-control"
|
||||
placeholder=""
|
||||
aria-label="<?php echo $item['label']; ?>"
|
||||
maxlength="<?php echo $item['maxlength']; ?>"
|
||||
<?php
|
||||
if (!empty($item['pattern'])) {
|
||||
?>
|
||||
pattern="<?php echo $item['pattern']; ?>"
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if (!empty($item['value'])) {
|
||||
?>
|
||||
value="<?php echo htmlspecialchars($item['value']); ?>"
|
||||
<?php
|
||||
}
|
||||
?>required />
|
||||
<?php } else if ($item['type'] == "select") { ?>
|
||||
<select class="form-control"
|
||||
name="<?php echo $item['name']; ?>"
|
||||
aria-label="<?php echo $item['label']; ?>"
|
||||
required>
|
||||
<?php
|
||||
foreach ($item['options'] as $value => $label) {
|
||||
$selected = "";
|
||||
if (!empty($item['value']) && $value == $item['value']) {
|
||||
$selected = " selected";
|
||||
}
|
||||
echo "<option value=\"$value\"$selected>$label</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="invalid-feedback">
|
||||
<?php echo $item['error']; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
<h4><i class="fas fa-user-graduate fa-fw"></i> Children</h4>
|
||||
<p class="card-text ml-2 mb-1">
|
||||
<i class="fas fa-info-circle"></i> <?php $Strings->get("To remove a child, delete the contents of the Name box."); ?>
|
||||
|
||||
<div class="list-group" id="child_list">
|
||||
<?php
|
||||
if (count($family->getChildren()) > 0) {
|
||||
foreach ($family->getChildren() as $child) {
|
||||
$childid = $child->getID();
|
||||
include __DIR__ . "/../lib/template_child_entry.php";
|
||||
}
|
||||
} else {
|
||||
include __DIR__ . "/../lib/template_child_entry.php";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="btn btn-sm btn-primary mt-1" id="add_child_row">
|
||||
<i class="fas fa-plus"></i> Add another
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
<h4><i class="fas fa-check-circle fa-fw"></i> Consent</h4>
|
||||
<div>
|
||||
<div>
|
||||
<?php $Strings->get("Okay to use photos?"); ?>
|
||||
<br />
|
||||
<span class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="photo_permission" id="photo_permission" value="1" <?php
|
||||
if ($family->getPhotoPermission()) {
|
||||
echo "checked";
|
||||
}
|
||||
?> required>
|
||||
<label class="form-check-label" for="photo_permission">Yes</label>
|
||||
</span>
|
||||
<span class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="photo_permission" id="photo_permission" value="0" <?php
|
||||
if (!$family->getPhotoPermission()) {
|
||||
echo "checked";
|
||||
}
|
||||
?> required>
|
||||
<label class="form-check-label" for="photo_permission">No</label>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<span class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="private" id="private" value="1" <?php
|
||||
if ($family->getPrivate()) {
|
||||
echo "checked";
|
||||
}
|
||||
?>>
|
||||
<label class="form-check-label" for="private"><?php $Strings->get("Member wishes to be remain private (excluded from member directory)"); ?></label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($editing) {
|
||||
?>
|
||||
<input type="hidden" name="familyid" value="<?php echo $family->getID(); ?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="source" value="editfamily" />
|
||||
<input type="hidden" name="action" value="editfamily" />
|
||||
|
||||
<div class="card-footer d-flex">
|
||||
<button type="submit" class="btn btn-success mr-1" id="savebutton">
|
||||
<i class="fas fa-save"></i> <?php $Strings->get("Save"); ?>
|
||||
</button>
|
||||
<?php if ($editing) { ?>
|
||||
<a href="./app.php?page=confirmdelete&id=<?php echo $family->getID(); ?>" class="btn btn-danger ml-auto">
|
||||
<i class="fas fa-times"></i> <?php $Strings->get("Delete"); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
@ -0,0 +1,396 @@
|
||||
<?php
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
redirectIfNotLoggedIn();
|
||||
|
||||
$editing = false;
|
||||
$data = [
|
||||
"id" => null,
|
||||
"camperid" => null,
|
||||
"adultid" => null,
|
||||
"youthid" => null,
|
||||
"firstname" => "",
|
||||
"lastname" => "",
|
||||
"address" => "",
|
||||
"zip" => "",
|
||||
"phone1" => "",
|
||||
"phone2" => "",
|
||||
"email" => "",
|
||||
"unit" => "",
|
||||
"shirt" => "",
|
||||
"sex" => "",
|
||||
"parentname" => "",
|
||||
"rank" => ""
|
||||
];
|
||||
$type = "camper";
|
||||
if (!empty($VARS['type']) && preg_match("/(camper|adult|youth)/", $VARS['type'])) {
|
||||
$type = $VARS['type'];
|
||||
}
|
||||
if (!empty($VARS['id']) && $database->has('people', ['personid' => $VARS['id']])) {
|
||||
$personid = $VARS['id'];
|
||||
$data = $database->get('people', ['personid (id)',
|
||||
'camperid',
|
||||
'adultid',
|
||||
'youthid',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'address',
|
||||
'zip',
|
||||
'phone1',
|
||||
'phone2',
|
||||
'email',
|
||||
'unit',
|
||||
'shirt',
|
||||
'sex'], ['personid' => $personid]);
|
||||
if (!empty($data["camperid"])) {
|
||||
$type = "camper";
|
||||
$data = array_merge($data, $database->get('campers', ['parentname', 'rank'], ['camperid' => $data["camperid"]]));
|
||||
} else if (!empty($data["adultid"])) {
|
||||
$type = "adult";
|
||||
$data = array_merge($data, $database->get('adults', ['days', 'position'], ['adultid' => $data["adultid"]]));
|
||||
} else if (!empty($data["youthid"])) {
|
||||
$type = "youth";
|
||||
$data = array_merge($data, $database->get('youth', ['days', 'position'], ['youthid' => $data["youthid"]]));
|
||||
}
|
||||
$editing = true;
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="action.php" method="post" id="editform">
|
||||
|
||||
<div class="card">
|
||||
|
||||
<h3 class="card-header d-flex">
|
||||
<div>
|
||||
<?php
|
||||
if ($editing) {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php $Strings->build("Editing $type", ['person' => "<span id=\"name_title\">" . htmlentities($data["firstname"] . " " . $data["lastname"]) . "</span>"]); ?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php $Strings->get("Adding $type"); ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<a href="./app.php?page=people" class="ml-auto btn btn-outline-info btn-sm">
|
||||
<i class="fas fa-times"></i> <?php $Strings->get("Cancel"); ?>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
$textboxes = [
|
||||
[
|
||||
"label" => "First Name",
|
||||
"name" => "firstname",
|
||||
"maxlength" => 255,
|
||||
"width" => 6,
|
||||
"value" => $data["firstname"],
|
||||
"error" => "Enter the person's first name."
|
||||
],
|
||||
[
|
||||
"label" => "Last Name",
|
||||
"name" => "lastname",
|
||||
"width" => 6,
|
||||
"maxlength" => 255,
|
||||
"value" => $data["lastname"],
|
||||
"error" => "Enter the person's last name."
|
||||
]
|
||||
];
|
||||
if ($type == "camper") {
|
||||
$textboxes = array_merge($textboxes, [
|
||||
[
|
||||
"label" => "Parent/Guardian Name",
|
||||
"name" => "parentname",
|
||||
"width" => 12,
|
||||
"maxlength" => 255,
|
||||
"value" => $data["parentname"],
|
||||
"error" => "Enter the parent or guardian's full name."
|
||||
]
|
||||
]);
|
||||
}
|
||||
$textboxes = array_merge($textboxes, [
|
||||
[
|
||||
"label" => "Address",
|
||||
"name" => "address",
|
||||
"maxlength" => 500,
|
||||
"width" => 8,
|
||||
"value" => $data["address"],
|
||||
"error" => "Enter the person's home address."
|
||||
],
|
||||
[
|
||||
"label" => "ZIP Code",
|
||||
"name" => "zip",
|
||||
"maxlength" => 10,
|
||||
"width" => 4,
|
||||
"value" => $data["zip"],
|
||||
"pattern" => "[0-9]{5}(-?[0-9]{4})?",
|
||||
"error" => "Enter a valid 5 or 9 digit ZIP code."
|
||||
],
|
||||
[
|
||||
"label" => "Phone Number",
|
||||
"name" => "phone1",
|
||||
"type" => "tel",
|
||||
"maxlength" => 20,
|
||||
"width" => 3,
|
||||
"value" => $data["phone1"],
|
||||
"pattern" => "[0-9]{10}",
|
||||
"error" => "Enter a 10-digit phone number (numbers only)."
|
||||
],
|
||||
[
|
||||
"label" => "Email",
|
||||
"name" => "email",
|
||||
"maxlength" => 255,
|
||||
"width" => 5,
|
||||
"type" => "email",
|
||||
"value" => $data["email"],
|
||||
"error" => "Enter your email address."
|
||||
]
|
||||
]);
|
||||
if ($type == "camper") {
|
||||
$textboxes = array_merge($textboxes, [
|
||||
[
|
||||
"label" => "Pack #",
|
||||
"name" => "unit",
|
||||
"width" => 2,
|
||||
"maxlength" => 4,
|
||||
"pattern" => "[0-9]{3,4}",
|
||||
"value" => $data["unit"],
|
||||
"error" => "Enter the pack number."
|
||||
],
|
||||
[
|
||||
"label" => "Rank",
|
||||
"name" => "rank",
|
||||
"type" => "select",
|
||||
"width" => 2,
|
||||
"value" => $data["rank"],
|
||||
"options" => [
|
||||
"" => "Choose...",
|
||||
"Tiger" => "Tiger",
|
||||
"Wolf" => "Wolf",
|
||||
"Bear" => "Bear",
|
||||
"Webelos" => "Webelos",
|
||||
"Arrow of Light" => "Arrow of Light",
|
||||
],
|
||||
"error" => "Choose a rank."
|
||||
]
|
||||
]);
|
||||
}
|
||||
if ($type == "youth") {
|
||||
$textboxes = array_merge($textboxes, [
|
||||
[
|
||||
"label" => "Parent Name",
|
||||
"name" => "parentname",
|
||||
"width" => 4,
|
||||
"maxlength" => 255,
|
||||
"value" => $data["parentname"],
|
||||
"error" => "Enter the parent or guardian's full name."
|
||||
],
|
||||
[
|
||||
"label" => "Parent Phone",
|
||||
"name" => "phone2",
|
||||
"type" => "tel",
|
||||
"maxlength" => 20,
|
||||
"width" => 3,
|
||||
"value" => $data["phone2"],
|
||||
"pattern" => "[0-9]{10}",
|
||||
"error" => "Enter a 10-digit phone number (numbers only)."
|
||||
]
|
||||
]);
|
||||
}
|
||||
if ($type == "adult" || $type == "youth") {
|
||||
if ($type == "adult") {
|
||||
$positions = [
|
||||
"None" => "No Preference",
|
||||
"Den Walker" => "Den Walker",
|
||||
"Station Leader" => "Station Leader",
|
||||
"Tot Lot" => "Tot Lot",
|
||||
"First Aid" => "First Aid",
|
||||
"Floater" => "Floater"
|
||||
];
|
||||
} else {
|
||||
$positions = [
|
||||
"None" => "No Preference",
|
||||
"Den Chief" => "Den Chief",
|
||||
"Station" => "Station",
|
||||
"Tot Lot" => "Tot Lot",
|
||||
"Floater" => "Floater"
|
||||
];
|
||||
}
|
||||
$textboxes = array_merge($textboxes, [
|
||||
[
|
||||
"label" => "Available Days",
|
||||
"name" => "days",
|
||||
"type" => "checkboxes",
|
||||
"options" => [
|
||||
"Tu" => "Tuesday",
|
||||
"We" => "Wednesday",
|
||||
"Th" => "Thursday",
|
||||
"Fr" => "Friday",
|
||||
],
|
||||
"error" => "Choose at least one day."
|
||||
],
|
||||
[
|
||||
"label" => "Preferred Position",
|
||||
"name" => "position",
|
||||
"type" => "select",
|
||||
"width" => 5,
|
||||
"options" => $positions,
|
||||
"error" => "Choose a position."
|
||||
]
|
||||
]);
|
||||
}
|
||||
$textboxes = array_merge($textboxes, [
|
||||
[
|
||||
"label" => "Shirt Size",
|
||||
"name" => "shirt",
|
||||
"type" => "select",
|
||||
"value" => $data["shirt"],
|
||||
"options" => [
|
||||
"" => "Choose...",
|
||||
"YS" => "Youth Small",
|
||||
"YM" => "Youth Medium",
|
||||
"YL" => "Youth Large",
|
||||
"AS" => "Adult Small",
|
||||
"AM" => "Adult Medium",
|
||||
"AL" => "Adult Large",
|
||||
"AX" => "Adult Extra Large",
|
||||
"A2" => "Adult 2X Large"
|
||||
],
|
||||
"error" => "Choose a shirt size."
|
||||
],
|
||||
[
|
||||
"label" => "Gender",
|
||||
"name" => "sex",
|
||||
"type" => "select",
|
||||
"width" => 3,
|
||||
"value" => $data["sex"],
|
||||
"options" => [
|
||||
"" => "Choose...",
|
||||
"M" => "Male",
|
||||
"F" => "Female"
|
||||
],
|
||||
"error" => "Choose a gender."
|
||||
],
|
||||
]);
|
||||
|
||||
foreach ($textboxes as $item) {
|
||||
?>
|
||||
|
||||
<div class="col-12 col-md-<?php echo (empty($item['width']) ? "4" : $item['width']); ?>">
|
||||
<div class="form-group mb-3">
|
||||
<label class="mb-0"><?php echo $item['label']; ?>:</label>
|
||||
<div class="input-group">
|
||||
<?php if (empty($item['type']) || ($item['type'] != "select" && $item['type'] != "checkboxes")) { ?>
|
||||
<input type="<?php echo (empty($item['type']) ? "text" : $item['type']); ?>"
|
||||
name="<?php echo $item['name']; ?>"
|
||||
data-name="<?php echo $item['name']; ?>"
|
||||
class="form-control"
|
||||
placeholder=""
|
||||
aria-label="<?php echo $item['label']; ?>"
|
||||
maxlength="<?php echo $item['maxlength']; ?>"
|
||||
<?php
|
||||
if (!empty($item['pattern'])) {
|
||||
?>
|
||||
pattern="<?php echo $item['pattern']; ?>"
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if (!empty($item['value'])) {
|
||||
?>
|
||||
value="<?php echo htmlspecialchars($item['value']); ?>"
|
||||
<?php
|
||||
}
|
||||
if (empty($item['optional'])) {
|
||||
echo "required";
|
||||
}
|
||||
?> />
|
||||
<?php } else if ($item['type'] == "select") { ?>
|
||||
<select class="form-control"
|
||||
name="<?php echo $item['name']; ?>"
|
||||
data-name="<?php echo $item['name']; ?>"
|
||||
aria-label="<?php echo $item['label']; ?>"
|
||||
<?php
|
||||
if (empty($item['optional'])) {
|
||||
echo "required";
|
||||
}
|
||||
?>>
|
||||
<?php
|
||||
foreach ($item['options'] as $value => $label) {
|
||||
$selected = "";
|
||||
if (!empty($item['value']) && $value == $item['value']) {
|
||||
$selected = " selected";
|
||||
}
|
||||
echo "<option value=\"$value\"$selected>$label</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
} else if ($item['type'] == "checkboxes") {
|
||||
?>
|
||||
<div class="d-flex justify-content-left flex-wrap">
|
||||
<?php
|
||||
foreach ($item['options'] as $value => $label) {
|
||||
?>
|
||||
<div class="form-check m-1">
|
||||
<input class="form-check-input" type="checkbox" data-name="<?php echo $item['name']; ?>" name="<?php echo $item['name']; ?>[]" value="<?php echo $value; ?>">
|
||||
<label class="form-check-label">
|
||||
<?php echo $label; ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="invalid-feedback">
|
||||
<?php echo $item['error']; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($editing) {
|
||||
?>
|
||||
<input type="hidden" name="personid" value="<?php echo $data['id']; ?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="type" value="<?php echo $type; ?>" />
|
||||
<input type="hidden" name="source" value="editperson" />
|
||||
<input type="hidden" name="action" value="editperson" />
|
||||
|
||||
<div class="card-footer d-flex">
|
||||
<button type="submit" class="btn btn-success mr-1" id="savebutton">
|
||||
<i class="fas fa-save"></i> <?php $Strings->get("Save"); ?>
|
||||
</button>
|
||||
<?php if ($editing) { ?>
|
||||
<a href="./app.php?page=confirmdelete&id=<?php echo $data['id']; ?>" class="btn btn-danger ml-auto">
|
||||
<i class="fas fa-times"></i> <?php $Strings->get("Delete"); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
@ -1,128 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
redirectIfNotLoggedIn();
|
||||
$user = new User($_SESSION['uid']);
|
||||
if (!$user->hasPermission("HACHEPORTAL_VIEW")) {
|
||||
header("Location: ./app.php?msg=no_permission");
|
||||
die();
|
||||
}
|
||||
$editpermission = $user->hasPermission("HACHEPORTAL_EDIT");
|
||||
$editable = ($editpermission && !empty($_GET['edit']));
|
||||
|
||||
$events = $database->select('events', ['eventid (id)', 'event (name)']);
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>
|
||||
<i class="fas fa-sort-amount-up"></i>
|
||||
<?php $Strings->get("Popularity"); ?>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<b><?php $Strings->get("Event"); ?></b>
|
||||
<b><?php $Strings->get("Families"); ?></b>
|
||||
</li>
|
||||
<?php
|
||||
$interests = $database->select("interests", ["[>]events" => ['eventid' => 'eventid']], ['interests.eventid (id)', 'events.event (name)']);
|
||||
$ranking = [];
|
||||
$rankingtitles = [];
|
||||
foreach ($interests as $ev) {
|
||||
if (empty($ranking[$ev['id']])) {
|
||||
$ranking[$ev['id']] = 1;
|
||||
$rankingtitles[$ev['id']] = $ev['name'];
|
||||
} else {
|
||||
$ranking[$ev['id']] ++;
|
||||
}
|
||||
}
|
||||
arsort($ranking);
|
||||
foreach ($ranking as $k => $v) {
|
||||
?>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span><?php echo $rankingtitles[$k]; ?></span>
|
||||
<span><?php echo $v; ?></span>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<?php if ($editable) { ?>
|
||||
<form action="action.php" method="POST">
|
||||
<input type="hidden" name="action" value="editevents" />
|
||||
<input type="hidden" name="source" value="events" />
|
||||
<?php } ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="d-flex justify-content-between">
|
||||
<span>
|
||||
<i class="fas fa-list-ul"></i>
|
||||
<?php $Strings->get("Event List"); ?>
|
||||
</span>
|
||||
<?php if ($editpermission && !$editable) { ?>
|
||||
<span>
|
||||
<a class="btn btn-primary btn-sm" href="./app.php?page=events&edit=1">
|
||||
<i class="fas fa-edit"></i>
|
||||
<?php $Strings->get("Edit"); ?>
|
||||
</a>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</h4>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<?php
|
||||
foreach ($events as $ev) {
|
||||
?>
|
||||
<li class="list-group-item py-0 px-1">
|
||||
<?php
|
||||
if ($editable) {
|
||||
?>
|
||||
<input type="text" class="form-control form-control-sm" name="events[<?php echo $ev['id']; ?>]" value="<?php echo htmlspecialchars($ev['name']); ?>" />
|
||||
<?php
|
||||
} else {
|
||||
echo $ev['name'];
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($editable) {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
?>
|
||||
<li class="list-group-item py-0 px-1">
|
||||
<input type="text" class="form-control form-control-sm" name="events[]" value="" />
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php if ($editable) { ?>
|
||||
<div class="card-footer">
|
||||
<button type="submit" class="btn btn-success"><i class="fas fa-save"></i> <?php $Strings->get("Save"); ?></button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php if ($editable) { ?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
@ -1,224 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
redirectIfNotLoggedIn();
|
||||
$user = new User($_SESSION['uid']);
|
||||
if (!$user->hasPermission("HACHEPORTAL_VIEW")) {
|
||||
header("Location: ./app.php?msg=no_permission");
|
||||
die();
|
||||
}
|
||||
|
||||
$writeaccess = $user->hasPermission("HACHEPORTAL_EDIT");
|
||||
|
||||
if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']])) {
|
||||
header("Location: ./app.php?page=families&msg=family_doesnt_exist");
|
||||
}
|
||||
|
||||
$famid = $VARS['id'];
|
||||
|
||||
$family = (new Family())->load($famid);
|
||||
?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title d-flex flex-wrap justify-content-between">
|
||||
<h3>
|
||||
<a href="app.php?page=families" class="text-body">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
</a>
|
||||
<?php echo $family->getName(); ?> <?php $Strings->get("Family"); ?>
|
||||
</h3>
|
||||
<div>
|
||||
<?php
|
||||
if ($writeaccess) {
|
||||
?>
|
||||
<a href="app.php?page=editfamily&id=<?php echo $family->getID(); ?>&source=viewfamily" class="btn btn-primary"><i class="fas fa-edit"></i> <?php $Strings->get('Edit Family'); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($family->getPrivate()) {
|
||||
?>
|
||||
<div class="alert alert-indigo">
|
||||
<i class="fas fa-users"></i> <i class="fas fa-shield-alt"></i> <i class="fas fa-info-circle"></i> <?php $Strings->get("This family wishes to remain private. Do not share this information, even with other HACHE members."); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="d-flex justify-content-around flex-wrap">
|
||||
<?php
|
||||
$newsletter = "Email";
|
||||
switch ($family->getNewsletter()) {
|
||||
case 1:
|
||||
$newsletter = $Strings->get("Email", false);
|
||||
break;
|
||||
case 2:
|
||||
$newsletter = $Strings->get("Print", false);
|
||||
break;
|
||||
case 3:
|
||||
$newsletter = $Strings->get("Email and Print", false);
|
||||
break;
|
||||
}
|
||||
$items = [
|
||||
[
|
||||
"value" => $family->getFather(),
|
||||
"icon" => "fas fa-male",
|
||||
"label" => "Father"
|
||||
],
|
||||
[
|
||||
"value" => $family->getMother(),
|
||||
"icon" => "fas fa-female",
|
||||
"label" => "Mother"
|
||||
],
|
||||
[
|
||||
"value" => $family->getPhone(),
|
||||
"icon" => "fas fa-phone",
|
||||
"label" => "Phone"
|
||||
],
|
||||
[
|
||||
"value" => $family->getEmail(),
|
||||
"icon" => "fas fa-at",
|
||||
"label" => "Email"
|
||||
],
|
||||
[
|
||||
"value" => $family->getAddress(),
|
||||
"icon" => "fas fa-home",
|
||||
"label" => "Address"
|
||||
],
|
||||
[
|
||||
"value" => $family->getCity(),
|
||||
"icon" => "fas fa-city",
|
||||
"label" => "City"
|
||||
],
|
||||
[
|
||||
"value" => $family->getState(),
|
||||
"icon" => "fas fa-flag",
|
||||
"label" => "State"
|
||||
],
|
||||
[
|
||||
"value" => $family->getZip(),
|
||||
"icon" => "fas fa-mail-bulk",
|
||||
"label" => "ZIP Code"
|
||||
],
|
||||
[
|
||||
"value" => $family->getPhotoPermission() ? $Strings->get("Yes", false) : $Strings->get("No", false),
|
||||
"icon" => "fas fa-camera",
|
||||
"label" => "Photo Permission"
|
||||
],
|
||||
[
|
||||
"value" => $newsletter,
|
||||
"icon" => "fas fa-newspaper",
|
||||
"label" => "Newsletter"
|
||||
],
|
||||
[
|
||||
"value" => date("M j Y", $family->getExpires()),
|
||||
"icon" => "fas fa-calendar",
|
||||
"label" => "Expires"
|
||||
],
|
||||
];
|
||||
foreach ($items as $i) {
|
||||
?>
|
||||
<div class="list-group-item h5 mb-2">
|
||||
<i class="<?php echo $i['icon']; ?>"></i> <?php
|
||||
$Strings->get($i['label']);
|
||||
echo ": ";
|
||||
echo $i['value'];
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<h4 class="mt-4"><?php $Strings->get("Children"); ?></h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><i class="fas fa-user-graduate"></i> <?php $Strings->get("Name"); ?></th>
|
||||
<th><i class="fas fa-birthday-cake"></i> <?php $Strings->get("Born"); ?></th>
|
||||
<th><i class="fas fa-graduation-cap"></i> <?php $Strings->get("Graduated"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($family->getChildren() as $c) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $c->getName(); ?></td>
|
||||
<td><?php echo date("F Y", $c->getBirthday()); ?></td>
|
||||
<td><?php $c->isGraduated() ? $Strings->get("Yes") : $Strings->get("No"); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h4 class="mt-4"><?php $Strings->get("Interests"); ?></h4>
|
||||
<?php
|
||||
$events = $database->select('events', ["[>]interests" => ['eventid' => 'eventid']], ['event (name)'], ['familyid' => $family->getID()]);
|
||||
|
||||
$eventcount = count($events);
|
||||
|
||||
if ($eventcount > 0) {
|
||||
|
||||
$cola = [];
|
||||
$colb = [];
|
||||
|
||||
for ($i = 0; $i < $eventcount; $i++) {
|
||||
if ($i % 2 === 0) {
|
||||
$cola[] = $events[$i];
|
||||
} else {
|
||||
$colb[] = $events[$i];
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
<ul class="list-group">
|
||||
<?php
|
||||
foreach ($cola as $ev) {
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<?php echo $ev['name']; ?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
<ul class="list-group">
|
||||
<?php
|
||||
foreach ($colb as $ev) {
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<?php echo $ev['name']; ?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<i class="fas fa-info-circle"></i> <?php $Strings->get("No interests selected."); ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue