@@ -36,58 +36,58 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | class AdminConfigController extends MvcController |
| 38 | 38 | { |
| 39 | - /** |
|
| 40 | - * GeoAnalysis Provider |
|
| 41 | - * @var GeoAnalysisProvider $provider |
|
| 42 | - */ |
|
| 43 | - protected $provider; |
|
| 39 | + /** |
|
| 40 | + * GeoAnalysis Provider |
|
| 41 | + * @var GeoAnalysisProvider $provider |
|
| 42 | + */ |
|
| 43 | + protected $provider; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Constructor for Admin Config controller |
|
| 47 | - * @param AbstractModule $module |
|
| 48 | - */ |
|
| 49 | - public function __construct(AbstractModule $module) { |
|
| 50 | - parent::__construct($module); |
|
| 45 | + /** |
|
| 46 | + * Constructor for Admin Config controller |
|
| 47 | + * @param AbstractModule $module |
|
| 48 | + */ |
|
| 49 | + public function __construct(AbstractModule $module) { |
|
| 50 | + parent::__construct($module); |
|
| 51 | 51 | |
| 52 | - $this->provider = $this->module->getProvider(); |
|
| 53 | - } |
|
| 52 | + $this->provider = $this->module->getProvider(); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Pages |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * Pages |
|
| 57 | + */ |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * AdminConfig@index |
|
| 61 | - */ |
|
| 62 | - public function index() { |
|
| 63 | - $wt_tree = Globals::getTree(); |
|
| 64 | - Theme::theme(new AdministrationTheme)->init($wt_tree); |
|
| 65 | - $controller = new PageController(); |
|
| 66 | - $controller |
|
| 67 | - ->restrictAccess(Auth::isManager($wt_tree)) |
|
| 68 | - ->setPageTitle($this->module->getTitle()); |
|
| 59 | + /** |
|
| 60 | + * AdminConfig@index |
|
| 61 | + */ |
|
| 62 | + public function index() { |
|
| 63 | + $wt_tree = Globals::getTree(); |
|
| 64 | + Theme::theme(new AdministrationTheme)->init($wt_tree); |
|
| 65 | + $controller = new PageController(); |
|
| 66 | + $controller |
|
| 67 | + ->restrictAccess(Auth::isManager($wt_tree)) |
|
| 68 | + ->setPageTitle($this->module->getTitle()); |
|
| 69 | 69 | |
| 70 | - $data = new ViewBag(); |
|
| 71 | - $data->set('title', $controller->getPageTitle()); |
|
| 72 | - $data->set('tree', $wt_tree); |
|
| 70 | + $data = new ViewBag(); |
|
| 71 | + $data->set('title', $controller->getPageTitle()); |
|
| 72 | + $data->set('tree', $wt_tree); |
|
| 73 | 73 | |
| 74 | - $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); |
|
| 74 | + $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); |
|
| 75 | 75 | |
| 76 | - $table_id = 'table-geoanalysis-' . Uuid::uuid4(); |
|
| 77 | - $data->set('table_id', $table_id); |
|
| 76 | + $table_id = 'table-geoanalysis-' . Uuid::uuid4(); |
|
| 77 | + $data->set('table_id', $table_id); |
|
| 78 | 78 | |
| 79 | - $other_trees = array(); |
|
| 80 | - foreach (Tree::getAll() as $tree) { |
|
| 81 | - if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree; |
|
| 82 | - } |
|
| 83 | - $data->set('other_trees', $other_trees); |
|
| 79 | + $other_trees = array(); |
|
| 80 | + foreach (Tree::getAll() as $tree) { |
|
| 81 | + if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree; |
|
| 82 | + } |
|
| 83 | + $data->set('other_trees', $other_trees); |
|
| 84 | 84 | |
| 85 | - $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 85 | + $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 86 | 86 | |
| 87 | - $controller |
|
| 88 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 89 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 90 | - ->addInlineJavascript(' |
|
| 87 | + $controller |
|
| 88 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 89 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 90 | + ->addInlineJavascript(' |
|
| 91 | 91 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 92 | 92 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 93 | 93 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | ') |
| 122 | - ->addInlineJavascript(' |
|
| 122 | + ->addInlineJavascript(' |
|
| 123 | 123 | function set_geoanalysis_status(ga_id, status, gedcom) { |
| 124 | 124 | jQuery.ajax({ |
| 125 | 125 | url: "module.php", |
@@ -163,54 +163,54 @@ discard block |
||
| 163 | 163 | '); |
| 164 | 164 | |
| 165 | 165 | |
| 166 | - ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 167 | - } |
|
| 166 | + ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * AdminConfig@jsonGeoAnalysisList |
|
| 171 | - */ |
|
| 172 | - public function jsonGeoAnalysisList() { |
|
| 173 | - $wt_tree = Globals::getTree(); |
|
| 174 | - $controller = new JsonController(); |
|
| 175 | - $controller |
|
| 176 | - ->restrictAccess(Auth::isManager($wt_tree)); |
|
| 169 | + /** |
|
| 170 | + * AdminConfig@jsonGeoAnalysisList |
|
| 171 | + */ |
|
| 172 | + public function jsonGeoAnalysisList() { |
|
| 173 | + $wt_tree = Globals::getTree(); |
|
| 174 | + $controller = new JsonController(); |
|
| 175 | + $controller |
|
| 176 | + ->restrictAccess(Auth::isManager($wt_tree)); |
|
| 177 | 177 | |
| 178 | - // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 179 | - $search = Filter::postArray('search'); |
|
| 180 | - if($search) $search = $search['value']; |
|
| 181 | - $start = Filter::postInteger('start'); |
|
| 182 | - $length = Filter::postInteger('length'); |
|
| 183 | - $order = Filter::postArray('order'); |
|
| 178 | + // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 179 | + $search = Filter::postArray('search'); |
|
| 180 | + if($search) $search = $search['value']; |
|
| 181 | + $start = Filter::postInteger('start'); |
|
| 182 | + $length = Filter::postInteger('length'); |
|
| 183 | + $order = Filter::postArray('order'); |
|
| 184 | 184 | |
| 185 | - foreach($order as $key => &$value) { |
|
| 186 | - switch($value['column']) { |
|
| 187 | - case 3: |
|
| 188 | - $value['column'] = 'majgd_descr'; |
|
| 189 | - break; |
|
| 190 | - case 5; |
|
| 191 | - $value['column'] = 'majgd_sublevel'; |
|
| 192 | - break; |
|
| 193 | - default: |
|
| 194 | - unset($order[$key]); |
|
| 195 | - } |
|
| 196 | - } |
|
| 185 | + foreach($order as $key => &$value) { |
|
| 186 | + switch($value['column']) { |
|
| 187 | + case 3: |
|
| 188 | + $value['column'] = 'majgd_descr'; |
|
| 189 | + break; |
|
| 190 | + case 5; |
|
| 191 | + $value['column'] = 'majgd_sublevel'; |
|
| 192 | + break; |
|
| 193 | + default: |
|
| 194 | + unset($order[$key]); |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - /** @var GeoAnalysisProvider $provider */ |
|
| 199 | - $provider = $this->module->getProvider(); |
|
| 198 | + /** @var GeoAnalysisProvider $provider */ |
|
| 199 | + $provider = $this->module->getProvider(); |
|
| 200 | 200 | |
| 201 | - $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
| 202 | - $recordsFiltered = count($list); |
|
| 203 | - $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
| 201 | + $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
| 202 | + $recordsFiltered = count($list); |
|
| 203 | + $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
| 204 | 204 | |
| 205 | - $data = array(); |
|
| 206 | - $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
| 207 | - foreach($list as $ga) { |
|
| 208 | - /** @var GeoAnalysis $ga */ |
|
| 205 | + $data = array(); |
|
| 206 | + $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
| 207 | + foreach($list as $ga) { |
|
| 208 | + /** @var GeoAnalysis $ga */ |
|
| 209 | 209 | |
| 210 | - $datum = array(); |
|
| 211 | - $options= $ga->getOptions(); |
|
| 210 | + $datum = array(); |
|
| 211 | + $options= $ga->getOptions(); |
|
| 212 | 212 | |
| 213 | - $datum[0] = ' |
|
| 213 | + $datum[0] = ' |
|
| 214 | 214 | <div class="btn-group"> |
| 215 | 215 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
| 216 | 216 | <i class="fa fa-pencil"></i><span class="caret"></span> |
@@ -234,116 +234,116 @@ discard block |
||
| 234 | 234 | </li> |
| 235 | 235 | </ul> |
| 236 | 236 | </div>'; |
| 237 | - $datum[1] = $ga->getId(); |
|
| 238 | - $datum[2] = $ga->isEnabled() ? |
|
| 237 | + $datum[1] = $ga->getId(); |
|
| 238 | + $datum[2] = $ga->isEnabled() ? |
|
| 239 | 239 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
| 240 | 240 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
| 241 | - $datum[3] = $ga->getTitle(); |
|
| 242 | - $analysis_level = $ga->getAnalysisLevel(); |
|
| 243 | - if($place_hierarchy['type'] == 'header') { |
|
| 244 | - $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
| 245 | - } elseif ($place_hierarchy['type'] == 'data') { |
|
| 246 | - $datum[4] = $analysis_level . ' (' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
| 247 | - } else { |
|
| 248 | - $datum[4] = $analysis_level; |
|
| 249 | - } |
|
| 250 | - $datum[5] = $ga->getAnalysisLevel(); |
|
| 251 | - $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 252 | - $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 253 | - if($ga->hasMap()) { |
|
| 254 | - if($options->getMap()->isLoaded()) { |
|
| 255 | - $datum[6] = $options->getMap()->getDescription(); |
|
| 256 | - $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
| 257 | - $top_level = $options->getMapLevel(); |
|
| 258 | - if($place_hierarchy['type'] == 'header') { |
|
| 259 | - $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
| 260 | - } elseif ($place_hierarchy['type'] == 'data') { |
|
| 261 | - $datum[7] .= $top_level . ' (' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
| 262 | - } else { |
|
| 263 | - $datum[7] .= $top_level; |
|
| 264 | - } |
|
| 265 | - $datum[7] .= '</span>'; |
|
| 266 | - } |
|
| 267 | - else { |
|
| 268 | - $datum[6] = I18N::translate('Error when loading map.'); |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - $datum[8] = $options->isUsingFlags() ? |
|
| 241 | + $datum[3] = $ga->getTitle(); |
|
| 242 | + $analysis_level = $ga->getAnalysisLevel(); |
|
| 243 | + if($place_hierarchy['type'] == 'header') { |
|
| 244 | + $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
| 245 | + } elseif ($place_hierarchy['type'] == 'data') { |
|
| 246 | + $datum[4] = $analysis_level . ' (' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
| 247 | + } else { |
|
| 248 | + $datum[4] = $analysis_level; |
|
| 249 | + } |
|
| 250 | + $datum[5] = $ga->getAnalysisLevel(); |
|
| 251 | + $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 252 | + $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 253 | + if($ga->hasMap()) { |
|
| 254 | + if($options->getMap()->isLoaded()) { |
|
| 255 | + $datum[6] = $options->getMap()->getDescription(); |
|
| 256 | + $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
| 257 | + $top_level = $options->getMapLevel(); |
|
| 258 | + if($place_hierarchy['type'] == 'header') { |
|
| 259 | + $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
| 260 | + } elseif ($place_hierarchy['type'] == 'data') { |
|
| 261 | + $datum[7] .= $top_level . ' (' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
| 262 | + } else { |
|
| 263 | + $datum[7] .= $top_level; |
|
| 264 | + } |
|
| 265 | + $datum[7] .= '</span>'; |
|
| 266 | + } |
|
| 267 | + else { |
|
| 268 | + $datum[6] = I18N::translate('Error when loading map.'); |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + $datum[8] = $options->isUsingFlags() ? |
|
| 272 | 272 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
| 273 | 273 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
| 274 | - $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
| 274 | + $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
| 275 | 275 | |
| 276 | - $data[] = $datum; |
|
| 277 | - } |
|
| 276 | + $data[] = $datum; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - $controller->pageHeader(); |
|
| 279 | + $controller->pageHeader(); |
|
| 280 | 280 | |
| 281 | - $controller->encode(array( |
|
| 282 | - 'draw' => Filter::getInteger('draw'), |
|
| 283 | - 'recordsTotal' => $recordsTotal, |
|
| 284 | - 'recordsFiltered' => $recordsFiltered, |
|
| 285 | - 'data' => $data |
|
| 286 | - )); |
|
| 281 | + $controller->encode(array( |
|
| 282 | + 'draw' => Filter::getInteger('draw'), |
|
| 283 | + 'recordsTotal' => $recordsTotal, |
|
| 284 | + 'recordsFiltered' => $recordsFiltered, |
|
| 285 | + 'data' => $data |
|
| 286 | + )); |
|
| 287 | 287 | |
| 288 | - } |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - /** |
|
| 291 | - * AdminConfig@edit |
|
| 292 | - */ |
|
| 293 | - public function edit() { |
|
| 294 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 295 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 290 | + /** |
|
| 291 | + * AdminConfig@edit |
|
| 292 | + */ |
|
| 293 | + public function edit() { |
|
| 294 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 295 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 296 | 296 | |
| 297 | - $this->renderEdit($ga); |
|
| 298 | - } |
|
| 297 | + $this->renderEdit($ga); |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | - /** |
|
| 301 | - * AdminConfig@add |
|
| 302 | - */ |
|
| 303 | - public function add() { |
|
| 304 | - $this->renderEdit(null); |
|
| 305 | - } |
|
| 300 | + /** |
|
| 301 | + * AdminConfig@add |
|
| 302 | + */ |
|
| 303 | + public function add() { |
|
| 304 | + $this->renderEdit(null); |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - /** |
|
| 308 | - * AdminConfig@save |
|
| 309 | - */ |
|
| 310 | - public function save() { |
|
| 311 | - $wt_tree = Globals::getTree(); |
|
| 312 | - $tmp_contrl = new PageController(); |
|
| 313 | - $tmp_contrl->restrictAccess( |
|
| 314 | - Auth::isManager($wt_tree) |
|
| 315 | - && Filter::checkCsrf() |
|
| 316 | - ); |
|
| 307 | + /** |
|
| 308 | + * AdminConfig@save |
|
| 309 | + */ |
|
| 310 | + public function save() { |
|
| 311 | + $wt_tree = Globals::getTree(); |
|
| 312 | + $tmp_contrl = new PageController(); |
|
| 313 | + $tmp_contrl->restrictAccess( |
|
| 314 | + Auth::isManager($wt_tree) |
|
| 315 | + && Filter::checkCsrf() |
|
| 316 | + ); |
|
| 317 | 317 | |
| 318 | - $ga_id = Filter::postInteger('ga_id'); |
|
| 319 | - $description = Filter::post('description'); |
|
| 320 | - $analysislevel = Filter::postInteger('analysislevel'); |
|
| 321 | - $use_map = Filter::postBool('use_map'); |
|
| 322 | - if($use_map) { |
|
| 323 | - $map_file = base64_decode(Filter::post('map_file')); |
|
| 324 | - $map_top_level = Filter::postInteger('map_top_level'); |
|
| 325 | - } |
|
| 326 | - $use_flags = Filter::postBool('use_flags'); |
|
| 327 | - $gen_details = Filter::postInteger('gen_details'); |
|
| 318 | + $ga_id = Filter::postInteger('ga_id'); |
|
| 319 | + $description = Filter::post('description'); |
|
| 320 | + $analysislevel = Filter::postInteger('analysislevel'); |
|
| 321 | + $use_map = Filter::postBool('use_map'); |
|
| 322 | + if($use_map) { |
|
| 323 | + $map_file = base64_decode(Filter::post('map_file')); |
|
| 324 | + $map_top_level = Filter::postInteger('map_top_level'); |
|
| 325 | + } |
|
| 326 | + $use_flags = Filter::postBool('use_flags'); |
|
| 327 | + $gen_details = Filter::postInteger('gen_details'); |
|
| 328 | 328 | |
| 329 | - $success = false; |
|
| 330 | - if($ga_id) { |
|
| 331 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 332 | - if($ga) { |
|
| 333 | - $ga->setTitle($description); |
|
| 334 | - $ga->setAnalysisLevel($analysislevel + 1); |
|
| 335 | - $options = $ga->getOptions(); |
|
| 336 | - if($options) { |
|
| 337 | - $options->setUsingFlags($use_flags); |
|
| 338 | - $options->setMaxDetailsInGen($gen_details); |
|
| 339 | - if($use_map) { |
|
| 340 | - $options->setMap(new OutlineMap($map_file)); |
|
| 341 | - $options->setMapLevel($map_top_level + 1); |
|
| 342 | - } |
|
| 343 | - else { |
|
| 344 | - $options->setMap(null); |
|
| 345 | - } |
|
| 346 | - } |
|
| 329 | + $success = false; |
|
| 330 | + if($ga_id) { |
|
| 331 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 332 | + if($ga) { |
|
| 333 | + $ga->setTitle($description); |
|
| 334 | + $ga->setAnalysisLevel($analysislevel + 1); |
|
| 335 | + $options = $ga->getOptions(); |
|
| 336 | + if($options) { |
|
| 337 | + $options->setUsingFlags($use_flags); |
|
| 338 | + $options->setMaxDetailsInGen($gen_details); |
|
| 339 | + if($use_map) { |
|
| 340 | + $options->setMap(new OutlineMap($map_file)); |
|
| 341 | + $options->setMapLevel($map_top_level + 1); |
|
| 342 | + } |
|
| 343 | + else { |
|
| 344 | + $options->setMap(null); |
|
| 345 | + } |
|
| 346 | + } |
|
| 347 | 347 | |
| 348 | 348 | $res = $this->provider->updateGeoAnalysis($ga); |
| 349 | 349 | if($res) { |
@@ -356,8 +356,8 @@ discard block |
||
| 356 | 356 | FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger'); |
| 357 | 357 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.'); |
| 358 | 358 | } |
| 359 | - } |
|
| 360 | - } else { |
|
| 359 | + } |
|
| 360 | + } else { |
|
| 361 | 361 | $ga = $this->provider->createGeoAnalysis( |
| 362 | 362 | $description, |
| 363 | 363 | $analysislevel + 1, |
@@ -375,33 +375,33 @@ discard block |
||
| 375 | 375 | FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger'); |
| 376 | 376 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.'); |
| 377 | 377 | } |
| 378 | - } |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl(); |
|
| 381 | - if(!$success) { |
|
| 382 | - if($ga) { |
|
| 383 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl(); |
|
| 384 | - } |
|
| 385 | - else { |
|
| 386 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl(); |
|
| 387 | - } |
|
| 388 | - } |
|
| 389 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 380 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl(); |
|
| 381 | + if(!$success) { |
|
| 382 | + if($ga) { |
|
| 383 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl(); |
|
| 384 | + } |
|
| 385 | + else { |
|
| 386 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl(); |
|
| 387 | + } |
|
| 388 | + } |
|
| 389 | + header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 390 | 390 | |
| 391 | - } |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | 394 | * Renders the edit form, whether it is an edition of an existing GeoAnalysis, or the addition of a new one. |
| 395 | 395 | * |
| 396 | 396 | * @param (GeoAnalysis!null) $ga GeoAnalysis to edit |
| 397 | 397 | */ |
| 398 | - protected function renderEdit(GeoAnalysis $ga = null) { |
|
| 399 | - $wt_tree = Globals::getTree(); |
|
| 400 | - Theme::theme(new AdministrationTheme)->init($wt_tree); |
|
| 401 | - $controller = new PageController(); |
|
| 402 | - $controller |
|
| 403 | - ->restrictAccess(Auth::isManager($wt_tree)) |
|
| 404 | - ->addInlineJavascript(' |
|
| 398 | + protected function renderEdit(GeoAnalysis $ga = null) { |
|
| 399 | + $wt_tree = Globals::getTree(); |
|
| 400 | + Theme::theme(new AdministrationTheme)->init($wt_tree); |
|
| 401 | + $controller = new PageController(); |
|
| 402 | + $controller |
|
| 403 | + ->restrictAccess(Auth::isManager($wt_tree)) |
|
| 404 | + ->addInlineJavascript(' |
|
| 405 | 405 | function toggleMapOptions() { |
| 406 | 406 | if($("input:radio[name=\'use_map\']:checked").val() == 1) { |
| 407 | 407 | $("#map_options").show(); |
@@ -415,34 +415,34 @@ discard block |
||
| 415 | 415 | toggleMapOptions(); |
| 416 | 416 | '); |
| 417 | 417 | |
| 418 | - $data = new ViewBag(); |
|
| 419 | - if($ga) { |
|
| 420 | - $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
| 421 | - $data->set('geo_analysis', $ga); |
|
| 422 | - } else { |
|
| 423 | - $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
| 424 | - } |
|
| 418 | + $data = new ViewBag(); |
|
| 419 | + if($ga) { |
|
| 420 | + $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
| 421 | + $data->set('geo_analysis', $ga); |
|
| 422 | + } else { |
|
| 423 | + $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | - $data->set('title', $controller->getPageTitle()); |
|
| 427 | - $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl()); |
|
| 428 | - $data->set('module_title', $this->module->getTitle()); |
|
| 429 | - $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $wt_tree->getNameUrl()); |
|
| 430 | - $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 426 | + $data->set('title', $controller->getPageTitle()); |
|
| 427 | + $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl()); |
|
| 428 | + $data->set('module_title', $this->module->getTitle()); |
|
| 429 | + $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $wt_tree->getNameUrl()); |
|
| 430 | + $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 431 | 431 | |
| 432 | - $map_list = array_map( |
|
| 433 | - function(OutlineMap $map) { |
|
| 434 | - return $map->getDescription(); |
|
| 435 | - }, |
|
| 436 | - $this->provider->getOutlineMapsList() |
|
| 437 | - ); |
|
| 438 | - asort($map_list); |
|
| 439 | - $data->set('map_list', $map_list); |
|
| 432 | + $map_list = array_map( |
|
| 433 | + function(OutlineMap $map) { |
|
| 434 | + return $map->getDescription(); |
|
| 435 | + }, |
|
| 436 | + $this->provider->getOutlineMapsList() |
|
| 437 | + ); |
|
| 438 | + asort($map_list); |
|
| 439 | + $data->set('map_list', $map_list); |
|
| 440 | 440 | |
| 441 | - $gen_details = array(0 => I18N::translate('All')); |
|
| 442 | - for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
| 443 | - $data->set('generation_details', $gen_details); |
|
| 441 | + $gen_details = array(0 => I18N::translate('All')); |
|
| 442 | + for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
| 443 | + $data->set('generation_details', $gen_details); |
|
| 444 | 444 | |
| 445 | - ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
| 446 | - } |
|
| 445 | + ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
| 446 | + } |
|
| 447 | 447 | |
| 448 | 448 | } |
| 449 | 449 | \ No newline at end of file |