Completed
Push — feature/code-analysis ( 0f93c5...1158f1 )
by Jonathan
03:21
created
src/Webtrees/Module/Sosa/Views/SosaListMissingView.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 	 * {@inhericDoc}
32 32
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
33 33
 	 */
34
-    protected function renderContent() {
35
-        ?>
34
+	protected function renderContent() {
35
+		?>
36 36
             <div id="maj-sosa-missing-page" class="center">
37 37
     			<h2><?php echo $this->data->get('title'); ?></h2>
38 38
     			
39 39
     			<?php  if($this->data->get('is_setup')) { 
40
-    			    $selectedgen = $this->data->get('generation');
41
-    			    $this->renderSosaHeader();
42
-    			    if($this->data->get('has_missing', false)) {
43
-    			        $missing_list = $this->data->get('missing_list');
44
-    			        $table_id = $this->data->get('table_id');
45
-    			        ?>
40
+					$selectedgen = $this->data->get('generation');
41
+					$this->renderSosaHeader();
42
+					if($this->data->get('has_missing', false)) {
43
+						$missing_list = $this->data->get('missing_list');
44
+						$table_id = $this->data->get('table_id');
45
+						?>
46 46
     			<div id="sosa-indi-missing" class="smissing-list">
47 47
                 	<table id="<?php echo $table_id;?>">
48 48
         				<thead>     
@@ -113,44 +113,44 @@  discard block
 block discarded – undo
113 113
         			<tbody>
114 114
         			
115 115
         			<?php foreach($this->data->get('missing_list') as $missing_tab) {
116
-        			    $person = $missing_tab['indi'];
116
+						$person = $missing_tab['indi'];
117 117
         			    
118
-        			    /** @var \Fisharebest\Webtrees\Individual $person */
119
-        			    if ($person->isPendingAddtion()) {
120
-        			        $class = ' class="new"';
121
-        			    } elseif ($person->isPendingDeletion()) {
122
-        			        $class = ' class="old"';
123
-        			    } else {
124
-        			        $class = '';
125
-        			    }
126
-        			    $dperson = new \MyArtJaub\Webtrees\Individual($person);
127
-        			    ?>			
118
+						/** @var \Fisharebest\Webtrees\Individual $person */
119
+						if ($person->isPendingAddtion()) {
120
+							$class = ' class="new"';
121
+						} elseif ($person->isPendingDeletion()) {
122
+							$class = ' class="old"';
123
+						} else {
124
+							$class = '';
125
+						}
126
+						$dperson = new \MyArtJaub\Webtrees\Individual($person);
127
+						?>			
128 128
                 		<tr <?php echo $class?>>
129 129
                 			<td class="transparent"><?php echo $missing_tab['sosa']; ?></td>
130 130
                 			<td class="transparent"><?php echo $person->getXref(); ?></td>
131 131
                 			<td colspan="2">
132 132
                 			<?php foreach ($person->getAllNames() as $num=>$name) {
133
-                				if ($name['type']=='NAME') {
134
-                					$title='';
135
-                				} else {
136
-                					$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"';
137
-                				}
138
-                				if ($num==$person->getPrimaryName()) {
139
-                					$class=' class="name2"';
140
-                					$sex_image=$person->getSexImage();
141
-                					list($surn, $givn)=explode(',', $name['sort']);
142
-                				} else {
143
-                					$class='';
144
-                					$sex_image='';
145
-                				} ?>
133
+								if ($name['type']=='NAME') {
134
+									$title='';
135
+								} else {
136
+									$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"';
137
+								}
138
+								if ($num==$person->getPrimaryName()) {
139
+									$class=' class="name2"';
140
+									$sex_image=$person->getSexImage();
141
+									list($surn, $givn)=explode(',', $name['sort']);
142
+								} else {
143
+									$class='';
144
+									$sex_image='';
145
+								} ?>
146 146
                 				<a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>">
147 147
                 					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?>
148 148
                 				</a>
149 149
                 				<?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller'); ?>
150 150
                 				<br/>
151 151
                     		<?php }
152
-                    		echo $person->getPrimaryParentsNames('parents details1', 'none');
153
-                    		?>
152
+							echo $person->getPrimaryParentsNames('parents details1', 'none');
153
+							?>
154 154
                     		</td>
155 155
                     		<td style="display:none;"></td>
156 156
                     		<td>
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                     			<?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?>
161 161
                     		</td>                    		
162 162
                 			<?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
163
-        				        $isISourced = $dperson->isSourced(); ?>
163
+								$isISourced = $dperson->isSourced(); ?>
164 164
         				   	<td><?php echo FunctionsPrint::formatIsSourcedIcon('R', $isISourced, 'INDI', 1, 'medium'); ?></td>
165 165
         					<td><?php echo $isISourced; ?></td>
166 166
         					<?php } else { ?>
@@ -171,34 +171,34 @@  discard block
 block discarded – undo
171 171
         					<td><?php echo $missing_tab['has_mother'] ? '&nbsp;' : 'X';?></td>
172 172
         					<td>
173 173
                     		<?php 
174
-                    		if ($birth_dates=$person->getAllBirthDates()) {
175
-        			            foreach ($birth_dates as $num=>$birth_date) {
176
-            					   if ($num) { ?><br/><?php } ?>
174
+							if ($birth_dates=$person->getAllBirthDates()) {
175
+								foreach ($birth_dates as $num=>$birth_date) {
176
+								   if ($num) { ?><br/><?php } ?>
177 177
             						<?php  echo $birth_date->display(true);
178
-        			            }
179
-                    		} else {
180
-                    		    $birth_date=$person->getEstimatedBirthDate();
181
-                    		    if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
182
-                    		        $birth_date->display(true);
183
-                    		    } else {
184
-                    		        echo '&nbsp;';
185
-                    		    }
186
-                    		    $birth_dates[0] = new Date('');
187
-                    		}
188
-                    		?>
178
+								}
179
+							} else {
180
+								$birth_date=$person->getEstimatedBirthDate();
181
+								if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
182
+									$birth_date->display(true);
183
+								} else {
184
+									echo '&nbsp;';
185
+								}
186
+								$birth_dates[0] = new Date('');
187
+							}
188
+							?>
189 189
                     		</td>
190 190
                     		<td><?php echo $birth_date->julianDay();?></td>
191 191
                 			<td>
192 192
                 			<?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) {
193
-        				        $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree());
194
-                				if ($n) { ?><br><?php } ?>
193
+								$tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree());
194
+								if ($n) { ?><br><?php } ?>
195 195
                 				<a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>">
196 196
                 					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?>
197 197
                 				</a>
198 198
                 			<?php } ?>
199 199
                 			</td>
200 200
         					<?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
201
-        				        $isBSourced = $dperson->isBirthSourced(); ?>
201
+								$isBSourced = $dperson->isBirthSourced(); ?>
202 202
         				   	<td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium'); ?></td>
203 203
         					<td><?php echo $isBSourced; ?></td>
204 204
         					<?php } else { ?>
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     			 <?php } else { ?> 
230 230
     			<p><?php echo I18N::translate('No ancestors are missing for this generation. Generation complete at %s.', I18N::percentage($this->data->get('perc_sosa'), 2)); ?></p>
231 231
     			    <?php }   			    
232
-    			} else { ?>
232
+				} else { ?>
233 233
     			<p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/>
234 234
     				<ul>
235 235
     					<li><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></li>
@@ -240,6 +240,6 @@  discard block
 block discarded – undo
240 240
     			<?php } ?>
241 241
     		</div> 
242 242
     		<?php 
243
-        }
243
+		}
244 244
 }
245 245
  
246 246
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Hooks/Schema/Migration0.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@
 block discarded – undo
23 23
 
24 24
 		Database::exec(
25 25
 		   "CREATE TABLE IF NOT EXISTS `##maj_hooks` (".
26
-	       " majh_id       			INTEGER AUTO_INCREMENT NOT NULL,".
27
-	       " majh_hook_function		VARCHAR(32)            NOT NULL,".
26
+		   " majh_id       			INTEGER AUTO_INCREMENT NOT NULL,".
27
+		   " majh_hook_function		VARCHAR(32)            NOT NULL,".
28 28
 		   " majh_hook_context      VARCHAR(32)            NOT NULL DEFAULT 'all',".
29
-	       " majh_module_name		VARCHAR(32)            NOT NULL,".
30
-	       " majh_module_priority	INTEGER            	   NOT NULL DEFAULT 99,".
31
-	       " majh_status      		ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',".		   
32
-	       " PRIMARY KEY (majh_id),".
33
-	       " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),".
34
-	       " FOREIGN KEY `##module_name_fk1` (majh_module_name)".
29
+		   " majh_module_name		VARCHAR(32)            NOT NULL,".
30
+		   " majh_module_priority	INTEGER            	   NOT NULL DEFAULT 99,".
31
+		   " majh_status      		ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',".		   
32
+		   " PRIMARY KEY (majh_id),".
33
+		   " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),".
34
+		   " FOREIGN KEY `##module_name_fk1` (majh_module_name)".
35 35
 		   " REFERENCES `##module` (module_name) ON DELETE CASCADE ON UPDATE CASCADE".
36
-	       ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
36
+		   ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
37 37
 		);
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Hooks/Views/AdminConfigView.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 	 * {@inhericDoc}
26 26
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
27 27
 	 */
28
-    protected function renderContent() {
28
+	protected function renderContent() {
29 29
         
30
-        $table_id = $this->data->get('table_id');
30
+		$table_id = $this->data->get('table_id');
31 31
         
32
-        ?>        
32
+		?>        
33 33
         <ol class="breadcrumb small">
34 34
         	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
35 35
 			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		</div>	
80 80
 		
81 81
 		<?php        
82
-    }
82
+	}
83 83
     
84 84
 }
85 85
  
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/ModuleManager.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -49,62 +49,62 @@
 block discarded – undo
49 49
 	}
50 50
 	
51 51
 	/**
52
-     * Protected constructor.
53
-     */
54
-    protected function __construct()
55
-    {
56
-    	$this->modules_list = array();
57
-    }
52
+	 * Protected constructor.
53
+	 */
54
+	protected function __construct()
55
+	{
56
+		$this->modules_list = array();
57
+	}
58 58
     
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational()
62
-     */
63
-    public function isOperational($moduleName) {
64
-    	if(!array_key_exists($moduleName, $this->modules_list)) {
65
-    		if($module = fw\Module::getModuleByName($moduleName)) {
66
-    			if($module instanceof DependentInterface) {
67
-    				if($module->validatePrerequisites()) {
68
-    					$this->modules_list[$moduleName] = TRUE;
69
-    					return true;
70
-    				} else {
71
-    					// Do not cache the result,
72
-    					// as they could change by the next call to the method
73
-    					return false;
74
-    				}
75
-    			}
76
-    			else {
77
-    				$this->modules_list[$moduleName] = TRUE;
78
-    				return true;
79
-    			}
80
-    		}
81
-    		else {
82
-    			$this->modules_list[$moduleName] = FALSE;
83
-    		}
84
-    	}
85
-    	return $this->modules_list[$moduleName];
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational()
62
+	 */
63
+	public function isOperational($moduleName) {
64
+		if(!array_key_exists($moduleName, $this->modules_list)) {
65
+			if($module = fw\Module::getModuleByName($moduleName)) {
66
+				if($module instanceof DependentInterface) {
67
+					if($module->validatePrerequisites()) {
68
+						$this->modules_list[$moduleName] = TRUE;
69
+						return true;
70
+					} else {
71
+						// Do not cache the result,
72
+						// as they could change by the next call to the method
73
+						return false;
74
+					}
75
+				}
76
+				else {
77
+					$this->modules_list[$moduleName] = TRUE;
78
+					return true;
79
+				}
80
+			}
81
+			else {
82
+				$this->modules_list[$moduleName] = FALSE;
83
+			}
84
+		}
85
+		return $this->modules_list[$moduleName];
86 86
     	
87
-    }
87
+	}
88 88
     
89 89
 
90
-    /**
91
-     * Private clone method to prevent cloning of the instance of the
92
-     * *ModuleManager* instance.
93
-     *
94
-     * @return void
95
-     */
96
-    private function __clone()
97
-    {
98
-    }
90
+	/**
91
+	 * Private clone method to prevent cloning of the instance of the
92
+	 * *ModuleManager* instance.
93
+	 *
94
+	 * @return void
95
+	 */
96
+	private function __clone()
97
+	{
98
+	}
99 99
 
100
-    /**
101
-     * Private unserialize method to prevent unserializing of the *ModuleManager*
102
-     * instance.
103
-     *
104
-     * @return void
105
-     */
106
-    private function __wakeup()
107
-    {
108
-    }
100
+	/**
101
+	 * Private unserialize method to prevent unserializing of the *ModuleManager*
102
+	 * instance.
103
+	 *
104
+	 * @return void
105
+	 */
106
+	private function __wakeup()
107
+	{
108
+	}
109 109
     
110 110
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/MiscExtensions/AdminConfigController.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -28,56 +28,56 @@
 block discarded – undo
28 28
  */
29 29
 class AdminConfigController extends MvcController
30 30
 {    
31
-    /**
32
-     * Manage updates sent from the AdminConfig@index form.
33
-     */
34
-    protected function update() {
35
-        global $WT_TREE;
31
+	/**
32
+	 * Manage updates sent from the AdminConfig@index form.
33
+	 */
34
+	protected function update() {
35
+		global $WT_TREE;
36 36
     
37
-        if(Auth::isAdmin()){
37
+		if(Auth::isAdmin()){
38 38
     
39
-            $this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX'));
39
+			$this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX'));
40 40
             
41
-            $this->module->setSetting('MAJ_ADD_HTML_HEADER', Filter::postInteger('MAJ_ADD_HTML_HEADER', 0, 1));
42
-            $this->module->setSetting('MAJ_SHOW_HTML_HEADER', Filter::postInteger('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
43
-            $this->module->setSetting('MAJ_HTML_HEADER', Filter::post('MAJ_HTML_HEADER'));
41
+			$this->module->setSetting('MAJ_ADD_HTML_HEADER', Filter::postInteger('MAJ_ADD_HTML_HEADER', 0, 1));
42
+			$this->module->setSetting('MAJ_SHOW_HTML_HEADER', Filter::postInteger('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
43
+			$this->module->setSetting('MAJ_HTML_HEADER', Filter::post('MAJ_HTML_HEADER'));
44 44
             
45
-            $this->module->setSetting('MAJ_ADD_HTML_FOOTER', Filter::postInteger('MAJ_ADD_HTML_FOOTER', 0, 1));
46
-            $this->module->setSetting('MAJ_SHOW_HTML_FOOTER', Filter::postInteger('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
47
-            $this->module->setSetting('MAJ_HTML_FOOTER', Filter::post('MAJ_HTML_FOOTER'));
45
+			$this->module->setSetting('MAJ_ADD_HTML_FOOTER', Filter::postInteger('MAJ_ADD_HTML_FOOTER', 0, 1));
46
+			$this->module->setSetting('MAJ_SHOW_HTML_FOOTER', Filter::postInteger('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
47
+			$this->module->setSetting('MAJ_HTML_FOOTER', Filter::post('MAJ_HTML_FOOTER'));
48 48
             
49
-            $this->module->setSetting('MAJ_DISPLAY_CNIL', Filter::postInteger('MAJ_DISPLAY_CNIL', 0, 1));
50
-            $this->module->setSetting('MAJ_CNIL_REFERENCE', Filter::post('MAJ_CNIL_REFERENCE'));
49
+			$this->module->setSetting('MAJ_DISPLAY_CNIL', Filter::postInteger('MAJ_DISPLAY_CNIL', 0, 1));
50
+			$this->module->setSetting('MAJ_CNIL_REFERENCE', Filter::post('MAJ_CNIL_REFERENCE'));
51 51
                 
52
-            FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
52
+			FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
53 53
     
54
-            return;
55
-        }
56
-    }
54
+			return;
55
+		}
56
+	}
57 57
     
58
-    /**
59
-     * Pages
60
-     */
58
+	/**
59
+	 * Pages
60
+	 */
61 61
         
62
-    /**
63
-     * AdminConfig@index
64
-     */
65
-    public function index() {      
66
-        global $WT_TREE;
62
+	/**
63
+	 * AdminConfig@index
64
+	 */
65
+	public function index() {      
66
+		global $WT_TREE;
67 67
         
68
-        $action = Filter::post('action');        
69
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
68
+		$action = Filter::post('action');        
69
+		if($action == 'update' && Filter::checkCsrf()) $this->update();
70 70
         
71
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);        
72
-        $ctrl = new PageController();
73
-        $ctrl
74
-            ->restrictAccess(Auth::isAdmin())
75
-            ->setPageTitle($this->module->getTitle());
71
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);        
72
+		$ctrl = new PageController();
73
+		$ctrl
74
+			->restrictAccess(Auth::isAdmin())
75
+			->setPageTitle($this->module->getTitle());
76 76
             
77
-        $view_bag = new ViewBag();
78
-        $view_bag->set('title', $ctrl->getPageTitle());
79
-        $view_bag->set('module', $this->module);
77
+		$view_bag = new ViewBag();
78
+		$view_bag->set('title', $ctrl->getPageTitle());
79
+		$view_bag->set('module', $this->module);
80 80
         
81
-        ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
82
-    }
81
+		ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
82
+	}
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/MiscExtensions/Views/AdminConfigView.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 * {@inhericDoc}
29 29
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
30 30
 	 */
31
-    protected function renderContent() {
31
+	protected function renderContent() {
32 32
         
33
-        if (Module::getModuleByName('ckeditor')) {
34
-            CkeditorModule::enableEditor($this->ctrl);
35
-        }
33
+		if (Module::getModuleByName('ckeditor')) {
34
+			CkeditorModule::enableEditor($this->ctrl);
35
+		}
36 36
         
37
-        /** @var AbstractModule $module  */
38
-        $module = $this->data->get('module');        
39
-        ?>        
37
+		/** @var AbstractModule $module  */
38
+		$module = $this->data->get('module');        
39
+		?>        
40 40
         <ol class="breadcrumb small">
41 41
         	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
42 42
 			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         </form>
188 188
 		
189 189
 		<?php        
190
-    }
190
+	}
191 191
     
192 192
 }
193 193
  
194 194
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoDisplayOptions.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -15,58 +15,58 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class GeoDisplayOptions {
17 17
     
18
-    /**
18
+	/**
19 19
 	 * Outline map to be used for diaplay
20
-     * @var (null|OutlineMap) $map
21
-     */
22
-    protected $map;
20
+	 * @var (null|OutlineMap) $map
21
+	 */
22
+	protected $map;
23 23
     
24 24
 	/**
25 25
 	 * Level in the Gedcom hierarchy of the parent level of the outline map.
26 26
 	 * @var int $map_level
27 27
 	 */
28
-    protected $map_level;
28
+	protected $map_level;
29 29
     
30 30
 	/**
31 31
 	 * Option to use flags in places display, instead of or in addition to the name.
32 32
 	 * @var bool $use_flags
33 33
 	 */
34
-    protected $use_flags;
34
+	protected $use_flags;
35 35
     
36 36
 	/**
37 37
 	 * Option to define the number of top places to display in the generation view.
38 38
 	 * @var int $max_details_in_gen
39 39
 	 */
40
-    protected $max_details_in_gen;
40
+	protected $max_details_in_gen;
41 41
     
42
-    /**
42
+	/**
43 43
 	 * Get the outline map to use for display.
44 44
 	 *
45
-     * @return (OutlineMap|null)
46
-     */
47
-    public function getMap(){
48
-        return $this->map;
49
-    }
45
+	 * @return (OutlineMap|null)
46
+	 */
47
+	public function getMap(){
48
+		return $this->map;
49
+	}
50 50
     
51 51
 	/**
52 52
 	 * Set the outline map to use for display.
53 53
 	 *
54
-     * @param (OutlineMap|null) $map
54
+	 * @param (OutlineMap|null) $map
55 55
 	 * @return self Enable method-chaining
56
-     */
57
-    public function setMap(OutlineMap $map = null) {
58
-        $this->map = $map;
59
-        return $this;
60
-    }
56
+	 */
57
+	public function setMap(OutlineMap $map = null) {
58
+		$this->map = $map;
59
+		return $this;
60
+	}
61 61
     
62 62
 	/**
63 63
 	 * Get the level of the map parent place
64 64
 	 *
65 65
 	 * @return int
66 66
 	 */
67
-    public function getMapLevel(){
68
-        return $this->map_level;
69
-    }
67
+	public function getMapLevel(){
68
+		return $this->map_level;
69
+	}
70 70
     
71 71
 	/**
72 72
 	 * Set the level of the map parent place
@@ -74,19 +74,19 @@  discard block
 block discarded – undo
74 74
 	 * @param int $maplevel
75 75
 	 * @return self Enable method-chaining
76 76
 	 */
77
-    public function setMapLevel($maplevel) {
78
-        $this->map_level = $maplevel;
79
-        return $this;
80
-    }
77
+	public function setMapLevel($maplevel) {
78
+		$this->map_level = $maplevel;
79
+		return $this;
80
+	}
81 81
     
82 82
 	/**
83 83
 	 * Get whether flags should be used in places display
84 84
 	 *
85 85
 	 * @return bool
86 86
 	 */
87
-    public function isUsingFlags(){
88
-        return $this->use_flags;
89
-    }
87
+	public function isUsingFlags(){
88
+		return $this->use_flags;
89
+	}
90 90
     
91 91
 	/**
92 92
 	 * Set whether flags should be used in places display
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
 	 * @param bool $use_flags
95 95
 	 * @return self Enable method-chaining
96 96
 	 */
97
-    public function setIsUsingFlags($use_flags) {
98
-        $this->use_flags = $use_flags;
99
-        return $this;
100
-    }
97
+	public function setIsUsingFlags($use_flags) {
98
+		$this->use_flags = $use_flags;
99
+		return $this;
100
+	}
101 101
     
102 102
 	/**
103 103
 	 * Get the number of Top Places in the generation view
104 104
 	 *
105 105
 	 * @return int
106 106
 	 */
107
-    public function getMaxDetailsInGen(){
108
-        return $this->max_details_in_gen;
109
-    }
107
+	public function getMaxDetailsInGen(){
108
+		return $this->max_details_in_gen;
109
+	}
110 110
     
111 111
 	/**
112 112
 	 * Set the number of Top Places in the generation view
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 * @param int $max_details_in_gen
115 115
 	 * @return self Enable method-chaining
116 116
 	 */
117
-    public function setMaxDetailsInGen($max_details_in_gen) {
118
-        $this->max_details_in_gen = $max_details_in_gen;
119
-        return $this;
120
-    }
117
+	public function setMaxDetailsInGen($max_details_in_gen) {
118
+		$this->max_details_in_gen = $max_details_in_gen;
119
+		return $this;
120
+	}
121 121
                    
122 122
 }
123 123
  
124 124
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/OutlineMapCanvas.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -19,49 +19,49 @@  discard block
 block discarded – undo
19 19
 	 * Width of the map (in pixels).
20 20
 	 * @var int $width
21 21
 	 */
22
-    public $width;
22
+	public $width;
23 23
 	
24 24
 	/**
25 25
 	 * Height of the map (in pixels).
26 26
 	 * @var int $height
27 27
 	 */
28
-    public $height;
28
+	public $height;
29 29
 	
30 30
 	/**
31 31
 	 * Background color for the map shapes with values (when no transparency if applied).
32 32
 	 * @var string $max_color
33 33
 	 */
34
-    public $max_color;
34
+	public $max_color;
35 35
 	
36 36
 	/**
37 37
 	 * Background color for the map shapes when hovered.
38 38
 	 * @var string $hover_color
39 39
 	 */
40
-    public $hover_color;
40
+	public $hover_color;
41 41
 	
42 42
 	/**
43 43
 	 * Background color for the map.
44 44
 	 * @var string $background_color
45 45
 	 */
46
-    public $background_color;
46
+	public $background_color;
47 47
 	
48 48
 	/**
49 49
 	 * Border color for the map.
50 50
 	 * @var string $background_stroke
51 51
 	 */
52
-    public $background_stroke;
52
+	public $background_stroke;
53 53
 	
54 54
 	/**
55 55
 	 * Default color for the shapes (without any value).
56 56
 	 * @var string $default_color
57 57
 	 */
58
-    public $default_color;
58
+	public $default_color;
59 59
 	
60 60
 	/**
61 61
 	 * Default border color for the shapes.
62 62
 	 * @var string $default_stroke
63 63
 	 */
64
-    public $default_stroke;
64
+	public $default_stroke;
65 65
     
66 66
 	/**
67 67
 	 * Constructor for OutlineMapCanvas.
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 	 * @param string $default_color Default background color for the shapes
76 76
 	 * @param string $default_stroke Default border color for the shapes
77 77
 	 */
78
-    public function __construct(
79
-        $width,
80
-        $height,
81
-        $max_color,
82
-        $hover_color,
83
-        $background_color,
84
-        $background_stroke,
85
-        $default_color,
86
-        $default_stroke
87
-     ) {
88
-        $this->width = $width;
89
-        $this->height = $height;
90
-        $this->max_color = $max_color;
91
-        $this->hover_color = $hover_color;
92
-        $this->background_color = $background_color;
93
-        $this->background_stroke = $background_stroke;
94
-        $this->default_color = $default_color;
95
-        $this->default_stroke = $default_stroke;
96
-    }
78
+	public function __construct(
79
+		$width,
80
+		$height,
81
+		$max_color,
82
+		$hover_color,
83
+		$background_color,
84
+		$background_stroke,
85
+		$default_color,
86
+		$default_stroke
87
+	 ) {
88
+		$this->width = $width;
89
+		$this->height = $height;
90
+		$this->max_color = $max_color;
91
+		$this->hover_color = $hover_color;
92
+		$this->background_color = $background_color;
93
+		$this->background_stroke = $background_stroke;
94
+		$this->default_color = $default_color;
95
+		$this->default_stroke = $default_stroke;
96
+	}
97 97
     
98 98
     
99 99
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysisProvider.php 1 patch
Indentation   +329 added lines, -329 removed lines patch added patch discarded remove patch
@@ -21,130 +21,130 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class GeoAnalysisProvider {
23 23
     
24
-    /**
25
-     * Reference tree
26
-     * @var Tree $tree
27
-     */
28
-    protected $tree;
24
+	/**
25
+	 * Reference tree
26
+	 * @var Tree $tree
27
+	 */
28
+	protected $tree;
29 29
     
30
-    /**
31
-     * Cached hierarchy of places in the Gedcom file.
32
-     * 
33
-     * @var (array|null) $place_hierarchy
34
-     */
35
-    protected $place_hierarchy;
30
+	/**
31
+	 * Cached hierarchy of places in the Gedcom file.
32
+	 * 
33
+	 * @var (array|null) $place_hierarchy
34
+	 */
35
+	protected $place_hierarchy;
36 36
     
37
-    /**
38
-     * Constructor for GeoAnalysis Provider.
39
-     * A provider is defined in relation to a specific tree.
40
-     *
41
-     * @param Tree $tree
42
-     */
43
-    public function __construct(Tree $tree) {
44
-        $this->tree = $tree;
45
-        $this->place_hierarchy = null;
46
-    }
37
+	/**
38
+	 * Constructor for GeoAnalysis Provider.
39
+	 * A provider is defined in relation to a specific tree.
40
+	 *
41
+	 * @param Tree $tree
42
+	 */
43
+	public function __construct(Tree $tree) {
44
+		$this->tree = $tree;
45
+		$this->place_hierarchy = null;
46
+	}
47 47
     
48
-    /**
49
-     * Creates and returns a GeoAnalysis object from a data row.
50
-     * The row data is expected to be an array with the indexes:
51
-     *  - majgd_id: geodispersion analysis ID
52
-     *  - majgd_descr: geodispersion analysis description/title
53
-     *  - majgd_sublevel: Analysis level
54
-     *  - majgd_useflagsgen: Use flags in places display
55
-     *  - majgd_detailsgen: Number of top places
56
-     *  - majgd_map: file name of the map
57
-     *  - majgd_toplevel: parent level for the map
58
-     * 
59
-     * @param array $row
60
-     * @return GeoAnalysis
61
-     */
62
-    protected function loadGeoAnalysisFromRow($row) {
63
-        $options = new GeoDisplayOptions();
64
-        $options
65
-        ->setIsUsingFlags($row['majgd_useflagsgen'] == 'yes')
66
-        ->setMaxDetailsInGen($row['majgd_detailsgen']);
48
+	/**
49
+	 * Creates and returns a GeoAnalysis object from a data row.
50
+	 * The row data is expected to be an array with the indexes:
51
+	 *  - majgd_id: geodispersion analysis ID
52
+	 *  - majgd_descr: geodispersion analysis description/title
53
+	 *  - majgd_sublevel: Analysis level
54
+	 *  - majgd_useflagsgen: Use flags in places display
55
+	 *  - majgd_detailsgen: Number of top places
56
+	 *  - majgd_map: file name of the map
57
+	 *  - majgd_toplevel: parent level for the map
58
+	 * 
59
+	 * @param array $row
60
+	 * @return GeoAnalysis
61
+	 */
62
+	protected function loadGeoAnalysisFromRow($row) {
63
+		$options = new GeoDisplayOptions();
64
+		$options
65
+		->setIsUsingFlags($row['majgd_useflagsgen'] == 'yes')
66
+		->setMaxDetailsInGen($row['majgd_detailsgen']);
67 67
         
68
-        if($row['majgd_map']) {
69
-            $options
70
-            ->setMap(new OutlineMap($row['majgd_map']))
71
-            ->setMapLevel($row['majgd_toplevel']);
72
-        }
68
+		if($row['majgd_map']) {
69
+			$options
70
+			->setMap(new OutlineMap($row['majgd_map']))
71
+			->setMapLevel($row['majgd_toplevel']);
72
+		}
73 73
         
74
-        $enabled = true;
75
-        if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76
-            $enabled = false;
77
-        }
74
+		$enabled = true;
75
+		if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76
+			$enabled = false;
77
+		}
78 78
         
79
-        return new GeoAnalysis(
80
-            $this->tree,
81
-            $row['majgd_id'],
82
-            $row['majgd_descr'],
83
-            $row['majgd_sublevel'],
84
-            $options,
85
-            $enabled
86
-            );
87
-    }
79
+		return new GeoAnalysis(
80
+			$this->tree,
81
+			$row['majgd_id'],
82
+			$row['majgd_descr'],
83
+			$row['majgd_sublevel'],
84
+			$options,
85
+			$enabled
86
+			);
87
+	}
88 88
     
89
-    /**
90
-     * Returns the number of geographical analysis (active and inactive). 
91
-     * 
92
-     * @return int
93
-     */
94
-    public function getGeoAnalysisCount() {
95
-        return Database::prepare(
96
-            'SELECT COUNT(majgd_id)' .
97
-            ' FROM `##maj_geodispersion`' .
98
-            ' WHERE majgd_file = :gedcom_id'
99
-            )->execute(array(
100
-                'gedcom_id' => $this->tree->getTreeId()
101
-            ))->fetchOne();
102
-    }
89
+	/**
90
+	 * Returns the number of geographical analysis (active and inactive). 
91
+	 * 
92
+	 * @return int
93
+	 */
94
+	public function getGeoAnalysisCount() {
95
+		return Database::prepare(
96
+			'SELECT COUNT(majgd_id)' .
97
+			' FROM `##maj_geodispersion`' .
98
+			' WHERE majgd_file = :gedcom_id'
99
+			)->execute(array(
100
+				'gedcom_id' => $this->tree->getTreeId()
101
+			))->fetchOne();
102
+	}
103 103
     
104
-    /**
105
-     * Get a geographical analysis by its ID.
106
-     * The function can only search for only enabled analysis, or all.
107
-     * 
108
-     * @param int $id geodispersion analysis ID
109
-     * @param bool $only_enabled Search for only enabled geodispersion analysis
110
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111
-     */
112
-    public function getGeoAnalysis($id, $only_enabled = true) {
113
-        $args = array (
114
-            'gedcom_id' => $this->tree->getTreeId(),
115
-            'ga_id' => $id
116
-        );
104
+	/**
105
+	 * Get a geographical analysis by its ID.
106
+	 * The function can only search for only enabled analysis, or all.
107
+	 * 
108
+	 * @param int $id geodispersion analysis ID
109
+	 * @param bool $only_enabled Search for only enabled geodispersion analysis
110
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111
+	 */
112
+	public function getGeoAnalysis($id, $only_enabled = true) {
113
+		$args = array (
114
+			'gedcom_id' => $this->tree->getTreeId(),
115
+			'ga_id' => $id
116
+		);
117 117
         
118
-        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
-            ' FROM `##maj_geodispersion`' .
120
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
-        if($only_enabled) {
122
-            $sql .= ' AND majgd_status = :status';
123
-            $args['status'] = 'enabled';
124
-        }
125
-        $sql .= ' ORDER BY majgd_descr';
118
+		$sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
+			' FROM `##maj_geodispersion`' .
120
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
+		if($only_enabled) {
122
+			$sql .= ' AND majgd_status = :status';
123
+			$args['status'] = 'enabled';
124
+		}
125
+		$sql .= ' ORDER BY majgd_descr';
126 126
         
127
-        $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
127
+		$ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
128 128
         
129
-        if($ga_array) {
130
-            return $this->loadGeoAnalysisFromRow($ga_array);
131
-        }
129
+		if($ga_array) {
130
+			return $this->loadGeoAnalysisFromRow($ga_array);
131
+		}
132 132
         
133
-        return null;            
134
-    }
133
+		return null;            
134
+	}
135 135
     
136
-    /**
137
-     * Add a new geodispersion analysis in the database, in a transactional manner.
138
-     * When successful, eturns the newly created GeoAnalysis object.
139
-     * 
140
-     * @param string $description geodispersion analysis title
141
-     * @param int $analysis_level Analysis level
142
-     * @param string $map_file Filename of the map
143
-     * @param int $map_top_level Parent level of the map
144
-     * @param bool $use_flags Use flag in the place display
145
-     * @param int $gen_details Number of top places to display
146
-     * @return GeoAnalysis
147
-     */
136
+	/**
137
+	 * Add a new geodispersion analysis in the database, in a transactional manner.
138
+	 * When successful, eturns the newly created GeoAnalysis object.
139
+	 * 
140
+	 * @param string $description geodispersion analysis title
141
+	 * @param int $analysis_level Analysis level
142
+	 * @param string $map_file Filename of the map
143
+	 * @param int $map_top_level Parent level of the map
144
+	 * @param bool $use_flags Use flag in the place display
145
+	 * @param int $gen_details Number of top places to display
146
+	 * @return GeoAnalysis
147
+	 */
148 148
 	public function createGeoAnalysis($description, $analysis_level, $map_file, $map_top_level, $use_flags, $gen_details) {
149 149
 		try{
150 150
 			Database::beginTransaction();
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 			Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage());
175 175
 		}
176 176
 		return $ga;
177
-    }
177
+	}
178 178
 	
179
-    /**
180
-     * Update a geodispersion analysis in the database, in transactional manner.
181
-     * When successful, returns the updated GeoAnalysis object
182
-     *  
183
-     * @param GeoAnalysis $ga
184
-     * @return GeoAnalysis
185
-     */
186
-    public function updateGeoAnalysis(GeoAnalysis $ga) {
187
-        try {
179
+	/**
180
+	 * Update a geodispersion analysis in the database, in transactional manner.
181
+	 * When successful, returns the updated GeoAnalysis object
182
+	 *  
183
+	 * @param GeoAnalysis $ga
184
+	 * @return GeoAnalysis
185
+	 */
186
+	public function updateGeoAnalysis(GeoAnalysis $ga) {
187
+		try {
188 188
 			Database::beginTransaction();
189 189
 		
190 190
 			Database::prepare(
@@ -217,238 +217,238 @@  discard block
 block discarded – undo
217 217
 			$ga = null;
218 218
 		}
219 219
 		return $ga;
220
-    }
220
+	}
221 221
     
222
-    /**
223
-     * Set the status of a specific analysis.
224
-     * The status can be enabled (true), or disabled (false).
225
-     * 
226
-     * @param GeoAnalysis $ga
227
-     * @param bool $status
228
-     */
229
-    public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) {
230
-        Database::prepare(
231
-            'UPDATE `##maj_geodispersion`'.
232
-            ' SET majgd_status = :status'.
233
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
234
-        )->execute(array(
235
-                'gedcom_id' => $this->tree->getTreeId(),
236
-                'status' => $status ? 'enabled' : 'disabled',
237
-                'ga_id' => $ga->getId()
238
-        ));
239
-    }
222
+	/**
223
+	 * Set the status of a specific analysis.
224
+	 * The status can be enabled (true), or disabled (false).
225
+	 * 
226
+	 * @param GeoAnalysis $ga
227
+	 * @param bool $status
228
+	 */
229
+	public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) {
230
+		Database::prepare(
231
+			'UPDATE `##maj_geodispersion`'.
232
+			' SET majgd_status = :status'.
233
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
234
+		)->execute(array(
235
+				'gedcom_id' => $this->tree->getTreeId(),
236
+				'status' => $status ? 'enabled' : 'disabled',
237
+				'ga_id' => $ga->getId()
238
+		));
239
+	}
240 240
     
241
-    /**
242
-     * Delete a geodispersion analysis from the database.
243
-     * 
244
-     * @param GeoAnalysis $ga
245
-     */
246
-    public function deleteGeoAnalysis(GeoAnalysis $ga) {
247
-        Database::prepare(
248
-            'DELETE FROM `##maj_geodispersion`'.
249
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
250
-            )->execute(array(
251
-                'gedcom_id' => $this->tree->getTreeId(),
252
-                'ga_id' => $ga->getId()
253
-            ));
254
-    }
241
+	/**
242
+	 * Delete a geodispersion analysis from the database.
243
+	 * 
244
+	 * @param GeoAnalysis $ga
245
+	 */
246
+	public function deleteGeoAnalysis(GeoAnalysis $ga) {
247
+		Database::prepare(
248
+			'DELETE FROM `##maj_geodispersion`'.
249
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
250
+			)->execute(array(
251
+				'gedcom_id' => $this->tree->getTreeId(),
252
+				'ga_id' => $ga->getId()
253
+			));
254
+	}
255 255
         
256
-    /**
257
-     * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM
258
-     *
259
-     * @return array List of enabled maps
260
-     */
261
-    public function getGeoAnalysisList(){
262
-        $res = array();
256
+	/**
257
+	 * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM
258
+	 *
259
+	 * @return array List of enabled maps
260
+	 */
261
+	public function getGeoAnalysisList(){
262
+		$res = array();
263 263
         
264
-        $list = Database::prepare(
265
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
-            ' FROM `##maj_geodispersion`' .
267
-            ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268
-            ' ORDER BY majgd_descr'
269
-        )->execute(array(
270
-            'gedcom_id' => $this->tree->getTreeId(),
271
-            'status' => 'enabled'
272
-        ))->fetchAll(\PDO::FETCH_ASSOC);
264
+		$list = Database::prepare(
265
+			'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
+			' FROM `##maj_geodispersion`' .
267
+			' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268
+			' ORDER BY majgd_descr'
269
+		)->execute(array(
270
+			'gedcom_id' => $this->tree->getTreeId(),
271
+			'status' => 'enabled'
272
+		))->fetchAll(\PDO::FETCH_ASSOC);
273 273
         
274
-        foreach($list as $ga) {
275
-           $res[] = $this->loadGeoAnalysisFromRow($ga);
276
-        }
274
+		foreach($list as $ga) {
275
+		   $res[] = $this->loadGeoAnalysisFromRow($ga);
276
+		}
277 277
         
278
-        return $res;
279
-    }
278
+		return $res;
279
+	}
280 280
     
281
-    /**
282
-     * Return the list of geodispersion analysis matching specified criterias.
283
-     * 
284
-     * @param string $search Search criteria in analysis description
285
-     * @param array $order_by Columns to order by
286
-     * @param int $start Offset to start with (for pagination)
287
-     * @param int|null $limit Max number of items to return (for pagination)
288
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289
-     */
290
-    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
291
-        $res = array();
281
+	/**
282
+	 * Return the list of geodispersion analysis matching specified criterias.
283
+	 * 
284
+	 * @param string $search Search criteria in analysis description
285
+	 * @param array $order_by Columns to order by
286
+	 * @param int $start Offset to start with (for pagination)
287
+	 * @param int|null $limit Max number of items to return (for pagination)
288
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289
+	 */
290
+	public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
291
+		$res = array();
292 292
             
293
-        $sql = 
294
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
-            ' FROM `##maj_geodispersion`' .
296
-            ' WHERE majgd_file = :gedcom_id';
293
+		$sql = 
294
+			'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
+			' FROM `##maj_geodispersion`' .
296
+			' WHERE majgd_file = :gedcom_id';
297 297
         
298
-        $args = array('gedcom_id'=> $this->tree->getTreeId());
298
+		$args = array('gedcom_id'=> $this->tree->getTreeId());
299 299
         
300
-        if($search) {
301
-            $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302
-            $args['search'] = $search;
303
-        }
300
+		if($search) {
301
+			$sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302
+			$args['search'] = $search;
303
+		}
304 304
         
305
-        if ($order_by) {
306
-            $sql .= ' ORDER BY ';
307
-            foreach ($order_by as $key => $value) {
308
-                if ($key > 0) {
309
-                    $sql .= ',';
310
-                }
305
+		if ($order_by) {
306
+			$sql .= ' ORDER BY ';
307
+			foreach ($order_by as $key => $value) {
308
+				if ($key > 0) {
309
+					$sql .= ',';
310
+				}
311 311
                 
312
-                switch ($value['dir']) {
313
-                    case 'asc':
314
-                        $sql .= $value['column'] . ' ASC ';
315
-                        break;
316
-                    case 'desc':
317
-                        $sql .= $value['column'] . ' DESC ';
318
-                        break;
319
-                }
320
-            }
321
-        } else {
322
-            $sql = " ORDER BY majgd_descr ASC";
323
-        }
312
+				switch ($value['dir']) {
313
+					case 'asc':
314
+						$sql .= $value['column'] . ' ASC ';
315
+						break;
316
+					case 'desc':
317
+						$sql .= $value['column'] . ' DESC ';
318
+						break;
319
+				}
320
+			}
321
+		} else {
322
+			$sql = " ORDER BY majgd_descr ASC";
323
+		}
324 324
         
325
-        if ($limit) {
326
-            $sql .= " LIMIT :limit OFFSET :offset";
327
-            $args['limit']  = $limit;
328
-            $args['offset'] = $start;
329
-        }
325
+		if ($limit) {
326
+			$sql .= " LIMIT :limit OFFSET :offset";
327
+			$args['limit']  = $limit;
328
+			$args['offset'] = $start;
329
+		}
330 330
             
331
-        $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
331
+		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
332 332
 
333
-        foreach($data as $ga) {
334
-            $res[] = $this->loadGeoAnalysisFromRow($ga);
335
-        }
333
+		foreach($data as $ga) {
334
+			$res[] = $this->loadGeoAnalysisFromRow($ga);
335
+		}
336 336
         
337
-        return $res;
338
-    }
337
+		return $res;
338
+	}
339 339
             
340
-    /**
341
-     * Returns the infered place hierarchy, determined from the Gedcom data.
342
-     * Depending on the data, it can be based on the Gedcom Header description, or from a place example.
343
-     * This is returned as an associative array:
344
-     *      - type:    describe the source of the data (<em>header<em> / <em>data</em>)
345
-     *      - hierarchy: an array of the place hierarchy (in reverse order of the gedcom)
346
-     *      
347
-     * @return array
348
-     */
349
-    public function getPlacesHierarchy() {
350
-        if(!$this->place_hierarchy) {
351
-            if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352
-                $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
-            }
354
-            else {
355
-                $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData());
356
-            }            
357
-        }
358
-        return $this->place_hierarchy;        
359
-    }
340
+	/**
341
+	 * Returns the infered place hierarchy, determined from the Gedcom data.
342
+	 * Depending on the data, it can be based on the Gedcom Header description, or from a place example.
343
+	 * This is returned as an associative array:
344
+	 *      - type:    describe the source of the data (<em>header<em> / <em>data</em>)
345
+	 *      - hierarchy: an array of the place hierarchy (in reverse order of the gedcom)
346
+	 *      
347
+	 * @return array
348
+	 */
349
+	public function getPlacesHierarchy() {
350
+		if(!$this->place_hierarchy) {
351
+			if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352
+				$this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
+			}
354
+			else {
355
+				$this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData());
356
+			}            
357
+		}
358
+		return $this->place_hierarchy;        
359
+	}
360 360
     
361
-    /**
362
-     * Returns an array of the place hierarchy, as defined in the GEDCOM header.
363
-     * The places are reversed compared to normal GEDCOM structure.
364
-     * 
365
-     * @return array|null
366
-     */
367
-    protected function getPlacesHierarchyFromHeader() {
368
-        $head = GedcomRecord::getInstance('HEAD', $this->tree);
369
-        $head_place = $head->getFirstFact('PLAC');
370
-        if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
-            return array_reverse(array_map('trim',explode(',', $head_place_value)));
372
-        }
373
-        return null;
374
-    }
361
+	/**
362
+	 * Returns an array of the place hierarchy, as defined in the GEDCOM header.
363
+	 * The places are reversed compared to normal GEDCOM structure.
364
+	 * 
365
+	 * @return array|null
366
+	 */
367
+	protected function getPlacesHierarchyFromHeader() {
368
+		$head = GedcomRecord::getInstance('HEAD', $this->tree);
369
+		$head_place = $head->getFirstFact('PLAC');
370
+		if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
+			return array_reverse(array_map('trim',explode(',', $head_place_value)));
372
+		}
373
+		return null;
374
+	}
375 375
     
376
-    /**
377
-     * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM.
378
-     * It will look for the longest hierarchy in the tree.
379
-     * The places are reversed compared to normal GEDCOM structure.
380
-     * 
381
-     * @return array
382
-     */
383
-    protected function getPlacesHierarchyFromData() {
384
-        $random_place = null;
385
-        $nb_levels = 0;
376
+	/**
377
+	 * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM.
378
+	 * It will look for the longest hierarchy in the tree.
379
+	 * The places are reversed compared to normal GEDCOM structure.
380
+	 * 
381
+	 * @return array
382
+	 */
383
+	protected function getPlacesHierarchyFromData() {
384
+		$random_place = null;
385
+		$nb_levels = 0;
386 386
         
387
-        //Select all '2 PLAC ' tags in the file and create array
388
-        $places_list=array();
389
-        $ged_data = Database::prepare(
390
-            'SELECT i_gedcom AS gedcom'.
391
-            ' FROM `##individuals`'.
392
-            ' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'.
393
-            ' UNION ALL'.
394
-            'SELECT f_gedcom AS gedcom'.
395
-            ' FROM `##families`'.
396
-            ' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id'
397
-        )->execute(array(
398
-            'gedcom' => '%\n2 PLAC %',
399
-            'gedcom_id' => $this->tree->getTreeId()            
400
-        ))->fetchOneColumn();
401
-        foreach ($ged_data as $ged_datum) {
402
-            preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403
-            foreach ($matches[1] as $match) {
404
-                $places_list[$match]=true;
405
-            }
406
-        }
387
+		//Select all '2 PLAC ' tags in the file and create array
388
+		$places_list=array();
389
+		$ged_data = Database::prepare(
390
+			'SELECT i_gedcom AS gedcom'.
391
+			' FROM `##individuals`'.
392
+			' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'.
393
+			' UNION ALL'.
394
+			'SELECT f_gedcom AS gedcom'.
395
+			' FROM `##families`'.
396
+			' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id'
397
+		)->execute(array(
398
+			'gedcom' => '%\n2 PLAC %',
399
+			'gedcom_id' => $this->tree->getTreeId()            
400
+		))->fetchOneColumn();
401
+		foreach ($ged_data as $ged_datum) {
402
+			preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403
+			foreach ($matches[1] as $match) {
404
+				$places_list[$match]=true;
405
+			}
406
+		}
407 407
         
408
-        // Unique list of places
409
-        $places_list=array_keys($places_list);
408
+		// Unique list of places
409
+		$places_list=array_keys($places_list);
410 410
         
411
-        //sort the array, limit to unique values, and count them
412
-        $places_parts=array();
413
-        usort($places_list, array('I18N', 'strcasecmp'));
414
-        $nb_places = count($places_list);
411
+		//sort the array, limit to unique values, and count them
412
+		$places_parts=array();
413
+		usort($places_list, array('I18N', 'strcasecmp'));
414
+		$nb_places = count($places_list);
415 415
         
416
-        //calculate maximum no. of levels to display
417
-        $has_found_good_example = false;
418
-        foreach($places_list as $place){
419
-            $levels = explode(",", $place);
420
-            $parts = count($levels);
421
-            if ($parts >= $nb_levels){
422
-                $nb_levels = $parts;
423
-                if(!$has_found_good_example){
424
-                    $random_place = $$place;
425
-                    if(min(array_map('strlen', $levels)) > 0){
426
-                        $has_found_good_example = true;
427
-                    }
428
-                }
429
-            }
430
-        }
416
+		//calculate maximum no. of levels to display
417
+		$has_found_good_example = false;
418
+		foreach($places_list as $place){
419
+			$levels = explode(",", $place);
420
+			$parts = count($levels);
421
+			if ($parts >= $nb_levels){
422
+				$nb_levels = $parts;
423
+				if(!$has_found_good_example){
424
+					$random_place = $$place;
425
+					if(min(array_map('strlen', $levels)) > 0){
426
+						$has_found_good_example = true;
427
+					}
428
+				}
429
+			}
430
+		}
431 431
         
432
-        return array_reverse(array_map('trim',explode(',', $randomPlace)));
433
-    }
432
+		return array_reverse(array_map('trim',explode(',', $randomPlace)));
433
+	}
434 434
     
435
-    /**
436
-     * Returns the list of geodispersion maps available within the maps folder.
437
-     * 
438
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[]
439
-     */
440
-    public function getOutlineMapsList() {
441
-        $res = array();
442
-        $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
443
-        if(is_dir($root_path)){
444
-            $dir = opendir($root_path);
445
-            while (($file=readdir($dir))!== false) {
446
-                if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
447
-                    $res[base64_encode($file)] = new OutlineMap($file, true);
448
-                }
449
-            }
450
-        }
451
-        return $res;
452
-    }
435
+	/**
436
+	 * Returns the list of geodispersion maps available within the maps folder.
437
+	 * 
438
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[]
439
+	 */
440
+	public function getOutlineMapsList() {
441
+		$res = array();
442
+		$root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
443
+		if(is_dir($root_path)){
444
+			$dir = opendir($root_path);
445
+			while (($file=readdir($dir))!== false) {
446
+				if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
447
+					$res[base64_encode($file)] = new OutlineMap($file, true);
448
+				}
449
+			}
450
+		}
451
+		return $res;
452
+	}
453 453
 }
454 454
  
455 455
\ No newline at end of file
Please login to merge, or discard this patch.