forked from HuubMons/HuMo-genealogy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timelines.php
726 lines (664 loc) · 26.5 KB
/
timelines.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
<?php
include_once("header.php"); // returns CMS_ROOTPATH constant
include_once(CMS_ROOTPATH."menu.php");
require_once(CMS_ROOTPATH."include/person_cls.php");
//require_once(CMS_ROOTPATH."include/date_place.php");
require_once(CMS_ROOTPATH."include/language_date.php");
include_once(CMS_ROOTPATH."include/calculate_age_cls.php");
$process_age = New calculate_year_cls;
if(isset($_GET['id'])) { $id=$_GET['id']; }
@$personDb = $db_functions->get_person($id);
$isborn=0; $isdeath=0; $ismarr=0; $ischild=0;
$deathtext=''; $borntext=''; $bapttext=''; $burrtext=''; $marrtext='';
$privacy_filtered=false;
function julgreg($date) { // alters a julian/gregorian date entry such as 4 mar 1572/3 to use regular date for calculations
if (strpos($date,'/')>0){
$temp=explode ('/',$date);
$date=$temp[0];
}
return $date;
}
$bornyear=''; $borndate=''; $temp='';
if($personDb->pers_birth_date) {
$borndate=julgreg($personDb->pers_birth_date);
$temp=substr($borndate,-4);
if($temp > 0 AND $temp < 2200) {
$bornyear=$temp;
$borntext= ucfirst(__('birth')).' '.language_date($borndate);
$isborn=1;
}
}
$baptyear=''; $baptdate=''; $temp='';
if($personDb->pers_bapt_date) {
$baptdate=julgreg($personDb->pers_bapt_date);
$temp=substr($baptdate,-4);
if($temp > 0 AND $temp < 2200) {
$baptyear=$temp;
$bapttext= ucfirst(__('baptised')).' '.language_date($baptdate);
$isborn=1;
}
}
$deathyear=''; $deathdate=''; $temp='';
if($personDb->pers_death_date) {
$deathdate=julgreg($personDb->pers_death_date);
$temp=substr($deathdate,-4);
if($temp > 0 AND $temp < 2200) {
$deathyear=$temp;
$deathtext= ucfirst(__('death')).' '.language_date($deathdate);
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$personDb->pers_death_date, true);
if ($age){ $deathtext='['.$age.'] '.$deathtext; }
$isdeath=1;
}
}
$burryear=''; $burrdate=''; $temp='';
if($personDb->pers_buried_date) {
$burrdate=julgreg($personDb->pers_buried_date);
$temp=substr($burrdate,-4);
if($temp > 0 AND $temp < 2200) {
$burryear=$temp;
$burrtext= ucfirst(__('buried')).language_date($burrdate);
$isdeath=1;
}
}
// *********** MARRIAGES & CHILDREN
if($personDb->pers_fams) {
$marriages=explode(";",$personDb->pers_fams);
for($i=0; $i<count($marriages);$i++) {
$children[$i]=''; $marryear[$i]=''; $marrdate[$i]=''; $temp='';
@$familyDb = $db_functions->get_family($marriages[$i]);
if ($personDb->pers_gedcomnumber==$familyDb->fam_man){
$spouse=$familyDb->fam_woman;
}
else{
$spouse=$familyDb->fam_man;
}
@$spouse2Db = $db_functions->get_person($spouse);
$privacy='1';
if ($spouse2Db){
$person_cls = New person_cls;
$person_cls->construct($spouse2Db);
$privacy=$person_cls->privacy;
$name=$person_cls->person_name($spouse2Db);
}
if ($privacy==''){
if(isset($spouse2Db->pers_death_date) AND $spouse2Db->pers_death_date) {
$spousedeathname[$i]=''; $spousedeathyear[$i]=''; $spousedeathtext[$i]='';
$spousedeathdate[$i]=julgreg($spouse2Db->pers_death_date);
$temp=substr($spousedeathdate[$i],-4);
if($temp AND $temp > 0 AND $temp < 2200) {
if($spouse2Db->pers_sexe=="M") { $spouse=__('SPOUSE_MALE'); }
else { $spouse=__('SPOUSE_FEMALE'); }
$spousedeathyear[$i]=$temp;
if($name["firstname"]) { $spousedeathname[$i]=$name["firstname"]; }
$spousedeathtext[$i]= ucfirst(__('death')).' '.$spouse." ".$spousedeathname[$i]." ".$dirmark1.str_replace(" "," ",language_date($spousedeathdate[$i]));
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$spouse2Db->pers_death_date, true);
if ($age){ $spousedeathtext[$i]='['.$age.'] '.$spousedeathtext[$i]; }
}
}
$temp='';
if($familyDb->fam_marr_date) {
$marrdate[$i]=julgreg($familyDb->fam_marr_date);
$text=ucfirst(__('marriage')).' ';
}
elseif($familyDb->fam_marr_church_date) {
$marrdate[$i]=julgreg($familyDb->fam_marr_church_date);
$text=ucfirst(__('church marriage')).' ';
}
elseif($familyDb->fam_marr_notice_date) {
$marrdate[$i]=julgreg($familyDb->fam_marr_notice_date);
$text=ucfirst(__('marriage notice')).' ';
}
elseif($familyDb->fam_marr_church_notice_date) {
$marrdate[$i]=julgreg($familyDb->fam_marr_church_notice_date);
$text=ucfirst(__('church marriage notice')).' ';
}
elseif($familyDb->fam_relation_date) {
$marrdate[$i]=julgreg($familyDb->fam_relation_date);
$text=ucfirst(__('partnership')).' ';
}
if($marrdate[$i]) {
$temp=substr($marrdate[$i],-4);
}
if($temp AND $temp > 0 AND $temp < 2200) {
if($name["firstname"]) {
$spousename=$name["firstname"];
$spousetext=__('with ').$spousename;
}
$marryear[$i]=$temp;
//$marrtext[$i]= $text.$spousetext."<br>".language_date($marrdate[$i]);
$marrtext[$i]= $text.$spousetext." ".$dirmark1.str_replace(" "," ",language_date($marrdate[$i]));
$ismarr=1;
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$marrdate[$i], true);
if ($age){ $marrtext[$i]='['.$age.'] '.$marrtext[$i]; }
}
}
else{
// *** Privacy filter activated ***
$privacy_filtered=true;
}
if($familyDb->fam_children) {
$children[$i]=explode(";",$familyDb->fam_children);
for($m=0; $m<count($children[$i]); $m++) {
$chmarriages[$i][$m]=''; // enter value so we wont get error messages
@$chldDb = $db_functions->get_person($children[$i][$m]);
if($chldDb->pers_sexe=="M") { $child=__('son'); }
else if ($chldDb->pers_sexe=="F") { $child=__('daughter'); }
else { $child=__('child '); }
$person2_cls = New person_cls;
$person2_cls->construct($chldDb);
$privacy=$person2_cls->privacy;
$name=$person2_cls->person_name($chldDb);
if ($privacy==''){
$chbornyear[$i][$m]=''; $chborndate[$i][$m]=''; $chborntext[$i][$m]='';
$chdeathyear[$i][$m]=''; $chdeathdate[$i][$m]=''; $chdeathtext[$i][$m]='';
$temp='';
$childname[$i][$m]=$name["firstname"];
$chborndate[$i][$m]=julgreg($chldDb->pers_birth_date);
$temp=substr($chborndate[$i][$m],-4);
if($temp > 0 AND $temp < 2200) {
$chbornyear[$i][$m]=$temp;
$chborntext[$i][$m]=ucfirst(__('birth')).' '.$child." ".$childname[$i][$m]." ".$dirmark1.str_replace(" "," ",language_date($chborndate[$i][$m]));
$ischild=1;
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$chldDb->pers_birth_date, true);
if ($age){ $chborntext[$i][$m]='['.$age.'] '.$chborntext[$i][$m]; }
}
$chdeathdate[$i][$m]=julgreg($chldDb->pers_death_date);
$temp='';
$temp=substr($chdeathdate[$i][$m],-4);
if($temp > 0 AND $temp < 2200) {
$chdeathyear[$i][$m]=$temp;
$chdeathtext[$i][$m]=ucfirst(__('death')).' '.$child." ".$childname[$i][$m]." ".$dirmark1.str_replace(" "," ",language_date($chdeathdate[$i][$m]));
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$chldDb->pers_death_date, true);
if ($age){ $chdeathtext[$i][$m]='['.$age.'] '.$chdeathtext[$i][$m]; }
}
}
else{
// *** Privacy filter activated ***
$privacy_filtered=true;
}
if($chldDb->pers_fams) {
$chmarriages[$i][$m]=explode(";",$chldDb->pers_fams);
for($p=0; $p<count($chmarriages[$i][$m]);$p++) {
$grchildren[$i][$m][$p]=''; // enter value so usbwebserver wont throw error messages
$chmarryear[$i][$m][$p]=''; $chmarrdate[$i][$m][$p]=''; $temp='';
@$chfamilyDb = $db_functions->get_family($chmarriages[$i][$m][$p]);
// CHILDREN'S MARRIAGES
if ($chldDb->pers_gedcomnumber==$chfamilyDb->fam_man){
$chspouse=$chfamilyDb->fam_woman;
}
else{
$chspouse=$chfamilyDb->fam_man;
}
@$chspouse2Db = $db_functions->get_person($chspouse);
$person_cls = New person_cls;
$person_cls->construct($chspouse2Db);
$privacy=$person_cls->privacy;
$name=$person_cls->person_name($chspouse2Db);
if ($privacy==''){
if ($chfamilyDb->fam_marr_date) {
$chmarrdate[$i][$m][$p]=julgreg($chfamilyDb->fam_marr_date);
$chtext=ucfirst(__('marriage')).' ';
}
elseif ($chfamilyDb->fam_marr_church_date) {
$chmarrdate[$i][$m][$p]=julgreg($chfamilyDb->fam_marr_church_date);
$chtext=ucfirst(__('church marriage')).' ';
}
elseif ($chfamilyDb->fam_marr_notice_date) {
$chmarrdate[$i][$m][$p]=julgreg($chfamilyDb->fam_marr_notice_date);
$chtext=ucfirst(__('marriage notice')).' ';
}
elseif ($chfamilyDb->fam_marr_church_notice_date) {
$chmarrdate[$i][$m][$p]=julgreg($chfamilyDb->fam_marr_church_notice_date);
$chtext=ucfirst(__('church marriage notice')).' ';
}
elseif ($chfamilyDb->fam_relation_date) {
$chmarrdate[$i][$m][$p]=julgreg($chfamilyDb->fam_relation_date);
$chtext=ucfirst(__('partnership')).' ';
}
if ($chmarrdate[$i][$m][$p]) {
$temp=substr($chmarrdate[$i][$m][$p],-4);
}
if ($temp AND $temp > 0 AND $temp < 2200) {
//if (isset($chspouse2Db->pers_firstname) AND $chspouse2Db->pers_firstname) {
if ($name["firstname"]){
$chspousename=$name["firstname"];
$chspousetext=__('with ').$chspousename;
}
$chmarryear[$i][$m][$p]=$temp;
$chmarrtext[$i][$m][$p]= $chtext.$child." ".$childname[$i][$m].' '.$chspousetext." ".$dirmark1.str_replace(" "," ",language_date($chmarrdate[$i][$m][$p]));
//$chismarr=1;
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$chmarrdate[$i][$m][$p], true);
if ($age){ $chmarrtext[$i][$m][$p]='['.$age.'] '.$chmarrtext[$i][$m][$p]; }
}
}
else{
// *** Privacy filter activated ***
$privacy_filtered=true;
}
// END CHILDREN'S MARRIAGES
if($chfamilyDb->fam_children) {
$grchildren[$i][$m][$p]=explode(";",$chfamilyDb->fam_children);
for($g=0; $g<count($grchildren[$i][$m][$p]); $g++) {
@$grchldDb = $db_functions->get_person($grchildren[$i][$m][$p][$g]);
$person3_cls = New person_cls;
$person3_cls->construct($grchldDb);
$privacy=$person3_cls->privacy;
$name=$person3_cls->person_name($grchldDb);
if ($privacy==''){
$grchbornyear[$i][$m][$p][$g]=''; $grchborndate[$i][$m][$p][$g]=''; $grchborntext[$i][$m][$p][$g]='';
$grchdeathyear[$i][$m][$p][$g]=''; $grchdeathdate[$i][$m][$p][$g]=''; $grchdeathtext[$i][$m][$p][$g]='';
$temp='';
if($grchldDb->pers_sexe=="M") { $grchild=__('grandson'); }
else if ($grchldDb->pers_sexe=="F") { $grchild=__('granddaughter'); }
else { $grchild=__('grandchild'); }
$grchildname[$i][$m][$p][$g]=$name["firstname"];
$grchborndate[$i][$m][$p][$g]=julgreg($grchldDb->pers_birth_date);
$temp=substr($grchborndate[$i][$m][$p][$g],-4);
if($temp > 0 AND $temp < 2200) {
$grchbornyear[$i][$m][$p][$g]=$temp;
$grchborntext[$i][$m][$p][$g]=ucfirst(__('birth')).' '.$grchild." ".$grchildname[$i][$m][$p][$g]." ".$dirmark1.str_replace(" "," ",language_date($grchborndate[$i][$m][$p][$g]));
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$grchldDb->pers_birth_date, true);
if ($age){ $grchborntext[$i][$m][$p][$g]='['.$age.'] '.$grchborntext[$i][$m][$p][$g]; }
}
$grchdeathdate[$i][$m][$p][$g]=julgreg($grchldDb->pers_death_date);
$temp='';
$temp=substr($grchdeathdate[$i][$m][$p][$g],-4);
if($temp > 0 AND $temp < 2200) {
$grchdeathyear[$i][$m][$p][$g]=$temp;
$grchdeathtext[$i][$m][$p][$g]=ucfirst(__('death')).' '.$grchild." ".$grchildname[$i][$m][$p][$g]." ".$dirmark1.str_replace(" "," ",language_date($grchdeathdate[$i][$m][$p][$g]));
$age=$process_age->calculate_age($personDb->pers_bapt_date,$personDb->pers_birth_date,$grchldDb->pers_death_date, true);
if ($age){ $grchdeathtext[$i][$m][$p][$g]='['.$age.'] '.$grchdeathtext[$i][$m][$p][$g]; }
}
} // end if privacy==''
else{
// *** Privacy filter activated ***
$privacy_filtered=true;
}
} // end for grchildren
} // end if grchildren
} // end for chmarriages
} //end if chldDb->pers_fams
} //end for
} // end if children
}
}
// *********** END MARRIAGES & CHILDREN
// *********** CHECK IF ANY DATES ARE AVAILABLE. IF PART ARE MISSING ESTIMATE BIRTH/DEATH
// *** Check privacy filter ***
$person_cls = New person_cls;
$person_cls->construct($personDb);
$privacy=$person_cls->privacy;
if($privacy==1) {
echo '<br><br>'.__('PRIVACY FILTER');
exit();
}
if($isborn==0 AND $isdeath==0 AND $ismarr==0 AND $ischild==0) { // no birth or death dates available
print "<br><br>".__('There are no dates available for this person. Timeline can not be calculated.');
exit();
}
if($isborn==1 AND $isdeath==0) { // birth date but no death date: we show 80 years from birth
if($bornyear!=0) {
$deathyear=$bornyear+80;
}
else {
$deathyear=$baptyear+80;
}
$deathtext=__('Date of death unknown');
if($deathyear > date("Y")) { // if birth+80 goes beyond present, we stop there but of course don't mention death.... ;-)
$deathyear=date("Y");
$deathtext='';
}
}
if($isborn==0 AND $isdeath==1) { // death date but no birth date: we show 80 years prior to death
if($deathyear!=0) {
$bornyear=$deathyear-80;
}
else {
$bornyear=$burryear-80;
}
$borntext=__('Date of birth unknown');
}
if($isborn==0 AND $isdeath==0 AND $ismarr==1) {
// no birth or death date but there is a marriage date:
// birth is estimated as 25 years prior to marriage date
// death is estimated as 55 years after marriage date
if($marryear[0]!=0){
$bornyear=$marryear[0]-25;
$deathyear=$marryear[0]+55;
}
$borntext=__('Date of birth unknown');
$deathtext=__('Date of death unknown');
}
if($isborn==0 AND $isdeath==0 AND $ismarr==0 and $ischild==1) {
// no birth,death or marriage date but there is a childbirth date:
// birth is estimated as 25 years prior to child birth date
// death is estimated as 55 years after child birth date
if($chbornyear[0][0]!=0) {
$bornyear=$chbornyear[0][0]-25;
$deathyear=$chbornyear[0][0]+55;
}
$borntext=__('Date of birth unknown');
$deathtext=__('Date of death unknown');
}
// ****** OPEN TIMELINE DIRECTORY FOR READING AVAILABLE FILES
$dh = opendir(CMS_ROOTPATH."languages/".$selected_language."/timelines"); // we know directory exists - otherwise the timelines options would not be displayed
$counter=0;
while (false !== ($filename = readdir($dh))) {
if (strtolower(substr($filename, -3)) == "txt"){
$counter++;
$filenames[$counter-1][0]=CMS_ROOTPATH."languages/".$selected_language."/timelines/".$filename;
$filenames[$counter-1][1]=substr($filename,0,-4);
}
}
sort($filenames);
$step=5; // default step - user can choose 1 or 10 instead
if(isset($_POST['step'])) { $step=$_POST['step']; }
$tml=3; // default timeline file
if(isset($_POST['tml'])) { $tml=$_POST['tml']; }
// **** SHOW MENU ****
print '<div class="left_box">';
if(CMS_SPECIFIC=="Joomla") {
print '<form name="tmlstep" method="post" action="index.php?option=com_humo-gen&task=timelines&id='.$id.'&database='.$database.'" style="display:inline;">';
}
else {
print '<form name="tmlstep" method="post" action="timelines.php?id='.$id.'&database='.$database.'" style="display:inline;">';
}
//======== HELP POPUP ========================
if(CMS_SPECIFIC=="Joomla") {
echo '<div class="fonts '.$rtlmarker.'sddm" style="postion:absolute; top:32; left:7;">';
$popwidth="width:700px;";
}
else {
echo '<div class="fonts '.$rtlmarker.'sddm" style="display:inline">';
$popwidth="";
}
echo '<a href="#"';
echo ' style="display:inline" ';
if(CMS_SPECIFIC=="Joomla") {
echo 'onmouseover="mopen(event,\'help_menu\',0,0)"';
}
else {
echo 'onmouseover="mopen(event,\'help_menu\',10,150)"';
}
echo 'onmouseout="mclosetime()">';
echo ' <strong>'.__('Help').'</strong>';
echo '</a> ';
echo '<div class="sddm_fixed" style="'.$popwidth.' z-index:40; text-align:'.$alignmarker.'; padding:4px; direction:'.$rtlmarker.'" id="help_menu" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">';
echo __('Explanation of the timeline chart:<br>
<ul><li>The middle column displays the years of the timeline. The starting point will be just before birth and the end year will be just after death.</li>
<li>The left column displays the events in the person\'s life.<br>
Events listed are: birth, death and marriage(s) of main person, death of spouse, birth, marriage and death of children and birth and death of grandchildren.<br>
Birth, death, marriages and death of spouse are listed in bold red. Birth, marriage and death of children in green. Birth and death of grandchildren in blue</li>
<li>The rightmost column displays historic events that took place in these years.</li></ul>
The timeline menu:<br>
<ul><li>On the top part of the menu you can choose how the chart will be displayed. There are three choices:<br>
1 - will display each year in a separate row.<br>
5 - will create periods of five years for a more concise display.<br>
10 - displays the chart in periods of one decade for even more concise display.</li>
<li>If the webmaster enabled more than one timeline, the bottom part of the menu will let you choose from amongst several possible timelines. For example "American History", "Dutch History" etc.</li>
<li><strong>After choosing the desired step and/or timeline, click the "Change Display" button on the bottom of the menu.</strong></li></ul>');
echo '</div>';
echo '</div><br>';
//=================================
// Steps of years in display: 1, 5 or 10
print '<br>'.__('Steps:').'<br>';
print '<input type="radio" name="step" value="1"';
if ($step==1) print ' checked="checked"';
print ' >1 '.__('year');
print '<br><input type="radio" name="step" value="5"';
if ($step==5) print ' checked="checked"';
print ' >5 '.__('years');
print '<br><input type="radio" name="step" value="10"';
if ($step==10) print ' checked="checked"';
print ' >10 '.__('years');
// Choice of timeline files available
if(count($filenames) > 1) { // only show timelines menu if there are more than 1 timeline files
print '<br><br>'.__('Choose timeline');
print '<div style="direction:ltr">';
for ($i=0; $i<count($filenames); $i++){
print '<input type="radio" name="tml" value="'.$i.'"';
if ($tml==$i) {
print ' checked="checked"';
}
print ' >'.$filenames[$i][1].'<br>';
}
print '</div>';
}
print '<br><input type="submit" value="'.__('Change Display').'" >';
print '</form>';
//print '</td></tr></table>';
print '</div>';
// **** END MENU ****
if(file_exists($filenames[0][0])) {
$handle = fopen($filenames[$tml][0], "r");
}
($isborn==1 AND $bornyear == '') ? $byear = $baptyear : $byear = $bornyear; // if only bapt date available use that
$beginyear=$byear-(($byear % $step) + $step); // if beginyear=1923 and step is 5 this makes it 1915
($isdeath==1 AND $deathyear == '') ? $dyear = $burryear : $dyear = $deathyear; // if only burial date available use that
$endyear=$dyear+(($step-($dyear % $step)))+($step); // if endyear=1923 and step is 5 this makes it 1929
if($endyear>date("Y")) { $endyear=date("Y"); }
$flag=0; // flags a first entry of timeline event in a specific year. is set to 1 when at least one entry has been made
// ****** DISPLAY
print "<div style='position:absolute;top:30px;left:150px;right:10px'>";
if ($privacy_filtered==true){
echo __('*** Privacy filter is active, one or more items are filtered. Please login to see all items ***').'<br>';
}
print "<table id='timetable' class='humo' style='border:1px'>";
$name=$person_cls->person_name($personDb);
print "<tr class=table_headline><th colspan='3'>".$name["name"]."</th></tr>";
print "<tr class=table_headline><th>".__('LIFE EVENTS')."</th>";
print "<th>".__('YEAR')."</th>";
$nofiles='';
if(!file_exists($filenames[0][0]))
$nofiles="<br>".__('There are no timeline files available for this language.');
print "<th>".__('HISTORIC EVENTS').$nofiles."</th></tr>";
$step==1?$yearwidth=60:$yearwidth=120; // when step is 1 the column can be much shorter
$flag_isbuffer=0;
$eventdir="ltr"; // default direction of timeline file is ltr (set to rtl later in the script if necessary
for($yr=$beginyear; $yr<$endyear; $yr+=$step) { // range of years for lifespan
// DISPLAY LIFE EVENTS FOR THIS YEAR/PERIOD (1st column)
print "<tr><td style='width:250px;padding:4px;vertical-align:top;font-weight:bold;color:red'>";
$br_flag=0;
for($tempyr=$yr; $tempyr<$yr+$step; $tempyr++) {
if ($bornyear!='' AND $bornyear == $tempyr) {
if($br_flag==1) { print "<br>"; }
print $borntext;
$br_flag=1;
}
else if ($baptyear!='' AND $baptyear == $tempyr) {
if($br_flag==1) { print "<br>"; }
print $bapttext;
$br_flag=1;
}
if(isset($marryear)) {
for($i=0;$i<count($marryear);$i++) {
if ($marryear[$i]!='' AND $marryear[$i] == $tempyr) {
if($br_flag==1) { print "<br>"; }
print $marrtext[$i];
$br_flag=1;
}
}
}
if(isset($spousedeathyear)) {
for($i=0;$i<count($spousedeathyear);$i++) {
if (@$spousedeathyear[$i]!='' AND $spousedeathyear[$i] == $tempyr) {
if($br_flag==1) { print "<br>"; }
print $spousedeathtext[$i];
$br_flag=1;
}
}
}
if(isset($chbornyear)) {
for($i=0; $i<count($marriages);$i++) {
for($m=0; $m<count($children[$i]);$m++) {
if (isset($chbornyear[$i][$m]) AND $chbornyear[$i][$m] == $tempyr) {
if($br_flag==1) { print "<br>"; }
print "<span style='color:green;font-weight:normal'>".$chborntext[$i][$m]."</span>";
$br_flag=1;
}
}
}
}
if(isset($chdeathyear)) {
for($i=0; $i<count($marriages);$i++) {
for($m=0; $m<count($children[$i]);$m++) {
if (isset($chdeathyear[$i][$m]) AND $chdeathyear[$i][$m] == $tempyr) {
if($br_flag==1) { print "<br>"; }
print "<span style='color:green;font-weight:normal'>".$chdeathtext[$i][$m]."</span>";
$br_flag=1;
}
}
}
}
if(isset($chmarryear)) {
for($i=0; $i<count($marriages);$i++) {
for($m=0; $m<count($children[$i]);$m++) {
if(isset($chmarriages[$i][$m])) {
for($p=0; $p<count($chmarriages[$i][$m]);$p++) {
if (isset($chmarryear[$i][$m][$p]) AND $chmarryear[$i][$m][$p]!='' AND $chmarryear[$i][$m][$p] == $tempyr) {
if($br_flag==1) { print "<br>"; }
print "<span style='color:green;font-weight:normal'>".$chmarrtext[$i][$m][$p]."</span>";
$br_flag=1;
}
}
}
}
}
}
if(isset($grchbornyear)) {
for($i=0; $i<count($marriages);$i++) {
for($m=0; $m<count($children[$i]);$m++) {
if(isset($chmarriages[$i][$m])) {
for($p=0; $p<count($chmarriages[$i][$m]);$p++) {
if(isset($grchildren[$i][$m][$p])) {
for($g=0; $g<count($grchildren[$i][$m][$p]);$g++) {
if (isset($grchbornyear[$i][$m][$p][$g]) AND $grchbornyear[$i][$m][$p][$g]!='' AND $grchbornyear[$i][$m][$p][$g] == $tempyr) {
if($br_flag==1) { print "<br>"; }
print "<span style='color:blue;font-weight:normal'>".$grchborntext[$i][$m][$p][$g]."</span>";
$br_flag=1;
}
}
}
}
}
}
}
}
if(isset($grchdeathyear)) {
for($i=0; $i<count($marriages);$i++) {
for($m=0; $m<count($children[$i]);$m++) {
if(isset($chmarriages[$i][$m])) {
for($p=0; $p<count($chmarriages[$i][$m]);$p++) {
if(isset($grchildren[$i][$m][$p])) {
for($g=0; $g<count($grchildren[$i][$m][$p]);$g++) {
if (isset($grchdeathyear[$i][$m][$p][$g]) AND $grchdeathyear[$i][$m][$p][$g]!='' AND $grchdeathyear[$i][$m][$p][$g] == $tempyr) {
if($br_flag==1) { print "<br>"; }
print "<span style='color:blue;font-weight:normal'>".$grchdeathtext[$i][$m][$p][$g]."</span>";
$br_flag=1;
}
}
}
}
}
}
}
}
if ($deathyear!='' AND $deathyear == $tempyr) {
if($br_flag==1) { print "<br>"; }
print $deathtext;
$br_flag=1;
}
else if ($burryear!='' AND $burryear == $tempyr) {
if($br_flag==1) { print "<br>"; }
print $burrtext;
$br_flag=1;
}
} // end life events loop
print "</td>";
// DISPLAY YEAR/PERIOD (2nd column)
$period='';
if($step!=1) {
$period="-".($yr+$step)+1;
}
print "<td style='width:".$yearwidth."px;padding:4px;text-align:center;vertical-align:top;font-weight:bold;font-size:120%'>".$yr.$period."</td>";
// DISPLAY HISTORIC EVENTS FOR THIS YEAR/PERIOD (3rd column)
print "<td style='vertical-align:top'>";
if(file_exists($filenames[0][0])) {
$flag_br=0;
//while (!feof($handle)) {
while (!feof($handle) OR (feof($handle) AND $flag_isbuffer==1) ) {
$eventyear=''; $eventdata='';
if($flag_isbuffer!=1) {
$buffer = fgets($handle, 4096);
$temp=substr($buffer,0,4);
}
else {
$flag_isbuffer=0;
}
if($temp>0 AND $temp <2200) { // valid year
if($temp < $yr){ // we didn't get to the lifespan yet - take next line
continue;
}
else if($temp >= $yr+$step) { // event year is beyond the year/period checked, flag existence of buffer and break out of while loop
$flag_isbuffer=1;
//print "</td></tr>";
break;
}
else if($temp>=$yr AND $temp<$yr+$step) {
if($flag_br==0) { // first entry in this year/period. if a "rtl" was read before the first text entry make direction rtl
print '<div style="direction:'.$eventdir.'">';
}
$thisyear='';
if($step!=1) {
$thisyear=$temp." ";
}
if(substr($buffer,4,1)=='-') {
$temp2=substr($buffer,5,4);
if($temp2 >0 AND $temp2 < 2200) {
$tillyear=$temp2;
$eventdata="(".__('till')." ".$tillyear.") ".substr($buffer,10);
if($flag_br==1) { print "<br>"; }
print $thisyear.$eventdata;
$flag_br=1;
}
}
else {
$eventdata=substr($buffer,5);
if($flag_br==1) { print "<br>"; }
print $thisyear.$eventdata;
$flag_br=1;
}
}
}
else { // line doesn't start with valid year - take next line
if(substr($temp,0,3)=="rtl") { //the timeline file is a rtl file (the word rtl was on one of the first lines in the file)
$eventdir="rtl";
}
continue;
}
} // end while loop
if($flag_br!=0) {
print '</div>';
}
}
print "</td></tr>";
} // end total lifespan loop
print "</table>";
print "<br><br><br><br>";
print "</div>";
// the following javascript reads height of table and adds a fake div with this height
// so that the joomla page will stretch down to allow for the whole table
if(CMS_SPECIFIC=="Joomla") {
echo '<script type="text/javascript">';
echo 'var tabheight = document.getElementById("timetable").offsetHeight;';
echo 'tabheight += 80;';
echo 'document.write(\'<div style="height:\' + tabheight + \'px"> </div>\');';
echo 'tabheight = 0;';
echo '</script>';
}
// END DISPLAY
if(file_exists($filenames[0][0])) {
fclose($handle);
}
include_once(CMS_ROOTPATH."footer.php");
?>