@@ -86,143 +86,143 @@ |
||
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 = ?" |
@@ -44,44 +44,44 @@ |
||
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 | } |
@@ -200,29 +200,29 @@ discard block |
||
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 |
||
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. |
@@ -47,60 +47,60 @@ |
||
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 |
@@ -66,14 +66,14 @@ |
||
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)) { |
@@ -852,528 +852,528 @@ |
||
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>'; |
@@ -50,116 +50,116 @@ discard block |
||
50 | 50 | } |
51 | 51 | // Process POST actions |
52 | 52 | switch (Filter::post('action')) { |
53 | -case 'delete': |
|
54 | - $gedcom_id = Filter::postInteger('gedcom_id'); |
|
55 | - if (Filter::checkCsrf() && $gedcom_id) { |
|
56 | - $tree = Tree::findById($gedcom_id); |
|
57 | - FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success'); |
|
58 | - $tree->delete(); |
|
59 | - } |
|
60 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
61 | - |
|
62 | - return; |
|
63 | -case 'setdefault': |
|
64 | - if (Filter::checkCsrf()) { |
|
65 | - Site::setPreference('DEFAULT_GEDCOM', Filter::post('ged')); |
|
66 | - FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” will be shown to visitors when they first arrive at this website.', $WT_TREE->getTitleHtml()), 'success'); |
|
67 | - } |
|
68 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
69 | - |
|
70 | - return; |
|
71 | -case 'new_tree': |
|
72 | - $basename = basename(Filter::post('tree_name')); |
|
73 | - $tree_title = Filter::post('tree_title'); |
|
74 | - |
|
75 | - if (Filter::checkCsrf() && $basename && $tree_title) { |
|
76 | - if (Tree::findByName($basename)) { |
|
77 | - FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” already exists.', Filter::escapeHtml($basename)), 'danger'); |
|
78 | - } else { |
|
79 | - Tree::create($basename, $tree_title); |
|
80 | - FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been created.', Filter::escapeHtml($basename)), 'success'); |
|
81 | - } |
|
82 | - } |
|
83 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?ged=' . Filter::escapeUrl($basename)); |
|
84 | - |
|
85 | - return; |
|
86 | -case 'replace_upload': |
|
87 | - $gedcom_id = Filter::postInteger('gedcom_id'); |
|
88 | - $keep_media = Filter::post('keep_media', '1', '0'); |
|
89 | - $GEDCOM_MEDIA_PATH = Filter::post('GEDCOM_MEDIA_PATH'); |
|
90 | - $WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0'); |
|
91 | - $tree = Tree::findById($gedcom_id); |
|
92 | - |
|
93 | - if (Filter::checkCsrf() && $tree) { |
|
94 | - $tree->setPreference('keep_media', $keep_media); |
|
95 | - $tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH); |
|
96 | - $tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES); |
|
97 | - if (isset($_FILES['tree_name'])) { |
|
98 | - if ($_FILES['tree_name']['error'] == 0 && is_readable($_FILES['tree_name']['tmp_name'])) { |
|
99 | - $tree->importGedcomFile($_FILES['tree_name']['tmp_name'], $_FILES['tree_name']['name']); |
|
100 | - } else { |
|
101 | - FlashMessages::addMessage(Functions::fileUploadErrorText($_FILES['tree_name']['error']), 'danger'); |
|
102 | - } |
|
103 | - } else { |
|
104 | - FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger'); |
|
105 | - } |
|
106 | - } |
|
107 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
108 | - |
|
109 | - return; |
|
110 | -case 'replace_import': |
|
111 | - $basename = basename(Filter::post('tree_name')); |
|
112 | - $gedcom_id = Filter::postInteger('gedcom_id'); |
|
113 | - $keep_media = Filter::post('keep_media', '1', '0'); |
|
114 | - $GEDCOM_MEDIA_PATH = Filter::post('GEDCOM_MEDIA_PATH'); |
|
115 | - $WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0'); |
|
116 | - $tree = Tree::findById($gedcom_id); |
|
117 | - |
|
118 | - if (Filter::checkCsrf() && $tree) { |
|
119 | - $tree->setPreference('keep_media', $keep_media); |
|
120 | - $tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH); |
|
121 | - $tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES); |
|
122 | - if ($basename) { |
|
123 | - $tree->importGedcomFile(WT_DATA_DIR . $basename, $basename); |
|
124 | - } else { |
|
125 | - FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger'); |
|
126 | - } |
|
127 | - } |
|
128 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
129 | - |
|
130 | - return; |
|
131 | - |
|
132 | -case 'synchronize': |
|
133 | - if (Filter::checkCsrf()) { |
|
134 | - $basenames = array(); |
|
135 | - |
|
136 | - foreach ($gedcom_files as $gedcom_file) { |
|
137 | - $filemtime = filemtime($gedcom_file); // Only import files that have changed |
|
138 | - $basename = basename($gedcom_file); |
|
139 | - $basenames[] = $basename; |
|
140 | - |
|
141 | - $tree = Tree::findByName($basename); |
|
142 | - if (!$tree) { |
|
143 | - $tree = Tree::create($basename, $basename); |
|
144 | - } |
|
145 | - if ($tree->getPreference('filemtime') != $filemtime) { |
|
146 | - $tree->importGedcomFile($gedcom_file, $basename); |
|
147 | - $tree->setPreference('filemtime', $filemtime); |
|
148 | - FlashMessages::addMessage(I18N::translate('The GEDCOM file “%s” has been imported.', Filter::escapeHtml($basename)), 'success'); |
|
149 | - } |
|
150 | - } |
|
151 | - |
|
152 | - foreach (Tree::getAll() as $tree) { |
|
153 | - if (!in_array($tree->getName(), $basenames)) { |
|
154 | - FlashMessages::addMessage(I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success'); |
|
155 | - $tree->delete(); |
|
156 | - } |
|
157 | - } |
|
158 | - |
|
159 | - } |
|
160 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
161 | - |
|
162 | - return; |
|
53 | + case 'delete': |
|
54 | + $gedcom_id = Filter::postInteger('gedcom_id'); |
|
55 | + if (Filter::checkCsrf() && $gedcom_id) { |
|
56 | + $tree = Tree::findById($gedcom_id); |
|
57 | + FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success'); |
|
58 | + $tree->delete(); |
|
59 | + } |
|
60 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
61 | + |
|
62 | + return; |
|
63 | + case 'setdefault': |
|
64 | + if (Filter::checkCsrf()) { |
|
65 | + Site::setPreference('DEFAULT_GEDCOM', Filter::post('ged')); |
|
66 | + FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” will be shown to visitors when they first arrive at this website.', $WT_TREE->getTitleHtml()), 'success'); |
|
67 | + } |
|
68 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
69 | + |
|
70 | + return; |
|
71 | + case 'new_tree': |
|
72 | + $basename = basename(Filter::post('tree_name')); |
|
73 | + $tree_title = Filter::post('tree_title'); |
|
74 | + |
|
75 | + if (Filter::checkCsrf() && $basename && $tree_title) { |
|
76 | + if (Tree::findByName($basename)) { |
|
77 | + FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” already exists.', Filter::escapeHtml($basename)), 'danger'); |
|
78 | + } else { |
|
79 | + Tree::create($basename, $tree_title); |
|
80 | + FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been created.', Filter::escapeHtml($basename)), 'success'); |
|
81 | + } |
|
82 | + } |
|
83 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?ged=' . Filter::escapeUrl($basename)); |
|
84 | + |
|
85 | + return; |
|
86 | + case 'replace_upload': |
|
87 | + $gedcom_id = Filter::postInteger('gedcom_id'); |
|
88 | + $keep_media = Filter::post('keep_media', '1', '0'); |
|
89 | + $GEDCOM_MEDIA_PATH = Filter::post('GEDCOM_MEDIA_PATH'); |
|
90 | + $WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0'); |
|
91 | + $tree = Tree::findById($gedcom_id); |
|
92 | + |
|
93 | + if (Filter::checkCsrf() && $tree) { |
|
94 | + $tree->setPreference('keep_media', $keep_media); |
|
95 | + $tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH); |
|
96 | + $tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES); |
|
97 | + if (isset($_FILES['tree_name'])) { |
|
98 | + if ($_FILES['tree_name']['error'] == 0 && is_readable($_FILES['tree_name']['tmp_name'])) { |
|
99 | + $tree->importGedcomFile($_FILES['tree_name']['tmp_name'], $_FILES['tree_name']['name']); |
|
100 | + } else { |
|
101 | + FlashMessages::addMessage(Functions::fileUploadErrorText($_FILES['tree_name']['error']), 'danger'); |
|
102 | + } |
|
103 | + } else { |
|
104 | + FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger'); |
|
105 | + } |
|
106 | + } |
|
107 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
108 | + |
|
109 | + return; |
|
110 | + case 'replace_import': |
|
111 | + $basename = basename(Filter::post('tree_name')); |
|
112 | + $gedcom_id = Filter::postInteger('gedcom_id'); |
|
113 | + $keep_media = Filter::post('keep_media', '1', '0'); |
|
114 | + $GEDCOM_MEDIA_PATH = Filter::post('GEDCOM_MEDIA_PATH'); |
|
115 | + $WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0'); |
|
116 | + $tree = Tree::findById($gedcom_id); |
|
117 | + |
|
118 | + if (Filter::checkCsrf() && $tree) { |
|
119 | + $tree->setPreference('keep_media', $keep_media); |
|
120 | + $tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH); |
|
121 | + $tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES); |
|
122 | + if ($basename) { |
|
123 | + $tree->importGedcomFile(WT_DATA_DIR . $basename, $basename); |
|
124 | + } else { |
|
125 | + FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger'); |
|
126 | + } |
|
127 | + } |
|
128 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
129 | + |
|
130 | + return; |
|
131 | + |
|
132 | + case 'synchronize': |
|
133 | + if (Filter::checkCsrf()) { |
|
134 | + $basenames = array(); |
|
135 | + |
|
136 | + foreach ($gedcom_files as $gedcom_file) { |
|
137 | + $filemtime = filemtime($gedcom_file); // Only import files that have changed |
|
138 | + $basename = basename($gedcom_file); |
|
139 | + $basenames[] = $basename; |
|
140 | + |
|
141 | + $tree = Tree::findByName($basename); |
|
142 | + if (!$tree) { |
|
143 | + $tree = Tree::create($basename, $basename); |
|
144 | + } |
|
145 | + if ($tree->getPreference('filemtime') != $filemtime) { |
|
146 | + $tree->importGedcomFile($gedcom_file, $basename); |
|
147 | + $tree->setPreference('filemtime', $filemtime); |
|
148 | + FlashMessages::addMessage(I18N::translate('The GEDCOM file “%s” has been imported.', Filter::escapeHtml($basename)), 'success'); |
|
149 | + } |
|
150 | + } |
|
151 | + |
|
152 | + foreach (Tree::getAll() as $tree) { |
|
153 | + if (!in_array($tree->getName(), $basenames)) { |
|
154 | + FlashMessages::addMessage(I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success'); |
|
155 | + $tree->delete(); |
|
156 | + } |
|
157 | + } |
|
158 | + |
|
159 | + } |
|
160 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
161 | + |
|
162 | + return; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | $default_tree_title = /* I18N: Default name for a new tree */ I18N::translate('My family tree'); |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | |
174 | 174 | // Process GET actions |
175 | 175 | switch (Filter::get('action')) { |
176 | -case 'importform': |
|
177 | - $controller |
|
178 | - ->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Import a GEDCOM file')) |
|
179 | - ->pageHeader(); |
|
176 | + case 'importform': |
|
177 | + $controller |
|
178 | + ->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Import a GEDCOM file')) |
|
179 | + ->pageHeader(); |
|
180 | 180 | |
181 | - ?> |
|
181 | + ?> |
|
182 | 182 | <ol class="breadcrumb small"> |
183 | 183 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
184 | 184 | <li><a href="admin_trees_manage.php"><?php echo I18N::translate('Manage family trees'); ?></a></li> |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | <h1><?php echo $controller->getPageTitle(); ?></h1> |
189 | 189 | <?php |
190 | 190 | |
191 | - $tree = Tree::findById(Filter::getInteger('gedcom_id')); |
|
192 | - // Check it exists |
|
193 | - if (!$tree) { |
|
194 | - break; |
|
195 | - } |
|
196 | - $gedcom_filename = $tree->getPreference('gedcom_filename') |
|
197 | - ?> |
|
198 | - <p> |
|
191 | + $tree = Tree::findById(Filter::getInteger('gedcom_id')); |
|
192 | + // Check it exists |
|
193 | + if (!$tree) { |
|
194 | + break; |
|
195 | + } |
|
196 | + $gedcom_filename = $tree->getPreference('gedcom_filename') |
|
197 | + ?> |
|
198 | + <p> |
|
199 | 199 | <?php echo /* I18N: %s is the name of a family tree */ I18N::translate('This will delete all the genealogy data from “%s” and replace it with data from a GEDCOM file.', $tree->getTitleHtml()); ?> |
200 | 200 | </p> |
201 | 201 | <form class="form form-horizontal" name="gedcomimportform" method="post" enctype="multipart/form-data" onsubmit="return checkGedcomImportForm('<?php echo Filter::escapeHtml(I18N::translate('You have selected a GEDCOM file with a different name. Is this correct?')); ?>');"> |
@@ -228,35 +228,35 @@ discard block |
||
228 | 228 | <div class="input-group"> |
229 | 229 | <span class="input-group-addon"> |
230 | 230 | <?php echo WT_DATA_DIR; ?> |
231 | - </span> |
|
231 | + </span> |
|
232 | 232 | <?php |
233 | - $d = opendir(WT_DATA_DIR); |
|
234 | - $files = array(); |
|
235 | - while (($f = readdir($d)) !== false) { |
|
236 | - if (!is_dir(WT_DATA_DIR . $f) && is_readable(WT_DATA_DIR . $f)) { |
|
237 | - $fp = fopen(WT_DATA_DIR . $f, 'rb'); |
|
238 | - $header = fread($fp, 64); |
|
239 | - fclose($fp); |
|
240 | - if (preg_match('/^(' . WT_UTF8_BOM . ')?0 *HEAD/', $header)) { |
|
241 | - $files[] = $f; |
|
242 | - } |
|
243 | - } |
|
244 | - } |
|
245 | - echo '<select name="tree_name" class="form-control" id="import-server-file">'; |
|
246 | - echo '<option value=""></option>'; |
|
247 | - sort($files); |
|
248 | - foreach ($files as $gedcom_file) { |
|
249 | - echo '<option value="', Filter::escapeHtml($gedcom_file), '" '; |
|
250 | - if ($gedcom_file === $gedcom_filename) { |
|
251 | - echo ' selected'; |
|
252 | - } |
|
253 | - echo'>', Filter::escapeHtml($gedcom_file), '</option>'; |
|
254 | - } |
|
255 | - if (!$files) { |
|
256 | - echo '<option disabled selected>', I18N::translate('No GEDCOM files found.'), '</option>'; |
|
257 | - } |
|
258 | - echo '</select>'; |
|
259 | - ?> |
|
233 | + $d = opendir(WT_DATA_DIR); |
|
234 | + $files = array(); |
|
235 | + while (($f = readdir($d)) !== false) { |
|
236 | + if (!is_dir(WT_DATA_DIR . $f) && is_readable(WT_DATA_DIR . $f)) { |
|
237 | + $fp = fopen(WT_DATA_DIR . $f, 'rb'); |
|
238 | + $header = fread($fp, 64); |
|
239 | + fclose($fp); |
|
240 | + if (preg_match('/^(' . WT_UTF8_BOM . ')?0 *HEAD/', $header)) { |
|
241 | + $files[] = $f; |
|
242 | + } |
|
243 | + } |
|
244 | + } |
|
245 | + echo '<select name="tree_name" class="form-control" id="import-server-file">'; |
|
246 | + echo '<option value=""></option>'; |
|
247 | + sort($files); |
|
248 | + foreach ($files as $gedcom_file) { |
|
249 | + echo '<option value="', Filter::escapeHtml($gedcom_file), '" '; |
|
250 | + if ($gedcom_file === $gedcom_filename) { |
|
251 | + echo ' selected'; |
|
252 | + } |
|
253 | + echo'>', Filter::escapeHtml($gedcom_file), '</option>'; |
|
254 | + } |
|
255 | + if (!$files) { |
|
256 | + echo '<option disabled selected>', I18N::translate('No GEDCOM files found.'), '</option>'; |
|
257 | + } |
|
258 | + echo '</select>'; |
|
259 | + ?> |
|
260 | 260 | </div> |
261 | 261 | </div> |
262 | 262 | </div> |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | > |
299 | 299 | <p class="small text-muted"> |
300 | 300 | <?php echo /* I18N: Help text for the “GEDCOM media path” configuration setting. A “path” is something like “C:\Documents\Genealogy\Photos\John_Smith.jpeg” */ I18N::translate('Some genealogy software creates GEDCOM files that contain media filenames with full paths. These paths will not exist on the web-server. To allow webtrees to find the file, the first part of the path must be removed.'); ?> |
301 | - <?php echo /* I18N: Help text for the “GEDCOM media path” configuration setting. %s are all folder names */ I18N::translate('For example, if the GEDCOM file contains %1$s and webtrees expects to find %2$s in the media folder, then you would need to remove %3$s.', '<code>C:\\Documents\\family\\photo.jpeg</code>', '<code>family\\photo.jpeg</code>', '<code>C:\\Documents\\</code>'); ?> |
|
301 | + <?php echo /* I18N: Help text for the “GEDCOM media path” configuration setting. %s are all folder names */ I18N::translate('For example, if the GEDCOM file contains %1$s and webtrees expects to find %2$s in the media folder, then you would need to remove %3$s.', '<code>C:\\Documents\\family\\photo.jpeg</code>', '<code>family\\photo.jpeg</code>', '<code>C:\\Documents\\</code>'); ?> |
|
302 | 302 | </p> |
303 | 303 | </div> |
304 | 304 | </fieldset> |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | </form> |
314 | 314 | <?php |
315 | 315 | |
316 | - return; |
|
316 | + return; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | if (!Tree::getAll()) { |
@@ -65,20 +65,20 @@ |
||
65 | 65 | // Ensure the user always visits this page twice - once to compose it and again to send it. |
66 | 66 | // This makes it harder for spammers. |
67 | 67 | switch ($action) { |
68 | -case 'compose': |
|
69 | - Session::put('good_to_send', true); |
|
70 | - break; |
|
71 | -case 'send': |
|
72 | - // Only send messages if we've come straight from the compose page. |
|
73 | - if (!Session::get('good_to_send')) { |
|
74 | - Log::addAuthenticationLog('Attempt to send a message without visiting the compose page. Spam attack?'); |
|
75 | - $action = 'compose'; |
|
76 | - } |
|
77 | - if (!Filter::checkCsrf()) { |
|
78 | - $action = 'compose'; |
|
79 | - } |
|
80 | - Session::forget('good_to_send'); |
|
81 | - break; |
|
68 | + case 'compose': |
|
69 | + Session::put('good_to_send', true); |
|
70 | + break; |
|
71 | + case 'send': |
|
72 | + // Only send messages if we've come straight from the compose page. |
|
73 | + if (!Session::get('good_to_send')) { |
|
74 | + Log::addAuthenticationLog('Attempt to send a message without visiting the compose page. Spam attack?'); |
|
75 | + $action = 'compose'; |
|
76 | + } |
|
77 | + if (!Filter::checkCsrf()) { |
|
78 | + $action = 'compose'; |
|
79 | + } |
|
80 | + Session::forget('good_to_send'); |
|
81 | + break; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | switch ($action) { |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | |
47 | 47 | $show_marnm = Filter::get('show_marnm', 'no|yes'); |
48 | 48 | switch ($show_marnm) { |
49 | -case 'no': |
|
50 | -case 'yes': |
|
51 | - Auth::user()->setPreference(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); |
|
52 | - break; |
|
53 | -default: |
|
54 | - $show_marnm = Auth::user()->getPreference(WT_SCRIPT_NAME . '_show_marnm'); |
|
49 | + case 'no': |
|
50 | + case 'yes': |
|
51 | + Auth::user()->setPreference(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); |
|
52 | + break; |
|
53 | + default: |
|
54 | + $show_marnm = Auth::user()->getPreference(WT_SCRIPT_NAME . '_show_marnm'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Make sure selections are consistent. |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | } |
92 | 92 | $url = WT_SCRIPT_NAME . '?surname=' . rawurlencode($surname) . '&ged=' . $WT_TREE->getNameUrl(); |
93 | 93 | switch ($falpha) { |
94 | - case '': |
|
95 | - break; |
|
96 | - case '@': |
|
97 | - $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
98 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
99 | - break; |
|
100 | - default: |
|
101 | - $legend .= ', ' . Filter::escapeHtml($falpha) . '…'; |
|
102 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
103 | - break; |
|
94 | + case '': |
|
95 | + break; |
|
96 | + case '@': |
|
97 | + $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
98 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
99 | + break; |
|
100 | + default: |
|
101 | + $legend .= ', ' . Filter::escapeHtml($falpha) . '…'; |
|
102 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
103 | + break; |
|
104 | 104 | } |
105 | 105 | $show = 'indi'; // SURN list makes no sense here |
106 | 106 | } elseif ($alpha === '@') { |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | $list = array(); |
137 | 137 | foreach (QueryName::surnameAlpha($WT_TREE, $show_marnm === 'yes', false) as $letter => $count) { |
138 | 138 | switch ($letter) { |
139 | - case '@': |
|
140 | - $html = I18N::translateContext('Unknown surname', '…'); |
|
141 | - break; |
|
142 | - case ',': |
|
143 | - $html = I18N::translate('None'); |
|
144 | - break; |
|
145 | - default: |
|
146 | - $html = Filter::escapeHtml($letter); |
|
147 | - break; |
|
139 | + case '@': |
|
140 | + $html = I18N::translateContext('Unknown surname', '…'); |
|
141 | + break; |
|
142 | + case ',': |
|
143 | + $html = I18N::translate('None'); |
|
144 | + break; |
|
145 | + default: |
|
146 | + $html = Filter::escapeHtml($letter); |
|
147 | + break; |
|
148 | 148 | } |
149 | 149 | if ($count) { |
150 | 150 | if ($letter == $alpha) { |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | if ($show === 'surn') { |
195 | 195 | // Show the surname list |
196 | 196 | switch ($WT_TREE->getPreference('SURNAME_LIST_STYLE')) { |
197 | - case 'style1': |
|
198 | - echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $WT_TREE); |
|
199 | - break; |
|
200 | - case 'style3': |
|
201 | - echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $WT_TREE); |
|
202 | - break; |
|
203 | - case 'style2': |
|
204 | - default: |
|
205 | - echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $WT_TREE); |
|
206 | - break; |
|
197 | + case 'style1': |
|
198 | + echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $WT_TREE); |
|
199 | + break; |
|
200 | + case 'style3': |
|
201 | + echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $WT_TREE); |
|
202 | + break; |
|
203 | + case 'style2': |
|
204 | + default: |
|
205 | + echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $WT_TREE); |
|
206 | + break; |
|
207 | 207 | } |
208 | 208 | } else { |
209 | 209 | // Show the list |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | $list = array(); |
227 | 227 | foreach ($givn_initials as $givn_initial => $count) { |
228 | 228 | switch ($givn_initial) { |
229 | - case '@': |
|
230 | - $html = I18N::translateContext('Unknown given name', '…'); |
|
231 | - break; |
|
232 | - default: |
|
233 | - $html = Filter::escapeHtml($givn_initial); |
|
234 | - break; |
|
229 | + case '@': |
|
230 | + $html = I18N::translateContext('Unknown given name', '…'); |
|
231 | + break; |
|
232 | + default: |
|
233 | + $html = Filter::escapeHtml($givn_initial); |
|
234 | + break; |
|
235 | 235 | } |
236 | 236 | if ($count) { |
237 | 237 | if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') { |