You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
5.7 KiB
PHP
173 lines
5.7 KiB
PHP
<?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 = $database->get("families", [
|
|
'familyid (id)',
|
|
'familyname (name)',
|
|
'phone',
|
|
'email',
|
|
'newsletter_method (newsletter)',
|
|
'address',
|
|
'city',
|
|
'state',
|
|
'zip',
|
|
'father_name (father)',
|
|
'mother_name (mother)',
|
|
'photo_permission (photo)'
|
|
], [
|
|
"familyid" => $famid
|
|
]);
|
|
|
|
$children = $database->select("people", ["name", "birthday", "graduated"], ["familyid" => $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['name']; ?> <?php $Strings->get("Family"); ?>
|
|
</h3>
|
|
<div>
|
|
<?php
|
|
if ($writeaccess) {
|
|
?>
|
|
<a href="app.php?page=editfamily&id=<?php echo $family['id']; ?>&source=viewfamily" class="btn btn-primary"><i class="fas fa-edit"></i> <?php $Strings->get('Edit Family'); ?></a>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-around flex-wrap">
|
|
<?php
|
|
$newsletter = "Email";
|
|
switch ($family['newsletter']) {
|
|
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 = [
|
|
[
|
|
"db" => "father",
|
|
"icon" => "fas fa-male",
|
|
"label" => "Father"
|
|
],
|
|
[
|
|
"db" => "mother",
|
|
"icon" => "fas fa-female",
|
|
"label" => "Mother"
|
|
],
|
|
[
|
|
"db" => "phone",
|
|
"icon" => "fas fa-phone",
|
|
"label" => "Phone"
|
|
],
|
|
[
|
|
"db" => "email",
|
|
"icon" => "fas fa-at",
|
|
"label" => "Email"
|
|
],
|
|
[
|
|
"db" => "address",
|
|
"icon" => "fas fa-map-marker",
|
|
"label" => "Address"
|
|
],
|
|
[
|
|
"db" => "city",
|
|
"icon" => "fas fa-city",
|
|
"label" => "City"
|
|
],
|
|
[
|
|
"db" => "state",
|
|
"icon" => "fas fa-flag",
|
|
"label" => "State"
|
|
],
|
|
[
|
|
"db" => "zip",
|
|
"icon" => "fas fa-mail-bulk",
|
|
"label" => "ZIP Code"
|
|
],
|
|
[
|
|
"value" => $family['photo'] ? $Strings->get("Yes", false) : $Strings->get("No", false),
|
|
"icon" => "fas fa-camera",
|
|
"label" => "Photo Permission"
|
|
],
|
|
[
|
|
"value" => $newsletter,
|
|
"icon" => "fas fa-newspaper",
|
|
"label" => "Newsletter"
|
|
],
|
|
];
|
|
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 ": ";
|
|
if (empty($i['db'])) {
|
|
echo $i['value'];
|
|
} else {
|
|
echo $family[$i['db']];
|
|
}
|
|
?>
|
|
</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 ($children as $c) {
|
|
?>
|
|
<tr>
|
|
<td><?php echo $c['name']; ?></td>
|
|
<td><?php echo date("F Y", strtotime($c['birthday'])); ?></td>
|
|
<td><?php $c['graduated'] == 1 ? $Strings->get("Yes") : $Strings->get("No"); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|