PHP Classes

File: showsheet.php

Recommend this page to a friend!
  Classes of Pierre FAUQUE   Genealogy Classes   showsheet.php   Download  
File: showsheet.php
Role: Application script
Content type: text/plain
Description: Show a family sheet
Class: Genealogy Classes
Manage genealogy trees for a family
Author: By
Last change:
Date: 12 years ago
Size: 9,277 bytes
 

Contents

Class file image Download
<?php
/*
    --------------------------------------------------------------------------------
    Project: Genealogy
    From: 11-sept-2010
    To:
    Version: 0.6 du 06/03/2011
    Author: Pierre FAUQUE, pierre@fauque.net
    Filename: showsheet.php (v0.2 27-oct-2010)
    --------------------------------------------------------------------------------
*/

if($_GET["id"]) { $id = $_GET["id"]; }

require(
"init.php"); // insert script of connection to the database
require("class.personne.php"); // insert class personne
$pers = new personne($id,$connexion,2); // main person for display a sheet (2) and not a card (1 or none)

// original picture is 158 x 200
$imgw = 69; // image width
$imgh = 87; // image height

// Look for parents
if($pers->idf) { $father = new personne($pers->idf,$connexion); }
if(
$pers->idm) { $mother = new personne($pers->idm,$connexion); }

// Look for grand-parents mother side
if($mother->idf) { $gfm = new personne($mother->idf,$connexion); }
if(
$mother->idm) { $gmm = new personne($mother->idm,$connexion); }

// Look for grand-parents father side
if($father->idf) { $gff = new personne($father->idf,$connexion); }
if(
$father->idm) { $gmf = new personne($father->idm,$connexion); }

// ========== Data for main person (full name and picture)

if($pers->picfn) { $ppers = "<br/><img src='".PICDIR.'/'.$pers->picfn."' width='$imgw' height='$imgh' alt='$pers->lname $pers->fname'>"; } else { $ppers = ''; }
$ipers = "<img src='".ICODIR.'/'.$pers->sex.".jpg'> <a href='showsheet.php?id=$pers->idpers'>$pers->pers</a>$ppers";

// ========== Data for parents and grand-parents

// ----- Look for the father
if($father->idpers) {
    if(
$father->picfn) { $pf = "<br/><img src='".PICDIR.'/'.$father->picfn."' width='$imgw' height='$imgh' alt='$father->lname $father->fname'>"; } else { $pf = ''; }
   
$ip = "<img src='".ICODIR.'/'.$father->sex.".jpg'> <a href='showsheet.php?id=$father->idpers'>$father->lname $father->fname</a>$pf";
} else {
$ip = "&nbsp;"; }

// ----- Look for the mother
if($mother->idpers) {
    if(
$mother->picfn) { $pm = "<br/><img src='".PICDIR.'/'.$mother->picfn."' width='$imgw' height='$imgh' alt='$mother->lname $mother->fname'>"; } else { $pm = ''; }
   
$im = "<img src='".ICODIR.'/'.$mother->sex.".jpg'> <a href='showsheet.php?id=$mother->idpers'>$mother->lname $mother->fname</a>$pm";
} else {
$im = "&nbsp;"; }


// ----- Look for the grandfather mother side
if($gfm->idpers) {
    if(
$gfm->picfn) { $pgfm = "<br/><img src='".PICDIR.'/'.$gfm->picfn."' width='$imgw' height='$imgh' alt='$gfm->lname $gfm->fname'>"; } else { $pgfm = ''; }
   
$igfm = "<img src='".ICODIR.'/'.$gfm->sex.".jpg'> <a href='showsheet.php?id=$gfm->idpers'>$gfm->lname $gfm->fname</a>$pgfm";
} else {
$igfm = "&nbsp;"; }

// ----- Look for the grandmother mother side
if($gmm->idpers) {
    if(
$gmm->picfn) { $pgmm = "<br/><img src='".PICDIR.'/'.$gmm->picfn."' width='$imgw' height='$imgh' alt='$gmm->lname $gmm->fname'>"; } else { $pgmm = ''; }
   
$igmm = "<img src='".ICODIR.'/'.$gmm->sex.".jpg'> <a href='showsheet.php?id=$gmm->idpers'>$gmm->lname $gmm->fname</a>$pgmm";
} else {
$igmm = "&nbsp;"; }


// ----- Look for the grandfather father side
if($gff->idpers) {
    if(
$gff->picfn) { $pgff = "<br/><img src='".PICDIR.'/'.$gff->picfn."' width='$imgw' height='$imgh' alt='$gff->lname $gff->fname'>"; } else { $pgff = ''; }
   
$igff = "<img src='".ICODIR.'/'.$gff->sex.".jpg'> <a href='showsheet.php?id=$gff->idpers'>$gff->lname $gff->fname</a>$pgff";
} else {
$igff = "&nbsp;"; }

// ----- Look for the grandmother father side
if($gmf->idpers) {
    if(
$gmf->picfn) { $pgmf = "<br/><img src='".PICDIR.'/'.$gmf->picfn."' width='$imgw' height='$imgh' alt='$gmf->lname $gmf->fname'>"; } else { $pgmf = ''; }
   
$igmf = "<img src='".ICODIR.'/'.$gmf->sex.".jpg'> <a href='showsheet.php?id=$gmf->idpers'>$gmf->lname $gmf->fname</a>$pgmf";
} else {
$igmf = "&nbsp;"; }

?><html>
<head>

<title><?php echo TIT_SHT; ?></title>

<style type="text/css" media="screen">
h1 {
    font-family:times new roman;
    font-size:18pt;
    font-weight:bold;
    font-style:italic;
    color:#000080;
    text-decoration:underline;
}
a {
    text-decoration:none;
}
a:hover {
    font-weight:bold;
    color:red;
}
td {
    font-family:arial;
    font-size:10pt;
    padding-left:5px;
    padding-right:5px;
    text-align:center;
}
img {
    margin-top:5px;
}
.gparents {
    border:solid 1px black;
    width:200px;
    height:120px;
    background-color:#FFFFFF;
}
.parents {
    border:solid 1px black;
    width:250px;
    height:120px;
    background-color:#FFFFFF;
}
.person {
    border:solid 1px blue;
    width:350px;
    height:120px;
    background-color:#FFFFFF;
}
.indiv {
    font-family:times new roman;
    font-size:12pt;
    font-style:italic;
}
.children {
    /* border:solid 1px black; */
    width:800px;
    height:120px;
}
.btnuser {
<?php
switch($pers->sex) {
    case
'm':
        echo
"\tbackground-color:#4040FF;\n";
        echo
"\tcolor:#FFFFFF;\n";
        break;
    case
'f':
        echo
"\tbackground-color:#FFB0B0;\n";;
        echo
"\tcolor:#000000;\n";
        break;
}
?>
}
</style>

<style type="text/css" media="print">
h1 {
    font-family:times new roman;
    font-size:18pt;
    font-weight:bold;
    font-style:italic;
    color:#000080;
    text-decoration:underline;
}
a {
    text-decoration:none;
}
a:hover {
    font-weight:bold;
    color:black;
}
td {
    font-family:arial;
    font-size:10pt;
    padding-left:5px;
    padding-right:5px;
    text-align:center;
}
img {
    margin-top:5px;
}
.gparents {
    border:solid 1px black;
    width:200px;
    height:120px;
    background-color:#FFFFFF;
}
.parents {
    border:solid 1px black;
    width:250px;
    height:120px;
    background-color:#FFFFFF;
}
.person {
    border:solid 1px blue;
    width:350px;
    height:120px;
    background-color:#FFFFFF;
}
.indiv {
    font-family:times new roman;
    font-size:12pt;
    font-style:italic;
}
.children {
    /* border:solid 1px black; */
    width:800px;
    height:120px;
}
.btnuser {
<?php
switch($pers->sex) {
    case
'm':
        echo
"\tbackground-color:#4040FF;\n";
        echo
"\tcolor:#FFFFFF;\n";
        break;
    case
'f':
        echo
"\tbackground-color:#FFB0B0;\n";;
        echo
"\tcolor:#000000;\n";
        break;
}
?>
}
</style>

<script language="javascript" type="text/javascript">
function showHelp() {
   W=500; H=screen.height;
   url="help.php?ww="+W; // width provided as parameter to calculate the position
   options = "width="+W+",height="+H+",toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes";
   newwin = open(url,"help",options);
}
</script>

</head>
<body>

<form>

<?php
echo "<h1>$pers->pers</h1>\n";
echo
"<p class='indiv'>".TXT_BTH." ".$pers->bdate;
if(
$pers->bplac) { echo " ".$pers->bplac; }
echo
"</p>";
?>

<table border='0'>
<!-- line grand-parents -->
<tr>
   <td width='120'><center><div class='gparents'><?php echo $igff; ?></div></center></td>
   <td width='120'><center><div class='gparents'><?php echo $igmf; ?></div></center></td>
   <td width='$imgh'>&nbsp;</td>
   <td width='120'><center><div class='gparents'><?php echo $igfm; ?></div></center></td>
   <td width='120'><center><div class='gparents'><?php echo $igmm; ?></div></center></td>
</tr>
<tr><td colspan='5'>&nbsp;</td></tr>

<!-- line parents -->
<tr>
   <td colspan='2'><center><div class='parents'><?php echo $ip; ?></div></center></td>
   <td width='$imgh'>&nbsp;</td>
   <td colspan='2'><center><div class='parents'><?php echo $im; ?></div></center></td>
</tr>
<tr><td colspan='5'>&nbsp</td></tr>

<!-- line main person -->
<tr>
   <td colspan='5'><center><div class='person'><?php echo $ipers; ?></div></center></td>
</tr>
<tr><td colspan='5'>&nbsp</td></tr>

<?php
$nbsp
=count($pers->spouses); // have the main person one or several spouses ?

if($nbsp) { echo "<tr><td colspan='5'><center>"; } // if yes, division for his family (spouse and children)

for($i=0; $i<$nbsp; $i++) {

   
$bed = $pers->children[$i]; $nbc = count($bed); // nb of children by marriage

   
echo "<div style=\"margin-top:8px; margin-bottom:8px;\">";
    echo
"<u>".TXT_SPS."</u>: ".$pers->spouses[$i][1]."<br/>";
   
$stmar=""; $stsep="";

    if(
$pers->spouses[$i][3]) { $stmar .= $pers->spouses[$i][3]; }
    if(
$pers->spouses[$i][4]) { $stmar .= " ".$pers->spouses[$i][4]; }
    if(
$pers->spouses[$i][5]) { $stmar .= " ".$pers->spouses[$i][5]; }
    if(
$stmar) { echo "$stmar<br/>"; } // marriage if exists

   
if($pers->spouses[$i][7]) { $stsep .= $pers->spouses[$i][7]; }
    if(
$pers->spouses[$i][8]) { $stsep .= " ".$pers->spouses[$i][8]; }
    if(
$pers->spouses[$i][9]) { $stsep .= " ".$pers->spouses[$i][9]; }
    if(
$stsep) { echo "$stsep<br/>"; } // end if marriage if exists

    // list of children for this couple
   
for($j=0; $j<$nbc; $j++) { echo $bed[$j][1]."<br/>"; }

    echo
"</div>";
}
if(
$nbsp) { echo '</center></td></tr>'; } // end of division if exists
?>

<tr><td class='noprint' colspan='5'>
   <center><input type="button" value=" <?php echo TXT_CRD." $pers->lname $pers->fname"; ?>" class="btnuser" onclick="window.location='showpers.php?id=<?php echo $id; ?>';"></center>
</td></tr>

</table>

<?php if($phone) { buttons(546); } else { buttons(815); } ?>

</form>

</body>

</html>