@@ -35,47 +35,47 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | class GeoAnalysisController extends MvcController |
| 37 | 37 | { |
| 38 | - /** |
|
| 39 | - * GeoAnalysis Provider |
|
| 40 | - * @var GeoAnalysisProvider $provider |
|
| 41 | - */ |
|
| 42 | - protected $provider; |
|
| 38 | + /** |
|
| 39 | + * GeoAnalysis Provider |
|
| 40 | + * @var GeoAnalysisProvider $provider |
|
| 41 | + */ |
|
| 42 | + protected $provider; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Constructor for GeoAnalysis controller |
|
| 46 | - * @param AbstractModule $module |
|
| 47 | - */ |
|
| 48 | - public function __construct(AbstractModule $module) { |
|
| 49 | - parent::__construct($module); |
|
| 44 | + /** |
|
| 45 | + * Constructor for GeoAnalysis controller |
|
| 46 | + * @param AbstractModule $module |
|
| 47 | + */ |
|
| 48 | + public function __construct(AbstractModule $module) { |
|
| 49 | + parent::__construct($module); |
|
| 50 | 50 | |
| 51 | - $this->provider = $this->module->getProvider(); |
|
| 52 | - } |
|
| 51 | + $this->provider = $this->module->getProvider(); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Pages |
|
| 56 | - */ |
|
| 54 | + /** |
|
| 55 | + * Pages |
|
| 56 | + */ |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * GeoAnalysis@index |
|
| 60 | - */ |
|
| 61 | - public function index() { |
|
| 58 | + /** |
|
| 59 | + * GeoAnalysis@index |
|
| 60 | + */ |
|
| 61 | + public function index() { |
|
| 62 | 62 | |
| 63 | - $controller = new PageController(); |
|
| 64 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 63 | + $controller = new PageController(); |
|
| 64 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 65 | 65 | |
| 66 | - $data = new ViewBag(); |
|
| 67 | - $data->set('title', $controller->getPageTitle()); |
|
| 68 | - $data->set('has_analysis', false); |
|
| 66 | + $data = new ViewBag(); |
|
| 67 | + $data->set('title', $controller->getPageTitle()); |
|
| 68 | + $data->set('has_analysis', false); |
|
| 69 | 69 | |
| 70 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 70 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 71 | 71 | |
| 72 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 73 | - $data->set('has_analysis', true); |
|
| 74 | - $data->set('geoanalysis', $ga); |
|
| 72 | + if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 73 | + $data->set('has_analysis', true); |
|
| 74 | + $data->set('geoanalysis', $ga); |
|
| 75 | 75 | |
| 76 | - $controller |
|
| 77 | - ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
| 78 | - ->addInlineJavascript(' |
|
| 76 | + $controller |
|
| 77 | + ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
| 78 | + ->addInlineJavascript(' |
|
| 79 | 79 | jQuery("#geodispersion-tabs").tabs(); |
| 80 | 80 | jQuery("#geodispersion-tabs").css("visibility", "visible"); |
| 81 | 81 | |
@@ -96,133 +96,133 @@ discard block |
||
| 96 | 96 | "json" |
| 97 | 97 | ); |
| 98 | 98 | '); |
| 99 | - } |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
| 102 | - } |
|
| 101 | + ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * GeoAnalysis@listAll |
|
| 106 | - */ |
|
| 107 | - public function listAll() { |
|
| 104 | + /** |
|
| 105 | + * GeoAnalysis@listAll |
|
| 106 | + */ |
|
| 107 | + public function listAll() { |
|
| 108 | 108 | |
| 109 | - $controller = new PageController(); |
|
| 110 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 109 | + $controller = new PageController(); |
|
| 110 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 111 | 111 | |
| 112 | - $data = new ViewBag(); |
|
| 113 | - $data->set('title', $controller->getPageTitle()); |
|
| 114 | - $data->set('has_list', false); |
|
| 112 | + $data = new ViewBag(); |
|
| 113 | + $data->set('title', $controller->getPageTitle()); |
|
| 114 | + $data->set('has_list', false); |
|
| 115 | 115 | |
| 116 | - $ga_list = $this->provider->getGeoAnalysisList(); |
|
| 117 | - if(count($ga_list) > 0 ) { |
|
| 118 | - $data->set('has_list', true); |
|
| 119 | - $data->set('geoanalysislist', $ga_list); |
|
| 120 | - } |
|
| 116 | + $ga_list = $this->provider->getGeoAnalysisList(); |
|
| 117 | + if(count($ga_list) > 0 ) { |
|
| 118 | + $data->set('has_list', true); |
|
| 119 | + $data->set('geoanalysislist', $ga_list); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
| 123 | - } |
|
| 122 | + ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * GeoAnalysis@setStatus |
| 127 | 127 | */ |
| 128 | - public function setStatus() { |
|
| 129 | - global $WT_TREE; |
|
| 128 | + public function setStatus() { |
|
| 129 | + global $WT_TREE; |
|
| 130 | 130 | |
| 131 | - $controller = new JsonController(); |
|
| 131 | + $controller = new JsonController(); |
|
| 132 | 132 | |
| 133 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 134 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 133 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 134 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 135 | 135 | |
| 136 | - $controller->restrictAccess( |
|
| 137 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 138 | - && Auth::isManager($WT_TREE) |
|
| 139 | - && $ga !== null |
|
| 140 | - ); |
|
| 136 | + $controller->restrictAccess( |
|
| 137 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 138 | + && Auth::isManager($WT_TREE) |
|
| 139 | + && $ga !== null |
|
| 140 | + ); |
|
| 141 | 141 | |
| 142 | - $status = Filter::getBool('status'); |
|
| 143 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 144 | - try{ |
|
| 145 | - $this->provider->setGeoAnalysisStatus($ga, $status); |
|
| 146 | - $res['status'] = $status; |
|
| 142 | + $status = Filter::getBool('status'); |
|
| 143 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 144 | + try{ |
|
| 145 | + $this->provider->setGeoAnalysisStatus($ga, $status); |
|
| 146 | + $res['status'] = $status; |
|
| 147 | 147 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
| 148 | - } |
|
| 149 | - catch (\Exception $ex) { |
|
| 150 | - $res['error'] = $ex->getMessage(); |
|
| 148 | + } |
|
| 149 | + catch (\Exception $ex) { |
|
| 150 | + $res['error'] = $ex->getMessage(); |
|
| 151 | 151 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
| 152 | - } |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - $controller->pageHeader(); |
|
| 155 | - if($res['error']) http_response_code(500); |
|
| 154 | + $controller->pageHeader(); |
|
| 155 | + if($res['error']) http_response_code(500); |
|
| 156 | 156 | |
| 157 | - $controller->encode($res); |
|
| 158 | - } |
|
| 157 | + $controller->encode($res); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | - * GeoAnalysis@delete |
|
| 162 | - */ |
|
| 163 | - public function delete() { |
|
| 164 | - global $WT_TREE; |
|
| 161 | + * GeoAnalysis@delete |
|
| 162 | + */ |
|
| 163 | + public function delete() { |
|
| 164 | + global $WT_TREE; |
|
| 165 | 165 | |
| 166 | - $controller = new JsonController(); |
|
| 166 | + $controller = new JsonController(); |
|
| 167 | 167 | |
| 168 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 169 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 168 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 169 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 170 | 170 | |
| 171 | - $controller->restrictAccess( |
|
| 172 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 173 | - && Auth::isManager($WT_TREE) |
|
| 174 | - && $ga |
|
| 175 | - ); |
|
| 171 | + $controller->restrictAccess( |
|
| 172 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 173 | + && Auth::isManager($WT_TREE) |
|
| 174 | + && $ga |
|
| 175 | + ); |
|
| 176 | 176 | |
| 177 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 178 | - try{ |
|
| 179 | - $this->provider->deleteGeoAnalysis($ga); |
|
| 177 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 178 | + try{ |
|
| 179 | + $this->provider->deleteGeoAnalysis($ga); |
|
| 180 | 180 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
| 181 | - } |
|
| 182 | - catch (\Exception $ex) { |
|
| 183 | - $res['error'] = $ex->getMessage(); |
|
| 181 | + } |
|
| 182 | + catch (\Exception $ex) { |
|
| 183 | + $res['error'] = $ex->getMessage(); |
|
| 184 | 184 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
| 185 | - } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - $controller->pageHeader(); |
|
| 188 | - if($res['error']) http_response_code(500); |
|
| 187 | + $controller->pageHeader(); |
|
| 188 | + if($res['error']) http_response_code(500); |
|
| 189 | 189 | |
| 190 | - $controller->encode($res); |
|
| 191 | - } |
|
| 190 | + $controller->encode($res); |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - /** |
|
| 194 | - * GeoAnalysis@dataTabs |
|
| 195 | - */ |
|
| 196 | - public function dataTabs() { |
|
| 197 | - global $WT_TREE; |
|
| 193 | + /** |
|
| 194 | + * GeoAnalysis@dataTabs |
|
| 195 | + */ |
|
| 196 | + public function dataTabs() { |
|
| 197 | + global $WT_TREE; |
|
| 198 | 198 | |
| 199 | - $controller = new JsonController(); |
|
| 199 | + $controller = new JsonController(); |
|
| 200 | 200 | |
| 201 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 202 | - $ga = $this->provider->getGeoAnalysis($ga_id); |
|
| 203 | - $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 201 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 202 | + $ga = $this->provider->getGeoAnalysis($ga_id); |
|
| 203 | + $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 204 | 204 | |
| 205 | - $controller |
|
| 206 | - ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
| 207 | - ->pageHeader(); |
|
| 205 | + $controller |
|
| 206 | + ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
| 207 | + ->pageHeader(); |
|
| 208 | 208 | |
| 209 | - $jsonArray = array(); |
|
| 209 | + $jsonArray = array(); |
|
| 210 | 210 | |
| 211 | - list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
| 211 | + list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
| 212 | 212 | |
| 213 | - $flags = array(); |
|
| 214 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 215 | - $mapProvider = new GoogleMapsProvider(); |
|
| 216 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 217 | - $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
| 218 | - } |
|
| 219 | - } |
|
| 213 | + $flags = array(); |
|
| 214 | + if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 215 | + $mapProvider = new GoogleMapsProvider(); |
|
| 216 | + foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 217 | + $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
| 218 | + } |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
| 222 | - $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
| 221 | + $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
| 222 | + $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
| 223 | 223 | |
| 224 | - $controller->encode($jsonArray); |
|
| 225 | - } |
|
| 224 | + $controller->encode($jsonArray); |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * Returns HTML code for the GeoAnalysis general tab (can be either a map or a table). |
@@ -232,70 +232,70 @@ discard block |
||
| 232 | 232 | * @param (null|array) $flags Array of flags |
| 233 | 233 | * @return string HTML code for the general tab |
| 234 | 234 | */ |
| 235 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 236 | - global $WT_TREE; |
|
| 235 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 236 | + global $WT_TREE; |
|
| 237 | 237 | |
| 238 | - if(!empty($placesGeneralResults)){ |
|
| 239 | - $data = new ViewBag(); |
|
| 238 | + if(!empty($placesGeneralResults)){ |
|
| 239 | + $data = new ViewBag(); |
|
| 240 | 240 | |
| 241 | - $nb_found = $placesGeneralResults['knownsum']; |
|
| 242 | - $nb_other = 0; |
|
| 243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 244 | - $nb_unknown = $placesGeneralResults['unknown']; |
|
| 241 | + $nb_found = $placesGeneralResults['knownsum']; |
|
| 242 | + $nb_other = 0; |
|
| 243 | + if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 244 | + $nb_unknown = $placesGeneralResults['unknown']; |
|
| 245 | 245 | |
| 246 | - $data->set('stats_gen_nb_found', $nb_found); |
|
| 247 | - $data->set('stats_gen_nb_other', $nb_other); |
|
| 248 | - $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
| 246 | + $data->set('stats_gen_nb_found', $nb_found); |
|
| 247 | + $data->set('stats_gen_nb_other', $nb_other); |
|
| 248 | + $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
| 249 | 249 | |
| 250 | - $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
| 250 | + $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
| 251 | 251 | |
| 252 | - if($ga->hasMap()) { |
|
| 253 | - $max = $placesGeneralResults['max']; |
|
| 254 | - $map = $ga->getOptions()->getMap(); |
|
| 255 | - $results_by_subdivs = $map->getSubdivisions(); |
|
| 256 | - $places_mappings = $map->getPlacesMappings(); |
|
| 257 | - foreach ($placesGeneralResults['places'] as $location => $count) { |
|
| 258 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 259 | - $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
| 260 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 261 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 262 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 263 | - } |
|
| 264 | - else { |
|
| 265 | - $levelref = $levelvalues[0]; |
|
| 266 | - } |
|
| 267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 268 | - if(isset($results_by_subdivs[$levelref])) { |
|
| 269 | - $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
| 270 | - $count_subd += $count; |
|
| 271 | - $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
| 272 | - $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
| 273 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 274 | - $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
| 275 | - $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - } |
|
| 252 | + if($ga->hasMap()) { |
|
| 253 | + $max = $placesGeneralResults['max']; |
|
| 254 | + $map = $ga->getOptions()->getMap(); |
|
| 255 | + $results_by_subdivs = $map->getSubdivisions(); |
|
| 256 | + $places_mappings = $map->getPlacesMappings(); |
|
| 257 | + foreach ($placesGeneralResults['places'] as $location => $count) { |
|
| 258 | + $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 259 | + $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
| 260 | + if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 261 | + $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 262 | + if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 263 | + } |
|
| 264 | + else { |
|
| 265 | + $levelref = $levelvalues[0]; |
|
| 266 | + } |
|
| 267 | + if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 268 | + if(isset($results_by_subdivs[$levelref])) { |
|
| 269 | + $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
| 270 | + $count_subd += $count; |
|
| 271 | + $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
| 272 | + $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
| 273 | + if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 274 | + $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
| 275 | + $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - $data->set('map', $ga->getOptions()->getMap()); |
|
| 281 | - $data->set('results_by_subdivisions', $results_by_subdivs); |
|
| 280 | + $data->set('map', $ga->getOptions()->getMap()); |
|
| 281 | + $data->set('results_by_subdivisions', $results_by_subdivs); |
|
| 282 | 282 | |
| 283 | - $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 284 | - } |
|
| 285 | - else { |
|
| 286 | - $results = $placesGeneralResults['places']; |
|
| 287 | - arsort($results); |
|
| 288 | - $data->set('results', $results); |
|
| 289 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 283 | + $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 284 | + } |
|
| 285 | + else { |
|
| 286 | + $results = $placesGeneralResults['places']; |
|
| 287 | + arsort($results); |
|
| 288 | + $data->set('results', $results); |
|
| 289 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 290 | 290 | |
| 291 | - $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 292 | - } |
|
| 293 | - } |
|
| 294 | - else { |
|
| 295 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 296 | - } |
|
| 297 | - return $html; |
|
| 298 | - } |
|
| 291 | + $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 292 | + } |
|
| 293 | + } |
|
| 294 | + else { |
|
| 295 | + $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 296 | + } |
|
| 297 | + return $html; |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | 300 | /** |
| 301 | 301 | * Returns HTML code for the GeoAnalysis generations tab. |
@@ -305,68 +305,68 @@ discard block |
||
| 305 | 305 | * @param (null|array) $flags Array of flags |
| 306 | 306 | * @return string HTML code for the generations tab |
| 307 | 307 | */ |
| 308 | - protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
| 309 | - global $WT_TREE; |
|
| 308 | + protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
| 309 | + global $WT_TREE; |
|
| 310 | 310 | |
| 311 | - if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
| 312 | - $data = new ViewBag(); |
|
| 311 | + if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
| 312 | + $data = new ViewBag(); |
|
| 313 | 313 | |
| 314 | - ksort($placesGenerationsResults); |
|
| 314 | + ksort($placesGenerationsResults); |
|
| 315 | 315 | |
| 316 | - $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
| 317 | - $data->set('max_details_gen', $detailslevel); |
|
| 318 | - $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
| 319 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 320 | - $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
| 321 | - $data->set('display_all_places', $display_all_places); |
|
| 316 | + $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
| 317 | + $data->set('max_details_gen', $detailslevel); |
|
| 318 | + $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
| 319 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 320 | + $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
| 321 | + $data->set('display_all_places', $display_all_places); |
|
| 322 | 322 | |
| 323 | - $results_by_gen = array(); |
|
| 324 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
| 325 | - $sum = 0; |
|
| 326 | - $other = 0; |
|
| 327 | - $unknown = 0; |
|
| 328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
| 329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
| 330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
| 323 | + $results_by_gen = array(); |
|
| 324 | + foreach($placesGenerationsResults as $gen => $genData){ |
|
| 325 | + $sum = 0; |
|
| 326 | + $other = 0; |
|
| 327 | + $unknown = 0; |
|
| 328 | + if(isset($genData['sum'])) $sum = $genData['sum']; |
|
| 329 | + if(isset($genData['other'])) $other = $genData['other']; |
|
| 330 | + if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
| 331 | 331 | |
| 332 | - if($sum > 0) { |
|
| 333 | - $results_by_gen[$gen]['sum'] = $sum; |
|
| 334 | - $results_by_gen[$gen]['other'] = $other; |
|
| 335 | - $results_by_gen[$gen]['unknown'] = $unknown; |
|
| 336 | - $results_by_gen[$gen]['places'] = array(); |
|
| 337 | - arsort($genData['places']); |
|
| 332 | + if($sum > 0) { |
|
| 333 | + $results_by_gen[$gen]['sum'] = $sum; |
|
| 334 | + $results_by_gen[$gen]['other'] = $other; |
|
| 335 | + $results_by_gen[$gen]['unknown'] = $unknown; |
|
| 336 | + $results_by_gen[$gen]['places'] = array(); |
|
| 337 | + arsort($genData['places']); |
|
| 338 | 338 | |
| 339 | - if($display_all_places){ |
|
| 340 | - foreach($genData['places'] as $placename=> $count){ |
|
| 341 | - $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
| 339 | + if($display_all_places){ |
|
| 340 | + foreach($genData['places'] as $placename=> $count){ |
|
| 341 | + $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
| 342 | 342 | |
| 343 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 344 | - $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
| 345 | - $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
| 346 | - } |
|
| 347 | - } |
|
| 348 | - } |
|
| 349 | - else { |
|
| 350 | - $tmp = $genData['places']; |
|
| 351 | - if($other > 0) { |
|
| 352 | - $tmp = array_slice($tmp, 0, 5, true); |
|
| 353 | - $tmp['other'] = $other; |
|
| 354 | - arsort($tmp); |
|
| 355 | - } |
|
| 356 | - $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
| 357 | - } |
|
| 358 | - } |
|
| 359 | - } |
|
| 343 | + if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 344 | + $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
| 345 | + $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
| 346 | + } |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | + else { |
|
| 350 | + $tmp = $genData['places']; |
|
| 351 | + if($other > 0) { |
|
| 352 | + $tmp = array_slice($tmp, 0, 5, true); |
|
| 353 | + $tmp['other'] = $other; |
|
| 354 | + arsort($tmp); |
|
| 355 | + } |
|
| 356 | + $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - $data->set('results_by_generations', $results_by_gen); |
|
| 361 | + $data->set('results_by_generations', $results_by_gen); |
|
| 362 | 362 | |
| 363 | - $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 363 | + $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 364 | 364 | |
| 365 | - } |
|
| 366 | - else { |
|
| 367 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 368 | - } |
|
| 369 | - return $html; |
|
| 370 | - } |
|
| 365 | + } |
|
| 366 | + else { |
|
| 367 | + $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 368 | + } |
|
| 369 | + return $html; |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | 372 | } |
| 373 | 373 | \ No newline at end of file |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $ga_id = Filter::getInteger('ga_id'); |
| 71 | 71 | |
| 72 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 72 | + if ($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 73 | 73 | $data->set('has_analysis', true); |
| 74 | 74 | $data->set('geoanalysis', $ga); |
| 75 | 75 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | jQuery.get( |
| 83 | 83 | "module.php", |
| 84 | 84 | { |
| 85 | - "mod" : "'. $this->module->getName() .'", |
|
| 85 | + "mod" : "'. $this->module->getName().'", |
|
| 86 | 86 | "mod_action": "GeoAnalysis@dataTabs", |
| 87 | 87 | "ga_id" : "'.$ga_id.'" |
| 88 | 88 | }, |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $data->set('has_list', false); |
| 115 | 115 | |
| 116 | 116 | $ga_list = $this->provider->getGeoAnalysisList(); |
| 117 | - if(count($ga_list) > 0 ) { |
|
| 117 | + if (count($ga_list) > 0) { |
|
| 118 | 118 | $data->set('has_list', true); |
| 119 | 119 | $data->set('geoanalysislist', $ga_list); |
| 120 | 120 | } |
@@ -140,19 +140,19 @@ discard block |
||
| 140 | 140 | ); |
| 141 | 141 | |
| 142 | 142 | $status = Filter::getBool('status'); |
| 143 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 144 | - try{ |
|
| 143 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
| 144 | + try { |
|
| 145 | 145 | $this->provider->setGeoAnalysisStatus($ga, $status); |
| 146 | 146 | $res['status'] = $status; |
| 147 | - Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
|
| 147 | + Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '.($status ? 'enabled' : 'disabled').'.'); |
|
| 148 | 148 | } |
| 149 | 149 | catch (\Exception $ex) { |
| 150 | 150 | $res['error'] = $ex->getMessage(); |
| 151 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
|
| 151 | + Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage()); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $controller->pageHeader(); |
| 155 | - if($res['error']) http_response_code(500); |
|
| 155 | + if ($res['error']) http_response_code(500); |
|
| 156 | 156 | |
| 157 | 157 | $controller->encode($res); |
| 158 | 158 | } |
@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | && $ga |
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 178 | - try{ |
|
| 177 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
| 178 | + try { |
|
| 179 | 179 | $this->provider->deleteGeoAnalysis($ga); |
| 180 | 180 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
| 181 | 181 | } |
| 182 | 182 | catch (\Exception $ex) { |
| 183 | 183 | $res['error'] = $ex->getMessage(); |
| 184 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
|
| 184 | + Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '.$ex->getMessage()); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $controller->pageHeader(); |
| 188 | - if($res['error']) http_response_code(500); |
|
| 188 | + if ($res['error']) http_response_code(500); |
|
| 189 | 189 | |
| 190 | 190 | $controller->encode($res); |
| 191 | 191 | } |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
| 212 | 212 | |
| 213 | 213 | $flags = array(); |
| 214 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 214 | + if ($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 215 | 215 | $mapProvider = new GoogleMapsProvider(); |
| 216 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 216 | + foreach ($placesDispGeneral['places'] as $place => $count) { |
|
| 217 | 217 | $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -232,15 +232,15 @@ discard block |
||
| 232 | 232 | * @param (null|array) $flags Array of flags |
| 233 | 233 | * @return string HTML code for the general tab |
| 234 | 234 | */ |
| 235 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 235 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags = null) { |
|
| 236 | 236 | global $WT_TREE; |
| 237 | 237 | |
| 238 | - if(!empty($placesGeneralResults)){ |
|
| 238 | + if (!empty($placesGeneralResults)) { |
|
| 239 | 239 | $data = new ViewBag(); |
| 240 | 240 | |
| 241 | 241 | $nb_found = $placesGeneralResults['knownsum']; |
| 242 | 242 | $nb_other = 0; |
| 243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 243 | + if (isset($placesGeneralResults['other'])) $nb_other = $placesGeneralResults['other']; |
|
| 244 | 244 | $nb_unknown = $placesGeneralResults['unknown']; |
| 245 | 245 | |
| 246 | 246 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -249,28 +249,28 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
| 251 | 251 | |
| 252 | - if($ga->hasMap()) { |
|
| 252 | + if ($ga->hasMap()) { |
|
| 253 | 253 | $max = $placesGeneralResults['max']; |
| 254 | 254 | $map = $ga->getOptions()->getMap(); |
| 255 | 255 | $results_by_subdivs = $map->getSubdivisions(); |
| 256 | 256 | $places_mappings = $map->getPlacesMappings(); |
| 257 | 257 | foreach ($placesGeneralResults['places'] as $location => $count) { |
| 258 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 258 | + $levelvalues = array_reverse(array_map('trim', explode(',', $location))); |
|
| 259 | 259 | $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
| 260 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 261 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 262 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 260 | + if ($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 261 | + $levelref = $levelvalues[0].'@'.$levelvalues[$level_map]; |
|
| 262 | + if (!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 263 | 263 | } |
| 264 | 264 | else { |
| 265 | 265 | $levelref = $levelvalues[0]; |
| 266 | 266 | } |
| 267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 268 | - if(isset($results_by_subdivs[$levelref])) { |
|
| 267 | + if (isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 268 | + if (isset($results_by_subdivs[$levelref])) { |
|
| 269 | 269 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
| 270 | - $count_subd += $count; |
|
| 270 | + $count_subd += $count; |
|
| 271 | 271 | $results_by_subdivs[$levelref]['count'] = $count_subd; |
| 272 | 272 | $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
| 273 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 273 | + if ($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 274 | 274 | $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
| 275 | 275 | $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
| 276 | 276 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | else { |
| 295 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 295 | + $html = '<p class="warning">'.I18N::translate('No data is available for the general analysis.').'</p>'; |
|
| 296 | 296 | } |
| 297 | 297 | return $html; |
| 298 | 298 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
| 309 | 309 | global $WT_TREE; |
| 310 | 310 | |
| 311 | - if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
| 311 | + if (!empty($placesGenerationsResults) && $ga->getOptions()) { |
|
| 312 | 312 | $data = new ViewBag(); |
| 313 | 313 | |
| 314 | 314 | ksort($placesGenerationsResults); |
@@ -321,26 +321,26 @@ discard block |
||
| 321 | 321 | $data->set('display_all_places', $display_all_places); |
| 322 | 322 | |
| 323 | 323 | $results_by_gen = array(); |
| 324 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
| 324 | + foreach ($placesGenerationsResults as $gen => $genData) { |
|
| 325 | 325 | $sum = 0; |
| 326 | 326 | $other = 0; |
| 327 | 327 | $unknown = 0; |
| 328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
| 329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
| 330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
| 328 | + if (isset($genData['sum'])) $sum = $genData['sum']; |
|
| 329 | + if (isset($genData['other'])) $other = $genData['other']; |
|
| 330 | + if (isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
| 331 | 331 | |
| 332 | - if($sum > 0) { |
|
| 332 | + if ($sum > 0) { |
|
| 333 | 333 | $results_by_gen[$gen]['sum'] = $sum; |
| 334 | 334 | $results_by_gen[$gen]['other'] = $other; |
| 335 | 335 | $results_by_gen[$gen]['unknown'] = $unknown; |
| 336 | 336 | $results_by_gen[$gen]['places'] = array(); |
| 337 | 337 | arsort($genData['places']); |
| 338 | 338 | |
| 339 | - if($display_all_places){ |
|
| 340 | - foreach($genData['places'] as $placename=> $count){ |
|
| 339 | + if ($display_all_places) { |
|
| 340 | + foreach ($genData['places'] as $placename=> $count) { |
|
| 341 | 341 | $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
| 342 | 342 | |
| 343 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 343 | + if ($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != '') { |
|
| 344 | 344 | $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
| 345 | 345 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
| 346 | 346 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | else { |
| 350 | 350 | $tmp = $genData['places']; |
| 351 | - if($other > 0) { |
|
| 351 | + if ($other > 0) { |
|
| 352 | 352 | $tmp = array_slice($tmp, 0, 5, true); |
| 353 | 353 | $tmp['other'] = $other; |
| 354 | 354 | arsort($tmp); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | else { |
| 367 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 367 | + $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'</p>'; |
|
| 368 | 368 | } |
| 369 | 369 | return $html; |
| 370 | 370 | } |
@@ -145,14 +145,15 @@ discard block |
||
| 145 | 145 | $this->provider->setGeoAnalysisStatus($ga, $status); |
| 146 | 146 | $res['status'] = $status; |
| 147 | 147 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
| 148 | - } |
|
| 149 | - catch (\Exception $ex) { |
|
| 148 | + } catch (\Exception $ex) { |
|
| 150 | 149 | $res['error'] = $ex->getMessage(); |
| 151 | 150 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
| 152 | 151 | } |
| 153 | 152 | |
| 154 | 153 | $controller->pageHeader(); |
| 155 | - if($res['error']) http_response_code(500); |
|
| 154 | + if($res['error']) { |
|
| 155 | + http_response_code(500); |
|
| 156 | + } |
|
| 156 | 157 | |
| 157 | 158 | $controller->encode($res); |
| 158 | 159 | } |
@@ -178,14 +179,15 @@ discard block |
||
| 178 | 179 | try{ |
| 179 | 180 | $this->provider->deleteGeoAnalysis($ga); |
| 180 | 181 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
| 181 | - } |
|
| 182 | - catch (\Exception $ex) { |
|
| 182 | + } catch (\Exception $ex) { |
|
| 183 | 183 | $res['error'] = $ex->getMessage(); |
| 184 | 184 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $controller->pageHeader(); |
| 188 | - if($res['error']) http_response_code(500); |
|
| 188 | + if($res['error']) { |
|
| 189 | + http_response_code(500); |
|
| 190 | + } |
|
| 189 | 191 | |
| 190 | 192 | $controller->encode($res); |
| 191 | 193 | } |
@@ -240,7 +242,9 @@ discard block |
||
| 240 | 242 | |
| 241 | 243 | $nb_found = $placesGeneralResults['knownsum']; |
| 242 | 244 | $nb_other = 0; |
| 243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 245 | + if(isset($placesGeneralResults['other'])) { |
|
| 246 | + $nb_other =$placesGeneralResults['other']; |
|
| 247 | + } |
|
| 244 | 248 | $nb_unknown = $placesGeneralResults['unknown']; |
| 245 | 249 | |
| 246 | 250 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -260,11 +264,12 @@ discard block |
||
| 260 | 264 | if($level_map >= 0 && $level_map < count($levelvalues)) { |
| 261 | 265 | $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
| 262 | 266 | if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
| 263 | - } |
|
| 264 | - else { |
|
| 267 | + } else { |
|
| 265 | 268 | $levelref = $levelvalues[0]; |
| 266 | 269 | } |
| 267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 270 | + if(isset($places_mappings[$levelref])) { |
|
| 271 | + $levelref = $places_mappings[$levelref]; |
|
| 272 | + } |
|
| 268 | 273 | if(isset($results_by_subdivs[$levelref])) { |
| 269 | 274 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
| 270 | 275 | $count_subd += $count; |
@@ -281,8 +286,7 @@ discard block |
||
| 281 | 286 | $data->set('results_by_subdivisions', $results_by_subdivs); |
| 282 | 287 | |
| 283 | 288 | $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
| 284 | - } |
|
| 285 | - else { |
|
| 289 | + } else { |
|
| 286 | 290 | $results = $placesGeneralResults['places']; |
| 287 | 291 | arsort($results); |
| 288 | 292 | $data->set('results', $results); |
@@ -290,8 +294,7 @@ discard block |
||
| 290 | 294 | |
| 291 | 295 | $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
| 292 | 296 | } |
| 293 | - } |
|
| 294 | - else { |
|
| 297 | + } else { |
|
| 295 | 298 | $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
| 296 | 299 | } |
| 297 | 300 | return $html; |
@@ -325,9 +328,15 @@ discard block |
||
| 325 | 328 | $sum = 0; |
| 326 | 329 | $other = 0; |
| 327 | 330 | $unknown = 0; |
| 328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
| 329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
| 330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
| 331 | + if(isset($genData['sum'])) { |
|
| 332 | + $sum = $genData['sum']; |
|
| 333 | + } |
|
| 334 | + if(isset($genData['other'])) { |
|
| 335 | + $other = $genData['other']; |
|
| 336 | + } |
|
| 337 | + if(isset($genData['unknown'])) { |
|
| 338 | + $unknown = $genData['unknown']; |
|
| 339 | + } |
|
| 331 | 340 | |
| 332 | 341 | if($sum > 0) { |
| 333 | 342 | $results_by_gen[$gen]['sum'] = $sum; |
@@ -345,8 +354,7 @@ discard block |
||
| 345 | 354 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
| 346 | 355 | } |
| 347 | 356 | } |
| 348 | - } |
|
| 349 | - else { |
|
| 357 | + } else { |
|
| 350 | 358 | $tmp = $genData['places']; |
| 351 | 359 | if($other > 0) { |
| 352 | 360 | $tmp = array_slice($tmp, 0, 5, true); |
@@ -362,8 +370,7 @@ discard block |
||
| 362 | 370 | |
| 363 | 371 | $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
| 364 | 372 | |
| 365 | - } |
|
| 366 | - else { |
|
| 373 | + } else { |
|
| 367 | 374 | $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
| 368 | 375 | } |
| 369 | 376 | return $html; |
@@ -34,25 +34,25 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class TaskController extends MvcController |
| 36 | 36 | { |
| 37 | - /** |
|
| 38 | - * Tasks Provider |
|
| 39 | - * @var TaskProviderInterface $provider |
|
| 40 | - */ |
|
| 41 | - protected $provider; |
|
| 37 | + /** |
|
| 38 | + * Tasks Provider |
|
| 39 | + * @var TaskProviderInterface $provider |
|
| 40 | + */ |
|
| 41 | + protected $provider; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Constructor for Admin Config controller |
|
| 45 | - * @param AbstractModule $module |
|
| 46 | - */ |
|
| 47 | - public function __construct(AbstractModule $module) { |
|
| 48 | - parent::__construct($module); |
|
| 43 | + /** |
|
| 44 | + * Constructor for Admin Config controller |
|
| 45 | + * @param AbstractModule $module |
|
| 46 | + */ |
|
| 47 | + public function __construct(AbstractModule $module) { |
|
| 48 | + parent::__construct($module); |
|
| 49 | 49 | |
| 50 | - $this->provider = $this->module->getProvider(); |
|
| 51 | - } |
|
| 50 | + $this->provider = $this->module->getProvider(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Pages |
|
| 55 | - */ |
|
| 53 | + /** |
|
| 54 | + * Pages |
|
| 55 | + */ |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Task@trigger |
@@ -76,35 +76,35 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * Task@setStatus |
| 78 | 78 | */ |
| 79 | - public function setStatus() { |
|
| 80 | - $controller = new JsonController(); |
|
| 79 | + public function setStatus() { |
|
| 80 | + $controller = new JsonController(); |
|
| 81 | 81 | |
| 82 | - $task_name = Filter::get('task'); |
|
| 83 | - $task = $this->provider->getTask($task_name, false); |
|
| 82 | + $task_name = Filter::get('task'); |
|
| 83 | + $task = $this->provider->getTask($task_name, false); |
|
| 84 | 84 | |
| 85 | - $controller->restrictAccess( |
|
| 86 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 87 | - && Auth::isAdmin() |
|
| 88 | - && $task |
|
| 89 | - ); |
|
| 85 | + $controller->restrictAccess( |
|
| 86 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 87 | + && Auth::isAdmin() |
|
| 88 | + && $task |
|
| 89 | + ); |
|
| 90 | 90 | |
| 91 | - $status = Filter::getBool('status'); |
|
| 92 | - $res = array('task' => $task->getName() , 'error' => null); |
|
| 93 | - try{ |
|
| 94 | - $this->provider->setTaskStatus($task, $status); |
|
| 95 | - $res['status'] = $status; |
|
| 91 | + $status = Filter::getBool('status'); |
|
| 92 | + $res = array('task' => $task->getName() , 'error' => null); |
|
| 93 | + try{ |
|
| 94 | + $this->provider->setTaskStatus($task, $status); |
|
| 95 | + $res['status'] = $status; |
|
| 96 | 96 | Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
| 97 | - } |
|
| 98 | - catch (\Exception $ex) { |
|
| 99 | - $res['error'] = $ex->getMessage(); |
|
| 97 | + } |
|
| 98 | + catch (\Exception $ex) { |
|
| 99 | + $res['error'] = $ex->getMessage(); |
|
| 100 | 100 | Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
| 101 | - } |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - $controller->pageHeader(); |
|
| 104 | - if($res['error']) http_response_code(500); |
|
| 103 | + $controller->pageHeader(); |
|
| 104 | + if($res['error']) http_response_code(500); |
|
| 105 | 105 | |
| 106 | - $controller->encode($res); |
|
| 107 | - } |
|
| 106 | + $controller->encode($res); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * Task@edit |
@@ -112,15 +112,15 @@ discard block |
||
| 112 | 112 | public function edit() { |
| 113 | 113 | global $WT_TREE; |
| 114 | 114 | |
| 115 | - $task_name = Filter::get('task'); |
|
| 116 | - $task = $this->provider->getTask($task_name, false); |
|
| 115 | + $task_name = Filter::get('task'); |
|
| 116 | + $task = $this->provider->getTask($task_name, false); |
|
| 117 | 117 | |
| 118 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 119 | - $controller = new PageController(); |
|
| 120 | - $controller |
|
| 121 | - ->restrictAccess(Auth::isAdmin() && $task) |
|
| 118 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 119 | + $controller = new PageController(); |
|
| 120 | + $controller |
|
| 121 | + ->restrictAccess(Auth::isAdmin() && $task) |
|
| 122 | 122 | ->setPageTitle(I18N::translate('Edit the administrative task')) |
| 123 | - ->addInlineJavascript(' |
|
| 123 | + ->addInlineJavascript(' |
|
| 124 | 124 | function toggleRemainingOccurrences() { |
| 125 | 125 | if($("input:radio[name=\'is_limited\']:checked").val() == 1) { |
| 126 | 126 | $("#nb_occurences").show(); |
@@ -133,39 +133,39 @@ discard block |
||
| 133 | 133 | $("[name=\'is_limited\']").on("change", toggleRemainingOccurrences); |
| 134 | 134 | toggleRemainingOccurrences(); |
| 135 | 135 | ') |
| 136 | - ; |
|
| 136 | + ; |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | - $data = new ViewBag(); |
|
| 140 | - $data->set('title', $controller->getPageTitle()); |
|
| 139 | + $data = new ViewBag(); |
|
| 140 | + $data->set('title', $controller->getPageTitle()); |
|
| 141 | 141 | $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
| 142 | - $data->set('module_title', $this->module->getTitle()); |
|
| 142 | + $data->set('module_title', $this->module->getTitle()); |
|
| 143 | 143 | $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl()); |
| 144 | 144 | $data->set('task', $task); |
| 145 | 145 | |
| 146 | - ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
|
| 146 | + ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * Task@save |
| 151 | 151 | */ |
| 152 | 152 | public function save() { |
| 153 | - $tmp_contrl = new PageController(); |
|
| 153 | + $tmp_contrl = new PageController(); |
|
| 154 | 154 | |
| 155 | - $tmp_contrl->restrictAccess( |
|
| 156 | - Auth::isAdmin() |
|
| 157 | - && Filter::checkCsrf() |
|
| 158 | - ); |
|
| 155 | + $tmp_contrl->restrictAccess( |
|
| 156 | + Auth::isAdmin() |
|
| 157 | + && Filter::checkCsrf() |
|
| 158 | + ); |
|
| 159 | 159 | |
| 160 | 160 | $task_name = Filter::post('task'); |
| 161 | - $frequency = Filter::postInteger('frequency'); |
|
| 162 | - $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
| 163 | - $nb_occur = Filter::postInteger('nb_occur'); |
|
| 161 | + $frequency = Filter::postInteger('frequency'); |
|
| 162 | + $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
| 163 | + $nb_occur = Filter::postInteger('nb_occur'); |
|
| 164 | 164 | |
| 165 | 165 | $task = $this->provider->getTask($task_name, false); |
| 166 | 166 | |
| 167 | - $success = false; |
|
| 168 | - if($task) { |
|
| 167 | + $success = false; |
|
| 168 | + if($task) { |
|
| 169 | 169 | $task->setFrequency($frequency); |
| 170 | 170 | if($is_limited == 1) { |
| 171 | 171 | $task->setRemainingOccurrences($nb_occur); |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.'); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - } |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
| 203 | - if(!$success) { |
|
| 202 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
| 203 | + if(!$success) { |
|
| 204 | 204 | $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName(); |
| 205 | - } |
|
| 206 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 205 | + } |
|
| 206 | + header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | \ No newline at end of file |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $tasks = $this->provider->getTasksToRun($token == $token_submitted, $task_name); |
| 70 | 70 | |
| 71 | - foreach($tasks as $task) { |
|
| 71 | + foreach ($tasks as $task) { |
|
| 72 | 72 | $task->execute(); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -89,19 +89,19 @@ discard block |
||
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | 91 | $status = Filter::getBool('status'); |
| 92 | - $res = array('task' => $task->getName() , 'error' => null); |
|
| 93 | - try{ |
|
| 92 | + $res = array('task' => $task->getName(), 'error' => null); |
|
| 93 | + try { |
|
| 94 | 94 | $this->provider->setTaskStatus($task, $status); |
| 95 | 95 | $res['status'] = $status; |
| 96 | - Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
|
| 96 | + Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '.($status ? 'enabled' : 'disabled').'.'); |
|
| 97 | 97 | } |
| 98 | 98 | catch (\Exception $ex) { |
| 99 | 99 | $res['error'] = $ex->getMessage(); |
| 100 | - Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
|
| 100 | + Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage()); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $controller->pageHeader(); |
| 104 | - if($res['error']) http_response_code(500); |
|
| 104 | + if ($res['error']) http_response_code(500); |
|
| 105 | 105 | |
| 106 | 106 | $controller->encode($res); |
| 107 | 107 | } |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $data = new ViewBag(); |
| 140 | 140 | $data->set('title', $controller->getPageTitle()); |
| 141 | - $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
| 141 | + $data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl()); |
|
| 142 | 142 | $data->set('module_title', $this->module->getTitle()); |
| 143 | - $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl()); |
|
| 143 | + $data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=Task@save&ged='.$WT_TREE->getNameUrl()); |
|
| 144 | 144 | $data->set('task', $task); |
| 145 | 145 | |
| 146 | 146 | ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
@@ -157,17 +157,17 @@ discard block |
||
| 157 | 157 | && Filter::checkCsrf() |
| 158 | 158 | ); |
| 159 | 159 | |
| 160 | - $task_name = Filter::post('task'); |
|
| 161 | - $frequency = Filter::postInteger('frequency'); |
|
| 162 | - $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
| 163 | - $nb_occur = Filter::postInteger('nb_occur'); |
|
| 160 | + $task_name = Filter::post('task'); |
|
| 161 | + $frequency = Filter::postInteger('frequency'); |
|
| 162 | + $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
| 163 | + $nb_occur = Filter::postInteger('nb_occur'); |
|
| 164 | 164 | |
| 165 | 165 | $task = $this->provider->getTask($task_name, false); |
| 166 | 166 | |
| 167 | 167 | $success = false; |
| 168 | - if($task) { |
|
| 168 | + if ($task) { |
|
| 169 | 169 | $task->setFrequency($frequency); |
| 170 | - if($is_limited == 1) { |
|
| 170 | + if ($is_limited == 1) { |
|
| 171 | 171 | $task->setRemainingOccurrences($nb_occur); |
| 172 | 172 | } |
| 173 | 173 | else { |
@@ -176,34 +176,34 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $res = $task->save(); |
| 178 | 178 | |
| 179 | - if($res) { |
|
| 180 | - if($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) { |
|
| 179 | + if ($res) { |
|
| 180 | + if ($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) { |
|
| 181 | 181 | $res = $task->saveConfig(); |
| 182 | 182 | |
| 183 | - if(!$res) { |
|
| 183 | + if (!$res) { |
|
| 184 | 184 | FlashMessages::addMessage(I18N::translate('An error occured while updating the specific settings of administrative task “%s”', $task->getTitle()), 'danger'); |
| 185 | - Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” specific settings could not be updated. See error log.'); |
|
| 185 | + Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” specific settings could not be updated. See error log.'); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - if($res) { |
|
| 189 | + if ($res) { |
|
| 190 | 190 | FlashMessages::addMessage(I18N::translate('The administrative task “%s” has been successfully updated', $task->getTitle()), 'success'); |
| 191 | - Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName() .'” has been updated.'); |
|
| 191 | + Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” has been updated.'); |
|
| 192 | 192 | $success = true; |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | else { |
| 196 | 196 | FlashMessages::addMessage(I18N::translate('An error occured while updating the administrative task “%s”', $task->getTitle()), 'danger'); |
| 197 | - Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.'); |
|
| 197 | + Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” could not be updated. See error log.'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
| 203 | - if(!$success) { |
|
| 204 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName(); |
|
| 202 | + $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig'; |
|
| 203 | + if (!$success) { |
|
| 204 | + $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='.$task->getName(); |
|
| 205 | 205 | } |
| 206 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 206 | + header('Location: '.WT_BASE_URL.$redirection_url); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | \ No newline at end of file |
@@ -94,14 +94,15 @@ discard block |
||
| 94 | 94 | $this->provider->setTaskStatus($task, $status); |
| 95 | 95 | $res['status'] = $status; |
| 96 | 96 | Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
| 97 | - } |
|
| 98 | - catch (\Exception $ex) { |
|
| 97 | + } catch (\Exception $ex) { |
|
| 99 | 98 | $res['error'] = $ex->getMessage(); |
| 100 | 99 | Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
| 101 | 100 | } |
| 102 | 101 | |
| 103 | 102 | $controller->pageHeader(); |
| 104 | - if($res['error']) http_response_code(500); |
|
| 103 | + if($res['error']) { |
|
| 104 | + http_response_code(500); |
|
| 105 | + } |
|
| 105 | 106 | |
| 106 | 107 | $controller->encode($res); |
| 107 | 108 | } |
@@ -169,8 +170,7 @@ discard block |
||
| 169 | 170 | $task->setFrequency($frequency); |
| 170 | 171 | if($is_limited == 1) { |
| 171 | 172 | $task->setRemainingOccurrences($nb_occur); |
| 172 | - } |
|
| 173 | - else { |
|
| 173 | + } else { |
|
| 174 | 174 | $task->setRemainingOccurrences(0); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -191,8 +191,7 @@ discard block |
||
| 191 | 191 | Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName() .'” has been updated.'); |
| 192 | 192 | $success = true; |
| 193 | 193 | } |
| 194 | - } |
|
| 195 | - else { |
|
| 194 | + } else { |
|
| 196 | 195 | FlashMessages::addMessage(I18N::translate('An error occured while updating the administrative task “%s”', $task->getTitle()), 'danger'); |
| 197 | 196 | Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.'); |
| 198 | 197 | } |
@@ -23,74 +23,74 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class PiwikController extends MvcController |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * Retrieve the number of visitors from Piwik, for a given period. |
|
| 28 | - * |
|
| 29 | - * @param string $block_id |
|
| 30 | - * @param string $period |
|
| 31 | - * @param (null|int) Number of visits |
|
| 32 | - */ |
|
| 33 | - private function getNumberOfVisitsPiwik($block_id, $period='year'){ |
|
| 26 | + /** |
|
| 27 | + * Retrieve the number of visitors from Piwik, for a given period. |
|
| 28 | + * |
|
| 29 | + * @param string $block_id |
|
| 30 | + * @param string $period |
|
| 31 | + * @param (null|int) Number of visits |
|
| 32 | + */ |
|
| 33 | + private function getNumberOfVisitsPiwik($block_id, $period='year'){ |
|
| 34 | 34 | |
| 35 | - $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url'); |
|
| 36 | - $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid'); |
|
| 37 | - $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token'); |
|
| 35 | + $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url'); |
|
| 36 | + $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid'); |
|
| 37 | + $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token'); |
|
| 38 | 38 | |
| 39 | - if($piwik_url && strlen($piwik_url) > 0 && |
|
| 40 | - $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
| 41 | - $piwik_token && strlen($piwik_token) |
|
| 42 | - ) |
|
| 43 | - { |
|
| 44 | - // calling Piwik REST API |
|
| 45 | - $url = $piwik_url; |
|
| 46 | - $url .= '?module=API&method=VisitsSummary.getVisits'; |
|
| 47 | - $url .= '&idSite='.$piwik_siteid.'&period='.$period.'&date=today'; |
|
| 48 | - $url .= '&format=PHP'; |
|
| 49 | - $url .= '&token_auth='.$piwik_token; |
|
| 39 | + if($piwik_url && strlen($piwik_url) > 0 && |
|
| 40 | + $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
| 41 | + $piwik_token && strlen($piwik_token) |
|
| 42 | + ) |
|
| 43 | + { |
|
| 44 | + // calling Piwik REST API |
|
| 45 | + $url = $piwik_url; |
|
| 46 | + $url .= '?module=API&method=VisitsSummary.getVisits'; |
|
| 47 | + $url .= '&idSite='.$piwik_siteid.'&period='.$period.'&date=today'; |
|
| 48 | + $url .= '&format=PHP'; |
|
| 49 | + $url .= '&token_auth='.$piwik_token; |
|
| 50 | 50 | |
| 51 | - if($fetched = File::fetchUrl($url)) { |
|
| 52 | - $content = @unserialize($fetched); |
|
| 53 | - if(is_numeric($content)) return $content; |
|
| 54 | - } |
|
| 55 | - } |
|
| 51 | + if($fetched = File::fetchUrl($url)) { |
|
| 52 | + $content = @unserialize($fetched); |
|
| 53 | + if(is_numeric($content)) return $content; |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return null; |
|
| 58 | - } |
|
| 57 | + return null; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Pages |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * Pages |
|
| 62 | + */ |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Piwik@index |
|
| 66 | - */ |
|
| 67 | - public function index() { |
|
| 64 | + /** |
|
| 65 | + * Piwik@index |
|
| 66 | + */ |
|
| 67 | + public function index() { |
|
| 68 | 68 | |
| 69 | - $ctrl = new AjaxController(); |
|
| 69 | + $ctrl = new AjaxController(); |
|
| 70 | 70 | |
| 71 | - $data = new ViewBag(); |
|
| 72 | - $data->set('has_stats', false); |
|
| 71 | + $data = new ViewBag(); |
|
| 72 | + $data->set('has_stats', false); |
|
| 73 | 73 | |
| 74 | - $block_id = Filter::get('block_id'); |
|
| 75 | - if($block_id){ |
|
| 76 | - $cached_item = Cache::get('piwikCountYear', $this->module); |
|
| 77 | - $visitCountYear = $cached_item->get(); |
|
| 78 | - if(!$cached_item->isHit()) { |
|
| 79 | - $visitCountYear = $this->getNumberOfVisitsPiwik($block_id); |
|
| 80 | - Cache::save($cached_item, $visitCountYear); |
|
| 81 | - } |
|
| 74 | + $block_id = Filter::get('block_id'); |
|
| 75 | + if($block_id){ |
|
| 76 | + $cached_item = Cache::get('piwikCountYear', $this->module); |
|
| 77 | + $visitCountYear = $cached_item->get(); |
|
| 78 | + if(!$cached_item->isHit()) { |
|
| 79 | + $visitCountYear = $this->getNumberOfVisitsPiwik($block_id); |
|
| 80 | + Cache::save($cached_item, $visitCountYear); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - if($visitCountYear){ |
|
| 84 | - $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day')); |
|
| 85 | - $visitCountYear = max( 0, $visitCountYear); |
|
| 83 | + if($visitCountYear){ |
|
| 84 | + $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day')); |
|
| 85 | + $visitCountYear = max( 0, $visitCountYear); |
|
| 86 | 86 | |
| 87 | - $data->set('has_stats', true); |
|
| 88 | - $data->set('visits_today', $visitCountToday); |
|
| 89 | - $data->set('visits_year', $visitCountYear + $visitCountToday); |
|
| 90 | - } |
|
| 91 | - } |
|
| 87 | + $data->set('has_stats', true); |
|
| 88 | + $data->set('visits_today', $visitCountToday); |
|
| 89 | + $data->set('visits_year', $visitCountYear + $visitCountToday); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - ViewFactory::make('PiwikStats', $this, $ctrl, $data)->render(); |
|
| 94 | - } |
|
| 93 | + ViewFactory::make('PiwikStats', $this, $ctrl, $data)->render(); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | \ No newline at end of file |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | * @param string $period |
| 31 | 31 | * @param (null|int) Number of visits |
| 32 | 32 | */ |
| 33 | - private function getNumberOfVisitsPiwik($block_id, $period='year'){ |
|
| 33 | + private function getNumberOfVisitsPiwik($block_id, $period = 'year') { |
|
| 34 | 34 | |
| 35 | 35 | $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url'); |
| 36 | 36 | $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid'); |
| 37 | 37 | $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token'); |
| 38 | 38 | |
| 39 | - if($piwik_url && strlen($piwik_url) > 0 && |
|
| 40 | - $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
| 39 | + if ($piwik_url && strlen($piwik_url) > 0 && |
|
| 40 | + $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
| 41 | 41 | $piwik_token && strlen($piwik_token) |
| 42 | 42 | ) |
| 43 | 43 | { |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | $url .= '&format=PHP'; |
| 49 | 49 | $url .= '&token_auth='.$piwik_token; |
| 50 | 50 | |
| 51 | - if($fetched = File::fetchUrl($url)) { |
|
| 51 | + if ($fetched = File::fetchUrl($url)) { |
|
| 52 | 52 | $content = @unserialize($fetched); |
| 53 | - if(is_numeric($content)) return $content; |
|
| 53 | + if (is_numeric($content)) return $content; |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | $data->set('has_stats', false); |
| 73 | 73 | |
| 74 | 74 | $block_id = Filter::get('block_id'); |
| 75 | - if($block_id){ |
|
| 75 | + if ($block_id) { |
|
| 76 | 76 | $cached_item = Cache::get('piwikCountYear', $this->module); |
| 77 | 77 | $visitCountYear = $cached_item->get(); |
| 78 | - if(!$cached_item->isHit()) { |
|
| 78 | + if (!$cached_item->isHit()) { |
|
| 79 | 79 | $visitCountYear = $this->getNumberOfVisitsPiwik($block_id); |
| 80 | 80 | Cache::save($cached_item, $visitCountYear); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if($visitCountYear){ |
|
| 83 | + if ($visitCountYear) { |
|
| 84 | 84 | $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day')); |
| 85 | - $visitCountYear = max( 0, $visitCountYear); |
|
| 85 | + $visitCountYear = max(0, $visitCountYear); |
|
| 86 | 86 | |
| 87 | 87 | $data->set('has_stats', true); |
| 88 | 88 | $data->set('visits_today', $visitCountToday); |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | |
| 51 | 51 | if($fetched = File::fetchUrl($url)) { |
| 52 | 52 | $content = @unserialize($fetched); |
| 53 | - if(is_numeric($content)) return $content; |
|
| 53 | + if(is_numeric($content)) { |
|
| 54 | + return $content; |
|
| 55 | + } |
|
| 54 | 56 | } |
| 55 | 57 | } |
| 56 | 58 | |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | namespace MyArtJaub\Webtrees\Module\Sosa\Views; |
| 12 | 12 | |
| 13 | -use Fisharebest\Webtrees\Date; |
|
| 14 | 13 | use Fisharebest\Webtrees\Filter; |
| 15 | 14 | use Fisharebest\Webtrees\Functions\Functions; |
| 16 | 15 | use Fisharebest\Webtrees\GedcomTag; |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | * {@inhericDoc} |
| 31 | 31 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 32 | 32 | */ |
| 33 | - protected function renderContent() { |
|
| 34 | - ?> |
|
| 33 | + protected function renderContent() { |
|
| 34 | + ?> |
|
| 35 | 35 | <div id="maj-sosa-missing-page" class="center"> |
| 36 | 36 | <h2><?= $this->data->get('title') ?></h2> |
| 37 | 37 | |
| 38 | 38 | <?php if($this->data->get('is_setup')) { |
| 39 | - $this->renderSosaHeader(); |
|
| 40 | - if($this->data->get('has_missing', false)) { |
|
| 41 | - $table_id = $this->data->get('table_id'); |
|
| 42 | - ?> |
|
| 39 | + $this->renderSosaHeader(); |
|
| 40 | + if($this->data->get('has_missing', false)) { |
|
| 41 | + $table_id = $this->data->get('table_id'); |
|
| 42 | + ?> |
|
| 43 | 43 | <div id="sosa-indi-missing" class="smissing-list"> |
| 44 | 44 | <table id="<?= $table_id ?>"> |
| 45 | 45 | <thead> |
@@ -103,48 +103,48 @@ discard block |
||
| 103 | 103 | <tbody> |
| 104 | 104 | |
| 105 | 105 | <?php foreach($this->data->get('missing_list') as $missing_tab) { |
| 106 | - $person = $missing_tab['indi']; |
|
| 106 | + $person = $missing_tab['indi']; |
|
| 107 | 107 | |
| 108 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 109 | - if ($person->isPendingAddtion()) { |
|
| 110 | - $class = ' class="new"'; |
|
| 111 | - } elseif ($person->isPendingDeletion()) { |
|
| 112 | - $class = ' class="old"'; |
|
| 113 | - } else { |
|
| 114 | - $class = ''; |
|
| 115 | - } |
|
| 116 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 117 | - list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); |
|
| 118 | - ?> |
|
| 108 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 109 | + if ($person->isPendingAddtion()) { |
|
| 110 | + $class = ' class="new"'; |
|
| 111 | + } elseif ($person->isPendingDeletion()) { |
|
| 112 | + $class = ' class="old"'; |
|
| 113 | + } else { |
|
| 114 | + $class = ''; |
|
| 115 | + } |
|
| 116 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 117 | + list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); |
|
| 118 | + ?> |
|
| 119 | 119 | <tr <?= $class ?>> |
| 120 | 120 | <td class="transparent"><?= $missing_tab['sosa'] ?></td> |
| 121 | 121 | <td class="transparent"><?= $person->getXref() ?></td> |
| 122 | 122 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 123 | 123 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 124 | - if ($name['type']=='NAME') { |
|
| 125 | - $title=''; |
|
| 126 | - } else { |
|
| 127 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 128 | - } |
|
| 129 | - if ($num==$person->getPrimaryName()) { |
|
| 130 | - $class=' class="name2"'; |
|
| 131 | - $sex_image=$person->getSexImage(); |
|
| 132 | - } else { |
|
| 133 | - $class=''; |
|
| 134 | - $sex_image=''; |
|
| 135 | - } ?> |
|
| 124 | + if ($name['type']=='NAME') { |
|
| 125 | + $title=''; |
|
| 126 | + } else { |
|
| 127 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 128 | + } |
|
| 129 | + if ($num==$person->getPrimaryName()) { |
|
| 130 | + $class=' class="name2"'; |
|
| 131 | + $sex_image=$person->getSexImage(); |
|
| 132 | + } else { |
|
| 133 | + $class=''; |
|
| 134 | + $sex_image=''; |
|
| 135 | + } ?> |
|
| 136 | 136 | <a <?= $title.' '.$class ?> href="<?= $person->getHtmlUrl() ?>"> |
| 137 | 137 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
| 138 | 138 | </a> |
| 139 | 139 | <?= $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller') ?> |
| 140 | 140 | <br/> |
| 141 | 141 | <?php } |
| 142 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 143 | - ?> |
|
| 142 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 143 | + ?> |
|
| 144 | 144 | </td> |
| 145 | 145 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
| 146 | 146 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 147 | - $isISourced = $dperson->isSourced(); ?> |
|
| 147 | + $isISourced = $dperson->isSourced(); ?> |
|
| 148 | 148 | <td data-sort="<?= $isISourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('R', $isISourced, 'INDI', 1, 'medium') ?></td> |
| 149 | 149 | <?php } else { ?> |
| 150 | 150 | <td> </td> |
@@ -154,23 +154,23 @@ discard block |
||
| 154 | 154 | <?php $birth_dates = $person->getAllBirthDates(); ?> |
| 155 | 155 | <td data-sort="<?= $person->getEstimatedBirthDate()->julianDay() ?>"> |
| 156 | 156 | <?php |
| 157 | - foreach ($birth_dates as $n => $birth_date) { |
|
| 158 | - if ($n > 0) { ?> <br> <?php } |
|
| 159 | - echo $birth_date->display(true); |
|
| 160 | - } |
|
| 161 | - ?> |
|
| 157 | + foreach ($birth_dates as $n => $birth_date) { |
|
| 158 | + if ($n > 0) { ?> <br> <?php } |
|
| 159 | + echo $birth_date->display(true); |
|
| 160 | + } |
|
| 161 | + ?> |
|
| 162 | 162 | </td> |
| 163 | 163 | <td> |
| 164 | 164 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
| 165 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 166 | - if ($n > 0) { ?><br><?php } ?> |
|
| 165 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 166 | + if ($n > 0) { ?><br><?php } ?> |
|
| 167 | 167 | <a href="'<?= $tmp->getURL(); ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
| 168 | 168 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
| 169 | 169 | </a> |
| 170 | 170 | <?php } ?> |
| 171 | 171 | </td> |
| 172 | 172 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 173 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 173 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 174 | 174 | <td data-sort="<?= $isBSourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium') ?></td> |
| 175 | 175 | <?php } else { ?> |
| 176 | 176 | <td> </td> |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | <?php } else if ($this->data->get('generation', 0) > 0) { ?> |
| 196 | 196 | <p><?= I18N::translate('No ancestors are missing for this generation. Generation complete at %s.', I18N::percentage($this->data->get('perc_sosa'), 2)) ?></p> |
| 197 | 197 | <?php } |
| 198 | - } else { ?> |
|
| 198 | + } else { ?> |
|
| 199 | 199 | <p class="warning"><?= I18N::translate('The list could not be displayed. Reasons might be:') ?><br/> |
| 200 | 200 | <ul> |
| 201 | 201 | <li><?= I18N::translate('No Sosa root individual has been defined.') ?></li> |
@@ -206,6 +206,6 @@ discard block |
||
| 206 | 206 | <?php } ?> |
| 207 | 207 | </div> |
| 208 | 208 | <?php |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | \ No newline at end of file |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | <div id="maj-sosa-missing-page" class="center"> |
| 36 | 36 | <h2><?= $this->data->get('title') ?></h2> |
| 37 | 37 | |
| 38 | - <?php if($this->data->get('is_setup')) { |
|
| 38 | + <?php if ($this->data->get('is_setup')) { |
|
| 39 | 39 | $this->renderSosaHeader(); |
| 40 | - if($this->data->get('has_missing', false)) { |
|
| 40 | + if ($this->data->get('has_missing', false)) { |
|
| 41 | 41 | $table_id = $this->data->get('table_id'); |
| 42 | 42 | ?> |
| 43 | 43 | <div id="sosa-indi-missing" class="smissing-list"> |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | </thead> |
| 103 | 103 | <tbody> |
| 104 | 104 | |
| 105 | - <?php foreach($this->data->get('missing_list') as $missing_tab) { |
|
| 105 | + <?php foreach ($this->data->get('missing_list') as $missing_tab) { |
|
| 106 | 106 | $person = $missing_tab['indi']; |
| 107 | 107 | |
| 108 | 108 | /** @var \Fisharebest\Webtrees\Individual $person */ |
@@ -121,17 +121,17 @@ discard block |
||
| 121 | 121 | <td class="transparent"><?= $person->getXref() ?></td> |
| 122 | 122 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 123 | 123 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 124 | - if ($name['type']=='NAME') { |
|
| 125 | - $title=''; |
|
| 124 | + if ($name['type'] == 'NAME') { |
|
| 125 | + $title = ''; |
|
| 126 | 126 | } else { |
| 127 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 127 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 128 | 128 | } |
| 129 | - if ($num==$person->getPrimaryName()) { |
|
| 130 | - $class=' class="name2"'; |
|
| 131 | - $sex_image=$person->getSexImage(); |
|
| 129 | + if ($num == $person->getPrimaryName()) { |
|
| 130 | + $class = ' class="name2"'; |
|
| 131 | + $sex_image = $person->getSexImage(); |
|
| 132 | 132 | } else { |
| 133 | - $class=''; |
|
| 134 | - $sex_image=''; |
|
| 133 | + $class = ''; |
|
| 134 | + $sex_image = ''; |
|
| 135 | 135 | } ?> |
| 136 | 136 | <a <?= $title.' '.$class ?> href="<?= $person->getHtmlUrl() ?>"> |
| 137 | 137 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | <td class="ui-state-default" colspan="11"> |
| 185 | 185 | <div class="center"> |
| 186 | 186 | <?= I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count'))) ?> |
| 187 | - <?php if($this->data->get('missing_hidden') > 0) echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
| 188 | - <?= ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)) ?> |
|
| 189 | - <?= ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'),2)).']' ?> |
|
| 187 | + <?php if ($this->data->get('missing_hidden') > 0) echo ' ['.I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
| 188 | + <?= ' - '.I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)) ?> |
|
| 189 | + <?= ' ['.I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'), 2)).']' ?> |
|
| 190 | 190 | </div> |
| 191 | 191 | </td> |
| 192 | 192 | </tr> |
@@ -184,7 +184,10 @@ |
||
| 184 | 184 | <td class="ui-state-default" colspan="11"> |
| 185 | 185 | <div class="center"> |
| 186 | 186 | <?= I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count'))) ?> |
| 187 | - <?php if($this->data->get('missing_hidden') > 0) echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
| 187 | + <?php if($this->data->get('missing_hidden') > 0) { |
|
| 188 | + echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; |
|
| 189 | +} |
|
| 190 | +?> |
|
| 188 | 191 | <?= ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)) ?> |
| 189 | 192 | <?= ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'),2)).']' ?> |
| 190 | 193 | </div> |
@@ -17,27 +17,27 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class FunctionsPrintLists { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Copy of core function, which is not public. |
|
| 22 | - * |
|
| 23 | - * @param Individual $individual |
|
| 24 | - * |
|
| 25 | - * @return string[] |
|
| 26 | - * @see \Fisharebest\Webtrees\Functions\FunctionsPrintLists |
|
| 27 | - */ |
|
| 28 | - public static function sortableNames(Individual $individual) { |
|
| 29 | - $names = $individual->getAllNames(); |
|
| 30 | - $primary = $individual->getPrimaryName(); |
|
| 20 | + /** |
|
| 21 | + * Copy of core function, which is not public. |
|
| 22 | + * |
|
| 23 | + * @param Individual $individual |
|
| 24 | + * |
|
| 25 | + * @return string[] |
|
| 26 | + * @see \Fisharebest\Webtrees\Functions\FunctionsPrintLists |
|
| 27 | + */ |
|
| 28 | + public static function sortableNames(Individual $individual) { |
|
| 29 | + $names = $individual->getAllNames(); |
|
| 30 | + $primary = $individual->getPrimaryName(); |
|
| 31 | 31 | |
| 32 | - list($surn, $givn) = explode(',', $names[$primary]['sort']); |
|
| 32 | + list($surn, $givn) = explode(',', $names[$primary]['sort']); |
|
| 33 | 33 | |
| 34 | - $givn = str_replace('@P.N.', 'AAAA', $givn); |
|
| 35 | - $surn = str_replace('@N.N.', 'AAAA', $surn); |
|
| 34 | + $givn = str_replace('@P.N.', 'AAAA', $givn); |
|
| 35 | + $surn = str_replace('@N.N.', 'AAAA', $surn); |
|
| 36 | 36 | |
| 37 | - return array( |
|
| 38 | - $surn . 'AAAA' . $givn, |
|
| 39 | - $givn . 'AAAA' . $surn, |
|
| 40 | - ); |
|
| 41 | - } |
|
| 37 | + return array( |
|
| 38 | + $surn . 'AAAA' . $givn, |
|
| 39 | + $givn . 'AAAA' . $surn, |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -35,8 +35,8 @@ |
||
| 35 | 35 | $surn = str_replace('@N.N.', 'AAAA', $surn); |
| 36 | 36 | |
| 37 | 37 | return array( |
| 38 | - $surn . 'AAAA' . $givn, |
|
| 39 | - $givn . 'AAAA' . $surn, |
|
| 38 | + $surn.'AAAA'.$givn, |
|
| 39 | + $givn.'AAAA'.$surn, |
|
| 40 | 40 | ); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | <input type="hidden" name="ged" value="<?= $this->data->get('url_ged') ?>"> |
| 40 | 40 | <select name="city"> |
| 41 | 41 | <?php foreach ($cities as $city) { ?> |
| 42 | - <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if(trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option> |
|
| 42 | + <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if (trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option> |
|
| 43 | 43 | <?php } ?> |
| 44 | 44 | </select> |
| 45 | 45 | <input type="submit" value="<?= I18N::translate('Show') ?>" /> |
| 46 | 46 | </form> |
| 47 | 47 | |
| 48 | - <?php if($this->data->get('has_list', false)) { ?> |
|
| 48 | + <?php if ($this->data->get('has_list', false)) { ?> |
|
| 49 | 49 | <div class="loading-image"> </div> |
| 50 | 50 | <div class="certificate-list"> |
| 51 | 51 | <table id="<?= $this->data->get('table_id') ?>"> |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | ?> |
| 63 | 63 | <tr> |
| 64 | 64 | <!-- Certificate date --> |
| 65 | - <?php if($date = $certificate->getCertificateDate()) { ?> |
|
| 65 | + <?php if ($date = $certificate->getCertificateDate()) { ?> |
|
| 66 | 66 | <td data-sort="<?= $date->julianDay() ?>"><?= $date->display() ?></td> |
| 67 | 67 | <?php } else { ?> |
| 68 | 68 | <td data-sort="0"> </td> |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | <?php |
| 74 | 74 | $name = $certificate->getCertificateDetails() ?: ''; |
| 75 | 75 | $sortname = ""; |
| 76 | - $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | - if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 76 | + $ct_names = preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | + if ($ct_names > 0) $sortname = $match[1].'_'; |
|
| 78 | 78 | $sortname .= $name; |
| 79 | 79 | ?> |
| 80 | 80 | <td data-sort="<?= Filter::escapeHtml($sortname) ?>"> |
@@ -39,7 +39,8 @@ discard block |
||
| 39 | 39 | <input type="hidden" name="ged" value="<?= $this->data->get('url_ged') ?>"> |
| 40 | 40 | <select name="city"> |
| 41 | 41 | <?php foreach ($cities as $city) { ?> |
| 42 | - <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if(trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option> |
|
| 42 | + <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if(trim($city) == trim($selected_city)) { |
|
| 43 | + echo 'selected="selected"'?> ><?= $city ?></option> |
|
| 43 | 44 | <?php } ?> |
| 44 | 45 | </select> |
| 45 | 46 | <input type="submit" value="<?= I18N::translate('Show') ?>" /> |
@@ -72,9 +73,12 @@ discard block |
||
| 72 | 73 | <!-- Certificate Name --> |
| 73 | 74 | <?php |
| 74 | 75 | $name = $certificate->getCertificateDetails() ?: ''; |
| 76 | +} |
|
| 75 | 77 | $sortname = ""; |
| 76 | 78 | $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
| 77 | - if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 79 | + if($ct_names > 0) { |
|
| 80 | + $sortname = $match[1].'_'; |
|
| 81 | + } |
|
| 78 | 82 | $sortname .= $name; |
| 79 | 83 | ?> |
| 80 | 84 | <td data-sort="<?= Filter::escapeHtml($sortname) ?>"> |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | * {@inhericDoc} |
| 25 | 25 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 26 | 26 | */ |
| 27 | - protected function renderContent() { |
|
| 27 | + protected function renderContent() { |
|
| 28 | 28 | |
| 29 | - $cities = $this->data->get('cities'); |
|
| 30 | - $selected_city = $this->data->get('selected_city'); |
|
| 29 | + $cities = $this->data->get('cities'); |
|
| 30 | + $selected_city = $this->data->get('selected_city'); |
|
| 31 | 31 | |
| 32 | - ?> |
|
| 32 | + ?> |
|
| 33 | 33 | <div id="maj-cert-list-page" class="center"> |
| 34 | 34 | <h2><?= $this->data->get('title') ?></h2> |
| 35 | 35 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | </thead> |
| 59 | 59 | <tbody> |
| 60 | 60 | <?php foreach ($this->data->get('certificate_list') as $certificate) { |
| 61 | - /** @var \MyArtJaub\Webtrees\Module\Certificates\Model\Certificate $certificate */ |
|
| 62 | - ?> |
|
| 61 | + /** @var \MyArtJaub\Webtrees\Module\Certificates\Model\Certificate $certificate */ |
|
| 62 | + ?> |
|
| 63 | 63 | <tr> |
| 64 | 64 | <!-- Certificate date --> |
| 65 | 65 | <?php if($date = $certificate->getCertificateDate()) { ?> |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | <td><?= Filter::escapeHtml($certificate->getCertificateType() ?: '') ?></td> |
| 72 | 72 | <!-- Certificate Name --> |
| 73 | 73 | <?php |
| 74 | - $name = $certificate->getCertificateDetails() ?: ''; |
|
| 75 | - $sortname = ""; |
|
| 76 | - $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | - if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 78 | - $sortname .= $name; |
|
| 79 | - ?> |
|
| 74 | + $name = $certificate->getCertificateDetails() ?: ''; |
|
| 75 | + $sortname = ""; |
|
| 76 | + $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | + if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 78 | + $sortname .= $name; |
|
| 79 | + ?> |
|
| 80 | 80 | <td data-sort="<?= Filter::escapeHtml($sortname) ?>"> |
| 81 | 81 | <a href="<?= $certificate->getHtmlUrl() ?>"><?= Filter::escapeHtml($name) ?></a> |
| 82 | 82 | </td> |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | </div> |
| 90 | 90 | |
| 91 | 91 | <?php |
| 92 | - } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | \ No newline at end of file |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * {@inhericDoc} |
| 33 | 33 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 34 | 34 | */ |
| 35 | - protected function renderContent() { |
|
| 35 | + protected function renderContent() { |
|
| 36 | 36 | |
| 37 | - if($this->data->get('has_sosa', false)) { |
|
| 38 | - $table_id = $this->data->get('table_id'); |
|
| 39 | - ?> |
|
| 37 | + if($this->data->get('has_sosa', false)) { |
|
| 38 | + $table_id = $this->data->get('table_id'); |
|
| 39 | + ?> |
|
| 40 | 40 | |
| 41 | 41 | <div id="sosa-fam-list" class="sosa-list"> |
| 42 | 42 | <table id="<?php echo $table_id; ?>"> |
@@ -176,58 +176,58 @@ discard block |
||
| 176 | 176 | <tbody> |
| 177 | 177 | |
| 178 | 178 | <?php foreach($this->data->get('sosa_list') as $sosa => $family) { |
| 179 | - /** @var \Fisharebest\Webtrees\Family $person */ |
|
| 179 | + /** @var \Fisharebest\Webtrees\Family $person */ |
|
| 180 | 180 | |
| 181 | - //PERSO Create decorator for Family |
|
| 182 | - $dfamily = new Family($family); |
|
| 181 | + //PERSO Create decorator for Family |
|
| 182 | + $dfamily = new Family($family); |
|
| 183 | 183 | |
| 184 | - $husb = $family->getHusband(); |
|
| 185 | - if (is_null($husb)) { |
|
| 186 | - $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree()); |
|
| 187 | - } |
|
| 188 | - $dhusb = new \MyArtJaub\Webtrees\Individual($husb); |
|
| 189 | - $wife = $family->getWife(); |
|
| 190 | - if (is_null($wife)) { |
|
| 191 | - $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree()); |
|
| 192 | - } |
|
| 193 | - $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
|
| 184 | + $husb = $family->getHusband(); |
|
| 185 | + if (is_null($husb)) { |
|
| 186 | + $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree()); |
|
| 187 | + } |
|
| 188 | + $dhusb = new \MyArtJaub\Webtrees\Individual($husb); |
|
| 189 | + $wife = $family->getWife(); |
|
| 190 | + if (is_null($wife)) { |
|
| 191 | + $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree()); |
|
| 192 | + } |
|
| 193 | + $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
|
| 194 | 194 | |
| 195 | - $mdate=$family->getMarriageDate(); |
|
| 195 | + $mdate=$family->getMarriageDate(); |
|
| 196 | 196 | |
| 197 | - if ($family->isPendingAddtion()) { |
|
| 198 | - $class = ' class="new"'; |
|
| 199 | - } elseif ($family->isPendingDeletion()) { |
|
| 200 | - $class = ' class="old"'; |
|
| 201 | - } else { |
|
| 202 | - $class = ''; |
|
| 203 | - } |
|
| 204 | - ?> |
|
| 197 | + if ($family->isPendingAddtion()) { |
|
| 198 | + $class = ' class="new"'; |
|
| 199 | + } elseif ($family->isPendingDeletion()) { |
|
| 200 | + $class = ' class="old"'; |
|
| 201 | + } else { |
|
| 202 | + $class = ''; |
|
| 203 | + } |
|
| 204 | + ?> |
|
| 205 | 205 | <tr <?= $class ?>> |
| 206 | 206 | <td class="transparent" data-sort="<?= $sosa ?>"><?= I18N::translate('%1$d/%2$d', $sosa, ($sosa + 1) % 10) ?></td> |
| 207 | 207 | <!-- HUSBAND --> |
| 208 | 208 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($husb); ?> |
| 209 | 209 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 210 | 210 | <?php foreach ($husb->getAllNames() as $num=>$name) { |
| 211 | - if ($name['type']=='NAME') { |
|
| 212 | - $title=''; |
|
| 213 | - } else { |
|
| 214 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"'; |
|
| 215 | - } |
|
| 216 | - if ($num==$husb->getPrimaryName()) { |
|
| 217 | - $class=' class="name2"'; |
|
| 218 | - $sex_image=$husb->getSexImage(); |
|
| 219 | - } else { |
|
| 220 | - $class=''; |
|
| 221 | - $sex_image=''; |
|
| 222 | - } ?> |
|
| 211 | + if ($name['type']=='NAME') { |
|
| 212 | + $title=''; |
|
| 213 | + } else { |
|
| 214 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"'; |
|
| 215 | + } |
|
| 216 | + if ($num==$husb->getPrimaryName()) { |
|
| 217 | + $class=' class="name2"'; |
|
| 218 | + $sex_image=$husb->getSexImage(); |
|
| 219 | + } else { |
|
| 220 | + $class=''; |
|
| 221 | + $sex_image=''; |
|
| 222 | + } ?> |
|
| 223 | 223 | <a <?php echo $title.' '.$class; ?> href="<?php echo $husb->getHtmlUrl(); ?>"> |
| 224 | 224 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
| 225 | 225 | </a> |
| 226 | 226 | <?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dhusb->getSosaNumbers(), 1, 'smaller'); ?> |
| 227 | 227 | <br/> |
| 228 | 228 | <?php } |
| 229 | - echo $husb->getPrimaryParentsNames('parents details1', 'none'); |
|
| 230 | - ?> |
|
| 229 | + echo $husb->getPrimaryParentsNames('parents details1', 'none'); |
|
| 230 | + ?> |
|
| 231 | 231 | </td> |
| 232 | 232 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
| 233 | 233 | <?php $hdate=$husb->getBirthDate(); ?> |
@@ -236,55 +236,55 @@ discard block |
||
| 236 | 236 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($wife); ?> |
| 237 | 237 | <td colspan="2"> |
| 238 | 238 | <?php foreach ($wife->getAllNames() as $num=>$name) { |
| 239 | - if ($name['type']=='NAME') { |
|
| 240 | - $title=''; |
|
| 241 | - } else { |
|
| 242 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"'; |
|
| 243 | - } |
|
| 244 | - if ($num==$wife->getPrimaryName()) { |
|
| 245 | - $class=' class="name2"'; |
|
| 246 | - $sex_image=$wife->getSexImage(); |
|
| 247 | - } else { |
|
| 248 | - $class=''; |
|
| 249 | - $sex_image=''; |
|
| 250 | - } ?> |
|
| 239 | + if ($name['type']=='NAME') { |
|
| 240 | + $title=''; |
|
| 241 | + } else { |
|
| 242 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"'; |
|
| 243 | + } |
|
| 244 | + if ($num==$wife->getPrimaryName()) { |
|
| 245 | + $class=' class="name2"'; |
|
| 246 | + $sex_image=$wife->getSexImage(); |
|
| 247 | + } else { |
|
| 248 | + $class=''; |
|
| 249 | + $sex_image=''; |
|
| 250 | + } ?> |
|
| 251 | 251 | <a <?= $title.' '.$class ?> href="<?= $wife->getHtmlUrl() ?>"> |
| 252 | 252 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
| 253 | 253 | </a> |
| 254 | 254 | <?= $sex_image.FunctionsPrint::formatSosaNumbers($dwife->getSosaNumbers(), 1, 'smaller') ?> |
| 255 | 255 | <br/> |
| 256 | 256 | <?php } |
| 257 | - echo $wife->getPrimaryParentsNames('parents details1', 'none'); |
|
| 258 | - ?> |
|
| 257 | + echo $wife->getPrimaryParentsNames('parents details1', 'none'); |
|
| 258 | + ?> |
|
| 259 | 259 | </td> |
| 260 | 260 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
| 261 | 261 | <?php $wdate=$wife->getBirthDate(); ?> |
| 262 | 262 | <td class="center" data-sort="<?= Date::getAge($wdate, $mdate, 1) ?>"><?= Date::getAge($wdate, $mdate, 2) ?></td> |
| 263 | 263 | <td data-sort="<?= $mdate->julianDay() ?>"><?php |
| 264 | - if ($marriage_dates = $family->getAllMarriageDates()) { |
|
| 265 | - foreach ($marriage_dates as $n => $marriage_date) { |
|
| 266 | - if ($n) { echo '<br>'; } ?> |
|
| 264 | + if ($marriage_dates = $family->getAllMarriageDates()) { |
|
| 265 | + foreach ($marriage_dates as $n => $marriage_date) { |
|
| 266 | + if ($n) { echo '<br>'; } ?> |
|
| 267 | 267 | <div><?= $marriage_date->display(true) ?></div> |
| 268 | 268 | <?php } |
| 269 | - } elseif ($family->getFacts('_NMR')) { |
|
| 270 | - echo I18N::translate('no'); |
|
| 271 | - } elseif ($family->getFacts('MARR')) { |
|
| 272 | - echo I18N::translate('yes'); |
|
| 273 | - } else { |
|
| 274 | - echo ' '; |
|
| 275 | - } ?> |
|
| 269 | + } elseif ($family->getFacts('_NMR')) { |
|
| 270 | + echo I18N::translate('no'); |
|
| 271 | + } elseif ($family->getFacts('MARR')) { |
|
| 272 | + echo I18N::translate('yes'); |
|
| 273 | + } else { |
|
| 274 | + echo ' '; |
|
| 275 | + } ?> |
|
| 276 | 276 | </td> |
| 277 | 277 | <td><?php |
| 278 | - foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) { |
|
| 279 | - $tmp = new Place($marriage_place, $family->getTree()); |
|
| 280 | - if ($n) { ?><br><?php } ?> |
|
| 278 | + foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) { |
|
| 279 | + $tmp = new Place($marriage_place, $family->getTree()); |
|
| 280 | + if ($n) { ?><br><?php } ?> |
|
| 281 | 281 | <a href="'<?= $tmp->getURL() ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
| 282 | 282 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
| 283 | 283 | </a> |
| 284 | 284 | <?php } ?> |
| 285 | 285 | </td> |
| 286 | 286 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 287 | - $isMSourced = $dfamily->isMarriageSourced(); ?> |
|
| 287 | + $isMSourced = $dfamily->isMarriageSourced(); ?> |
|
| 288 | 288 | <td data-sort=<?= $isMSourced ?>><?= FunctionsPrint::formatIsSourcedIcon('E', $isMSourced, 'MARR', 1, 'medium') ?></td> |
| 289 | 289 | <?php } else { ?> |
| 290 | 290 | <td> </td> |
@@ -295,30 +295,30 @@ discard block |
||
| 295 | 295 | <td hidden><?php |
| 296 | 296 | if (!$mdate->isOK()) { echo 'U'; } |
| 297 | 297 | else { |
| 298 | - if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; } |
|
| 299 | - else { echo 'YES'; } |
|
| 298 | + if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; } |
|
| 299 | + else { echo 'YES'; } |
|
| 300 | 300 | } |
| 301 | 301 | if ($family->getFacts(WT_EVENTS_DIV)) { echo 'D'; } |
| 302 | 302 | if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) { |
| 303 | - echo 'M'; |
|
| 303 | + echo 'M'; |
|
| 304 | 304 | } ?> |
| 305 | 305 | </td> |
| 306 | 306 | <td hidden><?php |
| 307 | - if ($husb->isDead() && $wife->isDead()) { echo 'Y'; } |
|
| 308 | - if ($husb->isDead() && !$wife->isDead()) { |
|
| 309 | - if ($wife->getSex() == 'F') { echo 'H'; } |
|
| 310 | - if ($wife->getSex() == 'M') { echo 'W'; } // male partners |
|
| 311 | - } |
|
| 312 | - if (!$husb->isDead() && $wife->isDead()) { |
|
| 313 | - if ($husb->getSex() == 'M') { echo 'W'; } |
|
| 314 | - if ($husb->getSex() == 'F') { echo 'H'; } // female partners |
|
| 315 | - } |
|
| 316 | - if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?> |
|
| 307 | + if ($husb->isDead() && $wife->isDead()) { echo 'Y'; } |
|
| 308 | + if ($husb->isDead() && !$wife->isDead()) { |
|
| 309 | + if ($wife->getSex() == 'F') { echo 'H'; } |
|
| 310 | + if ($wife->getSex() == 'M') { echo 'W'; } // male partners |
|
| 311 | + } |
|
| 312 | + if (!$husb->isDead() && $wife->isDead()) { |
|
| 313 | + if ($husb->getSex() == 'M') { echo 'W'; } |
|
| 314 | + if ($husb->getSex() == 'F') { echo 'H'; } // female partners |
|
| 315 | + } |
|
| 316 | + if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?> |
|
| 317 | 317 | </td> |
| 318 | 318 | <td hidden><?php |
| 319 | - if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; } |
|
| 320 | - elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; } |
|
| 321 | - else { echo ' '; } ?> |
|
| 319 | + if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; } |
|
| 320 | + elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; } |
|
| 321 | + else { echo ' '; } ?> |
|
| 322 | 322 | </td> |
| 323 | 323 | </tr> |
| 324 | 324 | <?php } ?> |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | <p class="warning"><?= I18N::translate('No family has been found for generation %d', $this->data->get('generation')) ?></p> |
| 357 | 357 | <?php |
| 358 | 358 | } |
| 359 | - } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | \ No newline at end of file |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | protected function renderContent() { |
| 36 | 36 | |
| 37 | - if($this->data->get('has_sosa', false)) { |
|
| 37 | + if ($this->data->get('has_sosa', false)) { |
|
| 38 | 38 | $table_id = $this->data->get('table_id'); |
| 39 | 39 | ?> |
| 40 | 40 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | class="ui-state-default" |
| 53 | 53 | title="<?php echo I18N::translate('Show individuals who are alive or couples where both partners are alive.'); ?>" |
| 54 | 54 | > |
| 55 | - <?php echo I18N::translate('Both alive');?> |
|
| 55 | + <?php echo I18N::translate('Both alive'); ?> |
|
| 56 | 56 | </button> |
| 57 | 57 | <button |
| 58 | 58 | type="button" |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | class="ui-state-default" |
| 62 | 62 | title="<?php echo I18N::translate('Show couples where only the female partner is deceased.'); ?>" |
| 63 | 63 | > |
| 64 | - <?php echo I18N::translate('Widower');?> |
|
| 64 | + <?php echo I18N::translate('Widower'); ?> |
|
| 65 | 65 | </button> |
| 66 | 66 | <button |
| 67 | 67 | type="button" |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | </thead> |
| 176 | 176 | <tbody> |
| 177 | 177 | |
| 178 | - <?php foreach($this->data->get('sosa_list') as $sosa => $family) { |
|
| 178 | + <?php foreach ($this->data->get('sosa_list') as $sosa => $family) { |
|
| 179 | 179 | /** @var \Fisharebest\Webtrees\Family $person */ |
| 180 | 180 | |
| 181 | 181 | //PERSO Create decorator for Family |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
| 194 | 194 | |
| 195 | - $mdate=$family->getMarriageDate(); |
|
| 195 | + $mdate = $family->getMarriageDate(); |
|
| 196 | 196 | |
| 197 | 197 | if ($family->isPendingAddtion()) { |
| 198 | 198 | $class = ' class="new"'; |
@@ -208,17 +208,17 @@ discard block |
||
| 208 | 208 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($husb); ?> |
| 209 | 209 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 210 | 210 | <?php foreach ($husb->getAllNames() as $num=>$name) { |
| 211 | - if ($name['type']=='NAME') { |
|
| 212 | - $title=''; |
|
| 211 | + if ($name['type'] == 'NAME') { |
|
| 212 | + $title = ''; |
|
| 213 | 213 | } else { |
| 214 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"'; |
|
| 214 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"'; |
|
| 215 | 215 | } |
| 216 | - if ($num==$husb->getPrimaryName()) { |
|
| 217 | - $class=' class="name2"'; |
|
| 218 | - $sex_image=$husb->getSexImage(); |
|
| 216 | + if ($num == $husb->getPrimaryName()) { |
|
| 217 | + $class = ' class="name2"'; |
|
| 218 | + $sex_image = $husb->getSexImage(); |
|
| 219 | 219 | } else { |
| 220 | - $class=''; |
|
| 221 | - $sex_image=''; |
|
| 220 | + $class = ''; |
|
| 221 | + $sex_image = ''; |
|
| 222 | 222 | } ?> |
| 223 | 223 | <a <?php echo $title.' '.$class; ?> href="<?php echo $husb->getHtmlUrl(); ?>"> |
| 224 | 224 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
@@ -230,23 +230,23 @@ discard block |
||
| 230 | 230 | ?> |
| 231 | 231 | </td> |
| 232 | 232 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
| 233 | - <?php $hdate=$husb->getBirthDate(); ?> |
|
| 233 | + <?php $hdate = $husb->getBirthDate(); ?> |
|
| 234 | 234 | <td class="center" data-sort="<?= Date::getAge($hdate, $mdate, 1) ?>"><?= Date::getAge($hdate, $mdate, 2) ?></td> |
| 235 | 235 | <!-- WIFE --> |
| 236 | 236 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($wife); ?> |
| 237 | 237 | <td colspan="2"> |
| 238 | 238 | <?php foreach ($wife->getAllNames() as $num=>$name) { |
| 239 | - if ($name['type']=='NAME') { |
|
| 240 | - $title=''; |
|
| 239 | + if ($name['type'] == 'NAME') { |
|
| 240 | + $title = ''; |
|
| 241 | 241 | } else { |
| 242 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"'; |
|
| 242 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"'; |
|
| 243 | 243 | } |
| 244 | - if ($num==$wife->getPrimaryName()) { |
|
| 245 | - $class=' class="name2"'; |
|
| 246 | - $sex_image=$wife->getSexImage(); |
|
| 244 | + if ($num == $wife->getPrimaryName()) { |
|
| 245 | + $class = ' class="name2"'; |
|
| 246 | + $sex_image = $wife->getSexImage(); |
|
| 247 | 247 | } else { |
| 248 | - $class=''; |
|
| 249 | - $sex_image=''; |
|
| 248 | + $class = ''; |
|
| 249 | + $sex_image = ''; |
|
| 250 | 250 | } ?> |
| 251 | 251 | <a <?= $title.' '.$class ?> href="<?= $wife->getHtmlUrl() ?>"> |
| 252 | 252 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | ?> |
| 259 | 259 | </td> |
| 260 | 260 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
| 261 | - <?php $wdate=$wife->getBirthDate(); ?> |
|
| 261 | + <?php $wdate = $wife->getBirthDate(); ?> |
|
| 262 | 262 | <td class="center" data-sort="<?= Date::getAge($wdate, $mdate, 1) ?>"><?= Date::getAge($wdate, $mdate, 2) ?></td> |
| 263 | 263 | <td data-sort="<?= $mdate->julianDay() ?>"><?php |
| 264 | 264 | if ($marriage_dates = $family->getAllMarriageDates()) { |
@@ -293,10 +293,8 @@ discard block |
||
| 293 | 293 | <?= I18N::number($family->getNumberOfChildren()) ?> |
| 294 | 294 | </td> |
| 295 | 295 | <td hidden><?php |
| 296 | - if (!$mdate->isOK()) { echo 'U'; } |
|
| 297 | - else { |
|
| 298 | - if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; } |
|
| 299 | - else { echo 'YES'; } |
|
| 296 | + if (!$mdate->isOK()) { echo 'U'; } else { |
|
| 297 | + if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; } else { echo 'YES'; } |
|
| 300 | 298 | } |
| 301 | 299 | if ($family->getFacts(WT_EVENTS_DIV)) { echo 'D'; } |
| 302 | 300 | if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) { |
@@ -316,9 +314,7 @@ discard block |
||
| 316 | 314 | if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?> |
| 317 | 315 | </td> |
| 318 | 316 | <td hidden><?php |
| 319 | - if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; } |
|
| 320 | - elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; } |
|
| 321 | - else { echo ' '; } ?> |
|
| 317 | + if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; } elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; } else { echo ' '; } ?> |
|
| 322 | 318 | </td> |
| 323 | 319 | </tr> |
| 324 | 320 | <?php } ?> |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | * {@inhericDoc} |
| 32 | 32 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 33 | 33 | */ |
| 34 | - protected function renderContent() { |
|
| 34 | + protected function renderContent() { |
|
| 35 | 35 | |
| 36 | - if($this->data->get('has_sosa', false)) { |
|
| 37 | - $table_id = $this->data->get('table_id'); |
|
| 38 | - ?> |
|
| 36 | + if($this->data->get('has_sosa', false)) { |
|
| 37 | + $table_id = $this->data->get('table_id'); |
|
| 38 | + ?> |
|
| 39 | 39 | |
| 40 | 40 | <div id="sosa-indi-list" class="sosa-list"> |
| 41 | 41 | <table id="<?= $table_id ?>"> |
@@ -177,62 +177,62 @@ discard block |
||
| 177 | 177 | <tbody> |
| 178 | 178 | |
| 179 | 179 | <?php foreach($this->data->get('sosa_list') as $sosa => $person) { |
| 180 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 181 | - if ($person->isPendingAddtion()) { |
|
| 182 | - $class = ' class="new"'; |
|
| 183 | - } elseif ($person->isPendingDeletion()) { |
|
| 184 | - $class = ' class="old"'; |
|
| 185 | - } else { |
|
| 186 | - $class = ''; |
|
| 187 | - } |
|
| 188 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 189 | - ?> |
|
| 180 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 181 | + if ($person->isPendingAddtion()) { |
|
| 182 | + $class = ' class="new"'; |
|
| 183 | + } elseif ($person->isPendingDeletion()) { |
|
| 184 | + $class = ' class="old"'; |
|
| 185 | + } else { |
|
| 186 | + $class = ''; |
|
| 187 | + } |
|
| 188 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 189 | + ?> |
|
| 190 | 190 | <tr <?= $class ?>> |
| 191 | 191 | <td class="transparent"><?= $sosa ?></td> |
| 192 | 192 | <td hidden><?= $person->getXref() ?></td> |
| 193 | 193 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); ?> |
| 194 | 194 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 195 | 195 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 196 | - if ($name['type']=='NAME') { |
|
| 197 | - $title=''; |
|
| 198 | - } else { |
|
| 199 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 200 | - } |
|
| 201 | - if ($num==$person->getPrimaryName()) { |
|
| 202 | - $class=' class="name2"'; |
|
| 203 | - $sex_image=$person->getSexImage(); |
|
| 204 | - } else { |
|
| 205 | - $class=''; |
|
| 206 | - $sex_image=''; |
|
| 207 | - } ?> |
|
| 196 | + if ($name['type']=='NAME') { |
|
| 197 | + $title=''; |
|
| 198 | + } else { |
|
| 199 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 200 | + } |
|
| 201 | + if ($num==$person->getPrimaryName()) { |
|
| 202 | + $class=' class="name2"'; |
|
| 203 | + $sex_image=$person->getSexImage(); |
|
| 204 | + } else { |
|
| 205 | + $class=''; |
|
| 206 | + $sex_image=''; |
|
| 207 | + } ?> |
|
| 208 | 208 | <a <?= $title.' '.$class; ?> href="<?= $person->getHtmlUrl() ?>"> |
| 209 | 209 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
| 210 | 210 | </a> |
| 211 | 211 | <?= $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller') ?> |
| 212 | 212 | <br/> |
| 213 | 213 | <?php } |
| 214 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 215 | - ?> |
|
| 214 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 215 | + ?> |
|
| 216 | 216 | </td> |
| 217 | 217 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
| 218 | 218 | <?php $birth_dates = $person->getAllBirthDates(); ?> |
| 219 | 219 | <td data-sort="<?= $person->getEstimatedBirthDate()->julianDay() ?>"> |
| 220 | 220 | <?php foreach ($birth_dates as $n => $birth_date) { |
| 221 | - if ($n > 0) { ?><br/><?php } ?> |
|
| 221 | + if ($n > 0) { ?><br/><?php } ?> |
|
| 222 | 222 | <?php echo $birth_date->display(true); |
| 223 | - } ?> |
|
| 223 | + } ?> |
|
| 224 | 224 | </td> |
| 225 | 225 | <td> |
| 226 | 226 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
| 227 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 228 | - if ($n > 0) { ?><br><?php } ?> |
|
| 227 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 228 | + if ($n > 0) { ?><br><?php } ?> |
|
| 229 | 229 | <a href="'<?= $tmp->getURL() ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
| 230 | 230 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
| 231 | 231 | </a> |
| 232 | 232 | <?php } ?> |
| 233 | 233 | </td> |
| 234 | 234 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 235 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 235 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 236 | 236 | <td data-sort="<?= $isBSourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium') ?></td> |
| 237 | 237 | <?php } else { ?> |
| 238 | 238 | <td> </td> |
@@ -240,63 +240,63 @@ discard block |
||
| 240 | 240 | <?php $death_dates = $person->getAllDeathDates(); ?> |
| 241 | 241 | <td data-sort="<?= $person->getEstimatedDeathDate()->julianDay() ?>"> |
| 242 | 242 | <?php foreach ($death_dates as $num => $death_date) { |
| 243 | - if ($num) { ?><br/><?php } ?> |
|
| 243 | + if ($num) { ?><br/><?php } ?> |
|
| 244 | 244 | <?php echo $death_date->display(true); |
| 245 | - } ?> |
|
| 245 | + } ?> |
|
| 246 | 246 | </td> |
| 247 | 247 | <?php if (isset($birth_dates[0]) && isset($death_dates[0])) { |
| 248 | - $age_at_death = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 249 | - $age_at_death_sort = Date::getAge($birth_dates[0], $death_dates[0], 2); |
|
| 250 | - } else { |
|
| 251 | - $age_at_death = ''; |
|
| 252 | - $age_at_death_sort = PHP_INT_MAX; |
|
| 253 | - } ?> |
|
| 248 | + $age_at_death = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 249 | + $age_at_death_sort = Date::getAge($birth_dates[0], $death_dates[0], 2); |
|
| 250 | + } else { |
|
| 251 | + $age_at_death = ''; |
|
| 252 | + $age_at_death_sort = PHP_INT_MAX; |
|
| 253 | + } ?> |
|
| 254 | 254 | <td class="center" data-sort="<?= $age_at_death_sort ?>"><?= $age_at_death ?></td> |
| 255 | 255 | <td> |
| 256 | 256 | <?php foreach ($person->getAllDeathPlaces() as $n => $death_place) { |
| 257 | - $tmp = new Place($death_place, $person->getTree()); |
|
| 258 | - if ($n) { ?><br><?php } ?> |
|
| 257 | + $tmp = new Place($death_place, $person->getTree()); |
|
| 258 | + if ($n) { ?><br><?php } ?> |
|
| 259 | 259 | <a href="'<?= $tmp->getURL() ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
| 260 | 260 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
| 261 | 261 | </a> |
| 262 | 262 | <?php } ?> |
| 263 | 263 | </td> |
| 264 | 264 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 265 | - if($person->isDead()) { |
|
| 266 | - $isDSourced = $dperson->isDeathSourced(); ?> |
|
| 265 | + if($person->isDead()) { |
|
| 266 | + $isDSourced = $dperson->isDeathSourced(); ?> |
|
| 267 | 267 | <td data-sort=<?= $isDSourced ?>><?= FunctionsPrint::formatIsSourcedIcon('E', $isDSourced, 'DEAT', 1, 'medium') ?></td> |
| 268 | 268 | <?php } else { ?> |
| 269 | 269 | <td data-sort="-99"> </td> |
| 270 | 270 | <?php } |
| 271 | - } else { ?> |
|
| 271 | + } else { ?> |
|
| 272 | 272 | <td> </td> |
| 273 | 273 | <?php } ?> |
| 274 | 274 | <td hidden><?= $person->getSex() ?></td> |
| 275 | 275 | <td hidden> |
| 276 | 276 | <?php if (!$person->canShow() || Date::compare($person->getEstimatedBirthDate(), new Date(date('Y') - 100)) > 0) { |
| 277 | - echo 'Y100'; |
|
| 278 | - } else { |
|
| 279 | - echo 'YES'; |
|
| 280 | - } ?> |
|
| 277 | + echo 'Y100'; |
|
| 278 | + } else { |
|
| 279 | + echo 'YES'; |
|
| 280 | + } ?> |
|
| 281 | 281 | </td> |
| 282 | 282 | <td hidden> |
| 283 | 283 | <?php if (isset($death_dates[0]) && Date::compare($death_dates[0], new Date(date('Y') - 100)) > 0) { |
| 284 | - echo 'Y100'; |
|
| 285 | - } elseif ($person->isDead()) { |
|
| 286 | - echo 'YES'; |
|
| 287 | - } else { |
|
| 288 | - echo 'N'; |
|
| 289 | - } ?> |
|
| 284 | + echo 'Y100'; |
|
| 285 | + } elseif ($person->isDead()) { |
|
| 286 | + echo 'YES'; |
|
| 287 | + } else { |
|
| 288 | + echo 'N'; |
|
| 289 | + } ?> |
|
| 290 | 290 | </td> |
| 291 | 291 | <td hidden> |
| 292 | 292 | <?php if (!$person->getChildFamilies()) { |
| 293 | - echo 'R'; |
|
| 293 | + echo 'R'; |
|
| 294 | 294 | } // roots |
| 295 | 295 | elseif (!$person->isDead() && $person->getNumberOfChildren() < 1) { |
| 296 | - echo 'L'; |
|
| 296 | + echo 'L'; |
|
| 297 | 297 | } // leaves |
| 298 | 298 | else { |
| 299 | - echo ' '; |
|
| 299 | + echo ' '; |
|
| 300 | 300 | } ?> |
| 301 | 301 | </td> |
| 302 | 302 | </tr> |
@@ -307,12 +307,12 @@ discard block |
||
| 307 | 307 | <th class="ui-state-default" colspan="15"> |
| 308 | 308 | <div class="center"> |
| 309 | 309 | <?= I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)', |
| 310 | - I18N::number($this->data->get('sosa_count')), |
|
| 311 | - I18N::number($this->data->get('sosa_theo')), |
|
| 312 | - I18N::percentage($this->data->get('sosa_ratio'),2) |
|
| 313 | - ) ?> |
|
| 310 | + I18N::number($this->data->get('sosa_count')), |
|
| 311 | + I18N::number($this->data->get('sosa_theo')), |
|
| 312 | + I18N::percentage($this->data->get('sosa_ratio'),2) |
|
| 313 | + ) ?> |
|
| 314 | 314 | <?php if($this->data->get('sosa_hidden') > 0) { |
| 315 | - echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 315 | + echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 316 | 316 | } ?> |
| 317 | 317 | </div> |
| 318 | 318 | </th> |
@@ -346,8 +346,8 @@ discard block |
||
| 346 | 346 | </div> |
| 347 | 347 | </div> |
| 348 | 348 | <?php |
| 349 | - } |
|
| 350 | - } |
|
| 349 | + } |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected function renderContent() { |
| 35 | 35 | |
| 36 | - if($this->data->get('has_sosa', false)) { |
|
| 36 | + if ($this->data->get('has_sosa', false)) { |
|
| 37 | 37 | $table_id = $this->data->get('table_id'); |
| 38 | 38 | ?> |
| 39 | 39 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | </thead> |
| 177 | 177 | <tbody> |
| 178 | 178 | |
| 179 | - <?php foreach($this->data->get('sosa_list') as $sosa => $person) { |
|
| 179 | + <?php foreach ($this->data->get('sosa_list') as $sosa => $person) { |
|
| 180 | 180 | /** @var \Fisharebest\Webtrees\Individual $person */ |
| 181 | 181 | if ($person->isPendingAddtion()) { |
| 182 | 182 | $class = ' class="new"'; |
@@ -193,17 +193,17 @@ discard block |
||
| 193 | 193 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); ?> |
| 194 | 194 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 195 | 195 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 196 | - if ($name['type']=='NAME') { |
|
| 197 | - $title=''; |
|
| 196 | + if ($name['type'] == 'NAME') { |
|
| 197 | + $title = ''; |
|
| 198 | 198 | } else { |
| 199 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 199 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 200 | 200 | } |
| 201 | - if ($num==$person->getPrimaryName()) { |
|
| 202 | - $class=' class="name2"'; |
|
| 203 | - $sex_image=$person->getSexImage(); |
|
| 201 | + if ($num == $person->getPrimaryName()) { |
|
| 202 | + $class = ' class="name2"'; |
|
| 203 | + $sex_image = $person->getSexImage(); |
|
| 204 | 204 | } else { |
| 205 | - $class=''; |
|
| 206 | - $sex_image=''; |
|
| 205 | + $class = ''; |
|
| 206 | + $sex_image = ''; |
|
| 207 | 207 | } ?> |
| 208 | 208 | <a <?= $title.' '.$class; ?> href="<?= $person->getHtmlUrl() ?>"> |
| 209 | 209 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | <?php } ?> |
| 263 | 263 | </td> |
| 264 | 264 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 265 | - if($person->isDead()) { |
|
| 265 | + if ($person->isDead()) { |
|
| 266 | 266 | $isDSourced = $dperson->isDeathSourced(); ?> |
| 267 | 267 | <td data-sort=<?= $isDSourced ?>><?= FunctionsPrint::formatIsSourcedIcon('E', $isDSourced, 'DEAT', 1, 'medium') ?></td> |
| 268 | 268 | <?php } else { ?> |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | <?= I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)', |
| 310 | 310 | I18N::number($this->data->get('sosa_count')), |
| 311 | 311 | I18N::number($this->data->get('sosa_theo')), |
| 312 | - I18N::percentage($this->data->get('sosa_ratio'),2) |
|
| 312 | + I18N::percentage($this->data->get('sosa_ratio'), 2) |
|
| 313 | 313 | ) ?> |
| 314 | - <?php if($this->data->get('sosa_hidden') > 0) { |
|
| 315 | - echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 314 | + <?php if ($this->data->get('sosa_hidden') > 0) { |
|
| 315 | + echo '['.I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 316 | 316 | } ?> |
| 317 | 317 | </div> |
| 318 | 318 | </th> |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | <button type="button" class="ui-state-default btn-toggle-parents"> |
| 325 | 325 | <?= I18N::translate('Show parents') ?> |
| 326 | 326 | </button> |
| 327 | - <button id="btn-toggle-statistics-<?php echo $table_id ;?>" type="button" class="ui-state-default btn-toggle-statistics"> |
|
| 327 | + <button id="btn-toggle-statistics-<?php echo $table_id; ?>" type="button" class="ui-state-default btn-toggle-statistics"> |
|
| 328 | 328 | <?= I18N::translate('Show statistics charts') ?> |
| 329 | 329 | </button> |
| 330 | 330 | </div> |
@@ -45,6 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $element_name Element name from the edit interface, used to POST values for update |
| 46 | 46 | * @param string $context Tag context |
| 47 | 47 | * @param string $contextid Id of tag context |
| 48 | + * @return string |
|
| 48 | 49 | */ |
| 49 | 50 | public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null); |
| 50 | 51 | |
@@ -53,6 +54,7 @@ discard block |
||
| 53 | 54 | * |
| 54 | 55 | * @param string $context Context of the edition |
| 55 | 56 | * @param int $level Level to which add the tags |
| 57 | + * @return void |
|
| 56 | 58 | */ |
| 57 | 59 | public function hAddSimpleTag($context, $level); |
| 58 | 60 | |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | interface CustomSimpleTagManagerInterface { |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Returns the list of expected tags, classified by type of records. |
|
| 23 | - * |
|
| 24 | - * @return array List of expected tags |
|
| 25 | - */ |
|
| 26 | - public function hGetExpectedTags(); |
|
| 21 | + /** |
|
| 22 | + * Returns the list of expected tags, classified by type of records. |
|
| 23 | + * |
|
| 24 | + * @return array List of expected tags |
|
| 25 | + */ |
|
| 26 | + public function hGetExpectedTags(); |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Return the HTML code to be display for this tag. |