Passed
Push — 1.7 ( 420789...d84c0a )
by
unknown
07:14
created
admin_trees_renumber.php 1 patch
Switch Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -86,143 +86,143 @@
 block discarded – undo
86 86
 		);
87 87
 		$new_xref = $WT_TREE->getNewXref($type);
88 88
 		switch ($type) {
89
-		case 'INDI':
90
-			Database::prepare(
91
-				"UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?"
92
-			)->execute(array($new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId()));
93
-			Database::prepare(
94
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
95
-			)->execute(array($old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId()));
96
-			Database::prepare(
97
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
98
-			)->execute(array($old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId()));
99
-			Database::prepare(
100
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
101
-			)->execute(array($old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId()));
102
-			Database::prepare(
103
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
104
-			)->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()));
105
-			Database::prepare(
106
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
107
-			)->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()));
108
-			Database::prepare(
109
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
110
-			)->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()));
111
-			Database::prepare(
112
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
113
-			)->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()));
114
-			Database::prepare(
115
-				"UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?"
116
-			)->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
117
-			Database::prepare(
118
-				"UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?"
119
-			)->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
120
-			Database::prepare(
121
-				"UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')"
122
-			)->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
123
-			break;
124
-		case 'FAM':
125
-			Database::prepare(
126
-				"UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?"
127
-			)->execute(array($new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId()));
128
-			Database::prepare(
129
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMC') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
130
-			)->execute(array($old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId()));
131
-			Database::prepare(
132
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMS') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
133
-			)->execute(array($old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId()));
134
-			Database::prepare(
135
-				"UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?"
136
-			)->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
137
-			Database::prepare(
138
-				"UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?"
139
-			)->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
140
-			break;
141
-		case 'SOUR':
142
-			Database::prepare(
143
-				"UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?"
144
-			)->execute(array($new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId()));
145
-			Database::prepare(
146
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'SOUR') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
147
-			)->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
148
-			Database::prepare(
149
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'SOUR') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
150
-			)->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
151
-			Database::prepare(
152
-				"UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'SOUR') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
153
-			)->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
154
-			Database::prepare(
155
-				"UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'SOUR') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
156
-			)->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
157
-			break;
158
-		case 'REPO':
159
-			Database::prepare(
160
-				"UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?"
161
-			)->execute(array($new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId()));
162
-			Database::prepare(
163
-				"UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'REPO') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
164
-			)->execute(array($old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId()));
165
-			break;
166
-		case 'NOTE':
167
-			Database::prepare(
168
-				"UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?"
169
-			)->execute(array($new_xref, "0 @$old_xref@ NOTE\n", "0 @$new_xref@ NOTE\n", "0 @$old_xref@ NOTE ", "0 @$new_xref@ NOTE ", $old_xref, $WT_TREE->getTreeId()));
170
-			Database::prepare(
171
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'NOTE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
172
-			)->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
173
-			Database::prepare(
174
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'NOTE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
175
-			)->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
176
-			Database::prepare(
177
-				"UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'NOTE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
178
-			)->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
179
-			Database::prepare(
180
-				"UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'NOTE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
181
-			)->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
182
-			Database::prepare(
183
-				"UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'NOTE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
184
-			)->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
185
-			break;
186
-		case 'OBJE':
187
-			Database::prepare(
188
-				"UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?"
189
-			)->execute(array($new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId()));
190
-			Database::prepare(
191
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'OBJE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
192
-			)->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
193
-			Database::prepare(
194
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'OBJE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
195
-			)->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
196
-			Database::prepare(
197
-				"UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'OBJE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
198
-			)->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
199
-			Database::prepare(
200
-				"UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'OBJE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
201
-			)->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
202
-			Database::prepare(
203
-				"UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'OBJE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
204
-			)->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
205
-			break;
206
-		default:
207
-			Database::prepare(
208
-				"UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?"
209
-			)->execute(array($new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId()));
210
-			Database::prepare(
211
-				"UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
212
-			)->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
213
-			Database::prepare(
214
-				"UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
215
-			)->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
216
-			Database::prepare(
217
-				"UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
218
-			)->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
219
-			Database::prepare(
220
-				"UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
221
-			)->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
222
-			Database::prepare(
223
-				"UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
224
-			)->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
225
-			break;
89
+		    case 'INDI':
90
+			    Database::prepare(
91
+				    "UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?"
92
+			    )->execute(array($new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId()));
93
+			    Database::prepare(
94
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
95
+			    )->execute(array($old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId()));
96
+			    Database::prepare(
97
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
98
+			    )->execute(array($old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId()));
99
+			    Database::prepare(
100
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
101
+			    )->execute(array($old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId()));
102
+			    Database::prepare(
103
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
104
+			    )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()));
105
+			    Database::prepare(
106
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
107
+			    )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()));
108
+			    Database::prepare(
109
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
110
+			    )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()));
111
+			    Database::prepare(
112
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
113
+			    )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()));
114
+			    Database::prepare(
115
+				    "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?"
116
+			    )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
117
+			    Database::prepare(
118
+				    "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?"
119
+			    )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
120
+			    Database::prepare(
121
+				    "UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')"
122
+			    )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
123
+			    break;
124
+		    case 'FAM':
125
+			    Database::prepare(
126
+				    "UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?"
127
+			    )->execute(array($new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId()));
128
+			    Database::prepare(
129
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMC') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
130
+			    )->execute(array($old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId()));
131
+			    Database::prepare(
132
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMS') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
133
+			    )->execute(array($old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId()));
134
+			    Database::prepare(
135
+				    "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?"
136
+			    )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
137
+			    Database::prepare(
138
+				    "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?"
139
+			    )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId()));
140
+			    break;
141
+		    case 'SOUR':
142
+			    Database::prepare(
143
+				    "UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?"
144
+			    )->execute(array($new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId()));
145
+			    Database::prepare(
146
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'SOUR') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
147
+			    )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
148
+			    Database::prepare(
149
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'SOUR') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
150
+			    )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
151
+			    Database::prepare(
152
+				    "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'SOUR') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
153
+			    )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
154
+			    Database::prepare(
155
+				    "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'SOUR') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
156
+			    )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()));
157
+			    break;
158
+		    case 'REPO':
159
+			    Database::prepare(
160
+				    "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?"
161
+			    )->execute(array($new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId()));
162
+			    Database::prepare(
163
+				    "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'REPO') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
164
+			    )->execute(array($old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId()));
165
+			    break;
166
+		    case 'NOTE':
167
+			    Database::prepare(
168
+				    "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?"
169
+			    )->execute(array($new_xref, "0 @$old_xref@ NOTE\n", "0 @$new_xref@ NOTE\n", "0 @$old_xref@ NOTE ", "0 @$new_xref@ NOTE ", $old_xref, $WT_TREE->getTreeId()));
170
+			    Database::prepare(
171
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'NOTE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
172
+			    )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
173
+			    Database::prepare(
174
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'NOTE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
175
+			    )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
176
+			    Database::prepare(
177
+				    "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'NOTE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
178
+			    )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
179
+			    Database::prepare(
180
+				    "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'NOTE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
181
+			    )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
182
+			    Database::prepare(
183
+				    "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'NOTE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
184
+			    )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()));
185
+			    break;
186
+		    case 'OBJE':
187
+			    Database::prepare(
188
+				    "UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?"
189
+			    )->execute(array($new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId()));
190
+			    Database::prepare(
191
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'OBJE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
192
+			    )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
193
+			    Database::prepare(
194
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'OBJE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
195
+			    )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
196
+			    Database::prepare(
197
+				    "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'OBJE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
198
+			    )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
199
+			    Database::prepare(
200
+				    "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'OBJE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
201
+			    )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
202
+			    Database::prepare(
203
+				    "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'OBJE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
204
+			    )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()));
205
+			    break;
206
+		    default:
207
+			    Database::prepare(
208
+				    "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?"
209
+			    )->execute(array($new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId()));
210
+			    Database::prepare(
211
+				    "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?"
212
+			    )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
213
+			    Database::prepare(
214
+				    "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?"
215
+			    )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
216
+			    Database::prepare(
217
+				    "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?"
218
+			    )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
219
+			    Database::prepare(
220
+				    "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?"
221
+			    )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
222
+			    Database::prepare(
223
+				    "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?"
224
+			    )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()));
225
+			    break;
226 226
 		}
227 227
 		Database::prepare(
228 228
 			"UPDATE `##name` SET n_id = ? WHERE n_id = ? AND n_file = ?"
Please login to merge, or discard this patch.
admin_module_reports.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,8 +74,11 @@
 block discarded – undo
74 74
 				<td class="col-xs-2">
75 75
 					<?php if ($module instanceof ModuleConfigInterface): ?>
76 76
 						<a href="<?php echo $module->getConfigLink(); ?>"><?php echo $module->getTitle(); ?> <i class="fa fa-cogs"></i></a>
77
-					<?php else: ?>
78
-						<?php echo $module->getTitle(); ?>
77
+					<?php else {
78
+    : ?>
79
+						<?php echo $module->getTitle();
80
+}
81
+?>
79 82
 					<?php endif; ?>
80 83
 				</td>
81 84
 				<td class="col-xs-5"><?php echo $module->getDescription(); ?></td>
Please login to merge, or discard this patch.
editnews.php 1 patch
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -44,44 +44,44 @@
 block discarded – undo
44 44
 $text      = Filter::post('text');
45 45
 
46 46
 switch ($action) {
47
-case 'compose':
48
-	if (Module::getModuleByName('ckeditor')) {
49
-		CkeditorModule::enableEditor($controller);
50
-	}
47
+    case 'compose':
48
+	    if (Module::getModuleByName('ckeditor')) {
49
+		    CkeditorModule::enableEditor($controller);
50
+	    }
51 51
 
52
-	echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>';
53
-	echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">';
54
-	if ($news_id) {
55
-		$news = Database::prepare("SELECT news_id AS id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) AS date, subject, body FROM `##news` WHERE news_id=?")->execute(array($news_id))->fetchOneRow(PDO::FETCH_ASSOC);
56
-	} else {
57
-		$news              = array();
58
-		$news['user_id']   = $user_id;
59
-		$news['gedcom_id'] = $gedcom_id;
60
-		$news['date']      = WT_TIMESTAMP;
61
-		$news['subject']   = '';
62
-		$news['body']      = '';
63
-	}
64
-	echo '<input type="hidden" name="user_id" value="' . $news['user_id'] . '">';
65
-	echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">';
66
-	echo '<input type="hidden" name="date" value="' . $news['date'] . '">';
67
-	echo '<table>';
68
-	echo '<tr><th style="text-align:start;">' . I18N::translate('Title') . '</th><tr>';
69
-	echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['subject'] . '"></td></tr>';
70
-	echo '<tr><th style="text-align:start;">' . I18N::translate('Content') . '</th></tr>';
71
-	echo '<tr><td>';
72
-	echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . Filter::escapeHtml($news['body']) . '</textarea>';
73
-	echo '</td></tr>';
74
-	echo '<tr><td><input type="submit" value="' . I18N::translate('save') . '"></td></tr>';
75
-	echo '</table>';
76
-	echo '</form>';
77
-	break;
78
-case 'save':
79
-	if ($news_id) {
80
-		Database::prepare("UPDATE `##news` SET subject=?, body=?, updated=FROM_UNIXTIME(?) WHERE news_id=?")->execute(array($title, $text, $date, $news_id));
81
-	} else {
82
-		Database::prepare("INSERT INTO `##news` (user_id, gedcom_id, subject, body, updated) VALUES (NULLIF(?, ''), NULLIF(?, '') ,? ,?, CURRENT_TIMESTAMP)")->execute(array($user_id, $gedcom_id, $title, $text));
83
-	}
52
+	    echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>';
53
+	    echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">';
54
+	    if ($news_id) {
55
+		    $news = Database::prepare("SELECT news_id AS id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) AS date, subject, body FROM `##news` WHERE news_id=?")->execute(array($news_id))->fetchOneRow(PDO::FETCH_ASSOC);
56
+	    } else {
57
+		    $news              = array();
58
+		    $news['user_id']   = $user_id;
59
+		    $news['gedcom_id'] = $gedcom_id;
60
+		    $news['date']      = WT_TIMESTAMP;
61
+		    $news['subject']   = '';
62
+		    $news['body']      = '';
63
+	    }
64
+	    echo '<input type="hidden" name="user_id" value="' . $news['user_id'] . '">';
65
+	    echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">';
66
+	    echo '<input type="hidden" name="date" value="' . $news['date'] . '">';
67
+	    echo '<table>';
68
+	    echo '<tr><th style="text-align:start;">' . I18N::translate('Title') . '</th><tr>';
69
+	    echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['subject'] . '"></td></tr>';
70
+	    echo '<tr><th style="text-align:start;">' . I18N::translate('Content') . '</th></tr>';
71
+	    echo '<tr><td>';
72
+	    echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . Filter::escapeHtml($news['body']) . '</textarea>';
73
+	    echo '</td></tr>';
74
+	    echo '<tr><td><input type="submit" value="' . I18N::translate('save') . '"></td></tr>';
75
+	    echo '</table>';
76
+	    echo '</form>';
77
+	    break;
78
+    case 'save':
79
+	    if ($news_id) {
80
+		    Database::prepare("UPDATE `##news` SET subject=?, body=?, updated=FROM_UNIXTIME(?) WHERE news_id=?")->execute(array($title, $text, $date, $news_id));
81
+	    } else {
82
+		    Database::prepare("INSERT INTO `##news` (user_id, gedcom_id, subject, body, updated) VALUES (NULLIF(?, ''), NULLIF(?, '') ,? ,?, CURRENT_TIMESTAMP)")->execute(array($user_id, $gedcom_id, $title, $text));
83
+	    }
84 84
 
85
-	$controller->addInlineJavascript('window.opener.location.reload();window.close();');
86
-	break;
85
+	    $controller->addInlineJavascript('window.opener.location.reload();window.close();');
86
+	    break;
87 87
 }
Please login to merge, or discard this patch.
themes/_custom/theme.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,14 +31,16 @@  discard block
 block discarded – undo
31 31
  * Only the first two functions are required: themeId() and themeName().
32 32
  * The rest are just examples, and should be removed in actual themes.
33 33
  */
34
-class MyTheme extends WebtreesTheme {
34
+class MyTheme extends WebtreesTheme
35
+{
35 36
 	/**
36 37
 	 * Give your theme a unique identifier. Themes beginning with an underscore
37 38
 	 * are reserved for internal use.
38 39
 	 *
39 40
 	 * {@inheritdoc}
40 41
 	 */
41
-	public function themeId() {
42
+	public function themeId()
43
+	{
42 44
 		return '_custom';
43 45
 	}
44 46
 
@@ -51,7 +53,8 @@  discard block
 block discarded – undo
51 53
 	 *
52 54
 	 * {@inheritdoc}
53 55
 	 */
54
-	public function themeName() {
56
+	public function themeName()
57
+	{
55 58
 		return 'Custom theme';
56 59
 	}
57 60
 
@@ -60,7 +63,8 @@  discard block
 block discarded – undo
60 63
 	 *
61 64
 	 * {@inheritdoc}
62 65
 	 */
63
-	public function stylesheets() {
66
+	public function stylesheets()
67
+	{
64 68
 		$css_files   = parent::stylesheets();
65 69
 		// Put a version number in the URL, to prevent browsers from caching old versions.
66 70
 		$css_files[] = WT_BASE_URL . 'themes/_custom/custom-v1.0.css';
@@ -75,7 +79,8 @@  discard block
 block discarded – undo
75 79
 	 *
76 80
 	 * {@inheritdoc}
77 81
 	 */
78
-	public function menuLists($surname) {
82
+	public function menuLists($surname)
83
+	{
79 84
 		// Start with the default "Lists" menu.
80 85
 		$menu = parent::menuLists($surname);
81 86
 		// Remove the "notes" sub-menu.
Please login to merge, or discard this patch.
includes/session.php 1 patch
Switch Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -200,29 +200,29 @@  discard block
 block discarded – undo
200 200
 		$frame += array('args' => array(), 'file' => 'unknown', 'line' => 'unknown');
201 201
 		array_walk($frame['args'], function (&$arg) {
202 202
 			switch (gettype($arg)) {
203
-			case 'boolean':
204
-			case 'integer':
205
-			case 'double':
206
-			case 'null':
207
-				$arg = var_export($arg, true);
208
-				break;
209
-			case 'string':
210
-				if (mb_strlen($arg) > 30) {
211
-					$arg = substr($arg, 0, 30) . '…';
212
-				}
213
-				$arg = var_export($arg, true);
214
-				break;
215
-			case 'object':
216
-				$reflection = new \ReflectionClass($arg);
217
-				if (is_object($arg) && method_exists($arg, '__toString')) {
218
-					$arg = '[' . $reflection->getShortName() . ' ' . (string) $arg . ']';
219
-				} else {
220
-					$arg = '[' . $reflection->getShortName() . ']';
221
-				}
222
-				break;
223
-			default:
224
-				$arg = '[' . gettype($arg) . ']';
225
-				break;
203
+			    case 'boolean':
204
+			    case 'integer':
205
+			    case 'double':
206
+			    case 'null':
207
+				    $arg = var_export($arg, true);
208
+				    break;
209
+			    case 'string':
210
+				    if (mb_strlen($arg) > 30) {
211
+					    $arg = substr($arg, 0, 30) . '…';
212
+				    }
213
+				    $arg = var_export($arg, true);
214
+				    break;
215
+			    case 'object':
216
+				    $reflection = new \ReflectionClass($arg);
217
+				    if (is_object($arg) && method_exists($arg, '__toString')) {
218
+					    $arg = '[' . $reflection->getShortName() . ' ' . (string) $arg . ']';
219
+				    } else {
220
+					    $arg = '[' . $reflection->getShortName() . ']';
221
+				    }
222
+				    break;
223
+			    default:
224
+				    $arg = '[' . gettype($arg) . ']';
225
+				    break;
226 226
 			}
227 227
 		});
228 228
 		$frame['file'] = str_replace(dirname(__DIR__), '', $frame['file']);
@@ -319,25 +319,25 @@  discard block
 block discarded – undo
319 319
 )->execute(array(WT_CLIENT_IP, Filter::server('HTTP_USER_AGENT', null, '')))->fetchOne();
320 320
 
321 321
 switch ($rule) {
322
-case 'allow':
323
-	$SEARCH_SPIDER = false;
324
-	break;
325
-case 'deny':
326
-	http_response_code(403);
327
-	exit;
328
-case 'robot':
329
-case 'unknown':
330
-	// Search engines don’t send cookies, and so create a new session with every visit.
331
-	// Make sure they always use the same one
332
-	Session::setId('search-engine-' . str_replace('.', '-', WT_CLIENT_IP));
333
-	$SEARCH_SPIDER = true;
334
-	break;
335
-case '':
336
-	Database::prepare(
337
-		"INSERT INTO `##site_access_rule` (ip_address_start, ip_address_end, user_agent_pattern, comment) VALUES (IFNULL(INET_ATON(?), 0), IFNULL(INET_ATON(?), 4294967295), ?, '')"
338
-	)->execute(array(WT_CLIENT_IP, WT_CLIENT_IP, Filter::server('HTTP_USER_AGENT', null, '')));
339
-	$SEARCH_SPIDER = true;
340
-	break;
322
+    case 'allow':
323
+	    $SEARCH_SPIDER = false;
324
+	    break;
325
+    case 'deny':
326
+	    http_response_code(403);
327
+	    exit;
328
+    case 'robot':
329
+    case 'unknown':
330
+	    // Search engines don’t send cookies, and so create a new session with every visit.
331
+	    // Make sure they always use the same one
332
+	    Session::setId('search-engine-' . str_replace('.', '-', WT_CLIENT_IP));
333
+	    $SEARCH_SPIDER = true;
334
+	    break;
335
+    case '':
336
+	    Database::prepare(
337
+		    "INSERT INTO `##site_access_rule` (ip_address_start, ip_address_end, user_agent_pattern, comment) VALUES (IFNULL(INET_ATON(?), 0), IFNULL(INET_ATON(?), 4294967295), ?, '')"
338
+	    )->execute(array(WT_CLIENT_IP, WT_CLIENT_IP, Filter::server('HTTP_USER_AGENT', null, '')));
339
+	    $SEARCH_SPIDER = true;
340
+	    break;
341 341
 }
342 342
 
343 343
 // Store our session data in the database.
Please login to merge, or discard this patch.
find.php 1 patch
Switch Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -47,60 +47,60 @@
 block discarded – undo
47 47
 $embed = substr($choose, 0, 1) === '1';
48 48
 
49 49
 switch ($type) {
50
-case 'indi':
51
-	$controller->setPageTitle(I18N::translate('Find an individual'));
52
-	break;
53
-case 'fam':
54
-	$controller->setPageTitle(I18N::translate('Find a family'));
55
-	break;
56
-case 'media':
57
-	$controller->setPageTitle(I18N::translate('Find a media object'));
58
-	break;
59
-case 'place':
60
-	$controller->setPageTitle(I18N::translate('Find a place'));
61
-	break;
62
-case 'repo':
63
-	$controller->setPageTitle(I18N::translate('Find a repository'));
64
-	break;
65
-case 'note':
66
-	$controller->setPageTitle(I18N::translate('Find a shared note'));
67
-	break;
68
-case 'source':
69
-	$controller->setPageTitle(I18N::translate('Find a source'));
70
-	break;
71
-case 'specialchar':
72
-	$controller->setPageTitle(I18N::translate('Find a special character'));
73
-	break;
74
-case 'factINDI':
75
-	$controller
76
-		->setPageTitle(I18N::translate('Find a fact or event'))
77
-		->addInlineJavascript('initPickFact("INDI");');
78
-	break;
79
-case 'factFAM':
80
-	$controller
81
-		->setPageTitle(I18N::translate('Find a fact or event'))
82
-		->addInlineJavascript('initPickFact("FAM");');
83
-	break;
84
-case 'factSOUR':
85
-	$controller
86
-		->setPageTitle(I18N::translate('Find a fact or event'))
87
-		->addInlineJavascript('initPickFact("SOUR");');
88
-	break;
89
-case 'factREPO':
90
-	$controller
91
-		->setPageTitle(I18N::translate('Find a fact or event'))
92
-		->addInlineJavascript('initPickFact("REPO");');
93
-	break;
94
-case 'factNAME':
95
-	$controller
96
-		->setPageTitle(I18N::translate('Find a fact or event'))
97
-		->addInlineJavascript('initPickFact("NAME");');
98
-	break;
99
-case 'factPLAC':
100
-	$controller
101
-		->setPageTitle(I18N::translate('Find a fact or event'))
102
-		->addInlineJavascript('initPickFact("PLAC");');
103
-	break;
50
+    case 'indi':
51
+	    $controller->setPageTitle(I18N::translate('Find an individual'));
52
+	    break;
53
+    case 'fam':
54
+	    $controller->setPageTitle(I18N::translate('Find a family'));
55
+	    break;
56
+    case 'media':
57
+	    $controller->setPageTitle(I18N::translate('Find a media object'));
58
+	    break;
59
+    case 'place':
60
+	    $controller->setPageTitle(I18N::translate('Find a place'));
61
+	    break;
62
+    case 'repo':
63
+	    $controller->setPageTitle(I18N::translate('Find a repository'));
64
+	    break;
65
+    case 'note':
66
+	    $controller->setPageTitle(I18N::translate('Find a shared note'));
67
+	    break;
68
+    case 'source':
69
+	    $controller->setPageTitle(I18N::translate('Find a source'));
70
+	    break;
71
+    case 'specialchar':
72
+	    $controller->setPageTitle(I18N::translate('Find a special character'));
73
+	    break;
74
+    case 'factINDI':
75
+	    $controller
76
+		    ->setPageTitle(I18N::translate('Find a fact or event'))
77
+		    ->addInlineJavascript('initPickFact("INDI");');
78
+	    break;
79
+    case 'factFAM':
80
+	    $controller
81
+		    ->setPageTitle(I18N::translate('Find a fact or event'))
82
+		    ->addInlineJavascript('initPickFact("FAM");');
83
+	    break;
84
+    case 'factSOUR':
85
+	    $controller
86
+		    ->setPageTitle(I18N::translate('Find a fact or event'))
87
+		    ->addInlineJavascript('initPickFact("SOUR");');
88
+	    break;
89
+    case 'factREPO':
90
+	    $controller
91
+		    ->setPageTitle(I18N::translate('Find a fact or event'))
92
+		    ->addInlineJavascript('initPickFact("REPO");');
93
+	    break;
94
+    case 'factNAME':
95
+	    $controller
96
+		    ->setPageTitle(I18N::translate('Find a fact or event'))
97
+		    ->addInlineJavascript('initPickFact("NAME");');
98
+	    break;
99
+    case 'factPLAC':
100
+	    $controller
101
+		    ->setPageTitle(I18N::translate('Find a fact or event'))
102
+		    ->addInlineJavascript('initPickFact("PLAC");');
103
+	    break;
104 104
 }
105 105
 $controller->pageHeader();
106 106
 
Please login to merge, or discard this patch.
action.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,14 +66,14 @@
 block discarded – undo
66 66
 		foreach ($record->getFacts() as $fact) {
67 67
 			if ($fact->getFactId() == $fact_id) {
68 68
 				switch ($fact->getTag()) {
69
-				case 'NOTE':
70
-				case 'SOUR':
71
-				case 'OBJE':
72
-					$type = 'all'; // paste this anywhere
73
-					break;
74
-				default:
75
-					$type = $record::RECORD_TYPE; // paste only to the same record type
76
-					break;
69
+				    case 'NOTE':
70
+				    case 'SOUR':
71
+				    case 'OBJE':
72
+					    $type = 'all'; // paste this anywhere
73
+					    break;
74
+				    default:
75
+					    $type = $record::RECORD_TYPE; // paste only to the same record type
76
+					    break;
77 77
 				}
78 78
 				$clipboard = Session::get('clipboard');
79 79
 				if (!is_array($clipboard)) {
Please login to merge, or discard this patch.
statisticsplot.php 2 patches
Switch Indentation   +521 added lines, -521 removed lines patch added patch discarded remove patch
@@ -852,528 +852,528 @@
 block discarded – undo
852 852
 echo '<div class="statistics_chart" title="', I18N::translate('Statistics chart'), '">';
853 853
 
854 854
 switch ($x_axis) {
855
-case '1':
856
-	echo $stats->chartDistribution(array(Filter::get('chart_shows'), Filter::get('chart_type'), Filter::get('SURN')));
857
-	break;
858
-case '2':
859
-	echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'birth_distribution_chart'));
860
-	break;
861
-case '3':
862
-	echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'death_distribution_chart'));
863
-	break;
864
-case '4':
865
-	echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'marriage_distribution_chart'));
866
-	break;
867
-case '11':
868
-	$monthdata = array();
869
-	for ($i = 0; $i < 12; ++$i) {
870
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
871
-	}
872
-	$xgiven            = true;
873
-	$zgiven            = false;
874
-	$title             = I18N::translate('Month of birth');
875
-	$xtitle            = I18N::translate('month');
876
-	$ytitle            = I18N::translate('numbers');
877
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
878
-	$xdata             = $monthdata;
879
-	$xmax              = 12;
880
-	if ($z_axis !== 300 && $z_axis !== 301) {
881
-		calculate_legend($boundaries_z_axis);
882
-	}
883
-	$percentage = false;
884
-	if ($y_axis === 201) {
885
-		$percentage = false;
886
-		$ytitle     = I18N::translate('Individuals');
887
-	} elseif ($y_axis === 202) {
888
-		$percentage = true;
889
-		$ytitle     = I18N::translate('percentage');
890
-	}
891
-	$male_female = false;
892
-	if ($z_axis === 300) {
893
-		$zgiven          = false;
894
-		$legend[0]       = 'all';
895
-		$zmax            = 1;
896
-		$z_boundaries[0] = 100000;
897
-	} elseif ($z_axis === 301) {
898
-		$male_female = true;
899
-		$zgiven      = true;
900
-		$legend[0]   = I18N::translate('Male');
901
-		$legend[1]   = I18N::translate('Female');
902
-		$zmax        = 2;
903
-		$xtitle      = $xtitle . I18N::translate(' per gender');
904
-	} elseif ($z_axis === 302) {
905
-		$xtitle = $xtitle . I18N::translate(' per time period');
906
-	}
907
-	//-- reset the data array
908
-	for ($i = 0; $i < $zmax; $i++) {
909
-		for ($j = 0; $j < $xmax; $j++) {
910
-			$ydata[$i][$j] = 0;
911
-		}
912
-	}
913
-	$total = month_of_birth($z_axis, $z_boundaries, $stats);
914
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
915
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
916
-	break;
917
-case '12':
918
-	$monthdata = array();
919
-	for ($i = 0; $i < 12; ++$i) {
920
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
921
-	}
922
-	$xgiven            = true;
923
-	$zgiven            = false;
924
-	$title             = I18N::translate('Month of death');
925
-	$xtitle            = I18N::translate('month');
926
-	$ytitle            = I18N::translate('numbers');
927
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
928
-	$xdata             = $monthdata;
929
-	$xmax              = 12;
930
-	if ($z_axis !== 300 && $z_axis !== 301) {
931
-		calculate_legend($boundaries_z_axis);
932
-	}
933
-	$percentage = false;
934
-	if ($y_axis === 201) {
935
-		$percentage = false;
936
-		$ytitle     = I18N::translate('Individuals');
937
-	} elseif ($y_axis === 202) {
938
-		$percentage = true;
939
-		$ytitle     = I18N::translate('percentage');
940
-	}
941
-	$male_female = false;
942
-	if ($z_axis === 300) {
943
-		$zgiven          = false;
944
-		$legend[0]       = 'all';
945
-		$zmax            = 1;
946
-		$z_boundaries[0] = 100000;
947
-	} elseif ($z_axis === 301) {
948
-		$male_female = true;
949
-		$zgiven      = true;
950
-		$legend[0]   = I18N::translate('Male');
951
-		$legend[1]   = I18N::translate('Female');
952
-		$zmax        = 2;
953
-		$xtitle      = $xtitle . I18N::translate(' per gender');
954
-	} elseif ($z_axis === 302) {
955
-		$xtitle = $xtitle . I18N::translate(' per time period');
956
-	}
957
-	//-- reset the data array
958
-	for ($i = 0; $i < $zmax; $i++) {
959
-		for ($j = 0; $j < $xmax; $j++) {
960
-			$ydata[$i][$j] = 0;
961
-		}
962
-	}
963
-	$total = month_of_death($z_axis, $z_boundaries, $stats);
964
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
965
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
966
-	break;
967
-case '13':
968
-	$monthdata = array();
969
-	for ($i = 0; $i < 12; ++$i) {
970
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
971
-	}
855
+    case '1':
856
+	    echo $stats->chartDistribution(array(Filter::get('chart_shows'), Filter::get('chart_type'), Filter::get('SURN')));
857
+	    break;
858
+    case '2':
859
+	    echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'birth_distribution_chart'));
860
+	    break;
861
+    case '3':
862
+	    echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'death_distribution_chart'));
863
+	    break;
864
+    case '4':
865
+	    echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'marriage_distribution_chart'));
866
+	    break;
867
+    case '11':
868
+	    $monthdata = array();
869
+	    for ($i = 0; $i < 12; ++$i) {
870
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
871
+	    }
872
+	    $xgiven            = true;
873
+	    $zgiven            = false;
874
+	    $title             = I18N::translate('Month of birth');
875
+	    $xtitle            = I18N::translate('month');
876
+	    $ytitle            = I18N::translate('numbers');
877
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
878
+	    $xdata             = $monthdata;
879
+	    $xmax              = 12;
880
+	    if ($z_axis !== 300 && $z_axis !== 301) {
881
+		    calculate_legend($boundaries_z_axis);
882
+	    }
883
+	    $percentage = false;
884
+	    if ($y_axis === 201) {
885
+		    $percentage = false;
886
+		    $ytitle     = I18N::translate('Individuals');
887
+	    } elseif ($y_axis === 202) {
888
+		    $percentage = true;
889
+		    $ytitle     = I18N::translate('percentage');
890
+	    }
891
+	    $male_female = false;
892
+	    if ($z_axis === 300) {
893
+		    $zgiven          = false;
894
+		    $legend[0]       = 'all';
895
+		    $zmax            = 1;
896
+		    $z_boundaries[0] = 100000;
897
+	    } elseif ($z_axis === 301) {
898
+		    $male_female = true;
899
+		    $zgiven      = true;
900
+		    $legend[0]   = I18N::translate('Male');
901
+		    $legend[1]   = I18N::translate('Female');
902
+		    $zmax        = 2;
903
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
904
+	    } elseif ($z_axis === 302) {
905
+		    $xtitle = $xtitle . I18N::translate(' per time period');
906
+	    }
907
+	    //-- reset the data array
908
+	    for ($i = 0; $i < $zmax; $i++) {
909
+		    for ($j = 0; $j < $xmax; $j++) {
910
+			    $ydata[$i][$j] = 0;
911
+		    }
912
+	    }
913
+	    $total = month_of_birth($z_axis, $z_boundaries, $stats);
914
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
915
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
916
+	    break;
917
+    case '12':
918
+	    $monthdata = array();
919
+	    for ($i = 0; $i < 12; ++$i) {
920
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
921
+	    }
922
+	    $xgiven            = true;
923
+	    $zgiven            = false;
924
+	    $title             = I18N::translate('Month of death');
925
+	    $xtitle            = I18N::translate('month');
926
+	    $ytitle            = I18N::translate('numbers');
927
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
928
+	    $xdata             = $monthdata;
929
+	    $xmax              = 12;
930
+	    if ($z_axis !== 300 && $z_axis !== 301) {
931
+		    calculate_legend($boundaries_z_axis);
932
+	    }
933
+	    $percentage = false;
934
+	    if ($y_axis === 201) {
935
+		    $percentage = false;
936
+		    $ytitle     = I18N::translate('Individuals');
937
+	    } elseif ($y_axis === 202) {
938
+		    $percentage = true;
939
+		    $ytitle     = I18N::translate('percentage');
940
+	    }
941
+	    $male_female = false;
942
+	    if ($z_axis === 300) {
943
+		    $zgiven          = false;
944
+		    $legend[0]       = 'all';
945
+		    $zmax            = 1;
946
+		    $z_boundaries[0] = 100000;
947
+	    } elseif ($z_axis === 301) {
948
+		    $male_female = true;
949
+		    $zgiven      = true;
950
+		    $legend[0]   = I18N::translate('Male');
951
+		    $legend[1]   = I18N::translate('Female');
952
+		    $zmax        = 2;
953
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
954
+	    } elseif ($z_axis === 302) {
955
+		    $xtitle = $xtitle . I18N::translate(' per time period');
956
+	    }
957
+	    //-- reset the data array
958
+	    for ($i = 0; $i < $zmax; $i++) {
959
+		    for ($j = 0; $j < $xmax; $j++) {
960
+			    $ydata[$i][$j] = 0;
961
+		    }
962
+	    }
963
+	    $total = month_of_death($z_axis, $z_boundaries, $stats);
964
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
965
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
966
+	    break;
967
+    case '13':
968
+	    $monthdata = array();
969
+	    for ($i = 0; $i < 12; ++$i) {
970
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
971
+	    }
972 972
 
973
-	if ($z_axis === 301) {
974
-		$z_axis = 300;
975
-	}
976
-	$xgiven            = true;
977
-	$zgiven            = false;
978
-	$title             = I18N::translate('Month of marriage');
979
-	$xtitle            = I18N::translate('month');
980
-	$ytitle            = I18N::translate('numbers');
981
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
982
-	$xdata             = $monthdata;
983
-	$xmax              = 12;
984
-	if ($z_axis !== 300 && $z_axis !== 301) {
985
-		calculate_legend($boundaries_z_axis);
986
-	}
987
-	$percentage = false;
988
-	if ($y_axis === 201) {
989
-		$percentage = false;
990
-		$ytitle     = I18N::translate('Families');
991
-	} elseif ($y_axis === 202) {
992
-		$percentage = true;
993
-		$ytitle     = I18N::translate('percentage');
994
-	}
995
-	$male_female = false;
996
-	if ($z_axis === 300) {
997
-		$zgiven          = false;
998
-		$legend[0]       = 'all';
999
-		$zmax            = 1;
1000
-		$z_boundaries[0] = 100000;
1001
-	} elseif ($z_axis === 301) {
1002
-		$male_female = true;
1003
-		$zgiven      = true;
1004
-		$legend[0]   = I18N::translate('Male');
1005
-		$legend[1]   = I18N::translate('Female');
1006
-		$zmax        = 2;
1007
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1008
-	} elseif ($z_axis === 302) {
1009
-		$xtitle = $xtitle . I18N::translate(' per time period');
1010
-	}
1011
-	//-- reset the data array
1012
-	for ($i = 0; $i < $zmax; $i++) {
1013
-		for ($j = 0; $j < $xmax; $j++) {
1014
-			$ydata[$i][$j] = 0;
1015
-		}
1016
-	}
1017
-	$total = month_of_marriage($z_axis, $z_boundaries, $stats);
1018
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1019
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1020
-	break;
1021
-case '14':
1022
-	$monthdata = array();
1023
-	for ($i = 0; $i < 12; ++$i) {
1024
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1025
-	}
1026
-	$xgiven            = true;
1027
-	$zgiven            = false;
1028
-	$title             = I18N::translate('Month of birth of first child in a relation');
1029
-	$xtitle            = I18N::translate('month');
1030
-	$ytitle            = I18N::translate('numbers');
1031
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1032
-	$xdata             = $monthdata;
1033
-	$xmax              = 12;
1034
-	if ($z_axis !== 300 && $z_axis !== 301) {
1035
-		calculate_legend($boundaries_z_axis);
1036
-	}
1037
-	$percentage = false;
1038
-	if ($y_axis === 201) {
1039
-		$percentage = false;
1040
-		$ytitle     = I18N::translate('Children');
1041
-	} elseif ($y_axis === 202) {
1042
-		$percentage = true;
1043
-		$ytitle     = I18N::translate('percentage');
1044
-	}
1045
-	$male_female = false;
1046
-	if ($z_axis === 300) {
1047
-		$zgiven          = false;
1048
-		$legend[0]       = 'all';
1049
-		$zmax            = 1;
1050
-		$z_boundaries[0] = 100000;
1051
-	} elseif ($z_axis === 301) {
1052
-		$male_female = true;
1053
-		$zgiven      = true;
1054
-		$legend[0]   = I18N::translate('Male');
1055
-		$legend[1]   = I18N::translate('Female');
1056
-		$zmax        = 2;
1057
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1058
-	} elseif ($z_axis === 302) {
1059
-		$xtitle = $xtitle . I18N::translate(' per time period');
1060
-	}
1061
-	//-- reset the data array
1062
-	for ($i = 0; $i < $zmax; $i++) {
1063
-		for ($j = 0; $j < $xmax; $j++) {
1064
-			$ydata[$i][$j] = 0;
1065
-		}
1066
-	}
1067
-	$total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats);
1068
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1069
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1070
-	break;
1071
-case '15':
1072
-	$monthdata = array();
1073
-	for ($i = 0; $i < 12; ++$i) {
1074
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1075
-	}
973
+	    if ($z_axis === 301) {
974
+		    $z_axis = 300;
975
+	    }
976
+	    $xgiven            = true;
977
+	    $zgiven            = false;
978
+	    $title             = I18N::translate('Month of marriage');
979
+	    $xtitle            = I18N::translate('month');
980
+	    $ytitle            = I18N::translate('numbers');
981
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
982
+	    $xdata             = $monthdata;
983
+	    $xmax              = 12;
984
+	    if ($z_axis !== 300 && $z_axis !== 301) {
985
+		    calculate_legend($boundaries_z_axis);
986
+	    }
987
+	    $percentage = false;
988
+	    if ($y_axis === 201) {
989
+		    $percentage = false;
990
+		    $ytitle     = I18N::translate('Families');
991
+	    } elseif ($y_axis === 202) {
992
+		    $percentage = true;
993
+		    $ytitle     = I18N::translate('percentage');
994
+	    }
995
+	    $male_female = false;
996
+	    if ($z_axis === 300) {
997
+		    $zgiven          = false;
998
+		    $legend[0]       = 'all';
999
+		    $zmax            = 1;
1000
+		    $z_boundaries[0] = 100000;
1001
+	    } elseif ($z_axis === 301) {
1002
+		    $male_female = true;
1003
+		    $zgiven      = true;
1004
+		    $legend[0]   = I18N::translate('Male');
1005
+		    $legend[1]   = I18N::translate('Female');
1006
+		    $zmax        = 2;
1007
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1008
+	    } elseif ($z_axis === 302) {
1009
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1010
+	    }
1011
+	    //-- reset the data array
1012
+	    for ($i = 0; $i < $zmax; $i++) {
1013
+		    for ($j = 0; $j < $xmax; $j++) {
1014
+			    $ydata[$i][$j] = 0;
1015
+		    }
1016
+	    }
1017
+	    $total = month_of_marriage($z_axis, $z_boundaries, $stats);
1018
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1019
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1020
+	    break;
1021
+    case '14':
1022
+	    $monthdata = array();
1023
+	    for ($i = 0; $i < 12; ++$i) {
1024
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1025
+	    }
1026
+	    $xgiven            = true;
1027
+	    $zgiven            = false;
1028
+	    $title             = I18N::translate('Month of birth of first child in a relation');
1029
+	    $xtitle            = I18N::translate('month');
1030
+	    $ytitle            = I18N::translate('numbers');
1031
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1032
+	    $xdata             = $monthdata;
1033
+	    $xmax              = 12;
1034
+	    if ($z_axis !== 300 && $z_axis !== 301) {
1035
+		    calculate_legend($boundaries_z_axis);
1036
+	    }
1037
+	    $percentage = false;
1038
+	    if ($y_axis === 201) {
1039
+		    $percentage = false;
1040
+		    $ytitle     = I18N::translate('Children');
1041
+	    } elseif ($y_axis === 202) {
1042
+		    $percentage = true;
1043
+		    $ytitle     = I18N::translate('percentage');
1044
+	    }
1045
+	    $male_female = false;
1046
+	    if ($z_axis === 300) {
1047
+		    $zgiven          = false;
1048
+		    $legend[0]       = 'all';
1049
+		    $zmax            = 1;
1050
+		    $z_boundaries[0] = 100000;
1051
+	    } elseif ($z_axis === 301) {
1052
+		    $male_female = true;
1053
+		    $zgiven      = true;
1054
+		    $legend[0]   = I18N::translate('Male');
1055
+		    $legend[1]   = I18N::translate('Female');
1056
+		    $zmax        = 2;
1057
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1058
+	    } elseif ($z_axis === 302) {
1059
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1060
+	    }
1061
+	    //-- reset the data array
1062
+	    for ($i = 0; $i < $zmax; $i++) {
1063
+		    for ($j = 0; $j < $xmax; $j++) {
1064
+			    $ydata[$i][$j] = 0;
1065
+		    }
1066
+	    }
1067
+	    $total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats);
1068
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1069
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1070
+	    break;
1071
+    case '15':
1072
+	    $monthdata = array();
1073
+	    for ($i = 0; $i < 12; ++$i) {
1074
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1075
+	    }
1076 1076
 
1077
-	if ($z_axis === 301) {
1078
-		$z_axis = 300;
1079
-	}
1080
-	$xgiven            = true;
1081
-	$zgiven            = false;
1082
-	$title             = I18N::translate('Month of first marriage');
1083
-	$xtitle            = I18N::translate('month');
1084
-	$ytitle            = I18N::translate('numbers');
1085
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1086
-	$xdata             = $monthdata;
1087
-	$xmax              = 12;
1088
-	if ($z_axis !== 300 && $z_axis !== 301) {
1089
-		calculate_legend($boundaries_z_axis);
1090
-	}
1091
-	$percentage = false;
1092
-	if ($y_axis === 201) {
1093
-		$percentage = false;
1094
-		$ytitle     = I18N::translate('Families');
1095
-	} elseif ($y_axis === 202) {
1096
-		$percentage = true;
1097
-		$ytitle     = I18N::translate('percentage');
1098
-	}
1099
-	$male_female = false;
1100
-	if ($z_axis === 300) {
1101
-		$zgiven          = false;
1102
-		$legend[0]       = 'all';
1103
-		$zmax            = 1;
1104
-		$z_boundaries[0] = 100000;
1105
-	} elseif ($z_axis === 301) {
1106
-		$male_female = true;
1107
-		$zgiven      = true;
1108
-		$legend[0]   = I18N::translate('Male');
1109
-		$legend[1]   = I18N::translate('Female');
1110
-		$zmax        = 2;
1111
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1112
-	} elseif ($z_axis === 302) {
1113
-		$xtitle = $xtitle . I18N::translate(' per time period');
1114
-	}
1115
-	//-- reset the data array
1116
-	for ($i = 0; $i < $zmax; $i++) {
1117
-		for ($j = 0; $j < $xmax; $j++) {
1118
-			$ydata[$i][$j] = 0;
1119
-		}
1120
-	}
1121
-	$total = month_of_first_marriage($z_axis, $z_boundaries, $stats);
1122
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1123
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1124
-	break;
1125
-case '17':
1126
-	$monthdata = array();
1127
-	for ($i = 0; $i < 12; ++$i) {
1128
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1129
-	}
1130
-	$xgiven            = false;
1131
-	$zgiven            = false;
1132
-	$title             = I18N::translate('Age related to birth year');
1133
-	$xtitle            = I18N::translate('age');
1134
-	$ytitle            = I18N::translate('numbers');
1135
-	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages');
1136
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1137
-	calculate_axis($boundaries_x_axis);
1138
-	if ($z_axis !== 300 && $z_axis !== 301) {
1139
-		calculate_legend($boundaries_z_axis);
1140
-	}
1141
-	$percentage = false;
1142
-	if ($y_axis === 201) {
1143
-		$percentage = false;
1144
-		$ytitle     = I18N::translate('Individuals');
1145
-	} elseif ($y_axis === 202) {
1146
-		$percentage = true;
1147
-		$ytitle     = I18N::translate('percentage');
1148
-	}
1149
-	$male_female = false;
1150
-	if ($z_axis === 300) {
1151
-		$zgiven          = false;
1152
-		$legend[0]       = 'all';
1153
-		$zmax            = 1;
1154
-		$z_boundaries[0] = 100000;
1155
-	} elseif ($z_axis === 301) {
1156
-		$male_female = true;
1157
-		$zgiven      = true;
1158
-		$legend[0]   = I18N::translate('Male');
1159
-		$legend[1]   = I18N::translate('Female');
1160
-		$zmax        = 2;
1161
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1162
-	} elseif ($z_axis === 302) {
1163
-		$xtitle = $xtitle . I18N::translate(' per time period');
1164
-	}
1165
-	//-- reset the data array
1166
-	for ($i = 0; $i < $zmax; $i++) {
1167
-		for ($j = 0; $j < $xmax; $j++) {
1168
-			$ydata[$i][$j] = 0;
1169
-		}
1170
-	}
1171
-	$total = lifespan_by_birth_year($z_axis, $z_boundaries, $stats);
1172
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1173
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1174
-	break;
1175
-case '18':
1176
-	$monthdata = array();
1177
-	for ($i = 0; $i < 12; ++$i) {
1178
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1179
-	}
1180
-	$xgiven            = false;
1181
-	$zgiven            = false;
1182
-	$title             = I18N::translate('Age related to death year');
1183
-	$xtitle            = I18N::translate('age');
1184
-	$ytitle            = I18N::translate('numbers');
1185
-	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages');
1186
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1187
-	calculate_axis($boundaries_x_axis);
1188
-	if ($z_axis !== 300 && $z_axis !== 301) {
1189
-		calculate_legend($boundaries_z_axis);
1190
-	}
1191
-	$percentage = false;
1192
-	if ($y_axis === 201) {
1193
-		$percentage = false;
1194
-		$ytitle     = I18N::translate('Individuals');
1195
-	} elseif ($y_axis === 202) {
1196
-		$percentage = true;
1197
-		$ytitle     = I18N::translate('percentage');
1198
-	}
1199
-	$male_female = false;
1200
-	if ($z_axis === 300) {
1201
-		$zgiven          = false;
1202
-		$legend[0]       = 'all';
1203
-		$zmax            = 1;
1204
-		$z_boundaries[0] = 100000;
1205
-	} elseif ($z_axis === 301) {
1206
-		$male_female = true;
1207
-		$zgiven      = true;
1208
-		$legend[0]   = I18N::translate('Male');
1209
-		$legend[1]   = I18N::translate('Female');
1210
-		$zmax        = 2;
1211
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1212
-	} elseif ($z_axis === 302) {
1213
-		$xtitle = $xtitle . I18N::translate(' per time period');
1214
-	}
1215
-	//-- reset the data array
1216
-	for ($i = 0; $i < $zmax; $i++) {
1217
-		for ($j = 0; $j < $xmax; $j++) {
1218
-			$ydata[$i][$j] = 0;
1219
-		}
1220
-	}
1221
-	$total = lifespan_by_death_year($z_axis, $z_boundaries, $stats);
1222
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1223
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1224
-	break;
1225
-case '19':
1226
-	$monthdata = array();
1227
-	for ($i = 0; $i < 12; ++$i) {
1228
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1229
-	}
1230
-	$xgiven            = false;
1231
-	$zgiven            = false;
1232
-	$title             = I18N::translate('Age in year of marriage');
1233
-	$xtitle            = I18N::translate('age');
1234
-	$ytitle            = I18N::translate('numbers');
1235
-	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1236
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1237
-	calculate_axis($boundaries_x_axis);
1238
-	if ($z_axis !== 300 && $z_axis !== 301) {
1239
-		calculate_legend($boundaries_z_axis);
1240
-	}
1241
-	$percentage = false;
1242
-	if ($y_axis === 201) {
1243
-		$percentage = false;
1244
-		$ytitle     = I18N::translate('Individuals');
1245
-	} elseif ($y_axis === 202) {
1246
-		$percentage = true;
1247
-		$ytitle     = I18N::translate('percentage');
1248
-	}
1249
-	$male_female     = false;
1250
-	$z_boundaries[0] = 100000;
1251
-	if ($z_axis === 300) {
1252
-		$zgiven          = false;
1253
-		$legend[0]       = 'all';
1254
-		$zmax            = 1;
1255
-	} elseif ($z_axis === 301) {
1256
-		$male_female = true;
1257
-		$zgiven      = true;
1258
-		$legend[0]   = I18N::translate('Male');
1259
-		$legend[1]   = I18N::translate('Female');
1260
-		$zmax        = 2;
1261
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1262
-	} elseif ($z_axis === 302) {
1263
-		$xtitle = $xtitle . I18N::translate(' per time period');
1264
-	}
1265
-	//-- reset the data array
1266
-	for ($i = 0; $i < $zmax; $i++) {
1267
-		for ($j = 0; $j < $xmax; $j++) {
1268
-			$ydata[$i][$j] = 0;
1269
-		}
1270
-	}
1271
-	$total = age_at_marriage($z_axis, $z_boundaries, $stats);
1272
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1273
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1274
-	break;
1275
-case '20':
1276
-	$monthdata = array();
1277
-	for ($i = 0; $i < 12; ++$i) {
1278
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1279
-	}
1280
-	$xgiven            = false;
1281
-	$zgiven            = false;
1282
-	$title             = I18N::translate('Age in year of first marriage');
1283
-	$xtitle            = I18N::translate('age');
1284
-	$ytitle            = I18N::translate('numbers');
1285
-	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1286
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1287
-	calculate_axis($boundaries_x_axis);
1288
-	if ($z_axis !== 300 && $z_axis !== 301) {
1289
-		calculate_legend($boundaries_z_axis);
1290
-	}
1291
-	$percentage = false;
1292
-	if ($y_axis === 201) {
1293
-		$percentage = false;
1294
-		$ytitle     = I18N::translate('Individuals');
1295
-	} elseif ($y_axis === 202) {
1296
-		$percentage = true;
1297
-		$ytitle     = I18N::translate('percentage');
1298
-	}
1299
-	$male_female = false;
1300
-	if ($z_axis === 300) {
1301
-		$zgiven          = false;
1302
-		$legend[0]       = 'all';
1303
-		$zmax            = 1;
1304
-		$z_boundaries[0] = 100000;
1305
-	} elseif ($z_axis === 301) {
1306
-		$male_female = true;
1307
-		$zgiven      = true;
1308
-		$legend[0]   = I18N::translate('Male');
1309
-		$legend[1]   = I18N::translate('Female');
1310
-		$zmax        = 2;
1311
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1312
-	} elseif ($z_axis === 302) {
1313
-		$xtitle = $xtitle . I18N::translate(' per time period');
1314
-	}
1315
-	//-- reset the data array
1316
-	for ($i = 0; $i < $zmax; $i++) {
1317
-		for ($j = 0; $j < $xmax; $j++) {
1318
-			$ydata[$i][$j] = 0;
1319
-		}
1320
-	}
1321
-	$total = age_at_first_marriage($z_axis, $z_boundaries, $stats);
1322
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1323
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1324
-	break;
1325
-case '21':
1326
-	$monthdata = array();
1327
-	for ($i = 0; $i < 12; ++$i) {
1328
-		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1329
-	}
1330
-	$xgiven            = false;
1331
-	$zgiven            = false;
1332
-	$title             = I18N::translate('Number of children');
1333
-	$xtitle            = I18N::translate('children');
1334
-	$ytitle            = I18N::translate('numbers');
1335
-	$boundaries_x_axis = Filter::get('x-axis-boundaries-numbers');
1336
-	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1337
-	calculate_axis($boundaries_x_axis);
1338
-	if ($z_axis !== 300 && $z_axis !== 301) {
1339
-		calculate_legend($boundaries_z_axis);
1340
-	}
1341
-	$percentage = false;
1342
-	if ($y_axis === 201) {
1343
-		$percentage = false;
1344
-		$ytitle     = I18N::translate('Families');
1345
-	} elseif ($y_axis === 202) {
1346
-		$percentage = true;
1347
-		$ytitle     = I18N::translate('percentage');
1348
-	}
1349
-	$male_female = false;
1350
-	if ($z_axis === 300) {
1351
-		$zgiven          = false;
1352
-		$legend[0]       = 'all';
1353
-		$zmax            = 1;
1354
-		$z_boundaries[0] = 100000;
1355
-	} elseif ($z_axis === 301) {
1356
-		$male_female = true;
1357
-		$zgiven      = true;
1358
-		$legend[0]   = I18N::translate('Male');
1359
-		$legend[1]   = I18N::translate('Female');
1360
-		$zmax        = 2;
1361
-		$xtitle      = $xtitle . I18N::translate(' per gender');
1362
-	} elseif ($z_axis === 302) {
1363
-		$xtitle = $xtitle . I18N::translate(' per time period');
1364
-	}
1365
-	//-- reset the data array
1366
-	for ($i = 0; $i < $zmax; $i++) {
1367
-		for ($j = 0; $j < $xmax; $j++) {
1368
-			$ydata[$i][$j] = 0;
1369
-		}
1370
-	}
1371
-	$total = number_of_children($z_axis, $z_boundaries, $stats);
1372
-	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren();
1373
-	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1374
-	break;
1375
-default:
1376
-	echo '<i class="icon-loading-large"></i>';
1377
-	break;
1077
+	    if ($z_axis === 301) {
1078
+		    $z_axis = 300;
1079
+	    }
1080
+	    $xgiven            = true;
1081
+	    $zgiven            = false;
1082
+	    $title             = I18N::translate('Month of first marriage');
1083
+	    $xtitle            = I18N::translate('month');
1084
+	    $ytitle            = I18N::translate('numbers');
1085
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1086
+	    $xdata             = $monthdata;
1087
+	    $xmax              = 12;
1088
+	    if ($z_axis !== 300 && $z_axis !== 301) {
1089
+		    calculate_legend($boundaries_z_axis);
1090
+	    }
1091
+	    $percentage = false;
1092
+	    if ($y_axis === 201) {
1093
+		    $percentage = false;
1094
+		    $ytitle     = I18N::translate('Families');
1095
+	    } elseif ($y_axis === 202) {
1096
+		    $percentage = true;
1097
+		    $ytitle     = I18N::translate('percentage');
1098
+	    }
1099
+	    $male_female = false;
1100
+	    if ($z_axis === 300) {
1101
+		    $zgiven          = false;
1102
+		    $legend[0]       = 'all';
1103
+		    $zmax            = 1;
1104
+		    $z_boundaries[0] = 100000;
1105
+	    } elseif ($z_axis === 301) {
1106
+		    $male_female = true;
1107
+		    $zgiven      = true;
1108
+		    $legend[0]   = I18N::translate('Male');
1109
+		    $legend[1]   = I18N::translate('Female');
1110
+		    $zmax        = 2;
1111
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1112
+	    } elseif ($z_axis === 302) {
1113
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1114
+	    }
1115
+	    //-- reset the data array
1116
+	    for ($i = 0; $i < $zmax; $i++) {
1117
+		    for ($j = 0; $j < $xmax; $j++) {
1118
+			    $ydata[$i][$j] = 0;
1119
+		    }
1120
+	    }
1121
+	    $total = month_of_first_marriage($z_axis, $z_boundaries, $stats);
1122
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1123
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1124
+	    break;
1125
+    case '17':
1126
+	    $monthdata = array();
1127
+	    for ($i = 0; $i < 12; ++$i) {
1128
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1129
+	    }
1130
+	    $xgiven            = false;
1131
+	    $zgiven            = false;
1132
+	    $title             = I18N::translate('Age related to birth year');
1133
+	    $xtitle            = I18N::translate('age');
1134
+	    $ytitle            = I18N::translate('numbers');
1135
+	    $boundaries_x_axis = Filter::get('x-axis-boundaries-ages');
1136
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1137
+	    calculate_axis($boundaries_x_axis);
1138
+	    if ($z_axis !== 300 && $z_axis !== 301) {
1139
+		    calculate_legend($boundaries_z_axis);
1140
+	    }
1141
+	    $percentage = false;
1142
+	    if ($y_axis === 201) {
1143
+		    $percentage = false;
1144
+		    $ytitle     = I18N::translate('Individuals');
1145
+	    } elseif ($y_axis === 202) {
1146
+		    $percentage = true;
1147
+		    $ytitle     = I18N::translate('percentage');
1148
+	    }
1149
+	    $male_female = false;
1150
+	    if ($z_axis === 300) {
1151
+		    $zgiven          = false;
1152
+		    $legend[0]       = 'all';
1153
+		    $zmax            = 1;
1154
+		    $z_boundaries[0] = 100000;
1155
+	    } elseif ($z_axis === 301) {
1156
+		    $male_female = true;
1157
+		    $zgiven      = true;
1158
+		    $legend[0]   = I18N::translate('Male');
1159
+		    $legend[1]   = I18N::translate('Female');
1160
+		    $zmax        = 2;
1161
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1162
+	    } elseif ($z_axis === 302) {
1163
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1164
+	    }
1165
+	    //-- reset the data array
1166
+	    for ($i = 0; $i < $zmax; $i++) {
1167
+		    for ($j = 0; $j < $xmax; $j++) {
1168
+			    $ydata[$i][$j] = 0;
1169
+		    }
1170
+	    }
1171
+	    $total = lifespan_by_birth_year($z_axis, $z_boundaries, $stats);
1172
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1173
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1174
+	    break;
1175
+    case '18':
1176
+	    $monthdata = array();
1177
+	    for ($i = 0; $i < 12; ++$i) {
1178
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1179
+	    }
1180
+	    $xgiven            = false;
1181
+	    $zgiven            = false;
1182
+	    $title             = I18N::translate('Age related to death year');
1183
+	    $xtitle            = I18N::translate('age');
1184
+	    $ytitle            = I18N::translate('numbers');
1185
+	    $boundaries_x_axis = Filter::get('x-axis-boundaries-ages');
1186
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1187
+	    calculate_axis($boundaries_x_axis);
1188
+	    if ($z_axis !== 300 && $z_axis !== 301) {
1189
+		    calculate_legend($boundaries_z_axis);
1190
+	    }
1191
+	    $percentage = false;
1192
+	    if ($y_axis === 201) {
1193
+		    $percentage = false;
1194
+		    $ytitle     = I18N::translate('Individuals');
1195
+	    } elseif ($y_axis === 202) {
1196
+		    $percentage = true;
1197
+		    $ytitle     = I18N::translate('percentage');
1198
+	    }
1199
+	    $male_female = false;
1200
+	    if ($z_axis === 300) {
1201
+		    $zgiven          = false;
1202
+		    $legend[0]       = 'all';
1203
+		    $zmax            = 1;
1204
+		    $z_boundaries[0] = 100000;
1205
+	    } elseif ($z_axis === 301) {
1206
+		    $male_female = true;
1207
+		    $zgiven      = true;
1208
+		    $legend[0]   = I18N::translate('Male');
1209
+		    $legend[1]   = I18N::translate('Female');
1210
+		    $zmax        = 2;
1211
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1212
+	    } elseif ($z_axis === 302) {
1213
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1214
+	    }
1215
+	    //-- reset the data array
1216
+	    for ($i = 0; $i < $zmax; $i++) {
1217
+		    for ($j = 0; $j < $xmax; $j++) {
1218
+			    $ydata[$i][$j] = 0;
1219
+		    }
1220
+	    }
1221
+	    $total = lifespan_by_death_year($z_axis, $z_boundaries, $stats);
1222
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1223
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1224
+	    break;
1225
+    case '19':
1226
+	    $monthdata = array();
1227
+	    for ($i = 0; $i < 12; ++$i) {
1228
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1229
+	    }
1230
+	    $xgiven            = false;
1231
+	    $zgiven            = false;
1232
+	    $title             = I18N::translate('Age in year of marriage');
1233
+	    $xtitle            = I18N::translate('age');
1234
+	    $ytitle            = I18N::translate('numbers');
1235
+	    $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1236
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1237
+	    calculate_axis($boundaries_x_axis);
1238
+	    if ($z_axis !== 300 && $z_axis !== 301) {
1239
+		    calculate_legend($boundaries_z_axis);
1240
+	    }
1241
+	    $percentage = false;
1242
+	    if ($y_axis === 201) {
1243
+		    $percentage = false;
1244
+		    $ytitle     = I18N::translate('Individuals');
1245
+	    } elseif ($y_axis === 202) {
1246
+		    $percentage = true;
1247
+		    $ytitle     = I18N::translate('percentage');
1248
+	    }
1249
+	    $male_female     = false;
1250
+	    $z_boundaries[0] = 100000;
1251
+	    if ($z_axis === 300) {
1252
+		    $zgiven          = false;
1253
+		    $legend[0]       = 'all';
1254
+		    $zmax            = 1;
1255
+	    } elseif ($z_axis === 301) {
1256
+		    $male_female = true;
1257
+		    $zgiven      = true;
1258
+		    $legend[0]   = I18N::translate('Male');
1259
+		    $legend[1]   = I18N::translate('Female');
1260
+		    $zmax        = 2;
1261
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1262
+	    } elseif ($z_axis === 302) {
1263
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1264
+	    }
1265
+	    //-- reset the data array
1266
+	    for ($i = 0; $i < $zmax; $i++) {
1267
+		    for ($j = 0; $j < $xmax; $j++) {
1268
+			    $ydata[$i][$j] = 0;
1269
+		    }
1270
+	    }
1271
+	    $total = age_at_marriage($z_axis, $z_boundaries, $stats);
1272
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1273
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1274
+	    break;
1275
+    case '20':
1276
+	    $monthdata = array();
1277
+	    for ($i = 0; $i < 12; ++$i) {
1278
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1279
+	    }
1280
+	    $xgiven            = false;
1281
+	    $zgiven            = false;
1282
+	    $title             = I18N::translate('Age in year of first marriage');
1283
+	    $xtitle            = I18N::translate('age');
1284
+	    $ytitle            = I18N::translate('numbers');
1285
+	    $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1286
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1287
+	    calculate_axis($boundaries_x_axis);
1288
+	    if ($z_axis !== 300 && $z_axis !== 301) {
1289
+		    calculate_legend($boundaries_z_axis);
1290
+	    }
1291
+	    $percentage = false;
1292
+	    if ($y_axis === 201) {
1293
+		    $percentage = false;
1294
+		    $ytitle     = I18N::translate('Individuals');
1295
+	    } elseif ($y_axis === 202) {
1296
+		    $percentage = true;
1297
+		    $ytitle     = I18N::translate('percentage');
1298
+	    }
1299
+	    $male_female = false;
1300
+	    if ($z_axis === 300) {
1301
+		    $zgiven          = false;
1302
+		    $legend[0]       = 'all';
1303
+		    $zmax            = 1;
1304
+		    $z_boundaries[0] = 100000;
1305
+	    } elseif ($z_axis === 301) {
1306
+		    $male_female = true;
1307
+		    $zgiven      = true;
1308
+		    $legend[0]   = I18N::translate('Male');
1309
+		    $legend[1]   = I18N::translate('Female');
1310
+		    $zmax        = 2;
1311
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1312
+	    } elseif ($z_axis === 302) {
1313
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1314
+	    }
1315
+	    //-- reset the data array
1316
+	    for ($i = 0; $i < $zmax; $i++) {
1317
+		    for ($j = 0; $j < $xmax; $j++) {
1318
+			    $ydata[$i][$j] = 0;
1319
+		    }
1320
+	    }
1321
+	    $total = age_at_first_marriage($z_axis, $z_boundaries, $stats);
1322
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1323
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1324
+	    break;
1325
+    case '21':
1326
+	    $monthdata = array();
1327
+	    for ($i = 0; $i < 12; ++$i) {
1328
+		    $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1329
+	    }
1330
+	    $xgiven            = false;
1331
+	    $zgiven            = false;
1332
+	    $title             = I18N::translate('Number of children');
1333
+	    $xtitle            = I18N::translate('children');
1334
+	    $ytitle            = I18N::translate('numbers');
1335
+	    $boundaries_x_axis = Filter::get('x-axis-boundaries-numbers');
1336
+	    $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1337
+	    calculate_axis($boundaries_x_axis);
1338
+	    if ($z_axis !== 300 && $z_axis !== 301) {
1339
+		    calculate_legend($boundaries_z_axis);
1340
+	    }
1341
+	    $percentage = false;
1342
+	    if ($y_axis === 201) {
1343
+		    $percentage = false;
1344
+		    $ytitle     = I18N::translate('Families');
1345
+	    } elseif ($y_axis === 202) {
1346
+		    $percentage = true;
1347
+		    $ytitle     = I18N::translate('percentage');
1348
+	    }
1349
+	    $male_female = false;
1350
+	    if ($z_axis === 300) {
1351
+		    $zgiven          = false;
1352
+		    $legend[0]       = 'all';
1353
+		    $zmax            = 1;
1354
+		    $z_boundaries[0] = 100000;
1355
+	    } elseif ($z_axis === 301) {
1356
+		    $male_female = true;
1357
+		    $zgiven      = true;
1358
+		    $legend[0]   = I18N::translate('Male');
1359
+		    $legend[1]   = I18N::translate('Female');
1360
+		    $zmax        = 2;
1361
+		    $xtitle      = $xtitle . I18N::translate(' per gender');
1362
+	    } elseif ($z_axis === 302) {
1363
+		    $xtitle = $xtitle . I18N::translate(' per time period');
1364
+	    }
1365
+	    //-- reset the data array
1366
+	    for ($i = 0; $i < $zmax; $i++) {
1367
+		    for ($j = 0; $j < $xmax; $j++) {
1368
+			    $ydata[$i][$j] = 0;
1369
+		    }
1370
+	    }
1371
+	    $total = number_of_children($z_axis, $z_boundaries, $stats);
1372
+	    $hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren();
1373
+	    my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1374
+	    break;
1375
+    default:
1376
+	    echo '<i class="icon-loading-large"></i>';
1377
+	    break;
1378 1378
 }
1379 1379
 echo '</div>';
Please login to merge, or discard this patch.
Braces   +30 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @return int
38 38
  */
39
-function month_of_birth($z_axis, array $z_boundaries, Stats $stats) {
39
+function month_of_birth($z_axis, array $z_boundaries, Stats $stats)
40
+{
40 41
 	$total = 0;
41 42
 
42 43
 	if ($z_axis === 300) {
@@ -92,7 +93,8 @@  discard block
 block discarded – undo
92 93
  *
93 94
  * @return int
94 95
  */
95
-function month_of_birth_of_first_child($z_axis, array $z_boundaries, Stats $stats) {
96
+function month_of_birth_of_first_child($z_axis, array $z_boundaries, Stats $stats)
97
+{
96 98
 	$total = 0;
97 99
 
98 100
 	if ($z_axis === 300) {
@@ -148,7 +150,8 @@  discard block
 block discarded – undo
148 150
  *
149 151
  * @return int
150 152
  */
151
-function month_of_death($z_axis, array $z_boundaries, Stats $stats) {
153
+function month_of_death($z_axis, array $z_boundaries, Stats $stats)
154
+{
152 155
 	$total = 0;
153 156
 
154 157
 	if ($z_axis === 300) {
@@ -204,7 +207,8 @@  discard block
 block discarded – undo
204 207
  *
205 208
  * @return int
206 209
  */
207
-function month_of_marriage($z_axis, array $z_boundaries, Stats $stats) {
210
+function month_of_marriage($z_axis, array $z_boundaries, Stats $stats)
211
+{
208 212
 	$total = 0;
209 213
 
210 214
 	if ($z_axis === 300) {
@@ -245,7 +249,8 @@  discard block
 block discarded – undo
245 249
  *
246 250
  * @return int
247 251
  */
248
-function month_of_first_marriage($z_axis, array $z_boundaries, Stats $stats) {
252
+function month_of_first_marriage($z_axis, array $z_boundaries, Stats $stats)
253
+{
249 254
 	$total = 0;
250 255
 
251 256
 	if ($z_axis === 300) {
@@ -298,7 +303,8 @@  discard block
 block discarded – undo
298 303
  *
299 304
  * @return int
300 305
  */
301
-function lifespan_by_birth_year($z_axis, array $z_boundaries, Stats $stats) {
306
+function lifespan_by_birth_year($z_axis, array $z_boundaries, Stats $stats)
307
+{
302 308
 	$total = 0;
303 309
 
304 310
 	if ($z_axis === 300) {
@@ -350,7 +356,8 @@  discard block
 block discarded – undo
350 356
  *
351 357
  * @return int
352 358
  */
353
-function lifespan_by_death_year($z_axis, array $z_boundaries, Stats $stats) {
359
+function lifespan_by_death_year($z_axis, array $z_boundaries, Stats $stats)
360
+{
354 361
 	$total = 0;
355 362
 
356 363
 	if ($z_axis === 300) {
@@ -402,7 +409,8 @@  discard block
 block discarded – undo
402 409
  *
403 410
  * @return int
404 411
  */
405
-function age_at_marriage($z_axis, array $z_boundaries, Stats $stats) {
412
+function age_at_marriage($z_axis, array $z_boundaries, Stats $stats)
413
+{
406 414
 	$total = 0;
407 415
 
408 416
 	if ($z_axis === 300) {
@@ -456,7 +464,8 @@  discard block
 block discarded – undo
456 464
  *
457 465
  * @return int
458 466
  */
459
-function age_at_first_marriage($z_axis, array $z_boundaries, Stats $stats) {
467
+function age_at_first_marriage($z_axis, array $z_boundaries, Stats $stats)
468
+{
460 469
 	$total = 0;
461 470
 
462 471
 	if ($z_axis === 300) {
@@ -533,7 +542,8 @@  discard block
 block discarded – undo
533 542
  *
534 543
  * @return int
535 544
  */
536
-function number_of_children($z_axis, array $z_boundaries, Stats $stats) {
545
+function number_of_children($z_axis, array $z_boundaries, Stats $stats)
546
+{
537 547
 	$total = 0;
538 548
 
539 549
 	if ($z_axis === 300) {
@@ -575,7 +585,8 @@  discard block
 block discarded – undo
575 585
  * @param int $x
576 586
  * @param int $val
577 587
  */
578
-function fill_y_data($z, $x, $val) {
588
+function fill_y_data($z, $x, $val)
589
+{
579 590
 	global $ydata, $xmax, $x_boundaries, $zmax, $z_boundaries, $xgiven, $zgiven;
580 591
 	//-- calculate index $i out of given z value
581 592
 	//-- calculate index $j out of given x value
@@ -612,7 +623,8 @@  discard block
 block discarded – undo
612 623
  * @param string      $ytitle
613 624
  * @param string[]    $legend
614 625
  */
615
-function my_plot($mytitle, $xdata, $xtitle, $ydata, $ytitle, $legend) {
626
+function my_plot($mytitle, $xdata, $xtitle, $ydata, $ytitle, $legend)
627
+{
616 628
 	global $percentage, $male_female, $ymax, $scalefactor, $datastring, $imgurl;
617 629
 
618 630
 	// Google Chart API only allows text encoding for numbers less than 100
@@ -752,7 +764,8 @@  discard block
 block discarded – undo
752 764
  *
753 765
  * @param string $x_axis_boundaries
754 766
  */
755
-function calculate_axis($x_axis_boundaries) {
767
+function calculate_axis($x_axis_boundaries)
768
+{
756 769
 	global $x_axis, $xdata, $xmax, $x_boundaries;
757 770
 
758 771
 	// Calculate xdata and zdata elements out of chart values
@@ -801,7 +814,8 @@  discard block
 block discarded – undo
801 814
  *
802 815
  * @return string
803 816
  */
804
-function format_range_of_numbers($x, $y) {
817
+function format_range_of_numbers($x, $y)
818
+{
805 819
 	return /* I18N: A range of numbers */ I18N::translate(
806 820
 		'%1$s–%2$s',
807 821
 		I18N::number($x),
@@ -814,7 +828,8 @@  discard block
 block discarded – undo
814 828
  *
815 829
  * @param string $boundaries_z_axis
816 830
  */
817
-function calculate_legend($boundaries_z_axis) {
831
+function calculate_legend($boundaries_z_axis)
832
+{
818 833
 	global $legend, $zmax, $z_boundaries;
819 834
 
820 835
 	// calculate the legend values
Please login to merge, or discard this patch.
admin_trees_check.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -223,7 +223,8 @@  discard block
 block discarded – undo
223 223
  *
224 224
  * @return string
225 225
  */
226
-function link_message($type1, $xref1, $type2, $xref2) {
226
+function link_message($type1, $xref1, $type2, $xref2)
227
+{
227 228
 	return /* I18N: The placeholders are GEDCOM XREFs and tags. e.g. “INDI I123 contains a FAMC link to F234.” */ I18N::translate(
228 229
 		'%1$s %2$s has a %3$s link to %4$s.',
229 230
 		format_type($type1),
@@ -240,7 +241,8 @@  discard block
 block discarded – undo
240 241
  *
241 242
  * @return string
242 243
  */
243
-function format_link($xref) {
244
+function format_link($xref)
245
+{
244 246
 	return '<b><a href="gedrecord.php?pid=' . $xref . '">' . $xref . '</a></b>';
245 247
 }
246 248
 
@@ -251,7 +253,8 @@  discard block
 block discarded – undo
251 253
  *
252 254
  * @return string
253 255
  */
254
-function format_type($type) {
256
+function format_type($type)
257
+{
255 258
 	return '<b title="' . strip_tags(GedcomTag::getLabel($type)) . '">' . $type . '</b>';
256 259
 }
257 260
 
@@ -262,7 +265,8 @@  discard block
 block discarded – undo
262 265
  *
263 266
  * @return string
264 267
  */
265
-function error($message) {
268
+function error($message)
269
+{
266 270
 	global $errors;
267 271
 	$errors = true;
268 272
 
@@ -276,7 +280,8 @@  discard block
 block discarded – undo
276 280
  *
277 281
  * @return string
278 282
  */
279
-function warning($message) {
283
+function warning($message)
284
+{
280 285
 	global $errors;
281 286
 	$errors = true;
282 287
 
Please login to merge, or discard this patch.