@@ -54,7 +54,10 @@ |
||
54 | 54 | <?php echo I18N::translate('Description'); ?> |
55 | 55 | </label> |
56 | 56 | <div class="col-sm-9"> |
57 | - <input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if(!$is_new) echo 'value="' . Filter::escapeHtml($ga->getTitle()) .'"'; ?> dir="auto"> |
|
57 | + <input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if(!$is_new) { |
|
58 | + echo 'value="' . Filter::escapeHtml($ga->getTitle()) .'"'; |
|
59 | +} |
|
60 | +?> dir="auto"> |
|
58 | 61 | <p class="small text-muted"> |
59 | 62 | <?php echo I18N::translate('Description to be given to the geographical dispersion analysis. It will be used as the page title for it.'); ?> |
60 | 63 | </p> |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * {@inhericDoc} |
26 | 26 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
27 | 27 | */ |
28 | - protected function renderContent() { |
|
28 | + protected function renderContent() { |
|
29 | 29 | |
30 | - /** @var GeoAnalysis $ga */ |
|
31 | - $ga = $this->data->get('geo_analysis'); |
|
32 | - $is_new = is_null($ga); |
|
30 | + /** @var GeoAnalysis $ga */ |
|
31 | + $ga = $this->data->get('geo_analysis'); |
|
32 | + $is_new = is_null($ga); |
|
33 | 33 | |
34 | - $places_hierarchy = $this->data->get('places_hierarchy'); |
|
35 | - ?> |
|
34 | + $places_hierarchy = $this->data->get('places_hierarchy'); |
|
35 | + ?> |
|
36 | 36 | <ol class="breadcrumb small"> |
37 | 37 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
38 | 38 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | </form> |
160 | 160 | |
161 | 161 | <?php } |
162 | - } |
|
162 | + } |
|
163 | 163 | |
164 | 164 | } |
165 | 165 | |
166 | 166 | \ No newline at end of file |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | <h1><?php echo $this->data->get('title'); ?></h1> |
44 | 44 | |
45 | - <?php if($places_hierarchy['type'] == 'none') { ?> |
|
45 | + <?php if ($places_hierarchy['type'] == 'none') { ?> |
|
46 | 46 | <div class="warning"><?php echo I18N::translate('No place structure could be determined. Please make sure that at least a place exists.'); ?></div> |
47 | 47 | <?php } else { ?> |
48 | 48 | |
49 | 49 | <form class="form-horizontal" name="newform" method="post" role="form" action="<?php echo $this->data->get('save_url'); ?>" autocomplete="off"> |
50 | 50 | <?php echo Filter::getCsrf(); ?> |
51 | - <?php if(!$is_new) { ?> |
|
51 | + <?php if (!$is_new) { ?> |
|
52 | 52 | <input type="hidden" name="ga_id" value="<?php echo $ga->getId(); ?>"> |
53 | 53 | <?php } ?> |
54 | 54 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <?php echo I18N::translate('Description'); ?> |
59 | 59 | </label> |
60 | 60 | <div class="col-sm-9"> |
61 | - <input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if(!$is_new) echo 'value="' . Filter::escapeHtml($ga->getTitle()) .'"'; ?> dir="auto"> |
|
61 | + <input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if (!$is_new) echo 'value="'.Filter::escapeHtml($ga->getTitle()).'"'; ?> dir="auto"> |
|
62 | 62 | <p class="small text-muted"> |
63 | 63 | <?php echo I18N::translate('Description to be given to the geographical dispersion analysis. It will be used as the page title for it.'); ?> |
64 | 64 | </p> |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | <?php echo I18N::translate('Map'); ?> |
102 | 102 | </label> |
103 | 103 | <div class="col-sm-9"> |
104 | - <?php echo FunctionsEdit::selectEditControl('map_file', $this->data->get('map_list') , null, ($is_new || ! $ga->hasMap()) ? '' : base64_encode($ga->getOptions()->getMap()->getFileName()), 'class="form-control"'); ?> |
|
104 | + <?php echo FunctionsEdit::selectEditControl('map_file', $this->data->get('map_list'), null, ($is_new || !$ga->hasMap()) ? '' : base64_encode($ga->getOptions()->getMap()->getFileName()), 'class="form-control"'); ?> |
|
105 | 105 | <p class="small text-muted"> |
106 | 106 | <?php echo I18N::translate('Map outline to be used for the result display.'); ?> |
107 | 107 | </p> |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | <?php echo I18N::translate('Map parent level'); ?> |
115 | 115 | </label> |
116 | 116 | <div class="col-sm-9"> |
117 | - <?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || ! $ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?> |
|
117 | + <?php echo FunctionsEdit::selectEditControl('map_top_level', $places_hierarchy['hierarchy'], null, $is_new || !$ga->hasMap() ? '' : $ga->getOptions()->getMapLevel() - 1, 'class="form-control"'); ?> |
|
118 | 118 | <p class="small text-muted"> |
119 | 119 | <?php echo I18N::translate('Subdivision level of the parent subdivision(s) represented by the map.'); ?><br /> |
120 | 120 | <?php echo I18N::translate('For instance, if the map is intended to represent a country by county analysis, then the map parent level would be “Country”, and the analysis level would be “County”.'); ?> |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | * {@inhericDoc} |
25 | 25 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
26 | 26 | */ |
27 | - protected function renderContent() { |
|
28 | - ?> |
|
27 | + protected function renderContent() { |
|
28 | + ?> |
|
29 | 29 | <div id="maj-geodisp-list-page" class="center"> |
30 | 30 | <h2><?php echo $this->data->get('title'); ?></h2> |
31 | 31 | |
32 | 32 | <?php |
33 | 33 | if($this->data->get('has_analysis', false)) { |
34 | - /** @var GeoAnalysis $ga */ |
|
35 | - $ga = $this->data->get('geoanalysis'); |
|
36 | - ?> |
|
34 | + /** @var GeoAnalysis $ga */ |
|
35 | + $ga = $this->data->get('geoanalysis'); |
|
36 | + ?> |
|
37 | 37 | |
38 | 38 | <div id="geodispersion-panel"> |
39 | 39 | <h3><?php echo $ga->getTitle() ?></h3> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | </div> |
67 | 67 | |
68 | 68 | <?php |
69 | - } |
|
69 | + } |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
73 | 73 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
30 | 30 | <h2><?php echo $this->data->get('title'); ?></h2> |
31 | 31 | |
32 | 32 | <?php |
33 | - if($this->data->get('has_analysis', false)) { |
|
33 | + if ($this->data->get('has_analysis', false)) { |
|
34 | 34 | /** @var GeoAnalysis $ga */ |
35 | 35 | $ga = $this->data->get('geoanalysis'); |
36 | 36 | ?> |
@@ -38,39 +38,38 @@ discard block |
||
38 | 38 | '<div id="geodispersion_gen"> |
39 | 39 | <table id="geodispersion_gentable" class="center">'; |
40 | 40 | |
41 | - foreach($results_by_gen as $gen => $genData){ |
|
41 | + foreach ($results_by_gen as $gen => $genData) { |
|
42 | 42 | $html .= |
43 | 43 | '<tr> |
44 | 44 | <td class="descriptionbox">' . |
45 | 45 | I18N::translate("Generation %s", I18N::number($gen)). |
46 | 46 | ($display_all_places ? '<br />' : ' '). |
47 | - I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']),1)) . |
|
47 | + I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']), 1)). |
|
48 | 48 | '</td> |
49 | 49 | <td class="optionbox left">'. |
50 | 50 | ($display_all_places ? |
51 | - $this->htmlGenerationAllPlacesRow($genData, $analysis_level) : |
|
52 | - $this->htmlGenerationTopPlacesRow($genData, $analysis_level) |
|
53 | - ) . |
|
51 | + $this->htmlGenerationAllPlacesRow($genData, $analysis_level) : $this->htmlGenerationTopPlacesRow($genData, $analysis_level) |
|
52 | + ). |
|
54 | 53 | '</ditdv> |
55 | 54 | </tr>'; |
56 | 55 | } |
57 | 56 | |
58 | - $html.= |
|
57 | + $html .= |
|
59 | 58 | '</table> |
60 | 59 | <div class="left"> |
61 | - <strong>' . I18N::translate('Interpretation help:') . '</strong> |
|
60 | + <strong>' . I18N::translate('Interpretation help:').'</strong> |
|
62 | 61 | <br />'. |
63 | - I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.') . |
|
62 | + I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.'). |
|
64 | 63 | '<br />'; |
65 | - if(!is_null($max_details_gen) && $max_details_gen == 0){ |
|
64 | + if (!is_null($max_details_gen) && $max_details_gen == 0) { |
|
66 | 65 | $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />'; |
67 | 66 | $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.'); |
68 | 67 | } |
69 | - else{ |
|
68 | + else { |
|
70 | 69 | $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />'; |
71 | 70 | $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen); |
72 | 71 | } |
73 | - $html.= |
|
72 | + $html .= |
|
74 | 73 | '</div> |
75 | 74 | </div>'; |
76 | 75 | |
@@ -92,25 +91,25 @@ discard block |
||
92 | 91 | |
93 | 92 | $sum_gen = $data['sum']; |
94 | 93 | $unknownother = $data['unknown'] + $data['other']; |
95 | - foreach($data['places'] as $placename=> $dataplace){ |
|
96 | - $levels = array_map('trim',explode(',', $placename)); |
|
94 | + foreach ($data['places'] as $placename=> $dataplace) { |
|
95 | + $levels = array_map('trim', explode(',', $placename)); |
|
97 | 96 | $content = ''; |
98 | - if(isset($dataplace['flag'])){ |
|
99 | - $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>'; |
|
97 | + if (isset($dataplace['flag'])) { |
|
98 | + $content .= '<td class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']).'</td><td>'; |
|
100 | 99 | } |
101 | - else{ |
|
102 | - $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>'; |
|
100 | + else { |
|
101 | + $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level - 1].'</span><br/>'; |
|
103 | 102 | } |
104 | 103 | $count = $dataplace['count']; |
105 | 104 | $content .= I18N::number($count); |
106 | 105 | $perc = Functions::safeDivision($count, $sum_gen + $unknownother); |
107 | - $perc2= Functions::safeDivision($count, $sum_gen); |
|
108 | - if($perc2>=0.1) |
|
109 | - $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
106 | + $perc2 = Functions::safeDivision($count, $sum_gen); |
|
107 | + if ($perc2 >= 0.1) |
|
108 | + $content .= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
110 | 109 | $content .= '</td>'; |
111 | 110 | |
112 | 111 | $html .= ' |
113 | - <td class="geodispersion_rowitem" width="'.max(round(100*$perc, 0),1).'%"> |
|
112 | + <td class="geodispersion_rowitem" width="'.max(round(100 * $perc, 0), 1).'%"> |
|
114 | 113 | <table> |
115 | 114 | <tr> |
116 | 115 | <td> |
@@ -123,11 +122,11 @@ discard block |
||
123 | 122 | </td>'; |
124 | 123 | } |
125 | 124 | |
126 | - if($unknownother>0){ |
|
127 | - $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
|
128 | - $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
|
129 | - if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
130 | - $html .='</td>'; |
|
125 | + if ($unknownother > 0) { |
|
126 | + $perc = Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
|
127 | + $html .= '<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
|
128 | + if ($perc >= 0.1) $html .= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
129 | + $html .= '</td>'; |
|
131 | 130 | } |
132 | 131 | |
133 | 132 | $html .= |
@@ -148,12 +147,12 @@ discard block |
||
148 | 147 | $sum_gen = $data['sum']; |
149 | 148 | $other = $data['other']; |
150 | 149 | |
151 | - foreach($data['places'] as $placename => $count) { |
|
152 | - if($placename != 'other'){ |
|
153 | - $levels = array_map('trim',explode(',', $placename)); |
|
154 | - $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>'; |
|
150 | + foreach ($data['places'] as $placename => $count) { |
|
151 | + if ($placename != 'other') { |
|
152 | + $levels = array_map('trim', explode(',', $placename)); |
|
153 | + $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level - 1].'</span>'; |
|
155 | 154 | } |
156 | - else{ |
|
155 | + else { |
|
157 | 156 | $placename = I18N::translate('Other places'); |
158 | 157 | } |
159 | 158 | $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1)); |
@@ -65,8 +65,7 @@ discard block |
||
65 | 65 | if(!is_null($max_details_gen) && $max_details_gen == 0){ |
66 | 66 | $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />'; |
67 | 67 | $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.'); |
68 | - } |
|
69 | - else{ |
|
68 | + } else{ |
|
70 | 69 | $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />'; |
71 | 70 | $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen); |
72 | 71 | } |
@@ -97,16 +96,16 @@ discard block |
||
97 | 96 | $content = ''; |
98 | 97 | if(isset($dataplace['flag'])){ |
99 | 98 | $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>'; |
100 | - } |
|
101 | - else{ |
|
99 | + } else{ |
|
102 | 100 | $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>'; |
103 | 101 | } |
104 | 102 | $count = $dataplace['count']; |
105 | 103 | $content .= I18N::number($count); |
106 | 104 | $perc = Functions::safeDivision($count, $sum_gen + $unknownother); |
107 | 105 | $perc2= Functions::safeDivision($count, $sum_gen); |
108 | - if($perc2>=0.1) |
|
109 | - $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
106 | + if($perc2>=0.1) { |
|
107 | + $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
108 | + } |
|
110 | 109 | $content .= '</td>'; |
111 | 110 | |
112 | 111 | $html .= ' |
@@ -126,7 +125,9 @@ discard block |
||
126 | 125 | if($unknownother>0){ |
127 | 126 | $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
128 | 127 | $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
129 | - if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
128 | + if($perc>=0.1) { |
|
129 | + $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
130 | + } |
|
130 | 131 | $html .='</td>'; |
131 | 132 | } |
132 | 133 | |
@@ -152,8 +153,7 @@ discard block |
||
152 | 153 | if($placename != 'other'){ |
153 | 154 | $levels = array_map('trim',explode(',', $placename)); |
154 | 155 | $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>'; |
155 | - } |
|
156 | - else{ |
|
156 | + } else{ |
|
157 | 157 | $placename = I18N::translate('Other places'); |
158 | 158 | } |
159 | 159 | $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1)); |
@@ -24,89 +24,89 @@ discard block |
||
24 | 24 | * {@inhericDoc} |
25 | 25 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
26 | 26 | */ |
27 | - protected function renderContent() { |
|
27 | + protected function renderContent() { |
|
28 | 28 | |
29 | - $max_details_gen = $this->data->get('max_details_gen'); |
|
30 | - $analysis_level = $this->data->get('analysis_level'); |
|
31 | - $results_by_gen = $this->data->get('results_by_generations'); |
|
32 | - $display_all_places = $this->data->get('display_all_places', true); |
|
29 | + $max_details_gen = $this->data->get('max_details_gen'); |
|
30 | + $analysis_level = $this->data->get('analysis_level'); |
|
31 | + $results_by_gen = $this->data->get('results_by_generations'); |
|
32 | + $display_all_places = $this->data->get('display_all_places', true); |
|
33 | 33 | |
34 | - $html = |
|
35 | - '<div id="geodispersion_gen"> |
|
34 | + $html = |
|
35 | + '<div id="geodispersion_gen"> |
|
36 | 36 | <table id="geodispersion_gentable" class="center">'; |
37 | 37 | |
38 | - foreach($results_by_gen as $gen => $genData){ |
|
39 | - $html .= |
|
40 | - '<tr> |
|
38 | + foreach($results_by_gen as $gen => $genData){ |
|
39 | + $html .= |
|
40 | + '<tr> |
|
41 | 41 | <td class="descriptionbox">' . |
42 | - I18N::translate("Generation %s", I18N::number($gen)). |
|
43 | - ($display_all_places ? '<br />' : ' '). |
|
44 | - I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']),1)) . |
|
45 | - '</td> |
|
42 | + I18N::translate("Generation %s", I18N::number($gen)). |
|
43 | + ($display_all_places ? '<br />' : ' '). |
|
44 | + I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']),1)) . |
|
45 | + '</td> |
|
46 | 46 | <td class="optionbox left">'. |
47 | - ($display_all_places ? |
|
48 | - $this->htmlGenerationAllPlacesRow($genData, $analysis_level) : |
|
49 | - $this->htmlGenerationTopPlacesRow($genData, $analysis_level) |
|
50 | - ) . |
|
51 | - '</ditdv> |
|
47 | + ($display_all_places ? |
|
48 | + $this->htmlGenerationAllPlacesRow($genData, $analysis_level) : |
|
49 | + $this->htmlGenerationTopPlacesRow($genData, $analysis_level) |
|
50 | + ) . |
|
51 | + '</ditdv> |
|
52 | 52 | </tr>'; |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - $html.= |
|
56 | - '</table> |
|
55 | + $html.= |
|
56 | + '</table> |
|
57 | 57 | <div class="left"> |
58 | 58 | <strong>' . I18N::translate('Interpretation help:') . '</strong> |
59 | 59 | <br />'. |
60 | - I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.') . |
|
61 | - '<br />'; |
|
62 | - if(!is_null($max_details_gen) && $max_details_gen == 0){ |
|
63 | - $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />'; |
|
64 | - $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.'); |
|
65 | - } |
|
66 | - else{ |
|
67 | - $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />'; |
|
68 | - $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen); |
|
69 | - } |
|
70 | - $html.= |
|
71 | - '</div> |
|
60 | + I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.') . |
|
61 | + '<br />'; |
|
62 | + if(!is_null($max_details_gen) && $max_details_gen == 0){ |
|
63 | + $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />'; |
|
64 | + $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.'); |
|
65 | + } |
|
66 | + else{ |
|
67 | + $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />'; |
|
68 | + $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen); |
|
69 | + } |
|
70 | + $html.= |
|
71 | + '</div> |
|
72 | 72 | </div>'; |
73 | 73 | |
74 | - return $html; |
|
75 | - } |
|
74 | + return $html; |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Return the HTML code to display a row with all places found in a generation. |
|
80 | - * |
|
81 | - * @param array $data Data array |
|
82 | - * @param int $analysis_level Level of subdivision of analysis |
|
83 | - * @return string HTML code for all places row |
|
84 | - */ |
|
85 | - protected function htmlGenerationAllPlacesRow($data, $analysis_level) { |
|
86 | - $html = |
|
87 | - '<table class="geodispersion_bigrow"> |
|
78 | + /** |
|
79 | + * Return the HTML code to display a row with all places found in a generation. |
|
80 | + * |
|
81 | + * @param array $data Data array |
|
82 | + * @param int $analysis_level Level of subdivision of analysis |
|
83 | + * @return string HTML code for all places row |
|
84 | + */ |
|
85 | + protected function htmlGenerationAllPlacesRow($data, $analysis_level) { |
|
86 | + $html = |
|
87 | + '<table class="geodispersion_bigrow"> |
|
88 | 88 | <tr>'; |
89 | 89 | |
90 | - $sum_gen = $data['sum']; |
|
91 | - $unknownother = $data['unknown'] + $data['other']; |
|
92 | - foreach($data['places'] as $placename=> $dataplace){ |
|
93 | - $levels = array_map('trim',explode(',', $placename)); |
|
94 | - $content = ''; |
|
95 | - if(isset($dataplace['flag'])){ |
|
96 | - $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>'; |
|
97 | - } |
|
98 | - else{ |
|
99 | - $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>'; |
|
100 | - } |
|
101 | - $count = $dataplace['count']; |
|
102 | - $content .= I18N::number($count); |
|
103 | - $perc = Functions::safeDivision($count, $sum_gen + $unknownother); |
|
104 | - $perc2= Functions::safeDivision($count, $sum_gen); |
|
105 | - if($perc2>=0.1) |
|
106 | - $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
107 | - $content .= '</td>'; |
|
90 | + $sum_gen = $data['sum']; |
|
91 | + $unknownother = $data['unknown'] + $data['other']; |
|
92 | + foreach($data['places'] as $placename=> $dataplace){ |
|
93 | + $levels = array_map('trim',explode(',', $placename)); |
|
94 | + $content = ''; |
|
95 | + if(isset($dataplace['flag'])){ |
|
96 | + $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>'; |
|
97 | + } |
|
98 | + else{ |
|
99 | + $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>'; |
|
100 | + } |
|
101 | + $count = $dataplace['count']; |
|
102 | + $content .= I18N::number($count); |
|
103 | + $perc = Functions::safeDivision($count, $sum_gen + $unknownother); |
|
104 | + $perc2= Functions::safeDivision($count, $sum_gen); |
|
105 | + if($perc2>=0.1) |
|
106 | + $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
107 | + $content .= '</td>'; |
|
108 | 108 | |
109 | - $html .= ' |
|
109 | + $html .= ' |
|
110 | 110 | <td class="geodispersion_rowitem" width="'.max(round(100*$perc, 0),1).'%"> |
111 | 111 | <table> |
112 | 112 | <tr> |
@@ -118,46 +118,46 @@ discard block |
||
118 | 118 | </tr> |
119 | 119 | </table> |
120 | 120 | </td>'; |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - if($unknownother>0){ |
|
124 | - $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
|
125 | - $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
|
126 | - if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
127 | - $html .='</td>'; |
|
128 | - } |
|
123 | + if($unknownother>0){ |
|
124 | + $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
|
125 | + $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
|
126 | + if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
127 | + $html .='</td>'; |
|
128 | + } |
|
129 | 129 | |
130 | - $html .= |
|
131 | - '</tr> |
|
130 | + $html .= |
|
131 | + '</tr> |
|
132 | 132 | </table>'; |
133 | - return $html; |
|
134 | - } |
|
133 | + return $html; |
|
134 | + } |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Returns the HTML code fo display a row of the Top Places found for a generation. |
138 | 138 | * |
139 | 139 | * @param array $data Data array |
140 | - * @param int $analysis_level Level of subdivision of analysis |
|
140 | + * @param int $analysis_level Level of subdivision of analysis |
|
141 | 141 | * @return string HTML code for Top Places row |
142 | 142 | */ |
143 | - protected function htmlGenerationTopPlacesRow($data, $analysis_level) { |
|
144 | - $tmp_places = array(); |
|
145 | - $sum_gen = $data['sum']; |
|
146 | - $other = $data['other']; |
|
143 | + protected function htmlGenerationTopPlacesRow($data, $analysis_level) { |
|
144 | + $tmp_places = array(); |
|
145 | + $sum_gen = $data['sum']; |
|
146 | + $other = $data['other']; |
|
147 | 147 | |
148 | - foreach($data['places'] as $placename => $count) { |
|
149 | - if($placename != 'other'){ |
|
150 | - $levels = array_map('trim',explode(',', $placename)); |
|
151 | - $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>'; |
|
152 | - } |
|
153 | - else{ |
|
154 | - $placename = I18N::translate('Other places'); |
|
155 | - } |
|
156 | - $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1)); |
|
157 | - } |
|
148 | + foreach($data['places'] as $placename => $count) { |
|
149 | + if($placename != 'other'){ |
|
150 | + $levels = array_map('trim',explode(',', $placename)); |
|
151 | + $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>'; |
|
152 | + } |
|
153 | + else{ |
|
154 | + $placename = I18N::translate('Other places'); |
|
155 | + } |
|
156 | + $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1)); |
|
157 | + } |
|
158 | 158 | |
159 | - return implode(I18N::$list_separator, $tmp_places); |
|
160 | - } |
|
159 | + return implode(I18N::$list_separator, $tmp_places); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | 164 | \ No newline at end of file |
@@ -86,7 +86,9 @@ |
||
86 | 86 | $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
87 | 87 | if(isset($location['transparency'])) { |
88 | 88 | $textToolTip = '<strong>'.$location['displayname'].'</strong><br/>'; |
89 | - if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
89 | + if($this->data->get('use_flags') && $location['flag'] != '') { |
|
90 | + $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
91 | + } |
|
90 | 92 | $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
91 | 93 | $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
92 | 94 | $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | * {@inheritDoc} |
26 | 26 | * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisTabGeneralView::htmlAnalysisData() |
27 | 27 | */ |
28 | - protected function htmlAnalysisData() { |
|
28 | + protected function htmlAnalysisData() { |
|
29 | 29 | |
30 | - /** @var OutlineMap $map */ |
|
31 | - $map = $this->data->get('map'); |
|
30 | + /** @var OutlineMap $map */ |
|
31 | + $map = $this->data->get('map'); |
|
32 | 32 | |
33 | - if($map === null) { |
|
34 | - return '<p class="warning">' . |
|
35 | - I18N::translate('The map could not be loaded.') . |
|
36 | - '</p>'; |
|
37 | - } |
|
33 | + if($map === null) { |
|
34 | + return '<p class="warning">' . |
|
35 | + I18N::translate('The map could not be loaded.') . |
|
36 | + '</p>'; |
|
37 | + } |
|
38 | 38 | |
39 | - $canvas = $map->getCanvas(); |
|
40 | - $subdvisions_results = $this->data->get('results_by_subdivisions'); |
|
39 | + $canvas = $map->getCanvas(); |
|
40 | + $subdvisions_results = $this->data->get('results_by_subdivisions'); |
|
41 | 41 | |
42 | - $nb_found = $this->data->get('stats_gen_nb_found'); |
|
43 | - $nb_other = $this->data->get('stats_gen_nb_other'); |
|
42 | + $nb_found = $this->data->get('stats_gen_nb_found'); |
|
43 | + $nb_other = $this->data->get('stats_gen_nb_other'); |
|
44 | 44 | |
45 | - $html = '<script> |
|
45 | + $html = '<script> |
|
46 | 46 | var tip = null; |
47 | 47 | var tipText = ""; |
48 | 48 | var over = false; |
@@ -89,29 +89,29 @@ discard block |
||
89 | 89 | var map = {}; |
90 | 90 | '; |
91 | 91 | |
92 | - foreach($subdvisions_results as $name => $location){ |
|
93 | - $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
94 | - if(isset($location['transparency'])) { |
|
95 | - $textToolTip = '<strong>'.$location['displayname'].'</strong><br/>'; |
|
96 | - if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
97 | - $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
|
98 | - $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
99 | - $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
|
100 | - $html.= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
101 | - 'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'. |
|
102 | - '});'. |
|
103 | - 'map.area'.$location['id'].'.mouseout(function () {'. |
|
104 | - 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'. |
|
105 | - '});'; |
|
106 | - } |
|
107 | - } |
|
108 | - $html .= '}); |
|
92 | + foreach($subdvisions_results as $name => $location){ |
|
93 | + $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
94 | + if(isset($location['transparency'])) { |
|
95 | + $textToolTip = '<strong>'.$location['displayname'].'</strong><br/>'; |
|
96 | + if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
97 | + $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
|
98 | + $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
99 | + $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
|
100 | + $html.= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
101 | + 'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'. |
|
102 | + '});'. |
|
103 | + 'map.area'.$location['id'].'.mouseout(function () {'. |
|
104 | + 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'. |
|
105 | + '});'; |
|
106 | + } |
|
107 | + } |
|
108 | + $html .= '}); |
|
109 | 109 | </script> |
110 | 110 | |
111 | 111 | <div id="geodispersion_map"></div> |
112 | 112 | <div id="geodispersion_tip"></div>'; |
113 | 113 | |
114 | - return $html; |
|
115 | - } |
|
114 | + return $html; |
|
115 | + } |
|
116 | 116 | |
117 | 117 | } |
118 | 118 | \ No newline at end of file |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | /** @var OutlineMap $map */ |
31 | 31 | $map = $this->data->get('map'); |
32 | 32 | |
33 | - if($map === null) { |
|
34 | - return '<p class="warning">' . |
|
35 | - I18N::translate('The map could not be loaded.') . |
|
33 | + if ($map === null) { |
|
34 | + return '<p class="warning">'. |
|
35 | + I18N::translate('The map could not be loaded.'). |
|
36 | 36 | '</p>'; |
37 | 37 | } |
38 | 38 | |
@@ -82,23 +82,23 @@ discard block |
||
82 | 82 | } |
83 | 83 | }); |
84 | 84 | |
85 | - var paper = new Raphael(document.getElementById("geodispersion_map"), '. $canvas->width .', '. $canvas->height .'); |
|
86 | - var background = paper.rect(0, 0, ' . $canvas->width . ', '. $canvas->height . '); |
|
87 | - background.attr({"fill" : "'. $canvas->background_color .'", "stroke" : "'. $canvas->background_stroke .'", "stroke-width": 1, "stroke-linejoin": "round" }); |
|
88 | - var attr = { fill: "'. $canvas->default_color .'", stroke: "'. $canvas->default_stroke .'", "stroke-width": 1, "stroke-linejoin": "round" }; |
|
85 | + var paper = new Raphael(document.getElementById("geodispersion_map"), '. $canvas->width.', '.$canvas->height.'); |
|
86 | + var background = paper.rect(0, 0, ' . $canvas->width.', '.$canvas->height.'); |
|
87 | + background.attr({"fill" : "'. $canvas->background_color.'", "stroke" : "'.$canvas->background_stroke.'", "stroke-width": 1, "stroke-linejoin": "round" }); |
|
88 | + var attr = { fill: "'. $canvas->default_color.'", stroke: "'.$canvas->default_stroke.'", "stroke-width": 1, "stroke-linejoin": "round" }; |
|
89 | 89 | var map = {}; |
90 | 90 | '; |
91 | 91 | |
92 | - foreach($subdvisions_results as $name => $location){ |
|
93 | - $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
94 | - if(isset($location['transparency'])) { |
|
92 | + foreach ($subdvisions_results as $name => $location) { |
|
93 | + $html .= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
94 | + if (isset($location['transparency'])) { |
|
95 | 95 | $textToolTip = '<strong>'.$location['displayname'].'</strong><br/>'; |
96 | - if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
96 | + if ($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
97 | 97 | $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
98 | - $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
99 | - $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
|
100 | - $html.= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
101 | - 'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'. |
|
98 | + $html .= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
99 | + $html .= 'map.area'.$location['id'].'.attr({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].' });'; |
|
100 | + $html .= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
101 | + 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->hover_color.'", "fill-opacity" : 1}, 100, "linear");'. |
|
102 | 102 | '});'. |
103 | 103 | 'map.area'.$location['id'].'.mouseout(function () {'. |
104 | 104 | 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'. |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | * {@inhericDoc} |
24 | 24 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
25 | 25 | */ |
26 | - protected function renderContent() { |
|
27 | - ?> |
|
26 | + protected function renderContent() { |
|
27 | + ?> |
|
28 | 28 | <div id="maj-geodisp-list-page" class="center"> |
29 | 29 | <h2><?php echo $this->data->get('title'); ?></h2> |
30 | 30 | |
31 | 31 | <?php |
32 | 32 | if($this->data->get('has_list', false)) { |
33 | - $galist = $this->data->get('geoanalysislist'); |
|
34 | - ?> |
|
33 | + $galist = $this->data->get('geoanalysislist'); |
|
34 | + ?> |
|
35 | 35 | |
36 | 36 | <p class="center"><?php echo I18N::translate('Choose a geographical dispersion analysis:'); ?><p> |
37 | 37 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | </div> |
59 | 59 | |
60 | 60 | <?php |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
65 | 65 | \ No newline at end of file |
@@ -29,17 +29,17 @@ |
||
29 | 29 | <h2><?php echo $this->data->get('title'); ?></h2> |
30 | 30 | |
31 | 31 | <?php |
32 | - if($this->data->get('has_list', false)) { |
|
32 | + if ($this->data->get('has_list', false)) { |
|
33 | 33 | $galist = $this->data->get('geoanalysislist'); |
34 | 34 | ?> |
35 | 35 | |
36 | 36 | <p class="center"><?php echo I18N::translate('Choose a geographical dispersion analysis:'); ?><p> |
37 | 37 | |
38 | 38 | <div class="maj-table"> |
39 | - <?php foreach($galist as $ga) {?> |
|
39 | + <?php foreach ($galist as $ga) {?> |
|
40 | 40 | <div class="maj-row"> |
41 | 41 | <div class="label"> |
42 | - <?php if($ga->hasMap()) { ?> |
|
42 | + <?php if ($ga->hasMap()) { ?> |
|
43 | 43 | <i class="icon-maj-map" title="<?php echo I18N::translate('Map'); ?>"></i> |
44 | 44 | <?php } else { ?> |
45 | 45 | <i class="icon-maj-table" title="<?php echo I18N::translate('Table'); ?>"></i> |
@@ -25,27 +25,27 @@ discard block |
||
25 | 25 | * {@inhericDoc} |
26 | 26 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
27 | 27 | */ |
28 | - protected function renderContent() { |
|
29 | - $nb_found = $this->data->get('stats_gen_nb_found'); |
|
30 | - $nb_other = $this->data->get('stats_gen_nb_other'); |
|
31 | - $nb_unknown = $this->data->get('stats_gen_nb_unknown'); |
|
32 | - $perc_known = Functions::safeDivision($nb_found - $nb_other, $nb_found + $nb_unknown); |
|
28 | + protected function renderContent() { |
|
29 | + $nb_found = $this->data->get('stats_gen_nb_found'); |
|
30 | + $nb_other = $this->data->get('stats_gen_nb_other'); |
|
31 | + $nb_unknown = $this->data->get('stats_gen_nb_unknown'); |
|
32 | + $perc_known = Functions::safeDivision($nb_found - $nb_other, $nb_found + $nb_unknown); |
|
33 | 33 | |
34 | - $html = '<div id="geodispersion_summary"> |
|
34 | + $html = '<div id="geodispersion_summary"> |
|
35 | 35 | <div class="maj-table center"> |
36 | 36 | <div class="maj-row"> |
37 | 37 | <div class="label">' . I18N::translate('Places found'). '</div> |
38 | 38 | <div class="value">' . I18N::translate('%1$d (%2$s)',$nb_found - $nb_other, I18N::percentage($perc_known)). '</div> |
39 | 39 | </div>'; |
40 | - if($nb_other > 0){ |
|
41 | - $perc_other = Functions::safeDivision($nb_other, $nb_found + $nb_unknown); |
|
42 | - $html .= |
|
43 | - '<div class="maj-row"> |
|
40 | + if($nb_other > 0){ |
|
41 | + $perc_other = Functions::safeDivision($nb_other, $nb_found + $nb_unknown); |
|
42 | + $html .= |
|
43 | + '<div class="maj-row"> |
|
44 | 44 | <div class="label">' . I18N::translate('Other places'). '</div> |
45 | 45 | <div class="value">' . I18N::translate('%1$d (%2$s)',$nb_other, I18N::percentage($perc_other)). '</div> |
46 | 46 | </div>'; |
47 | - } |
|
48 | - $html .= '<div class="maj-row"> |
|
47 | + } |
|
48 | + $html .= '<div class="maj-row"> |
|
49 | 49 | <div class="label">' . I18N::translate('Places not found'). '</div> |
50 | 50 | <div class="value">' . I18N::translate('%1$d (%2$s)',$nb_unknown, I18N::percentage(1 - $perc_known)). '</div> |
51 | 51 | </div> |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | ' . $this->htmlAnalysisData(). ' |
57 | 57 | </div>'; |
58 | 58 | |
59 | - return $html; |
|
60 | - } |
|
59 | + return $html; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Returns HTML code to display the analysis data, under the appropriate format. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @return string HTML Code for analysis display |
66 | 66 | * @abstract |
67 | 67 | */ |
68 | - protected abstract function htmlAnalysisData(); |
|
68 | + protected abstract function htmlAnalysisData(); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
72 | 72 | \ No newline at end of file |
@@ -34,26 +34,26 @@ |
||
34 | 34 | $html = '<div id="geodispersion_summary"> |
35 | 35 | <div class="maj-table center"> |
36 | 36 | <div class="maj-row"> |
37 | - <div class="label">' . I18N::translate('Places found'). '</div> |
|
38 | - <div class="value">' . I18N::translate('%1$d (%2$s)',$nb_found - $nb_other, I18N::percentage($perc_known)). '</div> |
|
37 | + <div class="label">' . I18N::translate('Places found').'</div> |
|
38 | + <div class="value">' . I18N::translate('%1$d (%2$s)', $nb_found - $nb_other, I18N::percentage($perc_known)).'</div> |
|
39 | 39 | </div>'; |
40 | - if($nb_other > 0){ |
|
40 | + if ($nb_other > 0) { |
|
41 | 41 | $perc_other = Functions::safeDivision($nb_other, $nb_found + $nb_unknown); |
42 | 42 | $html .= |
43 | 43 | '<div class="maj-row"> |
44 | - <div class="label">' . I18N::translate('Other places'). '</div> |
|
45 | - <div class="value">' . I18N::translate('%1$d (%2$s)',$nb_other, I18N::percentage($perc_other)). '</div> |
|
44 | + <div class="label">' . I18N::translate('Other places').'</div> |
|
45 | + <div class="value">' . I18N::translate('%1$d (%2$s)', $nb_other, I18N::percentage($perc_other)).'</div> |
|
46 | 46 | </div>'; |
47 | 47 | } |
48 | 48 | $html .= '<div class="maj-row"> |
49 | - <div class="label">' . I18N::translate('Places not found'). '</div> |
|
50 | - <div class="value">' . I18N::translate('%1$d (%2$s)',$nb_unknown, I18N::percentage(1 - $perc_known)). '</div> |
|
49 | + <div class="label">' . I18N::translate('Places not found').'</div> |
|
50 | + <div class="value">' . I18N::translate('%1$d (%2$s)', $nb_unknown, I18N::percentage(1 - $perc_known)).'</div> |
|
51 | 51 | </div> |
52 | 52 | </div> |
53 | 53 | </div> |
54 | 54 | <br/> |
55 | 55 | <div id="geodispersion_data"> |
56 | - ' . $this->htmlAnalysisData(). ' |
|
56 | + ' . $this->htmlAnalysisData().' |
|
57 | 57 | </div>'; |
58 | 58 | |
59 | 59 | return $html; |
@@ -22,44 +22,44 @@ |
||
22 | 22 | * {@inheritDoc} |
23 | 23 | * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisTabGeneralView::htmlAnalysisData() |
24 | 24 | */ |
25 | - protected function htmlAnalysisData() { |
|
26 | - $results = $this->data->get('results'); |
|
27 | - $analysis_level = $this->data->get('analysis_level'); |
|
25 | + protected function htmlAnalysisData() { |
|
26 | + $results = $this->data->get('results'); |
|
27 | + $analysis_level = $this->data->get('analysis_level'); |
|
28 | 28 | |
29 | - $nb_found = $this->data->get('stats_gen_nb_found'); |
|
30 | - $nb_other = $this->data->get('stats_gen_nb_other'); |
|
29 | + $nb_found = $this->data->get('stats_gen_nb_found'); |
|
30 | + $nb_other = $this->data->get('stats_gen_nb_other'); |
|
31 | 31 | |
32 | - $i=1; |
|
33 | - $previous_nb=0; |
|
32 | + $i=1; |
|
33 | + $previous_nb=0; |
|
34 | 34 | |
35 | - $html='<div class="maj-table center">'; |
|
36 | - foreach($results as $place => $nb){ |
|
37 | - $perc = Functions::safeDivision($nb, $nb_found - $nb_other); |
|
38 | - if($nb!=$previous_nb){ |
|
39 | - $j= I18N::number($i); |
|
40 | - } |
|
41 | - else{ |
|
42 | - $j=' '; |
|
43 | - } |
|
35 | + $html='<div class="maj-table center">'; |
|
36 | + foreach($results as $place => $nb){ |
|
37 | + $perc = Functions::safeDivision($nb, $nb_found - $nb_other); |
|
38 | + if($nb!=$previous_nb){ |
|
39 | + $j= I18N::number($i); |
|
40 | + } |
|
41 | + else{ |
|
42 | + $j=' '; |
|
43 | + } |
|
44 | 44 | |
45 | - $levels = array_map('trim',explode(',', $place)); |
|
46 | - $placename = $levels[$analysis_level-1]; |
|
47 | - if($placename == '' && $analysis_level > 1) $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level-2]); |
|
48 | - $html.= |
|
49 | - '<div class="maj-row"> |
|
45 | + $levels = array_map('trim',explode(',', $place)); |
|
46 | + $placename = $levels[$analysis_level-1]; |
|
47 | + if($placename == '' && $analysis_level > 1) $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level-2]); |
|
48 | + $html.= |
|
49 | + '<div class="maj-row"> |
|
50 | 50 | <div class="label"><strong>'.$j.'</strong></div> |
51 | 51 | <div class="label">'.$placename.'</div> |
52 | 52 | <div class="value">'.I18N::translate('%d',$nb).'</div> |
53 | 53 | <div class="value">'.I18N::percentage($perc,1).'</div> |
54 | 54 | </div>'; |
55 | - $i++; |
|
56 | - $previous_nb=$nb; |
|
57 | - } |
|
55 | + $i++; |
|
56 | + $previous_nb=$nb; |
|
57 | + } |
|
58 | 58 | |
59 | - $html.='</div>'; |
|
59 | + $html.='</div>'; |
|
60 | 60 | |
61 | - return $html; |
|
62 | - } |
|
61 | + return $html; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | 66 | \ No newline at end of file |
@@ -29,34 +29,34 @@ |
||
29 | 29 | $nb_found = $this->data->get('stats_gen_nb_found'); |
30 | 30 | $nb_other = $this->data->get('stats_gen_nb_other'); |
31 | 31 | |
32 | - $i=1; |
|
33 | - $previous_nb=0; |
|
32 | + $i = 1; |
|
33 | + $previous_nb = 0; |
|
34 | 34 | |
35 | - $html='<div class="maj-table center">'; |
|
36 | - foreach($results as $place => $nb){ |
|
35 | + $html = '<div class="maj-table center">'; |
|
36 | + foreach ($results as $place => $nb) { |
|
37 | 37 | $perc = Functions::safeDivision($nb, $nb_found - $nb_other); |
38 | - if($nb!=$previous_nb){ |
|
39 | - $j= I18N::number($i); |
|
38 | + if ($nb != $previous_nb) { |
|
39 | + $j = I18N::number($i); |
|
40 | 40 | } |
41 | - else{ |
|
42 | - $j=' '; |
|
41 | + else { |
|
42 | + $j = ' '; |
|
43 | 43 | } |
44 | 44 | |
45 | - $levels = array_map('trim',explode(',', $place)); |
|
46 | - $placename = $levels[$analysis_level-1]; |
|
47 | - if($placename == '' && $analysis_level > 1) $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level-2]); |
|
48 | - $html.= |
|
45 | + $levels = array_map('trim', explode(',', $place)); |
|
46 | + $placename = $levels[$analysis_level - 1]; |
|
47 | + if ($placename == '' && $analysis_level > 1) $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level - 2]); |
|
48 | + $html .= |
|
49 | 49 | '<div class="maj-row"> |
50 | 50 | <div class="label"><strong>'.$j.'</strong></div> |
51 | 51 | <div class="label">'.$placename.'</div> |
52 | - <div class="value">'.I18N::translate('%d',$nb).'</div> |
|
53 | - <div class="value">'.I18N::percentage($perc,1).'</div> |
|
52 | + <div class="value">'.I18N::translate('%d', $nb).'</div> |
|
53 | + <div class="value">'.I18N::percentage($perc, 1).'</div> |
|
54 | 54 | </div>'; |
55 | 55 | $i++; |
56 | - $previous_nb=$nb; |
|
56 | + $previous_nb = $nb; |
|
57 | 57 | } |
58 | 58 | |
59 | - $html.='</div>'; |
|
59 | + $html .= '</div>'; |
|
60 | 60 | |
61 | 61 | return $html; |
62 | 62 | } |
@@ -37,14 +37,15 @@ |
||
37 | 37 | $perc = Functions::safeDivision($nb, $nb_found - $nb_other); |
38 | 38 | if($nb!=$previous_nb){ |
39 | 39 | $j= I18N::number($i); |
40 | - } |
|
41 | - else{ |
|
40 | + } else{ |
|
42 | 41 | $j=' '; |
43 | 42 | } |
44 | 43 | |
45 | 44 | $levels = array_map('trim',explode(',', $place)); |
46 | 45 | $placename = $levels[$analysis_level-1]; |
47 | - if($placename == '' && $analysis_level > 1) $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level-2]); |
|
46 | + if($placename == '' && $analysis_level > 1) { |
|
47 | + $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level-2]); |
|
48 | + } |
|
48 | 49 | $html.= |
49 | 50 | '<div class="maj-row"> |
50 | 51 | <div class="label"><strong>'.$j.'</strong></div> |
@@ -17,41 +17,41 @@ |
||
17 | 17 | */ |
18 | 18 | interface CertificateProviderInterface { |
19 | 19 | |
20 | - /** |
|
21 | - * Returns the certificates directory path as it is really (within the firewall directory). |
|
22 | - * |
|
23 | - * @return string Real certificates directory path |
|
24 | - */ |
|
25 | - function getRealCertificatesDirectory(); |
|
20 | + /** |
|
21 | + * Returns the certificates directory path as it is really (within the firewall directory). |
|
22 | + * |
|
23 | + * @return string Real certificates directory path |
|
24 | + */ |
|
25 | + function getRealCertificatesDirectory(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Returns an array of the folders (cities) in the certificate directory. |
|
29 | - * Cities name are UTF8 encoded. |
|
30 | - * |
|
31 | - * @return array Array of cities name |
|
32 | - */ |
|
33 | - function getCitiesList(); |
|
27 | + /** |
|
28 | + * Returns an array of the folders (cities) in the certificate directory. |
|
29 | + * Cities name are UTF8 encoded. |
|
30 | + * |
|
31 | + * @return array Array of cities name |
|
32 | + */ |
|
33 | + function getCitiesList(); |
|
34 | 34 | |
35 | - /** |
|
36 | - * Returns the list of available certificates for a specified city. |
|
37 | - * Format of the list : |
|
38 | - * < file name , date of the certificate , type of certificate , name of the certificate > |
|
39 | - * Data are UTF8 encoded. |
|
40 | - * |
|
41 | - * @param string $selCity City to look in |
|
42 | - * @return array List of certificates |
|
43 | - */ |
|
44 | - function getCertificatesList($selCity); |
|
35 | + /** |
|
36 | + * Returns the list of available certificates for a specified city. |
|
37 | + * Format of the list : |
|
38 | + * < file name , date of the certificate , type of certificate , name of the certificate > |
|
39 | + * Data are UTF8 encoded. |
|
40 | + * |
|
41 | + * @param string $selCity City to look in |
|
42 | + * @return array List of certificates |
|
43 | + */ |
|
44 | + function getCertificatesList($selCity); |
|
45 | 45 | |
46 | - /** |
|
47 | - * Return the list of certificates from a city $city and containing the characters $contains |
|
48 | - * |
|
49 | - * @param string $city City to search in |
|
50 | - * @param string $contains Characters to match |
|
51 | - * @param string $limit Maximum number of results |
|
52 | - * @return array Array of matching certificates |
|
53 | - */ |
|
54 | - function getCertificatesListBeginWith($city, $contains, $limit); |
|
46 | + /** |
|
47 | + * Return the list of certificates from a city $city and containing the characters $contains |
|
48 | + * |
|
49 | + * @param string $city City to search in |
|
50 | + * @param string $contains Characters to match |
|
51 | + * @param string $limit Maximum number of results |
|
52 | + * @return array Array of matching certificates |
|
53 | + */ |
|
54 | + function getCertificatesListBeginWith($city, $contains, $limit); |
|
55 | 55 | |
56 | 56 | } |
57 | 57 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * Interface for providers of certificates |
17 | 17 | */ |
18 | -interface CertificateProviderInterface { |
|
18 | +interface CertificateProviderInterface { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Returns the certificates directory path as it is really (within the firewall directory). |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class Certificate extends Media { |
37 | 37 | |
38 | - const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
38 | + const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
39 | 39 | |
40 | - /** @var string The "TITL" value from the GEDCOM |
|
41 | - * This is a tweak to overcome the private level from the parent object... |
|
42 | - */ |
|
43 | - protected $title = ''; |
|
40 | + /** @var string The "TITL" value from the GEDCOM |
|
41 | + * This is a tweak to overcome the private level from the parent object... |
|
42 | + */ |
|
43 | + protected $title = ''; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Certificate provider |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param CertificateProviderInterface $provider |
81 | 81 | */ |
82 | 82 | public function __construct($data, Tree $tree, CertificateProviderInterface $provider) { |
83 | - $this->provider = $provider; |
|
83 | + $this->provider = $provider; |
|
84 | 84 | // Data is only the file name |
85 | 85 | $data = str_replace("\\", '/', $data); |
86 | 86 | $xref = Functions::encryptToSafeBase64($data); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @see \Fisharebest\Webtrees\Media::getTitle() |
166 | 166 | */ |
167 | 167 | public function getTitle() { |
168 | - return $this->title; |
|
168 | + return $this->title; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -241,26 +241,26 @@ discard block |
||
241 | 241 | $module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME); |
242 | 242 | |
243 | 243 | if($module) { |
244 | - $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
|
245 | - $sid= Filter::get('sid', WT_REGEX_XREF); |
|
244 | + $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
|
245 | + $sid= Filter::get('sid', WT_REGEX_XREF); |
|
246 | 246 | |
247 | - if($sid){ |
|
248 | - $this->source = Source::getInstance($sid, $this->tree); |
|
249 | - } |
|
250 | - else{ |
|
251 | - $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
252 | - } |
|
247 | + if($sid){ |
|
248 | + $this->source = Source::getInstance($sid, $this->tree); |
|
249 | + } |
|
250 | + else{ |
|
251 | + $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
252 | + } |
|
253 | 253 | |
254 | - if($this->source) { |
|
255 | - $wmtext = '©'; |
|
256 | - $repofact = $this->source->getFirstFact('REPO'); |
|
257 | - if($repofact) { |
|
258 | - $repo = $repofact->getTarget(); |
|
259 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | - } |
|
261 | - $wmtext .= $this->source->getFullName(); |
|
262 | - } |
|
263 | - return $wmtext; |
|
254 | + if($this->source) { |
|
255 | + $wmtext = '©'; |
|
256 | + $repofact = $this->source->getFirstFact('REPO'); |
|
257 | + if($repofact) { |
|
258 | + $repo = $repofact->getTarget(); |
|
259 | + if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | + } |
|
261 | + $wmtext .= $this->source->getFullName(); |
|
262 | + } |
|
263 | + return $wmtext; |
|
264 | 264 | } |
265 | 265 | return ''; |
266 | 266 | } |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | ' FROM `##individuals`'. |
324 | 324 | ' WHERE i_file= :gedcom_id AND i_gedcom LIKE :gedcom') |
325 | 325 | ->execute(array( |
326 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
327 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
326 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
327 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
328 | 328 | ))->fetchAll(); |
329 | 329 | |
330 | 330 | $list = array(); |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | ' FROM `##families`'. |
348 | 348 | ' WHERE f_file= :gedcom_id AND f_gedcom LIKE :gedcom') |
349 | 349 | ->execute(array( |
350 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
351 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
350 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
351 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
352 | 352 | ))->fetchAll(); |
353 | 353 | |
354 | 354 | $list = array(); |
@@ -375,25 +375,25 @@ discard block |
||
375 | 375 | 'SELECT i_gedcom AS gedrec FROM `##individuals`'. |
376 | 376 | ' WHERE i_file=:gedcom_id AND i_gedcom LIKE :gedcom') |
377 | 377 | ->execute(array( |
378 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
379 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
378 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
379 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
380 | 380 | ))->fetchOne(); |
381 | 381 | if(!$ged){ |
382 | 382 | $ged = Database::prepare( |
383 | 383 | 'SELECT f_gedcom AS gedrec FROM `##families`'. |
384 | 384 | ' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom') |
385 | - ->execute(array( |
|
386 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
387 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
388 | - ))->fetchOne(); |
|
385 | + ->execute(array( |
|
386 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
387 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
388 | + ))->fetchOne(); |
|
389 | 389 | if(!$ged){ |
390 | 390 | $ged = Database::prepare( |
391 | - 'SELECT o_gedcom AS gedrec FROM `##other`'. |
|
392 | - ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
|
393 | - ->execute(array( |
|
394 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
395 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
396 | - ))->fetchOne(); |
|
391 | + 'SELECT o_gedcom AS gedrec FROM `##other`'. |
|
392 | + ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
|
393 | + ->execute(array( |
|
394 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
395 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
396 | + ))->fetchOne(); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | //If a record has been found, parse it to find the source reference. |
@@ -118,8 +118,7 @@ discard block |
||
118 | 118 | if(Functions::isValidPath($certfile, true)) { |
119 | 119 | return new Certificate($certfile, $tree, $provider); |
120 | 120 | } |
121 | - } |
|
122 | - catch (\Exception $ex) { |
|
121 | + } catch (\Exception $ex) { |
|
123 | 122 | Log::addErrorLog('Certificate module error : > '.$ex->getMessage().' < with data > '.$xref.' <'); |
124 | 123 | } |
125 | 124 | |
@@ -202,7 +201,9 @@ discard block |
||
202 | 201 | */ |
203 | 202 | public function getCity(){ |
204 | 203 | $chunks = explode('/', $this->getFilename(), 2); |
205 | - if(count($chunks) > 1) return $chunks[0]; |
|
204 | + if(count($chunks) > 1) { |
|
205 | + return $chunks[0]; |
|
206 | + } |
|
206 | 207 | return null; |
207 | 208 | } |
208 | 209 | |
@@ -246,8 +247,7 @@ discard block |
||
246 | 247 | |
247 | 248 | if($sid){ |
248 | 249 | $this->source = Source::getInstance($sid, $this->tree); |
249 | - } |
|
250 | - else{ |
|
250 | + } else{ |
|
251 | 251 | $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
252 | 252 | } |
253 | 253 | |
@@ -256,7 +256,9 @@ discard block |
||
256 | 256 | $repofact = $this->source->getFirstFact('REPO'); |
257 | 257 | if($repofact) { |
258 | 258 | $repo = $repofact->getTarget(); |
259 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
259 | + if($repo && $repo instanceof Repository) { |
|
260 | + $wmtext .= ' '.$repo->getFullName().' - '; |
|
261 | + } |
|
260 | 262 | } |
261 | 263 | $wmtext .= $this->source->getFullName(); |
262 | 264 | } |
@@ -426,7 +428,9 @@ discard block |
||
426 | 428 | } |
427 | 429 | } |
428 | 430 | |
429 | - if($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
431 | + if($sid) { |
|
432 | + $this->source = Source::getInstance($sid, $this->tree); |
|
433 | + } |
|
430 | 434 | |
431 | 435 | return $this->source; |
432 | 436 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class Certificate extends Media { |
37 | 37 | |
38 | - const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
38 | + const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
39 | 39 | |
40 | 40 | /** @var string The "TITL" value from the GEDCOM |
41 | 41 | * This is a tweak to overcome the private level from the parent object... |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | $match = null; |
97 | 97 | $ct = preg_match("/(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}) )?(?<details>.*)/", $this->title, $match); |
98 | - if($ct > 0){ |
|
99 | - $monthId = (int) $match['month']; |
|
98 | + if ($ct > 0) { |
|
99 | + $monthId = (int)$match['month']; |
|
100 | 100 | $calendarShortMonths = Functions::getCalendarShortMonths(); |
101 | 101 | $monthShortName = array_key_exists($monthId, $calendarShortMonths) ? $calendarShortMonths[$monthId] : $monthId; |
102 | 102 | $this->certDate = new Date($match['day'].' '.strtoupper($monthShortName).' '.$match['year']); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | * @see \Fisharebest\Webtrees\GedcomRecord::getInstance() |
113 | 113 | */ |
114 | 114 | static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) { |
115 | - try{ |
|
115 | + try { |
|
116 | 116 | $certfile = Functions::decryptFromSafeBase64($xref); |
117 | 117 | |
118 | 118 | //NEED TO CHECK THAT !!! |
119 | - if(Functions::isValidPath($certfile, true)) { |
|
119 | + if (Functions::isValidPath($certfile, true)) { |
|
120 | 120 | return new Certificate($certfile, $tree, $provider); |
121 | 121 | } |
122 | 122 | } |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param string|Source $xref |
155 | 155 | */ |
156 | - public function setSource($xref){ |
|
157 | - if($xref instanceof Source){ |
|
156 | + public function setSource($xref) { |
|
157 | + if ($xref instanceof Source) { |
|
158 | 158 | $this->source = $xref; |
159 | 159 | } else { |
160 | 160 | $this->source = Source::getInstance($xref, $this->tree); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @return Date Certificate date |
176 | 176 | */ |
177 | - public function getCertificateDate(){ |
|
177 | + public function getCertificateDate() { |
|
178 | 178 | return $this->certDate; |
179 | 179 | } |
180 | 180 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return string Certificate date |
185 | 185 | */ |
186 | - public function getCertificateType(){ |
|
186 | + public function getCertificateType() { |
|
187 | 187 | return $this->certType; |
188 | 188 | } |
189 | 189 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return string Certificate details |
194 | 194 | */ |
195 | - public function getCertificateDetails(){ |
|
195 | + public function getCertificateDetails() { |
|
196 | 196 | return $this->certDetails; |
197 | 197 | } |
198 | 198 | |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string|NULL Certificate city |
203 | 203 | */ |
204 | - public function getCity(){ |
|
204 | + public function getCity() { |
|
205 | 205 | $chunks = explode('/', $this->getFilename(), 2); |
206 | - if(count($chunks) > 1) return $chunks[0]; |
|
206 | + if (count($chunks) > 1) return $chunks[0]; |
|
207 | 207 | return null; |
208 | 208 | } |
209 | 209 | |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | * {@inhericDoc} |
212 | 212 | * @see \Fisharebest\Webtrees\Media::getServerFilename() |
213 | 213 | */ |
214 | - public function getServerFilename($which='main') { |
|
215 | - $filename = $this->provider->getRealCertificatesDirectory() . $this->getFilename(); |
|
214 | + public function getServerFilename($which = 'main') { |
|
215 | + $filename = $this->provider->getRealCertificatesDirectory().$this->getFilename(); |
|
216 | 216 | return Functions::encodeUtf8ToFileSystem($filename); |
217 | 217 | } |
218 | 218 | |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | public function getHtmlUrlDirect($which = 'main', $download = false) { |
224 | 224 | $sidstr = ($this->source) ? '&sid='.$this->source->getXref() : ''; |
225 | 225 | return |
226 | - 'module.php?mod='. \MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME . |
|
227 | - '&mod_action=Certificate@image' . |
|
228 | - '&ged='. $this->tree->getNameUrl() . |
|
229 | - '&cid=' . $this->getXref() . $sidstr . |
|
230 | - '&cb=' . $this->getEtag($which); |
|
226 | + 'module.php?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME. |
|
227 | + '&mod_action=Certificate@image'. |
|
228 | + '&ged='.$this->tree->getNameUrl(). |
|
229 | + '&cid='.$this->getXref().$sidstr. |
|
230 | + '&cb='.$this->getEtag($which); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -238,26 +238,26 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return string Watermark text |
240 | 240 | */ |
241 | - public function getWatermarkText(){ |
|
241 | + public function getWatermarkText() { |
|
242 | 242 | $module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME); |
243 | 243 | |
244 | - if($module) { |
|
244 | + if ($module) { |
|
245 | 245 | $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
246 | - $sid= Filter::get('sid', WT_REGEX_XREF); |
|
246 | + $sid = Filter::get('sid', WT_REGEX_XREF); |
|
247 | 247 | |
248 | - if($sid){ |
|
248 | + if ($sid) { |
|
249 | 249 | $this->source = Source::getInstance($sid, $this->tree); |
250 | 250 | } |
251 | - else{ |
|
252 | - $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
251 | + else { |
|
252 | + $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
253 | 253 | } |
254 | 254 | |
255 | - if($this->source) { |
|
255 | + if ($this->source) { |
|
256 | 256 | $wmtext = '©'; |
257 | 257 | $repofact = $this->source->getFirstFact('REPO'); |
258 | - if($repofact) { |
|
258 | + if ($repofact) { |
|
259 | 259 | $repo = $repofact->getTarget(); |
260 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | + if ($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
261 | 261 | } |
262 | 262 | $wmtext .= $this->source->getFullName(); |
263 | 263 | } |
@@ -279,45 +279,45 @@ discard block |
||
279 | 279 | |
280 | 280 | $script = ''; |
281 | 281 | $controller = Globals::getController(); |
282 | - if($controller && !($controller instanceof IndividualController)){ |
|
282 | + if ($controller && !($controller instanceof IndividualController)) { |
|
283 | 283 | $controller->addInlineJavascript('$(document).ready(function() { '.$js.' });'); |
284 | 284 | } else { |
285 | - $script = '<script>' . $js . '</script>'; |
|
285 | + $script = '<script>'.$js.'</script>'; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | if ($which == 'icon' || !file_exists($this->getServerFilename())) { |
289 | 289 | // Use an icon |
290 | 290 | $image = |
291 | - '<i dir="auto" class="icon-maj-certificate margin-h-2"' . |
|
292 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
291 | + '<i dir="auto" class="icon-maj-certificate margin-h-2"'. |
|
292 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
293 | 293 | '></i>'; |
294 | 294 | } else { |
295 | 295 | $imgsize = getimagesize($this->getServerFilename()); |
296 | 296 | $image = |
297 | - '<img' . |
|
298 | - ' class ="'. 'certif_image' . '"' . |
|
299 | - ' dir="' . 'auto' . '"' . // For the tool-tip |
|
300 | - ' src="' . $this->getHtmlUrlDirect() . '"' . |
|
301 | - ' alt="' . strip_tags($this->getFullName()) . '"' . |
|
302 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
303 | - $imgsize[3] . // height="yyy" width="xxx" |
|
297 | + '<img'. |
|
298 | + ' class ="'.'certif_image'.'"'. |
|
299 | + ' dir="'.'auto'.'"'.// For the tool-tip |
|
300 | + ' src="'.$this->getHtmlUrlDirect().'"'. |
|
301 | + ' alt="'.strip_tags($this->getFullName()).'"'. |
|
302 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
303 | + $imgsize[3].// height="yyy" width="xxx" |
|
304 | 304 | '>'; |
305 | 305 | } |
306 | 306 | return |
307 | - '<a' . |
|
308 | - ' class="' . 'certgallery' . '"' . |
|
309 | - ' href="' . $this->getHtmlUrlDirect() . '"' . |
|
310 | - ' type="' . $this->mimeType() . '"' . |
|
311 | - ' data-obje-url="' . $this->getHtmlUrl() . '"' . |
|
312 | - ' data-title="' . strip_tags($this->getFullName()) . '"' . |
|
313 | - '>' . $image . '</a>'.$script; |
|
307 | + '<a'. |
|
308 | + ' class="'.'certgallery'.'"'. |
|
309 | + ' href="'.$this->getHtmlUrlDirect().'"'. |
|
310 | + ' type="'.$this->mimeType().'"'. |
|
311 | + ' data-obje-url="'.$this->getHtmlUrl().'"'. |
|
312 | + ' data-title="'.strip_tags($this->getFullName()).'"'. |
|
313 | + '>'.$image.'</a>'.$script; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | 317 | * {@inhericDoc} |
318 | 318 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedIndividuals() |
319 | 319 | */ |
320 | - public function linkedIndividuals($link = '_ACT'){ |
|
320 | + public function linkedIndividuals($link = '_ACT') { |
|
321 | 321 | $rows = Database::prepare( |
322 | 322 | 'SELECT i_id AS xref, i_gedcom AS gedcom'. |
323 | 323 | ' FROM `##individuals`'. |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * {@inhericDoc} |
342 | 342 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedFamilies() |
343 | 343 | */ |
344 | - public function linkedFamilies($link = '_ACT'){ |
|
344 | + public function linkedFamilies($link = '_ACT') { |
|
345 | 345 | $rows = Database::prepare( |
346 | 346 | 'SELECT f_id AS xref, f_gedcom AS gedcom'. |
347 | 347 | ' FROM `##families`'. |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @return Source|NULL Linked source |
368 | 368 | */ |
369 | - public function fetchALinkedSource(){ |
|
369 | + public function fetchALinkedSource() { |
|
370 | 370 | $sid = null; |
371 | 371 | |
372 | 372 | // Try to find in individual, then families, then other types of records. We are interested in the first available value. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'gedcom_id' => $this->tree->getTreeId(), |
379 | 379 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
380 | 380 | ))->fetchOne(); |
381 | - if(!$ged){ |
|
381 | + if (!$ged) { |
|
382 | 382 | $ged = Database::prepare( |
383 | 383 | 'SELECT f_gedcom AS gedrec FROM `##families`'. |
384 | 384 | ' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom') |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | 'gedcom_id' => $this->tree->getTreeId(), |
387 | 387 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
388 | 388 | ))->fetchOne(); |
389 | - if(!$ged){ |
|
389 | + if (!$ged) { |
|
390 | 390 | $ged = Database::prepare( |
391 | 391 | 'SELECT o_gedcom AS gedrec FROM `##other`'. |
392 | 392 | ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
@@ -397,19 +397,19 @@ discard block |
||
397 | 397 | } |
398 | 398 | } |
399 | 399 | //If a record has been found, parse it to find the source reference. |
400 | - if($ged){ |
|
400 | + if ($ged) { |
|
401 | 401 | $gedlines = explode("\n", $ged); |
402 | 402 | $level = 0; |
403 | 403 | $levelsource = -1; |
404 | - $sid_tmp=null; |
|
404 | + $sid_tmp = null; |
|
405 | 405 | $sourcefound = false; |
406 | - foreach($gedlines as $gedline){ |
|
406 | + foreach ($gedlines as $gedline) { |
|
407 | 407 | // Get the level |
408 | 408 | $match = null; |
409 | 409 | if (!$sourcefound && preg_match('~^('.WT_REGEX_INTEGER.') ~', $gedline, $match)) { |
410 | 410 | $level = $match[1]; |
411 | 411 | //If we are not any more within the context of a source, reset |
412 | - if($level <= $levelsource){ |
|
412 | + if ($level <= $levelsource) { |
|
413 | 413 | $levelsource = -1; |
414 | 414 | $sid_tmp = null; |
415 | 415 | } |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | $match2 = null; |
418 | 418 | if (preg_match('~^'.$level.' SOUR @('.WT_REGEX_XREF.')@$~', $gedline, $match2)) { |
419 | 419 | $levelsource = $level; |
420 | - $sid_tmp=$match2[1]; |
|
420 | + $sid_tmp = $match2[1]; |
|
421 | 421 | } |
422 | 422 | // If the image has be found, get the source reference and exit. |
423 | 423 | $match3 = null; |
424 | - if($levelsource>=0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)){ |
|
424 | + if ($levelsource >= 0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)) { |
|
425 | 425 | $sid = $sid_tmp; |
426 | 426 | $sourcefound = true; |
427 | 427 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | - if($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
432 | + if ($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
433 | 433 | |
434 | 434 | return $this->source; |
435 | 435 | } |