134 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			134 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
<!-- ********************* functions *******************************************-->
 | 
						|
 | 
						|
<?php
 | 
						|
function fill_line($person,$id,$link){
 | 
						|
  global $tr0, $tr1, $tr2;    //farbliche Kennzeichnung gender
 | 
						|
  foreach ($person as $row) {
 | 
						|
    $gender = $row['gender'];
 | 
						|
	  if ($row['member_id'] != 0) {
 | 
						|
      if ($row['gender'] == 01) { $tr=$tr1;$gen="m";} else {$tr=$tr2;$gen="f";}
 | 
						|
      if ($row['member_id'] != $id) {
 | 
						|
        echo $tr."<td><strong><img src='../../img/".$gen.".jpg'>  </td><td>"
 | 
						|
           .$link
 | 
						|
           .$row['member_id']."'>".$row['first_name']
 | 
						|
           ." ".$row['last_name']
 | 
						|
           ."</a></strong> </td>";
 | 
						|
        echo "<td>"
 | 
						|
        .$row['birth_name']. " </td><td> "
 | 
						|
        .date_ged($row['day_of_birth']). " </td><td> " .$row['place_of_birth']. " </td>";
 | 
						|
        if ($row['day_of_death'] != 0){
 | 
						|
          echo "<td> ".date_ged($row['day_of_death'])." </td></tr>";}
 | 
						|
        else { echo "</td> </tr>";}
 | 
						|
        }
 | 
						|
      } else {
 | 
						|
        echo $tr0 . "<td colspan=\"7\">Keine Daten erfasst!</td></tr>";
 | 
						|
      }
 | 
						|
  }
 | 
						|
} ?>
 | 
						|
 | 
						|
<?php
 | 
						|
function select_person($str_label, $person, $persons) {
 | 
						|
  global $nbm, $nbf, $nbu;
 | 
						|
  $nbm = $nbf = $nbu = 0;?>
 | 
						|
  <form  action="<?php echo "?id=".$person['member_id']; ?>">
 | 
						|
    <p><strong><?php echo $str_label."</strong></br>"; ?>
 | 
						|
    <select style="background-color:lightyellow;" name="id" onchange="submit()" ><?php
 | 
						|
    foreach ($persons as $pers){
 | 
						|
      switch($pers['gender']) {
 | 
						|
      case 1:  $nbm++; break;   // man
 | 
						|
      case 2:  $nbf++; break;   // woman
 | 
						|
      case 0:  $nbu++; break;   // unknown
 | 
						|
    }
 | 
						|
    $birth = DateTime::createFromFormat('Y-m-d', $pers['day_of_birth']);
 | 
						|
    if ($birth->format('Y') >= 2) { $year = $birth->format('Y');} else {$year = "????";}
 | 
						|
    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 $year. ": ";
 | 
						|
        echo $pers['last_name']. ", ";
 | 
						|
        echo $pers['first_name'];?>
 | 
						|
      </option><?php
 | 
						|
  }  ?>
 | 
						|
  </select>
 | 
						|
  </p>
 | 
						|
</form>
 | 
						|
<?php
 | 
						|
} ?>
 | 
						|
 | 
						|
<?php
 | 
						|
function select_parents($persons, $str_label, $str_select_name, $id, $gender) { ?>
 | 
						|
  <form action ="update" method = "get">
 | 
						|
    <label><?php echo $str_label."</br>"; ?>
 | 
						|
      <select style="background-color:lightyellow;" name ="<?php echo $str_select_name?>" onchange="this.form.submit()" ><?php
 | 
						|
      foreach ($persons as $pers) {
 | 
						|
        $birth = DateTime::createFromFormat('Y-m-d', $pers['day_of_birth']);
 | 
						|
        if ($birth->format('Y') >= 2) { $year = $birth->format('Y');} else {$year = "????";}
 | 
						|
        if (($pers['gender'] == $gender ) OR ($pers['gender'] == 0)) {
 | 
						|
          if ($pers['member_id'] == $id) { ?>
 | 
						|
            <option selected value="<?php echo $pers['member_id']?>" ><?php
 | 
						|
              $m = $pers['member_id'];
 | 
						|
          } else { ?>
 | 
						|
            <option value="<?php echo $pers['member_id']; ?>" ><?php
 | 
						|
          }
 | 
						|
          echo $year. ": ";
 | 
						|
          echo $pers['last_name']. ", ";
 | 
						|
          echo $pers['first_name'];?>
 | 
						|
            </option><?php
 | 
						|
        }
 | 
						|
      } ?>
 | 
						|
      </select>
 | 
						|
    </label>
 | 
						|
  </form><?php
 | 
						|
  return $m;
 | 
						|
}
 | 
						|
?>
 | 
						|
 | 
						|
<?php
 | 
						|
function select_partner($persons, $str_label, $str_select_name, $id) { ?>
 | 
						|
  <form action="update">
 | 
						|
    <label><?php echo $str_label; ?>
 | 
						|
      <select style="background-color:lightyellow;"name="id_part_new" onchange="this.form.submit()" ><?php
 | 
						|
        foreach ($persons as $pers) {
 | 
						|
          if ($pers['member_id'] == $id) { ?>
 | 
						|
            <option selected value="<?php echo $pers['member_id'];?>" ><?php
 | 
						|
          } else { ?>
 | 
						|
            <option value="<?php echo $pers['member_id']; ?>" ><?php
 | 
						|
          }
 | 
						|
              echo $pers['member_id']. " ";
 | 
						|
              echo $pers['last_name']. " ";
 | 
						|
              echo $pers['first_name']; ?>
 | 
						|
            </option><?php
 | 
						|
        } ?>
 | 
						|
      </select>
 | 
						|
    </label>
 | 
						|
  </form>
 | 
						|
  <?php
 | 
						|
}
 | 
						|
?>
 | 
						|
 | 
						|
<?php
 | 
						|
function select_adress($adressen, $id, $str_label) { ?>
 | 
						|
  <form  action="<?php echo "update"; ?>">
 | 
						|
    <label><?php echo $str_label; ?>
 | 
						|
      <select style="background-color:lightyellow;" name="id_place" onchange="this.form.submit()" >
 | 
						|
        <?php
 | 
						|
          foreach ($adressen as $adr) {
 | 
						|
            if ($adr['adr_id'] == $id) { ?>
 | 
						|
              <option selected value=" <?php echo $adr['adr_id']; ?>" >
 | 
						|
                <?php
 | 
						|
            } else { ?>
 | 
						|
              <option value="<?php echo $adr['adr_id'];?>"> <?php
 | 
						|
            }
 | 
						|
                echo $adr['adr_id']. ": ";
 | 
						|
                echo $adr['adr_ort']. ", ";
 | 
						|
                echo $adr['adr_strasse']; ?>
 | 
						|
              </option><?php
 | 
						|
            } ?>
 | 
						|
          </select>
 | 
						|
    </label>
 | 
						|
  </form><?php
 | 
						|
}
 | 
						|
?>
 |