@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | * {@inhericDoc} |
24 | 24 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
25 | 25 | */ |
26 | - protected function renderContent() { |
|
26 | + protected function renderContent() { |
|
27 | 27 | |
28 | - /** @var Tree $tree */ |
|
29 | - $tree = $this->data->get('tree'); |
|
30 | - $root_url = $this->data->get('root_url'); |
|
31 | - $other_trees = $this->data->get('other_trees'); |
|
32 | - $table_id = $this->data->get('table_id'); |
|
33 | - ?> |
|
28 | + /** @var Tree $tree */ |
|
29 | + $tree = $this->data->get('tree'); |
|
30 | + $root_url = $this->data->get('root_url'); |
|
31 | + $other_trees = $this->data->get('other_trees'); |
|
32 | + $table_id = $this->data->get('table_id'); |
|
33 | + ?> |
|
34 | 34 | <ol class="breadcrumb small"> |
35 | 35 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
36 | 36 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -63,23 +63,23 @@ discard block |
||
63 | 63 | <p> |
64 | 64 | <?php $places_hierarchy = $this->data->get('places_hierarchy'); |
65 | 65 | if($places_hierarchy) { |
66 | - switch ($places_hierarchy['type']) { |
|
67 | - case 'header': |
|
68 | - echo I18N::translate('According to the GEDCOM header, the places within your file follows the structure: '); |
|
69 | - break; |
|
70 | - case 'data': |
|
71 | - echo I18N::translate('Your GEDCOM header does not contain any indication of place structure.'). |
|
72 | - '<br/>'. |
|
73 | - I18N::translate('Here is an example of your place data: '); |
|
74 | - break; |
|
75 | - default: |
|
76 | - break; |
|
77 | - } |
|
78 | - $str_hierarchy = array(); |
|
79 | - foreach($places_hierarchy['hierarchy'] as $key => $level) { |
|
80 | - $str_hierarchy[] = I18N::translate('(%d) %s', $key + 1, $level); |
|
81 | - } |
|
82 | - echo '<strong>' . implode(I18N::$list_separator, $str_hierarchy) . '</strong>'; |
|
66 | + switch ($places_hierarchy['type']) { |
|
67 | + case 'header': |
|
68 | + echo I18N::translate('According to the GEDCOM header, the places within your file follows the structure: '); |
|
69 | + break; |
|
70 | + case 'data': |
|
71 | + echo I18N::translate('Your GEDCOM header does not contain any indication of place structure.'). |
|
72 | + '<br/>'. |
|
73 | + I18N::translate('Here is an example of your place data: '); |
|
74 | + break; |
|
75 | + default: |
|
76 | + break; |
|
77 | + } |
|
78 | + $str_hierarchy = array(); |
|
79 | + foreach($places_hierarchy['hierarchy'] as $key => $level) { |
|
80 | + $str_hierarchy[] = I18N::translate('(%d) %s', $key + 1, $level); |
|
81 | + } |
|
82 | + echo '<strong>' . implode(I18N::$list_separator, $str_hierarchy) . '</strong>'; |
|
83 | 83 | } |
84 | 84 | ?> |
85 | 85 | </p> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | </a> |
110 | 110 | |
111 | 111 | <?php |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | |
116 | 116 | \ No newline at end of file |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | |
42 | 42 | <h2> |
43 | 43 | <?php echo $tree->getTitleHtml(); ?> |
44 | - <?php if(count($other_trees) > 0) {?> |
|
44 | + <?php if (count($other_trees) > 0) {?> |
|
45 | 45 | <div class="btn-group"> |
46 | 46 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
47 | 47 | <?php echo I18N::translate('Change tree'); ?> |
48 | 48 | <span class="caret"></span> |
49 | 49 | </button> |
50 | - <?php foreach($other_trees as $other_tree) { ?> |
|
50 | + <?php foreach ($other_trees as $other_tree) { ?> |
|
51 | 51 | <ul class="dropdown-menu" role="menu"> |
52 | 52 | <li> |
53 | - <a href="<?php echo $root_url . '&ged=' . $other_tree->getNameUrl(); ?>"> |
|
53 | + <a href="<?php echo $root_url.'&ged='.$other_tree->getNameUrl(); ?>"> |
|
54 | 54 | <i class="fa fa-fw fa-tree"></i> <?php echo $other_tree->getTitleHtml(); ?> |
55 | 55 | </a> |
56 | 56 | </li> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | <p> |
64 | 64 | <?php $places_hierarchy = $this->data->get('places_hierarchy'); |
65 | - if($places_hierarchy) { |
|
65 | + if ($places_hierarchy) { |
|
66 | 66 | switch ($places_hierarchy['type']) { |
67 | 67 | case 'header': |
68 | 68 | echo I18N::translate('According to the GEDCOM header, the places within your file follows the structure: '); |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | break; |
77 | 77 | } |
78 | 78 | $str_hierarchy = array(); |
79 | - foreach($places_hierarchy['hierarchy'] as $key => $level) { |
|
79 | + foreach ($places_hierarchy['hierarchy'] as $key => $level) { |
|
80 | 80 | $str_hierarchy[] = I18N::translate('(%d) %s', $key + 1, $level); |
81 | 81 | } |
82 | - echo '<strong>' . implode(I18N::$list_separator, $str_hierarchy) . '</strong>'; |
|
82 | + echo '<strong>'.implode(I18N::$list_separator, $str_hierarchy).'</strong>'; |
|
83 | 83 | } |
84 | 84 | ?> |
85 | 85 | </p> |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | </tbody> |
104 | 104 | </table> |
105 | 105 | |
106 | - <a type="button" class="btn btn-primary" href="<?php echo $root_url . '@add&ged=' . $tree->getNameUrl(); ?>" title="<?php echo I18N::translate('Add'); ?>"> |
|
106 | + <a type="button" class="btn btn-primary" href="<?php echo $root_url.'@add&ged='.$tree->getNameUrl(); ?>" title="<?php echo I18N::translate('Add'); ?>"> |
|
107 | 107 | <i class="fa fa-plus"></i> |
108 | 108 | <?php echo I18N::translate('Add'); ?> |
109 | 109 | </a> |
@@ -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> |
@@ -146,14 +146,15 @@ discard block |
||
146 | 146 | $this->provider->setGeoAnalysisStatus($ga, $status); |
147 | 147 | $res['status'] = $status; |
148 | 148 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
149 | - } |
|
150 | - catch (\Exception $ex) { |
|
149 | + } catch (\Exception $ex) { |
|
151 | 150 | $res['error'] = $ex->getMessage(); |
152 | 151 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
153 | 152 | } |
154 | 153 | |
155 | 154 | $controller->pageHeader(); |
156 | - if($res['error']) http_response_code(500); |
|
155 | + if($res['error']) { |
|
156 | + http_response_code(500); |
|
157 | + } |
|
157 | 158 | |
158 | 159 | echo \Zend_Json::encode($res); |
159 | 160 | } |
@@ -179,14 +180,15 @@ discard block |
||
179 | 180 | try{ |
180 | 181 | $this->provider->deleteGeoAnalysis($ga); |
181 | 182 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
182 | - } |
|
183 | - catch (\Exception $ex) { |
|
183 | + } catch (\Exception $ex) { |
|
184 | 184 | $res['error'] = $ex->getMessage(); |
185 | 185 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
186 | 186 | } |
187 | 187 | |
188 | 188 | $controller->pageHeader(); |
189 | - if($res['error']) http_response_code(500); |
|
189 | + if($res['error']) { |
|
190 | + http_response_code(500); |
|
191 | + } |
|
190 | 192 | |
191 | 193 | echo \Zend_Json::encode($res); |
192 | 194 | } |
@@ -242,7 +244,9 @@ discard block |
||
242 | 244 | |
243 | 245 | $nb_found = $placesGeneralResults['knownsum']; |
244 | 246 | $nb_other = 0; |
245 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
247 | + if(isset($placesGeneralResults['other'])) { |
|
248 | + $nb_other =$placesGeneralResults['other']; |
|
249 | + } |
|
246 | 250 | $nb_unknown = $placesGeneralResults['unknown']; |
247 | 251 | |
248 | 252 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -264,11 +268,12 @@ discard block |
||
264 | 268 | if($level_map >= 0 && $level_map < count($levelvalues)) { |
265 | 269 | $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
266 | 270 | if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
267 | - } |
|
268 | - else { |
|
271 | + } else { |
|
269 | 272 | $levelref = $levelvalues[0]; |
270 | 273 | } |
271 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
274 | + if(isset($places_mappings[$levelref])) { |
|
275 | + $levelref = $places_mappings[$levelref]; |
|
276 | + } |
|
272 | 277 | if(isset($results_by_subdivs[$levelref])) { |
273 | 278 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
274 | 279 | $count_subd += $count; |
@@ -285,8 +290,7 @@ discard block |
||
285 | 290 | $data->set('results_by_subdivisions', $results_by_subdivs); |
286 | 291 | |
287 | 292 | $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
288 | - } |
|
289 | - else { |
|
293 | + } else { |
|
290 | 294 | $results = $placesGeneralResults['places']; |
291 | 295 | arsort($results); |
292 | 296 | $data->set('results', $results); |
@@ -294,8 +298,7 @@ discard block |
||
294 | 298 | |
295 | 299 | $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
296 | 300 | } |
297 | - } |
|
298 | - else { |
|
301 | + } else { |
|
299 | 302 | $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
300 | 303 | } |
301 | 304 | return $html; |
@@ -330,9 +333,15 @@ discard block |
||
330 | 333 | $sum = 0; |
331 | 334 | $other = 0; |
332 | 335 | $unknown = 0; |
333 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
334 | - if(isset($genData['other'])) $other = $genData['other']; |
|
335 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
336 | + if(isset($genData['sum'])) { |
|
337 | + $sum = $genData['sum']; |
|
338 | + } |
|
339 | + if(isset($genData['other'])) { |
|
340 | + $other = $genData['other']; |
|
341 | + } |
|
342 | + if(isset($genData['unknown'])) { |
|
343 | + $unknown = $genData['unknown']; |
|
344 | + } |
|
336 | 345 | |
337 | 346 | if($sum > 0) { |
338 | 347 | $results_by_gen[$gen]['sum'] = $sum; |
@@ -351,8 +360,7 @@ discard block |
||
351 | 360 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
352 | 361 | } |
353 | 362 | } |
354 | - } |
|
355 | - else { |
|
363 | + } else { |
|
356 | 364 | $tmp = $genData['places']; |
357 | 365 | if($other > 0) { |
358 | 366 | $tmp = array_slice($tmp, 0, 5, true); |
@@ -368,8 +376,7 @@ discard block |
||
368 | 376 | |
369 | 377 | $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
370 | 378 | |
371 | - } |
|
372 | - else { |
|
379 | + } else { |
|
373 | 380 | $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
374 | 381 | } |
375 | 382 | return $html; |
@@ -35,47 +35,47 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class GeoAnalysisController extends MvcController |
37 | 37 | { |
38 | - /** |
|
39 | - * GeoAnalysis Provider |
|
40 | - * @var GeoAnalysisProvider $provider |
|
41 | - */ |
|
42 | - protected $provider; |
|
38 | + /** |
|
39 | + * GeoAnalysis Provider |
|
40 | + * @var GeoAnalysisProvider $provider |
|
41 | + */ |
|
42 | + protected $provider; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Constructor for GeoAnalysis controller |
|
46 | - * @param AbstractModule $module |
|
47 | - */ |
|
48 | - public function __construct(AbstractModule $module) { |
|
49 | - parent::__construct($module); |
|
44 | + /** |
|
45 | + * Constructor for GeoAnalysis controller |
|
46 | + * @param AbstractModule $module |
|
47 | + */ |
|
48 | + public function __construct(AbstractModule $module) { |
|
49 | + parent::__construct($module); |
|
50 | 50 | |
51 | - $this->provider = $this->module->getProvider(); |
|
52 | - } |
|
51 | + $this->provider = $this->module->getProvider(); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Pages |
|
56 | - */ |
|
54 | + /** |
|
55 | + * Pages |
|
56 | + */ |
|
57 | 57 | |
58 | - /** |
|
59 | - * GeoAnalysis@index |
|
60 | - */ |
|
61 | - public function index() { |
|
58 | + /** |
|
59 | + * GeoAnalysis@index |
|
60 | + */ |
|
61 | + public function index() { |
|
62 | 62 | |
63 | - $controller = new PageController(); |
|
64 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
63 | + $controller = new PageController(); |
|
64 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
65 | 65 | |
66 | - $data = new ViewBag(); |
|
67 | - $data->set('title', $controller->getPageTitle()); |
|
68 | - $data->set('has_analysis', false); |
|
66 | + $data = new ViewBag(); |
|
67 | + $data->set('title', $controller->getPageTitle()); |
|
68 | + $data->set('has_analysis', false); |
|
69 | 69 | |
70 | - $ga_id = Filter::getInteger('ga_id'); |
|
70 | + $ga_id = Filter::getInteger('ga_id'); |
|
71 | 71 | |
72 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
73 | - $data->set('has_analysis', true); |
|
74 | - $data->set('geoanalysis', $ga); |
|
72 | + if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
73 | + $data->set('has_analysis', true); |
|
74 | + $data->set('geoanalysis', $ga); |
|
75 | 75 | |
76 | - $controller |
|
77 | - ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
78 | - ->addInlineJavascript(' |
|
76 | + $controller |
|
77 | + ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
78 | + ->addInlineJavascript(' |
|
79 | 79 | jQuery("#geodispersion-tabs").tabs(); |
80 | 80 | jQuery("#geodispersion-tabs").css("visibility", "visible"); |
81 | 81 | |
@@ -96,133 +96,133 @@ discard block |
||
96 | 96 | "json" |
97 | 97 | ); |
98 | 98 | '); |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
102 | - } |
|
101 | + ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * GeoAnalysis@listAll |
|
106 | - */ |
|
107 | - public function listAll() { |
|
104 | + /** |
|
105 | + * GeoAnalysis@listAll |
|
106 | + */ |
|
107 | + public function listAll() { |
|
108 | 108 | |
109 | - $controller = new PageController(); |
|
110 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
109 | + $controller = new PageController(); |
|
110 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
111 | 111 | |
112 | - $data = new ViewBag(); |
|
113 | - $data->set('title', $controller->getPageTitle()); |
|
114 | - $data->set('has_list', false); |
|
112 | + $data = new ViewBag(); |
|
113 | + $data->set('title', $controller->getPageTitle()); |
|
114 | + $data->set('has_list', false); |
|
115 | 115 | |
116 | - $ga_list = $this->provider->getGeoAnalysisList(); |
|
117 | - if(count($ga_list) > 0 ) { |
|
118 | - $data->set('has_list', true); |
|
119 | - $data->set('geoanalysislist', $ga_list); |
|
120 | - } |
|
116 | + $ga_list = $this->provider->getGeoAnalysisList(); |
|
117 | + if(count($ga_list) > 0 ) { |
|
118 | + $data->set('has_list', true); |
|
119 | + $data->set('geoanalysislist', $ga_list); |
|
120 | + } |
|
121 | 121 | |
122 | - ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
123 | - } |
|
122 | + ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
123 | + } |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * GeoAnalysis@setStatus |
127 | 127 | */ |
128 | - public function setStatus() { |
|
129 | - global $WT_TREE; |
|
128 | + public function setStatus() { |
|
129 | + global $WT_TREE; |
|
130 | 130 | |
131 | - $controller = new JsonController(); |
|
131 | + $controller = new JsonController(); |
|
132 | 132 | |
133 | - $ga_id = Filter::getInteger('ga_id'); |
|
134 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
133 | + $ga_id = Filter::getInteger('ga_id'); |
|
134 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
135 | 135 | |
136 | - $controller->restrictAccess( |
|
137 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
138 | - && Auth::isManager($WT_TREE) |
|
139 | - && $ga !== null |
|
140 | - ); |
|
136 | + $controller->restrictAccess( |
|
137 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
138 | + && Auth::isManager($WT_TREE) |
|
139 | + && $ga !== null |
|
140 | + ); |
|
141 | 141 | |
142 | - $status = Filter::getBool('status'); |
|
143 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
144 | - try{ |
|
145 | - $this->provider->setGeoAnalysisStatus($ga, $status); |
|
146 | - $res['status'] = $status; |
|
142 | + $status = Filter::getBool('status'); |
|
143 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
144 | + try{ |
|
145 | + $this->provider->setGeoAnalysisStatus($ga, $status); |
|
146 | + $res['status'] = $status; |
|
147 | 147 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
148 | - } |
|
149 | - catch (\Exception $ex) { |
|
150 | - $res['error'] = $ex->getMessage(); |
|
148 | + } |
|
149 | + catch (\Exception $ex) { |
|
150 | + $res['error'] = $ex->getMessage(); |
|
151 | 151 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
152 | - } |
|
152 | + } |
|
153 | 153 | |
154 | - $controller->pageHeader(); |
|
155 | - if($res['error']) http_response_code(500); |
|
154 | + $controller->pageHeader(); |
|
155 | + if($res['error']) http_response_code(500); |
|
156 | 156 | |
157 | - echo \Zend_Json::encode($res); |
|
158 | - } |
|
157 | + echo \Zend_Json::encode($res); |
|
158 | + } |
|
159 | 159 | |
160 | 160 | /** |
161 | - * GeoAnalysis@delete |
|
162 | - */ |
|
163 | - public function delete() { |
|
164 | - global $WT_TREE; |
|
161 | + * GeoAnalysis@delete |
|
162 | + */ |
|
163 | + public function delete() { |
|
164 | + global $WT_TREE; |
|
165 | 165 | |
166 | - $controller = new JsonController(); |
|
166 | + $controller = new JsonController(); |
|
167 | 167 | |
168 | - $ga_id = Filter::getInteger('ga_id'); |
|
169 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
168 | + $ga_id = Filter::getInteger('ga_id'); |
|
169 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
170 | 170 | |
171 | - $controller->restrictAccess( |
|
172 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
173 | - && Auth::isManager($WT_TREE) |
|
174 | - && $ga |
|
175 | - ); |
|
171 | + $controller->restrictAccess( |
|
172 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
173 | + && Auth::isManager($WT_TREE) |
|
174 | + && $ga |
|
175 | + ); |
|
176 | 176 | |
177 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
178 | - try{ |
|
179 | - $this->provider->deleteGeoAnalysis($ga); |
|
177 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
178 | + try{ |
|
179 | + $this->provider->deleteGeoAnalysis($ga); |
|
180 | 180 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
181 | - } |
|
182 | - catch (\Exception $ex) { |
|
183 | - $res['error'] = $ex->getMessage(); |
|
181 | + } |
|
182 | + catch (\Exception $ex) { |
|
183 | + $res['error'] = $ex->getMessage(); |
|
184 | 184 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | - $controller->pageHeader(); |
|
188 | - if($res['error']) http_response_code(500); |
|
187 | + $controller->pageHeader(); |
|
188 | + if($res['error']) http_response_code(500); |
|
189 | 189 | |
190 | - echo \Zend_Json::encode($res); |
|
191 | - } |
|
190 | + echo \Zend_Json::encode($res); |
|
191 | + } |
|
192 | 192 | |
193 | - /** |
|
194 | - * GeoAnalysis@dataTabs |
|
195 | - */ |
|
196 | - public function dataTabs() { |
|
197 | - global $WT_TREE; |
|
193 | + /** |
|
194 | + * GeoAnalysis@dataTabs |
|
195 | + */ |
|
196 | + public function dataTabs() { |
|
197 | + global $WT_TREE; |
|
198 | 198 | |
199 | - $controller = new JsonController(); |
|
199 | + $controller = new JsonController(); |
|
200 | 200 | |
201 | - $ga_id = Filter::getInteger('ga_id'); |
|
202 | - $ga = $this->provider->getGeoAnalysis($ga_id); |
|
203 | - $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
201 | + $ga_id = Filter::getInteger('ga_id'); |
|
202 | + $ga = $this->provider->getGeoAnalysis($ga_id); |
|
203 | + $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
204 | 204 | |
205 | - $controller |
|
206 | - ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
207 | - ->pageHeader(); |
|
205 | + $controller |
|
206 | + ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
207 | + ->pageHeader(); |
|
208 | 208 | |
209 | - $jsonArray = array(); |
|
209 | + $jsonArray = array(); |
|
210 | 210 | |
211 | - list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
211 | + list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
212 | 212 | |
213 | - $flags = array(); |
|
214 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
215 | - $mapProvider = new GoogleMapsProvider(); |
|
216 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
217 | - $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
218 | - } |
|
219 | - } |
|
213 | + $flags = array(); |
|
214 | + if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
215 | + $mapProvider = new GoogleMapsProvider(); |
|
216 | + foreach($placesDispGeneral['places'] as $place => $count) { |
|
217 | + $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
218 | + } |
|
219 | + } |
|
220 | 220 | |
221 | - $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
222 | - $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
221 | + $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
222 | + $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
223 | 223 | |
224 | - echo \Zend_Json::encode($jsonArray); |
|
225 | - } |
|
224 | + echo \Zend_Json::encode($jsonArray); |
|
225 | + } |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Returns HTML code for the GeoAnalysis general tab (can be either a map or a table). |
@@ -232,70 +232,70 @@ discard block |
||
232 | 232 | * @param (null|array) $flags Array of flags |
233 | 233 | * @return string HTML code for the general tab |
234 | 234 | */ |
235 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
236 | - global $WT_TREE; |
|
235 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
236 | + global $WT_TREE; |
|
237 | 237 | |
238 | - if(!empty($placesGeneralResults)){ |
|
239 | - $data = new ViewBag(); |
|
238 | + if(!empty($placesGeneralResults)){ |
|
239 | + $data = new ViewBag(); |
|
240 | 240 | |
241 | - $nb_found = $placesGeneralResults['knownsum']; |
|
242 | - $nb_other = 0; |
|
243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
244 | - $nb_unknown = $placesGeneralResults['unknown']; |
|
241 | + $nb_found = $placesGeneralResults['knownsum']; |
|
242 | + $nb_other = 0; |
|
243 | + if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
244 | + $nb_unknown = $placesGeneralResults['unknown']; |
|
245 | 245 | |
246 | - $data->set('stats_gen_nb_found', $nb_found); |
|
247 | - $data->set('stats_gen_nb_other', $nb_other); |
|
248 | - $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
246 | + $data->set('stats_gen_nb_found', $nb_found); |
|
247 | + $data->set('stats_gen_nb_other', $nb_other); |
|
248 | + $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
249 | 249 | |
250 | - $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
250 | + $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
251 | 251 | |
252 | - if($ga->hasMap()) { |
|
253 | - $max = $placesGeneralResults['max']; |
|
254 | - $map = $ga->getOptions()->getMap(); |
|
255 | - $results_by_subdivs = $map->getSubdivisions(); |
|
256 | - $places_mappings = $map->getPlacesMappings(); |
|
257 | - foreach ($placesGeneralResults['places'] as $location => $count) { |
|
258 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
259 | - $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
260 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
261 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
262 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
263 | - } |
|
264 | - else { |
|
265 | - $levelref = $levelvalues[0]; |
|
266 | - } |
|
267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
268 | - if(isset($results_by_subdivs[$levelref])) { |
|
269 | - $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
270 | - $count_subd += $count; |
|
271 | - $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
272 | - $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
273 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
274 | - $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
275 | - $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
276 | - } |
|
277 | - } |
|
278 | - } |
|
252 | + if($ga->hasMap()) { |
|
253 | + $max = $placesGeneralResults['max']; |
|
254 | + $map = $ga->getOptions()->getMap(); |
|
255 | + $results_by_subdivs = $map->getSubdivisions(); |
|
256 | + $places_mappings = $map->getPlacesMappings(); |
|
257 | + foreach ($placesGeneralResults['places'] as $location => $count) { |
|
258 | + $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
259 | + $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
260 | + if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
261 | + $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
262 | + if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
263 | + } |
|
264 | + else { |
|
265 | + $levelref = $levelvalues[0]; |
|
266 | + } |
|
267 | + if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
268 | + if(isset($results_by_subdivs[$levelref])) { |
|
269 | + $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
270 | + $count_subd += $count; |
|
271 | + $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
272 | + $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
273 | + if($ga->getOptions()->isUsingFlags() && $flags) { |
|
274 | + $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
275 | + $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
276 | + } |
|
277 | + } |
|
278 | + } |
|
279 | 279 | |
280 | - $data->set('map', $ga->getOptions()->getMap()); |
|
281 | - $data->set('results_by_subdivisions', $results_by_subdivs); |
|
280 | + $data->set('map', $ga->getOptions()->getMap()); |
|
281 | + $data->set('results_by_subdivisions', $results_by_subdivs); |
|
282 | 282 | |
283 | - $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
284 | - } |
|
285 | - else { |
|
286 | - $results = $placesGeneralResults['places']; |
|
287 | - arsort($results); |
|
288 | - $data->set('results', $results); |
|
289 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
283 | + $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
284 | + } |
|
285 | + else { |
|
286 | + $results = $placesGeneralResults['places']; |
|
287 | + arsort($results); |
|
288 | + $data->set('results', $results); |
|
289 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
290 | 290 | |
291 | - $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
292 | - } |
|
293 | - } |
|
294 | - else { |
|
295 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
296 | - } |
|
297 | - return $html; |
|
298 | - } |
|
291 | + $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
292 | + } |
|
293 | + } |
|
294 | + else { |
|
295 | + $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
296 | + } |
|
297 | + return $html; |
|
298 | + } |
|
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Returns HTML code for the GeoAnalysis generations tab. |
@@ -305,68 +305,68 @@ discard block |
||
305 | 305 | * @param (null|array) $flags Array of flags |
306 | 306 | * @return string HTML code for the generations tab |
307 | 307 | */ |
308 | - protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
309 | - global $WT_TREE; |
|
308 | + protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
309 | + global $WT_TREE; |
|
310 | 310 | |
311 | - if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
312 | - $data = new ViewBag(); |
|
311 | + if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
312 | + $data = new ViewBag(); |
|
313 | 313 | |
314 | - ksort($placesGenerationsResults); |
|
314 | + ksort($placesGenerationsResults); |
|
315 | 315 | |
316 | - $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
317 | - $data->set('max_details_gen', $detailslevel); |
|
318 | - $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
319 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
320 | - $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
321 | - $data->set('display_all_places', $display_all_places); |
|
316 | + $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
317 | + $data->set('max_details_gen', $detailslevel); |
|
318 | + $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
319 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
320 | + $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
321 | + $data->set('display_all_places', $display_all_places); |
|
322 | 322 | |
323 | - $results_by_gen = array(); |
|
324 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
325 | - $sum = 0; |
|
326 | - $other = 0; |
|
327 | - $unknown = 0; |
|
328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
323 | + $results_by_gen = array(); |
|
324 | + foreach($placesGenerationsResults as $gen => $genData){ |
|
325 | + $sum = 0; |
|
326 | + $other = 0; |
|
327 | + $unknown = 0; |
|
328 | + if(isset($genData['sum'])) $sum = $genData['sum']; |
|
329 | + if(isset($genData['other'])) $other = $genData['other']; |
|
330 | + if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
331 | 331 | |
332 | - if($sum > 0) { |
|
333 | - $results_by_gen[$gen]['sum'] = $sum; |
|
334 | - $results_by_gen[$gen]['other'] = $other; |
|
335 | - $results_by_gen[$gen]['unknown'] = $unknown; |
|
336 | - $results_by_gen[$gen]['places'] = array(); |
|
337 | - arsort($genData['places']); |
|
332 | + if($sum > 0) { |
|
333 | + $results_by_gen[$gen]['sum'] = $sum; |
|
334 | + $results_by_gen[$gen]['other'] = $other; |
|
335 | + $results_by_gen[$gen]['unknown'] = $unknown; |
|
336 | + $results_by_gen[$gen]['places'] = array(); |
|
337 | + arsort($genData['places']); |
|
338 | 338 | |
339 | - if($display_all_places){ |
|
340 | - foreach($genData['places'] as $placename=> $count){ |
|
341 | - $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
339 | + if($display_all_places){ |
|
340 | + foreach($genData['places'] as $placename=> $count){ |
|
341 | + $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
342 | 342 | |
343 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
344 | - $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
345 | - $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
346 | - } |
|
347 | - } |
|
348 | - } |
|
349 | - else { |
|
350 | - $tmp = $genData['places']; |
|
351 | - if($other > 0) { |
|
352 | - $tmp = array_slice($tmp, 0, 5, true); |
|
353 | - $tmp['other'] = $other; |
|
354 | - arsort($tmp); |
|
355 | - } |
|
356 | - $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
357 | - } |
|
358 | - } |
|
359 | - } |
|
343 | + if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
344 | + $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
345 | + $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
346 | + } |
|
347 | + } |
|
348 | + } |
|
349 | + else { |
|
350 | + $tmp = $genData['places']; |
|
351 | + if($other > 0) { |
|
352 | + $tmp = array_slice($tmp, 0, 5, true); |
|
353 | + $tmp['other'] = $other; |
|
354 | + arsort($tmp); |
|
355 | + } |
|
356 | + $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
357 | + } |
|
358 | + } |
|
359 | + } |
|
360 | 360 | |
361 | - $data->set('results_by_generations', $results_by_gen); |
|
361 | + $data->set('results_by_generations', $results_by_gen); |
|
362 | 362 | |
363 | - $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
363 | + $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
364 | 364 | |
365 | - } |
|
366 | - else { |
|
367 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
368 | - } |
|
369 | - return $html; |
|
370 | - } |
|
365 | + } |
|
366 | + else { |
|
367 | + $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
368 | + } |
|
369 | + return $html; |
|
370 | + } |
|
371 | 371 | |
372 | 372 | } |
373 | 373 | \ No newline at end of file |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $ga_id = Filter::getInteger('ga_id'); |
71 | 71 | |
72 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
72 | + if ($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
73 | 73 | $data->set('has_analysis', true); |
74 | 74 | $data->set('geoanalysis', $ga); |
75 | 75 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | jQuery.get( |
83 | 83 | "module.php", |
84 | 84 | { |
85 | - "mod" : "'. $this->module->getName() .'", |
|
85 | + "mod" : "'. $this->module->getName().'", |
|
86 | 86 | "mod_action": "GeoAnalysis@dataTabs", |
87 | 87 | "ga_id" : "'.$ga_id.'" |
88 | 88 | }, |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $data->set('has_list', false); |
115 | 115 | |
116 | 116 | $ga_list = $this->provider->getGeoAnalysisList(); |
117 | - if(count($ga_list) > 0 ) { |
|
117 | + if (count($ga_list) > 0) { |
|
118 | 118 | $data->set('has_list', true); |
119 | 119 | $data->set('geoanalysislist', $ga_list); |
120 | 120 | } |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | ); |
141 | 141 | |
142 | 142 | $status = Filter::getBool('status'); |
143 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
144 | - try{ |
|
143 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
144 | + try { |
|
145 | 145 | $this->provider->setGeoAnalysisStatus($ga, $status); |
146 | 146 | $res['status'] = $status; |
147 | - Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
|
147 | + Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '.($status ? 'enabled' : 'disabled').'.'); |
|
148 | 148 | } |
149 | 149 | catch (\Exception $ex) { |
150 | 150 | $res['error'] = $ex->getMessage(); |
151 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
|
151 | + Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage()); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $controller->pageHeader(); |
155 | - if($res['error']) http_response_code(500); |
|
155 | + if ($res['error']) http_response_code(500); |
|
156 | 156 | |
157 | 157 | echo \Zend_Json::encode($res); |
158 | 158 | } |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | && $ga |
175 | 175 | ); |
176 | 176 | |
177 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
178 | - try{ |
|
177 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
178 | + try { |
|
179 | 179 | $this->provider->deleteGeoAnalysis($ga); |
180 | 180 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
181 | 181 | } |
182 | 182 | catch (\Exception $ex) { |
183 | 183 | $res['error'] = $ex->getMessage(); |
184 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
|
184 | + Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '.$ex->getMessage()); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | $controller->pageHeader(); |
188 | - if($res['error']) http_response_code(500); |
|
188 | + if ($res['error']) http_response_code(500); |
|
189 | 189 | |
190 | 190 | echo \Zend_Json::encode($res); |
191 | 191 | } |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
212 | 212 | |
213 | 213 | $flags = array(); |
214 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
214 | + if ($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
215 | 215 | $mapProvider = new GoogleMapsProvider(); |
216 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
216 | + foreach ($placesDispGeneral['places'] as $place => $count) { |
|
217 | 217 | $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
218 | 218 | } |
219 | 219 | } |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | * @param (null|array) $flags Array of flags |
233 | 233 | * @return string HTML code for the general tab |
234 | 234 | */ |
235 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
235 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags = null) { |
|
236 | 236 | global $WT_TREE; |
237 | 237 | |
238 | - if(!empty($placesGeneralResults)){ |
|
238 | + if (!empty($placesGeneralResults)) { |
|
239 | 239 | $data = new ViewBag(); |
240 | 240 | |
241 | 241 | $nb_found = $placesGeneralResults['knownsum']; |
242 | 242 | $nb_other = 0; |
243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
243 | + if (isset($placesGeneralResults['other'])) $nb_other = $placesGeneralResults['other']; |
|
244 | 244 | $nb_unknown = $placesGeneralResults['unknown']; |
245 | 245 | |
246 | 246 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -249,28 +249,28 @@ discard block |
||
249 | 249 | |
250 | 250 | $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
251 | 251 | |
252 | - if($ga->hasMap()) { |
|
252 | + if ($ga->hasMap()) { |
|
253 | 253 | $max = $placesGeneralResults['max']; |
254 | 254 | $map = $ga->getOptions()->getMap(); |
255 | 255 | $results_by_subdivs = $map->getSubdivisions(); |
256 | 256 | $places_mappings = $map->getPlacesMappings(); |
257 | 257 | foreach ($placesGeneralResults['places'] as $location => $count) { |
258 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
258 | + $levelvalues = array_reverse(array_map('trim', explode(',', $location))); |
|
259 | 259 | $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
260 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
261 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
262 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
260 | + if ($level_map >= 0 && $level_map < count($levelvalues)) { |
|
261 | + $levelref = $levelvalues[0].'@'.$levelvalues[$level_map]; |
|
262 | + if (!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
263 | 263 | } |
264 | 264 | else { |
265 | 265 | $levelref = $levelvalues[0]; |
266 | 266 | } |
267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
268 | - if(isset($results_by_subdivs[$levelref])) { |
|
267 | + if (isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
268 | + if (isset($results_by_subdivs[$levelref])) { |
|
269 | 269 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
270 | - $count_subd += $count; |
|
270 | + $count_subd += $count; |
|
271 | 271 | $results_by_subdivs[$levelref]['count'] = $count_subd; |
272 | 272 | $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
273 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
273 | + if ($ga->getOptions()->isUsingFlags() && $flags) { |
|
274 | 274 | $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
275 | 275 | $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
276 | 276 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | } |
293 | 293 | } |
294 | 294 | else { |
295 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
295 | + $html = '<p class="warning">'.I18N::translate('No data is available for the general analysis.').'</p>'; |
|
296 | 296 | } |
297 | 297 | return $html; |
298 | 298 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
309 | 309 | global $WT_TREE; |
310 | 310 | |
311 | - if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
311 | + if (!empty($placesGenerationsResults) && $ga->getOptions()) { |
|
312 | 312 | $data = new ViewBag(); |
313 | 313 | |
314 | 314 | ksort($placesGenerationsResults); |
@@ -321,26 +321,26 @@ discard block |
||
321 | 321 | $data->set('display_all_places', $display_all_places); |
322 | 322 | |
323 | 323 | $results_by_gen = array(); |
324 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
324 | + foreach ($placesGenerationsResults as $gen => $genData) { |
|
325 | 325 | $sum = 0; |
326 | 326 | $other = 0; |
327 | 327 | $unknown = 0; |
328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
328 | + if (isset($genData['sum'])) $sum = $genData['sum']; |
|
329 | + if (isset($genData['other'])) $other = $genData['other']; |
|
330 | + if (isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
331 | 331 | |
332 | - if($sum > 0) { |
|
332 | + if ($sum > 0) { |
|
333 | 333 | $results_by_gen[$gen]['sum'] = $sum; |
334 | 334 | $results_by_gen[$gen]['other'] = $other; |
335 | 335 | $results_by_gen[$gen]['unknown'] = $unknown; |
336 | 336 | $results_by_gen[$gen]['places'] = array(); |
337 | 337 | arsort($genData['places']); |
338 | 338 | |
339 | - if($display_all_places){ |
|
340 | - foreach($genData['places'] as $placename=> $count){ |
|
339 | + if ($display_all_places) { |
|
340 | + foreach ($genData['places'] as $placename=> $count) { |
|
341 | 341 | $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
342 | 342 | |
343 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
343 | + if ($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != '') { |
|
344 | 344 | $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
345 | 345 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
346 | 346 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | } |
349 | 349 | else { |
350 | 350 | $tmp = $genData['places']; |
351 | - if($other > 0) { |
|
351 | + if ($other > 0) { |
|
352 | 352 | $tmp = array_slice($tmp, 0, 5, true); |
353 | 353 | $tmp['other'] = $other; |
354 | 354 | arsort($tmp); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | } |
366 | 366 | else { |
367 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
367 | + $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'</p>'; |
|
368 | 368 | } |
369 | 369 | return $html; |
370 | 370 | } |
@@ -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,39 +35,39 @@ discard block |
||
35 | 35 | protected function update() { |
36 | 36 | global $WT_TREE; |
37 | 37 | |
38 | - if(Auth::isAdmin()){ |
|
38 | + if (Auth::isAdmin()) { |
|
39 | 39 | |
40 | 40 | $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
41 | 41 | $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
42 | 42 | |
43 | - if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
43 | + if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
44 | 44 | $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
45 | 45 | } |
46 | 46 | |
47 | - if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
47 | + if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
48 | 48 | $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Only accept valid color for MAJ_WM_FONT_COLOR |
52 | 52 | $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
53 | - if($MAJ_WM_FONT_COLOR) { |
|
53 | + if ($MAJ_WM_FONT_COLOR) { |
|
54 | 54 | $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
55 | 55 | } |
56 | 56 | |
57 | 57 | // Only accept valid folders for MAJ_CERT_ROOTDIR |
58 | - $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
58 | + $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR').'/'); |
|
59 | 59 | if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
60 | 60 | $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
61 | 61 | } |
62 | 62 | |
63 | 63 | if ($MAJ_CERT_ROOTDIR) { |
64 | - if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
64 | + if (is_dir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) { |
|
65 | 65 | $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
66 | - } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
66 | + } elseif (File::mkdir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) { |
|
67 | 67 | $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
68 | - FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
68 | + FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'info'); |
|
69 | 69 | } else { |
70 | - FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
70 | + FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'danger'); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | global $WT_TREE; |
89 | 89 | |
90 | 90 | $action = Filter::post('action'); |
91 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
91 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
92 | 92 | |
93 | 93 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
94 | 94 | $ctrl = new PageController(); |
@@ -88,7 +88,9 @@ |
||
88 | 88 | global $WT_TREE; |
89 | 89 | |
90 | 90 | $action = Filter::post('action'); |
91 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
91 | + if($action == 'update' && Filter::checkCsrf()) { |
|
92 | + $this->update(); |
|
93 | + } |
|
92 | 94 | |
93 | 95 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
94 | 96 | $ctrl = new PageController(); |
@@ -28,77 +28,77 @@ |
||
28 | 28 | */ |
29 | 29 | class AdminConfigController extends MvcController |
30 | 30 | { |
31 | - /** |
|
32 | - * Manage updates sent from the AdminConfig@index form. |
|
33 | - */ |
|
34 | - protected function update() { |
|
31 | + /** |
|
32 | + * Manage updates sent from the AdminConfig@index form. |
|
33 | + */ |
|
34 | + protected function update() { |
|
35 | 35 | |
36 | - if(Auth::isAdmin()){ |
|
36 | + if(Auth::isAdmin()){ |
|
37 | 37 | |
38 | - $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
|
39 | - $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
|
38 | + $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
|
39 | + $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
|
40 | 40 | |
41 | - if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
42 | - $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
|
43 | - } |
|
41 | + if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
42 | + $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
|
43 | + } |
|
44 | 44 | |
45 | - if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
46 | - $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
|
47 | - } |
|
45 | + if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
46 | + $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
|
47 | + } |
|
48 | 48 | |
49 | - // Only accept valid color for MAJ_WM_FONT_COLOR |
|
50 | - $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
|
51 | - if($MAJ_WM_FONT_COLOR) { |
|
52 | - $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
|
53 | - } |
|
49 | + // Only accept valid color for MAJ_WM_FONT_COLOR |
|
50 | + $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
|
51 | + if($MAJ_WM_FONT_COLOR) { |
|
52 | + $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
|
53 | + } |
|
54 | 54 | |
55 | - // Only accept valid folders for MAJ_CERT_ROOTDIR |
|
56 | - $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
57 | - if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
|
58 | - $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
|
59 | - } |
|
55 | + // Only accept valid folders for MAJ_CERT_ROOTDIR |
|
56 | + $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
57 | + if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
|
58 | + $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
|
59 | + } |
|
60 | 60 | |
61 | - if ($MAJ_CERT_ROOTDIR) { |
|
62 | - if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
63 | - $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
64 | - } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
65 | - $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
66 | - FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
67 | - } else { |
|
68 | - FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
69 | - } |
|
70 | - } |
|
61 | + if ($MAJ_CERT_ROOTDIR) { |
|
62 | + if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
63 | + $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
64 | + } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
65 | + $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
66 | + FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
67 | + } else { |
|
68 | + FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success'); |
|
72 | + FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success'); |
|
73 | 73 | |
74 | - return; |
|
75 | - } |
|
76 | - } |
|
74 | + return; |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Pages |
|
80 | - */ |
|
78 | + /** |
|
79 | + * Pages |
|
80 | + */ |
|
81 | 81 | |
82 | - /** |
|
83 | - * AdminConfig@index |
|
84 | - */ |
|
85 | - public function index() { |
|
86 | - global $WT_TREE; |
|
82 | + /** |
|
83 | + * AdminConfig@index |
|
84 | + */ |
|
85 | + public function index() { |
|
86 | + global $WT_TREE; |
|
87 | 87 | |
88 | - $action = Filter::post('action'); |
|
89 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
88 | + $action = Filter::post('action'); |
|
89 | + if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
90 | 90 | |
91 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
92 | - $ctrl = new PageController(); |
|
93 | - $ctrl |
|
94 | - ->restrictAccess(Auth::isAdmin()) |
|
95 | - ->setPageTitle($this->module->getTitle()); |
|
91 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
92 | + $ctrl = new PageController(); |
|
93 | + $ctrl |
|
94 | + ->restrictAccess(Auth::isAdmin()) |
|
95 | + ->setPageTitle($this->module->getTitle()); |
|
96 | 96 | |
97 | - $view_bag = new ViewBag(); |
|
98 | - $view_bag->set('title', $ctrl->getPageTitle()); |
|
99 | - $view_bag->set('module', $this->module); |
|
97 | + $view_bag = new ViewBag(); |
|
98 | + $view_bag->set('title', $ctrl->getPageTitle()); |
|
99 | + $view_bag->set('module', $this->module); |
|
100 | 100 | |
101 | - ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
102 | - } |
|
101 | + ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
102 | + } |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | \ No newline at end of file |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | * {@inhericDoc} |
26 | 26 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
27 | 27 | */ |
28 | - protected function renderContent() { |
|
29 | - ?> |
|
28 | + protected function renderContent() { |
|
29 | + ?> |
|
30 | 30 | <div id="maj-cert-page" class="center"> |
31 | 31 | <h2><?php echo $this->data->get('title'); ?></h2> |
32 | 32 | |
33 | 33 | <?php if($this->data->get('has_certif', false)) { |
34 | - /** @var Certificate $certificate */ |
|
35 | - $certificate = $this->data->get('certificate'); |
|
36 | - $has_linked_indis = $this->data->get('has_linked_indis', false); |
|
37 | - $has_linked_fams = $this->data->get('has_linked_fams', false); |
|
38 | - ?> |
|
34 | + /** @var Certificate $certificate */ |
|
35 | + $certificate = $this->data->get('certificate'); |
|
36 | + $has_linked_indis = $this->data->get('has_linked_indis', false); |
|
37 | + $has_linked_fams = $this->data->get('has_linked_fams', false); |
|
38 | + ?> |
|
39 | 39 | <div id="certificate-details"> |
40 | 40 | <h3> |
41 | 41 | <?php echo $certificate->getCity(); ?> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | </div> |
87 | 87 | |
88 | 88 | <?php |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
93 | 93 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <div id="maj-cert-page" class="center"> |
31 | 31 | <h2><?php echo $this->data->get('title'); ?></h2> |
32 | 32 | |
33 | - <?php if($this->data->get('has_certif', false)) { |
|
33 | + <?php if ($this->data->get('has_certif', false)) { |
|
34 | 34 | /** @var Certificate $certificate */ |
35 | 35 | $certificate = $this->data->get('certificate'); |
36 | 36 | $has_linked_indis = $this->data->get('has_linked_indis', false); |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | <div id="certificate-edit"> |
50 | 50 | <?php echo $certificate->displayImage(); ?> |
51 | 51 | </div> |
52 | - <?php if($has_linked_indis || $has_linked_fams) { ?> |
|
52 | + <?php if ($has_linked_indis || $has_linked_fams) { ?> |
|
53 | 53 | <ul> |
54 | - <?php if($has_linked_indis) { ?> |
|
54 | + <?php if ($has_linked_indis) { ?> |
|
55 | 55 | <li> |
56 | 56 | <a href="#indi-certificate"> |
57 | 57 | <span id="indisource"><?php echo I18N::translate('Individuals'); ?></span> |
58 | 58 | </a> |
59 | 59 | </li> |
60 | 60 | <?php } ?> |
61 | - <?php if($has_linked_fams) { ?> |
|
61 | + <?php if ($has_linked_fams) { ?> |
|
62 | 62 | <li> |
63 | 63 | <a href="#fam-certificate"> |
64 | 64 | <span id="famsource"><?php echo I18N::translate('Families'); ?></span> |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | <?php } ?> |
68 | 68 | </ul> |
69 | 69 | |
70 | - <?php if($has_linked_indis) { ?> |
|
70 | + <?php if ($has_linked_indis) { ?> |
|
71 | 71 | <div id="indi-certificate"> |
72 | 72 | <?php echo FunctionsPrintLists::individualTable($this->data->get('linked_indis')); ?> |
73 | 73 | </div> |
74 | 74 | <?php } ?> |
75 | 75 | |
76 | - <?php if($has_linked_fams) { ?> |
|
76 | + <?php if ($has_linked_fams) { ?> |
|
77 | 77 | <div id="fam-certificate"> |
78 | 78 | <?php echo FunctionsPrintLists::familyTable($this->data->get('linked_fams')); ?> |
79 | 79 | </div> |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * {@inhericDoc} |
27 | 27 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
28 | 28 | */ |
29 | - protected function renderContent() { |
|
29 | + protected function renderContent() { |
|
30 | 30 | |
31 | - /** @var AbstractModule $module */ |
|
32 | - $module = $this->data->get('module'); |
|
33 | - ?> |
|
31 | + /** @var AbstractModule $module */ |
|
32 | + $module = $this->data->get('module'); |
|
33 | + ?> |
|
34 | 34 | <ol class="breadcrumb small"> |
35 | 35 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
36 | 36 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | </form> |
187 | 187 | |
188 | 188 | <?php |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | 193 | \ No newline at end of file |