Completed
Push — 1.7 ( bb708b...4a14f0 )
by Greg
08:24
created
app/Module/ClippingsCartModule.php 1 patch
Switch Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -75,37 +75,37 @@  discard block
 block discarded – undo
75 75
 		}
76 76
 
77 77
 		switch ($mod_action) {
78
-		case 'ajax':
79
-			$html = $this->getSidebarAjaxContent();
80
-			header('Content-Type: text/html; charset=UTF-8');
81
-			echo $html;
82
-			break;
83
-		case 'index':
84
-			global $controller, $WT_TREE;
85
-
86
-			$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
87
-
88
-			$clip_ctrl = new ClippingsCartController;
89
-			$cart      = Session::get('cart');
90
-
91
-			$controller = new PageController;
92
-			$controller
93
-				->setPageTitle($this->getTitle())
94
-				->pageHeader()
95
-				->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
96
-				->addInlineJavascript('autocomplete();');
97
-
98
-			echo '<script>';
99
-			echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
100
-			echo '</script>';
101
-
102
-			if (!$cart[$WT_TREE->getTreeId()]) {
103
-				echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
104
-			}
78
+			case 'ajax':
79
+				$html = $this->getSidebarAjaxContent();
80
+				header('Content-Type: text/html; charset=UTF-8');
81
+				echo $html;
82
+				break;
83
+			case 'index':
84
+				global $controller, $WT_TREE;
85
+
86
+				$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
87
+
88
+				$clip_ctrl = new ClippingsCartController;
89
+				$cart      = Session::get('cart');
90
+
91
+				$controller = new PageController;
92
+				$controller
93
+					->setPageTitle($this->getTitle())
94
+					->pageHeader()
95
+					->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
96
+					->addInlineJavascript('autocomplete();');
97
+
98
+				echo '<script>';
99
+				echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
100
+				echo '</script>';
101
+
102
+				if (!$cart[$WT_TREE->getTreeId()]) {
103
+					echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
104
+				}
105 105
 
106
-			if ($clip_ctrl->action == 'add') {
107
-				$record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
108
-				if ($clip_ctrl->type === 'FAM') { ?>
106
+				if ($clip_ctrl->action == 'add') {
107
+					$record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
108
+					if ($clip_ctrl->type === 'FAM') { ?>
109 109
 					<form action="module.php" method="get">
110 110
 						<input type="hidden" name="mod" value="clippings">
111 111
 						<input type="hidden" name="mod_action" value="index">
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
 									<td class="optionbox">
132 132
 										<input type="radio" name="others" value="members" checked>
133 133
 										<?php echo /* I18N: %s is a family (husband + wife) */
134
-										I18N::translate('%s and their children', $record->getFullName()); ?>
134
+											I18N::translate('%s and their children', $record->getFullName()); ?>
135 135
 									</td>
136 136
 								</tr>
137 137
 								<tr>
138 138
 									<td class="optionbox">
139 139
 										<input type="radio" name="others" value="descendants">
140 140
 										<?php echo /* I18N: %s is a family (husband + wife) */
141
-										I18N::translate('%s and their descendants', $record->getFullName()); ?>
141
+											I18N::translate('%s and their descendants', $record->getFullName()); ?>
142 142
 									</td>
143 143
 								</tr>
144 144
 							</tbody>
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 										<label>
180 180
 											<input type="radio" name="others" value="parents">
181 181
 											<?php
182
-											if ($record->getSex() === 'F') {
183
-												echo /* I18N: %s is a woman's name */
184
-												I18N::translate('%s, her parents and siblings', $record->getFullName());
185
-											} else {
186
-												echo /* I18N: %s is a man's name */
187
-												I18N::translate('%s, his parents and siblings', $record->getFullName());
188
-											}
189
-											?>
182
+												if ($record->getSex() === 'F') {
183
+													echo /* I18N: %s is a woman's name */
184
+													I18N::translate('%s, her parents and siblings', $record->getFullName());
185
+												} else {
186
+													echo /* I18N: %s is a man's name */
187
+													I18N::translate('%s, his parents and siblings', $record->getFullName());
188
+												}
189
+												?>
190 190
 										</label>
191 191
 									</td>
192 192
 								</tr>
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 										<label>
196 196
 											<input type="radio" name="others" value="members">
197 197
 											<?php
198
-											if ($record->getSex() === 'F') {
199
-												echo /* I18N: %s is a woman's name */
200
-												I18N::translate('%s, her spouses and children', $record->getFullName());
201
-											} else {
202
-												echo /* I18N: %s is a man's name */
203
-												I18N::translate('%s, his spouses and children', $record->getFullName());
204
-											}
205
-											?>
198
+												if ($record->getSex() === 'F') {
199
+													echo /* I18N: %s is a woman's name */
200
+													I18N::translate('%s, her spouses and children', $record->getFullName());
201
+												} else {
202
+													echo /* I18N: %s is a man's name */
203
+													I18N::translate('%s, his spouses and children', $record->getFullName());
204
+												}
205
+												?>
206 206
 										</label>
207 207
 									</td>
208 208
 								</tr>
@@ -211,18 +211,18 @@  discard block
 block discarded – undo
211 211
 										<label>
212 212
 											<input type="radio" name="others" value="ancestors" id="ancestors">
213 213
 											<?php
214
-											if ($record->getSex() === 'F') {
215
-												echo /* I18N: %s is a woman's name */
216
-												I18N::translate('%s and her ancestors', $record->getFullName());
217
-											} else {
218
-												echo /* I18N: %s is a man's name */
219
-												I18N::translate('%s and his ancestors', $record->getFullName());
220
-											}
221
-											?>
214
+												if ($record->getSex() === 'F') {
215
+													echo /* I18N: %s is a woman's name */
216
+													I18N::translate('%s and her ancestors', $record->getFullName());
217
+												} else {
218
+													echo /* I18N: %s is a man's name */
219
+													I18N::translate('%s and his ancestors', $record->getFullName());
220
+												}
221
+												?>
222 222
 										</label>
223 223
 										<br>
224 224
 										<?php echo I18N::translate('Number of generations'); ?>
225
-										<input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');">
225
+											<input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');">
226 226
 									</td>
227 227
 								</tr>
228 228
 								<tr>
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
 										<label>
231 231
 											<input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">
232 232
 											<?php
233
-											if ($record->getSex() === 'F') {
234
-												echo /* I18N: %s is a woman's name */
235
-												I18N::translate('%s, her ancestors and their families', $record->getFullName());
236
-											} else {
237
-												echo /* I18N: %s is a man's name */
238
-												I18N::translate('%s, his ancestors and their families', $record->getFullName());
239
-											}
240
-											?>
233
+												if ($record->getSex() === 'F') {
234
+													echo /* I18N: %s is a woman's name */
235
+													I18N::translate('%s, her ancestors and their families', $record->getFullName());
236
+												} else {
237
+													echo /* I18N: %s is a man's name */
238
+													I18N::translate('%s, his ancestors and their families', $record->getFullName());
239
+												}
240
+												?>
241 241
 										</label>
242 242
 										<br>
243 243
 										<?php echo I18N::translate('Number of generations'); ?>
244
-										<input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');">
244
+											<input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');">
245 245
 									</td>
246 246
 								</tr>
247 247
 								<tr>
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 										<label>
250 250
 											<input type="radio" name="others" value="descendants" id="descendants">
251 251
 											<?php
252
-											if ($record->getSex() === 'F') {
253
-												echo /* I18N: %s is a woman's name */
254
-												I18N::translate('%s, her spouses and descendants', $record->getFullName());
255
-											} else {
256
-												echo /* I18N: %s is a man's name */
257
-												I18N::translate('%s, his spouses and descendants', $record->getFullName());
258
-											}
259
-											?>
252
+												if ($record->getSex() === 'F') {
253
+													echo /* I18N: %s is a woman's name */
254
+													I18N::translate('%s, her spouses and descendants', $record->getFullName());
255
+												} else {
256
+													echo /* I18N: %s is a man's name */
257
+													I18N::translate('%s, his spouses and descendants', $record->getFullName());
258
+												}
259
+												?>
260 260
 										</label>
261 261
 										<br>
262 262
 										<?php echo I18N::translate('Number of generations'); ?>
263
-										<input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');">
263
+											<input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');">
264 264
 									</td>
265 265
 								</tr>
266 266
 							</tbody>
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 										<label>
303 303
 											<input type="radio" name="others" value="linked">
304 304
 											<?php echo /* I18N: %s is the name of a source */
305
-											I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?>
305
+												I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?>
306 306
 										</label>
307 307
 									</td>
308 308
 								</tr>
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 						</table>
318 318
 					</form>
319 319
 				<?php }
320
-			}
320
+				}
321 321
 
322
-			if (!$cart[$WT_TREE->getTreeId()]) {
323
-				if ($clip_ctrl->action != 'add') {
324
-					echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.');
325
-					?>
322
+				if (!$cart[$WT_TREE->getTreeId()]) {
323
+					if ($clip_ctrl->action != 'add') {
324
+						echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.');
325
+						?>
326 326
 					<form method="get" name="addin" action="module.php">
327 327
 						<input type="hidden" name="mod" value="clippings">
328 328
 						<input type="hidden" name="mod_action" value="index">
@@ -342,25 +342,25 @@  discard block
 block discarded – undo
342 342
 									</td>
343 343
 									<td class="optionbox">
344 344
 										<?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?>
345
-										<?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?>
346
-										<?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?>
347
-										<input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>">
345
+											<?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?>
346
+											<?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?>
347
+											<input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>">
348 348
 									</td>
349 349
 								</tr>
350 350
 							</tbody>
351 351
 						</table>
352 352
 					</form>
353 353
 					<?php
354
-				}
354
+					}
355 355
 
356
-				// -- end new lines
357
-				echo I18N::translate('Your clippings cart is empty.');
358
-			} else {
359
-				// Keep track of the INDI from the parent page, otherwise it will
360
-				// get lost after ajax updates
361
-				$pid = Filter::get('pid', WT_REGEX_XREF);
356
+					// -- end new lines
357
+					echo I18N::translate('Your clippings cart is empty.');
358
+				} else {
359
+					// Keep track of the INDI from the parent page, otherwise it will
360
+					// get lost after ajax updates
361
+					$pid = Filter::get('pid', WT_REGEX_XREF);
362 362
 
363
-				if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?>
363
+					if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?>
364 364
 					<form method="get" action="module.php">
365 365
 						<input type="hidden" name="mod" value="clippings">
366 366
 						<input type="hidden" name="mod_action" value="index">
@@ -468,9 +468,9 @@  discard block
 block discarded – undo
468 468
 									</td>
469 469
 									<td class="optionbox">
470 470
 										<?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?>
471
-										<?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?>
472
-										<?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?>
473
-										<input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>">
471
+											<?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?>
472
+											<?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?>
473
+											<input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>">
474 474
 									</td>
475 475
 								</tr>
476 476
 							</tbody>
@@ -500,32 +500,32 @@  discard block
 block discarded – undo
500 500
 					</thead>
501 501
 					<tbody>
502 502
 						<?php
503
-						foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
504
-							$record = GedcomRecord::getInstance($xref, $WT_TREE);
505
-							if ($record) {
506
-								switch ($record::RECORD_TYPE) {
507
-								case 'INDI':
508
-									$icon = 'icon-indis';
509
-									break;
510
-								case 'FAM':
511
-									$icon = 'icon-sfamily';
512
-									break;
513
-								case 'SOUR':
514
-									$icon = 'icon-source';
515
-									break;
516
-								case 'REPO':
517
-									$icon = 'icon-repository';
518
-									break;
519
-								case 'NOTE':
520
-									$icon = 'icon-note';
521
-									break;
522
-								case 'OBJE':
523
-									$icon = 'icon-media';
524
-									break;
525
-								default:
526
-									$icon = 'icon-clippings';
527
-									break;
528
-								}
503
+							foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
504
+								$record = GedcomRecord::getInstance($xref, $WT_TREE);
505
+								if ($record) {
506
+									switch ($record::RECORD_TYPE) {
507
+										case 'INDI':
508
+											$icon = 'icon-indis';
509
+											break;
510
+										case 'FAM':
511
+											$icon = 'icon-sfamily';
512
+											break;
513
+										case 'SOUR':
514
+											$icon = 'icon-source';
515
+											break;
516
+										case 'REPO':
517
+											$icon = 'icon-repository';
518
+											break;
519
+										case 'NOTE':
520
+											$icon = 'icon-note';
521
+											break;
522
+										case 'OBJE':
523
+											$icon = 'icon-media';
524
+											break;
525
+										default:
526
+											$icon = 'icon-clippings';
527
+											break;
528
+									}
529 529
 								?>
530 530
 								<tr>
531 531
 									<td class="list_value">
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 				<?php
545 545
 			}
546 546
 			break;
547
-		default:
548
-			http_response_code(404);
549
-			break;
547
+			default:
548
+				http_response_code(404);
549
+				break;
550 550
 		}
551 551
 	}
552 552
 
@@ -695,12 +695,12 @@  discard block
 block discarded – undo
695 695
 				$record = GedcomRecord::getInstance($xref, $WT_TREE);
696 696
 				if ($record instanceof Individual || $record instanceof Family) {
697 697
 					switch ($record::RECORD_TYPE) {
698
-					case 'INDI':
699
-						$icon = 'icon-indis';
700
-						break;
701
-					case 'FAM':
702
-						$icon = 'icon-sfamily';
703
-						break;
698
+						case 'INDI':
699
+							$icon = 'icon-indis';
700
+							break;
701
+						case 'FAM':
702
+							$icon = 'icon-sfamily';
703
+							break;
704 704
 					}
705 705
 					$out .= '<li>';
706 706
 					if (!empty($icon)) {
Please login to merge, or discard this patch.