366 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			366 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
<?php
 | 
						|
  $thisPage="nachkommen";
 | 
						|
  include __DIR__ . "./../layout/header.php";
 | 
						|
  include __DIR__ . "./../layout/navigation.php";
 | 
						|
  include __DIR__ . "./../layout/css/navi.css";
 | 
						|
  include __DIR__ . "./../layout/css/box_tafel.css"; ?>
 | 
						|
</head>
 | 
						|
 | 
						|
<body id="Anfang">
 | 
						|
  <?php
 | 
						|
  global $box, $col, $col_1, $top, $delta_l, $delta_h, $h_box_halbe, $delta_sp, $ladezeit, $child_children;
 | 
						|
  // *********** difine boxes: box is 200 wide und 60 hight
 | 
						|
  $b = 0;                         // Rückgabe von display_data (anzahl boxes)
 | 
						|
  $top = 120;                     // Anfangshöhe
 | 
						|
  $botom = 780;
 | 
						|
  $top_max = $top;                // Bestimmt den Anfang des footers
 | 
						|
  $delta_l = 270;                 // Abstand Spalte zu Spalte
 | 
						|
  $delta_sp = 10;                 // space between boxes
 | 
						|
  $h_box_halbe = 30;              // halbe Boxhöhe
 | 
						|
  $h_box = 2 * $h_box_halbe;      // Boxhöhe
 | 
						|
  $delta_h = $h_box + $delta_sp;  // Abstand (Höhe) zur Partnerbox
 | 
						|
  $t_arr = $top + $h_box_halbe;   // arrow left
 | 
						|
  $col_1 = 60;                    // Abstand links zur ersten Spalte
 | 
						|
  $col_2 = $col_1 + (1 * $delta_l);
 | 
						|
  $col_3 = $col_1 + (2 * $delta_l);
 | 
						|
  $col_4 = $col_1 + (3 * $delta_l);
 | 
						|
  $col_5 = $col_1 + (4 * $delta_l);
 | 
						|
 | 
						|
// ***************** functions *************************************************
 | 
						|
  function fill($person, $info) { // fill the box
 | 
						|
    $info = "";
 | 
						|
    if (isset($person->member_id)) {
 | 
						|
      $id = $person->member_id;
 | 
						|
      if ($person->gender == 1){$g = "m";$img ="male.jpg";} else {$g = "f";$img ="female.jpg";}
 | 
						|
      if ($person->member_img != "") { $img = $person->member_img;}
 | 
						|
      $period = periode($person);?>
 | 
						|
      <div class='basic "<?php echo $g?>box"'>   <!--// m- oder fbox -->
 | 
						|
        <table><tbody><tr>
 | 
						|
          <td>
 | 
						|
            <a href='familienblatt?id=<?php echo $id?>'/>
 | 
						|
              <span class="info"><img src="../../photos/<?php echo $img;?>"
 | 
						|
              title='Familienblatt anzeigen' border='0' alt='Foto Person' width='40' height='50' /></span></a></td>
 | 
						|
          <td>
 | 
						|
            <a href='nachkommen?id=<?php echo $person->member_id?>' title='neue Person' <?php
 | 
						|
              echo "<b>".$info."</b>".$person->first_name." ".$person->last_name."</a></b><br>";?>
 | 
						|
              <b><img src="../../img/<?php echo $g.".jpg";?>" /></b> <?php
 | 
						|
              echo periode($person)."  => ".alter($person). "J.";?></td></tr>
 | 
						|
        </table>
 | 
						|
      </div><?php
 | 
						|
    return true;} else { return false;} // member_id vorhanden
 | 
						|
  } ?>
 | 
						|
 | 
						|
  <!--***************** zeichne Box *******************************************
 | 
						|
  $col:         Spalte 1 bis 5
 | 
						|
  $box:         Box-Nr. von oben gezählt
 | 
						|
  $box_before:  Anzahl Boxes vorher
 | 
						|
  $bol_f:       erster Durchlauf? --> <?php
 | 
						|
  function display_box ($data_0, $data_1, $col, $box, $box_before, $bol_f) {
 | 
						|
    global $col, $col_1, $top, $delta_l, $delta_h, $h_box_halbe, $delta_sp, $child_children;
 | 
						|
    $anzahl = $anz_partner = 0;         // returnwert anzahl boxes
 | 
						|
 | 
						|
    $h_box = 2 * $h_box_halbe;          // Boxhöhe = 2*30px
 | 
						|
    $delta_h = $h_box + $delta_sp;      // Abstand zur Partnerbox (10px)
 | 
						|
 | 
						|
    $boxes = $box - $box_before;        // Nr. der Box
 | 
						|
    if ($boxes != 0){$boxes--;}
 | 
						|
    $t_up = $boxes * $delta_h;          // Länge Verbindung zur vorherigen Box
 | 
						|
 | 
						|
    $t = $top + ($box * $delta_h);      // $top = absolute oberste Position
 | 
						|
    $t0 = $t + $h_box_halbe + $delta_h; // Partnerbox von oben (110)
 | 
						|
    $t1 = $t + $h_box;                  // Ende Personenbox unten (beginn Linie zum Partner)
 | 
						|
    $t2 = $t + $h_box_halbe;            // Mitte Box child
 | 
						|
    $t3 = $t - $h_box_halbe - 20;       // Senkrechte zur Box (Bruder/Schwester)
 | 
						|
    $t4 = $t3 - $t_up;                  // Senkrechte zur Box (Bruder/Schwester)
 | 
						|
    $t_p = $t + $delta_h;               // top der Partnerbox (80)
 | 
						|
 | 
						|
    $left  = $col_1 + ($col * $delta_l);  // Anfangsabstand links + 3 Spalten mit je delta_l (230)
 | 
						|
    $left0 = $left - 40;
 | 
						|
    $left1 = $left + 20;                  // senkrechte Linie zum Partner
 | 
						|
    $left2 = $left + 40;                  // Partnerbox von links
 | 
						|
    $left3 = $left - 20;                  // senkrechte Verbindungslinie Kinder
 | 
						|
    $left4 = $left1 + 215;                // Pfeil Kindes-Kind
 | 
						|
 | 
						|
    $verh = "⚭";
 | 
						|
    $gesch = "⚯";
 | 
						|
    $verstorben = "†";
 | 
						|
    $gefallen = "X";
 | 
						|
    $info = "";
 | 
						|
    // erster Durchlauf
 | 
						|
    $bol_first = $bol_f;
 | 
						|
    if (!empty($data_0)) { $bol_d0 = true;} else {$bol_d0 = false;} // data_0 nicht leer
 | 
						|
    if (!empty($data_1)) { $bol_d1 = true;} else {$bol_d1 = false;} // data_1 nicht leer
 | 
						|
    if (!$col==0){$anz_partner = count($data_1);}else {$anz_partner = 1;}
 | 
						|
 | 
						|
    if ($col != 0) {        //linke waagerechte Anknüpfung an Box (nict für Generation 0)?>
 | 
						|
      <div class="line_v" style="top:<?php echo $t2;?>px;left:<?php echo $left3;?>px;"></div><?php
 | 
						|
      if ($bol_first == true){ // Verbindungslinie von waagerechter Anknüpfung nach oben?>
 | 
						|
        <div class="line_h1" style="top:<?php echo $t2;?>px;left:<?php echo $left3;?>px;"></div>
 | 
						|
        <div class="line_v" style="top:<?php echo $t0;?>px;left:<?php echo $left0;?>px;"></div><?php
 | 
						|
      }
 | 
						|
    }
 | 
						|
    if ($bol_first == false) { // Senkrechre zur nächsten Box (Bruder/Schwester)?>
 | 
						|
       <div class="line_h1" style="top:<?php echo $t3+10;?>px;left:<?php echo $left3;?>px;"></div>
 | 
						|
       <div class="line_h" style="top:<?php echo $t4+10;?>px;left:<?php echo $left3;?>px;
 | 
						|
          height:<?php echo $t_up;?>px;">
 | 
						|
       </div><?php
 | 
						|
    }?>
 | 
						|
    <div class "sib_box" style="position:absolute; top:<?php echo $t;?>px; left:<?php echo $left;?>px;
 | 
						|
      box-shadow:4px 4px 4px #999999;"><?php
 | 
						|
      $status = $verh;
 | 
						|
      if (isset($data_0['member_id'])) {
 | 
						|
        fill($data_0, $box); // Box für Person
 | 
						|
      } else {
 | 
						|
        $gen = "m";
 | 
						|
        leereBox($gen);
 | 
						|
        $anz_partner = 1;
 | 
						|
      }
 | 
						|
      $anzahl ++;           // anzahl boxes + 1 ?>
 | 
						|
    </div><?php
 | 
						|
    // ************************* Partnerbox ****************************************
 | 
						|
    $t_part = 0;      // Differenz zwischen Partnerboxen
 | 
						|
    if ($anz_partner == 0) {
 | 
						|
      $bol_d1 = false;
 | 
						|
    } else {
 | 
						|
      $status = $verh;
 | 
						|
      for ($b = 0; $b < $anz_partner; $b++){
 | 
						|
        // senkrechte Verbindungslinien Partner an die Box der Person?>
 | 
						|
        <div class="line_h0" style="top:<?php echo $t1+$t_part;?>px;left:<?php echo $left1;?>px;"></div>
 | 
						|
        <div class="line_v" style="top:<?php echo $t0+$t_part;?>px;left:<?php echo $left1;?>px;"><?php
 | 
						|
          if (isset($data_1[$b]['place_of_death'])) {
 | 
						|
            if ($data_1[$b]['place_of_death'] == "gefallen"){
 | 
						|
              $status = $gefallen;
 | 
						|
            }
 | 
						|
          }
 | 
						|
          echo "<b>".$status."</b>"; ?>
 | 
						|
        </div>
 | 
						|
        <div class "sib_box" style="position:absolute;top:<?php echo $t_p+$t_part;?>px;left:<?php echo $left2;?>px;
 | 
						|
          box-shadow:4px 4px 4px #999999;"><?php
 | 
						|
          if (isset($data_1[$b]['member_id'])) {
 | 
						|
            fill($data_1[$b], $box+1);
 | 
						|
          } else {
 | 
						|
            $gen = "f";
 | 
						|
            leereBox($gen);
 | 
						|
          }
 | 
						|
          $status = $gesch;
 | 
						|
          $anzahl ++;
 | 
						|
          $t_part = $t_part + 70; // neue Differenz zwischen Partnerboxen?>
 | 
						|
        </div><?php
 | 
						|
      }
 | 
						|
    }
 | 
						|
    return $anzahl;   // Anzahl der gezeichneten Boxes
 | 
						|
  }
 | 
						|
 | 
						|
  // ****************** create an empty box with gender picture ******************
 | 
						|
  function leereBox($g) {
 | 
						|
    global $col;
 | 
						|
    echo "<div class='basic ".$g."box"."'>";
 | 
						|
    echo "<center><b><img src='../../img/".$g.".jpg'></b> ";
 | 
						|
    if ($col==0){echo "Großeltern<br>";}
 | 
						|
    if ($col==1){echo "Eltern<br>";}
 | 
						|
    echo "unbekannt</center></div>";
 | 
						|
  }?>
 | 
						|
  <!--*********** end functions *************************************************
 | 
						|
  <div class="d-flex align-items-center">
 | 
						|
    <strong>Loading...</strong>
 | 
						|
    <div class="spinner-border ml-auto" role="status" aria-hidden="true"></div>
 | 
						|
  </div> --><?php
 | 
						|
  $strHeader = "Vorfahren und Nachkommen einer ausgewählten Person: ";
 | 
						|
  $l = strlen($strHeader)*12;   // Position des Headers berechnen
 | 
						|
  $len_h = strlen($strHeader)*12;
 | 
						|
  $t = 60; ?>
 | 
						|
 | 
						|
  <div class="container" id="myTable">
 | 
						|
    <div class="starter-template" >
 | 
						|
<!-- **************** Auswahl der Person ************************************-->
 | 
						|
      <form  action="<?php echo "?id=".$person->member_id; ?>">
 | 
						|
        <div style="z-index:2;left:<?php echo $len_h;?>px;top:<?php echo $t;?>px;height:30px;">
 | 
						|
          <p><strong><?php echo $strHeader." ";?></strong>
 | 
						|
          <select name="id" onchange="submit()"  style="background-color:lightyellow;">
 | 
						|
            <option value="null"> Bitte Person auswählen<?php
 | 
						|
            foreach ($persons as $pers) {
 | 
						|
              if ($pers->member_id == $person->member_id) { ?>">
 | 
						|
                <option selected value="<?php echo $pers->member_id; ?>"> <?php
 | 
						|
              } else { ?>
 | 
						|
                <option value="<?php echo $pers->member_id;?>"> <?php
 | 
						|
              }
 | 
						|
                echo jahr($pers->day_of_birth)."  ".$pers->last_name.", ".$pers->first_name;?>
 | 
						|
              </option><?php
 | 
						|
            } ?>
 | 
						|
          </select>
 | 
						|
        </p>
 | 
						|
        </div>
 | 
						|
      </form>
 | 
						|
      <?php
 | 
						|
// ********************************** Überschriften ****************************
 | 
						|
      $ueberschrift = array("Großeltern", "Eltern", "Person", "Kinder", "Enkel");
 | 
						|
      $anz_ueberschiften = count($ueberschrift);
 | 
						|
      $str_div = "<div style='position:fixed;z-index:2; top:";
 | 
						|
      $top_1 = $top-25;
 | 
						|
      $str_p0 = "<p><strong>";
 | 
						|
      $str_p1 = "</strong></p></div>";
 | 
						|
      // Überschriften - keine fixe Position?>
 | 
						|
      <div style="position:fixed;z-index:2;top:<?php echo $top-60;?>px; left:<?php echo $len_h;?>px;"></div><?php
 | 
						|
      $len_h = $col_1 + 40;   // Abstand zur ersten Spalte + 40
 | 
						|
      for ($i=0; $i < $anz_ueberschiften; $i++) {
 | 
						|
        echo $str_div.$top_1."px;"."left:".$len_h."px;';>".$str_p0.$ueberschrift[$i].$str_p1; //die();
 | 
						|
        $len_h = $len_h + $delta_l;
 | 
						|
      } ?>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
 | 
						|
<!-- ********** linker Block zur Erklärung ********************************* -->
 | 
						|
  <div id="leftarrow" style="position:absolute; top:<?php echo ($top+160).'px;'.'left:'.$col_1;?>px;z-index:5;">
 | 
						|
    <strong>Weitere Vorfahren:</strong></br>
 | 
						|
<!-- ********** sowie gelber Pfeil nach links ****************************** -->
 | 
						|
    <img border="0" src="../../img/ArrowLeft.gif" width="10" height="15" align="left"
 | 
						|
        title=" => Vorfahr" alt=" => Vorfahr" style="margin-right:5px"/><?php
 | 
						|
//   ********** Vorfahren väterlich ****************************************
 | 
						|
    if (isset($gen_00[0]->member_id)){
 | 
						|
        echo "<a href='nachkommen?id=".$gen_20[0]->member_id."'><strong>"
 | 
						|
          .$gen_00[0]->first_name." ".$gen_00[0]->last_name
 | 
						|
          ."</a></strong></br>   * ".date_german($gen_00[0]->day_of_birth)."</br>";
 | 
						|
    } else { echo "keine Daten</br>"; }?>
 | 
						|
<!-- ********** zweiter gelber Pfeil nach links **************************** -->
 | 
						|
    <img border="0" src="../../img/ArrowLeft.gif" width="10" height="15" align="left"
 | 
						|
       title=" => Vorfahr" alt=" => Vorfahr" style="margin-right:5px"/><?php
 | 
						|
//   ********** Vorfahren mütterlich ***************************************
 | 
						|
    if (isset($gen_01[0]->member_id)){
 | 
						|
        echo "<a href='nachkommen?mid=".$gen_01[0]->member_id."'><strong>"
 | 
						|
          .$gen_01[0]->first_name." ".$gen_01[0]->last_name
 | 
						|
          ."</a></strong></br>   * ".date_german($gen_01[0]->day_of_birth)."</br></br>";
 | 
						|
    } else { echo "keine Daten</br></br></br>"; } ?>
 | 
						|
 | 
						|
    <strong>Weitere Nachfahren:</strong></br>
 | 
						|
    <img border="0" src="../../img/ArrowRight.gif" width="10" height="15" align="left"
 | 
						|
        title=" => Vorfahr" alt=" => Vorfahr" style="margin-right:5px"/><?php
 | 
						|
    echo "Link auf Eltern der Kindes-Kinder<br><br>"?>
 | 
						|
 | 
						|
<!-- ********** Hinweise zur Webseite ************************************** -->
 | 
						|
    <div class="box" style='left:0px; width:250px; top:110px;'>
 | 
						|
      <p><strong><font color=blue>Hinweise zu dieser Webseite<br></font></strong></p>
 | 
						|
      <li>
 | 
						|
        Ein Click auf das <strong>Bild</strong> einer Person ruft das Familienblatt auf</br>
 | 
						|
      </li><br>
 | 
						|
      <li>
 | 
						|
        Ein Click auf den <strong>Namen</strong> erzeugt eine neue Ausgangsbasis<br>
 | 
						|
      </li><br>
 | 
						|
      <li>
 | 
						|
        Die <span style="background-color:lightyellow;
 | 
						|
          border:1px; border-style:solid; border-color:lightgrey;"> Auswahlliste</span> im Seitenkopf
 | 
						|
           erzeugt neue Ausgangsbasis
 | 
						|
      </li><br>
 | 
						|
      <li>
 | 
						|
        Familienstand:
 | 
						|
        <ul>
 | 
						|
          <li>
 | 
						|
            verheiratet: <b>  ⚭</b>
 | 
						|
          </li>
 | 
						|
          <li>
 | 
						|
            geschieden:  <b>⚯</b><br>
 | 
						|
          </li>
 | 
						|
          <li>
 | 
						|
            gefallen: <b>X</b>
 | 
						|
          </li>
 | 
						|
        </ul>
 | 
						|
      </li>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
  <div><?php
 | 
						|
    echo $str_div.$botom."px;"."left:".$col_1."px;';>";?>
 | 
						|
      <img border="0" src="../../img/ArrowUp.gif" width="15" height="15" align="left"
 | 
						|
        title="Nach oben" alt="Nach oben" style="margin-right:5px"/>
 | 
						|
    <a href="#Anfang"><p><strong><font color="blue">zurück zum Seitenanfang</font></strong></p></a>
 | 
						|
  </div><?php
 | 
						|
 | 
						|
//************************************************************************
 | 
						|
  $i = 0;   // index arrays
 | 
						|
  $j = 0;   // onkel & tanten
 | 
						|
  $k = 0;   // kinder
 | 
						|
  $l = 0;   // enkel
 | 
						|
  $cp = 0;  // child Partner
 | 
						|
  $row = $col = $b1 = $b2 = $b3 = $b4 = $b5 = 0;
 | 
						|
// ******************* Grandfather gen_10; Grandmother_11 **********************
 | 
						|
  $box_before_0 = $box = 0; // first loop: Startbox = 0
 | 
						|
  $bol_f0 = true;           //
 | 
						|
  $b1 = display_box($gen_10[0], $gen_11, $col=0, $box, $box_before_0, $bol_f0);
 | 
						|
  $bol_f0 = false;
 | 
						|
  $box_before_0 = $box;     // aktuelle Box-Position
 | 
						|
  $box_before_1 = $box;     // Startbedingungen neuer Zweig
 | 
						|
  $first_loop = true;       // erster Gesamt-Durchlauf (steuert $box Position)
 | 
						|
  $i = 0;                   // Zähler für Personen und Partner
 | 
						|
  $bol_f1 = true;           // erster Durchlauf
 | 
						|
 | 
						|
  foreach ($gen_20 as $g2) {
 | 
						|
    if (!empty($g2)){
 | 
						|
      $b2 = display_box($g2, $gen_21[$i], $col=1, $box, $box_before_1, $bol_f1);
 | 
						|
    } else {
 | 
						|
      $b2 = display_box($g2, $gen_21, $col=1, $box, $box_before_1, $bol_f1);
 | 
						|
    }
 | 
						|
    $bol_f1 = false;      // erster DL vorbei
 | 
						|
    $box_before_1 = $box; // aktuelle Box-Position
 | 
						|
    $box_before_2 = $box;
 | 
						|
    $j = 0;
 | 
						|
    $bol_f2 = True;               // erster Durchlauf
 | 
						|
    foreach ($gen_30[$i] as $g3) {
 | 
						|
      $b3 = display_box($g3, $gen_301[$i][$j], $col=2, $box, $box_before_2, $bol_f2);
 | 
						|
      $bol_f2 = false;            //erster DL vorbei - echo "Anzahl ".$b."</br>";
 | 
						|
      $box_before_2 = $box;
 | 
						|
      $box_before_3 = $box;       // schon gezeichnete Boxes
 | 
						|
      $k = 0;                       // Anzahl Kinder 0 0
 | 
						|
      $bol_f3 = true;             // true für erster Aufruf
 | 
						|
      foreach ($gen_40[$i][$j] as $g4) {
 | 
						|
        $b4 = display_box($g4, $gen_401[$i][$j][$k], $col=3, $box, $box_before_3, $bol_f3);
 | 
						|
        $bol_f3 = false;          // erster Durchlauf vorbei
 | 
						|
        $box_before_3 = $box;
 | 
						|
        $box = $box + $b4;        // + anzahl (Rückgabewert)
 | 
						|
        $k++;
 | 
						|
 | 
						|
        $box_before_4 = $box;
 | 
						|
        $bol_f4 = true;          // erster Durchlauf
 | 
						|
        $b5 = 0;
 | 
						|
        foreach ($gen_500[$l] as $g5) { // Kindeskinder
 | 
						|
          $box = $box + $b5;
 | 
						|
          $b5 = display_box($g5, $gen_51[$cp], $col=4, $box-2, $box_before_4, $bol_f4);
 | 
						|
          $bol_f4 = false;
 | 
						|
          $box_before_4 = $box;
 | 
						|
          $cp++;
 | 
						|
        }
 | 
						|
        $l++;                   // nächstes Kind
 | 
						|
      }
 | 
						|
      if ($b4 <= $b3){ $korr = $b3;} else { $korr = $b4;}
 | 
						|
      if ($k == 0){$box = $box + $b3;}                        // wenn Kinder = 0:
 | 
						|
      if (($k == 1) && ($b4 == 1)){$box = $box + $korr - 1;}  // bei einem kind
 | 
						|
      if (($k == 1) &&( $b4 == 2)){$box = $box + $korr - 2;}  // bei einem kind
 | 
						|
      $j++;
 | 
						|
    }
 | 
						|
    if ($b3 <= $b2){ $korr_1 = $b2;} else { $korr_1 = $b3;}
 | 
						|
    if (($j == 0)){$box = $box + $b2;}                        // wenn Kinder = 0:
 | 
						|
    if (($j == 1) && ($b3 == 0)){$box = $box + $korr_1 - 1;}
 | 
						|
    if (($j == 1) && ($b3 == 1)){$box = $box + $korr_1 - 1;}  // bei einem kind
 | 
						|
    if (($j == 1) &&( $b3 == 2)){$box = $box + $korr_1 - 2;}  // - $korrektur;}
 | 
						|
 | 
						|
    if ($first_loop == true) {
 | 
						|
      $box = $box + $b2 - 2;}                                 // beim ersten Durchlauf
 | 
						|
    $first_loop = false;
 | 
						|
    $i++;
 | 
						|
    }
 | 
						|
    $top_max = (($box + 1) * $delta_h) + 100;?>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
 | 
						|
  <?php
 | 
						|
    if ($top_max <= 800) {$top_max = 800; } //1600;?>
 | 
						|
<!-- **** Beim runterscrollen verschwindet Kopfzeile **** -->
 | 
						|
    <script
 | 
						|
      src="https://code.jquery.com/jquery-1.12.4.min.js"
 | 
						|
      integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
 | 
						|
      crossorigin="anonymous">
 | 
						|
    </script>
 | 
						|
 | 
						|
    <?php
 | 
						|
    include __DIR__ . "/../js/hochschieben.js";
 | 
						|
    $t_footer = $top_max;
 | 
						|
    include __DIR__ . "/../layout/footer_e.php"; ?>
 | 
						|
  </div>
 |