PHP Classes

File: showpers.php

Recommend this page to a friend!
  Classes of Pierre FAUQUE   Genealogy Classes   showpers.php   Download  
File: showpers.php
Role: Application script
Content type: text/plain
Description: Show a person
Class: Genealogy Classes
Manage genealogy trees for a family
Author: By
Last change:
Date: 12 years ago
Size: 5,463 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: showpers.php (v0.2 27-oct-2010)
    --------------------------------------------------------------------------------
*/

require("init.php");
require(
"class.personne.php");

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

//---------------------------------------------------
// Order of parameters:
// 1) id of the person
// 2) link of connection to the database
// 3) type of link (1: show card 2: show sheet) (default is 1)
// 4) with or without (1,0) identifier (default is 0)
$pers = new personne($id,$connexion);
$infosupp = 0; $mail = ''; $tel = '';
$hr = "<hr width='400' align='left' size='1' noshade>";
//---------------------------------------------------

?><html>

<head>

<title><?php echo $pers->pers; ?></title>

<link rel="stylesheet" href="genscr.css" type="text/css" media="screen">
<link rel="stylesheet" href="genprt.css" type="text/css" media="print">

<script language="javascript" type="text/javascript">
<?php
if(!$phone) { ?>
function goto() {
    pers = document.choix.idpers.options[document.choix.idpers.options.selectedIndex].value;
    window.location="showpers.php?id="+pers;
}
<?php } ?>
function popup(id) {
   var id;
   L = 800; H = 600; url = "msg_infos.php?id="+id;
   options = "width="+L+",height="+H+",toolbar=no,status=no,menubar=no,resizable=no,scrollbars=yes";
   msgwin = open(url,"info",options);
}
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";
   helpwin = open(url,"help",options);
}
</script>

</head>

<body>
<?php
echo "<h1>".$pers->pers."</h1>";

echo
"<div class='bd'>";
echo
TXT_BTH." ".$pers->bdate;
if(
$pers->bplac) { echo " ".$pers->bplac.$pers->bsour; }
echo
"<br/>";

echo
TXT_DTH." ".$pers->ddate;
if(
$pers->dplac) { echo " ".$pers->dplac.$pers->dsour; }
echo
"<br/></div>";

echo
"<div style=\"margin-top:8px; margin-bottom:8px\">";
echo
TXT_FTH.": ".$pers->father."<br/>";
echo
TXT_MTH.": ".$pers->mother."<br/>";
echo
"</div>";

$nbsp=count($pers->spouses); // $nbsp = nb of spouse

for($i=0; $i<$nbsp; $i++) { // For each spouse

    // $nbc is the number of children with this spouse, found in the database
    // $pers->spouses[$i][11] is the number of known children with this spouse
   
$bed = $pers->children[$i]; $nbc = count($bed);

    echo
"<div style=\"margin-top:8px; margin-bottom:8px\">";

    echo
TXT_SPS.": ".$pers->spouses[$i][1]."<br/>";

    echo
"<div class=\"enfant\">"; $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(
$pers->spouses[$i][12]) { $stmar .= " ".$pers->spouses[$i][12]; }
    if(
$stmar) { echo "$stmar<br/>"; }

    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/>"; }

    if (
$pers->spouses[$i][11] != '') {
        if(
$pers->spouses[$i][11]==0) { echo $pers->fname." ".TXT_AND." ".$pers->spouses[$i][10]." ".TXT_HH0."<br/>"; }
        if(
$pers->spouses[$i][11]==1) { echo $pers->fname." ".TXT_AND." ".$pers->spouses[$i][10]." ".TXT_HHD." ".$pers->spouses[$i][11]." ".TXT_CH1."<br/>"; }
        if(
$pers->spouses[$i][11]>1) { echo $pers->fname." ".TXT_AND." ".$pers->spouses[$i][10]." ".TXT_HHD." ".$pers->spouses[$i][11]." ".TXT_CHS."<br/>"; } }
    else {
        if(
$nbc==0) { echo TXT_WK0." ".TXT_FOR." ".$pers->fname." ".TXT_AND." ".$pers->spouses[$i][10]."<br/>"; }
        if(
$nbc==1) { echo TXT_WK1." ".TXT_CH1." ".TXT_FOR." ".$pers->fname." ".TXT_AND." ".$pers->spouses[$i][10]."<br/>"; }
        if(
$nbc>1) { echo TXT_WKS." $nbc ".TXT_CHS." ".TXT_FOR." ".$pers->fname." ".TXT_AND." ".$pers->spouses[$i][10]."<br/>"; }
    }

    for(
$j=0; $j<$nbc; $j++) { echo $bed[$j][1]."<br/>"; }
    echo
"</div></div>";
}
// Infos (pictures and allowed informations)
$infos = '';
$phones = '';
if(
$pers->pic) { $infos .= $pers->pic.'<br/>'; }
if(
$pers->pdate) { $infos .= "<span style='font-family:arial; font-size:8pt; color:#505050'>Photo $pers->pdate</span><br/>"; }
if(
$pers->mail) { $infos .= "<img src='".ICODIR."/mail.jpg'> <i>".$pers->mail.'</i><br/>'; }
if(
$pers->mphon) { $phones = "<img src='".ICODIR."/mob.jpg'> ".$pers->mphon." &nbsp"; }
if(
$pers->aphon) { $phones .= "<img src='".ICODIR."/tel.jpg'> ".$pers->aphon; }
if(
$phones) { $infos .= $phones.'<br/>'; }
if(
$pers->addr) { $infos .= "<img src='".ICODIR."/addr.jpg'> ".$pers->addr.'<br/>'; }
// Some notes
$nbn = count($pers->notes); // Are there some notes ?
if($nbn) {
   
$infos .= TXT_NOT.":<br/>";
    for(
$n=0; $n<$nbn; $n++) { $infos .= '- '.$pers->notes[$n]."<br/>"; }
}
if(
$infos) { echo "<p>".$hr.$infos.$hr."</p>"; }

echo
"<p class='dates'>".lastMAJ($connexion)."<br/>".TXT_DPR." : ".date("d/m/Y H:i O")."</p>\n\n";

if(
$phone) { buttons(578,$id); } else { buttons(1999,$id); }

// DEBUG
// $pers->showVars();
?>

</body>

</html>