@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | $vmax = 0; |
7 | 7 | $avg = 0; |
8 | 8 | foreach ($data as $age => $v) { |
9 | - $n = strlen($v); |
|
10 | - $vmax = max($vmax, $n); |
|
11 | - $agemax = max($agemax, $age); |
|
12 | - $count += $n; |
|
13 | - $avg += $age * $n; |
|
9 | + $n = strlen($v); |
|
10 | + $vmax = max($vmax, $n); |
|
11 | + $agemax = max($agemax, $age); |
|
12 | + $count += $n; |
|
13 | + $avg += $age * $n; |
|
14 | 14 | } |
15 | 15 | if ($count < 1) { |
16 | - return ''; |
|
16 | + return ''; |
|
17 | 17 | } |
18 | 18 | $avg = round($avg / $count); |
19 | 19 | $chart_url = 'https://chart.googleapis.com/chart?cht=bvs'; // chart type |
@@ -27,36 +27,36 @@ discard block |
||
27 | 27 | $chart_url .= '&chm=V,FF0000,0,' . ($avg - 0.3) . ',1'; // average age line marker |
28 | 28 | $chart_url .= '&chxl=0:|'; // label |
29 | 29 | for ($age = 0; $age <= $agemax; $age += 5) { |
30 | - $chart_url .= $age . '|||||'; // x axis |
|
30 | + $chart_url .= $age . '|||||'; // x axis |
|
31 | 31 | } |
32 | 32 | $chart_url .= '|1:||' . rawurlencode(I18N::percentage($vmax / $count)); // y axis |
33 | 33 | $chart_url .= '|2:||'; |
34 | 34 | $step = $vmax; |
35 | 35 | for ($d = $vmax; $d > 0; $d--) { |
36 | - if ($vmax < ($d * 10 + 1) && ($vmax % $d) == 0) { |
|
37 | - $step = $d; |
|
38 | - } |
|
36 | + if ($vmax < ($d * 10 + 1) && ($vmax % $d) == 0) { |
|
37 | + $step = $d; |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | if ($step == $vmax) { |
41 | - for ($d = $vmax - 1; $d > 0; $d--) { |
|
42 | - if (($vmax - 1) < ($d * 10 + 1) && (($vmax - 1) % $d) == 0) { |
|
43 | - $step = $d; |
|
44 | - } |
|
45 | - } |
|
41 | + for ($d = $vmax - 1; $d > 0; $d--) { |
|
42 | + if (($vmax - 1) < ($d * 10 + 1) && (($vmax - 1) % $d) == 0) { |
|
43 | + $step = $d; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | for ($n = $step; $n < $vmax; $n += $step) { |
48 | - $chart_url .= $n . '|'; |
|
48 | + $chart_url .= $n . '|'; |
|
49 | 49 | } |
50 | 50 | $chart_url .= rawurlencode($vmax . ' / ' . $count); // r axis |
51 | 51 | $chart_url .= '&chg=100,' . round(100 * $step / $vmax, 1) . ',1,5'; // grid |
52 | 52 | $chart_url .= '&chd=s:'; // data : simple encoding from A=0 to 9=61 |
53 | 53 | $CHART_ENCODING61 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
54 | 54 | for ($age = 0; $age <= $agemax; $age++) { |
55 | - $chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'M') * 61 / $vmax)]; |
|
55 | + $chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'M') * 61 / $vmax)]; |
|
56 | 56 | } |
57 | 57 | $chart_url .= ','; |
58 | 58 | for ($age = 0; $age <= $agemax; $age++) { |
59 | - $chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'F') * 61 / $vmax)]; |
|
59 | + $chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'F') * 61 / $vmax)]; |
|
60 | 60 | } |
61 | 61 | $html = '<img src="' . $chart_url . '" alt="' . $title . '" title="' . $title . '" class="gchart">'; |
62 | 62 |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | // init chart data |
71 | 71 | $marr_by_age = []; |
72 | 72 | for ($age = 0; $age <= $max_age; $age++) { |
73 | - $marr_by_age[$age] = ''; |
|
73 | + $marr_by_age[$age] = ''; |
|
74 | 74 | } |
75 | 75 | $birt_by_decade = []; |
76 | 76 | $marr_by_decade = []; |
77 | 77 | for ($year = 1550; $year < 2030; $year += 10) { |
78 | - $birt_by_decade[$year] = ''; |
|
79 | - $marr_by_decade[$year] = ''; |
|
78 | + $birt_by_decade[$year] = ''; |
|
79 | + $marr_by_decade[$year] = ''; |
|
80 | 80 | } |
81 | 81 | ?> |
82 | 82 | |
@@ -244,18 +244,18 @@ discard block |
||
244 | 244 | |
245 | 245 | <!-- Husband age --> |
246 | 246 | <?php |
247 | - $mdate = $family->getMarriageDate(); |
|
248 | - $hdate = $husb->getBirthDate(); |
|
249 | - if ($hdate->isOK() && $mdate->isOK()) { |
|
250 | - if ($hdate->gregorianYear() >= 1550 && $hdate->gregorianYear() < 2030) { |
|
251 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
252 | - } |
|
253 | - $hage = Date::getAge($hdate, $mdate, 0); |
|
254 | - if ($hage >= 0 && $hage <= $max_age) { |
|
255 | - $marr_by_age[$hage] .= $husb->getSex(); |
|
256 | - } |
|
257 | - } |
|
258 | - ?> |
|
247 | + $mdate = $family->getMarriageDate(); |
|
248 | + $hdate = $husb->getBirthDate(); |
|
249 | + if ($hdate->isOK() && $mdate->isOK()) { |
|
250 | + if ($hdate->gregorianYear() >= 1550 && $hdate->gregorianYear() < 2030) { |
|
251 | + $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
252 | + } |
|
253 | + $hage = Date::getAge($hdate, $mdate, 0); |
|
254 | + if ($hage >= 0 && $hage <= $max_age) { |
|
255 | + $marr_by_age[$hage] .= $husb->getSex(); |
|
256 | + } |
|
257 | + } |
|
258 | + ?> |
|
259 | 259 | <td class="center" data-sort="<?= Date::getAge($hdate, $mdate, 1) ?>"> |
260 | 260 | <?= Date::getAge($hdate, $mdate, 2) ?> |
261 | 261 | </td> |
@@ -280,17 +280,17 @@ discard block |
||
280 | 280 | |
281 | 281 | <!-- Wife age --> |
282 | 282 | <?php |
283 | - $wdate = $wife->getBirthDate(); |
|
284 | - if ($wdate->isOK() && $mdate->isOK()) { |
|
285 | - if ($wdate->gregorianYear() >= 1550 && $wdate->gregorianYear() < 2030) { |
|
286 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
287 | - } |
|
288 | - $wage = Date::getAge($wdate, $mdate, 0); |
|
289 | - if ($wage >= 0 && $wage <= $max_age) { |
|
290 | - $marr_by_age[$wage] .= $wife->getSex(); |
|
291 | - } |
|
292 | - } |
|
293 | - ?> |
|
283 | + $wdate = $wife->getBirthDate(); |
|
284 | + if ($wdate->isOK() && $mdate->isOK()) { |
|
285 | + if ($wdate->gregorianYear() >= 1550 && $wdate->gregorianYear() < 2030) { |
|
286 | + $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
287 | + } |
|
288 | + $wage = Date::getAge($wdate, $mdate, 0); |
|
289 | + if ($wage >= 0 && $wage <= $max_age) { |
|
290 | + $marr_by_age[$wage] .= $wife->getSex(); |
|
291 | + } |
|
292 | + } |
|
293 | + ?> |
|
294 | 294 | |
295 | 295 | <td class="center" data-sort="<?= Date::getAge($wdate, $mdate, 1) ?>"> |
296 | 296 | <?= Date::getAge($wdate, $mdate, 2) ?> |
@@ -123,49 +123,49 @@ |
||
123 | 123 | |
124 | 124 | <p class="card-text"> |
125 | 125 | <?php |
126 | - // Show file details |
|
127 | - $mediatype = $media_file->type(); |
|
128 | - if ($mediatype) { |
|
129 | - echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($mediatype)); |
|
130 | - } |
|
131 | - echo FunctionsPrintFacts::printFactSources($tree, $media_object->getGedcom(), 1); |
|
132 | - echo FunctionsPrint::printFactNotes($tree, $media_object->getGedcom(), 1); |
|
133 | - if ($media_file->isExternal()) { |
|
134 | - echo GedcomTag::getLabelValue('URL', $media_file->filename()); |
|
135 | - } elseif ($media_file->fileExists()) { |
|
136 | - ?> |
|
126 | + // Show file details |
|
127 | + $mediatype = $media_file->type(); |
|
128 | + if ($mediatype) { |
|
129 | + echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($mediatype)); |
|
130 | + } |
|
131 | + echo FunctionsPrintFacts::printFactSources($tree, $media_object->getGedcom(), 1); |
|
132 | + echo FunctionsPrint::printFactNotes($tree, $media_object->getGedcom(), 1); |
|
133 | + if ($media_file->isExternal()) { |
|
134 | + echo GedcomTag::getLabelValue('URL', $media_file->filename()); |
|
135 | + } elseif ($media_file->fileExists()) { |
|
136 | + ?> |
|
137 | 137 | <button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#details-<?= e($n) ?>" aria-expanded="false" aria-controls="details-<?= e($n) ?>"> |
138 | 138 | <?= I18N::translate('Media file') ?> |
139 | 139 | </button> |
140 | 140 | <div class="collapse" id="details-<?= e($n) ?>"> |
141 | 141 | <?php |
142 | - if (Auth::isEditor($tree)) { |
|
143 | - echo GedcomTag::getLabelValue('FILE', $media_file->filename()); |
|
144 | - } |
|
145 | - echo GedcomTag::getLabelValue('FORM', $media_file->mimeType()); |
|
146 | - foreach ($media_file->attributes() as $tag => $value) { |
|
147 | - echo GedcomTag::getLabelValue($tag, $value); |
|
148 | - } |
|
149 | - ?> |
|
142 | + if (Auth::isEditor($tree)) { |
|
143 | + echo GedcomTag::getLabelValue('FILE', $media_file->filename()); |
|
144 | + } |
|
145 | + echo GedcomTag::getLabelValue('FORM', $media_file->mimeType()); |
|
146 | + foreach ($media_file->attributes() as $tag => $value) { |
|
147 | + echo GedcomTag::getLabelValue($tag, $value); |
|
148 | + } |
|
149 | + ?> |
|
150 | 150 | </div> |
151 | 151 | <?php |
152 | - } else { |
|
153 | - echo '<p class="alert alert-danger">', /* I18N: %s is a filename */ I18N::translate('The file “%s” does not exist.', $media_file->filename()), '</p>'; |
|
154 | - } |
|
155 | - ?> |
|
152 | + } else { |
|
153 | + echo '<p class="alert alert-danger">', /* I18N: %s is a filename */ I18N::translate('The file “%s” does not exist.', $media_file->filename()), '</p>'; |
|
154 | + } |
|
155 | + ?> |
|
156 | 156 | </p> |
157 | 157 | </div> |
158 | 158 | <div class="card-footer"> |
159 | 159 | <?php |
160 | - foreach ($media_object->linkedIndividuals('OBJE') as $individual) { |
|
161 | - echo '<a href="' . e($individual->url()) . '">' . FontAwesome::semanticIcon('individual', I18N::translate('Individual')) . ' ' . $individual->getFullName() . '</a><br>'; |
|
162 | - } |
|
163 | - foreach ($media_object->linkedFamilies('OBJE') as $family) { |
|
164 | - echo '<a href="' . e($family->url()) . '">' . FontAwesome::semanticicon('family', I18N::translate('Family')) . ' ' . $family->getFullName() . '</a><br>'; |
|
165 | - } |
|
166 | - foreach ($media_object->linkedSources('OBJE') as $source) { |
|
167 | - echo '<a href="' . e($source->url()) . '">' . FontAwesome::semanticIcon('source', I18N::translate('Source')) . ' ' . $source->getFullName() . '</a><br>'; |
|
168 | - } ?> |
|
160 | + foreach ($media_object->linkedIndividuals('OBJE') as $individual) { |
|
161 | + echo '<a href="' . e($individual->url()) . '">' . FontAwesome::semanticIcon('individual', I18N::translate('Individual')) . ' ' . $individual->getFullName() . '</a><br>'; |
|
162 | + } |
|
163 | + foreach ($media_object->linkedFamilies('OBJE') as $family) { |
|
164 | + echo '<a href="' . e($family->url()) . '">' . FontAwesome::semanticicon('family', I18N::translate('Family')) . ' ' . $family->getFullName() . '</a><br>'; |
|
165 | + } |
|
166 | + foreach ($media_object->linkedSources('OBJE') as $source) { |
|
167 | + echo '<a href="' . e($source->url()) . '">' . FontAwesome::semanticIcon('source', I18N::translate('Source')) . ' ' . $source->getFullName() . '</a><br>'; |
|
168 | + } ?> |
|
169 | 169 | </div> |
170 | 170 | </div> |
171 | 171 | </div> |
@@ -20,9 +20,9 @@ |
||
20 | 20 | </label> |
21 | 21 | <div class="col-sm-9 wt-page-options-value"> |
22 | 22 | <?= FunctionsEdit::formControlIndividual($tree, null, [ |
23 | - 'id' => 'addxref', |
|
24 | - 'name' => 'addxref', |
|
25 | - ]) ?> |
|
23 | + 'id' => 'addxref', |
|
24 | + 'name' => 'addxref', |
|
25 | + ]) ?> |
|
26 | 26 | |
27 | 27 | <?= Bootstrap4::checkbox(/* I18N: Label for a configuration option */ I18N::translate('Include the individual’s immediate family'), false, ['name' => 'addfam']) ?> |
28 | 28 | </div> |
@@ -122,7 +122,7 @@ |
||
122 | 122 | <?php if ($page_hits ?? 0 > 0): ?> |
123 | 123 | <div class="wt-page-views"> |
124 | 124 | <?= I18N::plural('This page has been viewed %s time.', 'This page has been viewed %s times.', $page_hits, |
125 | - '<span class="odometer">' . I18N::digits($page_hits) . '</span>') ?> |
|
125 | + '<span class="odometer">' . I18N::digits($page_hits) . '</span>') ?> |
|
126 | 126 | </div> |
127 | 127 | <?php endif ?> |
128 | 128 |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | </label> |
18 | 18 | <div class="col-sm-9 wt-page-options-value"> |
19 | 19 | <?= FunctionsEdit::formControlIndividual($tree, $individual1, [ |
20 | - 'id' => 'xref1', |
|
21 | - 'name' => 'xref1', |
|
22 | - ]) ?> |
|
20 | + 'id' => 'xref1', |
|
21 | + 'name' => 'xref1', |
|
22 | + ]) ?> |
|
23 | 23 | <button class="btn btn-link small" id="btn-swap-individuals" type="button"> |
24 | 24 | <?= /* I18N: Reverse the order of two individuals */ |
25 | - I18N::translate('Swap individuals') ?> |
|
25 | + I18N::translate('Swap individuals') ?> |
|
26 | 26 | </button> |
27 | 27 | </div> |
28 | 28 | </div> |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | </label> |
34 | 34 | <div class="col-sm-9 wt-page-options-value"> |
35 | 35 | <?= FunctionsEdit::formControlIndividual($tree, $individual2, [ |
36 | - 'id' => 'xref2', |
|
37 | - 'name' => 'xref2', |
|
38 | - ]) ?> |
|
36 | + 'id' => 'xref2', |
|
37 | + 'name' => 'xref2', |
|
38 | + ]) ?> |
|
39 | 39 | </div> |
40 | 40 | </div> |
41 | 41 | |
@@ -73,19 +73,19 @@ discard block |
||
73 | 73 | <div class="col-form-label col-sm-3 wt-page-options-label"></div> |
74 | 74 | <div class="col-sm-9 wt-page-options-value"> |
75 | 75 | <input class="btn btn-primary" type="submit" value="<?= /* I18N: A button label. */ |
76 | - I18N::translate('view') ?>"> |
|
76 | + I18N::translate('view') ?>"> |
|
77 | 77 | </div> |
78 | 78 | </div> |
79 | 79 | </form> |
80 | 80 | |
81 | 81 | <?php if ($individual1 !== null && $individual2 !== null): ?> |
82 | 82 | <div class="wt-ajax-load wt-page-content wt-chart wt-relationships-chart" data-ajax-url="<?= e(route('relationships-chart', [ |
83 | - 'xref1' => $individual1->getXref(), |
|
84 | - 'xref2' => $individual2->getXref(), |
|
85 | - 'ged' => $individual2->getTree()->getName(), |
|
86 | - 'recursion' => $recursion, |
|
87 | - 'ancestors' => $ancestors, |
|
88 | - ])) ?>"></div> |
|
83 | + 'xref1' => $individual1->getXref(), |
|
84 | + 'xref2' => $individual2->getXref(), |
|
85 | + 'ged' => $individual2->getTree()->getName(), |
|
86 | + 'recursion' => $recursion, |
|
87 | + 'ancestors' => $ancestors, |
|
88 | + ])) ?>"></div> |
|
89 | 89 | <?php endif ?> |
90 | 90 | |
91 | 91 | <?php View::push('javascript') ?> |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | var birthmonths = []; |
15 | 15 | var birthdays = []; |
16 | 16 | <?php |
17 | - foreach ($individuals as $c => $indi) { |
|
18 | - if (!empty($birthyears[$indi->getXref()])) { |
|
19 | - echo 'birthyears[' . $c . ']=' . $birthyears[$indi->getXref()] . ';'; |
|
20 | - } |
|
21 | - if (!empty($birthmonths[$indi->getXref()])) { |
|
22 | - echo 'birthmonths[' . $c . ']=' . $birthmonths[$indi->getXref()] . ';'; |
|
23 | - } |
|
24 | - if (!empty($birthdays[$indi->getXref()])) { |
|
25 | - echo 'birthdays[' . $c . ']=' . $birthdays[$indi->getXref()] . ';'; |
|
26 | - } |
|
27 | - } |
|
28 | - ?> |
|
17 | + foreach ($individuals as $c => $indi) { |
|
18 | + if (!empty($birthyears[$indi->getXref()])) { |
|
19 | + echo 'birthyears[' . $c . ']=' . $birthyears[$indi->getXref()] . ';'; |
|
20 | + } |
|
21 | + if (!empty($birthmonths[$indi->getXref()])) { |
|
22 | + echo 'birthmonths[' . $c . ']=' . $birthmonths[$indi->getXref()] . ';'; |
|
23 | + } |
|
24 | + if (!empty($birthdays[$indi->getXref()])) { |
|
25 | + echo 'birthdays[' . $c . ']=' . $birthdays[$indi->getXref()] . ';'; |
|
26 | + } |
|
27 | + } |
|
28 | + ?> |
|
29 | 29 | |
30 | 30 | var bheight = <?= $bheight ?>; |
31 | 31 | var scale = <?= $scale ?>; |
@@ -255,134 +255,134 @@ discard block |
||
255 | 255 | <?= $baseyear ?> |
256 | 256 | </div> |
257 | 257 | <?php |
258 | - // at a scale of 25 or higher, show every year |
|
259 | - $mod = 25 / $scale; |
|
260 | - if ($mod < 1) { |
|
261 | - $mod = 1; |
|
262 | - } |
|
263 | - for ($i = $baseyear + 1; $i < $topyear; $i++) { |
|
264 | - if ($i % $mod === 0) { |
|
265 | - echo '<div id="scale' . $i . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left:0;' : 'right:0;') . ' top:' . ((($i - $baseyear) * $scale) - $scale / 2) . 'px; font-size: 7pt; text-align:' . (I18N::direction() === 'ltr' ? 'left' : 'right') . ';">'; |
|
266 | - echo $i; |
|
267 | - echo '</div>'; |
|
268 | - } |
|
269 | - } |
|
270 | - echo ''; |
|
271 | - ?> |
|
258 | + // at a scale of 25 or higher, show every year |
|
259 | + $mod = 25 / $scale; |
|
260 | + if ($mod < 1) { |
|
261 | + $mod = 1; |
|
262 | + } |
|
263 | + for ($i = $baseyear + 1; $i < $topyear; $i++) { |
|
264 | + if ($i % $mod === 0) { |
|
265 | + echo '<div id="scale' . $i . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left:0;' : 'right:0;') . ' top:' . ((($i - $baseyear) * $scale) - $scale / 2) . 'px; font-size: 7pt; text-align:' . (I18N::direction() === 'ltr' ? 'left' : 'right') . ';">'; |
|
266 | + echo $i; |
|
267 | + echo '</div>'; |
|
268 | + } |
|
269 | + } |
|
270 | + echo ''; |
|
271 | + ?> |
|
272 | 272 | <div id="scale<?= e($topyear) ?>" style="position:absolute; <?= I18N::direction() === 'ltr' ? 'left' : 'right' ?>:0; top:<?= ($topyear - $baseyear) * $scale ?>px; font-size: 7pt; text-align:<?= I18N::direction() === 'ltr' ? 'left' : 'right' ?>;"> |
273 | 273 | <?= e($topyear) ?> |
274 | 274 | </div> |
275 | 275 | |
276 | 276 | <?php foreach ($indifacts as $factcount => $event): ?> |
277 | 277 | <?php |
278 | - $desc = $event->getValue(); |
|
279 | - $gdate = $event->getDate(); |
|
280 | - $date = $gdate->minimumDate(); |
|
281 | - $date = $date->convertToCalendar('gregorian'); |
|
282 | - $year = $date->y; |
|
283 | - $month = max(1, $date->m); |
|
284 | - $day = max(1, $date->d); |
|
285 | - $xoffset = 0 + 22; |
|
286 | - $yoffset = 0 + (($year - $baseyear) * $scale) - ($scale); |
|
287 | - $yoffset = $yoffset + (($month / 12) * $scale); |
|
288 | - $yoffset = $yoffset + (($day / 30) * ($scale / 12)); |
|
289 | - $yoffset = (int) ($yoffset); |
|
290 | - $place = (int) ($yoffset / $bheight); |
|
291 | - $i = 1; |
|
292 | - $j = 0; |
|
293 | - $tyoffset = 0; |
|
294 | - while (isset($placements[$place])) { |
|
295 | - if ($i === $j) { |
|
296 | - $tyoffset = $bheight * $i; |
|
297 | - $i++; |
|
298 | - } else { |
|
299 | - $tyoffset = -1 * $bheight * $j; |
|
300 | - $j++; |
|
301 | - } |
|
302 | - $place = (int) (($yoffset + $tyoffset) / $bheight); |
|
303 | - } |
|
304 | - $yoffset += $tyoffset; |
|
305 | - $xoffset += abs($tyoffset); |
|
306 | - $placements[$place] = $yoffset; |
|
278 | + $desc = $event->getValue(); |
|
279 | + $gdate = $event->getDate(); |
|
280 | + $date = $gdate->minimumDate(); |
|
281 | + $date = $date->convertToCalendar('gregorian'); |
|
282 | + $year = $date->y; |
|
283 | + $month = max(1, $date->m); |
|
284 | + $day = max(1, $date->d); |
|
285 | + $xoffset = 0 + 22; |
|
286 | + $yoffset = 0 + (($year - $baseyear) * $scale) - ($scale); |
|
287 | + $yoffset = $yoffset + (($month / 12) * $scale); |
|
288 | + $yoffset = $yoffset + (($day / 30) * ($scale / 12)); |
|
289 | + $yoffset = (int) ($yoffset); |
|
290 | + $place = (int) ($yoffset / $bheight); |
|
291 | + $i = 1; |
|
292 | + $j = 0; |
|
293 | + $tyoffset = 0; |
|
294 | + while (isset($placements[$place])) { |
|
295 | + if ($i === $j) { |
|
296 | + $tyoffset = $bheight * $i; |
|
297 | + $i++; |
|
298 | + } else { |
|
299 | + $tyoffset = -1 * $bheight * $j; |
|
300 | + $j++; |
|
301 | + } |
|
302 | + $place = (int) (($yoffset + $tyoffset) / $bheight); |
|
303 | + } |
|
304 | + $yoffset += $tyoffset; |
|
305 | + $xoffset += abs($tyoffset); |
|
306 | + $placements[$place] = $yoffset; |
|
307 | 307 | |
308 | - echo "<div id=\"fact$factcount\" style=\"position:absolute; " . (I18N::direction() === 'ltr' ? 'left: ' . ($xoffset) : 'right: ' . ($xoffset)) . 'px; top:' . ($yoffset) . 'px; font-size: 8pt; height: ' . ($bheight) . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ');">'; |
|
309 | - echo '<table cellspacing="0" cellpadding="0" border="0" style="cursor: hand;"><tr><td>'; |
|
310 | - echo '<img src="' . Theme::theme()->parameter('image-hline') . '" name="boxline' . $factcount . '" id="boxline' . $factcount . '" height="3" width="10" style="padding-'; |
|
311 | - if (I18N::direction() === 'ltr') { |
|
312 | - echo 'left: 3px;">'; |
|
313 | - } else { |
|
314 | - echo 'right: 3px;">'; |
|
315 | - } |
|
308 | + echo "<div id=\"fact$factcount\" style=\"position:absolute; " . (I18N::direction() === 'ltr' ? 'left: ' . ($xoffset) : 'right: ' . ($xoffset)) . 'px; top:' . ($yoffset) . 'px; font-size: 8pt; height: ' . ($bheight) . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ');">'; |
|
309 | + echo '<table cellspacing="0" cellpadding="0" border="0" style="cursor: hand;"><tr><td>'; |
|
310 | + echo '<img src="' . Theme::theme()->parameter('image-hline') . '" name="boxline' . $factcount . '" id="boxline' . $factcount . '" height="3" width="10" style="padding-'; |
|
311 | + if (I18N::direction() === 'ltr') { |
|
312 | + echo 'left: 3px;">'; |
|
313 | + } else { |
|
314 | + echo 'right: 3px;">'; |
|
315 | + } |
|
316 | 316 | |
317 | - $col = array_search($event->getParent(), $individuals); |
|
318 | - if ($col === false) { |
|
319 | - // Marriage event - use the color of the husband |
|
320 | - $col = array_search($event->getParent()->getHusband(), $individuals); |
|
321 | - } |
|
322 | - if ($col === false) { |
|
323 | - // Marriage event - use the color of the wife |
|
324 | - $col = array_search($event->getParent()->getWife(), $individuals); |
|
325 | - } |
|
326 | - $col = $col % 6; |
|
327 | - echo '</td><td class="person' . $col . '">'; |
|
328 | - if (count($individuals) > 6) { |
|
329 | - // We only have six colours, so show naes if more than this number |
|
330 | - echo $event->getParent()->getFullName() . ' — '; |
|
331 | - } |
|
332 | - $record = $event->getParent(); |
|
333 | - echo $event->getLabel(); |
|
334 | - echo ' — '; |
|
335 | - if ($record instanceof Individual) { |
|
336 | - echo FunctionsPrint::formatFactDate($event, $record, false, false); |
|
337 | - } elseif ($record instanceof Family) { |
|
338 | - echo $gdate->display(); |
|
339 | - if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) { |
|
340 | - $ageh = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getHusband()->getBirthDate(), $gdate)); |
|
341 | - } else { |
|
342 | - $ageh = null; |
|
343 | - } |
|
344 | - if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) { |
|
345 | - $agew = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getWife()->getBirthDate(), $gdate)); |
|
346 | - } else { |
|
347 | - $agew = null; |
|
348 | - } |
|
349 | - if ($ageh && $agew) { |
|
350 | - echo '<span class="age"> ', I18N::translate('Husband’s age'), ' ', $ageh, ' ', I18N::translate('Wife’s age'), ' ', $agew, '</span>'; |
|
351 | - } elseif ($ageh) { |
|
352 | - echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>'; |
|
353 | - } elseif ($agew) { |
|
354 | - echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>'; |
|
355 | - } |
|
356 | - } |
|
357 | - echo ' ' . e($desc); |
|
358 | - if (!$event->getPlace()->isEmpty()) { |
|
359 | - echo ' — ' . $event->getPlace()->getShortName(); |
|
360 | - } |
|
361 | - // Print spouses names for family events |
|
362 | - if ($event->getParent() instanceof Family) { |
|
363 | - echo ' — <a href="', e($event->getParent()->url()), '">', $event->getParent()->getFullName(), '</a>'; |
|
364 | - } |
|
365 | - echo '</td></tr></table>'; |
|
366 | - echo '</div>'; |
|
367 | - if (I18N::direction() === 'ltr') { |
|
368 | - $img = 'image-dline2'; |
|
369 | - $ypos = '0%'; |
|
370 | - } else { |
|
371 | - $img = 'image-dline'; |
|
372 | - $ypos = '100%'; |
|
373 | - } |
|
374 | - $dyoffset = ($yoffset - $tyoffset) + $bheight / 3; |
|
375 | - if ($tyoffset < 0) { |
|
376 | - $dyoffset = $yoffset + $bheight / 3; |
|
377 | - if (I18N::direction() === 'ltr') { |
|
378 | - $img = 'image-dline'; |
|
379 | - $ypos = '100%'; |
|
380 | - } else { |
|
381 | - $img = 'image-dline2'; |
|
382 | - $ypos = '0%'; |
|
383 | - } |
|
384 | - } |
|
385 | - ?> |
|
317 | + $col = array_search($event->getParent(), $individuals); |
|
318 | + if ($col === false) { |
|
319 | + // Marriage event - use the color of the husband |
|
320 | + $col = array_search($event->getParent()->getHusband(), $individuals); |
|
321 | + } |
|
322 | + if ($col === false) { |
|
323 | + // Marriage event - use the color of the wife |
|
324 | + $col = array_search($event->getParent()->getWife(), $individuals); |
|
325 | + } |
|
326 | + $col = $col % 6; |
|
327 | + echo '</td><td class="person' . $col . '">'; |
|
328 | + if (count($individuals) > 6) { |
|
329 | + // We only have six colours, so show naes if more than this number |
|
330 | + echo $event->getParent()->getFullName() . ' — '; |
|
331 | + } |
|
332 | + $record = $event->getParent(); |
|
333 | + echo $event->getLabel(); |
|
334 | + echo ' — '; |
|
335 | + if ($record instanceof Individual) { |
|
336 | + echo FunctionsPrint::formatFactDate($event, $record, false, false); |
|
337 | + } elseif ($record instanceof Family) { |
|
338 | + echo $gdate->display(); |
|
339 | + if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) { |
|
340 | + $ageh = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getHusband()->getBirthDate(), $gdate)); |
|
341 | + } else { |
|
342 | + $ageh = null; |
|
343 | + } |
|
344 | + if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) { |
|
345 | + $agew = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getWife()->getBirthDate(), $gdate)); |
|
346 | + } else { |
|
347 | + $agew = null; |
|
348 | + } |
|
349 | + if ($ageh && $agew) { |
|
350 | + echo '<span class="age"> ', I18N::translate('Husband’s age'), ' ', $ageh, ' ', I18N::translate('Wife’s age'), ' ', $agew, '</span>'; |
|
351 | + } elseif ($ageh) { |
|
352 | + echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>'; |
|
353 | + } elseif ($agew) { |
|
354 | + echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>'; |
|
355 | + } |
|
356 | + } |
|
357 | + echo ' ' . e($desc); |
|
358 | + if (!$event->getPlace()->isEmpty()) { |
|
359 | + echo ' — ' . $event->getPlace()->getShortName(); |
|
360 | + } |
|
361 | + // Print spouses names for family events |
|
362 | + if ($event->getParent() instanceof Family) { |
|
363 | + echo ' — <a href="', e($event->getParent()->url()), '">', $event->getParent()->getFullName(), '</a>'; |
|
364 | + } |
|
365 | + echo '</td></tr></table>'; |
|
366 | + echo '</div>'; |
|
367 | + if (I18N::direction() === 'ltr') { |
|
368 | + $img = 'image-dline2'; |
|
369 | + $ypos = '0%'; |
|
370 | + } else { |
|
371 | + $img = 'image-dline'; |
|
372 | + $ypos = '100%'; |
|
373 | + } |
|
374 | + $dyoffset = ($yoffset - $tyoffset) + $bheight / 3; |
|
375 | + if ($tyoffset < 0) { |
|
376 | + $dyoffset = $yoffset + $bheight / 3; |
|
377 | + if (I18N::direction() === 'ltr') { |
|
378 | + $img = 'image-dline'; |
|
379 | + $ypos = '100%'; |
|
380 | + } else { |
|
381 | + $img = 'image-dline2'; |
|
382 | + $ypos = '0%'; |
|
383 | + } |
|
384 | + } |
|
385 | + ?> |
|
386 | 386 | |
387 | 387 | <!-- diagonal line --> |
388 | 388 | <div id="dbox<?= $factcount ?>" style="position:absolute; <?= (I18N::direction() === 'ltr' ? 'left: ' . (0 + 25) : 'right: ' . (0 + 25)) ?>px; top:<?= ($dyoffset) ?>px; font-size: 8pt; height: <?= abs($tyoffset) ?>px; width: <?= abs($tyoffset) ?>px; background-image: url('<?= Theme::theme()->parameter($img) ?>'); background-position: 0% <?= $ypos ?>;"> |
@@ -13,18 +13,18 @@ discard block |
||
13 | 13 | |
14 | 14 | <tbody> |
15 | 15 | <?php |
16 | - $found = false; |
|
17 | - foreach ($family->getFacts('HUSB', false, $fam_access_level) as $fact) { |
|
18 | - $found |= !$fact->isPendingDeletion(); |
|
19 | - $person = $fact->getTarget(); |
|
20 | - if ($person instanceof Individual) { |
|
21 | - $row_class = 'wt-gender-' . $person->getSex(); |
|
22 | - if ($fact->isPendingAddition()) { |
|
23 | - $row_class .= ' new'; |
|
24 | - } elseif ($fact->isPendingDeletion()) { |
|
25 | - $row_class .= ' old'; |
|
26 | - } |
|
27 | - ?> |
|
16 | + $found = false; |
|
17 | + foreach ($family->getFacts('HUSB', false, $fam_access_level) as $fact) { |
|
18 | + $found |= !$fact->isPendingDeletion(); |
|
19 | + $person = $fact->getTarget(); |
|
20 | + if ($person instanceof Individual) { |
|
21 | + $row_class = 'wt-gender-' . $person->getSex(); |
|
22 | + if ($fact->isPendingAddition()) { |
|
23 | + $row_class .= ' new'; |
|
24 | + } elseif ($fact->isPendingDeletion()) { |
|
25 | + $row_class .= ' old'; |
|
26 | + } |
|
27 | + ?> |
|
28 | 28 | <tr class="<?= $row_class ?>"> |
29 | 29 | <th scope="row"> |
30 | 30 | <?= $individual === $person ? '<i class="icon-selected"></i>' : '' ?> |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | </td> |
36 | 36 | </tr> |
37 | 37 | <?php |
38 | - } |
|
39 | - } |
|
40 | - if (!$found && $family->canEdit()) { |
|
41 | - ?> |
|
38 | + } |
|
39 | + } |
|
40 | + if (!$found && $family->canEdit()) { |
|
41 | + ?> |
|
42 | 42 | <tr> |
43 | 43 | <th scope="row"></th> |
44 | 44 | <td> |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | </td> |
49 | 49 | </tr> |
50 | 50 | <?php |
51 | - } |
|
52 | - |
|
53 | - $found = false; |
|
54 | - foreach ($family->getFacts('WIFE', false, $fam_access_level) as $fact) { |
|
55 | - $person = $fact->getTarget(); |
|
56 | - if ($person instanceof Individual) { |
|
57 | - $found |= !$fact->isPendingDeletion(); |
|
58 | - $row_class = 'wt-gender-' . $person->getSex(); |
|
59 | - if ($fact->isPendingAddition()) { |
|
60 | - $row_class .= ' new'; |
|
61 | - } elseif ($fact->isPendingDeletion()) { |
|
62 | - $row_class .= ' old'; |
|
63 | - } |
|
64 | - ?> |
|
51 | + } |
|
52 | + |
|
53 | + $found = false; |
|
54 | + foreach ($family->getFacts('WIFE', false, $fam_access_level) as $fact) { |
|
55 | + $person = $fact->getTarget(); |
|
56 | + if ($person instanceof Individual) { |
|
57 | + $found |= !$fact->isPendingDeletion(); |
|
58 | + $row_class = 'wt-gender-' . $person->getSex(); |
|
59 | + if ($fact->isPendingAddition()) { |
|
60 | + $row_class .= ' new'; |
|
61 | + } elseif ($fact->isPendingDeletion()) { |
|
62 | + $row_class .= ' old'; |
|
63 | + } |
|
64 | + ?> |
|
65 | 65 | |
66 | 66 | <tr class="<?= $row_class ?>"> |
67 | 67 | <th scope="row"> |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | </td> |
74 | 74 | </tr> |
75 | 75 | <?php |
76 | - } |
|
77 | - } |
|
78 | - if (!$found && $family->canEdit()) { ?> |
|
76 | + } |
|
77 | + } |
|
78 | + if (!$found && $family->canEdit()) { ?> |
|
79 | 79 | <tr> |
80 | 80 | <th scope="row"></th> |
81 | 81 | <td> |
@@ -88,19 +88,19 @@ discard block |
||
88 | 88 | <?php } ?> |
89 | 89 | |
90 | 90 | <?php |
91 | - ///// MARR ///// |
|
92 | - $found = false; |
|
93 | - $prev = new Date(''); |
|
94 | - foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { |
|
95 | - $found |= !$fact->isPendingDeletion(); |
|
96 | - if ($fact->isPendingAddition()) { |
|
97 | - $row_class = 'new'; |
|
98 | - } elseif ($fact->isPendingDeletion()) { |
|
99 | - $row_class = 'old'; |
|
100 | - } else { |
|
101 | - $row_class = ''; |
|
102 | - } |
|
103 | - ?> |
|
91 | + ///// MARR ///// |
|
92 | + $found = false; |
|
93 | + $prev = new Date(''); |
|
94 | + foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { |
|
95 | + $found |= !$fact->isPendingDeletion(); |
|
96 | + if ($fact->isPendingAddition()) { |
|
97 | + $row_class = 'new'; |
|
98 | + } elseif ($fact->isPendingDeletion()) { |
|
99 | + $row_class = 'old'; |
|
100 | + } else { |
|
101 | + $row_class = ''; |
|
102 | + } |
|
103 | + ?> |
|
104 | 104 | |
105 | 105 | <tr class="<?= $row_class ?>"> |
106 | 106 | <th scope="row"> |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | </tr> |
112 | 112 | |
113 | 113 | <?php |
114 | - if (!$prev->isOK() && $fact->getDate()->isOK()) { |
|
115 | - $prev = $fact->getDate(); |
|
116 | - } |
|
117 | - } |
|
114 | + if (!$prev->isOK() && $fact->getDate()->isOK()) { |
|
115 | + $prev = $fact->getDate(); |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | - if (!$found && $family->canShow() && $family->canEdit()) { |
|
120 | - ?> |
|
119 | + if (!$found && $family->canShow() && $family->canEdit()) { |
|
120 | + ?> |
|
121 | 121 | <tr> |
122 | 122 | <th scope="row"> |
123 | 123 | </th> |
@@ -128,30 +128,30 @@ discard block |
||
128 | 128 | </td> |
129 | 129 | </tr> |
130 | 130 | <?php |
131 | - } |
|
132 | - |
|
133 | - ///// CHIL ///// |
|
134 | - $child_number = 0; |
|
135 | - foreach ($family->getFacts('CHIL', false, $fam_access_level) as $fact) { |
|
136 | - $person = $fact->getTarget(); |
|
137 | - if ($person instanceof Individual) { |
|
138 | - $row_class = 'wt-gender-' . $person->getSex(); |
|
139 | - if ($fact->isPendingAddition()) { |
|
140 | - $child_number++; |
|
141 | - $row_class .= ' new'; |
|
142 | - } elseif ($fact->isPendingDeletion()) { |
|
143 | - $row_class .= ' old'; |
|
144 | - } else { |
|
145 | - $child_number++; |
|
146 | - } |
|
147 | - $next = new Date(''); |
|
148 | - foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { |
|
149 | - if ($bfact->getDate()->isOK()) { |
|
150 | - $next = $bfact->getDate(); |
|
151 | - break; |
|
152 | - } |
|
153 | - } |
|
154 | - ?> |
|
131 | + } |
|
132 | + |
|
133 | + ///// CHIL ///// |
|
134 | + $child_number = 0; |
|
135 | + foreach ($family->getFacts('CHIL', false, $fam_access_level) as $fact) { |
|
136 | + $person = $fact->getTarget(); |
|
137 | + if ($person instanceof Individual) { |
|
138 | + $row_class = 'wt-gender-' . $person->getSex(); |
|
139 | + if ($fact->isPendingAddition()) { |
|
140 | + $child_number++; |
|
141 | + $row_class .= ' new'; |
|
142 | + } elseif ($fact->isPendingDeletion()) { |
|
143 | + $row_class .= ' old'; |
|
144 | + } else { |
|
145 | + $child_number++; |
|
146 | + } |
|
147 | + $next = new Date(''); |
|
148 | + foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { |
|
149 | + if ($bfact->getDate()->isOK()) { |
|
150 | + $next = $bfact->getDate(); |
|
151 | + break; |
|
152 | + } |
|
153 | + } |
|
154 | + ?> |
|
155 | 155 | |
156 | 156 | <tr class="<?= $row_class ?>"> |
157 | 157 | <th scope="row"> |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | </td> |
183 | 183 | </tr> |
184 | 184 | <?php |
185 | - $prev = $next; |
|
186 | - } |
|
187 | - } ?> |
|
185 | + $prev = $next; |
|
186 | + } |
|
187 | + } ?> |
|
188 | 188 | |
189 | 189 | <?php if ($family->canEdit()): ?> |
190 | 190 | <tr> |
@@ -39,45 +39,45 @@ |
||
39 | 39 | <!-- Parents --> |
40 | 40 | <?php foreach ($parent_families as $family): ?> |
41 | 41 | <?= view('modules/relatives/family', [ |
42 | - 'individual' => $individual, |
|
43 | - 'family' => $family, |
|
44 | - 'type' => 'FAMC', |
|
45 | - 'label' => $individual->getChildFamilyLabel($family), |
|
46 | - 'fam_access_level' => $fam_access_level, |
|
47 | - ]) ?> |
|
42 | + 'individual' => $individual, |
|
43 | + 'family' => $family, |
|
44 | + 'type' => 'FAMC', |
|
45 | + 'label' => $individual->getChildFamilyLabel($family), |
|
46 | + 'fam_access_level' => $fam_access_level, |
|
47 | + ]) ?> |
|
48 | 48 | <?php endforeach ?> |
49 | 49 | |
50 | 50 | <!-- step-parents --> |
51 | 51 | <?php foreach ($step_parent_families as $family): ?> |
52 | 52 | <?= view('modules/relatives/family', [ |
53 | - 'individual' => $individual, |
|
54 | - 'family' => $family, |
|
55 | - 'type' => 'FAMC', |
|
56 | - 'label' => $individual->getStepFamilyLabel($family), |
|
57 | - 'fam_access_level' => $fam_access_level, |
|
58 | - ]) ?> |
|
53 | + 'individual' => $individual, |
|
54 | + 'family' => $family, |
|
55 | + 'type' => 'FAMC', |
|
56 | + 'label' => $individual->getStepFamilyLabel($family), |
|
57 | + 'fam_access_level' => $fam_access_level, |
|
58 | + ]) ?> |
|
59 | 59 | <?php endforeach ?> |
60 | 60 | |
61 | 61 | <!-- spouses --> |
62 | 62 | <?php foreach ($spouse_families as $family): ?> |
63 | 63 | <?= view('modules/relatives/family', [ |
64 | - 'individual' => $individual, |
|
65 | - 'family' => $family, |
|
66 | - 'type' => 'FAMS', |
|
67 | - 'label' => $individual->getSpouseFamilyLabel($family), |
|
68 | - 'fam_access_level' => $fam_access_level, |
|
69 | - ]) ?> |
|
64 | + 'individual' => $individual, |
|
65 | + 'family' => $family, |
|
66 | + 'type' => 'FAMS', |
|
67 | + 'label' => $individual->getSpouseFamilyLabel($family), |
|
68 | + 'fam_access_level' => $fam_access_level, |
|
69 | + ]) ?> |
|
70 | 70 | <?php endforeach ?> |
71 | 71 | |
72 | 72 | <!-- step-children --> |
73 | 73 | <?php foreach ($step_child_familiess as $family): ?> |
74 | 74 | <?= view('modules/relatives/family', [ |
75 | - 'individual' => $individual, |
|
76 | - 'family' => $family, |
|
77 | - 'type' => 'FAMS', |
|
78 | - 'label' => $family->getFullName(), |
|
79 | - 'fam_access_level' => $fam_access_level, |
|
80 | - ]) ?> |
|
75 | + 'individual' => $individual, |
|
76 | + 'family' => $family, |
|
77 | + 'type' => 'FAMS', |
|
78 | + 'label' => $family->getFullName(), |
|
79 | + 'fam_access_level' => $fam_access_level, |
|
80 | + ]) ?> |
|
81 | 81 | <?php endforeach ?> |
82 | 82 | |
83 | 83 | <?php if ($can_edit): ?> |