@@ -25,17 +25,17 @@ 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'); |
|
| 32 | - $canvas = $map->getCanvas(); |
|
| 33 | - $subdvisions_results = $this->data->get('results_by_subdivisions'); |
|
| 30 | + /** @var OutlineMap $map */ |
|
| 31 | + $map = $this->data->get('map'); |
|
| 32 | + $canvas = $map->getCanvas(); |
|
| 33 | + $subdvisions_results = $this->data->get('results_by_subdivisions'); |
|
| 34 | 34 | |
| 35 | - $nb_found = $this->data->get('stats_gen_nb_found'); |
|
| 36 | - $nb_other = $this->data->get('stats_gen_nb_other'); |
|
| 35 | + $nb_found = $this->data->get('stats_gen_nb_found'); |
|
| 36 | + $nb_other = $this->data->get('stats_gen_nb_other'); |
|
| 37 | 37 | |
| 38 | - $html = '<script> |
|
| 38 | + $html = '<script> |
|
| 39 | 39 | var tip = null; |
| 40 | 40 | var tipText = ""; |
| 41 | 41 | var over = false; |
@@ -82,29 +82,29 @@ discard block |
||
| 82 | 82 | var map = {}; |
| 83 | 83 | '; |
| 84 | 84 | |
| 85 | - foreach($subdvisions_results as $name => $location){ |
|
| 86 | - $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
| 87 | - if(isset($location['transparency'])) { |
|
| 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/>'; |
|
| 90 | - $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
|
| 91 | - $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
| 92 | - $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
|
| 93 | - $html.= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
| 94 | - 'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'. |
|
| 95 | - '});'. |
|
| 96 | - 'map.area'.$location['id'].'.mouseout(function () {'. |
|
| 97 | - 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'. |
|
| 98 | - '});'; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - $html .= '}); |
|
| 85 | + foreach($subdvisions_results as $name => $location){ |
|
| 86 | + $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
| 87 | + if(isset($location['transparency'])) { |
|
| 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/>'; |
|
| 90 | + $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
|
| 91 | + $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
| 92 | + $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
|
| 93 | + $html.= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
| 94 | + 'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'. |
|
| 95 | + '});'. |
|
| 96 | + 'map.area'.$location['id'].'.mouseout(function () {'. |
|
| 97 | + 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'. |
|
| 98 | + '});'; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + $html .= '}); |
|
| 102 | 102 | </script> |
| 103 | 103 | |
| 104 | 104 | <div id="geodispersion_map"></div> |
| 105 | 105 | <div id="geodispersion_tip"></div>'; |
| 106 | 106 | |
| 107 | - return $html; |
|
| 108 | - } |
|
| 107 | + return $html; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | \ No newline at end of file |
@@ -75,23 +75,23 @@ |
||
| 75 | 75 | } |
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | - var paper = new Raphael(document.getElementById("geodispersion_map"), '. $canvas->width .', '. $canvas->height .'); |
|
| 79 | - var background = paper.rect(0, 0, ' . $canvas->width . ', '. $canvas->height . '); |
|
| 80 | - background.attr({"fill" : "'. $canvas->background_color .'", "stroke" : "'. $canvas->background_stroke .'", "stroke-width": 1, "stroke-linejoin": "round" }); |
|
| 81 | - var attr = { fill: "'. $canvas->default_color .'", stroke: "'. $canvas->default_stroke .'", "stroke-width": 1, "stroke-linejoin": "round" }; |
|
| 78 | + var paper = new Raphael(document.getElementById("geodispersion_map"), '. $canvas->width.', '.$canvas->height.'); |
|
| 79 | + var background = paper.rect(0, 0, ' . $canvas->width.', '.$canvas->height.'); |
|
| 80 | + background.attr({"fill" : "'. $canvas->background_color.'", "stroke" : "'.$canvas->background_stroke.'", "stroke-width": 1, "stroke-linejoin": "round" }); |
|
| 81 | + var attr = { fill: "'. $canvas->default_color.'", stroke: "'.$canvas->default_stroke.'", "stroke-width": 1, "stroke-linejoin": "round" }; |
|
| 82 | 82 | var map = {}; |
| 83 | 83 | '; |
| 84 | 84 | |
| 85 | - foreach($subdvisions_results as $name => $location){ |
|
| 86 | - $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
| 87 | - if(isset($location['transparency'])) { |
|
| 85 | + foreach ($subdvisions_results as $name => $location) { |
|
| 86 | + $html .= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
|
| 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'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
| 90 | 90 | $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
| 91 | - $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
| 92 | - $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
|
| 93 | - $html.= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
| 94 | - 'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'. |
|
| 91 | + $html .= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
|
| 92 | + $html .= 'map.area'.$location['id'].'.attr({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].' });'; |
|
| 93 | + $html .= 'map.area'.$location['id'].'.mouseover(function () {'. |
|
| 94 | + 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->hover_color.'", "fill-opacity" : 1}, 100, "linear");'. |
|
| 95 | 95 | '});'. |
| 96 | 96 | 'map.area'.$location['id'].'.mouseout(function () {'. |
| 97 | 97 | 'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'. |
@@ -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'].' });'; |
@@ -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> |
@@ -36,47 +36,47 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | class GeoAnalysisController extends MvcController |
| 38 | 38 | { |
| 39 | - /** |
|
| 40 | - * GeoAnalysis Provider |
|
| 41 | - * @var GeoAnalysisProvider $provider |
|
| 42 | - */ |
|
| 43 | - protected $provider; |
|
| 39 | + /** |
|
| 40 | + * GeoAnalysis Provider |
|
| 41 | + * @var GeoAnalysisProvider $provider |
|
| 42 | + */ |
|
| 43 | + protected $provider; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Constructor for GeoAnalysis controller |
|
| 47 | - * @param AbstractModule $module |
|
| 48 | - */ |
|
| 49 | - public function __construct(AbstractModule $module) { |
|
| 50 | - parent::__construct($module); |
|
| 45 | + /** |
|
| 46 | + * Constructor for GeoAnalysis controller |
|
| 47 | + * @param AbstractModule $module |
|
| 48 | + */ |
|
| 49 | + public function __construct(AbstractModule $module) { |
|
| 50 | + parent::__construct($module); |
|
| 51 | 51 | |
| 52 | - $this->provider = $this->module->getProvider(); |
|
| 53 | - } |
|
| 52 | + $this->provider = $this->module->getProvider(); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Pages |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * Pages |
|
| 57 | + */ |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * GeoAnalysis@index |
|
| 61 | - */ |
|
| 62 | - public function index() { |
|
| 59 | + /** |
|
| 60 | + * GeoAnalysis@index |
|
| 61 | + */ |
|
| 62 | + public function index() { |
|
| 63 | 63 | |
| 64 | - $controller = new PageController(); |
|
| 65 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 64 | + $controller = new PageController(); |
|
| 65 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 66 | 66 | |
| 67 | - $data = new ViewBag(); |
|
| 68 | - $data->set('title', $controller->getPageTitle()); |
|
| 69 | - $data->set('has_analysis', false); |
|
| 67 | + $data = new ViewBag(); |
|
| 68 | + $data->set('title', $controller->getPageTitle()); |
|
| 69 | + $data->set('has_analysis', false); |
|
| 70 | 70 | |
| 71 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 71 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 72 | 72 | |
| 73 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 74 | - $data->set('has_analysis', true); |
|
| 75 | - $data->set('geoanalysis', $ga); |
|
| 73 | + if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 74 | + $data->set('has_analysis', true); |
|
| 75 | + $data->set('geoanalysis', $ga); |
|
| 76 | 76 | |
| 77 | - $controller |
|
| 78 | - ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
| 79 | - ->addInlineJavascript(' |
|
| 77 | + $controller |
|
| 78 | + ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
| 79 | + ->addInlineJavascript(' |
|
| 80 | 80 | jQuery("#geodispersion-tabs").tabs(); |
| 81 | 81 | jQuery("#geodispersion-tabs").css("visibility", "visible"); |
| 82 | 82 | |
@@ -97,133 +97,133 @@ discard block |
||
| 97 | 97 | "json" |
| 98 | 98 | ); |
| 99 | 99 | '); |
| 100 | - } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
| 103 | - } |
|
| 102 | + ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * GeoAnalysis@listAll |
|
| 107 | - */ |
|
| 108 | - public function listAll() { |
|
| 105 | + /** |
|
| 106 | + * GeoAnalysis@listAll |
|
| 107 | + */ |
|
| 108 | + public function listAll() { |
|
| 109 | 109 | |
| 110 | - $controller = new PageController(); |
|
| 111 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 110 | + $controller = new PageController(); |
|
| 111 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 112 | 112 | |
| 113 | - $data = new ViewBag(); |
|
| 114 | - $data->set('title', $controller->getPageTitle()); |
|
| 115 | - $data->set('has_list', false); |
|
| 113 | + $data = new ViewBag(); |
|
| 114 | + $data->set('title', $controller->getPageTitle()); |
|
| 115 | + $data->set('has_list', false); |
|
| 116 | 116 | |
| 117 | - $ga_list = $this->provider->getGeoAnalysisList(); |
|
| 118 | - if(count($ga_list) > 0 ) { |
|
| 119 | - $data->set('has_list', true); |
|
| 120 | - $data->set('geoanalysislist', $ga_list); |
|
| 121 | - } |
|
| 117 | + $ga_list = $this->provider->getGeoAnalysisList(); |
|
| 118 | + if(count($ga_list) > 0 ) { |
|
| 119 | + $data->set('has_list', true); |
|
| 120 | + $data->set('geoanalysislist', $ga_list); |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
| 124 | - } |
|
| 123 | + ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * GeoAnalysis@setStatus |
| 128 | 128 | */ |
| 129 | - public function setStatus() { |
|
| 130 | - global $WT_TREE; |
|
| 129 | + public function setStatus() { |
|
| 130 | + global $WT_TREE; |
|
| 131 | 131 | |
| 132 | - $controller = new JsonController(); |
|
| 132 | + $controller = new JsonController(); |
|
| 133 | 133 | |
| 134 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 135 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 134 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 135 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 136 | 136 | |
| 137 | - $controller->restrictAccess( |
|
| 138 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 139 | - && Auth::isManager($WT_TREE) |
|
| 140 | - && $ga |
|
| 141 | - ); |
|
| 137 | + $controller->restrictAccess( |
|
| 138 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 139 | + && Auth::isManager($WT_TREE) |
|
| 140 | + && $ga |
|
| 141 | + ); |
|
| 142 | 142 | |
| 143 | - $status = Filter::getBool('status'); |
|
| 144 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 145 | - try{ |
|
| 146 | - $this->provider->setGeoAnalysisStatus($ga, $status); |
|
| 147 | - $res['status'] = $status; |
|
| 143 | + $status = Filter::getBool('status'); |
|
| 144 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 145 | + try{ |
|
| 146 | + $this->provider->setGeoAnalysisStatus($ga, $status); |
|
| 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) { |
|
| 151 | - $res['error'] = $ex->getMessage(); |
|
| 149 | + } |
|
| 150 | + catch (\Exception $ex) { |
|
| 151 | + $res['error'] = $ex->getMessage(); |
|
| 152 | 152 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
| 153 | - } |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - $controller->pageHeader(); |
|
| 156 | - if($res['error']) http_response_code(500); |
|
| 155 | + $controller->pageHeader(); |
|
| 156 | + if($res['error']) http_response_code(500); |
|
| 157 | 157 | |
| 158 | - echo \Zend_Json::encode($res); |
|
| 159 | - } |
|
| 158 | + echo \Zend_Json::encode($res); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | - * GeoAnalysis@delete |
|
| 163 | - */ |
|
| 164 | - public function delete() { |
|
| 165 | - global $WT_TREE; |
|
| 162 | + * GeoAnalysis@delete |
|
| 163 | + */ |
|
| 164 | + public function delete() { |
|
| 165 | + global $WT_TREE; |
|
| 166 | 166 | |
| 167 | - $controller = new JsonController(); |
|
| 167 | + $controller = new JsonController(); |
|
| 168 | 168 | |
| 169 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 170 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 169 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 170 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 171 | 171 | |
| 172 | - $controller->restrictAccess( |
|
| 173 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 174 | - && Auth::isManager($WT_TREE) |
|
| 175 | - && $ga |
|
| 176 | - ); |
|
| 172 | + $controller->restrictAccess( |
|
| 173 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 174 | + && Auth::isManager($WT_TREE) |
|
| 175 | + && $ga |
|
| 176 | + ); |
|
| 177 | 177 | |
| 178 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 179 | - try{ |
|
| 180 | - $this->provider->deleteGeoAnalysis($ga); |
|
| 178 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 179 | + try{ |
|
| 180 | + $this->provider->deleteGeoAnalysis($ga); |
|
| 181 | 181 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
| 182 | - } |
|
| 183 | - catch (\Exception $ex) { |
|
| 184 | - $res['error'] = $ex->getMessage(); |
|
| 182 | + } |
|
| 183 | + catch (\Exception $ex) { |
|
| 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 | - $controller->pageHeader(); |
|
| 189 | - if($res['error']) http_response_code(500); |
|
| 188 | + $controller->pageHeader(); |
|
| 189 | + if($res['error']) http_response_code(500); |
|
| 190 | 190 | |
| 191 | - echo \Zend_Json::encode($res); |
|
| 192 | - } |
|
| 191 | + echo \Zend_Json::encode($res); |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * GeoAnalysis@dataTabs |
|
| 196 | - */ |
|
| 197 | - public function dataTabs() { |
|
| 198 | - global $WT_TREE; |
|
| 194 | + /** |
|
| 195 | + * GeoAnalysis@dataTabs |
|
| 196 | + */ |
|
| 197 | + public function dataTabs() { |
|
| 198 | + global $WT_TREE; |
|
| 199 | 199 | |
| 200 | - $controller = new JsonController(); |
|
| 200 | + $controller = new JsonController(); |
|
| 201 | 201 | |
| 202 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 203 | - $ga = $this->provider->getGeoAnalysis($ga_id); |
|
| 204 | - $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 202 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 203 | + $ga = $this->provider->getGeoAnalysis($ga_id); |
|
| 204 | + $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 205 | 205 | |
| 206 | - $controller |
|
| 207 | - ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
| 208 | - ->pageHeader(); |
|
| 206 | + $controller |
|
| 207 | + ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
| 208 | + ->pageHeader(); |
|
| 209 | 209 | |
| 210 | - $jsonArray = array(); |
|
| 210 | + $jsonArray = array(); |
|
| 211 | 211 | |
| 212 | - list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
| 212 | + list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
| 213 | 213 | |
| 214 | - $flags = array(); |
|
| 215 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 216 | - $mapProvider = new GoogleMapsProvider(); |
|
| 217 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 218 | - $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
| 219 | - } |
|
| 220 | - } |
|
| 214 | + $flags = array(); |
|
| 215 | + if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 216 | + $mapProvider = new GoogleMapsProvider(); |
|
| 217 | + foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 218 | + $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
| 219 | + } |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | - $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
| 223 | - $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
| 222 | + $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
| 223 | + $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
| 224 | 224 | |
| 225 | - echo \Zend_Json::encode($jsonArray); |
|
| 226 | - } |
|
| 225 | + echo \Zend_Json::encode($jsonArray); |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | 229 | * Returns HTML code for the GeoAnalysis general tab (can be either a map or a table). |
@@ -233,73 +233,73 @@ discard block |
||
| 233 | 233 | * @param (null|array) $flags Array of flags |
| 234 | 234 | * @return string HTML code for the general tab |
| 235 | 235 | */ |
| 236 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 237 | - global $WT_TREE; |
|
| 236 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 237 | + global $WT_TREE; |
|
| 238 | 238 | |
| 239 | - $html = ''; |
|
| 240 | - if($placesGeneralResults){ |
|
| 241 | - $data = new ViewBag(); |
|
| 239 | + $html = ''; |
|
| 240 | + if($placesGeneralResults){ |
|
| 241 | + $data = new ViewBag(); |
|
| 242 | 242 | |
| 243 | - $nb_found = $placesGeneralResults['knownsum']; |
|
| 244 | - $nb_other = 0; |
|
| 245 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 246 | - $nb_unknown = $placesGeneralResults['unknown']; |
|
| 243 | + $nb_found = $placesGeneralResults['knownsum']; |
|
| 244 | + $nb_other = 0; |
|
| 245 | + if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 246 | + $nb_unknown = $placesGeneralResults['unknown']; |
|
| 247 | 247 | |
| 248 | - $data->set('stats_gen_nb_found', $nb_found); |
|
| 249 | - $data->set('stats_gen_nb_other', $nb_other); |
|
| 250 | - $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
| 248 | + $data->set('stats_gen_nb_found', $nb_found); |
|
| 249 | + $data->set('stats_gen_nb_other', $nb_other); |
|
| 250 | + $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
| 251 | 251 | |
| 252 | - $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
| 252 | + $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
| 253 | 253 | |
| 254 | - if($ga->hasMap()) { |
|
| 255 | - $max = $placesGeneralResults['max']; |
|
| 256 | - $map = $ga->getOptions()->getMap(); |
|
| 257 | - $maxcolor = $map->getCanvas()->max_color; |
|
| 258 | - $hovercolor = $map->getCanvas()->hover_color; |
|
| 259 | - $results_by_subdivs = $map->getSubdivisions(); |
|
| 260 | - $places_mappings = $map->getPlacesMappings(); |
|
| 261 | - foreach ($placesGeneralResults['places'] as $location => $count) { |
|
| 262 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 263 | - $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
| 264 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 265 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 266 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 267 | - } |
|
| 268 | - else { |
|
| 269 | - $levelref = $levelvalues[0]; |
|
| 270 | - } |
|
| 271 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 272 | - if(isset($results_by_subdivs[$levelref])) { |
|
| 273 | - $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
| 274 | - $count_subd += $count; |
|
| 275 | - $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
| 276 | - $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
| 277 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 278 | - $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
| 279 | - $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
| 280 | - } |
|
| 281 | - } |
|
| 282 | - } |
|
| 254 | + if($ga->hasMap()) { |
|
| 255 | + $max = $placesGeneralResults['max']; |
|
| 256 | + $map = $ga->getOptions()->getMap(); |
|
| 257 | + $maxcolor = $map->getCanvas()->max_color; |
|
| 258 | + $hovercolor = $map->getCanvas()->hover_color; |
|
| 259 | + $results_by_subdivs = $map->getSubdivisions(); |
|
| 260 | + $places_mappings = $map->getPlacesMappings(); |
|
| 261 | + foreach ($placesGeneralResults['places'] as $location => $count) { |
|
| 262 | + $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 263 | + $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
| 264 | + if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 265 | + $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 266 | + if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 267 | + } |
|
| 268 | + else { |
|
| 269 | + $levelref = $levelvalues[0]; |
|
| 270 | + } |
|
| 271 | + if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 272 | + if(isset($results_by_subdivs[$levelref])) { |
|
| 273 | + $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
| 274 | + $count_subd += $count; |
|
| 275 | + $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
| 276 | + $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
| 277 | + if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 278 | + $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
| 279 | + $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - $data->set('map', $ga->getOptions()->getMap()); |
|
| 285 | - $data->set('results_by_subdivisions', $results_by_subdivs); |
|
| 284 | + $data->set('map', $ga->getOptions()->getMap()); |
|
| 285 | + $data->set('results_by_subdivisions', $results_by_subdivs); |
|
| 286 | 286 | |
| 287 | - $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 288 | - } |
|
| 289 | - else { |
|
| 290 | - $results = $placesGeneralResults['places']; |
|
| 291 | - arsort($results); |
|
| 292 | - $data->set('results', $results); |
|
| 293 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 287 | + $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 288 | + } |
|
| 289 | + else { |
|
| 290 | + $results = $placesGeneralResults['places']; |
|
| 291 | + arsort($results); |
|
| 292 | + $data->set('results', $results); |
|
| 293 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 294 | 294 | |
| 295 | - $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 296 | - } |
|
| 297 | - } |
|
| 298 | - else { |
|
| 299 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 300 | - } |
|
| 301 | - return $html; |
|
| 302 | - } |
|
| 295 | + $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 296 | + } |
|
| 297 | + } |
|
| 298 | + else { |
|
| 299 | + $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 300 | + } |
|
| 301 | + return $html; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * Returns HTML code for the GeoAnalysis generations tab. |
@@ -309,70 +309,70 @@ discard block |
||
| 309 | 309 | * @param (null|array) $flags Array of flags |
| 310 | 310 | * @return string HTML code for the generations tab |
| 311 | 311 | */ |
| 312 | - protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
| 313 | - global $WT_TREE; |
|
| 312 | + protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
| 313 | + global $WT_TREE; |
|
| 314 | 314 | |
| 315 | - $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'<p>'; |
|
| 316 | - if($placesGenerationsResults && $ga->getOptions()){ |
|
| 317 | - $data = new ViewBag(); |
|
| 315 | + $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'<p>'; |
|
| 316 | + if($placesGenerationsResults && $ga->getOptions()){ |
|
| 317 | + $data = new ViewBag(); |
|
| 318 | 318 | |
| 319 | - ksort($placesGenerationsResults); |
|
| 319 | + ksort($placesGenerationsResults); |
|
| 320 | 320 | |
| 321 | - $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
| 322 | - $data->set('max_details_gen', $detailslevel); |
|
| 323 | - $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
| 324 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 325 | - $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
| 326 | - $data->set('display_all_places', $display_all_places); |
|
| 321 | + $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
| 322 | + $data->set('max_details_gen', $detailslevel); |
|
| 323 | + $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
| 324 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 325 | + $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
| 326 | + $data->set('display_all_places', $display_all_places); |
|
| 327 | 327 | |
| 328 | - $results_by_gen = array(); |
|
| 329 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
| 330 | - $sum = 0; |
|
| 331 | - $other = 0; |
|
| 332 | - $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']; |
|
| 328 | + $results_by_gen = array(); |
|
| 329 | + foreach($placesGenerationsResults as $gen => $genData){ |
|
| 330 | + $sum = 0; |
|
| 331 | + $other = 0; |
|
| 332 | + $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 | 336 | |
| 337 | - if($sum > 0) { |
|
| 338 | - $results_by_gen[$gen]['sum'] = $sum; |
|
| 339 | - $results_by_gen[$gen]['other'] = $other; |
|
| 340 | - $results_by_gen[$gen]['unknown'] = $unknown; |
|
| 341 | - $results_by_gen[$gen]['places'] = array(); |
|
| 342 | - arsort($genData['places']); |
|
| 337 | + if($sum > 0) { |
|
| 338 | + $results_by_gen[$gen]['sum'] = $sum; |
|
| 339 | + $results_by_gen[$gen]['other'] = $other; |
|
| 340 | + $results_by_gen[$gen]['unknown'] = $unknown; |
|
| 341 | + $results_by_gen[$gen]['places'] = array(); |
|
| 342 | + arsort($genData['places']); |
|
| 343 | 343 | |
| 344 | - if($display_all_places){ |
|
| 345 | - foreach($genData['places'] as $placename=> $count){ |
|
| 346 | - $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
| 347 | - $levels = array_map('trim',explode(',', $placename)); |
|
| 344 | + if($display_all_places){ |
|
| 345 | + foreach($genData['places'] as $placename=> $count){ |
|
| 346 | + $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
| 347 | + $levels = array_map('trim',explode(',', $placename)); |
|
| 348 | 348 | |
| 349 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 350 | - $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
| 351 | - $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
| 352 | - } |
|
| 353 | - } |
|
| 354 | - } |
|
| 355 | - else { |
|
| 356 | - $tmp = $genData['places']; |
|
| 357 | - if($other > 0) { |
|
| 358 | - $tmp = array_slice($tmp, 0, 5, true); |
|
| 359 | - $tmp['other'] = $other; |
|
| 360 | - arsort($tmp); |
|
| 361 | - } |
|
| 362 | - $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
| 363 | - } |
|
| 364 | - } |
|
| 365 | - } |
|
| 349 | + if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 350 | + $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
| 351 | + $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + } |
|
| 355 | + else { |
|
| 356 | + $tmp = $genData['places']; |
|
| 357 | + if($other > 0) { |
|
| 358 | + $tmp = array_slice($tmp, 0, 5, true); |
|
| 359 | + $tmp['other'] = $other; |
|
| 360 | + arsort($tmp); |
|
| 361 | + } |
|
| 362 | + $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
| 363 | + } |
|
| 364 | + } |
|
| 365 | + } |
|
| 366 | 366 | |
| 367 | - $data->set('results_by_generations', $results_by_gen); |
|
| 367 | + $data->set('results_by_generations', $results_by_gen); |
|
| 368 | 368 | |
| 369 | - $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 369 | + $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 370 | 370 | |
| 371 | - } |
|
| 372 | - else { |
|
| 373 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 374 | - } |
|
| 375 | - return $html; |
|
| 376 | - } |
|
| 371 | + } |
|
| 372 | + else { |
|
| 373 | + $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 374 | + } |
|
| 375 | + return $html; |
|
| 376 | + } |
|
| 377 | 377 | |
| 378 | 378 | } |
| 379 | 379 | \ No newline at end of file |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $ga_id = Filter::getInteger('ga_id'); |
| 72 | 72 | |
| 73 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 73 | + if ($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 74 | 74 | $data->set('has_analysis', true); |
| 75 | 75 | $data->set('geoanalysis', $ga); |
| 76 | 76 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | jQuery.get( |
| 84 | 84 | "module.php", |
| 85 | 85 | { |
| 86 | - "mod" : "'. $this->module->getName() .'", |
|
| 86 | + "mod" : "'. $this->module->getName().'", |
|
| 87 | 87 | "mod_action": "GeoAnalysis@dataTabs", |
| 88 | 88 | "ga_id" : "'.$ga_id.'" |
| 89 | 89 | }, |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $data->set('has_list', false); |
| 116 | 116 | |
| 117 | 117 | $ga_list = $this->provider->getGeoAnalysisList(); |
| 118 | - if(count($ga_list) > 0 ) { |
|
| 118 | + if (count($ga_list) > 0) { |
|
| 119 | 119 | $data->set('has_list', true); |
| 120 | 120 | $data->set('geoanalysislist', $ga_list); |
| 121 | 121 | } |
@@ -141,19 +141,19 @@ discard block |
||
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | 143 | $status = Filter::getBool('status'); |
| 144 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 145 | - try{ |
|
| 144 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
| 145 | + try { |
|
| 146 | 146 | $this->provider->setGeoAnalysisStatus($ga, $status); |
| 147 | 147 | $res['status'] = $status; |
| 148 | - Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
|
| 148 | + Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '.($status ? 'enabled' : 'disabled').'.'); |
|
| 149 | 149 | } |
| 150 | 150 | catch (\Exception $ex) { |
| 151 | 151 | $res['error'] = $ex->getMessage(); |
| 152 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
|
| 152 | + Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage()); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $controller->pageHeader(); |
| 156 | - if($res['error']) http_response_code(500); |
|
| 156 | + if ($res['error']) http_response_code(500); |
|
| 157 | 157 | |
| 158 | 158 | echo \Zend_Json::encode($res); |
| 159 | 159 | } |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | && $ga |
| 176 | 176 | ); |
| 177 | 177 | |
| 178 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 179 | - try{ |
|
| 178 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
| 179 | + try { |
|
| 180 | 180 | $this->provider->deleteGeoAnalysis($ga); |
| 181 | 181 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
| 182 | 182 | } |
| 183 | 183 | catch (\Exception $ex) { |
| 184 | 184 | $res['error'] = $ex->getMessage(); |
| 185 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
|
| 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']) http_response_code(500); |
|
| 190 | 190 | |
| 191 | 191 | echo \Zend_Json::encode($res); |
| 192 | 192 | } |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
| 213 | 213 | |
| 214 | 214 | $flags = array(); |
| 215 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 215 | + if ($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 216 | 216 | $mapProvider = new GoogleMapsProvider(); |
| 217 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 217 | + foreach ($placesDispGeneral['places'] as $place => $count) { |
|
| 218 | 218 | $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -233,16 +233,16 @@ discard block |
||
| 233 | 233 | * @param (null|array) $flags Array of flags |
| 234 | 234 | * @return string HTML code for the general tab |
| 235 | 235 | */ |
| 236 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 236 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags = null) { |
|
| 237 | 237 | global $WT_TREE; |
| 238 | 238 | |
| 239 | 239 | $html = ''; |
| 240 | - if($placesGeneralResults){ |
|
| 240 | + if ($placesGeneralResults) { |
|
| 241 | 241 | $data = new ViewBag(); |
| 242 | 242 | |
| 243 | 243 | $nb_found = $placesGeneralResults['knownsum']; |
| 244 | 244 | $nb_other = 0; |
| 245 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 245 | + if (isset($placesGeneralResults['other'])) $nb_other = $placesGeneralResults['other']; |
|
| 246 | 246 | $nb_unknown = $placesGeneralResults['unknown']; |
| 247 | 247 | |
| 248 | 248 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
| 253 | 253 | |
| 254 | - if($ga->hasMap()) { |
|
| 254 | + if ($ga->hasMap()) { |
|
| 255 | 255 | $max = $placesGeneralResults['max']; |
| 256 | 256 | $map = $ga->getOptions()->getMap(); |
| 257 | 257 | $maxcolor = $map->getCanvas()->max_color; |
@@ -259,22 +259,22 @@ discard block |
||
| 259 | 259 | $results_by_subdivs = $map->getSubdivisions(); |
| 260 | 260 | $places_mappings = $map->getPlacesMappings(); |
| 261 | 261 | foreach ($placesGeneralResults['places'] as $location => $count) { |
| 262 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 262 | + $levelvalues = array_reverse(array_map('trim', explode(',', $location))); |
|
| 263 | 263 | $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
| 264 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 265 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 266 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 264 | + if ($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 265 | + $levelref = $levelvalues[0].'@'.$levelvalues[$level_map]; |
|
| 266 | + if (!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 267 | 267 | } |
| 268 | 268 | else { |
| 269 | 269 | $levelref = $levelvalues[0]; |
| 270 | 270 | } |
| 271 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 272 | - if(isset($results_by_subdivs[$levelref])) { |
|
| 271 | + if (isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 272 | + if (isset($results_by_subdivs[$levelref])) { |
|
| 273 | 273 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
| 274 | - $count_subd += $count; |
|
| 274 | + $count_subd += $count; |
|
| 275 | 275 | $results_by_subdivs[$levelref]['count'] = $count_subd; |
| 276 | 276 | $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
| 277 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 277 | + if ($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 278 | 278 | $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
| 279 | 279 | $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
| 280 | 280 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | else { |
| 299 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 299 | + $html = '<p class="warning">'.I18N::translate('No data is available for the general analysis.').'</p>'; |
|
| 300 | 300 | } |
| 301 | 301 | return $html; |
| 302 | 302 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | global $WT_TREE; |
| 314 | 314 | |
| 315 | 315 | $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'<p>'; |
| 316 | - if($placesGenerationsResults && $ga->getOptions()){ |
|
| 316 | + if ($placesGenerationsResults && $ga->getOptions()) { |
|
| 317 | 317 | $data = new ViewBag(); |
| 318 | 318 | |
| 319 | 319 | ksort($placesGenerationsResults); |
@@ -326,27 +326,27 @@ discard block |
||
| 326 | 326 | $data->set('display_all_places', $display_all_places); |
| 327 | 327 | |
| 328 | 328 | $results_by_gen = array(); |
| 329 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
| 329 | + foreach ($placesGenerationsResults as $gen => $genData) { |
|
| 330 | 330 | $sum = 0; |
| 331 | 331 | $other = 0; |
| 332 | 332 | $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']; |
|
| 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 | 336 | |
| 337 | - if($sum > 0) { |
|
| 337 | + if ($sum > 0) { |
|
| 338 | 338 | $results_by_gen[$gen]['sum'] = $sum; |
| 339 | 339 | $results_by_gen[$gen]['other'] = $other; |
| 340 | 340 | $results_by_gen[$gen]['unknown'] = $unknown; |
| 341 | 341 | $results_by_gen[$gen]['places'] = array(); |
| 342 | 342 | arsort($genData['places']); |
| 343 | 343 | |
| 344 | - if($display_all_places){ |
|
| 345 | - foreach($genData['places'] as $placename=> $count){ |
|
| 344 | + if ($display_all_places) { |
|
| 345 | + foreach ($genData['places'] as $placename=> $count) { |
|
| 346 | 346 | $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
| 347 | - $levels = array_map('trim',explode(',', $placename)); |
|
| 347 | + $levels = array_map('trim', explode(',', $placename)); |
|
| 348 | 348 | |
| 349 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 349 | + if ($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != '') { |
|
| 350 | 350 | $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
| 351 | 351 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
| 352 | 352 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | else { |
| 356 | 356 | $tmp = $genData['places']; |
| 357 | - if($other > 0) { |
|
| 357 | + if ($other > 0) { |
|
| 358 | 358 | $tmp = array_slice($tmp, 0, 5, true); |
| 359 | 359 | $tmp['other'] = $other; |
| 360 | 360 | arsort($tmp); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | } |
| 372 | 372 | else { |
| 373 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 373 | + $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'</p>'; |
|
| 374 | 374 | } |
| 375 | 375 | return $html; |
| 376 | 376 | } |
@@ -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; |
@@ -33,160 +33,160 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | class CertificateController extends MvcController |
| 35 | 35 | { |
| 36 | - /** |
|
| 37 | - * Certificate Provider |
|
| 38 | - * @var CertificateProviderInterface $provider |
|
| 39 | - */ |
|
| 40 | - protected $provider; |
|
| 36 | + /** |
|
| 37 | + * Certificate Provider |
|
| 38 | + * @var CertificateProviderInterface $provider |
|
| 39 | + */ |
|
| 40 | + protected $provider; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Constructor for Certificate controller |
|
| 44 | - * @param AbstractModule $module |
|
| 45 | - */ |
|
| 46 | - public function __construct(AbstractModule $module) { |
|
| 47 | - parent::__construct($module); |
|
| 48 | - |
|
| 49 | - $this->provider = $this->module->getProvider(); |
|
| 50 | - } |
|
| 42 | + /** |
|
| 43 | + * Constructor for Certificate controller |
|
| 44 | + * @param AbstractModule $module |
|
| 45 | + */ |
|
| 46 | + public function __construct(AbstractModule $module) { |
|
| 47 | + parent::__construct($module); |
|
| 48 | + |
|
| 49 | + $this->provider = $this->module->getProvider(); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Pages |
|
| 55 | - */ |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Certificate@index |
|
| 59 | - */ |
|
| 60 | - public function index() { |
|
| 61 | - global $WT_TREE; |
|
| 62 | - |
|
| 63 | - $controller = new PageController(); |
|
| 64 | - $controller |
|
| 65 | - ->setPageTitle(I18N::translate('Certificate')) |
|
| 66 | - ->restrictAccess( |
|
| 67 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 68 | - ); |
|
| 69 | - |
|
| 70 | - $cid = Filter::get('cid'); |
|
| 71 | - |
|
| 72 | - $certificate = null; |
|
| 73 | - $city = ''; |
|
| 74 | - if($cid && strlen($cid) > 22){ |
|
| 75 | - $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 76 | - if($certificate) $city = $certificate->getCity(); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $data = new ViewBag(); |
|
| 80 | - $data->set('title', $controller->getPageTitle()); |
|
| 81 | - |
|
| 82 | - $data->set('has_certif', false); |
|
| 83 | - if($certificate) { |
|
| 84 | - $controller->restrictAccess($certificate->canShow()); |
|
| 85 | - $data->set('title', $certificate->getTitle()); |
|
| 86 | - $data->set('has_certif', true); |
|
| 87 | - $data->set('certificate', $certificate); |
|
| 53 | + /** |
|
| 54 | + * Pages |
|
| 55 | + */ |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Certificate@index |
|
| 59 | + */ |
|
| 60 | + public function index() { |
|
| 61 | + global $WT_TREE; |
|
| 62 | + |
|
| 63 | + $controller = new PageController(); |
|
| 64 | + $controller |
|
| 65 | + ->setPageTitle(I18N::translate('Certificate')) |
|
| 66 | + ->restrictAccess( |
|
| 67 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 68 | + ); |
|
| 69 | + |
|
| 70 | + $cid = Filter::get('cid'); |
|
| 71 | + |
|
| 72 | + $certificate = null; |
|
| 73 | + $city = ''; |
|
| 74 | + if($cid && strlen($cid) > 22){ |
|
| 75 | + $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 76 | + if($certificate) $city = $certificate->getCity(); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $data = new ViewBag(); |
|
| 80 | + $data->set('title', $controller->getPageTitle()); |
|
| 81 | + |
|
| 82 | + $data->set('has_certif', false); |
|
| 83 | + if($certificate) { |
|
| 84 | + $controller->restrictAccess($certificate->canShow()); |
|
| 85 | + $data->set('title', $certificate->getTitle()); |
|
| 86 | + $data->set('has_certif', true); |
|
| 87 | + $data->set('certificate', $certificate); |
|
| 88 | 88 | |
| 89 | - $data->set( |
|
| 90 | - 'url_certif_city', |
|
| 91 | - 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 92 | - '&mod_action=Certificate@listAll' . |
|
| 93 | - '&ged=' . $WT_TREE->getNameUrl() . |
|
| 94 | - '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 95 | - ); |
|
| 89 | + $data->set( |
|
| 90 | + 'url_certif_city', |
|
| 91 | + 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 92 | + '&mod_action=Certificate@listAll' . |
|
| 93 | + '&ged=' . $WT_TREE->getNameUrl() . |
|
| 94 | + '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 95 | + ); |
|
| 96 | 96 | |
| 97 | - $controller->addInlineJavascript(' |
|
| 97 | + $controller->addInlineJavascript(' |
|
| 98 | 98 | jQuery("#certificate-tabs").tabs(); |
| 99 | 99 | jQuery("#certificate-tabs").css("visibility", "visible"); |
| 100 | 100 | '); |
| 101 | 101 | |
| 102 | - $data->set('has_linked_indis', false); |
|
| 103 | - $data->set('has_linked_fams', false); |
|
| 102 | + $data->set('has_linked_indis', false); |
|
| 103 | + $data->set('has_linked_fams', false); |
|
| 104 | 104 | |
| 105 | - $linked_indis = $certificate->linkedIndividuals(); |
|
| 106 | - $linked_fams = $certificate->linkedFamilies(); |
|
| 105 | + $linked_indis = $certificate->linkedIndividuals(); |
|
| 106 | + $linked_fams = $certificate->linkedFamilies(); |
|
| 107 | 107 | |
| 108 | - if($linked_indis && count($linked_indis) > 0) { |
|
| 109 | - $data->set('has_linked_indis', true); |
|
| 110 | - $data->set('linked_indis', $linked_indis); |
|
| 111 | - } |
|
| 108 | + if($linked_indis && count($linked_indis) > 0) { |
|
| 109 | + $data->set('has_linked_indis', true); |
|
| 110 | + $data->set('linked_indis', $linked_indis); |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - if($linked_fams && count($linked_fams) > 0) { |
|
| 114 | - $data->set('has_linked_fams', true); |
|
| 115 | - $data->set('linked_fams', $linked_fams); |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
| 120 | - } |
|
| 113 | + if($linked_fams && count($linked_fams) > 0) { |
|
| 114 | + $data->set('has_linked_fams', true); |
|
| 115 | + $data->set('linked_fams', $linked_fams); |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Certificate@image |
|
| 124 | - */ |
|
| 125 | - public function image() { |
|
| 126 | - global $WT_TREE; |
|
| 122 | + /** |
|
| 123 | + * Certificate@image |
|
| 124 | + */ |
|
| 125 | + public function image() { |
|
| 126 | + global $WT_TREE; |
|
| 127 | 127 | |
| 128 | - $cid = Filter::get('cid'); |
|
| 129 | - $certificate = null; |
|
| 130 | - if($cid) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 128 | + $cid = Filter::get('cid'); |
|
| 129 | + $certificate = null; |
|
| 130 | + if($cid) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 131 | 131 | |
| 132 | - $imageBuilder = new ImageBuilder($certificate); |
|
| 132 | + $imageBuilder = new ImageBuilder($certificate); |
|
| 133 | 133 | |
| 134 | - if (Filter::get('cb')) { |
|
| 135 | - $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
| 136 | - } |
|
| 134 | + if (Filter::get('cb')) { |
|
| 135 | + $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - $imageBuilder |
|
| 139 | - ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
| 140 | - ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
| 141 | - ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
| 142 | - ; |
|
| 138 | + $imageBuilder |
|
| 139 | + ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
| 140 | + ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
| 141 | + ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
| 142 | + ; |
|
| 143 | 143 | |
| 144 | - $imageBuilder->render(); |
|
| 144 | + $imageBuilder->render(); |
|
| 145 | 145 | |
| 146 | - } |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * Certificate@listAll |
|
| 150 | - */ |
|
| 151 | - public function listAll() { |
|
| 152 | - global $WT_TREE; |
|
| 153 | - |
|
| 154 | - $controller = new PageController(); |
|
| 155 | - $controller |
|
| 156 | - ->setPageTitle(I18N::translate('Certificates')) |
|
| 157 | - ->restrictAccess( |
|
| 158 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 159 | - ); |
|
| 160 | - |
|
| 161 | - $city = Filter::get('city'); |
|
| 162 | - |
|
| 163 | - if($city && strlen($city) > 22){ |
|
| 164 | - $city = Functions::decryptFromSafeBase64($city); |
|
| 165 | - $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - $data = new ViewBag(); |
|
| 169 | - $data->set('title', $controller->getPageTitle()); |
|
| 170 | - $data->set('url_module', $this->module->getName()); |
|
| 171 | - $data->set('url_action', 'Certificate@listAll'); |
|
| 172 | - $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 173 | - |
|
| 174 | - $data->set('cities', $this->provider->getCitiesList()); |
|
| 175 | - $data->set('selected_city', $city); |
|
| 176 | - |
|
| 177 | - $data->set('has_list', false); |
|
| 178 | - if($city) { |
|
| 179 | - $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
| 148 | + /** |
|
| 149 | + * Certificate@listAll |
|
| 150 | + */ |
|
| 151 | + public function listAll() { |
|
| 152 | + global $WT_TREE; |
|
| 153 | + |
|
| 154 | + $controller = new PageController(); |
|
| 155 | + $controller |
|
| 156 | + ->setPageTitle(I18N::translate('Certificates')) |
|
| 157 | + ->restrictAccess( |
|
| 158 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 159 | + ); |
|
| 160 | + |
|
| 161 | + $city = Filter::get('city'); |
|
| 162 | + |
|
| 163 | + if($city && strlen($city) > 22){ |
|
| 164 | + $city = Functions::decryptFromSafeBase64($city); |
|
| 165 | + $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + $data = new ViewBag(); |
|
| 169 | + $data->set('title', $controller->getPageTitle()); |
|
| 170 | + $data->set('url_module', $this->module->getName()); |
|
| 171 | + $data->set('url_action', 'Certificate@listAll'); |
|
| 172 | + $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 173 | + |
|
| 174 | + $data->set('cities', $this->provider->getCitiesList()); |
|
| 175 | + $data->set('selected_city', $city); |
|
| 176 | + |
|
| 177 | + $data->set('has_list', false); |
|
| 178 | + if($city) { |
|
| 179 | + $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
| 180 | 180 | |
| 181 | - $certif_list = $this->provider->getCertificatesList($city); |
|
| 182 | - if($certif_list) { |
|
| 183 | - $data->set('has_list', true); |
|
| 184 | - $data->set('table_id', $table_id); |
|
| 185 | - $data->set('certificate_list', $certif_list); |
|
| 181 | + $certif_list = $this->provider->getCertificatesList($city); |
|
| 182 | + if($certif_list) { |
|
| 183 | + $data->set('has_list', true); |
|
| 184 | + $data->set('table_id', $table_id); |
|
| 185 | + $data->set('certificate_list', $certif_list); |
|
| 186 | 186 | |
| 187 | - $controller |
|
| 188 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 189 | - ->addInlineJavascript(' |
|
| 187 | + $controller |
|
| 188 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 189 | + ->addInlineJavascript(' |
|
| 190 | 190 | /* Initialise datatables */ |
| 191 | 191 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
| 192 | 192 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -213,29 +213,29 @@ discard block |
||
| 213 | 213 | jQuery(".certificate-list").css("visibility", "visible"); |
| 214 | 214 | jQuery(".loading-image").css("display", "none"); |
| 215 | 215 | '); |
| 216 | - } |
|
| 217 | - } |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
| 219 | + ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
| 220 | 220 | |
| 221 | - } |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - /** |
|
| 224 | - * Certificate@autocomplete |
|
| 225 | - */ |
|
| 226 | - public function autocomplete() { |
|
| 227 | - global $WT_TREE; |
|
| 223 | + /** |
|
| 224 | + * Certificate@autocomplete |
|
| 225 | + */ |
|
| 226 | + public function autocomplete() { |
|
| 227 | + global $WT_TREE; |
|
| 228 | 228 | |
| 229 | - $controller = new JsonController(); |
|
| 229 | + $controller = new JsonController(); |
|
| 230 | 230 | |
| 231 | - $city = Filter::get('city'); |
|
| 232 | - $contains = Filter::get('term'); |
|
| 231 | + $city = Filter::get('city'); |
|
| 232 | + $contains = Filter::get('term'); |
|
| 233 | 233 | |
| 234 | - $controller |
|
| 235 | - ->restrictAccess(Auth::isEditor($WT_TREE) && $city && $contains) |
|
| 236 | - ->pageHeader(); |
|
| 234 | + $controller |
|
| 235 | + ->restrictAccess(Auth::isEditor($WT_TREE) && $city && $contains) |
|
| 236 | + ->pageHeader(); |
|
| 237 | 237 | |
| 238 | - $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
| 239 | - echo \Zend_Json::encode($listCert); |
|
| 240 | - } |
|
| 238 | + $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
| 239 | + echo \Zend_Json::encode($listCert); |
|
| 240 | + } |
|
| 241 | 241 | } |
| 242 | 242 | \ No newline at end of file |
@@ -71,16 +71,16 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $certificate = null; |
| 73 | 73 | $city = ''; |
| 74 | - if($cid && strlen($cid) > 22){ |
|
| 74 | + if ($cid && strlen($cid) > 22) { |
|
| 75 | 75 | $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
| 76 | - if($certificate) $city = $certificate->getCity(); |
|
| 76 | + if ($certificate) $city = $certificate->getCity(); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $data = new ViewBag(); |
| 80 | 80 | $data->set('title', $controller->getPageTitle()); |
| 81 | 81 | |
| 82 | 82 | $data->set('has_certif', false); |
| 83 | - if($certificate) { |
|
| 83 | + if ($certificate) { |
|
| 84 | 84 | $controller->restrictAccess($certificate->canShow()); |
| 85 | 85 | $data->set('title', $certificate->getTitle()); |
| 86 | 86 | $data->set('has_certif', true); |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $data->set( |
| 90 | 90 | 'url_certif_city', |
| 91 | - 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 92 | - '&mod_action=Certificate@listAll' . |
|
| 93 | - '&ged=' . $WT_TREE->getNameUrl() . |
|
| 94 | - '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 91 | + 'module.php?mod='.Constants::MODULE_MAJ_CERTIF_NAME. |
|
| 92 | + '&mod_action=Certificate@listAll'. |
|
| 93 | + '&ged='.$WT_TREE->getNameUrl(). |
|
| 94 | + '&city='.Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | 97 | $controller->addInlineJavascript(' |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | $linked_indis = $certificate->linkedIndividuals(); |
| 106 | 106 | $linked_fams = $certificate->linkedFamilies(); |
| 107 | 107 | |
| 108 | - if($linked_indis && count($linked_indis) > 0) { |
|
| 108 | + if ($linked_indis && count($linked_indis) > 0) { |
|
| 109 | 109 | $data->set('has_linked_indis', true); |
| 110 | 110 | $data->set('linked_indis', $linked_indis); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if($linked_fams && count($linked_fams) > 0) { |
|
| 113 | + if ($linked_fams && count($linked_fams) > 0) { |
|
| 114 | 114 | $data->set('has_linked_fams', true); |
| 115 | 115 | $data->set('linked_fams', $linked_fams); |
| 116 | 116 | } |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | public function image() { |
| 126 | 126 | global $WT_TREE; |
| 127 | 127 | |
| 128 | - $cid = Filter::get('cid'); |
|
| 128 | + $cid = Filter::get('cid'); |
|
| 129 | 129 | $certificate = null; |
| 130 | - if($cid) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 130 | + if ($cid) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 131 | 131 | |
| 132 | 132 | $imageBuilder = new ImageBuilder($certificate); |
| 133 | 133 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $city = Filter::get('city'); |
| 162 | 162 | |
| 163 | - if($city && strlen($city) > 22){ |
|
| 163 | + if ($city && strlen($city) > 22) { |
|
| 164 | 164 | $city = Functions::decryptFromSafeBase64($city); |
| 165 | 165 | $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
| 166 | 166 | } |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | $data->set('selected_city', $city); |
| 176 | 176 | |
| 177 | 177 | $data->set('has_list', false); |
| 178 | - if($city) { |
|
| 179 | - $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
| 178 | + if ($city) { |
|
| 179 | + $table_id = 'table-certiflist-'.Uuid::uuid4(); |
|
| 180 | 180 | |
| 181 | 181 | $certif_list = $this->provider->getCertificatesList($city); |
| 182 | - if($certif_list) { |
|
| 182 | + if ($certif_list) { |
|
| 183 | 183 | $data->set('has_list', true); |
| 184 | 184 | $data->set('table_id', $table_id); |
| 185 | 185 | $data->set('certificate_list', $certif_list); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; |
| 195 | 195 | |
| 196 | 196 | jQuery("#'.$table_id.'").dataTable( { |
| 197 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 197 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 198 | 198 | '.I18N::datatablesI18N().', |
| 199 | 199 | jQueryUI: true, |
| 200 | 200 | autoWidth: false, |
@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | $city = ''; |
| 74 | 74 | if($cid && strlen($cid) > 22){ |
| 75 | 75 | $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
| 76 | - if($certificate) $city = $certificate->getCity(); |
|
| 76 | + if($certificate) { |
|
| 77 | + $city = $certificate->getCity(); |
|
| 78 | + } |
|
| 77 | 79 | } |
| 78 | 80 | |
| 79 | 81 | $data = new ViewBag(); |
@@ -127,7 +129,9 @@ discard block |
||
| 127 | 129 | |
| 128 | 130 | $cid = Filter::get('cid'); |
| 129 | 131 | $certificate = null; |
| 130 | - if($cid) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 132 | + if($cid) { |
|
| 133 | + $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 134 | + } |
|
| 131 | 135 | |
| 132 | 136 | $imageBuilder = new ImageBuilder($certificate); |
| 133 | 137 | |
@@ -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 |