2018-12-04 13:48:40 -07:00
< ? 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' ];
2018-12-04 19:07:19 -07:00
$family = ( new Family ()) -> load ( $famid );
2018-12-04 13:48:40 -07:00
?>
< 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 >
2018-12-04 19:07:19 -07:00
< ? php echo $family -> getName (); ?> <?php $Strings->get("Family"); ?>
2018-12-04 13:48:40 -07:00
</ h3 >
< div >
< ? php
if ( $writeaccess ) {
?>
2018-12-04 19:07:19 -07:00
< 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>
2018-12-04 13:48:40 -07:00
< ? php
}
?>
</ div >
</ div >
2018-12-17 20:02:51 -07:00
< ? 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
}
?>
2018-12-04 13:48:40 -07:00
< div class = " d-flex justify-content-around flex-wrap " >
< ? php
$newsletter = " Email " ;
2018-12-04 19:07:19 -07:00
switch ( $family -> getNewsletter ()) {
2018-12-04 13:48:40 -07:00
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 = [
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getFather (),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-male " ,
" label " => " Father "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getMother (),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-female " ,
" label " => " Mother "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getPhone (),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-phone " ,
" label " => " Phone "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getEmail (),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-at " ,
" label " => " Email "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getAddress (),
" icon " => " fas fa-home " ,
2018-12-04 13:48:40 -07:00
" label " => " Address "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getCity (),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-city " ,
" label " => " City "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getState (),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-flag " ,
" label " => " State "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getZip (),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-mail-bulk " ,
" label " => " ZIP Code "
],
[
2018-12-04 19:07:19 -07:00
" value " => $family -> getPhotoPermission () ? $Strings -> get ( " Yes " , false ) : $Strings -> get ( " No " , false ),
2018-12-04 13:48:40 -07:00
" icon " => " fas fa-camera " ,
" label " => " Photo Permission "
],
[
" value " => $newsletter ,
" icon " => " fas fa-newspaper " ,
" label " => " Newsletter "
],
2018-12-11 20:56:28 -07:00
[
" value " => date ( " M j Y " , $family -> getExpires ()),
" icon " => " fas fa-calendar " ,
" label " => " Expires "
],
2018-12-04 13:48:40 -07:00
];
foreach ( $items as $i ) {
2023-03-13 20:06:18 -06:00
if ( empty ( $i [ 'value' ])) {
continue ;
}
2018-12-04 13:48:40 -07:00
?>
< div class = " list-group-item h5 mb-2 " >
< i class = " <?php echo $i['icon'] ; ?> " ></ i > < ? php
$Strings -> get ( $i [ 'label' ]);
echo " : " ;
2018-12-04 19:07:19 -07:00
echo $i [ 'value' ];
2018-12-04 13:48:40 -07:00
?>
</ 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
2018-12-04 19:07:19 -07:00
foreach ( $family -> getChildren () as $c ) {
2018-12-04 13:48:40 -07:00
?>
< tr >
2018-12-04 19:07:19 -07:00
< 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>
2018-12-04 13:48:40 -07:00
</ tr >
< ? php
}
?>
</ tbody >
</ table >
</ div >
2018-12-08 11:17:22 -07:00
< 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
}
?>
2018-12-04 13:48:40 -07:00
</ div >
</ div >