/
report_ancestor.php
1518 lines (1370 loc) · 58.8 KB
/
report_ancestor.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
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// First test scipt made by: Klaas de Winkel
// Graphical script made by: Theo Huitema
// Graphical part: better lay-out (colours) and pictures made by: Rene Janssen
// Graphical part: improved lay-out by: Huub Mons.
// Ancestor sheet, PDF export for ancestor report and ancestor sheet, image generation for chart made by: Yossi Beck.
// July 2011: translated all variables to english by: Huub Mons.
//error_reporting(E_ALL);
@set_time_limit(3000);
//==========================
global $humo_option, $user, $marr_date_array, $marr_place_array;
global $gedcomnumber, $language;
global $screen_mode, $dirmark1, $dirmark2, $pdf_footnotes;
// == define roman numbers (max. 60 generations)
$rom_nr = array( 1=>'I', 2=>'II', 3=>'III', 4=>'IV', 5=>'V', 6=>'VI', 7=>'VII', 8=>'VIII', 9=>'IX', 10=>'X',
11=>'XI', 12=>'XII', 13=>'XIII', 14=>'XIV', 15=>'XV', 16=>'XVI', 17=>'XVII', 18=>'XVIII', 19=>'XIX', 20=>'XX',
21=>'XXI', 22=>'XXII', 23=>'XXIII', 24=>'XXIV', 25=>'XXV', 26=>'XXVII', 27=>'XXVII', 28=>'XXVIII', 29=>'XXIX', 30=>'XXX',
31=>'XXXI',32=>'XXXII',33=>'XXXIII',34=>'XXXIV',35=>'XXXV',36=>'XXXVII',37=>'XXXVII',38=>'XXXVIII',39=>'XXXIX',40=>'XL',
41=>'XLI', 42=>'XLII', 43=>'XLIII', 44=>'XLIV', 45=>'XLV', 46=>'XLVII', 47=>'XLVII', 48=>'XLVIII', 49=>'XLIX', 50=>'L',
51=>'LI', 52=>'LII', 53=>'LIII', 54=>'LIV', 55=>'LV', 56=>'LVII', 57=>'LVII', 58=>'LVIII', 59=>'LIX', 60=>'LX',);
$screen_mode='';
if (isset($_POST["screen_mode"]) AND $_POST["screen_mode"]=='PDF'){ $screen_mode='PDF'; }
if (isset($_POST["screen_mode"]) AND $_POST["screen_mode"]=='RTF'){ $screen_mode='RTF'; }
if (isset($_POST["screen_mode"]) AND $_POST["screen_mode"]=='ASPDF'){ $screen_mode='ASPDF'; }
if (isset($_GET["screen_mode"]) AND $_GET["screen_mode"]=='ancestor_sheet'){ $screen_mode='ancestor_sheet'; }
if (isset($_GET["screen_mode"]) AND $_GET["screen_mode"]=='ancestor_chart'){ $screen_mode='ancestor_chart'; }
if(isset($hourglass) AND $hourglass===true) { $screen_mode='ancestor_chart'; }
else $hourglass=false;
$pdf_source= array(); // is set in show_sources.php with sourcenr as key to be used in source appendix
// see end of this code
include_once("header.php"); // returns CMS_ROOTPATH constant
include_once(CMS_ROOTPATH."include/language_date.php");
include_once(CMS_ROOTPATH."include/language_event.php");
include_once(CMS_ROOTPATH."include/calculate_age_cls.php");
include_once(CMS_ROOTPATH."include/person_cls.php");
include_once(CMS_ROOTPATH."include/witness.php");
// Needed for marriage:
include_once(CMS_ROOTPATH."include/process_text.php");
include_once(CMS_ROOTPATH."include/date_place.php");
include_once(CMS_ROOTPATH."include/marriage_cls.php");
include_once(CMS_ROOTPATH."include/show_sources.php");
include_once(CMS_ROOTPATH."include/show_picture.php");
if($screen_mode!='PDF' AND $screen_mode!='ASPDF') { //we can't have a menu in pdf...
include_once(CMS_ROOTPATH."menu.php");
} else {
include_once(CMS_ROOTPATH."include/db_functions_cls.php");
$db_functions = New db_functions;
if (isset($_SESSION['tree_prefix'])){
$dataqry = "SELECT * FROM humo_trees LEFT JOIN humo_tree_texts
ON humo_trees.tree_id=humo_tree_texts.treetext_tree_id
AND humo_tree_texts.treetext_language='".$selected_language."'
WHERE tree_prefix='".$tree_prefix_quoted."'";
@$datasql = $dbh->query($dataqry);
@$dataDb = @$datasql->fetch(PDO::FETCH_OBJ);
}
$tree_prefix=$dataDb->tree_prefix;
$db_functions->set_tree_prefix($tree_prefix);
$tree_id=$dataDb->tree_id;
$db_functions->set_tree_id($tree_id);
}
if($hourglass===false) {
$family_id=1; // *** Default value, normally not used... ***
if (isset($_GET["id"])){ $family_id=$_GET["id"]; }
if (isset($_POST["id"])){ $family_id=$_POST["id"]; }
}
if ($screen_mode!='ancestor_chart' AND $screen_mode!='ancestor_sheet' AND $screen_mode!='ASPDF'){
// *** Source presentation selected by user (title/ footnote or hide sources) ***
// *** Default setting is selected by administrator ***
if (isset($_GET['source_presentation'])){
$_SESSION['save_source_presentation']=safe_text($_GET["source_presentation"]);
}
$source_presentation=$user['group_source_presentation'];
if (isset($_SESSION['save_source_presentation'])){
$source_presentation=$_SESSION['save_source_presentation'];
}
else{
// *** Save setting in session (if no choice is made, this is admin default setting) ***
$_SESSION['save_source_presentation']=safe_text($source_presentation);
}
}
if($screen_mode!='PDF' AND $screen_mode!='RTF' AND $screen_mode!="ancestor_sheet" AND $screen_mode!='ASPDF' AND $hourglass===false) {
echo '<div class="standard_header fonts">';
if ($screen_mode=='ancestor_chart'){
echo __('Ancestor chart');
}
else {
echo __('Ancestor report');
//if($user["group_pdf_button"]=='y' AND $language["dir"]!="rtl") {
if($user["group_pdf_button"]=='y' AND $language["dir"]!="rtl" AND $language["name"]!="简体中文") {
// Show pdf button
print ' <form method="POST" action="'.$uri_path.'report_ancestor.php?show_sources=1" style="display : inline;">';
print '<input type="hidden" name="id" value="'.$family_id.'">';
print '<input type="hidden" name="database" value="'.$_SESSION['tree_prefix'].'">';
print '<input type="hidden" name="screen_mode" value="PDF">';
print '<input class="fonts" type="Submit" name="submit" value="'.__('PDF Report').'">';
print '</form>';
}
if($user["group_rtf_button"]=='y' AND $language["dir"]!="rtl") {
// Show rtf button
print ' <form method="POST" action="'.$uri_path.'report_ancestor.php?show_sources=1" style="display : inline;">';
print '<input type="hidden" name="id" value="'.$family_id.'">';
print '<input type="hidden" name="database" value="'.$_SESSION['tree_prefix'].'">';
print '<input type="hidden" name="screen_mode" value="RTF">';
print '<input class="fonts" type="Submit" name="submit" value="'.__('RTF Report').'">';
print '</form>';
}
}
echo '</div>';
}
if($screen_mode=='PDF') {
//initialize pdf generation
$pdfdetails=array();
$pdf_marriage=array();
$pdf=new PDF();
$pers = $dbh->query("SELECT * FROM humo_persons WHERE pers_tree_id='".$tree_id."' AND pers_gedcomnumber='".$family_id."'");
@$persDb = $pers->fetch(PDO::FETCH_OBJ);
// *** Use person class ***
$pers_cls = New person_cls;
$pers_cls->construct($persDb);
$name=$pers_cls->person_name($persDb);
$title=pdf_convert(__('Ancestor report').__(' of ').$name["standard_name"]);
$pdf->SetTitle($title);
$pdf->SetAuthor('Huub Mons (pdf: Yossi Beck)');
$pdf->AddPage();
$pdf->SetFont('Arial','B',15);
$pdf->Ln(4);
$name=$pers_cls->person_name($persDb);
$pdf->MultiCell(0,10,__('Ancestor report').__(' of ').$name["standard_name"],0,'C');
$pdf->Ln(4);
$pdf->SetFont('Arial','',12);
}
if($screen_mode=='RTF') { // initialize rtf generation
require_once 'include/phprtflite/lib/PHPRtfLite.php';
// *** registers PHPRtfLite autoloader (spl) ***
PHPRtfLite::registerAutoloader();
// *** rtf document instance ***
$rtf = new PHPRtfLite();
// *** Add section ***
$sect = $rtf->addSection();
// *** RTF Settings ***
$arial10 = new PHPRtfLite_Font(10, 'Arial');
$arial12 = new PHPRtfLite_Font(12, 'Arial');
$arial14 = new PHPRtfLite_Font(14, 'Arial', '#000066');
//Fonts
$fontHead = new PHPRtfLite_Font(12, 'Arial');
$fontSmall = new PHPRtfLite_Font(3);
$fontAnimated = new PHPRtfLite_Font(10);
$fontLink = new PHPRtfLite_Font(10, 'Helvetica', '#0000cc');
$parNames = new PHPRtfLite_ParFormat();
$parNames->setBackgroundColor('#FFFFFF');
$parNames->setIndentLeft(0);
$parNames->setSpaceBefore(0);
$parNames->setSpaceAfter(0);
$parHead = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
$parHead->setSpaceBefore(3);
$parHead->setSpaceAfter(8);
$parHead->setBackgroundColor('#baf4c1');
$parGen = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
$parGen->setSpaceBefore(0);
$parGen->setSpaceAfter(8);
$parGen->setBackgroundColor('#baf4c1');
$parSimple = new PHPRtfLite_ParFormat();
$parSimple->setIndentLeft(2.5);
$parSimple->setIndentRight(0.5);
// *** Generate title of RTF file ***
$pers = $dbh->query("SELECT * FROM humo_persons WHERE pers_tree_id='".$tree_id."' AND pers_gedcomnumber='$family_id'");
@$persDb = $pers->fetch(PDO::FETCH_OBJ);
// *** Use person class ***
$pers_cls = New person_cls;
$pers_cls->construct($persDb);
$name=$pers_cls->person_name($persDb);
$title=__('Ancestor report').__(' of ').$name["standard_name"];
//$sect->writeText($title, $arial14, new PHPRtfLite_ParFormat());
$sect->writeText($title, $arial14, $parHead);
$file_name=date("Y_m_d_H_i_s").'.rtf';
// *** FOR TESTING PURPOSES ONLY ***
if (@file_exists("../gedcom-bestanden")) $file_name='../gedcom-bestanden/'.$file_name;
else $file_name='tmp_files/'.$file_name;
// *** Automatically remove old RTF files ***
$dh = opendir('tmp_files');
while (false !== ($filename = readdir($dh))) {
if (substr($filename, -3) == "rtf"){
//echo 'tmp_files/'.$filename.'<br>';
// *** Remove files older then today ***
if (substr($filename,0,10)!=date("Y_m_d")) unlink('tmp_files/'.$filename);
}
}
//echo $file_name;
}
if ($screen_mode!='ancestor_chart' AND $screen_mode!='ancestor_sheet' AND $screen_mode!='ASPDF'){
$ancestor_array2[] = $family_id;
$ancestor_number2[]=1;
$marriage_gedcomnumber2[]=0;
$generation = 1;
$language["gen1"]='';
if (__('PROBANT')!='PROBANT'){ $language["gen1"].=__('PROBANT'); }
$language["gen2"]=__('Parents');
$language["gen3"]=__('Grandparents');
$language["gen4"]=__('Great-Grandparents');
$language["gen5"]=__('Great Great-Grandparents');
$language["gen6"]=__('3rd Great-Grandparents');
$language["gen7"]=__('4th Great-Grandparents');
$language["gen8"]=__('5th Great-Grandparents');
$language["gen9"]=__('6th Great-Grandparents');
$language["gen10"]=__('7th Great-Grandparents');
$language["gen11"]=__('8th Great-Grandparents');
$language["gen12"]=__('9th Great-Grandparents');
$language["gen13"]=__('10th Great-Grandparents');
$language["gen14"]=__('11th Great-Grandparents');
$language["gen15"]=__('12th Great-Grandparents');
$language["gen16"]=__('13th Great-Grandparents');
$language["gen17"]=__('14th Great-Grandparents');
$language["gen18"]=__('15th Great-Grandparents');
$language["gen19"]=__('16th Great-Grandparents');
$language["gen20"]=__('17th Great-Grandparents');
$language["gen21"]=__('18th Great-Grandparents');
$language["gen22"]=__('19th Great-Grandparents');
$language["gen23"]=__('20th Great-Grandparents');
$language["gen24"]=__('21th Great-Grandparents');
$language["gen25"]=__('22th Great-Grandparents');
$language["gen26"]=__('23th Great-Grandparents');
$language["gen27"]=__('24th Great-Grandparents');
$language["gen28"]=__('25th Great-Grandparents');
$language["gen29"]=__('26th Great-Grandparents');
$language["gen30"]=__('27th Great-Grandparents');
$language["gen31"]=__('28th Great-Grandparents');
$language["gen32"]=__('29th Great-Grandparents');
$language["gen33"]=__('30th Great-Grandparents');
$language["gen34"]=__('31th Great-Grandparents');
$language["gen35"]=__('32th Great-Grandparents');
$language["gen36"]=__('33th Great-Grandparents');
$language["gen37"]=__('34th Great-Grandparents');
$language["gen38"]=__('35th Great-Grandparents');
$language["gen39"]=__('36th Great-Grandparents');
$language["gen40"]=__('37th Great-Grandparents');
$language["gen41"]=__('38th Great-Grandparents');
$language["gen42"]=__('39th Great-Grandparents');
$language["gen43"]=__('40th Great-Grandparents');
$language["gen44"]=__('41th Great-Grandparents');
$language["gen45"]=__('42th Great-Grandparents');
$language["gen46"]=__('43th Great-Grandparents');
$language["gen47"]=__('44th Great-Grandparents');
$language["gen48"]=__('45th Great-Grandparents');
$language["gen49"]=__('46th Great-Grandparents');
$language["gen50"]=__('47th Great-Grandparents');
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo '<table style="border-style:none" align="center"><tr><td></td></tr>';
}
$listed_array=array();
// *** Loop for ancestor report ***
while (isset($ancestor_array2[0])){
unset($ancestor_array);
$ancestor_array=$ancestor_array2;
unset($ancestor_array2);
unset($ancestor_number);
$ancestor_number=$ancestor_number2;
unset($ancestor_number2);
unset($marriage_gedcomnumber);
$marriage_gedcomnumber=$marriage_gedcomnumber2;
unset($marriage_gedcomnumber2);
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo '</table>';
echo '<div class="standard_header fonts">'.__('generation ').$rom_nr[$generation];
if (isset($language["gen".$generation]) AND $language["gen".$generation]){
echo ' ('.$language["gen".$generation].')';
}
echo '</div><br>';
echo '<table class="humo standard" align="center">';
}
elseif($screen_mode=="RTF") {
$rtf_text=__('generation ').$rom_nr[$generation];
$sect->writeText($rtf_text, $arial14, $parGen);
}
else {
//echo 'pdf generation<br>';
$pdf->Cell(0,2,"",0,1);
$pdf->SetFont('Arial','BI',14);
$pdf->SetFillColor(200,220,255);
if($pdf->GetY() > 260) { $pdf->AddPage(); $pdf->SetY(20); }
if (isset($language["gen".$generation]) AND $language["gen".$generation]){
$pdf->Cell(0,8,pdf_convert(__('generation ').$rom_nr[$generation].' ('.$language["gen".$generation].')'),0,1,'C',true);
}
else {
$pdf->Cell(0,8,pdf_convert(__('generation ').$rom_nr[$generation]),0,1,'C',true);
}
$pdf->SetFont('Arial','',12);
}
// *** Loop per generation ***
for ($i=0; $i<count($ancestor_array); $i++) {
$listednr='';
// Check this code, can be improved?
foreach ($listed_array as $key => $value) {
if($value==$ancestor_array[$i]) {$listednr=$key;}
// if person was already listed, $listednr gets kwartier number for reference in report:
// instead of person's details it will say: "already listed above under number 4234"
// and no additional ancestors will be looked for, to prevent duplicated branches
}
if($listednr=='') { //if not listed yet, add person to array
$listed_array[$ancestor_number[$i]]=$ancestor_array[$i];
}
if ($ancestor_array[$i]!='0'){
@$person_manDb = $db_functions->get_person($ancestor_array[$i]);
$man_cls = New person_cls;
$man_cls->construct($person_manDb);
$privacy_man=$man_cls->privacy;
// for pdf function pdf_ancestor_name() further along
//$sexe=$person_manDb->pers_sexe;
if (strtolower($person_manDb->pers_sexe)=='m' AND $ancestor_number[$i]>1){
@$familyDb = $db_functions->get_family($marriage_gedcomnumber[$i]);
// *** Use privacy filter of woman ***
@$person_womanDb = $db_functions->get_person($familyDb->fam_woman);
$woman_cls = New person_cls;
$woman_cls->construct($person_womanDb);
$privacy_woman=$woman_cls->privacy;
// *** Use class for marriage ***
$marriage_cls = New marriage_cls;
$marriage_cls->construct($familyDb, $privacy_man, $privacy_woman);
$family_privacy=$marriage_cls->privacy;
}
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo '<tr><td valign="top" width="80" nowrap><b>'.$ancestor_number[$i].
'</b> ('.floor($ancestor_number[$i]/2).')</td>';
echo '<td>';
//*** Show data man ***
echo '<div class="parent1">';
// *** Use "child", to show a link for own family. ***
echo $man_cls->name_extended("child");
if ($listednr=='') {
echo $man_cls->person_data("standard", $ancestor_array[$i]);
}
else { // person was already listed
echo ' <strong> ('.__('Allready listed above as number ').$listednr.') </strong>';
}
echo '</div>';
echo '</td></tr>';
}
elseif($screen_mode == "RTF") {
$sect->writeText('', $arial12, new PHPRtfLite_ParFormat());
$table = $sect->addTable();
$table->addRow(1);
$table->addColumnsList(array(2,0.5,14));
$rtf_text = $ancestor_number[$i]."(".floor($ancestor_number[$i]/2).")";
$cell = $table->getCell(1, 1);
$cell->writeText($rtf_text, $arial10, $parNames);
$rtf_text = strip_tags($man_cls->name_extended("child"),"<b><i>");
$cell = $table->getCell(1, 2);
if ($person_manDb->pers_sexe=="M")
$cell->addImage('images/man.jpg', null);
elseif ($person_manDb->pers_sexe=="F")
$cell->addImage(CMS_ROOTPATH.'images/woman.jpg', null);
else
$cell->addImage(CMS_ROOTPATH.'images/unknown.jpg', null);
$cell = $table->getCell(1, 3);
$cell->writeText($rtf_text, $arial12, $parNames);
if ($listednr=='') {
$rtf_text=strip_tags($man_cls->person_data("standard", $ancestor_array[$i]),"<b><i>");
$rtf_text = substr($rtf_text,0,-1); // take off newline
}
else { // person was already listed
$rtf_text=strip_tags('('.__('Allready listed above as number ').$listednr.') ',"<b><i>");
}
$cell->writeText($rtf_text, $arial12, $parNames);
$result = show_media($person_manDb,'');
if(isset($result[1]) AND count($result[1])>0) {
$break=1; $textarr = Array(); $goodpics=FALSE;
foreach($result[1] as $key => $value) {
if (strpos($key,"path")!==FALSE) {
$type = substr($result[1][$key],-3);
if($type=="jpg" OR $type=="png") {
if($goodpics==FALSE) { //found 1st pic - make table
$table2 = $sect->addTable();
$table2->addRow(0.1);
$table2->addColumnsList(array(2.5,5,5));
$goodpics=TRUE;
}
$break++;
$cell = $table2->getCell(1, $break);
$imageFile = $value;
$image = $cell->addImage($imageFile);
$txtkey = str_replace("pic_path","pic_text",$key);
if(isset($result[1][$txtkey])) {
$textarr[]=$result[1][$txtkey];
}
else { $textarr[]=" "; }
}
}
if($break==3) break; // max 2 pics
}
$break1=1;
if(count($textarr)>0) {
$table2->addRow(0.1); //add row only if there is photo text
foreach($textarr as $value) {
$break1++;
$cell = $table2->getCell(2, $break1);
$cell->writeText($value);
}
}
}
}
else {
// pdf NUMBER + MAN NAME + DATA
$pdf->pdf_ancestor_name($ancestor_number[$i],$person_manDb->pers_sexe,$man_cls->name_extended("child"));
if($listednr=='') {
$pdfdetails= $man_cls->person_data("standard",$ancestor_array[$i]);
if($pdfdetails) {
$pdf->pdfdisplay($pdfdetails,"ancestor");
}
elseif ($ancestor_number[$i]>9999) {
$pdf->Ln(8); // (number) was placed under previous number
// and there's no data so we have to move 1 line down for next person
}
}
else { // person was already listed
$thisx=$pdf->GetX();
$pdf->SetX($thisx+28);
$pdf->Write(8,__('Allready listed above as number ').$listednr."\n");
$pdf->SetX($thisx);
}
$temp=0;
$temp=floor($ancestor_number[$i]%2);
if($ancestor_number[$i]>1 AND $temp==1 AND $i+1<count($ancestor_array)) {
// if we're not in first generation (one person)
// and we are after writing the woman's details
// and there is at least one person of another family to come in this generation
// then place a devider line
$pdf->Cell(0,1,"",'B',1);
$pdf->Ln(1);
}
}
// Show own marriage (new line, after man)
if (strtolower($person_manDb->pers_sexe)=='m' AND $ancestor_number[$i]>1){
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo '<tr><td> </td><td>';
echo '<span class="marriage">';
}
// *** $family_privacy='1' betekent filteren ***
if ($family_privacy){
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo __(' to: ');
}
elseif($screen_mode=="RTF") {
$rtf_text = __(' to: ');
$sect->writeText($rtf_text, $arial12, $parSimple);
}
else {
$pdf->SetX(37);
$pdf->Write(6,__(' to: ')."\n");
}
// If privacy filter is activated, show divorce
if ($familyDb->fam_div_date OR $familyDb->fam_div_place){
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo ' <span class="divorse">('.trim(__('divorced ')).')</span>';
}
elseif($screen_mode=="RTF") {
$rtf_text = trim(__('divorced '));
$sect->writeText($rtf_text, $arial12, $parSimple);
}
else {
$pdf->Write(6,' ('.trim(__('divorced ')).')');
}
}
// Show end of relation here?
//if ($familyDb->fam_relation_end_date){
// echo ' <span class="divorse">('.trim(__('divorced ')).')</span>';
//}
}
else{
if($screen_mode!='PDF' AND $screen_mode!='RTF' ) {
echo $marriage_cls->marriage_data();
}
elseif($screen_mode=="RTF") {
$rtf_text = strip_tags($marriage_cls->marriage_data(),"<b><i>");
$sect->writeText($rtf_text, $arial12, $parSimple);
}
else {
//show pdf MARRIAGE DATA
$pdf_marriage=$marriage_cls->marriage_data();
if($pdf_marriage) {
$pdf->displayrel($pdf_marriage,"ancestor");
}
}
}
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo '</span>';
echo '</td></tr>';
}
}
// == Check for parents
if ($person_manDb->pers_famc AND $listednr==''){
@$family_parentsDb = $db_functions->get_family($person_manDb->pers_famc);
if ($family_parentsDb->fam_man){
$ancestor_array2[] = $family_parentsDb->fam_man;
$ancestor_number2[]=(2*$ancestor_number[$i]);
$marriage_gedcomnumber2[]=$person_manDb->pers_famc;
}
if ($family_parentsDb->fam_woman){
$ancestor_array2[]= $family_parentsDb->fam_woman;
$ancestor_number2[]=(2*$ancestor_number[$i]+1);
$marriage_gedcomnumber2[]=$person_manDb->pers_famc;
}
else{
// *** N.N. name ***
$ancestor_array2[]= '0';
$ancestor_number2[]=(2*$ancestor_number[$i]+1);
$marriage_gedcomnumber2[]=$person_manDb->pers_famc;
}
}
} else{
// *** Show N.N. person ***
@$person_manDb = $db_functions->get_person($ancestor_array[$i]);
$man_cls = New person_cls;
$man_cls->construct($person_manDb);
$privacy_man=$man_cls->privacy;
if($screen_mode!='PDF' AND $screen_mode!='RTF') {
echo '<tr><td valign="top" width="80" nowrap><b>'.$ancestor_number[$i].
'</b> ('.floor($ancestor_number[$i]/2).')</td>';
echo '<td>';
//*** Show person_data of man ***
echo '<div class="parent1">';
// *** Use "child", to show a link to own family. ***
echo $man_cls->name_extended("child");
echo $man_cls->person_data("standard", $ancestor_array[$i]);
echo '</div>';
echo '</td></tr>';
}
elseif($screen_mode == "RTF") {
$sect->writeText('', $arial12, new PHPRtfLite_ParFormat());
$table = $sect->addTable();
$table->addRow(1);
$table->addColumnsList(array(2,0.5,14));
$rtf_text = $ancestor_number[$i]."(".floor($ancestor_number[$i]/2).")";
$cell = $table->getCell(1, 1);
$cell->writeText($rtf_text, $arial10, $parNames);
$cell = $table->getCell(1, 2);
if ($person_manDb AND $person_manDb->pers_sexe=="M")
$cell->addImage('images/man.jpg', null);
elseif ($person_manDb AND $person_manDb->pers_sexe=="F")
$cell->addImage(CMS_ROOTPATH.'images/woman.jpg', null);
else
$cell->addImage(CMS_ROOTPATH.'images/unknown.jpg', null);
$rtf_text = strip_tags($man_cls->name_extended("child"),"<b><i>");
$cell = $table->getCell(1, 3);
$cell->writeText($rtf_text, $arial12, $parNames);
$rtf_text=strip_tags($man_cls->person_data("standard", $ancestor_array[$i]),"<b><i>");
$rtf_text = substr($rtf_text,0,-1); // take off newline
$cell->writeText($rtf_text, $arial12, $parNames);
}
else {
// pdf NUMBER + NAME + DATA NN PERSON
//$pdf->pdf_ancestor_name($ancestor_number[$i],$person_manDb->pers_sexe,$man_cls->name_extended("child"));
$pdf->pdf_ancestor_name($ancestor_number[$i],'',__('N.N.'));
$pdfdetails= $man_cls->person_data("standard",$ancestor_array[$i]);
if($pdfdetails) {
$pdf->pdfdisplay($pdfdetails,"ancestor");
}
elseif ($ancestor_number[$i]>9999) {
$pdf->Ln(8); // (number) was placed under previous number
// and there's no data so we have to move 1 line down for next person
}
$temp=0;
$temp=floor($ancestor_number[$i]%2);
if($ancestor_number[$i]>1 AND $temp==1 AND $i+1<count($ancestor_array)) {
// if we're not in first generation (one person)
// and we are after writing the woman's details
// and there is at least one person of another family to come in this generation
// then place a divider line between the families in this generation
$pdf->Cell(0,1,"",'B',1);
$pdf->Ln(1);
}
}
}
} // loop per generation
$generation++;
} // loop ancestor report
} // *** End of ancestor report
else{ // = ancestor chart, OR ancestor sheet OR PDF of ancestor sheet
// The following is used for ancestor chart, ancestor sheet and ancestor sheet PDF (ASPDF)
// person 01
$personDb = $db_functions->get_person($family_id);
$gedcomnumber[1]= $personDb->pers_gedcomnumber;
$pers_famc[1]=$personDb->pers_famc;
$sexe[1]=$personDb->pers_sexe;
$parent_array[2]=''; $parent_array[3]='';
if ($pers_famc[1]){
$parentDb = $db_functions->get_family($pers_famc[1]);
$parent_array[2]=$parentDb->fam_man; $parent_array[3]=$parentDb->fam_woman ;
$marr_date_array[2]=$parentDb->fam_marr_date ; $marr_place_array[2]=$parentDb->fam_marr_place ;
}
// end of person 1
// Loop to find person data
$count_max = 64;
if($hourglass===true) { $count_max = pow(2,$chosengenanc); }
for ($counter = 2; $counter < $count_max; $counter++){
$gedcomnumber[$counter]= '';
$pers_famc[$counter]= '';
$sexe[$counter]= '';
if ($parent_array[$counter]){
$personDb = $db_functions->get_person($parent_array[$counter]);
$gedcomnumber[$counter]= $personDb->pers_gedcomnumber;
$pers_famc[$counter]=$personDb->pers_famc;
$sexe[$counter]=$personDb->pers_sexe;
}
$Vcounter=$counter*2; $Mcounter=$Vcounter+1;
$parent_array[$Vcounter]=''; $parent_array[$Mcounter]='';
$marr_date_array[$Vcounter]=''; $marr_place_array[$Vcounter]='';
if ($pers_famc[$counter]){
$parentDb = $db_functions->get_family($pers_famc[$counter]);
$parent_array[$Vcounter]=$parentDb->fam_man; $parent_array[$Mcounter]=$parentDb->fam_woman ;
$marr_date_array[$Vcounter]=$parentDb->fam_marr_date ; $marr_place_array[$Vcounter]=$parentDb->fam_marr_place ;
}
}
// *** Function to show data ***
// box_appearance (large, medium, small, and some other boxes...)
function ancestor_chart_person($id, $box_appearance){
global $dbh, $db_functions, $tree_prefix_quoted, $humo_option, $user;
global $marr_date_array, $marr_place_array;
global $gedcomnumber, $language, $screen_mode, $dirmark1, $dirmark2;
$hour_value=''; // if called from hourglass.php size of chart is given in box_appearance as "hour45" etc.
if(strpos($box_appearance,"hour")!==false) { $hour_value=substr($box_appearance,4); }
$text=''; $popup='';
if ($gedcomnumber[$id]){
@$personDb = $db_functions->get_person($gedcomnumber[$id]);
$person_cls = New person_cls;
$person_cls->construct($personDb);
$pers_privacy=$person_cls->privacy;
$name=$person_cls->person_name($personDb);
if ($screen_mode=="ancestor_sheet" OR $language["dir"]=="rtl") {
$name2=$name["name"];
}
else {
//$name2=$name["short_firstname"];
$name2=$name["name"];
}
$name2=$dirmark2.$name2.$name["colour_mark"].$dirmark2;
// *** Replace pop-up icon by a text box ***
$replacement_text='';
if ($screen_mode=="ancestor_sheet") { // *** Ancestor sheet: name bold, id not ***
//$replacement_text.=$id.' <b>'.$name2.'</b>';
$replacement_text.='<b>'.$name2.'</b>';
}
else {
//$replacement_text.='<b>'.$id.'</b>'; // *** Ancestor number: id bold, name not ***
$replacement_text.='<span class="anc_box_name">'.$name2.'</span>';
}
// >>>>> link to show rest of ancestor chart
//if ($box_appearance=='small' AND isset($personDb->pers_gedcomnumber) AND $screen_mode!="ancestor_sheet"){
if ($box_appearance=='small' AND isset($personDb->pers_gedcomnumber) AND $personDb->pers_famc AND $screen_mode!="ancestor_sheet"){
//$replacement_text.= ' <a href="'.$_SERVER['PHP_SELF'].'?id='.$personDb->pers_gedcomnumber.
// "&screen_mode=ancestor_chart\">>>></a> ";
$replacement_text.=' >>>'.$dirmark1;
}
if ($pers_privacy){
if($box_appearance!='ancestor_sheet_marr') {
$replacement_text.='<br>'.__(' PRIVACY FILTER'); //Tekst privacy weergeven
}
else {
$replacement_text = __(' PRIVACY FILTER');
}
}
else{
if ($box_appearance!='small'){
//if ($personDb->pers_birth_date OR $personDb->pers_birth_place){
if ($personDb->pers_birth_date){
//$replacement_text.='<br>'.__('*').$dirmark1.' '.date_place($personDb->pers_birth_date,$personDb->pers_birth_place); }
$replacement_text.='<br>'.__('*').$dirmark1.' '.date_place($personDb->pers_birth_date,''); }
//elseif ($personDb->pers_bapt_date OR $personDb->pers_bapt_place){
elseif ($personDb->pers_bapt_date){
//$replacement_text.='<br>'.__('~').$dirmark1.' '.date_place($personDb->pers_bapt_date,$personDb->pers_bapt_place); }
$replacement_text.='<br>'.__('~').$dirmark1.' '.date_place($personDb->pers_bapt_date,''); }
//if ($personDb->pers_death_date OR $personDb->pers_death_place){
if ($personDb->pers_death_date){
//$replacement_text.='<br>'.__('†').$dirmark1.' '.date_place($personDb->pers_death_date,$personDb->pers_death_place); }
$replacement_text.='<br>'.__('†').$dirmark1.' '.date_place($personDb->pers_death_date,''); }
//elseif ($personDb->pers_buried_date OR $personDb->pers_buried_place){
elseif ($personDb->pers_buried_date){
//$replacement_text.='<br>'.__('[]').$dirmark1.' '.date_place($personDb->pers_buried_date,$personDb->pers_buried_place); }
$replacement_text.='<br>'.__('[]').$dirmark1.' '.date_place($personDb->pers_buried_date,''); }
if ($box_appearance!='medium'){
$marr_date=''; if (isset($marr_date_array[$id]) AND ($marr_date_array[$id]!='')){
$marr_date=$marr_date_array[$id]; }
$marr_place=''; if (isset($marr_place_array[$id]) AND ($marr_place_array[$id]!='')){
$marr_place=$marr_place_array[$id]; }
//if ($marr_date OR $marr_place){
if ($marr_date){
//$replacement_text.='<br>'.__('X').$dirmark1.' '.date_place($marr_date,$marr_place); }
$replacement_text.='<br>'.__('X').$dirmark1.' '.date_place($marr_date,''); }
}
if ($box_appearance=='ancestor_sheet_marr'){
$replacement_text='';
$marr_date=''; if (isset($marr_date_array[$id]) AND ($marr_date_array[$id]!='')){
$marr_date=$marr_date_array[$id]; }
$marr_place=''; if (isset($marr_place_array[$id]) AND ($marr_place_array[$id]!='')){
$marr_place=$marr_place_array[$id]; }
//if ($marr_date OR $marr_place){
if ($marr_date){
//$replacement_text=__('X').$dirmark1.' '.date_place($marr_date,$marr_place); }
$replacement_text=__('X').$dirmark1.' '.date_place($marr_date,''); }
else $replacement_text=__('X'); // if no details in the row we don't want the row to collapse
}
if ($box_appearance=='ancestor_header'){
$replacement_text='';
$replacement_text.=strip_tags($name2);
$replacement_text.= $dirmark2;
}
}
}
if($hour_value != '') { // called from hourglass
if($hour_value == '45') { $replacement_text = $name['name']; }
elseif($hour_value == '40') { $replacement_text = '<span class="wordwrap" style="font-size:75%">'.$name['short_firstname'].'</span>'; }
elseif($hour_value >20 AND $hour_value <40) { $replacement_text = $name['initials'];}
elseif($hour_value <25) { $replacement_text = " ";}
// if full scale (50) then the default of this function will be used: name with details
}
$extra_popup_text='';
$marr_date=''; if (isset($marr_date_array[$id]) AND ($marr_date_array[$id]!='')){
$marr_date=$marr_date_array[$id]; }
$marr_place=''; if (isset($marr_place_array[$id]) AND ($marr_place_array[$id]!='')){
$marr_place=$marr_place_array[$id]; }
if ($marr_date OR $marr_place){
$extra_popup_text.='<br>'.__('X').$dirmark1.' '.date_place($marr_date,$marr_place);
}
// *** Show picture by person ***
if ($box_appearance!='small' AND $box_appearance!='medium'){
// *** Show picture ***
if (!$pers_privacy AND $user['group_pictures']=='j'){
// *** Path can be changed per family tree ***
global $dataDb;
$tree_pict_path=$dataDb->tree_pict_path;
$picture_qry=$db_functions->get_events_person($personDb->pers_gedcomnumber,'picture');
// *** Only show 1st picture ***
if (isset($picture_qry[0])){
$pictureDb=$picture_qry[0];
$picture=show_picture($tree_pict_path,$pictureDb->event_event,80,70);
$text.='<img src="'.$tree_pict_path.$picture['thumb'].$picture['picture'].'" style="float:left; margin:5px;" alt="'.$pictureDb->event_text.'" width="'.$picture['width'].'">';
}
}
}
if ($box_appearance=='ancestor_sheet_marr' OR $box_appearance=='ancestor_header' ){ // cause in that case there is no link
$text.= $replacement_text;
}
else{
$text.=$person_cls->person_popup_menu($personDb,true,$replacement_text,$extra_popup_text);
}
}
return $text."\n";
}
// *** End of function ancestor_chart_person ***
// Specific code for ancestor chart:
if($screen_mode!="ancestor_sheet" AND $screen_mode!= "ASPDF" AND $hourglass===false) {
echo '<script type="text/javascript" src="include/jqueryui/js/html2canvas.js"></script>';
echo '<script type="text/javascript" src="include/jqueryui/js/jquery.plugin.html2canvas.js"></script>';
echo '<div style="text-align:center;">';
echo '<br><input type="button" id="imgbutton" value="'.__('Get image of chart for printing (allow popup!)').'" onClick="showimg();">';
echo '</div>';
$divlen = 1000;
// width of the chart. for 6 generations 1000px is right
// if we ever make the anc chart have optionally more generations, the width and length will have to be generated
// as in dreport_descendant.php
//following div gets width and length in imaging java function showimg() (at bottom) otherwise double scrollbars won't work.
echo '<div id="png">';
echo '
<style type="text/css">
#doublescroll { position:relative; width:auto; height:1100px; overflow: auto; overflow-y: hidden; }
#doublescroll p { margin: 0; padding: 1em; white-space: nowrap; }
</style>
';
echo '<div id="doublescroll">';
// *** First column name ***
$left=10;
$sexe_colour=''; $backgr_col = "#FFFFFF";
//if ($sexe[1] == 'F'){ $sexe_colour=' ancestor_woman'; }
//if ($sexe[1] == 'M'){ $sexe_colour=' ancestor_man'; }
if ($sexe[1] == 'F'){ $sexe_colour=' ancestor_woman'; $backgr_col = "#FBDEC0"; }
if ($sexe[1] == 'M'){ $sexe_colour=' ancestor_man'; $backgr_col = "#C0F9FC";}
//echo '<div class="ancestor_name'.$sexe_colour.'" style="top: 520px; left: '.$left.'px; height: 80px; width:180px;';
//echo '<div class="ancestor_name'.$sexe_colour.'" align="left" style="top: 520px; left: '.$left.'px; height: 80px; width:200px;';
echo '<div class="ancestor_name'.$sexe_colour.'" align="left" style="background-color:'.$backgr_col.'; top: 520px; left: '.$left.'px; height: 80px; width:200px;';
echo '">';
echo ancestor_chart_person('1', 'large');
echo '</div>';
$left=50;
$top=320;
// *** Second column split ***
echo '<div class="ancestor_split" style="top: '.$top.'px; left: '.$left.'px; height: 199px"></div>';
echo '<div class="ancestor_split" style="top: '.($top+281).'px; left: '.$left.'px; height: 199px"></div>';
// *** Second column names ***
for ($i=1; $i<3; $i++){
$sexe_colour=''; $backgr_col = "#FFFFFF";
//if ($sexe[$i+1] == 'F'){ $sexe_colour=' ancestor_woman'; }
//if ($sexe[$i+1] == 'M'){ $sexe_colour=' ancestor_man'; }
if ($sexe[$i+1] == 'F'){ $sexe_colour=' ancestor_woman'; $backgr_col = "#FBDEC0"; }
if ($sexe[$i+1] == 'M'){ $sexe_colour=' ancestor_man'; $backgr_col = "#C0F9FC";}
echo '<div class="ancestor_name'.$sexe_colour.'" style="background-color:'.$backgr_col.'; top: '.(($top-520)+($i*480)).'px; left: '.($left+8).'px; height: 80px; width:200px;';
echo '">';
echo ancestor_chart_person($i+1, 'large');
echo '</div>';
}
$left=80;
$top=199;
// *** Third column split ***
echo '<div class="ancestor_split" style="top: '.$top.'px; left: '.($left+32).'px; height: 80px;"></div>';
echo '<div class="ancestor_split" style="top: '.($top+162).'px; left: '.($left+32).'px; height: 80px;"></div>';
echo '<div class="ancestor_split" style="top: '.($top+480).'px; left: '.($left+32).'px; height: 80px;"></div>';
echo '<div class="ancestor_split" style="top: '.($top+642).'px; left: '.($left+32).'px; height: 80px;"></div>';
// *** Third column names ***
for ($i=1; $i<5; $i++){
$sexe_colour=''; $backgr_col = "#FFFFFF";
//if ($sexe[$i+3] == 'F'){ $sexe_colour=' ancestor_woman'; }
//if ($sexe[$i+3] == 'M'){ $sexe_colour=' ancestor_man'; }
if ($sexe[$i+3] == 'F'){ $sexe_colour=' ancestor_woman'; $backgr_col = "#FBDEC0";}
if ($sexe[$i+3] == 'M'){ $sexe_colour=' ancestor_man'; $backgr_col = "#C0F9FC";}
echo '<div class="ancestor_name'.$sexe_colour.'" style="background-color:'.$backgr_col.'; top: '.(($top-279)+($i*240)).'px; left: '.($left+40).'px; height: 80px; width:200px;';
echo '">';
echo ancestor_chart_person($i+3, 'large');
echo '</div>';
}
$left=300;
$top=-290;
// *** Fourth column line ***
for ($i=1; $i<3; $i++){
echo '<div class="ancestor_line" style="top: '.($top+($i*485)).'px; left: '.($left+24).'px; height: 240px;"></div>';
}
// *** Fourth column split ***
for ($i=1; $i<5; $i++){
echo '<div class="ancestor_split" style="top: '.(($top+185)+($i*240)).'px; left: '.($left+32).'px; height: 120px;"></div>';
}
// *** Fourth column names ***
for ($i=1; $i<9; $i++){
$sexe_colour=''; $backgr_col = "#FFFFFF";
//if ($sexe[$i+7] == 'F'){ $sexe_colour=' ancestor_woman'; }
//if ($sexe[$i+7] == 'M'){ $sexe_colour=' ancestor_man'; }
if ($sexe[$i+7] == 'F'){ $sexe_colour=' ancestor_woman'; $backgr_col = "#FBDEC0";}
if ($sexe[$i+7] == 'M'){ $sexe_colour=' ancestor_man'; $backgr_col = "#C0F9FC";}
echo '<div class="ancestor_name'.$sexe_colour.'" style="background-color:'.$backgr_col.'; top: '.(($top+265)+($i*120)).'px; left: '.($left+40).'px; height: 80px; width:200px;';
echo '">';
echo ancestor_chart_person($i+7, 'large');
echo '</div>';
}
$left=520;
$top=-110;
// *** Fifth column line ***
for ($i=1; $i<5; $i++){
echo '<div class="ancestor_line" style="top: '.($top+($i*240)).'px; left: '.($left+24).'px; height: 120px;"></div>';
}
// *** Fifth column split ***
for ($i=1; $i<9; $i++){
echo '<div class="ancestor_split" style="top: '.(($top+90)+($i*120)).'px; left: '.($left+32).'px; height: 60px;"></div>';
}
// *** Fifth column names ***
for ($i=1; $i<17; $i++){
$sexe_colour=''; $backgr_col = "#FFFFFF";
//if ($sexe[$i+15] == 'F'){ $sexe_colour=' ancestor_woman'; }
//if ($sexe[$i+15] == 'M'){ $sexe_colour=' ancestor_man'; }
if ($sexe[$i+15] == 'F'){ $sexe_colour=' ancestor_woman'; $backgr_col = "#FBDEC0";}
if ($sexe[$i+15] == 'M'){ $sexe_colour=' ancestor_man'; $backgr_col = "#C0F9FC";}
echo '<div class="ancestor_name'.$sexe_colour.'" style="background-color:'.$backgr_col.'; top: '.(($top+125)+($i*60)).'px; left: '.($left+40).'px; height: 50px; width:200px;';
echo '">';
echo ancestor_chart_person($i+15, 'medium');
echo '</div>';
}
$left=740;
$top=-20;
// *** Last column line ***
for ($i=1; $i<9; $i++){
echo '<div class="ancestor_line" style="top: '.($top+($i*120)).'px; left: '.($left+24).'px; height: 60px;"></div>';
}
// *** Last column split ***
for ($i=1; $i<17; $i++){
echo '<div class="ancestor_split" style="top: '.(($top+45)+($i*60)).'px; left: '.($left+32).'px; height: 30px;"></div>';
}
// *** Last column names ***
for ($i=1; $i<33; $i++){
$sexe_colour=''; $backgr_col = "#FFFFFF";
//if ($sexe[$i+31] == 'F'){ $sexe_colour=' ancestor_woman'; }
//if ($sexe[$i+31] == 'M'){ $sexe_colour=' ancestor_man'; }
if ($sexe[$i+31] == 'F'){ $sexe_colour=' ancestor_woman'; $backgr_col = "#FBDEC0"; }
if ($sexe[$i+31] == 'M'){ $sexe_colour=' ancestor_man'; $backgr_col = "#C0F9FC";}
echo '<div class="ancestor_name'.$sexe_colour.'" style="background-color:'.$backgr_col.'; top: '.(($top+66)+($i*30)).'px; left: '.($left+40).'px; height:16px; width:200px;';
echo '">';
echo ancestor_chart_person($i+31, 'small');
echo '</div>';
}
echo '</div>';
echo '<div>';
// YB:
// before creating the image we want to hide unnecessary items such as the help link, the menu box etc
// we also have to set the width and height of the "png" div (this can't be set before because then the double scrollbars won't work
// after generating the image, all those items are returned to their previous state....
echo '<script type="text/javascript">';
echo "
function showimg() {
/* document.getElementById('helppopup').style.visibility = 'hidden';
document.getElementById('menubox').style.visibility = 'hidden'; */
document.getElementById('imgbutton').style.visibility = 'hidden';
document.getElementById('png').style.width = '".$divlen."px';
document.getElementById('png').style.height= 'auto';
html2canvas( [ document.getElementById('png') ], {
onrendered: function( canvas ) {
var img = canvas.toDataURL();
/* document.getElementById('helppopup').style.visibility = 'visible';