Passed
Push — 1.7 ( 9a2349...400c71 )
by Greg
06:42
created
app/Module/InteractiveTreeModule.php 3 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -28,78 +28,78 @@  discard block
 block discarded – undo
28 28
  * Tip : you could change the number of generations loaded before ajax calls both in individual page and in treeview page to optimize speed and server load
29 29
  */
30 30
 class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface, ModuleChartInterface {
31
-	/** {@inheritdoc} */
32
-	public function getTitle() {
33
-		return /* I18N: Name of a module */ I18N::translate('Interactive tree');
34
-	}
35
-
36
-	/** {@inheritdoc} */
37
-	public function getDescription() {
38
-		return /* I18N: Description of the “Interactive tree” module */ I18N::translate('An interactive tree, showing all the ancestors and descendants of an individual.');
39
-	}
40
-
41
-	/** {@inheritdoc} */
42
-	public function defaultTabOrder() {
43
-		return 68;
44
-	}
45
-
46
-	/** {@inheritdoc} */
47
-	public function getTabContent() {
48
-		global $controller;
49
-
50
-		$tv              = new TreeView('tvTab');
51
-		list($html, $js) = $tv->drawViewport($controller->record, 3);
52
-
53
-		return
54
-			'<script src="' . $this->js() . '"></script>' .
55
-			'<script src="' . WT_JQUERYUI_TOUCH_PUNCH_URL . '"></script>' .
56
-			'<script>' . $js . '</script>' .
57
-			$html;
58
-	}
59
-
60
-	/** {@inheritdoc} */
61
-	public function hasTabContent() {
62
-		return !Auth::isSearchEngine();
63
-	}
64
-
65
-	/** {@inheritdoc} */
66
-	public function isGrayedOut() {
67
-		return false;
68
-	}
69
-
70
-	/** {@inheritdoc} */
71
-	public function canLoadAjax() {
72
-		return true;
73
-	}
74
-
75
-	/**
76
-	 * Return a menu item for this chart.
77
-	 *
78
-	 * @return Menu|null
79
-	 */
80
-	public function getChartMenu(Individual $individual) {
81
-		return new Menu(
82
-			$this->getTitle(),
83
-			'module.php?mod=tree&amp;mod_action=treeview&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
84
-			'menu-chart-tree',
85
-			array('rel' => 'nofollow')
86
-		);
87
-	}
88
-
89
-	/**
90
-	 * Return a menu item for this chart - for use in individual boxes.
91
-	 *
92
-	 * @return Menu|null
93
-	 */
94
-	public function getBoxChartMenu(Individual $individual) {
95
-		return $this->getChartMenu($individual);
96
-	}
97
-
98
-	/** {@inheritdoc} */
99
-	public function getPreLoadContent() {
100
-		// We cannot use jQuery("head").append(<link rel="stylesheet" ...as jQuery is not loaded at this time
101
-		return
102
-			'<script>
31
+    /** {@inheritdoc} */
32
+    public function getTitle() {
33
+        return /* I18N: Name of a module */ I18N::translate('Interactive tree');
34
+    }
35
+
36
+    /** {@inheritdoc} */
37
+    public function getDescription() {
38
+        return /* I18N: Description of the “Interactive tree” module */ I18N::translate('An interactive tree, showing all the ancestors and descendants of an individual.');
39
+    }
40
+
41
+    /** {@inheritdoc} */
42
+    public function defaultTabOrder() {
43
+        return 68;
44
+    }
45
+
46
+    /** {@inheritdoc} */
47
+    public function getTabContent() {
48
+        global $controller;
49
+
50
+        $tv              = new TreeView('tvTab');
51
+        list($html, $js) = $tv->drawViewport($controller->record, 3);
52
+
53
+        return
54
+            '<script src="' . $this->js() . '"></script>' .
55
+            '<script src="' . WT_JQUERYUI_TOUCH_PUNCH_URL . '"></script>' .
56
+            '<script>' . $js . '</script>' .
57
+            $html;
58
+    }
59
+
60
+    /** {@inheritdoc} */
61
+    public function hasTabContent() {
62
+        return !Auth::isSearchEngine();
63
+    }
64
+
65
+    /** {@inheritdoc} */
66
+    public function isGrayedOut() {
67
+        return false;
68
+    }
69
+
70
+    /** {@inheritdoc} */
71
+    public function canLoadAjax() {
72
+        return true;
73
+    }
74
+
75
+    /**
76
+     * Return a menu item for this chart.
77
+     *
78
+     * @return Menu|null
79
+     */
80
+    public function getChartMenu(Individual $individual) {
81
+        return new Menu(
82
+            $this->getTitle(),
83
+            'module.php?mod=tree&amp;mod_action=treeview&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
84
+            'menu-chart-tree',
85
+            array('rel' => 'nofollow')
86
+        );
87
+    }
88
+
89
+    /**
90
+     * Return a menu item for this chart - for use in individual boxes.
91
+     *
92
+     * @return Menu|null
93
+     */
94
+    public function getBoxChartMenu(Individual $individual) {
95
+        return $this->getChartMenu($individual);
96
+    }
97
+
98
+    /** {@inheritdoc} */
99
+    public function getPreLoadContent() {
100
+        // We cannot use jQuery("head").append(<link rel="stylesheet" ...as jQuery is not loaded at this time
101
+        return
102
+            '<script>
103 103
 			if (document.createStyleSheet) {
104 104
 				document.createStyleSheet("' . $this->css() . '"); // For Internet Explorer
105 105
 			} else {
@@ -110,83 +110,83 @@  discard block
 block discarded – undo
110 110
 				document.getElementsByTagName("head")[0].appendChild(newSheet);
111 111
 			}
112 112
 			</script>';
113
-	}
114
-
115
-	/**
116
-	 * This is a general purpose hook, allowing modules to respond to routes
117
-	 * of the form module.php?mod=FOO&mod_action=BAR
118
-	 *
119
-	 * @param string $mod_action
120
-	 */
121
-	public function modAction($mod_action) {
122
-		global $controller, $WT_TREE;
123
-
124
-		switch ($mod_action) {
125
-		case 'treeview':
126
-			$controller = new ChartController;
127
-			$tv         = new TreeView('tv');
128
-			ob_start();
129
-
130
-			$person = $controller->getSignificantIndividual();
131
-
132
-			list($html, $js) = $tv->drawViewport($person, 4);
133
-
134
-			$controller
135
-				->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName()))
136
-				->pageHeader()
137
-				->addExternalJavascript($this->js())
138
-				->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL)
139
-				->addInlineJavascript($js)
140
-				->addInlineJavascript('
113
+    }
114
+
115
+    /**
116
+     * This is a general purpose hook, allowing modules to respond to routes
117
+     * of the form module.php?mod=FOO&mod_action=BAR
118
+     *
119
+     * @param string $mod_action
120
+     */
121
+    public function modAction($mod_action) {
122
+        global $controller, $WT_TREE;
123
+
124
+        switch ($mod_action) {
125
+        case 'treeview':
126
+            $controller = new ChartController;
127
+            $tv         = new TreeView('tv');
128
+            ob_start();
129
+
130
+            $person = $controller->getSignificantIndividual();
131
+
132
+            list($html, $js) = $tv->drawViewport($person, 4);
133
+
134
+            $controller
135
+                ->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName()))
136
+                ->pageHeader()
137
+                ->addExternalJavascript($this->js())
138
+                ->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL)
139
+                ->addInlineJavascript($js)
140
+                ->addInlineJavascript('
141 141
 					if (document.createStyleSheet) {
142 142
 						document.createStyleSheet("' . $this->css() . '"); // For Internet Explorer
143 143
 					} else {
144 144
 						jQuery("head").append(\'<link rel="stylesheet" type="text/css" href="' . $this->css() . '">\');
145 145
 					}
146 146
 				');
147
-			echo $html;
148
-			break;
149
-
150
-		case 'getDetails':
151
-			header('Content-Type: text/html; charset=UTF-8');
152
-			$pid        = Filter::get('pid', WT_REGEX_XREF);
153
-			$i          = Filter::get('instance');
154
-			$tv         = new TreeView($i);
155
-			$individual = Individual::getInstance($pid, $WT_TREE);
156
-			if ($individual) {
157
-				echo $tv->getDetails($individual);
158
-			}
159
-			break;
160
-
161
-		case 'getPersons':
162
-			header('Content-Type: text/html; charset=UTF-8');
163
-			$q  = Filter::get('q');
164
-			$i  = Filter::get('instance');
165
-			$tv = new TreeView($i);
166
-			echo $tv->getPersons($q);
167
-			break;
168
-
169
-		default:
170
-			http_response_code(404);
171
-			break;
172
-		}
173
-	}
174
-
175
-	/**
176
-	 * URL for our style sheet.
177
-	 *
178
-	 * @return string
179
-	 */
180
-	public function css() {
181
-		return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/css/treeview.css';
182
-	}
183
-
184
-	/**
185
-	 * URL for our JavaScript.
186
-	 *
187
-	 * @return string
188
-	 */
189
-	public function js() {
190
-		return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/treeview.js';
191
-	}
147
+            echo $html;
148
+            break;
149
+
150
+        case 'getDetails':
151
+            header('Content-Type: text/html; charset=UTF-8');
152
+            $pid        = Filter::get('pid', WT_REGEX_XREF);
153
+            $i          = Filter::get('instance');
154
+            $tv         = new TreeView($i);
155
+            $individual = Individual::getInstance($pid, $WT_TREE);
156
+            if ($individual) {
157
+                echo $tv->getDetails($individual);
158
+            }
159
+            break;
160
+
161
+        case 'getPersons':
162
+            header('Content-Type: text/html; charset=UTF-8');
163
+            $q  = Filter::get('q');
164
+            $i  = Filter::get('instance');
165
+            $tv = new TreeView($i);
166
+            echo $tv->getPersons($q);
167
+            break;
168
+
169
+        default:
170
+            http_response_code(404);
171
+            break;
172
+        }
173
+    }
174
+
175
+    /**
176
+     * URL for our style sheet.
177
+     *
178
+     * @return string
179
+     */
180
+    public function css() {
181
+        return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/css/treeview.css';
182
+    }
183
+
184
+    /**
185
+     * URL for our JavaScript.
186
+     *
187
+     * @return string
188
+     */
189
+    public function js() {
190
+        return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/treeview.js';
191
+    }
192 192
 }
Please login to merge, or discard this patch.
Switch Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -122,53 +122,53 @@
 block discarded – undo
122 122
 		global $controller, $WT_TREE;
123 123
 
124 124
 		switch ($mod_action) {
125
-		case 'treeview':
126
-			$controller = new ChartController;
127
-			$tv         = new TreeView('tv');
128
-			ob_start();
129
-
130
-			$person = $controller->getSignificantIndividual();
131
-
132
-			list($html, $js) = $tv->drawViewport($person, 4);
133
-
134
-			$controller
135
-				->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName()))
136
-				->pageHeader()
137
-				->addExternalJavascript($this->js())
138
-				->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL)
139
-				->addInlineJavascript($js)
140
-				->addInlineJavascript('
125
+		    case 'treeview':
126
+			    $controller = new ChartController;
127
+			    $tv         = new TreeView('tv');
128
+			    ob_start();
129
+
130
+			    $person = $controller->getSignificantIndividual();
131
+
132
+			    list($html, $js) = $tv->drawViewport($person, 4);
133
+
134
+			    $controller
135
+				    ->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName()))
136
+				    ->pageHeader()
137
+				    ->addExternalJavascript($this->js())
138
+				    ->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL)
139
+				    ->addInlineJavascript($js)
140
+				    ->addInlineJavascript('
141 141
 					if (document.createStyleSheet) {
142 142
 						document.createStyleSheet("' . $this->css() . '"); // For Internet Explorer
143 143
 					} else {
144 144
 						jQuery("head").append(\'<link rel="stylesheet" type="text/css" href="' . $this->css() . '">\');
145 145
 					}
146 146
 				');
147
-			echo $html;
148
-			break;
149
-
150
-		case 'getDetails':
151
-			header('Content-Type: text/html; charset=UTF-8');
152
-			$pid        = Filter::get('pid', WT_REGEX_XREF);
153
-			$i          = Filter::get('instance');
154
-			$tv         = new TreeView($i);
155
-			$individual = Individual::getInstance($pid, $WT_TREE);
156
-			if ($individual) {
157
-				echo $tv->getDetails($individual);
158
-			}
159
-			break;
160
-
161
-		case 'getPersons':
162
-			header('Content-Type: text/html; charset=UTF-8');
163
-			$q  = Filter::get('q');
164
-			$i  = Filter::get('instance');
165
-			$tv = new TreeView($i);
166
-			echo $tv->getPersons($q);
167
-			break;
168
-
169
-		default:
170
-			http_response_code(404);
171
-			break;
147
+			    echo $html;
148
+			    break;
149
+
150
+		    case 'getDetails':
151
+			    header('Content-Type: text/html; charset=UTF-8');
152
+			    $pid        = Filter::get('pid', WT_REGEX_XREF);
153
+			    $i          = Filter::get('instance');
154
+			    $tv         = new TreeView($i);
155
+			    $individual = Individual::getInstance($pid, $WT_TREE);
156
+			    if ($individual) {
157
+				    echo $tv->getDetails($individual);
158
+			    }
159
+			    break;
160
+
161
+		    case 'getPersons':
162
+			    header('Content-Type: text/html; charset=UTF-8');
163
+			    $q  = Filter::get('q');
164
+			    $i  = Filter::get('instance');
165
+			    $tv = new TreeView($i);
166
+			    echo $tv->getPersons($q);
167
+			    break;
168
+
169
+		    default:
170
+			    http_response_code(404);
171
+			    break;
172 172
 		}
173 173
 	}
174 174
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,22 +29,26 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface, ModuleChartInterface {
31 31
 	/** {@inheritdoc} */
32
-	public function getTitle() {
32
+	public function getTitle()
33
+	{
33 34
 		return /* I18N: Name of a module */ I18N::translate('Interactive tree');
34 35
 	}
35 36
 
36 37
 	/** {@inheritdoc} */
37
-	public function getDescription() {
38
+	public function getDescription()
39
+	{
38 40
 		return /* I18N: Description of the “Interactive tree” module */ I18N::translate('An interactive tree, showing all the ancestors and descendants of an individual.');
39 41
 	}
40 42
 
41 43
 	/** {@inheritdoc} */
42
-	public function defaultTabOrder() {
44
+	public function defaultTabOrder()
45
+	{
43 46
 		return 68;
44 47
 	}
45 48
 
46 49
 	/** {@inheritdoc} */
47
-	public function getTabContent() {
50
+	public function getTabContent()
51
+	{
48 52
 		global $controller;
49 53
 
50 54
 		$tv              = new TreeView('tvTab');
@@ -58,17 +62,20 @@  discard block
 block discarded – undo
58 62
 	}
59 63
 
60 64
 	/** {@inheritdoc} */
61
-	public function hasTabContent() {
65
+	public function hasTabContent()
66
+	{
62 67
 		return !Auth::isSearchEngine();
63 68
 	}
64 69
 
65 70
 	/** {@inheritdoc} */
66
-	public function isGrayedOut() {
71
+	public function isGrayedOut()
72
+	{
67 73
 		return false;
68 74
 	}
69 75
 
70 76
 	/** {@inheritdoc} */
71
-	public function canLoadAjax() {
77
+	public function canLoadAjax()
78
+	{
72 79
 		return true;
73 80
 	}
74 81
 
@@ -77,7 +84,8 @@  discard block
 block discarded – undo
77 84
 	 *
78 85
 	 * @return Menu|null
79 86
 	 */
80
-	public function getChartMenu(Individual $individual) {
87
+	public function getChartMenu(Individual $individual)
88
+	{
81 89
 		return new Menu(
82 90
 			$this->getTitle(),
83 91
 			'module.php?mod=tree&amp;mod_action=treeview&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
@@ -91,12 +99,14 @@  discard block
 block discarded – undo
91 99
 	 *
92 100
 	 * @return Menu|null
93 101
 	 */
94
-	public function getBoxChartMenu(Individual $individual) {
102
+	public function getBoxChartMenu(Individual $individual)
103
+	{
95 104
 		return $this->getChartMenu($individual);
96 105
 	}
97 106
 
98 107
 	/** {@inheritdoc} */
99
-	public function getPreLoadContent() {
108
+	public function getPreLoadContent()
109
+	{
100 110
 		// We cannot use jQuery("head").append(<link rel="stylesheet" ...as jQuery is not loaded at this time
101 111
 		return
102 112
 			'<script>
@@ -118,7 +128,8 @@  discard block
 block discarded – undo
118 128
 	 *
119 129
 	 * @param string $mod_action
120 130
 	 */
121
-	public function modAction($mod_action) {
131
+	public function modAction($mod_action)
132
+	{
122 133
 		global $controller, $WT_TREE;
123 134
 
124 135
 		switch ($mod_action) {
@@ -177,7 +188,8 @@  discard block
 block discarded – undo
177 188
 	 *
178 189
 	 * @return string
179 190
 	 */
180
-	public function css() {
191
+	public function css()
192
+	{
181 193
 		return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/css/treeview.css';
182 194
 	}
183 195
 
@@ -186,7 +198,8 @@  discard block
 block discarded – undo
186 198
 	 *
187 199
 	 * @return string
188 200
 	 */
189
-	public function js() {
201
+	public function js()
202
+	{
190 203
 		return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/treeview.js';
191 204
 	}
192 205
 }
Please login to merge, or discard this patch.
app/Module/RecentChangesModule.php 3 patches
Indentation   +338 added lines, -338 removed lines patch added patch discarded remove patch
@@ -31,273 +31,273 @@  discard block
 block discarded – undo
31 31
  * Class RecentChangesModule
32 32
  */
33 33
 class RecentChangesModule extends AbstractModule implements ModuleBlockInterface {
34
-	const DEFAULT_BLOCK      = '1';
35
-	const DEFAULT_DAYS       = 7;
36
-	const DEFAULT_HIDE_EMPTY = '0';
37
-	const DEFAULT_SHOW_USER  = '1';
38
-	const DEFAULT_SORT_STYLE = 'date_desc';
39
-	const DEFAULT_INFO_STYLE = 'table';
40
-	const MAX_DAYS           = 90;
41
-
42
-	/** {@inheritdoc} */
43
-	public function getTitle() {
44
-		return /* I18N: Name of a module */ I18N::translate('Recent changes');
45
-	}
46
-
47
-	/** {@inheritdoc} */
48
-	public function getDescription() {
49
-		return /* I18N: Description of the “Recent changes” module */ I18N::translate('A list of records that have been updated recently.');
50
-	}
51
-
52
-	/** {@inheritdoc} */
53
-	public function getBlock($block_id, $template = true, $cfg = array()) {
54
-		global $ctype, $WT_TREE;
55
-
56
-		$days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
57
-		$infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
58
-		$sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
59
-		$show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
60
-		$block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
61
-		$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
62
-
63
-		foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'show_user', 'block') as $name) {
64
-			if (array_key_exists($name, $cfg)) {
65
-				$$name = $cfg[$name];
66
-			}
67
-		}
68
-
69
-		$records = $this->getRecentChanges($WT_TREE, WT_CLIENT_JD - $days);
70
-
71
-		if (empty($records) && $hide_empty) {
72
-			return '';
73
-		}
74
-
75
-		// Print block header
76
-		$id    = $this->getName() . $block_id;
77
-		$class = $this->getName() . '_block';
78
-
79
-		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
80
-			$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
81
-		} else {
82
-			$title = '';
83
-		}
84
-		$title .= /* I18N: title for list of recent changes */ I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
85
-
86
-		$content = '';
87
-		// Print block content
88
-		if (count($records) == 0) {
89
-			$content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
90
-		} else {
91
-			switch ($infoStyle) {
92
-			case 'list':
93
-				$content .= $this->changesList($records, $sortStyle, $show_user);
94
-				break;
95
-			case 'table':
96
-				$content .= $this->changesTable($records, $sortStyle, $show_user);
97
-				break;
98
-			}
99
-		}
100
-
101
-		if ($template) {
102
-			if ($block) {
103
-				$class .= ' small_inner_block';
104
-			}
105
-
106
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
107
-		} else {
108
-			return $content;
109
-		}
110
-	}
111
-
112
-	/** {@inheritdoc} */
113
-	public function loadAjax() {
114
-		return true;
115
-	}
116
-
117
-	/** {@inheritdoc} */
118
-	public function isUserBlock() {
119
-		return true;
120
-	}
121
-
122
-	/** {@inheritdoc} */
123
-	public function isGedcomBlock() {
124
-		return true;
125
-	}
126
-
127
-	/** {@inheritdoc} */
128
-	public function configureBlock($block_id) {
129
-		if (Filter::postBool('save') && Filter::checkCsrf()) {
130
-			$this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
131
-			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
132
-			$this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
133
-			$this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
134
-			$this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
135
-			$this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
136
-		}
137
-
138
-		$days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
139
-		$infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
140
-		$sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
141
-		$show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
142
-		$block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
143
-		$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
144
-
145
-		echo '<tr><td class="descriptionbox wrap width33">';
146
-		echo I18N::translate('Number of days to show');
147
-		echo '</td><td class="optionbox">';
148
-		echo '<input type="text" name="days" size="2" value="', $days, '">';
149
-		echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
150
-		echo '</td></tr>';
151
-
152
-		echo '<tr><td class="descriptionbox wrap width33">';
153
-		echo I18N::translate('Presentation style');
154
-		echo '</td><td class="optionbox">';
155
-		echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
156
-		echo '</td></tr>';
157
-
158
-		echo '<tr><td class="descriptionbox wrap width33">';
159
-		echo I18N::translate('Sort order');
160
-		echo '</td><td class="optionbox">';
161
-		echo FunctionsEdit::selectEditControl('sortStyle', array(
162
-			'name'      => /* I18N: An option in a list-box */ I18N::translate('sort by name'),
163
-			'date_asc'  => /* I18N: An option in a list-box */ I18N::translate('sort by date, oldest first'),
164
-			'date_desc' => /* I18N: An option in a list-box */ I18N::translate('sort by date, newest first'),
165
-		), null, $sortStyle, '');
166
-		echo '</td></tr>';
167
-
168
-		echo '<tr><td class="descriptionbox wrap width33">';
169
-		echo /* I18N: label for a yes/no option */ I18N::translate('Show the user who made the change');
170
-		echo '</td><td class="optionbox">';
171
-		echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
172
-		echo '</td></tr>';
173
-
174
-		echo '<tr><td class="descriptionbox wrap width33">';
175
-		echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
176
-		echo '</td><td class="optionbox">';
177
-		echo FunctionsEdit::editFieldYesNo('block', $block);
178
-		echo '</td></tr>';
179
-
180
-		echo '<tr><td class="descriptionbox wrap width33">';
181
-		echo I18N::translate('Should this block be hidden when it is empty');
182
-		echo '</td><td class="optionbox">';
183
-		echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
184
-		echo '</td></tr>';
185
-		echo '<tr><td colspan="2" class="optionbox wrap">';
186
-		echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
187
-		echo '</td></tr>';
188
-	}
189
-
190
-	/**
191
-	 * Find records that have changed since a given julian day
192
-	 *
193
-	 * @param Tree $tree Changes for which tree
194
-	 * @param int  $jd   Julian day
195
-	 *
196
-	 * @return GedcomRecord[] List of records with changes
197
-	 */
198
-	private function getRecentChanges(Tree $tree, $jd) {
199
-		$sql =
200
-			"SELECT d_gid FROM `##dates`" .
201
-			" WHERE d_fact='CHAN' AND d_julianday1 >= :jd AND d_file = :tree_id";
202
-
203
-		$vars = array(
204
-			'jd'      => $jd,
205
-			'tree_id' => $tree->getTreeId(),
206
-		);
207
-
208
-		$xrefs = Database::prepare($sql)->execute($vars)->fetchOneColumn();
209
-
210
-		$records = array();
211
-		foreach ($xrefs as $xref) {
212
-			$record = GedcomRecord::getInstance($xref, $tree);
213
-			if ($record->canShow()) {
214
-				$records[] = $record;
215
-			}
216
-		}
217
-
218
-		return $records;
219
-	}
220
-
221
-	/**
222
-	 * Format a table of events
223
-	 *
224
-	 * @param GedcomRecord[] $records
225
-	 * @param string         $sort
226
-	 * @param bool           $show_user
227
-	 *
228
-	 * @return string
229
-	 */
230
-	private function changesList(array $records, $sort, $show_user) {
231
-		switch ($sort) {
232
-		case 'name':
233
-			uasort($records, array('self', 'sortByNameAndChangeDate'));
234
-			break;
235
-		case 'date_asc':
236
-			uasort($records, array('self', 'sortByChangeDateAndName'));
237
-			$records = array_reverse($records);
238
-			break;
239
-		case 'date_desc':
240
-			uasort($records, array('self', 'sortByChangeDateAndName'));
241
-		}
242
-
243
-		$html = '';
244
-		foreach ($records as $record) {
245
-			$html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item name2">' . $record->getFullName() . '</a>';
246
-			$html .= '<div class="indent" style="margin-bottom: 5px;">';
247
-			if ($record instanceof Individual) {
248
-				if ($record->getAddName()) {
249
-					$html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item">' . $record->getAddName() . '</a>';
250
-				}
251
-			}
252
-
253
-			// The timestamp may be missing or private.
254
-			$timestamp = $record->lastChangeTimestamp();
255
-			if ($timestamp !== '') {
256
-				if ($show_user) {
257
-					$html .= /* I18N: [a record was] Changed on <date/time> by <user> */
258
-						I18N::translate('Changed on %1$s by %2$s', $timestamp, Filter::escapeHtml($record->lastChangeUser()));
259
-				} else {
260
-					$html .= /* I18N: [a record was] Changed on <date/time> */
261
-						I18N::translate('Changed on %1$s', $timestamp);
262
-				}
263
-			}
264
-			$html .= '</div>';
265
-		}
266
-
267
-		return $html;
268
-	}
269
-
270
-	/**
271
-	 * Format a table of events
272
-	 *
273
-	 * @param GedcomRecord[] $records
274
-	 * @param string         $sort
275
-	 * @param bool           $show_user
276
-	 *
277
-	 * @return string
278
-	 */
279
-	private function changesTable($records, $sort, $show_user) {
280
-		global $controller;
281
-
282
-		$table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
283
-
284
-		switch ($sort) {
285
-		case 'name':
286
-		default:
287
-			$aaSorting = "[1,'asc'], [2,'desc']";
288
-			break;
289
-		case 'date_asc':
290
-			$aaSorting = "[2,'asc'], [1,'asc']";
291
-			break;
292
-		case 'date_desc':
293
-			$aaSorting = "[2,'desc'], [1,'asc']";
294
-			break;
295
-		}
296
-
297
-		$html = '';
298
-		$controller
299
-			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
300
-			->addInlineJavascript('
34
+    const DEFAULT_BLOCK      = '1';
35
+    const DEFAULT_DAYS       = 7;
36
+    const DEFAULT_HIDE_EMPTY = '0';
37
+    const DEFAULT_SHOW_USER  = '1';
38
+    const DEFAULT_SORT_STYLE = 'date_desc';
39
+    const DEFAULT_INFO_STYLE = 'table';
40
+    const MAX_DAYS           = 90;
41
+
42
+    /** {@inheritdoc} */
43
+    public function getTitle() {
44
+        return /* I18N: Name of a module */ I18N::translate('Recent changes');
45
+    }
46
+
47
+    /** {@inheritdoc} */
48
+    public function getDescription() {
49
+        return /* I18N: Description of the “Recent changes” module */ I18N::translate('A list of records that have been updated recently.');
50
+    }
51
+
52
+    /** {@inheritdoc} */
53
+    public function getBlock($block_id, $template = true, $cfg = array()) {
54
+        global $ctype, $WT_TREE;
55
+
56
+        $days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
57
+        $infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
58
+        $sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
59
+        $show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
60
+        $block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
61
+        $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
62
+
63
+        foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'show_user', 'block') as $name) {
64
+            if (array_key_exists($name, $cfg)) {
65
+                $$name = $cfg[$name];
66
+            }
67
+        }
68
+
69
+        $records = $this->getRecentChanges($WT_TREE, WT_CLIENT_JD - $days);
70
+
71
+        if (empty($records) && $hide_empty) {
72
+            return '';
73
+        }
74
+
75
+        // Print block header
76
+        $id    = $this->getName() . $block_id;
77
+        $class = $this->getName() . '_block';
78
+
79
+        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
80
+            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
81
+        } else {
82
+            $title = '';
83
+        }
84
+        $title .= /* I18N: title for list of recent changes */ I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
85
+
86
+        $content = '';
87
+        // Print block content
88
+        if (count($records) == 0) {
89
+            $content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
90
+        } else {
91
+            switch ($infoStyle) {
92
+            case 'list':
93
+                $content .= $this->changesList($records, $sortStyle, $show_user);
94
+                break;
95
+            case 'table':
96
+                $content .= $this->changesTable($records, $sortStyle, $show_user);
97
+                break;
98
+            }
99
+        }
100
+
101
+        if ($template) {
102
+            if ($block) {
103
+                $class .= ' small_inner_block';
104
+            }
105
+
106
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
107
+        } else {
108
+            return $content;
109
+        }
110
+    }
111
+
112
+    /** {@inheritdoc} */
113
+    public function loadAjax() {
114
+        return true;
115
+    }
116
+
117
+    /** {@inheritdoc} */
118
+    public function isUserBlock() {
119
+        return true;
120
+    }
121
+
122
+    /** {@inheritdoc} */
123
+    public function isGedcomBlock() {
124
+        return true;
125
+    }
126
+
127
+    /** {@inheritdoc} */
128
+    public function configureBlock($block_id) {
129
+        if (Filter::postBool('save') && Filter::checkCsrf()) {
130
+            $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
131
+            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
132
+            $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
133
+            $this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
134
+            $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
135
+            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
136
+        }
137
+
138
+        $days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
139
+        $infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
140
+        $sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
141
+        $show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
142
+        $block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
143
+        $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
144
+
145
+        echo '<tr><td class="descriptionbox wrap width33">';
146
+        echo I18N::translate('Number of days to show');
147
+        echo '</td><td class="optionbox">';
148
+        echo '<input type="text" name="days" size="2" value="', $days, '">';
149
+        echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
150
+        echo '</td></tr>';
151
+
152
+        echo '<tr><td class="descriptionbox wrap width33">';
153
+        echo I18N::translate('Presentation style');
154
+        echo '</td><td class="optionbox">';
155
+        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
156
+        echo '</td></tr>';
157
+
158
+        echo '<tr><td class="descriptionbox wrap width33">';
159
+        echo I18N::translate('Sort order');
160
+        echo '</td><td class="optionbox">';
161
+        echo FunctionsEdit::selectEditControl('sortStyle', array(
162
+            'name'      => /* I18N: An option in a list-box */ I18N::translate('sort by name'),
163
+            'date_asc'  => /* I18N: An option in a list-box */ I18N::translate('sort by date, oldest first'),
164
+            'date_desc' => /* I18N: An option in a list-box */ I18N::translate('sort by date, newest first'),
165
+        ), null, $sortStyle, '');
166
+        echo '</td></tr>';
167
+
168
+        echo '<tr><td class="descriptionbox wrap width33">';
169
+        echo /* I18N: label for a yes/no option */ I18N::translate('Show the user who made the change');
170
+        echo '</td><td class="optionbox">';
171
+        echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
172
+        echo '</td></tr>';
173
+
174
+        echo '<tr><td class="descriptionbox wrap width33">';
175
+        echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
176
+        echo '</td><td class="optionbox">';
177
+        echo FunctionsEdit::editFieldYesNo('block', $block);
178
+        echo '</td></tr>';
179
+
180
+        echo '<tr><td class="descriptionbox wrap width33">';
181
+        echo I18N::translate('Should this block be hidden when it is empty');
182
+        echo '</td><td class="optionbox">';
183
+        echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
184
+        echo '</td></tr>';
185
+        echo '<tr><td colspan="2" class="optionbox wrap">';
186
+        echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
187
+        echo '</td></tr>';
188
+    }
189
+
190
+    /**
191
+     * Find records that have changed since a given julian day
192
+     *
193
+     * @param Tree $tree Changes for which tree
194
+     * @param int  $jd   Julian day
195
+     *
196
+     * @return GedcomRecord[] List of records with changes
197
+     */
198
+    private function getRecentChanges(Tree $tree, $jd) {
199
+        $sql =
200
+            "SELECT d_gid FROM `##dates`" .
201
+            " WHERE d_fact='CHAN' AND d_julianday1 >= :jd AND d_file = :tree_id";
202
+
203
+        $vars = array(
204
+            'jd'      => $jd,
205
+            'tree_id' => $tree->getTreeId(),
206
+        );
207
+
208
+        $xrefs = Database::prepare($sql)->execute($vars)->fetchOneColumn();
209
+
210
+        $records = array();
211
+        foreach ($xrefs as $xref) {
212
+            $record = GedcomRecord::getInstance($xref, $tree);
213
+            if ($record->canShow()) {
214
+                $records[] = $record;
215
+            }
216
+        }
217
+
218
+        return $records;
219
+    }
220
+
221
+    /**
222
+     * Format a table of events
223
+     *
224
+     * @param GedcomRecord[] $records
225
+     * @param string         $sort
226
+     * @param bool           $show_user
227
+     *
228
+     * @return string
229
+     */
230
+    private function changesList(array $records, $sort, $show_user) {
231
+        switch ($sort) {
232
+        case 'name':
233
+            uasort($records, array('self', 'sortByNameAndChangeDate'));
234
+            break;
235
+        case 'date_asc':
236
+            uasort($records, array('self', 'sortByChangeDateAndName'));
237
+            $records = array_reverse($records);
238
+            break;
239
+        case 'date_desc':
240
+            uasort($records, array('self', 'sortByChangeDateAndName'));
241
+        }
242
+
243
+        $html = '';
244
+        foreach ($records as $record) {
245
+            $html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item name2">' . $record->getFullName() . '</a>';
246
+            $html .= '<div class="indent" style="margin-bottom: 5px;">';
247
+            if ($record instanceof Individual) {
248
+                if ($record->getAddName()) {
249
+                    $html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item">' . $record->getAddName() . '</a>';
250
+                }
251
+            }
252
+
253
+            // The timestamp may be missing or private.
254
+            $timestamp = $record->lastChangeTimestamp();
255
+            if ($timestamp !== '') {
256
+                if ($show_user) {
257
+                    $html .= /* I18N: [a record was] Changed on <date/time> by <user> */
258
+                        I18N::translate('Changed on %1$s by %2$s', $timestamp, Filter::escapeHtml($record->lastChangeUser()));
259
+                } else {
260
+                    $html .= /* I18N: [a record was] Changed on <date/time> */
261
+                        I18N::translate('Changed on %1$s', $timestamp);
262
+                }
263
+            }
264
+            $html .= '</div>';
265
+        }
266
+
267
+        return $html;
268
+    }
269
+
270
+    /**
271
+     * Format a table of events
272
+     *
273
+     * @param GedcomRecord[] $records
274
+     * @param string         $sort
275
+     * @param bool           $show_user
276
+     *
277
+     * @return string
278
+     */
279
+    private function changesTable($records, $sort, $show_user) {
280
+        global $controller;
281
+
282
+        $table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
283
+
284
+        switch ($sort) {
285
+        case 'name':
286
+        default:
287
+            $aaSorting = "[1,'asc'], [2,'desc']";
288
+            break;
289
+        case 'date_asc':
290
+            $aaSorting = "[2,'asc'], [1,'asc']";
291
+            break;
292
+        case 'date_desc':
293
+            $aaSorting = "[2,'desc'], [1,'asc']";
294
+            break;
295
+        }
296
+
297
+        $html = '';
298
+        $controller
299
+            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
300
+            ->addInlineJavascript('
301 301
 				jQuery("#' . $table_id . '").dataTable({
302 302
 					dom: \'t\',
303 303
 					paging: false,
@@ -316,75 +316,75 @@  discard block
 block discarded – undo
316 316
 				});
317 317
 			');
318 318
 
319
-		$html .= '<table id="' . $table_id . '" class="width100">';
320
-		$html .= '<thead><tr>';
321
-		$html .= '<th></th>';
322
-		$html .= '<th>' . I18N::translate('Record') . '</th>';
323
-		$html .= '<th>' . GedcomTag::getLabel('CHAN') . '</th>';
324
-		$html .= '<th>' . GedcomTag::getLabel('_WT_USER') . '</th>';
325
-		$html .= '</tr></thead><tbody>';
326
-
327
-		foreach ($records as $record) {
328
-			$html .= '<tr><td>';
329
-			switch ($record::RECORD_TYPE) {
330
-			case 'INDI':
331
-				$html .= $record->getSexImage('small');
332
-				break;
333
-			case 'FAM':
334
-				$html .= '<i class="icon-button_family"></i>';
335
-				break;
336
-			case 'OBJE':
337
-				$html .= '<i class="icon-button_media"></i>';
338
-				break;
339
-			case 'NOTE':
340
-				$html .= '<i class="icon-button_note"></i>';
341
-				break;
342
-			case 'SOUR':
343
-				$html .= '<i class="icon-button_source"></i>';
344
-				break;
345
-			case 'REPO':
346
-				$html .= '<i class="icon-button_repository"></i>';
347
-				break;
348
-			}
349
-			$html .= '</td>';
350
-			$html .= '<td data-sort="' . Filter::escapeHtml($record->getSortName()) . '">';
351
-			$html .= '<a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a>';
352
-			$addname = $record->getAddName();
353
-			if ($addname) {
354
-				$html .= '<div class="indent"><a href="' . $record->getHtmlUrl() . '">' . $addname . '</a></div>';
355
-			}
356
-			$html .= '</td>';
357
-			$html .= '<td data-sort="' . $record->lastChangeTimestamp(true) . '">' . $record->lastChangeTimestamp() . '</td>';
358
-			$html .= '<td>' . Filter::escapeHtml($record->lastChangeUser()) . '</td>';
359
-			$html .= '</tr>';
360
-		}
361
-
362
-		$html .= '</tbody></table>';
363
-
364
-		return $html;
365
-	}
366
-
367
-	/**
368
-	 * Sort the records by (1) last change date and (2) name
369
-	 *
370
-	 * @param GedcomRecord $a
371
-	 * @param GedcomRecord $b
372
-	 *
373
-	 * @return int
374
-	 */
375
-	private static function sortByChangeDateAndName(GedcomRecord $a, GedcomRecord $b) {
376
-		return $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true) ?: GedcomRecord::compare($a, $b);
377
-	}
378
-
379
-	/**
380
-	 * Sort the records by (1) name and (2) last change date
381
-	 *
382
-	 * @param GedcomRecord $a
383
-	 * @param GedcomRecord $b
384
-	 *
385
-	 * @return int
386
-	 */
387
-	private static function sortByNameAndChangeDate(GedcomRecord $a, GedcomRecord $b) {
388
-		return GedcomRecord::compare($a, $b) ?: $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true);
389
-	}
319
+        $html .= '<table id="' . $table_id . '" class="width100">';
320
+        $html .= '<thead><tr>';
321
+        $html .= '<th></th>';
322
+        $html .= '<th>' . I18N::translate('Record') . '</th>';
323
+        $html .= '<th>' . GedcomTag::getLabel('CHAN') . '</th>';
324
+        $html .= '<th>' . GedcomTag::getLabel('_WT_USER') . '</th>';
325
+        $html .= '</tr></thead><tbody>';
326
+
327
+        foreach ($records as $record) {
328
+            $html .= '<tr><td>';
329
+            switch ($record::RECORD_TYPE) {
330
+            case 'INDI':
331
+                $html .= $record->getSexImage('small');
332
+                break;
333
+            case 'FAM':
334
+                $html .= '<i class="icon-button_family"></i>';
335
+                break;
336
+            case 'OBJE':
337
+                $html .= '<i class="icon-button_media"></i>';
338
+                break;
339
+            case 'NOTE':
340
+                $html .= '<i class="icon-button_note"></i>';
341
+                break;
342
+            case 'SOUR':
343
+                $html .= '<i class="icon-button_source"></i>';
344
+                break;
345
+            case 'REPO':
346
+                $html .= '<i class="icon-button_repository"></i>';
347
+                break;
348
+            }
349
+            $html .= '</td>';
350
+            $html .= '<td data-sort="' . Filter::escapeHtml($record->getSortName()) . '">';
351
+            $html .= '<a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a>';
352
+            $addname = $record->getAddName();
353
+            if ($addname) {
354
+                $html .= '<div class="indent"><a href="' . $record->getHtmlUrl() . '">' . $addname . '</a></div>';
355
+            }
356
+            $html .= '</td>';
357
+            $html .= '<td data-sort="' . $record->lastChangeTimestamp(true) . '">' . $record->lastChangeTimestamp() . '</td>';
358
+            $html .= '<td>' . Filter::escapeHtml($record->lastChangeUser()) . '</td>';
359
+            $html .= '</tr>';
360
+        }
361
+
362
+        $html .= '</tbody></table>';
363
+
364
+        return $html;
365
+    }
366
+
367
+    /**
368
+     * Sort the records by (1) last change date and (2) name
369
+     *
370
+     * @param GedcomRecord $a
371
+     * @param GedcomRecord $b
372
+     *
373
+     * @return int
374
+     */
375
+    private static function sortByChangeDateAndName(GedcomRecord $a, GedcomRecord $b) {
376
+        return $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true) ?: GedcomRecord::compare($a, $b);
377
+    }
378
+
379
+    /**
380
+     * Sort the records by (1) name and (2) last change date
381
+     *
382
+     * @param GedcomRecord $a
383
+     * @param GedcomRecord $b
384
+     *
385
+     * @return int
386
+     */
387
+    private static function sortByNameAndChangeDate(GedcomRecord $a, GedcomRecord $b) {
388
+        return GedcomRecord::compare($a, $b) ?: $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true);
389
+    }
390 390
 }
Please login to merge, or discard this patch.
Switch Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 			$content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
90 90
 		} else {
91 91
 			switch ($infoStyle) {
92
-			case 'list':
93
-				$content .= $this->changesList($records, $sortStyle, $show_user);
94
-				break;
95
-			case 'table':
96
-				$content .= $this->changesTable($records, $sortStyle, $show_user);
97
-				break;
92
+			    case 'list':
93
+				    $content .= $this->changesList($records, $sortStyle, $show_user);
94
+				    break;
95
+			    case 'table':
96
+				    $content .= $this->changesTable($records, $sortStyle, $show_user);
97
+				    break;
98 98
 			}
99 99
 		}
100 100
 
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	private function changesList(array $records, $sort, $show_user) {
231 231
 		switch ($sort) {
232
-		case 'name':
233
-			uasort($records, array('self', 'sortByNameAndChangeDate'));
234
-			break;
235
-		case 'date_asc':
236
-			uasort($records, array('self', 'sortByChangeDateAndName'));
237
-			$records = array_reverse($records);
238
-			break;
239
-		case 'date_desc':
240
-			uasort($records, array('self', 'sortByChangeDateAndName'));
232
+		    case 'name':
233
+			    uasort($records, array('self', 'sortByNameAndChangeDate'));
234
+			    break;
235
+		    case 'date_asc':
236
+			    uasort($records, array('self', 'sortByChangeDateAndName'));
237
+			    $records = array_reverse($records);
238
+			    break;
239
+		    case 'date_desc':
240
+			    uasort($records, array('self', 'sortByChangeDateAndName'));
241 241
 		}
242 242
 
243 243
 		$html = '';
@@ -282,16 +282,16 @@  discard block
 block discarded – undo
282 282
 		$table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
283 283
 
284 284
 		switch ($sort) {
285
-		case 'name':
286
-		default:
287
-			$aaSorting = "[1,'asc'], [2,'desc']";
288
-			break;
289
-		case 'date_asc':
290
-			$aaSorting = "[2,'asc'], [1,'asc']";
291
-			break;
292
-		case 'date_desc':
293
-			$aaSorting = "[2,'desc'], [1,'asc']";
294
-			break;
285
+		    case 'name':
286
+		    default:
287
+			    $aaSorting = "[1,'asc'], [2,'desc']";
288
+			    break;
289
+		    case 'date_asc':
290
+			    $aaSorting = "[2,'asc'], [1,'asc']";
291
+			    break;
292
+		    case 'date_desc':
293
+			    $aaSorting = "[2,'desc'], [1,'asc']";
294
+			    break;
295 295
 		}
296 296
 
297 297
 		$html = '';
@@ -327,24 +327,24 @@  discard block
 block discarded – undo
327 327
 		foreach ($records as $record) {
328 328
 			$html .= '<tr><td>';
329 329
 			switch ($record::RECORD_TYPE) {
330
-			case 'INDI':
331
-				$html .= $record->getSexImage('small');
332
-				break;
333
-			case 'FAM':
334
-				$html .= '<i class="icon-button_family"></i>';
335
-				break;
336
-			case 'OBJE':
337
-				$html .= '<i class="icon-button_media"></i>';
338
-				break;
339
-			case 'NOTE':
340
-				$html .= '<i class="icon-button_note"></i>';
341
-				break;
342
-			case 'SOUR':
343
-				$html .= '<i class="icon-button_source"></i>';
344
-				break;
345
-			case 'REPO':
346
-				$html .= '<i class="icon-button_repository"></i>';
347
-				break;
330
+			    case 'INDI':
331
+				    $html .= $record->getSexImage('small');
332
+				    break;
333
+			    case 'FAM':
334
+				    $html .= '<i class="icon-button_family"></i>';
335
+				    break;
336
+			    case 'OBJE':
337
+				    $html .= '<i class="icon-button_media"></i>';
338
+				    break;
339
+			    case 'NOTE':
340
+				    $html .= '<i class="icon-button_note"></i>';
341
+				    break;
342
+			    case 'SOUR':
343
+				    $html .= '<i class="icon-button_source"></i>';
344
+				    break;
345
+			    case 'REPO':
346
+				    $html .= '<i class="icon-button_repository"></i>';
347
+				    break;
348 348
 			}
349 349
 			$html .= '</td>';
350 350
 			$html .= '<td data-sort="' . Filter::escapeHtml($record->getSortName()) . '">';
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@  discard block
 block discarded – undo
30 30
 /**
31 31
  * Class RecentChangesModule
32 32
  */
33
-class RecentChangesModule extends AbstractModule implements ModuleBlockInterface {
33
+class RecentChangesModule extends AbstractModule implements ModuleBlockInterface
34
+{
34 35
 	const DEFAULT_BLOCK      = '1';
35 36
 	const DEFAULT_DAYS       = 7;
36 37
 	const DEFAULT_HIDE_EMPTY = '0';
@@ -40,17 +41,20 @@  discard block
 block discarded – undo
40 41
 	const MAX_DAYS           = 90;
41 42
 
42 43
 	/** {@inheritdoc} */
43
-	public function getTitle() {
44
+	public function getTitle()
45
+	{
44 46
 		return /* I18N: Name of a module */ I18N::translate('Recent changes');
45 47
 	}
46 48
 
47 49
 	/** {@inheritdoc} */
48
-	public function getDescription() {
50
+	public function getDescription()
51
+	{
49 52
 		return /* I18N: Description of the “Recent changes” module */ I18N::translate('A list of records that have been updated recently.');
50 53
 	}
51 54
 
52 55
 	/** {@inheritdoc} */
53
-	public function getBlock($block_id, $template = true, $cfg = array()) {
56
+	public function getBlock($block_id, $template = true, $cfg = array())
57
+	{
54 58
 		global $ctype, $WT_TREE;
55 59
 
56 60
 		$days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
@@ -110,22 +114,26 @@  discard block
 block discarded – undo
110 114
 	}
111 115
 
112 116
 	/** {@inheritdoc} */
113
-	public function loadAjax() {
117
+	public function loadAjax()
118
+	{
114 119
 		return true;
115 120
 	}
116 121
 
117 122
 	/** {@inheritdoc} */
118
-	public function isUserBlock() {
123
+	public function isUserBlock()
124
+	{
119 125
 		return true;
120 126
 	}
121 127
 
122 128
 	/** {@inheritdoc} */
123
-	public function isGedcomBlock() {
129
+	public function isGedcomBlock()
130
+	{
124 131
 		return true;
125 132
 	}
126 133
 
127 134
 	/** {@inheritdoc} */
128
-	public function configureBlock($block_id) {
135
+	public function configureBlock($block_id)
136
+	{
129 137
 		if (Filter::postBool('save') && Filter::checkCsrf()) {
130 138
 			$this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
131 139
 			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
@@ -195,7 +203,8 @@  discard block
 block discarded – undo
195 203
 	 *
196 204
 	 * @return GedcomRecord[] List of records with changes
197 205
 	 */
198
-	private function getRecentChanges(Tree $tree, $jd) {
206
+	private function getRecentChanges(Tree $tree, $jd)
207
+	{
199 208
 		$sql =
200 209
 			"SELECT d_gid FROM `##dates`" .
201 210
 			" WHERE d_fact='CHAN' AND d_julianday1 >= :jd AND d_file = :tree_id";
@@ -227,7 +236,8 @@  discard block
 block discarded – undo
227 236
 	 *
228 237
 	 * @return string
229 238
 	 */
230
-	private function changesList(array $records, $sort, $show_user) {
239
+	private function changesList(array $records, $sort, $show_user)
240
+	{
231 241
 		switch ($sort) {
232 242
 		case 'name':
233 243
 			uasort($records, array('self', 'sortByNameAndChangeDate'));
@@ -276,7 +286,8 @@  discard block
 block discarded – undo
276 286
 	 *
277 287
 	 * @return string
278 288
 	 */
279
-	private function changesTable($records, $sort, $show_user) {
289
+	private function changesTable($records, $sort, $show_user)
290
+	{
280 291
 		global $controller;
281 292
 
282 293
 		$table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
@@ -372,7 +383,8 @@  discard block
 block discarded – undo
372 383
 	 *
373 384
 	 * @return int
374 385
 	 */
375
-	private static function sortByChangeDateAndName(GedcomRecord $a, GedcomRecord $b) {
386
+	private static function sortByChangeDateAndName(GedcomRecord $a, GedcomRecord $b)
387
+	{
376 388
 		return $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true) ?: GedcomRecord::compare($a, $b);
377 389
 	}
378 390
 
@@ -384,7 +396,8 @@  discard block
 block discarded – undo
384 396
 	 *
385 397
 	 * @return int
386 398
 	 */
387
-	private static function sortByNameAndChangeDate(GedcomRecord $a, GedcomRecord $b) {
399
+	private static function sortByNameAndChangeDate(GedcomRecord $a, GedcomRecord $b)
400
+	{
388 401
 		return GedcomRecord::compare($a, $b) ?: $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true);
389 402
 	}
390 403
 }
Please login to merge, or discard this patch.
app/Module/TopGivenNamesModule.php 3 patches
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -26,132 +26,132 @@
 block discarded – undo
26 26
  * Class TopGivenNamesModule
27 27
  */
28 28
 class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface {
29
-	/** {@inheritdoc} */
30
-	public function getTitle() {
31
-		return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top given names');
32
-	}
33
-
34
-	/** {@inheritdoc} */
35
-	public function getDescription() {
36
-		return /* I18N: Description of the “Top given names” module */ I18N::translate('A list of the most popular given names.');
37
-	}
38
-
39
-	/**
40
-	 * Generate the HTML content of this block.
41
-	 *
42
-	 * @param int      $block_id
43
-	 * @param bool     $template
44
-	 * @param string[] $cfg
45
-	 *
46
-	 * @return string
47
-	 */
48
-	public function getBlock($block_id, $template = true, $cfg = array()) {
49
-		global $ctype, $WT_TREE;
50
-
51
-		$num       = $this->getBlockSetting($block_id, 'num', '10');
52
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
-
54
-		foreach (array('num', 'infoStyle') as $name) {
55
-			if (array_key_exists($name, $cfg)) {
56
-				$$name = $cfg[$name];
57
-			}
58
-		}
59
-
60
-		$stats = new Stats($WT_TREE);
61
-
62
-		$id    = $this->getName() . $block_id;
63
-		$class = $this->getName() . '_block';
64
-		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
65
-			$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
66
-		} else {
67
-			$title = '';
68
-		}
69
-		if ($num == 1) {
70
-			// I18N: i.e. most popular given name.
71
-			$title .= I18N::translate('Top given name');
72
-		} else {
73
-			// I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1
74
-			$title .= I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num));
75
-		}
76
-
77
-		$content = '<div class="normal_inner_block">';
78
-		//Select List or Table
79
-		switch ($infoStyle) {
80
-		case "list": // Output style 1:  Simple list style. Better suited to left side of page.
81
-			if (I18N::direction() === 'ltr') {
82
-				$padding = 'padding-left: 15px';
83
-			} else {
84
-				$padding = 'padding-right: 15px';
85
-			}
86
-			$params = array(1, $num, 'rcount');
87
-			// List Female names
88
-			$totals = $stats->commonGivenFemaleTotals($params);
89
-			if ($totals) {
90
-				$content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
91
-			}
92
-			// List Male names
93
-			$totals = $stats->commonGivenMaleTotals($params);
94
-			if ($totals) {
95
-				$content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
96
-			}
97
-			break;
98
-		case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
99
-			$params = array(1, $num, 'rcount');
100
-			$content .= '<table style="margin:auto;">
29
+    /** {@inheritdoc} */
30
+    public function getTitle() {
31
+        return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top given names');
32
+    }
33
+
34
+    /** {@inheritdoc} */
35
+    public function getDescription() {
36
+        return /* I18N: Description of the “Top given names” module */ I18N::translate('A list of the most popular given names.');
37
+    }
38
+
39
+    /**
40
+     * Generate the HTML content of this block.
41
+     *
42
+     * @param int      $block_id
43
+     * @param bool     $template
44
+     * @param string[] $cfg
45
+     *
46
+     * @return string
47
+     */
48
+    public function getBlock($block_id, $template = true, $cfg = array()) {
49
+        global $ctype, $WT_TREE;
50
+
51
+        $num       = $this->getBlockSetting($block_id, 'num', '10');
52
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
+
54
+        foreach (array('num', 'infoStyle') as $name) {
55
+            if (array_key_exists($name, $cfg)) {
56
+                $$name = $cfg[$name];
57
+            }
58
+        }
59
+
60
+        $stats = new Stats($WT_TREE);
61
+
62
+        $id    = $this->getName() . $block_id;
63
+        $class = $this->getName() . '_block';
64
+        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
65
+            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
66
+        } else {
67
+            $title = '';
68
+        }
69
+        if ($num == 1) {
70
+            // I18N: i.e. most popular given name.
71
+            $title .= I18N::translate('Top given name');
72
+        } else {
73
+            // I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1
74
+            $title .= I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num));
75
+        }
76
+
77
+        $content = '<div class="normal_inner_block">';
78
+        //Select List or Table
79
+        switch ($infoStyle) {
80
+        case "list": // Output style 1:  Simple list style. Better suited to left side of page.
81
+            if (I18N::direction() === 'ltr') {
82
+                $padding = 'padding-left: 15px';
83
+            } else {
84
+                $padding = 'padding-right: 15px';
85
+            }
86
+            $params = array(1, $num, 'rcount');
87
+            // List Female names
88
+            $totals = $stats->commonGivenFemaleTotals($params);
89
+            if ($totals) {
90
+                $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
91
+            }
92
+            // List Male names
93
+            $totals = $stats->commonGivenMaleTotals($params);
94
+            if ($totals) {
95
+                $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
96
+            }
97
+            break;
98
+        case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
99
+            $params = array(1, $num, 'rcount');
100
+            $content .= '<table style="margin:auto;">
101 101
 						<tr>
102 102
 						<td>' . $stats->commonGivenFemaleTable($params) . '</td>
103 103
 						<td>' . $stats->commonGivenMaleTable($params) . '</td>';
104
-			$content .= '</tr></table>';
105
-			break;
106
-		}
107
-		$content .= "</div>";
108
-
109
-		if ($template) {
110
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
111
-		} else {
112
-			return $content;
113
-		}
114
-	}
115
-
116
-	/** {@inheritdoc} */
117
-	public function loadAjax() {
118
-		return true;
119
-	}
120
-
121
-	/** {@inheritdoc} */
122
-	public function isUserBlock() {
123
-		return true;
124
-	}
125
-
126
-	/** {@inheritdoc} */
127
-	public function isGedcomBlock() {
128
-		return true;
129
-	}
130
-
131
-	/**
132
-	 * An HTML form to edit block settings
133
-	 *
134
-	 * @param int $block_id
135
-	 */
136
-	public function configureBlock($block_id) {
137
-		if (Filter::postBool('save') && Filter::checkCsrf()) {
138
-			$this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
139
-			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
140
-		}
141
-
142
-		$num       = $this->getBlockSetting($block_id, 'num', '10');
143
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
144
-
145
-		echo '<tr><td class="descriptionbox wrap width33">';
146
-		echo /* I18N: ... to show in a list */ I18N::translate('Number of given names');
147
-		echo '</td><td class="optionbox">';
148
-		echo '<input type="text" name="num" size="2" value="', $num, '">';
149
-		echo '</td></tr>';
150
-
151
-		echo '<tr><td class="descriptionbox wrap width33">';
152
-		echo I18N::translate('Presentation style');
153
-		echo '</td><td class="optionbox">';
154
-		echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
155
-		echo '</td></tr>';
156
-	}
104
+            $content .= '</tr></table>';
105
+            break;
106
+        }
107
+        $content .= "</div>";
108
+
109
+        if ($template) {
110
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
111
+        } else {
112
+            return $content;
113
+        }
114
+    }
115
+
116
+    /** {@inheritdoc} */
117
+    public function loadAjax() {
118
+        return true;
119
+    }
120
+
121
+    /** {@inheritdoc} */
122
+    public function isUserBlock() {
123
+        return true;
124
+    }
125
+
126
+    /** {@inheritdoc} */
127
+    public function isGedcomBlock() {
128
+        return true;
129
+    }
130
+
131
+    /**
132
+     * An HTML form to edit block settings
133
+     *
134
+     * @param int $block_id
135
+     */
136
+    public function configureBlock($block_id) {
137
+        if (Filter::postBool('save') && Filter::checkCsrf()) {
138
+            $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
139
+            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
140
+        }
141
+
142
+        $num       = $this->getBlockSetting($block_id, 'num', '10');
143
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
144
+
145
+        echo '<tr><td class="descriptionbox wrap width33">';
146
+        echo /* I18N: ... to show in a list */ I18N::translate('Number of given names');
147
+        echo '</td><td class="optionbox">';
148
+        echo '<input type="text" name="num" size="2" value="', $num, '">';
149
+        echo '</td></tr>';
150
+
151
+        echo '<tr><td class="descriptionbox wrap width33">';
152
+        echo I18N::translate('Presentation style');
153
+        echo '</td><td class="optionbox">';
154
+        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
155
+        echo '</td></tr>';
156
+    }
157 157
 }
Please login to merge, or discard this patch.
Switch Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -77,32 +77,32 @@
 block discarded – undo
77 77
 		$content = '<div class="normal_inner_block">';
78 78
 		//Select List or Table
79 79
 		switch ($infoStyle) {
80
-		case "list": // Output style 1:  Simple list style. Better suited to left side of page.
81
-			if (I18N::direction() === 'ltr') {
82
-				$padding = 'padding-left: 15px';
83
-			} else {
84
-				$padding = 'padding-right: 15px';
85
-			}
86
-			$params = array(1, $num, 'rcount');
87
-			// List Female names
88
-			$totals = $stats->commonGivenFemaleTotals($params);
89
-			if ($totals) {
90
-				$content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
91
-			}
92
-			// List Male names
93
-			$totals = $stats->commonGivenMaleTotals($params);
94
-			if ($totals) {
95
-				$content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
96
-			}
97
-			break;
98
-		case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
99
-			$params = array(1, $num, 'rcount');
100
-			$content .= '<table style="margin:auto;">
80
+		    case "list": // Output style 1:  Simple list style. Better suited to left side of page.
81
+			    if (I18N::direction() === 'ltr') {
82
+				    $padding = 'padding-left: 15px';
83
+			    } else {
84
+				    $padding = 'padding-right: 15px';
85
+			    }
86
+			    $params = array(1, $num, 'rcount');
87
+			    // List Female names
88
+			    $totals = $stats->commonGivenFemaleTotals($params);
89
+			    if ($totals) {
90
+				    $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
91
+			    }
92
+			    // List Male names
93
+			    $totals = $stats->commonGivenMaleTotals($params);
94
+			    if ($totals) {
95
+				    $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
96
+			    }
97
+			    break;
98
+		    case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
99
+			    $params = array(1, $num, 'rcount');
100
+			    $content .= '<table style="margin:auto;">
101 101
 						<tr>
102 102
 						<td>' . $stats->commonGivenFemaleTable($params) . '</td>
103 103
 						<td>' . $stats->commonGivenMaleTable($params) . '</td>';
104
-			$content .= '</tr></table>';
105
-			break;
104
+			    $content .= '</tr></table>';
105
+			    break;
106 106
 		}
107 107
 		$content .= "</div>";
108 108
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,14 +25,17 @@  discard block
 block discarded – undo
25 25
 /**
26 26
  * Class TopGivenNamesModule
27 27
  */
28
-class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface {
28
+class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface
29
+{
29 30
 	/** {@inheritdoc} */
30
-	public function getTitle() {
31
+	public function getTitle()
32
+	{
31 33
 		return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top given names');
32 34
 	}
33 35
 
34 36
 	/** {@inheritdoc} */
35
-	public function getDescription() {
37
+	public function getDescription()
38
+	{
36 39
 		return /* I18N: Description of the “Top given names” module */ I18N::translate('A list of the most popular given names.');
37 40
 	}
38 41
 
@@ -45,7 +48,8 @@  discard block
 block discarded – undo
45 48
 	 *
46 49
 	 * @return string
47 50
 	 */
48
-	public function getBlock($block_id, $template = true, $cfg = array()) {
51
+	public function getBlock($block_id, $template = true, $cfg = array())
52
+	{
49 53
 		global $ctype, $WT_TREE;
50 54
 
51 55
 		$num       = $this->getBlockSetting($block_id, 'num', '10');
@@ -114,17 +118,20 @@  discard block
 block discarded – undo
114 118
 	}
115 119
 
116 120
 	/** {@inheritdoc} */
117
-	public function loadAjax() {
121
+	public function loadAjax()
122
+	{
118 123
 		return true;
119 124
 	}
120 125
 
121 126
 	/** {@inheritdoc} */
122
-	public function isUserBlock() {
127
+	public function isUserBlock()
128
+	{
123 129
 		return true;
124 130
 	}
125 131
 
126 132
 	/** {@inheritdoc} */
127
-	public function isGedcomBlock() {
133
+	public function isGedcomBlock()
134
+	{
128 135
 		return true;
129 136
 	}
130 137
 
@@ -133,7 +140,8 @@  discard block
 block discarded – undo
133 140
 	 *
134 141
 	 * @param int $block_id
135 142
 	 */
136
-	public function configureBlock($block_id) {
143
+	public function configureBlock($block_id)
144
+	{
137 145
 		if (Filter::postBool('save') && Filter::checkCsrf()) {
138 146
 			$this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
139 147
 			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
Please login to merge, or discard this patch.
app/Module/ModuleThemeInterface.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,5 +20,6 @@
 block discarded – undo
20 20
  *
21 21
  * This class is not currently used
22 22
  */
23
-interface ModuleThemeInterface {
23
+interface ModuleThemeInterface
24
+{
24 25
 }
Please login to merge, or discard this patch.
app/Module/DescendancyReportModule.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@
 block discarded – undo
23 23
  * Class DescendancyReportModule
24 24
  */
25 25
 class DescendancyReportModule extends AbstractModule implements ModuleReportInterface {
26
-	/** {@inheritdoc} */
27
-	public function getTitle() {
28
-		// This text also appears in the .XML file - update both together
29
-		return /* I18N: Name of a module/report */ I18N::translate('Descendants');
30
-	}
26
+    /** {@inheritdoc} */
27
+    public function getTitle() {
28
+        // This text also appears in the .XML file - update both together
29
+        return /* I18N: Name of a module/report */ I18N::translate('Descendants');
30
+    }
31 31
 
32
-	/** {@inheritdoc} */
33
-	public function getDescription() {
34
-		// This text also appears in the .XML file - update both together
35
-		return /* I18N: Description of the “Descendants” module */ I18N::translate('A report of an individual’s descendants, in a narrative style.');
36
-	}
32
+    /** {@inheritdoc} */
33
+    public function getDescription() {
34
+        // This text also appears in the .XML file - update both together
35
+        return /* I18N: Description of the “Descendants” module */ I18N::translate('A report of an individual’s descendants, in a narrative style.');
36
+    }
37 37
 
38
-	/**
39
-	 * What is the default access level for this module?
40
-	 *
41
-	 * Some modules are aimed at admins or managers, and are not generally shown to users.
42
-	 *
43
-	 * @return int
44
-	 */
45
-	public function defaultAccessLevel() {
46
-		return Auth::PRIV_PRIVATE;
47
-	}
38
+    /**
39
+     * What is the default access level for this module?
40
+     *
41
+     * Some modules are aimed at admins or managers, and are not generally shown to users.
42
+     *
43
+     * @return int
44
+     */
45
+    public function defaultAccessLevel() {
46
+        return Auth::PRIV_PRIVATE;
47
+    }
48 48
 
49
-	/**
50
-	 * Return a menu item for this report.
51
-	 *
52
-	 * @return Menu
53
-	 */
54
-	public function getReportMenu() {
55
-		global $controller, $WT_TREE;
49
+    /**
50
+     * Return a menu item for this report.
51
+     *
52
+     * @return Menu
53
+     */
54
+    public function getReportMenu() {
55
+        global $controller, $WT_TREE;
56 56
 
57
-		return new Menu(
58
-			$this->getTitle(),
59
-			'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
-			'menu-report-' . $this->getName(),
61
-			array('rel' => 'nofollow')
62
-		);
63
-	}
57
+        return new Menu(
58
+            $this->getTitle(),
59
+            'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
+            'menu-report-' . $this->getName(),
61
+            array('rel' => 'nofollow')
62
+        );
63
+    }
64 64
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,15 +22,18 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Class DescendancyReportModule
24 24
  */
25
-class DescendancyReportModule extends AbstractModule implements ModuleReportInterface {
25
+class DescendancyReportModule extends AbstractModule implements ModuleReportInterface
26
+{
26 27
 	/** {@inheritdoc} */
27
-	public function getTitle() {
28
+	public function getTitle()
29
+	{
28 30
 		// This text also appears in the .XML file - update both together
29 31
 		return /* I18N: Name of a module/report */ I18N::translate('Descendants');
30 32
 	}
31 33
 
32 34
 	/** {@inheritdoc} */
33
-	public function getDescription() {
35
+	public function getDescription()
36
+	{
34 37
 		// This text also appears in the .XML file - update both together
35 38
 		return /* I18N: Description of the “Descendants” module */ I18N::translate('A report of an individual’s descendants, in a narrative style.');
36 39
 	}
@@ -42,7 +45,8 @@  discard block
 block discarded – undo
42 45
 	 *
43 46
 	 * @return int
44 47
 	 */
45
-	public function defaultAccessLevel() {
48
+	public function defaultAccessLevel()
49
+	{
46 50
 		return Auth::PRIV_PRIVATE;
47 51
 	}
48 52
 
@@ -51,7 +55,8 @@  discard block
 block discarded – undo
51 55
 	 *
52 56
 	 * @return Menu
53 57
 	 */
54
-	public function getReportMenu() {
58
+	public function getReportMenu()
59
+	{
55 60
 		global $controller, $WT_TREE;
56 61
 
57 62
 		return new Menu(
Please login to merge, or discard this patch.
app/Module/IndividualFamiliesReportModule.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@
 block discarded – undo
23 23
  * Class IndividualFamiliesReportModule
24 24
  */
25 25
 class IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface {
26
-	/** {@inheritdoc} */
27
-	public function getTitle() {
28
-		// This text also appears in the .XML file - update both together
29
-		return /* I18N: Name of a module/report */ I18N::translate('Related families');
30
-	}
26
+    /** {@inheritdoc} */
27
+    public function getTitle() {
28
+        // This text also appears in the .XML file - update both together
29
+        return /* I18N: Name of a module/report */ I18N::translate('Related families');
30
+    }
31 31
 
32
-	/** {@inheritdoc} */
33
-	public function getDescription() {
34
-		// This text also appears in the .XML file - update both together
35
-		return /* I18N: Description of the “Related families” */ I18N::translate('A report of the families that are closely related to an individual.');
36
-	}
32
+    /** {@inheritdoc} */
33
+    public function getDescription() {
34
+        // This text also appears in the .XML file - update both together
35
+        return /* I18N: Description of the “Related families” */ I18N::translate('A report of the families that are closely related to an individual.');
36
+    }
37 37
 
38
-	/**
39
-	 * What is the default access level for this module?
40
-	 *
41
-	 * Some modules are aimed at admins or managers, and are not generally shown to users.
42
-	 *
43
-	 * @return int
44
-	 */
45
-	public function defaultAccessLevel() {
46
-		return Auth::PRIV_USER;
47
-	}
38
+    /**
39
+     * What is the default access level for this module?
40
+     *
41
+     * Some modules are aimed at admins or managers, and are not generally shown to users.
42
+     *
43
+     * @return int
44
+     */
45
+    public function defaultAccessLevel() {
46
+        return Auth::PRIV_USER;
47
+    }
48 48
 
49
-	/**
50
-	 * Return a menu item for this report.
51
-	 *
52
-	 * @return Menu
53
-	 */
54
-	public function getReportMenu() {
55
-		global $controller, $WT_TREE;
49
+    /**
50
+     * Return a menu item for this report.
51
+     *
52
+     * @return Menu
53
+     */
54
+    public function getReportMenu() {
55
+        global $controller, $WT_TREE;
56 56
 
57
-		return new Menu(
58
-			$this->getTitle(),
59
-			'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
-			'menu-report-' . $this->getName(),
61
-			array('rel' => 'nofollow')
62
-		);
63
-	}
57
+        return new Menu(
58
+            $this->getTitle(),
59
+            'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
+            'menu-report-' . $this->getName(),
61
+            array('rel' => 'nofollow')
62
+        );
63
+    }
64 64
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,15 +22,18 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Class IndividualFamiliesReportModule
24 24
  */
25
-class IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface {
25
+class IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface
26
+{
26 27
 	/** {@inheritdoc} */
27
-	public function getTitle() {
28
+	public function getTitle()
29
+	{
28 30
 		// This text also appears in the .XML file - update both together
29 31
 		return /* I18N: Name of a module/report */ I18N::translate('Related families');
30 32
 	}
31 33
 
32 34
 	/** {@inheritdoc} */
33
-	public function getDescription() {
35
+	public function getDescription()
36
+	{
34 37
 		// This text also appears in the .XML file - update both together
35 38
 		return /* I18N: Description of the “Related families” */ I18N::translate('A report of the families that are closely related to an individual.');
36 39
 	}
@@ -42,7 +45,8 @@  discard block
 block discarded – undo
42 45
 	 *
43 46
 	 * @return int
44 47
 	 */
45
-	public function defaultAccessLevel() {
48
+	public function defaultAccessLevel()
49
+	{
46 50
 		return Auth::PRIV_USER;
47 51
 	}
48 52
 
@@ -51,7 +55,8 @@  discard block
 block discarded – undo
51 55
 	 *
52 56
 	 * @return Menu
53 57
 	 */
54
-	public function getReportMenu() {
58
+	public function getReportMenu()
59
+	{
55 60
 		global $controller, $WT_TREE;
56 61
 
57 62
 		return new Menu(
Please login to merge, or discard this patch.
app/Module/OnThisDayModule.php 3 patches
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -26,137 +26,137 @@
 block discarded – undo
26 26
  * Class OnThisDayModule
27 27
  */
28 28
 class OnThisDayModule extends AbstractModule implements ModuleBlockInterface {
29
-	/** {@inheritdoc} */
30
-	public function getTitle() {
31
-		return /* I18N: Name of a module */ I18N::translate('On this day');
32
-	}
33
-
34
-	/** {@inheritdoc} */
35
-	public function getDescription() {
36
-		return /* I18N: Description of the “On this day” module */ I18N::translate('A list of the anniversaries that occur today.');
37
-	}
38
-
39
-	/**
40
-	 * Generate the HTML content of this block.
41
-	 *
42
-	 * @param int      $block_id
43
-	 * @param bool     $template
44
-	 * @param string[] $cfg
45
-	 *
46
-	 * @return string
47
-	 */
48
-	public function getBlock($block_id, $template = true, $cfg = array()) {
49
-		global $ctype, $WT_TREE;
50
-
51
-		$filter    = $this->getBlockSetting($block_id, 'filter', '1');
52
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
-		$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
54
-		$block     = $this->getBlockSetting($block_id, 'block', '1');
55
-
56
-		foreach (array('filter', 'infoStyle', 'sortStyle', 'block') as $name) {
57
-			if (array_key_exists($name, $cfg)) {
58
-				$$name = $cfg[$name];
59
-			}
60
-		}
61
-
62
-		$todayjd = WT_CLIENT_JD;
63
-
64
-		$id    = $this->getName() . $block_id;
65
-		$class = $this->getName() . '_block';
66
-		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
67
-			$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
68
-		} else {
69
-			$title = '';
70
-		}
71
-		$title .= $this->getTitle();
72
-
73
-		$content = '';
74
-
75
-		// If we are only showing living individuals, then we don't need to search for DEAT events.
76
-		$tags = $filter ? 'BIRT MARR' : 'BIRT MARR DEAT';
77
-
78
-		switch ($infoStyle) {
79
-		case 'list':
80
-			// Output style 1:  Old format, no visible tables, much smaller text. Better suited to right side of page.
81
-			$content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle);
82
-			break;
83
-		case 'table':
84
-			// Style 2: New format, tables, big text, etc. Not too good on right side of page
85
-			ob_start();
86
-			$content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle);
87
-			$content .= ob_get_clean();
88
-			break;
89
-		}
90
-
91
-		if ($template) {
92
-			if ($block) {
93
-				$class .= ' small_inner_block';
94
-			}
95
-
96
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
97
-		} else {
98
-			return $content;
99
-		}
100
-	}
101
-
102
-	/** {@inheritdoc} */
103
-	public function loadAjax() {
104
-		return true;
105
-	}
106
-
107
-	/** {@inheritdoc} */
108
-	public function isUserBlock() {
109
-		return true;
110
-	}
111
-
112
-	/** {@inheritdoc} */
113
-	public function isGedcomBlock() {
114
-		return true;
115
-	}
116
-
117
-	/**
118
-	 * An HTML form to edit block settings
119
-	 *
120
-	 * @param int $block_id
121
-	 */
122
-	public function configureBlock($block_id) {
123
-		if (Filter::postBool('save') && Filter::checkCsrf()) {
124
-			$this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
125
-			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
126
-			$this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
127
-			$this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
128
-		}
129
-
130
-		$filter    = $this->getBlockSetting($block_id, 'filter', '1');
131
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
132
-		$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
133
-		$block     = $this->getBlockSetting($block_id, 'block', '1');
134
-
135
-		echo '<tr><td class="descriptionbox wrap width33">';
136
-		echo /* I18N: Label for a configuration option */ I18N::translate('Show only events of living individuals');
137
-		echo '</td><td class="optionbox">';
138
-		echo FunctionsEdit::editFieldYesNo('filter', $filter);
139
-		echo '</td></tr>';
140
-
141
-		echo '<tr><td class="descriptionbox wrap width33">';
142
-		echo /* I18N: Label for a configuration option */ I18N::translate('Presentation style');
143
-		echo '</td><td class="optionbox">';
144
-		echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
145
-		echo '</td></tr>';
146
-
147
-		echo '<tr><td class="descriptionbox wrap width33">';
148
-		echo /* I18N: Label for a configuration option */ I18N::translate('Sort order');
149
-		echo '</td><td class="optionbox">';
150
-		echo FunctionsEdit::selectEditControl('sortStyle', array(
151
-			/* I18N: An option in a list-box */ 'alpha' => I18N::translate('sort by name'),
152
-			/* I18N: An option in a list-box */ 'anniv' => I18N::translate('sort by date'),
153
-		), null, $sortStyle, '');
154
-		echo '</td></tr>';
155
-
156
-		echo '<tr><td class="descriptionbox wrap width33">';
157
-		echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
158
-		echo '</td><td class="optionbox">';
159
-		echo FunctionsEdit::editFieldYesNo('block', $block);
160
-		echo '</td></tr>';
161
-	}
29
+    /** {@inheritdoc} */
30
+    public function getTitle() {
31
+        return /* I18N: Name of a module */ I18N::translate('On this day');
32
+    }
33
+
34
+    /** {@inheritdoc} */
35
+    public function getDescription() {
36
+        return /* I18N: Description of the “On this day” module */ I18N::translate('A list of the anniversaries that occur today.');
37
+    }
38
+
39
+    /**
40
+     * Generate the HTML content of this block.
41
+     *
42
+     * @param int      $block_id
43
+     * @param bool     $template
44
+     * @param string[] $cfg
45
+     *
46
+     * @return string
47
+     */
48
+    public function getBlock($block_id, $template = true, $cfg = array()) {
49
+        global $ctype, $WT_TREE;
50
+
51
+        $filter    = $this->getBlockSetting($block_id, 'filter', '1');
52
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
+        $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
54
+        $block     = $this->getBlockSetting($block_id, 'block', '1');
55
+
56
+        foreach (array('filter', 'infoStyle', 'sortStyle', 'block') as $name) {
57
+            if (array_key_exists($name, $cfg)) {
58
+                $$name = $cfg[$name];
59
+            }
60
+        }
61
+
62
+        $todayjd = WT_CLIENT_JD;
63
+
64
+        $id    = $this->getName() . $block_id;
65
+        $class = $this->getName() . '_block';
66
+        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
67
+            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
68
+        } else {
69
+            $title = '';
70
+        }
71
+        $title .= $this->getTitle();
72
+
73
+        $content = '';
74
+
75
+        // If we are only showing living individuals, then we don't need to search for DEAT events.
76
+        $tags = $filter ? 'BIRT MARR' : 'BIRT MARR DEAT';
77
+
78
+        switch ($infoStyle) {
79
+        case 'list':
80
+            // Output style 1:  Old format, no visible tables, much smaller text. Better suited to right side of page.
81
+            $content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle);
82
+            break;
83
+        case 'table':
84
+            // Style 2: New format, tables, big text, etc. Not too good on right side of page
85
+            ob_start();
86
+            $content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle);
87
+            $content .= ob_get_clean();
88
+            break;
89
+        }
90
+
91
+        if ($template) {
92
+            if ($block) {
93
+                $class .= ' small_inner_block';
94
+            }
95
+
96
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
97
+        } else {
98
+            return $content;
99
+        }
100
+    }
101
+
102
+    /** {@inheritdoc} */
103
+    public function loadAjax() {
104
+        return true;
105
+    }
106
+
107
+    /** {@inheritdoc} */
108
+    public function isUserBlock() {
109
+        return true;
110
+    }
111
+
112
+    /** {@inheritdoc} */
113
+    public function isGedcomBlock() {
114
+        return true;
115
+    }
116
+
117
+    /**
118
+     * An HTML form to edit block settings
119
+     *
120
+     * @param int $block_id
121
+     */
122
+    public function configureBlock($block_id) {
123
+        if (Filter::postBool('save') && Filter::checkCsrf()) {
124
+            $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
125
+            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
126
+            $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
127
+            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
128
+        }
129
+
130
+        $filter    = $this->getBlockSetting($block_id, 'filter', '1');
131
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
132
+        $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
133
+        $block     = $this->getBlockSetting($block_id, 'block', '1');
134
+
135
+        echo '<tr><td class="descriptionbox wrap width33">';
136
+        echo /* I18N: Label for a configuration option */ I18N::translate('Show only events of living individuals');
137
+        echo '</td><td class="optionbox">';
138
+        echo FunctionsEdit::editFieldYesNo('filter', $filter);
139
+        echo '</td></tr>';
140
+
141
+        echo '<tr><td class="descriptionbox wrap width33">';
142
+        echo /* I18N: Label for a configuration option */ I18N::translate('Presentation style');
143
+        echo '</td><td class="optionbox">';
144
+        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
145
+        echo '</td></tr>';
146
+
147
+        echo '<tr><td class="descriptionbox wrap width33">';
148
+        echo /* I18N: Label for a configuration option */ I18N::translate('Sort order');
149
+        echo '</td><td class="optionbox">';
150
+        echo FunctionsEdit::selectEditControl('sortStyle', array(
151
+            /* I18N: An option in a list-box */ 'alpha' => I18N::translate('sort by name'),
152
+            /* I18N: An option in a list-box */ 'anniv' => I18N::translate('sort by date'),
153
+        ), null, $sortStyle, '');
154
+        echo '</td></tr>';
155
+
156
+        echo '<tr><td class="descriptionbox wrap width33">';
157
+        echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
158
+        echo '</td><td class="optionbox">';
159
+        echo FunctionsEdit::editFieldYesNo('block', $block);
160
+        echo '</td></tr>';
161
+    }
162 162
 }
Please login to merge, or discard this patch.
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -76,16 +76,16 @@
 block discarded – undo
76 76
 		$tags = $filter ? 'BIRT MARR' : 'BIRT MARR DEAT';
77 77
 
78 78
 		switch ($infoStyle) {
79
-		case 'list':
80
-			// Output style 1:  Old format, no visible tables, much smaller text. Better suited to right side of page.
81
-			$content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle);
82
-			break;
83
-		case 'table':
84
-			// Style 2: New format, tables, big text, etc. Not too good on right side of page
85
-			ob_start();
86
-			$content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle);
87
-			$content .= ob_get_clean();
88
-			break;
79
+		    case 'list':
80
+			    // Output style 1:  Old format, no visible tables, much smaller text. Better suited to right side of page.
81
+			    $content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle);
82
+			    break;
83
+		    case 'table':
84
+			    // Style 2: New format, tables, big text, etc. Not too good on right side of page
85
+			    ob_start();
86
+			    $content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle);
87
+			    $content .= ob_get_clean();
88
+			    break;
89 89
 		}
90 90
 
91 91
 		if ($template) {
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,14 +25,17 @@  discard block
 block discarded – undo
25 25
 /**
26 26
  * Class OnThisDayModule
27 27
  */
28
-class OnThisDayModule extends AbstractModule implements ModuleBlockInterface {
28
+class OnThisDayModule extends AbstractModule implements ModuleBlockInterface
29
+{
29 30
 	/** {@inheritdoc} */
30
-	public function getTitle() {
31
+	public function getTitle()
32
+	{
31 33
 		return /* I18N: Name of a module */ I18N::translate('On this day');
32 34
 	}
33 35
 
34 36
 	/** {@inheritdoc} */
35
-	public function getDescription() {
37
+	public function getDescription()
38
+	{
36 39
 		return /* I18N: Description of the “On this day” module */ I18N::translate('A list of the anniversaries that occur today.');
37 40
 	}
38 41
 
@@ -45,7 +48,8 @@  discard block
 block discarded – undo
45 48
 	 *
46 49
 	 * @return string
47 50
 	 */
48
-	public function getBlock($block_id, $template = true, $cfg = array()) {
51
+	public function getBlock($block_id, $template = true, $cfg = array())
52
+	{
49 53
 		global $ctype, $WT_TREE;
50 54
 
51 55
 		$filter    = $this->getBlockSetting($block_id, 'filter', '1');
@@ -100,17 +104,20 @@  discard block
 block discarded – undo
100 104
 	}
101 105
 
102 106
 	/** {@inheritdoc} */
103
-	public function loadAjax() {
107
+	public function loadAjax()
108
+	{
104 109
 		return true;
105 110
 	}
106 111
 
107 112
 	/** {@inheritdoc} */
108
-	public function isUserBlock() {
113
+	public function isUserBlock()
114
+	{
109 115
 		return true;
110 116
 	}
111 117
 
112 118
 	/** {@inheritdoc} */
113
-	public function isGedcomBlock() {
119
+	public function isGedcomBlock()
120
+	{
114 121
 		return true;
115 122
 	}
116 123
 
@@ -119,7 +126,8 @@  discard block
 block discarded – undo
119 126
 	 *
120 127
 	 * @param int $block_id
121 128
 	 */
122
-	public function configureBlock($block_id) {
129
+	public function configureBlock($block_id)
130
+	{
123 131
 		if (Filter::postBool('save') && Filter::checkCsrf()) {
124 132
 			$this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
125 133
 			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
Please login to merge, or discard this patch.
app/Module/AbstractModule.php 2 patches
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -23,206 +23,206 @@
 block discarded – undo
23 23
  * Class AbstractModule - common functions for blocks
24 24
  */
25 25
 abstract class AbstractModule {
26
-	/** @var string The directory where the module is installed */
27
-	private $directory;
28
-
29
-	/** @var string[] A cached copy of the module settings */
30
-	private $settings;
31
-
32
-	/** @var string For custom modules - optional (recommended) version number */
33
-	const CUSTOM_VERSION = '';
34
-
35
-	/** @var string For custom modules - link for support, upgrades, etc. */
36
-	const CUSTOM_WEBSITE = '';
37
-
38
-	/**
39
-	 * Create a new module.
40
-	 *
41
-	 * @param string $directory Where is this module installed
42
-	 */
43
-	public function __construct($directory) {
44
-		$this->directory = $directory;
45
-	}
46
-
47
-	/**
48
-	 * Get a block setting.
49
-	 *
50
-	 * @param int         $block_id
51
-	 * @param string      $setting_name
52
-	 * @param string|null $default_value
53
-	 *
54
-	 * @return null|string
55
-	 */
56
-	public function getBlockSetting($block_id, $setting_name, $default_value = null) {
57
-		$setting_value = Database::prepare(
58
-			"SELECT setting_value FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
59
-		)->execute(array(
60
-			'block_id'     => $block_id,
61
-			'setting_name' => $setting_name,
62
-		))->fetchOne();
63
-
64
-		return $setting_value === null ? $default_value : $setting_value;
65
-	}
66
-
67
-	/**
68
-	 * Set a block setting.
69
-	 *
70
-	 * @param int         $block_id
71
-	 * @param string      $setting_name
72
-	 * @param string|null $setting_value
73
-	 *
74
-	 * @return $this
75
-	 */
76
-	public function setBlockSetting($block_id, $setting_name, $setting_value) {
77
-		if ($setting_value === null) {
78
-			Database::prepare(
79
-				"DELETE FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
80
-			)->execute(array(
81
-					'block_id'     => $block_id,
82
-					'setting_name' => $setting_name,
83
-			));
84
-		} else {
85
-			Database::prepare(
86
-				"REPLACE INTO `##block_setting` (block_id, setting_name, setting_value) VALUES (:block_id, :setting_name, :setting_value)"
87
-			)->execute(array(
88
-				'block_id'      => $block_id,
89
-				'setting_name'  => $setting_name,
90
-				'setting_value' => $setting_value,
91
-			));
92
-		}
93
-
94
-		return $this;
95
-	}
96
-
97
-	/**
98
-	 * How should this module be labelled on tabs, menus, etc.?
99
-	 *
100
-	 * @return string
101
-	 */
102
-	abstract public function getTitle();
103
-
104
-	/**
105
-	 * A sentence describing what this module does.
106
-	 *
107
-	 * @return string
108
-	 */
109
-	abstract public function getDescription();
110
-
111
-	/**
112
-	 * What is the default access level for this module?
113
-	 *
114
-	 * Some modules are aimed at admins or managers, and are not generally shown to users.
115
-	 *
116
-	 * @return int
117
-	 */
118
-	public function defaultAccessLevel() {
119
-		// Returns one of: Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_USER, WT_PRIV_ADMIN
120
-		return Auth::PRIV_PRIVATE;
121
-	}
122
-
123
-	/**
124
-	 * Provide a unique internal name for this module
125
-	 *
126
-	 * @return string
127
-	 */
128
-	public function getName() {
129
-		return basename($this->directory);
130
-	}
131
-
132
-	/**
133
-	 * Load all the settings for the module into a cache.
134
-	 *
135
-	 * Since modules may have many settings, and will probably want to use
136
-	 * lots of them, load them all at once and cache them.
137
-	 */
138
-	private function loadAllSettings() {
139
-		if ($this->settings === null) {
140
-			$this->settings = Database::prepare(
141
-				"SELECT setting_name, setting_value FROM `##module_setting` WHERE module_name = ?"
142
-			)->execute(array($this->getName()))->fetchAssoc();
143
-		}
144
-	}
145
-
146
-	/**
147
-	 * Get a module setting. Return a default if the setting is not set.
148
-	 *
149
-	 * @param string $setting_name
150
-	 * @param string $default
151
-	 *
152
-	 * @return string|null
153
-	 */
154
-	public function getSetting($setting_name, $default = null) {
155
-		$this->loadAllSettings();
156
-
157
-		if (array_key_exists($setting_name, $this->settings)) {
158
-			return $this->settings[$setting_name];
159
-		} else {
160
-			return $default;
161
-		}
162
-	}
163
-
164
-	/**
165
-	 * Set a module setting.
166
-	 *
167
-	 * Since module settings are NOT NULL, setting a value to NULL will cause
168
-	 * it to be deleted.
169
-	 *
170
-	 * @param string $setting_name
171
-	 * @param string $setting_value
172
-	 */
173
-	public function setSetting($setting_name, $setting_value) {
174
-		$this->loadAllSettings();
175
-
176
-		if ($setting_value === null) {
177
-			Database::prepare(
178
-				"DELETE FROM `##module_setting` WHERE module_name = ? AND setting_name = ?"
179
-			)->execute(array($this->getName(), $setting_name));
180
-			unset($this->settings[$setting_name]);
181
-		} elseif (!array_key_exists($setting_name, $this->settings)) {
182
-			Database::prepare(
183
-				"INSERT INTO `##module_setting` (module_name, setting_name, setting_value) VALUES (?, ?, ?)"
184
-			)->execute(array($this->getName(), $setting_name, $setting_value));
185
-			$this->settings[$setting_name] = $setting_value;
186
-		} elseif ($setting_value != $this->settings[$setting_name]) {
187
-			Database::prepare(
188
-				"UPDATE `##module_setting` SET setting_value = ? WHERE module_name = ? AND setting_name = ?"
189
-			)->execute(array($setting_value, $this->getName(), $setting_name));
190
-			$this->settings[$setting_name] = $setting_value;
191
-		} else {
192
-			// Setting already exists, but with the same value - do nothing.
193
-		}
194
-	}
195
-
196
-	/**
197
-	 * This is a general purpose hook, allowing modules to respond to routes
198
-	 * of the form module.php?mod=FOO&mod_action=BAR
199
-	 *
200
-	 * @param string $mod_action
201
-	 */
202
-	public function modAction($mod_action) {
203
-	}
204
-
205
-	/**
206
-	 * Get a the current access level for a module
207
-	 *
208
-	 * @param Tree   $tree
209
-	 * @param string $component tab, block, menu, etc
210
-	 *
211
-	 * @return int
212
-	 */
213
-	public function getAccessLevel(Tree $tree, $component) {
214
-		$access_level = Database::prepare(
215
-			"SELECT access_level FROM `##module_privacy` WHERE gedcom_id = :gedcom_id AND module_name = :module_name AND component = :component"
216
-		)->execute(array(
217
-			'gedcom_id'   => $tree->getTreeId(),
218
-			'module_name' => $this->getName(),
219
-			'component'   => $component,
220
-		))->fetchOne();
221
-
222
-		if ($access_level === null) {
223
-			return $this->defaultAccessLevel();
224
-		} else {
225
-			return (int) $access_level;
226
-		}
227
-	}
26
+    /** @var string The directory where the module is installed */
27
+    private $directory;
28
+
29
+    /** @var string[] A cached copy of the module settings */
30
+    private $settings;
31
+
32
+    /** @var string For custom modules - optional (recommended) version number */
33
+    const CUSTOM_VERSION = '';
34
+
35
+    /** @var string For custom modules - link for support, upgrades, etc. */
36
+    const CUSTOM_WEBSITE = '';
37
+
38
+    /**
39
+     * Create a new module.
40
+     *
41
+     * @param string $directory Where is this module installed
42
+     */
43
+    public function __construct($directory) {
44
+        $this->directory = $directory;
45
+    }
46
+
47
+    /**
48
+     * Get a block setting.
49
+     *
50
+     * @param int         $block_id
51
+     * @param string      $setting_name
52
+     * @param string|null $default_value
53
+     *
54
+     * @return null|string
55
+     */
56
+    public function getBlockSetting($block_id, $setting_name, $default_value = null) {
57
+        $setting_value = Database::prepare(
58
+            "SELECT setting_value FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
59
+        )->execute(array(
60
+            'block_id'     => $block_id,
61
+            'setting_name' => $setting_name,
62
+        ))->fetchOne();
63
+
64
+        return $setting_value === null ? $default_value : $setting_value;
65
+    }
66
+
67
+    /**
68
+     * Set a block setting.
69
+     *
70
+     * @param int         $block_id
71
+     * @param string      $setting_name
72
+     * @param string|null $setting_value
73
+     *
74
+     * @return $this
75
+     */
76
+    public function setBlockSetting($block_id, $setting_name, $setting_value) {
77
+        if ($setting_value === null) {
78
+            Database::prepare(
79
+                "DELETE FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
80
+            )->execute(array(
81
+                    'block_id'     => $block_id,
82
+                    'setting_name' => $setting_name,
83
+            ));
84
+        } else {
85
+            Database::prepare(
86
+                "REPLACE INTO `##block_setting` (block_id, setting_name, setting_value) VALUES (:block_id, :setting_name, :setting_value)"
87
+            )->execute(array(
88
+                'block_id'      => $block_id,
89
+                'setting_name'  => $setting_name,
90
+                'setting_value' => $setting_value,
91
+            ));
92
+        }
93
+
94
+        return $this;
95
+    }
96
+
97
+    /**
98
+     * How should this module be labelled on tabs, menus, etc.?
99
+     *
100
+     * @return string
101
+     */
102
+    abstract public function getTitle();
103
+
104
+    /**
105
+     * A sentence describing what this module does.
106
+     *
107
+     * @return string
108
+     */
109
+    abstract public function getDescription();
110
+
111
+    /**
112
+     * What is the default access level for this module?
113
+     *
114
+     * Some modules are aimed at admins or managers, and are not generally shown to users.
115
+     *
116
+     * @return int
117
+     */
118
+    public function defaultAccessLevel() {
119
+        // Returns one of: Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_USER, WT_PRIV_ADMIN
120
+        return Auth::PRIV_PRIVATE;
121
+    }
122
+
123
+    /**
124
+     * Provide a unique internal name for this module
125
+     *
126
+     * @return string
127
+     */
128
+    public function getName() {
129
+        return basename($this->directory);
130
+    }
131
+
132
+    /**
133
+     * Load all the settings for the module into a cache.
134
+     *
135
+     * Since modules may have many settings, and will probably want to use
136
+     * lots of them, load them all at once and cache them.
137
+     */
138
+    private function loadAllSettings() {
139
+        if ($this->settings === null) {
140
+            $this->settings = Database::prepare(
141
+                "SELECT setting_name, setting_value FROM `##module_setting` WHERE module_name = ?"
142
+            )->execute(array($this->getName()))->fetchAssoc();
143
+        }
144
+    }
145
+
146
+    /**
147
+     * Get a module setting. Return a default if the setting is not set.
148
+     *
149
+     * @param string $setting_name
150
+     * @param string $default
151
+     *
152
+     * @return string|null
153
+     */
154
+    public function getSetting($setting_name, $default = null) {
155
+        $this->loadAllSettings();
156
+
157
+        if (array_key_exists($setting_name, $this->settings)) {
158
+            return $this->settings[$setting_name];
159
+        } else {
160
+            return $default;
161
+        }
162
+    }
163
+
164
+    /**
165
+     * Set a module setting.
166
+     *
167
+     * Since module settings are NOT NULL, setting a value to NULL will cause
168
+     * it to be deleted.
169
+     *
170
+     * @param string $setting_name
171
+     * @param string $setting_value
172
+     */
173
+    public function setSetting($setting_name, $setting_value) {
174
+        $this->loadAllSettings();
175
+
176
+        if ($setting_value === null) {
177
+            Database::prepare(
178
+                "DELETE FROM `##module_setting` WHERE module_name = ? AND setting_name = ?"
179
+            )->execute(array($this->getName(), $setting_name));
180
+            unset($this->settings[$setting_name]);
181
+        } elseif (!array_key_exists($setting_name, $this->settings)) {
182
+            Database::prepare(
183
+                "INSERT INTO `##module_setting` (module_name, setting_name, setting_value) VALUES (?, ?, ?)"
184
+            )->execute(array($this->getName(), $setting_name, $setting_value));
185
+            $this->settings[$setting_name] = $setting_value;
186
+        } elseif ($setting_value != $this->settings[$setting_name]) {
187
+            Database::prepare(
188
+                "UPDATE `##module_setting` SET setting_value = ? WHERE module_name = ? AND setting_name = ?"
189
+            )->execute(array($setting_value, $this->getName(), $setting_name));
190
+            $this->settings[$setting_name] = $setting_value;
191
+        } else {
192
+            // Setting already exists, but with the same value - do nothing.
193
+        }
194
+    }
195
+
196
+    /**
197
+     * This is a general purpose hook, allowing modules to respond to routes
198
+     * of the form module.php?mod=FOO&mod_action=BAR
199
+     *
200
+     * @param string $mod_action
201
+     */
202
+    public function modAction($mod_action) {
203
+    }
204
+
205
+    /**
206
+     * Get a the current access level for a module
207
+     *
208
+     * @param Tree   $tree
209
+     * @param string $component tab, block, menu, etc
210
+     *
211
+     * @return int
212
+     */
213
+    public function getAccessLevel(Tree $tree, $component) {
214
+        $access_level = Database::prepare(
215
+            "SELECT access_level FROM `##module_privacy` WHERE gedcom_id = :gedcom_id AND module_name = :module_name AND component = :component"
216
+        )->execute(array(
217
+            'gedcom_id'   => $tree->getTreeId(),
218
+            'module_name' => $this->getName(),
219
+            'component'   => $component,
220
+        ))->fetchOne();
221
+
222
+        if ($access_level === null) {
223
+            return $this->defaultAccessLevel();
224
+        } else {
225
+            return (int) $access_level;
226
+        }
227
+    }
228 228
 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Class AbstractModule - common functions for blocks
24 24
  */
25
-abstract class AbstractModule {
25
+abstract class AbstractModule
26
+{
26 27
 	/** @var string The directory where the module is installed */
27 28
 	private $directory;
28 29
 
@@ -40,7 +41,8 @@  discard block
 block discarded – undo
40 41
 	 *
41 42
 	 * @param string $directory Where is this module installed
42 43
 	 */
43
-	public function __construct($directory) {
44
+	public function __construct($directory)
45
+	{
44 46
 		$this->directory = $directory;
45 47
 	}
46 48
 
@@ -53,7 +55,8 @@  discard block
 block discarded – undo
53 55
 	 *
54 56
 	 * @return null|string
55 57
 	 */
56
-	public function getBlockSetting($block_id, $setting_name, $default_value = null) {
58
+	public function getBlockSetting($block_id, $setting_name, $default_value = null)
59
+	{
57 60
 		$setting_value = Database::prepare(
58 61
 			"SELECT setting_value FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
59 62
 		)->execute(array(
@@ -73,7 +76,8 @@  discard block
 block discarded – undo
73 76
 	 *
74 77
 	 * @return $this
75 78
 	 */
76
-	public function setBlockSetting($block_id, $setting_name, $setting_value) {
79
+	public function setBlockSetting($block_id, $setting_name, $setting_value)
80
+	{
77 81
 		if ($setting_value === null) {
78 82
 			Database::prepare(
79 83
 				"DELETE FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
@@ -115,7 +119,8 @@  discard block
 block discarded – undo
115 119
 	 *
116 120
 	 * @return int
117 121
 	 */
118
-	public function defaultAccessLevel() {
122
+	public function defaultAccessLevel()
123
+	{
119 124
 		// Returns one of: Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_USER, WT_PRIV_ADMIN
120 125
 		return Auth::PRIV_PRIVATE;
121 126
 	}
@@ -125,7 +130,8 @@  discard block
 block discarded – undo
125 130
 	 *
126 131
 	 * @return string
127 132
 	 */
128
-	public function getName() {
133
+	public function getName()
134
+	{
129 135
 		return basename($this->directory);
130 136
 	}
131 137
 
@@ -135,7 +141,8 @@  discard block
 block discarded – undo
135 141
 	 * Since modules may have many settings, and will probably want to use
136 142
 	 * lots of them, load them all at once and cache them.
137 143
 	 */
138
-	private function loadAllSettings() {
144
+	private function loadAllSettings()
145
+	{
139 146
 		if ($this->settings === null) {
140 147
 			$this->settings = Database::prepare(
141 148
 				"SELECT setting_name, setting_value FROM `##module_setting` WHERE module_name = ?"
@@ -151,7 +158,8 @@  discard block
 block discarded – undo
151 158
 	 *
152 159
 	 * @return string|null
153 160
 	 */
154
-	public function getSetting($setting_name, $default = null) {
161
+	public function getSetting($setting_name, $default = null)
162
+	{
155 163
 		$this->loadAllSettings();
156 164
 
157 165
 		if (array_key_exists($setting_name, $this->settings)) {
@@ -170,7 +178,8 @@  discard block
 block discarded – undo
170 178
 	 * @param string $setting_name
171 179
 	 * @param string $setting_value
172 180
 	 */
173
-	public function setSetting($setting_name, $setting_value) {
181
+	public function setSetting($setting_name, $setting_value)
182
+	{
174 183
 		$this->loadAllSettings();
175 184
 
176 185
 		if ($setting_value === null) {
@@ -199,7 +208,8 @@  discard block
 block discarded – undo
199 208
 	 *
200 209
 	 * @param string $mod_action
201 210
 	 */
202
-	public function modAction($mod_action) {
211
+	public function modAction($mod_action)
212
+	{
203 213
 	}
204 214
 
205 215
 	/**
@@ -210,7 +220,8 @@  discard block
 block discarded – undo
210 220
 	 *
211 221
 	 * @return int
212 222
 	 */
213
-	public function getAccessLevel(Tree $tree, $component) {
223
+	public function getAccessLevel(Tree $tree, $component)
224
+	{
214 225
 		$access_level = Database::prepare(
215 226
 			"SELECT access_level FROM `##module_privacy` WHERE gedcom_id = :gedcom_id AND module_name = :module_name AND component = :component"
216 227
 		)->execute(array(
Please login to merge, or discard this patch.
app/Module/YahrzeitModule.php 3 patches
Indentation   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -32,111 +32,111 @@  discard block
 block discarded – undo
32 32
  * Class YahrzeitModule
33 33
  */
34 34
 class YahrzeitModule extends AbstractModule implements ModuleBlockInterface {
35
-	/** {@inheritdoc} */
36
-	public function getTitle() {
37
-		return /* I18N: Name of a module. Yahrzeiten (the plural of Yahrzeit) are special anniversaries of deaths in the Hebrew faith/calendar. */ I18N::translate('Yahrzeiten');
38
-	}
35
+    /** {@inheritdoc} */
36
+    public function getTitle() {
37
+        return /* I18N: Name of a module. Yahrzeiten (the plural of Yahrzeit) are special anniversaries of deaths in the Hebrew faith/calendar. */ I18N::translate('Yahrzeiten');
38
+    }
39 39
 
40
-	/** {@inheritdoc} */
41
-	public function getDescription() {
42
-		return /* I18N: Description of the “Yahrzeiten” module. A “Hebrew death” is a death where the date is recorded in the Hebrew calendar. */ I18N::translate('A list of the Hebrew death anniversaries that will occur in the near future.');
43
-	}
40
+    /** {@inheritdoc} */
41
+    public function getDescription() {
42
+        return /* I18N: Description of the “Yahrzeiten” module. A “Hebrew death” is a death where the date is recorded in the Hebrew calendar. */ I18N::translate('A list of the Hebrew death anniversaries that will occur in the near future.');
43
+    }
44 44
 
45
-	/**
46
-	 * Generate the HTML content of this block.
47
-	 *
48
-	 * @param int      $block_id
49
-	 * @param bool     $template
50
-	 * @param string[] $cfg
51
-	 *
52
-	 * @return string
53
-	 */
54
-	public function getBlock($block_id, $template = true, $cfg = array()) {
55
-		global $ctype, $controller, $WT_TREE;
45
+    /**
46
+     * Generate the HTML content of this block.
47
+     *
48
+     * @param int      $block_id
49
+     * @param bool     $template
50
+     * @param string[] $cfg
51
+     *
52
+     * @return string
53
+     */
54
+    public function getBlock($block_id, $template = true, $cfg = array()) {
55
+        global $ctype, $controller, $WT_TREE;
56 56
 
57
-		$days      = $this->getBlockSetting($block_id, 'days', '7');
58
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
59
-		$calendar  = $this->getBlockSetting($block_id, 'calendar', 'jewish');
60
-		$block     = $this->getBlockSetting($block_id, 'block', '1');
57
+        $days      = $this->getBlockSetting($block_id, 'days', '7');
58
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
59
+        $calendar  = $this->getBlockSetting($block_id, 'calendar', 'jewish');
60
+        $block     = $this->getBlockSetting($block_id, 'block', '1');
61 61
 
62
-		foreach (array('days', 'infoStyle', 'block') as $name) {
63
-			if (array_key_exists($name, $cfg)) {
64
-				$$name = $cfg[$name];
65
-			}
66
-		}
62
+        foreach (array('days', 'infoStyle', 'block') as $name) {
63
+            if (array_key_exists($name, $cfg)) {
64
+                $$name = $cfg[$name];
65
+            }
66
+        }
67 67
 
68
-		$startjd = WT_CLIENT_JD;
69
-		$endjd   = WT_CLIENT_JD + $days - 1;
68
+        $startjd = WT_CLIENT_JD;
69
+        $endjd   = WT_CLIENT_JD + $days - 1;
70 70
 
71
-		$id    = $this->getName() . $block_id;
72
-		$class = $this->getName() . '_block';
73
-		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
74
-			$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
75
-		} else {
76
-			$title = '';
77
-		}
78
-		$title .= $this->getTitle();
71
+        $id    = $this->getName() . $block_id;
72
+        $class = $this->getName() . '_block';
73
+        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
74
+            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
75
+        } else {
76
+            $title = '';
77
+        }
78
+        $title .= $this->getTitle();
79 79
 
80
-		$content = '';
81
-		// The standard anniversary rules cover most of the Yahrzeit rules, we just
82
-		// need to handle a few special cases.
83
-		// Fetch normal anniversaries...
84
-		$yahrzeits = array();
85
-		for ($jd = $startjd - 1; $jd <= $endjd + $days; ++$jd) {
86
-			foreach (FunctionsDb::getAnniversaryEvents($jd, 'DEAT _YART', $WT_TREE) as $fact) {
87
-				// Exact hebrew dates only
88
-				$date = $fact->getDate();
89
-				if ($date->minimumDate() instanceof JewishDate && $date->minimumJulianDay() === $date->maximumJulianDay()) {
90
-					$fact->jd    = $jd;
91
-					$yahrzeits[] = $fact;
92
-				}
93
-			}
94
-		}
80
+        $content = '';
81
+        // The standard anniversary rules cover most of the Yahrzeit rules, we just
82
+        // need to handle a few special cases.
83
+        // Fetch normal anniversaries...
84
+        $yahrzeits = array();
85
+        for ($jd = $startjd - 1; $jd <= $endjd + $days; ++$jd) {
86
+            foreach (FunctionsDb::getAnniversaryEvents($jd, 'DEAT _YART', $WT_TREE) as $fact) {
87
+                // Exact hebrew dates only
88
+                $date = $fact->getDate();
89
+                if ($date->minimumDate() instanceof JewishDate && $date->minimumJulianDay() === $date->maximumJulianDay()) {
90
+                    $fact->jd    = $jd;
91
+                    $yahrzeits[] = $fact;
92
+                }
93
+            }
94
+        }
95 95
 
96
-		// ...then adjust dates
97
-		$jewish_calendar = new JewishCalendar;
96
+        // ...then adjust dates
97
+        $jewish_calendar = new JewishCalendar;
98 98
 
99
-		foreach ($yahrzeits as $yahrzeit) {
100
-			if ($yahrzeit->getTag() === 'DEAT') {
101
-				$today = new JewishDate($yahrzeit->jd);
102
-				$hd    = $yahrzeit->getDate()->minimumDate();
103
-				$hd1   = new JewishDate($hd);
104
-				$hd1->y += 1;
105
-				$hd1->setJdFromYmd();
106
-				// Special rules. See http://www.hebcal.com/help/anniv.html
107
-				// Everything else is taken care of by our standard anniversary rules.
108
-				if ($hd->d == 30 && $hd->m == 2 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
109
-					// 30 CSH - Last day in CSH
110
-					$yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 3, 1) - 1;
111
-				} elseif ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
112
-					// 30 KSL - Last day in KSL
113
-					$yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1) - 1;
114
-				} elseif ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->daysInMonth() < 30 && !$today->isLeapYear()) {
115
-					// 30 ADR - Last day in SHV
116
-					$yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1) - 1;
117
-				}
118
-			}
119
-		}
99
+        foreach ($yahrzeits as $yahrzeit) {
100
+            if ($yahrzeit->getTag() === 'DEAT') {
101
+                $today = new JewishDate($yahrzeit->jd);
102
+                $hd    = $yahrzeit->getDate()->minimumDate();
103
+                $hd1   = new JewishDate($hd);
104
+                $hd1->y += 1;
105
+                $hd1->setJdFromYmd();
106
+                // Special rules. See http://www.hebcal.com/help/anniv.html
107
+                // Everything else is taken care of by our standard anniversary rules.
108
+                if ($hd->d == 30 && $hd->m == 2 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
109
+                    // 30 CSH - Last day in CSH
110
+                    $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 3, 1) - 1;
111
+                } elseif ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
112
+                    // 30 KSL - Last day in KSL
113
+                    $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1) - 1;
114
+                } elseif ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->daysInMonth() < 30 && !$today->isLeapYear()) {
115
+                    // 30 ADR - Last day in SHV
116
+                    $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1) - 1;
117
+                }
118
+            }
119
+        }
120 120
 
121
-		switch ($infoStyle) {
122
-		case 'list':
123
-			foreach ($yahrzeits as $yahrzeit) {
124
-				if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
125
-					$ind = $yahrzeit->getParent();
126
-					$content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage();
127
-					$content .= "<div class=\"indent\">";
128
-					$content .= $yahrzeit->getDate()->display(true);
129
-					$content .= ', ' . I18N::translate('%s year anniversary', $yahrzeit->anniv);
130
-					$content .= "</div>";
131
-				}
132
-			}
133
-			break;
134
-		case 'table':
135
-		default:
136
-			$table_id = Uuid::uuid4(); // table requires a unique ID
137
-			$controller
138
-				->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
139
-				->addInlineJavascript('
121
+        switch ($infoStyle) {
122
+        case 'list':
123
+            foreach ($yahrzeits as $yahrzeit) {
124
+                if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
125
+                    $ind = $yahrzeit->getParent();
126
+                    $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage();
127
+                    $content .= "<div class=\"indent\">";
128
+                    $content .= $yahrzeit->getDate()->display(true);
129
+                    $content .= ', ' . I18N::translate('%s year anniversary', $yahrzeit->anniv);
130
+                    $content .= "</div>";
131
+                }
132
+            }
133
+            break;
134
+        case 'table':
135
+        default:
136
+            $table_id = Uuid::uuid4(); // table requires a unique ID
137
+            $controller
138
+                ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
139
+                ->addInlineJavascript('
140 140
 					jQuery("#' . $table_id . '").dataTable({
141 141
 						dom: \'t\',
142 142
 						' . I18N::datatablesI18N() . ',
@@ -160,135 +160,135 @@  discard block
 block discarded – undo
160 160
 					jQuery("#' . $table_id . '").css("visibility", "visible");
161 161
 					jQuery(".loading-image").css("display", "none");
162 162
 				');
163
-			$content = '';
164
-			$content .= '<div class="loading-image">&nbsp;</div>';
165
-			$content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">';
166
-			$content .= '<thead><tr>';
167
-			$content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
168
-			$content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
169
-			$content .= '<th>' . GedcomTag::getLabel('DEAT') . '</th>';
170
-			$content .= '<th>DEAT</th>';
171
-			$content .= '<th><i class="icon-reminder" title="' . I18N::translate('Anniversary') . '"></i></th>';
172
-			$content .= '<th>' . GedcomTag::getLabel('_YART') . '</th>';
173
-			$content .= '<th>_YART</th>';
174
-			$content .= '</tr></thead><tbody>';
163
+            $content = '';
164
+            $content .= '<div class="loading-image">&nbsp;</div>';
165
+            $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">';
166
+            $content .= '<thead><tr>';
167
+            $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
168
+            $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
169
+            $content .= '<th>' . GedcomTag::getLabel('DEAT') . '</th>';
170
+            $content .= '<th>DEAT</th>';
171
+            $content .= '<th><i class="icon-reminder" title="' . I18N::translate('Anniversary') . '"></i></th>';
172
+            $content .= '<th>' . GedcomTag::getLabel('_YART') . '</th>';
173
+            $content .= '<th>_YART</th>';
174
+            $content .= '</tr></thead><tbody>';
175 175
 
176
-			foreach ($yahrzeits as $yahrzeit) {
177
-				if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
178
-					$content .= '<tr>';
179
-					$ind = $yahrzeit->getParent();
180
-					// Individual name(s)
181
-					$name = $ind->getFullName();
182
-					$url  = $ind->getHtmlUrl();
183
-					$content .= '<td>';
184
-					$content .= '<a href="' . $url . '">' . $name . '</a>';
185
-					$content .= $ind->getSexImage();
186
-					$addname = $ind->getAddName();
187
-					if ($addname) {
188
-						$content .= '<br><a href="' . $url . '">' . $addname . '</a>';
189
-					}
190
-					$content .= '</td>';
191
-					$content .= '<td>' . $ind->getSortName() . '</td>';
176
+            foreach ($yahrzeits as $yahrzeit) {
177
+                if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
178
+                    $content .= '<tr>';
179
+                    $ind = $yahrzeit->getParent();
180
+                    // Individual name(s)
181
+                    $name = $ind->getFullName();
182
+                    $url  = $ind->getHtmlUrl();
183
+                    $content .= '<td>';
184
+                    $content .= '<a href="' . $url . '">' . $name . '</a>';
185
+                    $content .= $ind->getSexImage();
186
+                    $addname = $ind->getAddName();
187
+                    if ($addname) {
188
+                        $content .= '<br><a href="' . $url . '">' . $addname . '</a>';
189
+                    }
190
+                    $content .= '</td>';
191
+                    $content .= '<td>' . $ind->getSortName() . '</td>';
192 192
 
193
-					// death/yahrzeit event date
194
-					$content .= '<td>' . $yahrzeit->getDate()->display() . '</td>';
195
-					$content .= '<td>' . $yahrzeit->getDate()->julianDay() . '</td>'; // sortable date
193
+                    // death/yahrzeit event date
194
+                    $content .= '<td>' . $yahrzeit->getDate()->display() . '</td>';
195
+                    $content .= '<td>' . $yahrzeit->getDate()->julianDay() . '</td>'; // sortable date
196 196
 
197
-					// Anniversary
198
-					$content .= '<td>' . $yahrzeit->anniv . '</td>';
197
+                    // Anniversary
198
+                    $content .= '<td>' . $yahrzeit->anniv . '</td>';
199 199
 
200
-					// upcomming yahrzeit dates
201
-					switch ($calendar) {
202
-					case 'gregorian':
203
-						$today = new GregorianDate($yahrzeit->jd);
204
-						break;
205
-					case 'jewish':
206
-					default:
207
-						$today = new JewishDate($yahrzeit->jd);
208
-						break;
209
-					}
210
-					$td = new Date($today->format('%@ %A %O %E'));
211
-					$content .= '<td>' . $td->display() . '</td>';
212
-					$content .= '<td>' . $td->julianDay() . '</td>'; // sortable date
200
+                    // upcomming yahrzeit dates
201
+                    switch ($calendar) {
202
+                    case 'gregorian':
203
+                        $today = new GregorianDate($yahrzeit->jd);
204
+                        break;
205
+                    case 'jewish':
206
+                    default:
207
+                        $today = new JewishDate($yahrzeit->jd);
208
+                        break;
209
+                    }
210
+                    $td = new Date($today->format('%@ %A %O %E'));
211
+                    $content .= '<td>' . $td->display() . '</td>';
212
+                    $content .= '<td>' . $td->julianDay() . '</td>'; // sortable date
213 213
 
214
-					$content .= '</tr>';
215
-				}
216
-			}
217
-			$content .= '</tbody></table>';
214
+                    $content .= '</tr>';
215
+                }
216
+            }
217
+            $content .= '</tbody></table>';
218 218
 
219
-			break;
220
-		}
219
+            break;
220
+        }
221 221
 
222
-		if ($template) {
223
-			if ($block) {
224
-				$class .= ' small_inner_block';
225
-			}
222
+        if ($template) {
223
+            if ($block) {
224
+                $class .= ' small_inner_block';
225
+            }
226 226
 
227
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
228
-		} else {
229
-			return $content;
230
-		}
231
-	}
227
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
228
+        } else {
229
+            return $content;
230
+        }
231
+    }
232 232
 
233
-	/** {@inheritdoc} */
234
-	public function loadAjax() {
235
-		return true;
236
-	}
233
+    /** {@inheritdoc} */
234
+    public function loadAjax() {
235
+        return true;
236
+    }
237 237
 
238
-	/** {@inheritdoc} */
239
-	public function isUserBlock() {
240
-		return true;
241
-	}
238
+    /** {@inheritdoc} */
239
+    public function isUserBlock() {
240
+        return true;
241
+    }
242 242
 
243
-	/** {@inheritdoc} */
244
-	public function isGedcomBlock() {
245
-		return true;
246
-	}
243
+    /** {@inheritdoc} */
244
+    public function isGedcomBlock() {
245
+        return true;
246
+    }
247 247
 
248
-	/**
249
-	 * An HTML form to edit block settings
250
-	 *
251
-	 * @param int $block_id
252
-	 */
253
-	public function configureBlock($block_id) {
254
-		if (Filter::postBool('save') && Filter::checkCsrf()) {
255
-			$this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
256
-			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
257
-			$this->setBlockSetting($block_id, 'calendar', Filter::post('calendar', 'jewish|gregorian', 'jewish'));
258
-			$this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
259
-		}
248
+    /**
249
+     * An HTML form to edit block settings
250
+     *
251
+     * @param int $block_id
252
+     */
253
+    public function configureBlock($block_id) {
254
+        if (Filter::postBool('save') && Filter::checkCsrf()) {
255
+            $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
256
+            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
257
+            $this->setBlockSetting($block_id, 'calendar', Filter::post('calendar', 'jewish|gregorian', 'jewish'));
258
+            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
259
+        }
260 260
 
261
-		$days      = $this->getBlockSetting($block_id, 'days', '7');
262
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
263
-		$calendar  = $this->getBlockSetting($block_id, 'calendar', 'jewish');
264
-		$block     = $this->getBlockSetting($block_id, 'block', '1');
261
+        $days      = $this->getBlockSetting($block_id, 'days', '7');
262
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
263
+        $calendar  = $this->getBlockSetting($block_id, 'calendar', 'jewish');
264
+        $block     = $this->getBlockSetting($block_id, 'block', '1');
265 265
 
266
-		echo '<tr><td class="descriptionbox wrap width33">';
267
-		echo I18N::translate('Number of days to show');
268
-		echo '</td><td class="optionbox">';
269
-		echo '<input type="text" name="days" size="2" value="' . $days . '">';
270
-		echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', 30, I18N::number(30)), '</em>';
271
-		echo '</td></tr>';
266
+        echo '<tr><td class="descriptionbox wrap width33">';
267
+        echo I18N::translate('Number of days to show');
268
+        echo '</td><td class="optionbox">';
269
+        echo '<input type="text" name="days" size="2" value="' . $days . '">';
270
+        echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', 30, I18N::number(30)), '</em>';
271
+        echo '</td></tr>';
272 272
 
273
-		echo '<tr><td class="descriptionbox wrap width33">';
274
-		echo I18N::translate('Presentation style');
275
-		echo '</td><td class="optionbox">';
276
-		echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
277
-		echo '</td></tr>';
273
+        echo '<tr><td class="descriptionbox wrap width33">';
274
+        echo I18N::translate('Presentation style');
275
+        echo '</td><td class="optionbox">';
276
+        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
277
+        echo '</td></tr>';
278 278
 
279
-		echo '<tr><td class="descriptionbox wrap width33">';
280
-		echo I18N::translate('Calendar');
281
-		echo '</td><td class="optionbox">';
282
-		echo FunctionsEdit::selectEditControl('calendar', array(
283
-			'jewish'    => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'),
284
-			'gregorian' => /* I18N: The gregorian calendar */ I18N::translate('Gregorian'),
285
-		), null, $calendar, '');
286
-		echo '</td></tr>';
279
+        echo '<tr><td class="descriptionbox wrap width33">';
280
+        echo I18N::translate('Calendar');
281
+        echo '</td><td class="optionbox">';
282
+        echo FunctionsEdit::selectEditControl('calendar', array(
283
+            'jewish'    => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'),
284
+            'gregorian' => /* I18N: The gregorian calendar */ I18N::translate('Gregorian'),
285
+        ), null, $calendar, '');
286
+        echo '</td></tr>';
287 287
 
288
-		echo '<tr><td class="descriptionbox wrap width33">';
289
-		echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
290
-		echo '</td><td class="optionbox">';
291
-		echo FunctionsEdit::editFieldYesNo('block', $block);
292
-		echo '</td></tr>';
293
-	}
288
+        echo '<tr><td class="descriptionbox wrap width33">';
289
+        echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
290
+        echo '</td><td class="optionbox">';
291
+        echo FunctionsEdit::editFieldYesNo('block', $block);
292
+        echo '</td></tr>';
293
+    }
294 294
 }
Please login to merge, or discard this patch.
Switch Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
 		}
120 120
 
121 121
 		switch ($infoStyle) {
122
-		case 'list':
123
-			foreach ($yahrzeits as $yahrzeit) {
124
-				if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
125
-					$ind = $yahrzeit->getParent();
126
-					$content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage();
127
-					$content .= "<div class=\"indent\">";
128
-					$content .= $yahrzeit->getDate()->display(true);
129
-					$content .= ', ' . I18N::translate('%s year anniversary', $yahrzeit->anniv);
130
-					$content .= "</div>";
131
-				}
132
-			}
133
-			break;
134
-		case 'table':
135
-		default:
136
-			$table_id = Uuid::uuid4(); // table requires a unique ID
137
-			$controller
138
-				->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
139
-				->addInlineJavascript('
122
+		    case 'list':
123
+			    foreach ($yahrzeits as $yahrzeit) {
124
+				    if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
125
+					    $ind = $yahrzeit->getParent();
126
+					    $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage();
127
+					    $content .= "<div class=\"indent\">";
128
+					    $content .= $yahrzeit->getDate()->display(true);
129
+					    $content .= ', ' . I18N::translate('%s year anniversary', $yahrzeit->anniv);
130
+					    $content .= "</div>";
131
+				    }
132
+			    }
133
+			    break;
134
+		    case 'table':
135
+		    default:
136
+			    $table_id = Uuid::uuid4(); // table requires a unique ID
137
+			    $controller
138
+				    ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
139
+				    ->addInlineJavascript('
140 140
 					jQuery("#' . $table_id . '").dataTable({
141 141
 						dom: \'t\',
142 142
 						' . I18N::datatablesI18N() . ',
@@ -160,53 +160,53 @@  discard block
 block discarded – undo
160 160
 					jQuery("#' . $table_id . '").css("visibility", "visible");
161 161
 					jQuery(".loading-image").css("display", "none");
162 162
 				');
163
-			$content = '';
164
-			$content .= '<div class="loading-image">&nbsp;</div>';
165
-			$content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">';
166
-			$content .= '<thead><tr>';
167
-			$content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
168
-			$content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
169
-			$content .= '<th>' . GedcomTag::getLabel('DEAT') . '</th>';
170
-			$content .= '<th>DEAT</th>';
171
-			$content .= '<th><i class="icon-reminder" title="' . I18N::translate('Anniversary') . '"></i></th>';
172
-			$content .= '<th>' . GedcomTag::getLabel('_YART') . '</th>';
173
-			$content .= '<th>_YART</th>';
174
-			$content .= '</tr></thead><tbody>';
163
+			    $content = '';
164
+			    $content .= '<div class="loading-image">&nbsp;</div>';
165
+			    $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">';
166
+			    $content .= '<thead><tr>';
167
+			    $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
168
+			    $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>';
169
+			    $content .= '<th>' . GedcomTag::getLabel('DEAT') . '</th>';
170
+			    $content .= '<th>DEAT</th>';
171
+			    $content .= '<th><i class="icon-reminder" title="' . I18N::translate('Anniversary') . '"></i></th>';
172
+			    $content .= '<th>' . GedcomTag::getLabel('_YART') . '</th>';
173
+			    $content .= '<th>_YART</th>';
174
+			    $content .= '</tr></thead><tbody>';
175 175
 
176
-			foreach ($yahrzeits as $yahrzeit) {
177
-				if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
178
-					$content .= '<tr>';
179
-					$ind = $yahrzeit->getParent();
180
-					// Individual name(s)
181
-					$name = $ind->getFullName();
182
-					$url  = $ind->getHtmlUrl();
183
-					$content .= '<td>';
184
-					$content .= '<a href="' . $url . '">' . $name . '</a>';
185
-					$content .= $ind->getSexImage();
186
-					$addname = $ind->getAddName();
187
-					if ($addname) {
188
-						$content .= '<br><a href="' . $url . '">' . $addname . '</a>';
189
-					}
190
-					$content .= '</td>';
191
-					$content .= '<td>' . $ind->getSortName() . '</td>';
176
+			    foreach ($yahrzeits as $yahrzeit) {
177
+				    if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
178
+					    $content .= '<tr>';
179
+					    $ind = $yahrzeit->getParent();
180
+					    // Individual name(s)
181
+					    $name = $ind->getFullName();
182
+					    $url  = $ind->getHtmlUrl();
183
+					    $content .= '<td>';
184
+					    $content .= '<a href="' . $url . '">' . $name . '</a>';
185
+					    $content .= $ind->getSexImage();
186
+					    $addname = $ind->getAddName();
187
+					    if ($addname) {
188
+						    $content .= '<br><a href="' . $url . '">' . $addname . '</a>';
189
+					    }
190
+					    $content .= '</td>';
191
+					    $content .= '<td>' . $ind->getSortName() . '</td>';
192 192
 
193
-					// death/yahrzeit event date
194
-					$content .= '<td>' . $yahrzeit->getDate()->display() . '</td>';
195
-					$content .= '<td>' . $yahrzeit->getDate()->julianDay() . '</td>'; // sortable date
193
+					    // death/yahrzeit event date
194
+					    $content .= '<td>' . $yahrzeit->getDate()->display() . '</td>';
195
+					    $content .= '<td>' . $yahrzeit->getDate()->julianDay() . '</td>'; // sortable date
196 196
 
197
-					// Anniversary
198
-					$content .= '<td>' . $yahrzeit->anniv . '</td>';
197
+					    // Anniversary
198
+					    $content .= '<td>' . $yahrzeit->anniv . '</td>';
199 199
 
200
-					// upcomming yahrzeit dates
201
-					switch ($calendar) {
202
-					case 'gregorian':
203
-						$today = new GregorianDate($yahrzeit->jd);
204
-						break;
205
-					case 'jewish':
206
-					default:
207
-						$today = new JewishDate($yahrzeit->jd);
208
-						break;
209
-					}
200
+					    // upcomming yahrzeit dates
201
+					    switch ($calendar) {
202
+					        case 'gregorian':
203
+						        $today = new GregorianDate($yahrzeit->jd);
204
+						        break;
205
+					        case 'jewish':
206
+					        default:
207
+						        $today = new JewishDate($yahrzeit->jd);
208
+						        break;
209
+					    }
210 210
 					$td = new Date($today->format('%@ %A %O %E'));
211 211
 					$content .= '<td>' . $td->display() . '</td>';
212 212
 					$content .= '<td>' . $td->julianDay() . '</td>'; // sortable date
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,14 +31,17 @@  discard block
 block discarded – undo
31 31
 /**
32 32
  * Class YahrzeitModule
33 33
  */
34
-class YahrzeitModule extends AbstractModule implements ModuleBlockInterface {
34
+class YahrzeitModule extends AbstractModule implements ModuleBlockInterface
35
+{
35 36
 	/** {@inheritdoc} */
36
-	public function getTitle() {
37
+	public function getTitle()
38
+	{
37 39
 		return /* I18N: Name of a module. Yahrzeiten (the plural of Yahrzeit) are special anniversaries of deaths in the Hebrew faith/calendar. */ I18N::translate('Yahrzeiten');
38 40
 	}
39 41
 
40 42
 	/** {@inheritdoc} */
41
-	public function getDescription() {
43
+	public function getDescription()
44
+	{
42 45
 		return /* I18N: Description of the “Yahrzeiten” module. A “Hebrew death” is a death where the date is recorded in the Hebrew calendar. */ I18N::translate('A list of the Hebrew death anniversaries that will occur in the near future.');
43 46
 	}
44 47
 
@@ -51,7 +54,8 @@  discard block
 block discarded – undo
51 54
 	 *
52 55
 	 * @return string
53 56
 	 */
54
-	public function getBlock($block_id, $template = true, $cfg = array()) {
57
+	public function getBlock($block_id, $template = true, $cfg = array())
58
+	{
55 59
 		global $ctype, $controller, $WT_TREE;
56 60
 
57 61
 		$days      = $this->getBlockSetting($block_id, 'days', '7');
@@ -231,17 +235,20 @@  discard block
 block discarded – undo
231 235
 	}
232 236
 
233 237
 	/** {@inheritdoc} */
234
-	public function loadAjax() {
238
+	public function loadAjax()
239
+	{
235 240
 		return true;
236 241
 	}
237 242
 
238 243
 	/** {@inheritdoc} */
239
-	public function isUserBlock() {
244
+	public function isUserBlock()
245
+	{
240 246
 		return true;
241 247
 	}
242 248
 
243 249
 	/** {@inheritdoc} */
244
-	public function isGedcomBlock() {
250
+	public function isGedcomBlock()
251
+	{
245 252
 		return true;
246 253
 	}
247 254
 
@@ -250,7 +257,8 @@  discard block
 block discarded – undo
250 257
 	 *
251 258
 	 * @param int $block_id
252 259
 	 */
253
-	public function configureBlock($block_id) {
260
+	public function configureBlock($block_id)
261
+	{
254 262
 		if (Filter::postBool('save') && Filter::checkCsrf()) {
255 263
 			$this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
256 264
 			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
Please login to merge, or discard this patch.