Completed
Pull Request — master (#841)
by Rico
59:13 queued 47:04
created
app/Report/ReportParserSetup.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 namespace Fisharebest\Webtrees\Report;
17 17
 
18 18
 use Fisharebest\Webtrees\Auth;
19
-use Fisharebest\Webtrees\Date;
20 19
 use Fisharebest\Webtrees\I18N;
21 20
 
22 21
 /**
Please login to merge, or discard this patch.
app/Controller/LifespanController.php 1 patch
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -506,23 +506,23 @@
 block discarded – undo
506 506
 	 */
507 507
 	public function getCalendarDate($date) {
508 508
 		switch ($this->calendar) {
509
-			case 'julian':
510
-				$caldate = new JulianDate($date);
511
-				break;
512
-			case 'french':
513
-				$caldate = new FrenchDate($date);
514
-				break;
515
-			case 'jewish':
516
-				$caldate = new JewishDate($date);
517
-				break;
518
-			case 'hijri':
519
-				$caldate = new HijriDate($date);
520
-				break;
521
-			case 'jalali':
522
-				$caldate = new JalaliDate($date);
523
-				break;
524
-			default:
525
-				$caldate = new GregorianDate($date);
509
+		case 'julian':
510
+			$caldate = new JulianDate($date);
511
+			break;
512
+		case 'french':
513
+			$caldate = new FrenchDate($date);
514
+			break;
515
+		case 'jewish':
516
+			$caldate = new JewishDate($date);
517
+			break;
518
+		case 'hijri':
519
+			$caldate = new HijriDate($date);
520
+			break;
521
+		case 'jalali':
522
+			$caldate = new JalaliDate($date);
523
+			break;
524
+		default:
525
+			$caldate = new GregorianDate($date);
526 526
 		}
527 527
 
528 528
 		return $caldate;
Please login to merge, or discard this patch.
app/Controller/PedigreeController.php 1 patch
Switch Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -102,26 +102,26 @@  discard block
 block discarded – undo
102 102
 
103 103
 		$this->arrows = new \stdClass();
104 104
 		switch ($this->orientation) {
105
-			case self::PORTRAIT:
106
-				//drop through
107
-			case self::LANDSCAPE:
108
-				$this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow';
109
-				$this->arrows->menu    = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow';
110
-				$addoffset['x']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
111
-				$addoffset['y']        = 0;
112
-				break;
113
-			case self::OLDEST_AT_TOP:
114
-				$this->arrows->prevGen = 'icon-uarrow';
115
-				$this->arrows->menu    = 'icon-darrow';
116
-				$addoffset['x']        = 0;
117
-				$addoffset['y']        = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0;
118
-				break;
119
-			case self::OLDEST_AT_BOTTOM:
120
-				$this->arrows->prevGen = 'icon-darrow';
121
-				$this->arrows->menu    = 'icon-uarrow';
122
-				$addoffset['x']        = 0;
123
-				$addoffset['y']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
124
-				break;
105
+		case self::PORTRAIT:
106
+			//drop through
107
+		case self::LANDSCAPE:
108
+			$this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow';
109
+			$this->arrows->menu    = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow';
110
+			$addoffset['x']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
111
+			$addoffset['y']        = 0;
112
+			break;
113
+		case self::OLDEST_AT_TOP:
114
+			$this->arrows->prevGen = 'icon-uarrow';
115
+			$this->arrows->menu    = 'icon-darrow';
116
+			$addoffset['x']        = 0;
117
+			$addoffset['y']        = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0;
118
+			break;
119
+		case self::OLDEST_AT_BOTTOM:
120
+			$this->arrows->prevGen = 'icon-darrow';
121
+			$this->arrows->menu    = 'icon-uarrow';
122
+			$addoffset['x']        = 0;
123
+			$addoffset['y']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
124
+			break;
125 125
 		}
126 126
 
127 127
 		// -- this next section will create and position the DIV layers for the pedigree tree
@@ -150,73 +150,73 @@  discard block
 block discarded – undo
150 150
 
151 151
 			// -- calculate the xoffset
152 152
 			switch ($this->orientation) {
153
-				case self::PORTRAIT:
154
-					$xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8);
155
-					if(!$i && $this->root->getSpouseFamilies()) {
156
-						$xoffset -= self::ARROW_SIZE;
153
+			case self::PORTRAIT:
154
+				$xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8);
155
+				if(!$i && $this->root->getSpouseFamilies()) {
156
+					$xoffset -= self::ARROW_SIZE;
157
+				}
158
+				// -- compact the tree
159
+				if ($curgen < $this->generations) {
160
+					if ($i % 2 == 0) {
161
+						$yoffset = $yoffset - (($boxspacing / 2) * ($curgen - 1));
162
+					} else {
163
+						$yoffset = $yoffset + (($boxspacing / 2) * ($curgen - 1));
157 164
 					}
158
-					// -- compact the tree
159
-					if ($curgen < $this->generations) {
160
-						if ($i % 2 == 0) {
161
-							$yoffset = $yoffset - (($boxspacing / 2) * ($curgen - 1));
165
+					$parent = (int) (($i - 1) / 2);
166
+					$pgen   = $curgen;
167
+					while ($parent > 0) {
168
+						if ($parent % 2 == 0) {
169
+							$yoffset = $yoffset - (($boxspacing / 2) * $pgen);
162 170
 						} else {
163
-							$yoffset = $yoffset + (($boxspacing / 2) * ($curgen - 1));
164
-						}
165
-						$parent = (int) (($i - 1) / 2);
166
-						$pgen   = $curgen;
167
-						while ($parent > 0) {
168
-							if ($parent % 2 == 0) {
169
-								$yoffset = $yoffset - (($boxspacing / 2) * $pgen);
170
-							} else {
171
-								$yoffset = $yoffset + (($boxspacing / 2) * $pgen);
172
-							}
173
-							$pgen++;
174
-							if ($pgen > 3) {
175
-								$temp = 0;
176
-								for ($j = 1; $j < ($pgen - 2); $j++) {
177
-									$temp += (pow(2, $j) - 1);
178
-								}
179
-								if ($parent % 2 == 0) {
180
-									$yoffset = $yoffset - (($boxspacing / 2) * $temp);
181
-								} else {
182
-									$yoffset = $yoffset + (($boxspacing / 2) * $temp);
183
-								}
184
-							}
185
-							$parent = (int) (($parent - 1) / 2);
171
+							$yoffset = $yoffset + (($boxspacing / 2) * $pgen);
186 172
 						}
187
-						if ($curgen > 3) {
173
+						$pgen++;
174
+						if ($pgen > 3) {
188 175
 							$temp = 0;
189
-							for ($j = 1; $j < ($curgen - 2); $j++) {
176
+							for ($j = 1; $j < ($pgen - 2); $j++) {
190 177
 								$temp += (pow(2, $j) - 1);
191 178
 							}
192
-							if ($i % 2 == 0) {
179
+							if ($parent % 2 == 0) {
193 180
 								$yoffset = $yoffset - (($boxspacing / 2) * $temp);
194 181
 							} else {
195 182
 								$yoffset = $yoffset + (($boxspacing / 2) * $temp);
196 183
 							}
197 184
 						}
185
+						$parent = (int) (($parent - 1) / 2);
198 186
 					}
199
-					$yoffset -= (($boxspacing / 2) * pow(2, ($this->generations - 2)) - ($boxspacing / 2));
200
-					break;
201
-				case self::LANDSCAPE:
202
-					$xoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->width + $bxspacing);
203
-					if ($curgen == 1) {
204
-						$xoffset += 10;
205
-					}
206
-					break;
207
-				case self::OLDEST_AT_TOP:
208
-					//swap x & y offsets as chart is rotated
209
-					$xoffset = $yoffset;
210
-					$yoffset = $curgen  * ($this->getBoxDimensions()->height + ($byspacing * 4));
211
-					break;
212
-				case self::OLDEST_AT_BOTTOM:
213
-					//swap x & y offsets as chart is rotated
214
-					$xoffset = $yoffset;
215
-					$yoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->height + ($byspacing * 2));
216
-					if ($i && $this->root->getSpouseFamilies()) {
217
-						$yoffset += self::ARROW_SIZE;
187
+					if ($curgen > 3) {
188
+						$temp = 0;
189
+						for ($j = 1; $j < ($curgen - 2); $j++) {
190
+							$temp += (pow(2, $j) - 1);
191
+						}
192
+						if ($i % 2 == 0) {
193
+							$yoffset = $yoffset - (($boxspacing / 2) * $temp);
194
+						} else {
195
+							$yoffset = $yoffset + (($boxspacing / 2) * $temp);
196
+						}
218 197
 					}
219
-					break;
198
+				}
199
+				$yoffset -= (($boxspacing / 2) * pow(2, ($this->generations - 2)) - ($boxspacing / 2));
200
+				break;
201
+			case self::LANDSCAPE:
202
+				$xoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->width + $bxspacing);
203
+				if ($curgen == 1) {
204
+					$xoffset += 10;
205
+				}
206
+				break;
207
+			case self::OLDEST_AT_TOP:
208
+				//swap x & y offsets as chart is rotated
209
+				$xoffset = $yoffset;
210
+				$yoffset = $curgen  * ($this->getBoxDimensions()->height + ($byspacing * 4));
211
+				break;
212
+			case self::OLDEST_AT_BOTTOM:
213
+				//swap x & y offsets as chart is rotated
214
+				$xoffset = $yoffset;
215
+				$yoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->height + ($byspacing * 2));
216
+				if ($i && $this->root->getSpouseFamilies()) {
217
+					$yoffset += self::ARROW_SIZE;
218
+				}
219
+				break;
220 220
 			}
221 221
 			$this->nodes[$i]["x"] = (int) $xoffset;
222 222
 			$this->nodes[$i]["y"] = (int) $yoffset;
Please login to merge, or discard this patch.
app/Functions/FunctionsDate.php 1 patch
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -32,32 +32,32 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function getAgeAtEvent($age_string, $show_years) {
34 34
 		switch (strtoupper($age_string)) {
35
-			case 'CHILD':
36
-				return I18N::translate('Child');
37
-			case 'INFANT':
38
-				return I18N::translate('Infant');
39
-			case 'STILLBORN':
40
-				return I18N::translate('Stillborn');
41
-			default:
42
-				return preg_replace_callback(
43
-					array(
44
-						'/(\d+)([ymwd])/',
45
-					),
46
-					function ($match) use ($age_string, $show_years) {
47
-						switch ($match[2]) {
48
-							case 'y':
49
-								if ($show_years || preg_match('/[dm]/', $age_string)) {
50
-									return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1]));
51
-								} else {
52
-									return I18N::digits($match[1]);
53
-								}
54
-							case 'm':
55
-								return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1]));
56
-							case 'w':
57
-								return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1]));
58
-							case 'd':
59
-								return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1]));
60
-						}
35
+		case 'CHILD':
36
+			return I18N::translate('Child');
37
+		case 'INFANT':
38
+			return I18N::translate('Infant');
39
+		case 'STILLBORN':
40
+			return I18N::translate('Stillborn');
41
+		default:
42
+			return preg_replace_callback(
43
+				array(
44
+					'/(\d+)([ymwd])/',
45
+				),
46
+				function ($match) use ($age_string, $show_years) {
47
+					switch ($match[2]) {
48
+					case 'y':
49
+					if ($show_years || preg_match('/[dm]/', $age_string)) {
50
+					return I18N::plural('%s year', '%s years', $match[1], I18N::digits($match[1]));
51
+					} else {
52
+					return I18N::digits($match[1]);
53
+					}
54
+					case 'm':
55
+					return I18N::plural('%s month', '%s months', $match[1], I18N::digits($match[1]));
56
+					case 'w':
57
+					return I18N::plural('%s week', '%s weeks', $match[1], I18N::digits($match[1]));
58
+					case 'd':
59
+					return I18N::plural('%s day', '%s days', $match[1], I18N::digits($match[1]));
60
+					}
61 61
 					},
62 62
 					$age_string
63 63
 				);
@@ -79,40 +79,40 @@  discard block
 block discarded – undo
79 79
 		preg_match_all('/%[^%]/', $time_fmt, $matches);
80 80
 		foreach ($matches[0] as $match) {
81 81
 			switch ($match) {
82
-				case '%a':
83
-					$t = gmdate('His', $time);
84
-					if ($t == '000000') {
85
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */
86
-							I18N::translate('midnight'), $time_fmt);
87
-					} elseif ($t < '120000') {
88
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */
89
-							I18N::translate('a.m.'), $time_fmt);
90
-					} elseif ($t == '120000') {
91
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */
92
-							I18N::translate('noon'), $time_fmt);
93
-					} else {
94
-						$time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */
95
-							I18N::translate('p.m.'), $time_fmt);
96
-					}
97
-					break;
98
-				case '%A':
99
-					$t = gmdate('His', $time);
100
-					if ($t == '000000') {
101
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */
102
-							I18N::translate('Midnight'), $time_fmt);
103
-					} elseif ($t < '120000') {
104
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */
105
-							I18N::translate('A.M.'), $time_fmt);
106
-					} elseif ($t == '120000') {
107
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */
108
-							I18N::translate('Noon'), $time_fmt);
109
-					} else {
110
-						$time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */
111
-							I18N::translate('P.M.'), $time_fmt);
112
-					}
113
-					break;
114
-				default:
115
-					$time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
82
+			case '%a':
83
+				$t = gmdate('His', $time);
84
+				if ($t == '000000') {
85
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */
86
+						I18N::translate('midnight'), $time_fmt);
87
+				} elseif ($t < '120000') {
88
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */
89
+						I18N::translate('a.m.'), $time_fmt);
90
+				} elseif ($t == '120000') {
91
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */
92
+						I18N::translate('noon'), $time_fmt);
93
+				} else {
94
+					$time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */
95
+						I18N::translate('p.m.'), $time_fmt);
96
+				}
97
+				break;
98
+			case '%A':
99
+				$t = gmdate('His', $time);
100
+				if ($t == '000000') {
101
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */
102
+						I18N::translate('Midnight'), $time_fmt);
103
+				} elseif ($t < '120000') {
104
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */
105
+						I18N::translate('A.M.'), $time_fmt);
106
+				} elseif ($t == '120000') {
107
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */
108
+						I18N::translate('Noon'), $time_fmt);
109
+				} else {
110
+					$time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */
111
+						I18N::translate('P.M.'), $time_fmt);
112
+				}
113
+				break;
114
+			default:
115
+				$time_fmt = str_replace($match, I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
116 116
 			}
117 117
 		}
118 118
 
Please login to merge, or discard this patch.
app/Functions/FunctionsDb.php 1 patch
Switch Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -248,18 +248,18 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public static function searchIndividualsPhonetic($soundex, $lastname, $firstname, $place, array $trees) {
250 250
 		switch ($soundex) {
251
-			case 'Russell':
252
-				$givn_sdx = Soundex::russell($firstname);
253
-				$surn_sdx = Soundex::russell($lastname);
254
-				$plac_sdx = Soundex::russell($place);
255
-				break;
256
-			case 'DaitchM':
257
-				$givn_sdx = Soundex::daitchMokotoff($firstname);
258
-				$surn_sdx = Soundex::daitchMokotoff($lastname);
259
-				$plac_sdx = Soundex::daitchMokotoff($place);
260
-				break;
261
-			default:
262
-				throw new \DomainException('soundex: ' . $soundex);
251
+		case 'Russell':
252
+			$givn_sdx = Soundex::russell($firstname);
253
+			$surn_sdx = Soundex::russell($lastname);
254
+			$plac_sdx = Soundex::russell($place);
255
+			break;
256
+		case 'DaitchM':
257
+			$givn_sdx = Soundex::daitchMokotoff($firstname);
258
+			$surn_sdx = Soundex::daitchMokotoff($lastname);
259
+			$plac_sdx = Soundex::daitchMokotoff($place);
260
+			break;
261
+		default:
262
+			throw new \DomainException('soundex: ' . $soundex);
263 263
 		}
264 264
 
265 265
 		// Nothing to search for?  Return nothing.
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 			foreach ($givn_sdx as $n => $sdx) {
292 292
 				$sql .= $n ? " OR " : "";
293 293
 				switch ($soundex) {
294
-					case 'Russell':
295
-						$sql .= "n_soundex_givn_std LIKE CONCAT('%', :given_name_" . $n . ", '%')";
296
-						break;
297
-					case 'DaitchM':
298
-						$sql .= "n_soundex_givn_dm LIKE CONCAT('%', :given_name_" . $n . ", '%')";
299
-						break;
294
+				case 'Russell':
295
+					$sql .= "n_soundex_givn_std LIKE CONCAT('%', :given_name_" . $n . ", '%')";
296
+					break;
297
+				case 'DaitchM':
298
+					$sql .= "n_soundex_givn_dm LIKE CONCAT('%', :given_name_" . $n . ", '%')";
299
+					break;
300 300
 				}
301 301
 				$args['given_name_' . $n] = $sdx;
302 302
 			}
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
 			foreach ($surn_sdx as $n => $sdx) {
310 310
 				$sql .= $n ? " OR " : "";
311 311
 				switch ($soundex) {
312
-					case 'Russell':
313
-						$sql .= "n_soundex_surn_std LIKE CONCAT('%', :surname_" . $n . ", '%')";
314
-						break;
315
-					case 'DaitchM':
316
-						$sql .= "n_soundex_surn_dm LIKE CONCAT('%', :surname_" . $n . ", '%')";
317
-						break;
312
+				case 'Russell':
313
+					$sql .= "n_soundex_surn_std LIKE CONCAT('%', :surname_" . $n . ", '%')";
314
+					break;
315
+				case 'DaitchM':
316
+					$sql .= "n_soundex_surn_dm LIKE CONCAT('%', :surname_" . $n . ", '%')";
317
+					break;
318 318
 				}
319 319
 				$args['surname_' . $n] = $sdx;
320 320
 			}
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 			foreach ($plac_sdx as $n => $sdx) {
328 328
 				$sql .= $n ? " OR " : "";
329 329
 				switch ($soundex) {
330
-					case 'Russell':
331
-						$sql .= "p_std_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
332
-						break;
333
-					case 'DaitchM':
334
-						$sql .= "p_dm_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
335
-						break;
330
+				case 'Russell':
331
+					$sql .= "p_std_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
332
+					break;
333
+				case 'DaitchM':
334
+					$sql .= "p_dm_soundex LIKE CONCAT('%', :place_" . $n . ", '%')";
335
+					break;
336 336
 				}
337 337
 				$args['place_' . $n] = $sdx;
338 338
 			}
@@ -790,82 +790,82 @@  discard block
 block discarded – undo
790 790
 			} else {
791 791
 				// SPECIAL CASES:
792 792
 				switch ($anniv->m) {
793
-					case 2:
794
-						// 29 CSH does not include 30 CSH (but would include an invalid 31 CSH if there were no 30 CSH)
795
-						if ($anniv->d === 1) {
796
-							$where .= " AND d_day <= 1 AND d_mon = 2";
797
-						} elseif ($anniv->d === 30) {
798
-							$where .= " AND d_day >= 30 AND d_mon = 2";
799
-						} elseif ($anniv->d === 29 && $anniv->daysInMonth() === 29) {
800
-							$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 2";
801
-						} else {
802
-							$where .= " AND d_day = :day AND d_mon = 2";
803
-							$args['day'] = $anniv->d;
804
-						}
805
-						break;
806
-					case 3:
807
-						// 1 KSL includes 30 CSH (if this year didn’t have 30 CSH)
808
-						// 29 KSL does not include 30 KSL (but would include an invalid 31 KSL if there were no 30 KSL)
809
-						if ($anniv->d === 1) {
810
-							$tmp = new JewishDate(array($anniv->y, 'CSH', 1));
811
-							if ($tmp->daysInMonth() === 29) {
812
-								$where .= " AND (d_day <= 1 AND d_mon = 3 OR d_day = 30 AND d_mon = 2)";
813
-							} else {
814
-								$where .= " AND d_day <= 1 AND d_mon = 3";
815
-							}
816
-						} elseif ($anniv->d === 30) {
817
-							$where .= " AND d_day >= 30 AND d_mon = 3";
818
-						} elseif ($anniv->d == 29 && $anniv->daysInMonth() === 29) {
819
-							$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 3";
820
-						} else {
821
-							$where .= " AND d_day = :day AND d_mon = 3";
822
-							$args['day'] = $anniv->d;
823
-						}
824
-						break;
825
-					case 4:
826
-						// 1 TVT includes 30 KSL (if this year didn’t have 30 KSL)
827
-						if ($anniv->d === 1) {
828
-							$tmp = new JewishDate(array($anniv->y, 'KSL', 1));
829
-							if ($tmp->daysInMonth() === 29) {
830
-								$where .= " AND (d_day <=1 AND d_mon = 4 OR d_day = 30 AND d_mon = 3)";
831
-							} else {
832
-								$where .= " AND d_day <= 1 AND d_mon = 4";
833
-							}
834
-						} elseif ($anniv->d === $anniv->daysInMonth()) {
835
-							$where .= " AND d_day >= :day AND d_mon=4";
836
-							$args['day'] = $anniv->d;
793
+				case 2:
794
+					// 29 CSH does not include 30 CSH (but would include an invalid 31 CSH if there were no 30 CSH)
795
+					if ($anniv->d === 1) {
796
+						$where .= " AND d_day <= 1 AND d_mon = 2";
797
+					} elseif ($anniv->d === 30) {
798
+						$where .= " AND d_day >= 30 AND d_mon = 2";
799
+					} elseif ($anniv->d === 29 && $anniv->daysInMonth() === 29) {
800
+						$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 2";
801
+					} else {
802
+						$where .= " AND d_day = :day AND d_mon = 2";
803
+						$args['day'] = $anniv->d;
804
+					}
805
+					break;
806
+				case 3:
807
+					// 1 KSL includes 30 CSH (if this year didn’t have 30 CSH)
808
+					// 29 KSL does not include 30 KSL (but would include an invalid 31 KSL if there were no 30 KSL)
809
+					if ($anniv->d === 1) {
810
+						$tmp = new JewishDate(array($anniv->y, 'CSH', 1));
811
+						if ($tmp->daysInMonth() === 29) {
812
+							$where .= " AND (d_day <= 1 AND d_mon = 3 OR d_day = 30 AND d_mon = 2)";
837 813
 						} else {
838
-							$where .= " AND d_day = :day AND d_mon=4";
839
-							$args['day'] = $anniv->d;
814
+							$where .= " AND d_day <= 1 AND d_mon = 3";
840 815
 						}
841
-						break;
842
-					case 7: // ADS includes ADR (non-leap)
843
-						if ($anniv->d === 1) {
844
-							$where .= " AND d_day <= 1";
845
-						} elseif ($anniv->d === $anniv->daysInMonth()) {
846
-							$where .= " AND d_day >= :day";
847
-							$args['day'] = $anniv->d;
816
+					} elseif ($anniv->d === 30) {
817
+						$where .= " AND d_day >= 30 AND d_mon = 3";
818
+					} elseif ($anniv->d == 29 && $anniv->daysInMonth() === 29) {
819
+						$where .= " AND (d_day = 29 OR d_day > 30) AND d_mon = 3";
820
+					} else {
821
+						$where .= " AND d_day = :day AND d_mon = 3";
822
+						$args['day'] = $anniv->d;
823
+					}
824
+					break;
825
+				case 4:
826
+					// 1 TVT includes 30 KSL (if this year didn’t have 30 KSL)
827
+					if ($anniv->d === 1) {
828
+						$tmp = new JewishDate(array($anniv->y, 'KSL', 1));
829
+						if ($tmp->daysInMonth() === 29) {
830
+							$where .= " AND (d_day <=1 AND d_mon = 4 OR d_day = 30 AND d_mon = 3)";
848 831
 						} else {
849
-							$where .= " AND d_day = :day";
850
-							$args['day'] = $anniv->d;
832
+							$where .= " AND d_day <= 1 AND d_mon = 4";
851 833
 						}
852
-						$where .= " AND (d_mon = 6 AND MOD(7 * d_year + 1, 19) >= 7 OR d_mon = 7)";
853
-						break;
854
-					case 8: // 1 NSN includes 30 ADR, if this year is non-leap
855
-						if ($anniv->d === 1) {
856
-							if ($anniv->isLeapYear()) {
857
-								$where .= " AND d_day <= 1 AND d_mon = 8";
858
-							} else {
859
-								$where .= " AND (d_day <= 1 AND d_mon = 8 OR d_day = 30 AND d_mon = 6)";
860
-							}
861
-						} elseif ($anniv->d === $anniv->daysInMonth()) {
862
-							$where .= " AND d_day >= :day AND d_mon = 8";
863
-							$args['day'] = $anniv->d;
834
+					} elseif ($anniv->d === $anniv->daysInMonth()) {
835
+						$where .= " AND d_day >= :day AND d_mon=4";
836
+						$args['day'] = $anniv->d;
837
+					} else {
838
+						$where .= " AND d_day = :day AND d_mon=4";
839
+						$args['day'] = $anniv->d;
840
+					}
841
+					break;
842
+				case 7: // ADS includes ADR (non-leap)
843
+					if ($anniv->d === 1) {
844
+						$where .= " AND d_day <= 1";
845
+					} elseif ($anniv->d === $anniv->daysInMonth()) {
846
+						$where .= " AND d_day >= :day";
847
+						$args['day'] = $anniv->d;
848
+					} else {
849
+						$where .= " AND d_day = :day";
850
+						$args['day'] = $anniv->d;
851
+					}
852
+					$where .= " AND (d_mon = 6 AND MOD(7 * d_year + 1, 19) >= 7 OR d_mon = 7)";
853
+					break;
854
+				case 8: // 1 NSN includes 30 ADR, if this year is non-leap
855
+					if ($anniv->d === 1) {
856
+						if ($anniv->isLeapYear()) {
857
+							$where .= " AND d_day <= 1 AND d_mon = 8";
864 858
 						} else {
865
-							$where .= " AND d_day = :day AND d_mon = 8";
866
-							$args['day'] = $anniv->d;
859
+							$where .= " AND (d_day <= 1 AND d_mon = 8 OR d_day = 30 AND d_mon = 6)";
867 860
 						}
868
-						break;
861
+					} elseif ($anniv->d === $anniv->daysInMonth()) {
862
+						$where .= " AND d_day >= :day AND d_mon = 8";
863
+						$args['day'] = $anniv->d;
864
+					} else {
865
+						$where .= " AND d_day = :day AND d_mon = 8";
866
+						$args['day'] = $anniv->d;
867
+					}
868
+					break;
869 869
 				}
870 870
 			}
871 871
 			// Only events in the past (includes dates without a year)
Please login to merge, or discard this patch.
app/Functions/FunctionsExport.php 1 patch
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public static function exportGedcom(Tree $tree, $gedout, $exportOptions) {
185 185
 		switch ($exportOptions['privatize']) {
186
-			case 'gedadmin':
187
-				$access_level = Auth::PRIV_NONE;
188
-				break;
189
-			case 'user':
190
-				$access_level = Auth::PRIV_USER;
191
-				break;
192
-			case 'visitor':
193
-				$access_level = Auth::PRIV_PRIVATE;
194
-				break;
195
-			case 'none':
196
-				$access_level = Auth::PRIV_HIDE;
197
-				break;
186
+		case 'gedadmin':
187
+			$access_level = Auth::PRIV_NONE;
188
+			break;
189
+		case 'user':
190
+			$access_level = Auth::PRIV_USER;
191
+			break;
192
+		case 'visitor':
193
+			$access_level = Auth::PRIV_PRIVATE;
194
+			break;
195
+		case 'none':
196
+			$access_level = Auth::PRIV_HIDE;
197
+			break;
198 198
 		}
199 199
 
200 200
 		$head = self::gedcomHeader($tree);
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 
252 252
 		foreach ($rows as $row) {
253 253
 			switch ($row->type) {
254
-				case 'NOTE':
255
-					$record = Note::getInstance($row->xref, $tree, $row->gedcom);
256
-					break;
257
-				case 'REPO':
258
-					$record = Repository::getInstance($row->xref, $tree, $row->gedcom);
259
-					break;
260
-				default:
261
-					$record = GedcomRecord::getInstance($row->xref, $tree, $row->gedcom);
262
-					break;
254
+			case 'NOTE':
255
+				$record = Note::getInstance($row->xref, $tree, $row->gedcom);
256
+				break;
257
+			case 'REPO':
258
+				$record = Repository::getInstance($row->xref, $tree, $row->gedcom);
259
+				break;
260
+			default:
261
+				$record = GedcomRecord::getInstance($row->xref, $tree, $row->gedcom);
262
+				break;
263 263
 			}
264 264
 
265 265
 			$rec = $record->privatizeGedcom($access_level);
Please login to merge, or discard this patch.
app/Functions/FunctionsMedia.php 1 patch
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,17 +34,17 @@
 block discarded – undo
34 34
 			$val = -1;
35 35
 		}
36 36
 		switch (substr($val, -1)) {
37
-			case 'g':
38
-			case 'G':
39
-				return (int) $val * 1024 * 1024 * 1024;
40
-			case 'm':
41
-			case 'M':
42
-				return (int) $val * 1024 * 1024;
43
-			case 'k':
44
-			case 'K':
45
-				return (int) $val * 1024;
46
-			default:
47
-				return (int) $val;
37
+		case 'g':
38
+		case 'G':
39
+			return (int) $val * 1024 * 1024 * 1024;
40
+		case 'm':
41
+		case 'M':
42
+			return (int) $val * 1024 * 1024;
43
+		case 'k':
44
+		case 'K':
45
+			return (int) $val * 1024;
46
+		default:
47
+			return (int) $val;
48 48
 		}
49 49
 	}
50 50
 
Please login to merge, or discard this patch.
app/Functions/FunctionsPrint.php 1 patch
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 	public static function printPedigreePerson(Individual $person = null, $show_full = 1) {
51 51
 
52 52
 		switch ($show_full) {
53
-			case 0:
54
-				if ($person) {
55
-					echo Theme::theme()->individualBoxSmall($person);
56
-				} else {
57
-					echo Theme::theme()->individualBoxSmallEmpty();
58
-				}
59
-				break;
60
-			case 1:
61
-				if ($person) {
62
-					echo Theme::theme()->individualBox($person);
63
-				} else {
64
-					echo Theme::theme()->individualBoxEmpty();
65
-				}
66
-				break;
53
+		case 0:
54
+			if ($person) {
55
+				echo Theme::theme()->individualBoxSmall($person);
56
+			} else {
57
+				echo Theme::theme()->individualBoxSmallEmpty();
58
+			}
59
+			break;
60
+		case 1:
61
+			if ($person) {
62
+				echo Theme::theme()->individualBox($person);
63
+			} else {
64
+				echo Theme::theme()->individualBoxEmpty();
65
+			}
66
+			break;
67 67
 		}
68 68
 	}
69 69
 
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
 					$age      = Date::getAge($parent->getBirthDate(), $birth_date, 2);
260 260
 					$deatdate = $parent->getDeathDate();
261 261
 					switch ($parent->getSex()) {
262
-						case 'F':
263
-							// Highlight mothers who die in childbirth or shortly afterwards
264
-							if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay() + 90) {
265
-								$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
266
-							} else {
267
-								$html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>';
268
-							}
269
-							break;
270
-						case 'M':
271
-							// Highlight fathers who die before the birth
272
-							if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay()) {
273
-								$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
274
-							} else {
275
-								$html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>';
276
-							}
277
-							break;
278
-						default:
279
-							$html .= ' <span title="' . I18N::translate('Parent’s age') . '">' . $sex . $age . '</span>';
280
-							break;
262
+					case 'F':
263
+						// Highlight mothers who die in childbirth or shortly afterwards
264
+						if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay() + 90) {
265
+							$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
266
+						} else {
267
+							$html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>';
268
+						}
269
+						break;
270
+					case 'M':
271
+						// Highlight fathers who die before the birth
272
+						if ($deatdate->isOK() && $deatdate->maximumJulianDay() < $birth_date->minimumJulianDay()) {
273
+							$html .= ' <span title="' . GedcomTag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>';
274
+						} else {
275
+							$html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>';
276
+						}
277
+						break;
278
+					default:
279
+						$html .= ' <span title="' . I18N::translate('Parent’s age') . '">' . $sex . $age . '</span>';
280
+						break;
281 281
 					}
282 282
 				}
283 283
 			}
@@ -578,33 +578,33 @@  discard block
 block discarded – undo
578 578
 
579 579
 		// -- Add from pick list
580 580
 		switch ($type) {
581
-			case "INDI":
582
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
583
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
584
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
585
-				break;
586
-			case "FAM":
587
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
588
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
589
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
590
-				break;
591
-			case "SOUR":
592
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
593
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
594
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
595
-				break;
596
-			case "NOTE":
597
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
598
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
599
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
600
-				break;
601
-			case "REPO":
602
-				$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
603
-				$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
604
-				$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
605
-				break;
606
-			default:
607
-				return;
581
+		case "INDI":
582
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
583
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
584
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('INDI_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
585
+			break;
586
+		case "FAM":
587
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
588
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
589
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('FAM_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
590
+			break;
591
+		case "SOUR":
592
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
593
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
594
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('SOUR_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
595
+			break;
596
+		case "NOTE":
597
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
598
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
599
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('NOTE_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
600
+			break;
601
+		case "REPO":
602
+			$addfacts    = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
603
+			$uniquefacts = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
604
+			$quickfacts  = preg_split("/[, ;:]+/", $WT_TREE->getPreference('REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
605
+			break;
606
+		default:
607
+			return;
608 608
 		}
609 609
 		$addfacts            = array_merge(self::checkFactUnique($uniquefacts, $usedfacts, $type), $addfacts);
610 610
 		$quickfacts          = array_intersect($quickfacts, $addfacts);
Please login to merge, or discard this patch.
app/Functions/FunctionsPrintLists.php 1 patch
Switch Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1687,37 +1687,37 @@  discard block
 block discarded – undo
1687 1687
 
1688 1688
 		}
1689 1689
 		switch ($style) {
1690
-			case 1:
1691
-				return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
1692
-			case 2:
1693
-				return implode(I18N::$list_separator, $html);
1694
-			case 3:
1695
-				$i     = 0;
1696
-				$count = count($html);
1697
-				if ($count > 36) {
1698
-					$col = 4;
1699
-				} elseif ($count > 18) {
1700
-					$col = 3;
1701
-				} elseif ($count > 6) {
1702
-					$col = 2;
1703
-				} else {
1704
-					$col = 1;
1705
-				}
1706
-				$newcol = ceil($count / $col);
1707
-				$html2  = '<table class="list_table"><tr>';
1708
-				$html2 .= '<td class="list_value" style="padding: 14px;">';
1709
-
1710
-				foreach ($html as $surns) {
1711
-					$html2 .= $surns . '<br>';
1712
-					$i++;
1713
-					if ($i == $newcol && $i < $count) {
1714
-						$html2 .= '</td><td class="list_value" style="padding: 14px;">';
1715
-						$newcol = $i + ceil($count / $col);
1716
-					}
1690
+		case 1:
1691
+			return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
1692
+		case 2:
1693
+			return implode(I18N::$list_separator, $html);
1694
+		case 3:
1695
+			$i     = 0;
1696
+			$count = count($html);
1697
+			if ($count > 36) {
1698
+				$col = 4;
1699
+			} elseif ($count > 18) {
1700
+				$col = 3;
1701
+			} elseif ($count > 6) {
1702
+				$col = 2;
1703
+			} else {
1704
+				$col = 1;
1705
+			}
1706
+			$newcol = ceil($count / $col);
1707
+			$html2  = '<table class="list_table"><tr>';
1708
+			$html2 .= '<td class="list_value" style="padding: 14px;">';
1709
+
1710
+			foreach ($html as $surns) {
1711
+				$html2 .= $surns . '<br>';
1712
+				$i++;
1713
+				if ($i == $newcol && $i < $count) {
1714
+					$html2 .= '</td><td class="list_value" style="padding: 14px;">';
1715
+					$newcol = $i + ceil($count / $col);
1717 1716
 				}
1718
-				$html2 .= '</td></tr></table>';
1717
+			}
1718
+			$html2 .= '</td></tr></table>';
1719 1719
 
1720
-				return $html2;
1720
+			return $html2;
1721 1721
 		}
1722 1722
 	}
1723 1723
 
@@ -1747,15 +1747,15 @@  discard block
 block discarded – undo
1747 1747
 		}
1748 1748
 
1749 1749
 		switch ($sort) {
1750
-			case 'name':
1751
-				uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSortName');
1752
-				break;
1753
-			case 'date_asc':
1754
-				uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1755
-				$arr = array_reverse($arr);
1756
-				break;
1757
-			case 'date_desc':
1758
-				uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1750
+		case 'name':
1751
+			uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSortName');
1752
+			break;
1753
+		case 'date_asc':
1754
+			uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1755
+			$arr = array_reverse($arr);
1756
+			break;
1757
+		case 'date_desc':
1758
+			uasort($arr, '\Fisharebest\Webtrees\Functions\Functions::eventSort');
1759 1759
 		}
1760 1760
 		$html = '';
1761 1761
 		foreach ($arr as $value) {
@@ -1788,15 +1788,15 @@  discard block
 block discarded – undo
1788 1788
 		$n        = 0;
1789 1789
 		$table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
1790 1790
 		switch ($sort) {
1791
-			case 'name':        //name
1792
-				$aaSorting = "[5,'asc'], [4,'desc']";
1793
-				break;
1794
-			case 'date_asc':    //date ascending
1795
-				$aaSorting = "[4,'asc'], [5,'asc']";
1796
-				break;
1797
-			case 'date_desc':   //date descending
1798
-				$aaSorting = "[4,'desc'], [5,'asc']";
1799
-				break;
1791
+		case 'name':        //name
1792
+			$aaSorting = "[5,'asc'], [4,'desc']";
1793
+			break;
1794
+		case 'date_asc':    //date ascending
1795
+			$aaSorting = "[4,'asc'], [5,'asc']";
1796
+			break;
1797
+		case 'date_desc':   //date descending
1798
+			$aaSorting = "[4,'desc'], [5,'asc']";
1799
+			break;
1800 1800
 		}
1801 1801
 		$html = '';
1802 1802
 		$controller
@@ -1843,27 +1843,27 @@  discard block
 block discarded – undo
1843 1843
 			}
1844 1844
 			$html .= '<tr><td>';
1845 1845
 			switch ($record::RECORD_TYPE) {
1846
-				case 'INDI':
1847
-					$icon = $record->getSexImage('small');
1848
-					break;
1849
-				case 'FAM':
1850
-					$icon = '<i class="icon-button_family"></i>';
1851
-					break;
1852
-				case 'OBJE':
1853
-					$icon = '<i class="icon-button_media"></i>';
1854
-					break;
1855
-				case 'NOTE':
1856
-					$icon = '<i class="icon-button_note"></i>';
1857
-					break;
1858
-				case 'SOUR':
1859
-					$icon = '<i class="icon-button_source"></i>';
1860
-					break;
1861
-				case 'REPO':
1862
-					$icon = '<i class="icon-button_repository"></i>';
1863
-					break;
1864
-				default:
1865
-					$icon = '&nbsp;';
1866
-					break;
1846
+			case 'INDI':
1847
+				$icon = $record->getSexImage('small');
1848
+				break;
1849
+			case 'FAM':
1850
+				$icon = '<i class="icon-button_family"></i>';
1851
+				break;
1852
+			case 'OBJE':
1853
+				$icon = '<i class="icon-button_media"></i>';
1854
+				break;
1855
+			case 'NOTE':
1856
+				$icon = '<i class="icon-button_note"></i>';
1857
+				break;
1858
+			case 'SOUR':
1859
+				$icon = '<i class="icon-button_source"></i>';
1860
+				break;
1861
+			case 'REPO':
1862
+				$icon = '<i class="icon-button_repository"></i>';
1863
+				break;
1864
+			default:
1865
+				$icon = '&nbsp;';
1866
+				break;
1867 1867
 			}
1868 1868
 			$html .= '<a href="' . $record->getHtmlUrl() . '">' . $icon . '</a>';
1869 1869
 			$html .= '</td>';
@@ -2092,14 +2092,14 @@  discard block
 block discarded – undo
2092 2092
 
2093 2093
 		// Now we've filtered the list, we can sort by event, if required
2094 2094
 		switch ($sort_by) {
2095
-			case 'anniv':
2096
-				// Data is already sorted by anniversary date
2097
-				break;
2098
-			case 'alpha':
2099
-				uasort($filtered_events, function (Fact $x, Fact $y) {
2100
-					return GedcomRecord::compare($x->getParent(), $y->getParent());
2101
-				});
2102
-				break;
2095
+		case 'anniv':
2096
+			// Data is already sorted by anniversary date
2097
+			break;
2098
+		case 'alpha':
2099
+			uasort($filtered_events, function (Fact $x, Fact $y) {
2100
+				return GedcomRecord::compare($x->getParent(), $y->getParent());
2101
+			});
2102
+			break;
2103 2103
 		}
2104 2104
 
2105 2105
 		foreach ($filtered_events as $fact) {
Please login to merge, or discard this patch.