@@ -69,12 +69,12 @@ |
||
69 | 69 | global $ctype, $WT_TREE; |
70 | 70 | |
71 | 71 | switch (Filter::get('action')) { |
72 | - case 'deletenews': |
|
73 | - $news_id = Filter::getInteger('news_id'); |
|
74 | - if ($news_id) { |
|
75 | - Database::prepare("DELETE FROM `##news` WHERE news_id = ?")->execute(array($news_id)); |
|
76 | - } |
|
77 | - break; |
|
72 | + case 'deletenews': |
|
73 | + $news_id = Filter::getInteger('news_id'); |
|
74 | + if ($news_id) { |
|
75 | + Database::prepare("DELETE FROM `##news` WHERE news_id = ?")->execute(array($news_id)); |
|
76 | + } |
|
77 | + break; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $articles = Database::prepare( |
@@ -122,53 +122,53 @@ |
||
122 | 122 | global $controller, $WT_TREE; |
123 | 123 | |
124 | 124 | switch ($mod_action) { |
125 | - case 'treeview': |
|
126 | - $controller = new ChartController; |
|
127 | - $tv = new TreeView('tv'); |
|
128 | - ob_start(); |
|
129 | - |
|
130 | - $person = $controller->getSignificantIndividual(); |
|
131 | - |
|
132 | - list($html, $js) = $tv->drawViewport($person, 4); |
|
133 | - |
|
134 | - $controller |
|
135 | - ->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName())) |
|
136 | - ->pageHeader() |
|
137 | - ->addExternalJavascript($this->js()) |
|
138 | - ->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL) |
|
139 | - ->addInlineJavascript($js) |
|
140 | - ->addInlineJavascript(' |
|
125 | + case 'treeview': |
|
126 | + $controller = new ChartController; |
|
127 | + $tv = new TreeView('tv'); |
|
128 | + ob_start(); |
|
129 | + |
|
130 | + $person = $controller->getSignificantIndividual(); |
|
131 | + |
|
132 | + list($html, $js) = $tv->drawViewport($person, 4); |
|
133 | + |
|
134 | + $controller |
|
135 | + ->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName())) |
|
136 | + ->pageHeader() |
|
137 | + ->addExternalJavascript($this->js()) |
|
138 | + ->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL) |
|
139 | + ->addInlineJavascript($js) |
|
140 | + ->addInlineJavascript(' |
|
141 | 141 | if (document.createStyleSheet) { |
142 | 142 | document.createStyleSheet("' . $this->css() . '"); // For Internet Explorer |
143 | 143 | } else { |
144 | 144 | jQuery("head").append(\'<link rel="stylesheet" type="text/css" href="' . $this->css() . '">\'); |
145 | 145 | } |
146 | 146 | '); |
147 | - echo $html; |
|
148 | - break; |
|
149 | - |
|
150 | - case 'getDetails': |
|
151 | - header('Content-Type: text/html; charset=UTF-8'); |
|
152 | - $pid = Filter::get('pid', WT_REGEX_XREF); |
|
153 | - $i = Filter::get('instance'); |
|
154 | - $tv = new TreeView($i); |
|
155 | - $individual = Individual::getInstance($pid, $WT_TREE); |
|
156 | - if ($individual) { |
|
157 | - echo $tv->getDetails($individual); |
|
158 | - } |
|
159 | - break; |
|
160 | - |
|
161 | - case 'getPersons': |
|
162 | - header('Content-Type: text/html; charset=UTF-8'); |
|
163 | - $q = Filter::get('q'); |
|
164 | - $i = Filter::get('instance'); |
|
165 | - $tv = new TreeView($i); |
|
166 | - echo $tv->getPersons($q); |
|
167 | - break; |
|
168 | - |
|
169 | - default: |
|
170 | - http_response_code(404); |
|
171 | - break; |
|
147 | + echo $html; |
|
148 | + break; |
|
149 | + |
|
150 | + case 'getDetails': |
|
151 | + header('Content-Type: text/html; charset=UTF-8'); |
|
152 | + $pid = Filter::get('pid', WT_REGEX_XREF); |
|
153 | + $i = Filter::get('instance'); |
|
154 | + $tv = new TreeView($i); |
|
155 | + $individual = Individual::getInstance($pid, $WT_TREE); |
|
156 | + if ($individual) { |
|
157 | + echo $tv->getDetails($individual); |
|
158 | + } |
|
159 | + break; |
|
160 | + |
|
161 | + case 'getPersons': |
|
162 | + header('Content-Type: text/html; charset=UTF-8'); |
|
163 | + $q = Filter::get('q'); |
|
164 | + $i = Filter::get('instance'); |
|
165 | + $tv = new TreeView($i); |
|
166 | + echo $tv->getPersons($q); |
|
167 | + break; |
|
168 | + |
|
169 | + default: |
|
170 | + http_response_code(404); |
|
171 | + break; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | $content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days)); |
90 | 90 | } else { |
91 | 91 | switch ($infoStyle) { |
92 | - case 'list': |
|
93 | - $content .= $this->changesList($records, $sortStyle, $show_user); |
|
94 | - break; |
|
95 | - case 'table': |
|
96 | - $content .= $this->changesTable($records, $sortStyle, $show_user); |
|
97 | - break; |
|
92 | + case 'list': |
|
93 | + $content .= $this->changesList($records, $sortStyle, $show_user); |
|
94 | + break; |
|
95 | + case 'table': |
|
96 | + $content .= $this->changesTable($records, $sortStyle, $show_user); |
|
97 | + break; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | */ |
230 | 230 | private function changesList(array $records, $sort, $show_user) { |
231 | 231 | switch ($sort) { |
232 | - case 'name': |
|
233 | - uasort($records, array('self', 'sortByNameAndChangeDate')); |
|
234 | - break; |
|
235 | - case 'date_asc': |
|
236 | - uasort($records, array('self', 'sortByChangeDateAndName')); |
|
237 | - $records = array_reverse($records); |
|
238 | - break; |
|
239 | - case 'date_desc': |
|
240 | - uasort($records, array('self', 'sortByChangeDateAndName')); |
|
232 | + case 'name': |
|
233 | + uasort($records, array('self', 'sortByNameAndChangeDate')); |
|
234 | + break; |
|
235 | + case 'date_asc': |
|
236 | + uasort($records, array('self', 'sortByChangeDateAndName')); |
|
237 | + $records = array_reverse($records); |
|
238 | + break; |
|
239 | + case 'date_desc': |
|
240 | + uasort($records, array('self', 'sortByChangeDateAndName')); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $html = ''; |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | $table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page |
283 | 283 | |
284 | 284 | switch ($sort) { |
285 | - case 'name': |
|
286 | - default: |
|
287 | - $aaSorting = "[1,'asc'], [2,'desc']"; |
|
288 | - break; |
|
289 | - case 'date_asc': |
|
290 | - $aaSorting = "[2,'asc'], [1,'asc']"; |
|
291 | - break; |
|
292 | - case 'date_desc': |
|
293 | - $aaSorting = "[2,'desc'], [1,'asc']"; |
|
294 | - break; |
|
285 | + case 'name': |
|
286 | + default: |
|
287 | + $aaSorting = "[1,'asc'], [2,'desc']"; |
|
288 | + break; |
|
289 | + case 'date_asc': |
|
290 | + $aaSorting = "[2,'asc'], [1,'asc']"; |
|
291 | + break; |
|
292 | + case 'date_desc': |
|
293 | + $aaSorting = "[2,'desc'], [1,'asc']"; |
|
294 | + break; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | $html = ''; |
@@ -327,24 +327,24 @@ discard block |
||
327 | 327 | foreach ($records as $record) { |
328 | 328 | $html .= '<tr><td>'; |
329 | 329 | switch ($record::RECORD_TYPE) { |
330 | - case 'INDI': |
|
331 | - $html .= $record->getSexImage('small'); |
|
332 | - break; |
|
333 | - case 'FAM': |
|
334 | - $html .= '<i class="icon-button_family"></i>'; |
|
335 | - break; |
|
336 | - case 'OBJE': |
|
337 | - $html .= '<i class="icon-button_media"></i>'; |
|
338 | - break; |
|
339 | - case 'NOTE': |
|
340 | - $html .= '<i class="icon-button_note"></i>'; |
|
341 | - break; |
|
342 | - case 'SOUR': |
|
343 | - $html .= '<i class="icon-button_source"></i>'; |
|
344 | - break; |
|
345 | - case 'REPO': |
|
346 | - $html .= '<i class="icon-button_repository"></i>'; |
|
347 | - break; |
|
330 | + case 'INDI': |
|
331 | + $html .= $record->getSexImage('small'); |
|
332 | + break; |
|
333 | + case 'FAM': |
|
334 | + $html .= '<i class="icon-button_family"></i>'; |
|
335 | + break; |
|
336 | + case 'OBJE': |
|
337 | + $html .= '<i class="icon-button_media"></i>'; |
|
338 | + break; |
|
339 | + case 'NOTE': |
|
340 | + $html .= '<i class="icon-button_note"></i>'; |
|
341 | + break; |
|
342 | + case 'SOUR': |
|
343 | + $html .= '<i class="icon-button_source"></i>'; |
|
344 | + break; |
|
345 | + case 'REPO': |
|
346 | + $html .= '<i class="icon-button_repository"></i>'; |
|
347 | + break; |
|
348 | 348 | } |
349 | 349 | $html .= '</td>'; |
350 | 350 | $html .= '<td data-sort="' . Filter::escapeHtml($record->getSortName()) . '">'; |
@@ -77,32 +77,32 @@ |
||
77 | 77 | $content = '<div class="normal_inner_block">'; |
78 | 78 | //Select List or Table |
79 | 79 | switch ($infoStyle) { |
80 | - case "list": // Output style 1: Simple list style. Better suited to left side of page. |
|
81 | - if (I18N::direction() === 'ltr') { |
|
82 | - $padding = 'padding-left: 15px'; |
|
83 | - } else { |
|
84 | - $padding = 'padding-right: 15px'; |
|
85 | - } |
|
86 | - $params = array(1, $num, 'rcount'); |
|
87 | - // List Female names |
|
88 | - $totals = $stats->commonGivenFemaleTotals($params); |
|
89 | - if ($totals) { |
|
90 | - $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; |
|
91 | - } |
|
92 | - // List Male names |
|
93 | - $totals = $stats->commonGivenMaleTotals($params); |
|
94 | - if ($totals) { |
|
95 | - $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; |
|
96 | - } |
|
97 | - break; |
|
98 | - case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page |
|
99 | - $params = array(1, $num, 'rcount'); |
|
100 | - $content .= '<table style="margin:auto;"> |
|
80 | + case "list": // Output style 1: Simple list style. Better suited to left side of page. |
|
81 | + if (I18N::direction() === 'ltr') { |
|
82 | + $padding = 'padding-left: 15px'; |
|
83 | + } else { |
|
84 | + $padding = 'padding-right: 15px'; |
|
85 | + } |
|
86 | + $params = array(1, $num, 'rcount'); |
|
87 | + // List Female names |
|
88 | + $totals = $stats->commonGivenFemaleTotals($params); |
|
89 | + if ($totals) { |
|
90 | + $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; |
|
91 | + } |
|
92 | + // List Male names |
|
93 | + $totals = $stats->commonGivenMaleTotals($params); |
|
94 | + if ($totals) { |
|
95 | + $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; |
|
96 | + } |
|
97 | + break; |
|
98 | + case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page |
|
99 | + $params = array(1, $num, 'rcount'); |
|
100 | + $content .= '<table style="margin:auto;"> |
|
101 | 101 | <tr> |
102 | 102 | <td>' . $stats->commonGivenFemaleTable($params) . '</td> |
103 | 103 | <td>' . $stats->commonGivenMaleTable($params) . '</td>'; |
104 | - $content .= '</tr></table>'; |
|
105 | - break; |
|
104 | + $content .= '</tr></table>'; |
|
105 | + break; |
|
106 | 106 | } |
107 | 107 | $content .= "</div>"; |
108 | 108 |
@@ -76,16 +76,16 @@ |
||
76 | 76 | $tags = $filter ? 'BIRT MARR' : 'BIRT MARR DEAT'; |
77 | 77 | |
78 | 78 | switch ($infoStyle) { |
79 | - case 'list': |
|
80 | - // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page. |
|
81 | - $content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle); |
|
82 | - break; |
|
83 | - case 'table': |
|
84 | - // Style 2: New format, tables, big text, etc. Not too good on right side of page |
|
85 | - ob_start(); |
|
86 | - $content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle); |
|
87 | - $content .= ob_get_clean(); |
|
88 | - break; |
|
79 | + case 'list': |
|
80 | + // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page. |
|
81 | + $content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle); |
|
82 | + break; |
|
83 | + case 'table': |
|
84 | + // Style 2: New format, tables, big text, etc. Not too good on right side of page |
|
85 | + ob_start(); |
|
86 | + $content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle); |
|
87 | + $content .= ob_get_clean(); |
|
88 | + break; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | if ($template) { |
@@ -119,24 +119,24 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | switch ($infoStyle) { |
122 | - case 'list': |
|
123 | - foreach ($yahrzeits as $yahrzeit) { |
|
124 | - if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { |
|
125 | - $ind = $yahrzeit->getParent(); |
|
126 | - $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage(); |
|
127 | - $content .= "<div class=\"indent\">"; |
|
128 | - $content .= $yahrzeit->getDate()->display(true); |
|
129 | - $content .= ', ' . I18N::translate('%s year anniversary', $yahrzeit->anniv); |
|
130 | - $content .= "</div>"; |
|
131 | - } |
|
132 | - } |
|
133 | - break; |
|
134 | - case 'table': |
|
135 | - default: |
|
136 | - $table_id = Uuid::uuid4(); // table requires a unique ID |
|
137 | - $controller |
|
138 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
139 | - ->addInlineJavascript(' |
|
122 | + case 'list': |
|
123 | + foreach ($yahrzeits as $yahrzeit) { |
|
124 | + if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { |
|
125 | + $ind = $yahrzeit->getParent(); |
|
126 | + $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage(); |
|
127 | + $content .= "<div class=\"indent\">"; |
|
128 | + $content .= $yahrzeit->getDate()->display(true); |
|
129 | + $content .= ', ' . I18N::translate('%s year anniversary', $yahrzeit->anniv); |
|
130 | + $content .= "</div>"; |
|
131 | + } |
|
132 | + } |
|
133 | + break; |
|
134 | + case 'table': |
|
135 | + default: |
|
136 | + $table_id = Uuid::uuid4(); // table requires a unique ID |
|
137 | + $controller |
|
138 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
139 | + ->addInlineJavascript(' |
|
140 | 140 | jQuery("#' . $table_id . '").dataTable({ |
141 | 141 | dom: \'t\', |
142 | 142 | ' . I18N::datatablesI18N() . ', |
@@ -160,53 +160,53 @@ discard block |
||
160 | 160 | jQuery("#' . $table_id . '").css("visibility", "visible"); |
161 | 161 | jQuery(".loading-image").css("display", "none"); |
162 | 162 | '); |
163 | - $content = ''; |
|
164 | - $content .= '<div class="loading-image"> </div>'; |
|
165 | - $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">'; |
|
166 | - $content .= '<thead><tr>'; |
|
167 | - $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>'; |
|
168 | - $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>'; |
|
169 | - $content .= '<th>' . GedcomTag::getLabel('DEAT') . '</th>'; |
|
170 | - $content .= '<th>DEAT</th>'; |
|
171 | - $content .= '<th><i class="icon-reminder" title="' . I18N::translate('Anniversary') . '"></i></th>'; |
|
172 | - $content .= '<th>' . GedcomTag::getLabel('_YART') . '</th>'; |
|
173 | - $content .= '<th>_YART</th>'; |
|
174 | - $content .= '</tr></thead><tbody>'; |
|
163 | + $content = ''; |
|
164 | + $content .= '<div class="loading-image"> </div>'; |
|
165 | + $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">'; |
|
166 | + $content .= '<thead><tr>'; |
|
167 | + $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>'; |
|
168 | + $content .= '<th>' . GedcomTag::getLabel('NAME') . '</th>'; |
|
169 | + $content .= '<th>' . GedcomTag::getLabel('DEAT') . '</th>'; |
|
170 | + $content .= '<th>DEAT</th>'; |
|
171 | + $content .= '<th><i class="icon-reminder" title="' . I18N::translate('Anniversary') . '"></i></th>'; |
|
172 | + $content .= '<th>' . GedcomTag::getLabel('_YART') . '</th>'; |
|
173 | + $content .= '<th>_YART</th>'; |
|
174 | + $content .= '</tr></thead><tbody>'; |
|
175 | 175 | |
176 | - foreach ($yahrzeits as $yahrzeit) { |
|
177 | - if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { |
|
178 | - $content .= '<tr>'; |
|
179 | - $ind = $yahrzeit->getParent(); |
|
180 | - // Individual name(s) |
|
181 | - $name = $ind->getFullName(); |
|
182 | - $url = $ind->getHtmlUrl(); |
|
183 | - $content .= '<td>'; |
|
184 | - $content .= '<a href="' . $url . '">' . $name . '</a>'; |
|
185 | - $content .= $ind->getSexImage(); |
|
186 | - $addname = $ind->getAddName(); |
|
187 | - if ($addname) { |
|
188 | - $content .= '<br><a href="' . $url . '">' . $addname . '</a>'; |
|
189 | - } |
|
190 | - $content .= '</td>'; |
|
191 | - $content .= '<td>' . $ind->getSortName() . '</td>'; |
|
176 | + foreach ($yahrzeits as $yahrzeit) { |
|
177 | + if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { |
|
178 | + $content .= '<tr>'; |
|
179 | + $ind = $yahrzeit->getParent(); |
|
180 | + // Individual name(s) |
|
181 | + $name = $ind->getFullName(); |
|
182 | + $url = $ind->getHtmlUrl(); |
|
183 | + $content .= '<td>'; |
|
184 | + $content .= '<a href="' . $url . '">' . $name . '</a>'; |
|
185 | + $content .= $ind->getSexImage(); |
|
186 | + $addname = $ind->getAddName(); |
|
187 | + if ($addname) { |
|
188 | + $content .= '<br><a href="' . $url . '">' . $addname . '</a>'; |
|
189 | + } |
|
190 | + $content .= '</td>'; |
|
191 | + $content .= '<td>' . $ind->getSortName() . '</td>'; |
|
192 | 192 | |
193 | - // death/yahrzeit event date |
|
194 | - $content .= '<td>' . $yahrzeit->getDate()->display() . '</td>'; |
|
195 | - $content .= '<td>' . $yahrzeit->getDate()->julianDay() . '</td>'; // sortable date |
|
193 | + // death/yahrzeit event date |
|
194 | + $content .= '<td>' . $yahrzeit->getDate()->display() . '</td>'; |
|
195 | + $content .= '<td>' . $yahrzeit->getDate()->julianDay() . '</td>'; // sortable date |
|
196 | 196 | |
197 | - // Anniversary |
|
198 | - $content .= '<td>' . $yahrzeit->anniv . '</td>'; |
|
197 | + // Anniversary |
|
198 | + $content .= '<td>' . $yahrzeit->anniv . '</td>'; |
|
199 | 199 | |
200 | - // upcomming yahrzeit dates |
|
201 | - switch ($calendar) { |
|
202 | - case 'gregorian': |
|
203 | - $today = new GregorianDate($yahrzeit->jd); |
|
204 | - break; |
|
205 | - case 'jewish': |
|
206 | - default: |
|
207 | - $today = new JewishDate($yahrzeit->jd); |
|
208 | - break; |
|
209 | - } |
|
200 | + // upcomming yahrzeit dates |
|
201 | + switch ($calendar) { |
|
202 | + case 'gregorian': |
|
203 | + $today = new GregorianDate($yahrzeit->jd); |
|
204 | + break; |
|
205 | + case 'jewish': |
|
206 | + default: |
|
207 | + $today = new JewishDate($yahrzeit->jd); |
|
208 | + break; |
|
209 | + } |
|
210 | 210 | $td = new Date($today->format('%@ %A %O %E')); |
211 | 211 | $content .= '<td>' . $td->display() . '</td>'; |
212 | 212 | $content .= '<td>' . $td->julianDay() . '</td>'; // sortable date |
@@ -80,22 +80,22 @@ |
||
80 | 80 | global $WT_TREE; |
81 | 81 | |
82 | 82 | switch ($mod_action) { |
83 | - case 'menu-add-favorite': |
|
84 | - // Process the "add to user favorites" menu item on indi/fam/etc. pages |
|
85 | - $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE); |
|
86 | - if (Auth::check() && $record->canShowName()) { |
|
87 | - self::addFavorite(array( |
|
88 | - 'user_id' => Auth::id(), |
|
89 | - 'gedcom_id' => $record->getTree()->getTreeId(), |
|
90 | - 'gid' => $record->getXref(), |
|
91 | - 'type' => $record::RECORD_TYPE, |
|
92 | - 'url' => null, |
|
93 | - 'note' => null, |
|
94 | - 'title' => null, |
|
95 | - )); |
|
96 | - FlashMessages::addMessage(/* I18N: %s is the name of an individual, source or other record */ I18N::translate('“%s” has been added to your favorites.', $record->getFullName())); |
|
97 | - } |
|
98 | - break; |
|
83 | + case 'menu-add-favorite': |
|
84 | + // Process the "add to user favorites" menu item on indi/fam/etc. pages |
|
85 | + $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE); |
|
86 | + if (Auth::check() && $record->canShowName()) { |
|
87 | + self::addFavorite(array( |
|
88 | + 'user_id' => Auth::id(), |
|
89 | + 'gedcom_id' => $record->getTree()->getTreeId(), |
|
90 | + 'gid' => $record->getXref(), |
|
91 | + 'type' => $record::RECORD_TYPE, |
|
92 | + 'url' => null, |
|
93 | + 'note' => null, |
|
94 | + 'title' => null, |
|
95 | + )); |
|
96 | + FlashMessages::addMessage(/* I18N: %s is the name of an individual, source or other record */ I18N::translate('“%s” has been added to your favorites.', $record->getFullName())); |
|
97 | + } |
|
98 | + break; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -46,15 +46,15 @@ |
||
46 | 46 | */ |
47 | 47 | public function modAction($mod_action) { |
48 | 48 | switch ($mod_action) { |
49 | - case 'delete': |
|
50 | - $stmt = Database::prepare("DELETE FROM `##message` WHERE user_id = :user_id AND message_id = :message_id"); |
|
51 | - |
|
52 | - foreach (Filter::postArray('message_id') as $id) { |
|
53 | - $stmt->execute(array( |
|
54 | - 'message_id' => $id, |
|
55 | - 'user_id' => Auth::id(), |
|
56 | - )); |
|
57 | - } |
|
49 | + case 'delete': |
|
50 | + $stmt = Database::prepare("DELETE FROM `##message` WHERE user_id = :user_id AND message_id = :message_id"); |
|
51 | + |
|
52 | + foreach (Filter::postArray('message_id') as $id) { |
|
53 | + $stmt->execute(array( |
|
54 | + 'message_id' => $id, |
|
55 | + 'user_id' => Auth::id(), |
|
56 | + )); |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $ged = Filter::post('ged'); |
@@ -52,17 +52,17 @@ |
||
52 | 52 | */ |
53 | 53 | public function modAction($mod_action) { |
54 | 54 | switch ($mod_action) { |
55 | - case 'census_find': |
|
56 | - self::censusFind(); |
|
57 | - break; |
|
58 | - case 'media_find': |
|
59 | - self::mediaFind(); |
|
60 | - break; |
|
61 | - case 'media_query_3a': |
|
62 | - self::mediaQuery(); |
|
63 | - break; |
|
64 | - default: |
|
65 | - http_response_code(404); |
|
55 | + case 'census_find': |
|
56 | + self::censusFind(); |
|
57 | + break; |
|
58 | + case 'media_find': |
|
59 | + self::mediaFind(); |
|
60 | + break; |
|
61 | + case 'media_query_3a': |
|
62 | + self::mediaQuery(); |
|
63 | + break; |
|
64 | + default: |
|
65 | + http_response_code(404); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |