@@ -198,27 +198,27 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | switch ($type) { |
201 | - case 'INDI': |
|
202 | - $record = new Individual($xref, $gedcom, $pending, $tree); |
|
203 | - break; |
|
204 | - case 'FAM': |
|
205 | - $record = new Family($xref, $gedcom, $pending, $tree); |
|
206 | - break; |
|
207 | - case 'SOUR': |
|
208 | - $record = new Source($xref, $gedcom, $pending, $tree); |
|
209 | - break; |
|
210 | - case 'OBJE': |
|
211 | - $record = new Media($xref, $gedcom, $pending, $tree); |
|
212 | - break; |
|
213 | - case 'REPO': |
|
214 | - $record = new Repository($xref, $gedcom, $pending, $tree); |
|
215 | - break; |
|
216 | - case 'NOTE': |
|
217 | - $record = new Note($xref, $gedcom, $pending, $tree); |
|
218 | - break; |
|
219 | - default: |
|
220 | - $record = new self($xref, $gedcom, $pending, $tree); |
|
221 | - break; |
|
201 | + case 'INDI': |
|
202 | + $record = new Individual($xref, $gedcom, $pending, $tree); |
|
203 | + break; |
|
204 | + case 'FAM': |
|
205 | + $record = new Family($xref, $gedcom, $pending, $tree); |
|
206 | + break; |
|
207 | + case 'SOUR': |
|
208 | + $record = new Source($xref, $gedcom, $pending, $tree); |
|
209 | + break; |
|
210 | + case 'OBJE': |
|
211 | + $record = new Media($xref, $gedcom, $pending, $tree); |
|
212 | + break; |
|
213 | + case 'REPO': |
|
214 | + $record = new Repository($xref, $gedcom, $pending, $tree); |
|
215 | + break; |
|
216 | + case 'NOTE': |
|
217 | + $record = new Note($xref, $gedcom, $pending, $tree); |
|
218 | + break; |
|
219 | + default: |
|
220 | + $record = new self($xref, $gedcom, $pending, $tree); |
|
221 | + break; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | // Store it in the cache |
@@ -437,31 +437,31 @@ discard block |
||
437 | 437 | // CACHING: this function can take three different parameters, |
438 | 438 | // and therefore needs three different caches for the result. |
439 | 439 | switch ($access_level) { |
440 | - case Auth::PRIV_PRIVATE: // visitor |
|
441 | - if ($this->disp_public === null) { |
|
442 | - $this->disp_public = $this->canShowRecord(Auth::PRIV_PRIVATE); |
|
443 | - } |
|
440 | + case Auth::PRIV_PRIVATE: // visitor |
|
441 | + if ($this->disp_public === null) { |
|
442 | + $this->disp_public = $this->canShowRecord(Auth::PRIV_PRIVATE); |
|
443 | + } |
|
444 | 444 | |
445 | - return $this->disp_public; |
|
446 | - case Auth::PRIV_USER: // member |
|
447 | - if ($this->disp_user === null) { |
|
448 | - $this->disp_user = $this->canShowRecord(Auth::PRIV_USER); |
|
449 | - } |
|
445 | + return $this->disp_public; |
|
446 | + case Auth::PRIV_USER: // member |
|
447 | + if ($this->disp_user === null) { |
|
448 | + $this->disp_user = $this->canShowRecord(Auth::PRIV_USER); |
|
449 | + } |
|
450 | 450 | |
451 | - return $this->disp_user; |
|
452 | - case Auth::PRIV_NONE: // admin |
|
453 | - if ($this->disp_none === null) { |
|
454 | - $this->disp_none = $this->canShowRecord(Auth::PRIV_NONE); |
|
455 | - } |
|
451 | + return $this->disp_user; |
|
452 | + case Auth::PRIV_NONE: // admin |
|
453 | + if ($this->disp_none === null) { |
|
454 | + $this->disp_none = $this->canShowRecord(Auth::PRIV_NONE); |
|
455 | + } |
|
456 | 456 | |
457 | - return $this->disp_none; |
|
458 | - case Auth::PRIV_HIDE: // hidden from admins |
|
459 | - // We use this value to bypass privacy checks. For example, |
|
460 | - // when downloading data or when calculating privacy itself. |
|
461 | - return true; |
|
462 | - default: |
|
463 | - // Should never get here. |
|
464 | - return false; |
|
457 | + return $this->disp_none; |
|
458 | + case Auth::PRIV_HIDE: // hidden from admins |
|
459 | + // We use this value to bypass privacy checks. For example, |
|
460 | + // when downloading data or when calculating privacy itself. |
|
461 | + return true; |
|
462 | + default: |
|
463 | + // Should never get here. |
|
464 | + return false; |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
@@ -816,10 +816,10 @@ discard block |
||
816 | 816 | } |
817 | 817 | if ($event->getDate()->isOK() || !$event->getPlace()->isEmpty()) { |
818 | 818 | switch ($style) { |
819 | - case 1: |
|
820 | - return '<br><em>' . $event->getLabel() . ' ' . FunctionsPrint::formatFactDate($event, $this, false, false) . $joiner . FunctionsPrint::formatFactPlace($event) . '</em>'; |
|
821 | - case 2: |
|
822 | - return '<dl><dt class="label">' . $event->getLabel() . '</dt><dd class="field">' . FunctionsPrint::formatFactDate($event, $this, false, false) . $joiner . FunctionsPrint::formatFactPlace($event) . '</dd></dl>'; |
|
819 | + case 1: |
|
820 | + return '<br><em>' . $event->getLabel() . ' ' . FunctionsPrint::formatFactDate($event, $this, false, false) . $joiner . FunctionsPrint::formatFactPlace($event) . '</em>'; |
|
821 | + case 2: |
|
822 | + return '<dl><dt class="label">' . $event->getLabel() . '</dt><dd class="field">' . FunctionsPrint::formatFactDate($event, $this, false, false) . $joiner . FunctionsPrint::formatFactPlace($event) . '</dd></dl>'; |
|
823 | 823 | } |
824 | 824 | } |
825 | 825 | } |
@@ -49,72 +49,72 @@ discard block |
||
49 | 49 | echo '<div id="pending"><h2>', I18N::translate('Pending changes'), '</h2>'; |
50 | 50 | |
51 | 51 | switch ($action) { |
52 | -case 'undo': |
|
53 | - $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
54 | - $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
55 | - // Undo a change, and subsequent changes to the same record |
|
56 | - Database::prepare( |
|
57 | - "UPDATE `##change`" . |
|
58 | - " SET status = 'rejected'" . |
|
59 | - " WHERE status = 'pending'" . |
|
60 | - " AND gedcom_id = ?" . |
|
61 | - " AND xref = ?" . |
|
62 | - " AND change_id >= ?" |
|
63 | - )->execute(array($gedcom_id, $xref, $change_id)); |
|
64 | - break; |
|
65 | -case 'accept': |
|
66 | - $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
67 | - $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
68 | - // Accept a change, and all previous changes to the same record |
|
69 | - $changes = Database::prepare( |
|
70 | - "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
71 | - " FROM `##change` c" . |
|
72 | - " JOIN `##gedcom` g USING (gedcom_id)" . |
|
73 | - " WHERE c.status = 'pending'" . |
|
74 | - " AND gedcom_id = ?" . |
|
75 | - " AND xref = ?" . |
|
76 | - " AND change_id <= ?" . |
|
77 | - " ORDER BY change_id" |
|
78 | - )->execute(array($gedcom_id, $xref, $change_id))->fetchAll(); |
|
79 | - foreach ($changes as $change) { |
|
80 | - if (empty($change->new_gedcom)) { |
|
81 | - // delete |
|
82 | - FunctionsImport::updateRecord($change->old_gedcom, $gedcom_id, true); |
|
83 | - } else { |
|
84 | - // add/update |
|
85 | - FunctionsImport::updateRecord($change->new_gedcom, $gedcom_id, false); |
|
52 | + case 'undo': |
|
53 | + $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
54 | + $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
55 | + // Undo a change, and subsequent changes to the same record |
|
56 | + Database::prepare( |
|
57 | + "UPDATE `##change`" . |
|
58 | + " SET status = 'rejected'" . |
|
59 | + " WHERE status = 'pending'" . |
|
60 | + " AND gedcom_id = ?" . |
|
61 | + " AND xref = ?" . |
|
62 | + " AND change_id >= ?" |
|
63 | + )->execute(array($gedcom_id, $xref, $change_id)); |
|
64 | + break; |
|
65 | + case 'accept': |
|
66 | + $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
67 | + $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne(); |
|
68 | + // Accept a change, and all previous changes to the same record |
|
69 | + $changes = Database::prepare( |
|
70 | + "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
71 | + " FROM `##change` c" . |
|
72 | + " JOIN `##gedcom` g USING (gedcom_id)" . |
|
73 | + " WHERE c.status = 'pending'" . |
|
74 | + " AND gedcom_id = ?" . |
|
75 | + " AND xref = ?" . |
|
76 | + " AND change_id <= ?" . |
|
77 | + " ORDER BY change_id" |
|
78 | + )->execute(array($gedcom_id, $xref, $change_id))->fetchAll(); |
|
79 | + foreach ($changes as $change) { |
|
80 | + if (empty($change->new_gedcom)) { |
|
81 | + // delete |
|
82 | + FunctionsImport::updateRecord($change->old_gedcom, $gedcom_id, true); |
|
83 | + } else { |
|
84 | + // add/update |
|
85 | + FunctionsImport::updateRecord($change->new_gedcom, $gedcom_id, false); |
|
86 | + } |
|
87 | + Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute(array($change->change_id)); |
|
88 | + Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
86 | 89 | } |
87 | - Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute(array($change->change_id)); |
|
88 | - Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
89 | - } |
|
90 | - break; |
|
91 | -case 'undoall': |
|
92 | - Database::prepare( |
|
93 | - "UPDATE `##change`" . |
|
94 | - " SET status='rejected'" . |
|
95 | - " WHERE status='pending' AND gedcom_id=?" |
|
96 | - )->execute(array($WT_TREE->getTreeId())); |
|
97 | - break; |
|
98 | -case 'acceptall': |
|
99 | - $changes = Database::prepare( |
|
100 | - "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
101 | - " FROM `##change` c" . |
|
102 | - " JOIN `##gedcom` g USING (gedcom_id)" . |
|
103 | - " WHERE c.status='pending' AND gedcom_id=?" . |
|
104 | - " ORDER BY change_id" |
|
105 | - )->execute(array($WT_TREE->getTreeId()))->fetchAll(); |
|
106 | - foreach ($changes as $change) { |
|
107 | - if (empty($change->new_gedcom)) { |
|
108 | - // delete |
|
109 | - FunctionsImport::updateRecord($change->old_gedcom, $change->gedcom_id, true); |
|
110 | - } else { |
|
111 | - // add/update |
|
112 | - FunctionsImport::updateRecord($change->new_gedcom, $change->gedcom_id, false); |
|
90 | + break; |
|
91 | + case 'undoall': |
|
92 | + Database::prepare( |
|
93 | + "UPDATE `##change`" . |
|
94 | + " SET status='rejected'" . |
|
95 | + " WHERE status='pending' AND gedcom_id=?" |
|
96 | + )->execute(array($WT_TREE->getTreeId())); |
|
97 | + break; |
|
98 | + case 'acceptall': |
|
99 | + $changes = Database::prepare( |
|
100 | + "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
101 | + " FROM `##change` c" . |
|
102 | + " JOIN `##gedcom` g USING (gedcom_id)" . |
|
103 | + " WHERE c.status='pending' AND gedcom_id=?" . |
|
104 | + " ORDER BY change_id" |
|
105 | + )->execute(array($WT_TREE->getTreeId()))->fetchAll(); |
|
106 | + foreach ($changes as $change) { |
|
107 | + if (empty($change->new_gedcom)) { |
|
108 | + // delete |
|
109 | + FunctionsImport::updateRecord($change->old_gedcom, $change->gedcom_id, true); |
|
110 | + } else { |
|
111 | + // add/update |
|
112 | + FunctionsImport::updateRecord($change->new_gedcom, $change->gedcom_id, false); |
|
113 | + } |
|
114 | + Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute(array($change->change_id)); |
|
115 | + Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
113 | 116 | } |
114 | - Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute(array($change->change_id)); |
|
115 | - Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
116 | - } |
|
117 | - break; |
|
117 | + break; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $changed_gedcoms = Database::prepare( |
@@ -146,27 +146,27 @@ discard block |
||
146 | 146 | |
147 | 147 | |
148 | 148 | switch ($match[1]) { |
149 | - case 'INDI': |
|
150 | - $record = new Individual($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
151 | - break; |
|
152 | - case 'FAM': |
|
153 | - $record = new Family($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
154 | - break; |
|
155 | - case 'SOUR': |
|
156 | - $record = new Source($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
157 | - break; |
|
158 | - case 'REPO': |
|
159 | - $record = new Repository($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
160 | - break; |
|
161 | - case 'OBJE': |
|
162 | - $record = new Media($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
163 | - break; |
|
164 | - case 'NOTE': |
|
165 | - $record = new Note($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
166 | - break; |
|
167 | - default: |
|
168 | - $record = new GedcomRecord($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
169 | - break; |
|
149 | + case 'INDI': |
|
150 | + $record = new Individual($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
151 | + break; |
|
152 | + case 'FAM': |
|
153 | + $record = new Family($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
154 | + break; |
|
155 | + case 'SOUR': |
|
156 | + $record = new Source($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
157 | + break; |
|
158 | + case 'REPO': |
|
159 | + $record = new Repository($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
160 | + break; |
|
161 | + case 'OBJE': |
|
162 | + $record = new Media($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
163 | + break; |
|
164 | + case 'NOTE': |
|
165 | + $record = new Note($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
166 | + break; |
|
167 | + default: |
|
168 | + $record = new GedcomRecord($change->xref, $change->old_gedcom, $change->new_gedcom, $tree); |
|
169 | + break; |
|
170 | 170 | } |
171 | 171 | if ($change->xref != $prev_xref || $change->gedcom_id != $prev_gedcom_id) { |
172 | 172 | if ($prev_xref) { |
@@ -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) { |
@@ -41,10 +41,10 @@ |
||
41 | 41 | protected function flashMessageContainer(\stdClass $message) { |
42 | 42 | // This theme uses jQueryUI markup. |
43 | 43 | switch ($message->status) { |
44 | - case 'danger': |
|
45 | - return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | - default: |
|
47 | - return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
44 | + case 'danger': |
|
45 | + return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | + default: |
|
47 | + return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 |
@@ -41,10 +41,10 @@ |
||
41 | 41 | protected function flashMessageContainer(\stdClass $message) { |
42 | 42 | // This theme uses jQueryUI markup. |
43 | 43 | switch ($message->status) { |
44 | - case 'danger': |
|
45 | - return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | - default: |
|
47 | - return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
44 | + case 'danger': |
|
45 | + return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | + default: |
|
47 | + return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 |
@@ -41,10 +41,10 @@ |
||
41 | 41 | protected function flashMessageContainer(\stdClass $message) { |
42 | 42 | // This theme uses jQueryUI markup. |
43 | 43 | switch ($message->status) { |
44 | - case 'danger': |
|
45 | - return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | - default: |
|
47 | - return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
44 | + case 'danger': |
|
45 | + return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | + default: |
|
47 | + return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 |
@@ -41,10 +41,10 @@ |
||
41 | 41 | protected function flashMessageContainer(\stdClass $message) { |
42 | 42 | // This theme uses jQueryUI markup. |
43 | 43 | switch ($message->status) { |
44 | - case 'danger': |
|
45 | - return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | - default: |
|
47 | - return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
44 | + case 'danger': |
|
45 | + return '<p class="ui-state-error">' . $message->text . '</p>'; |
|
46 | + default: |
|
47 | + return '<p class="ui-state-highlight">' . $message->text . '</p>'; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 |
@@ -75,37 +75,37 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | switch ($mod_action) { |
78 | - case 'ajax': |
|
79 | - $html = $this->getSidebarAjaxContent(); |
|
80 | - header('Content-Type: text/html; charset=UTF-8'); |
|
81 | - echo $html; |
|
82 | - break; |
|
83 | - case 'index': |
|
84 | - global $controller, $WT_TREE; |
|
85 | - |
|
86 | - $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); |
|
87 | - |
|
88 | - $clip_ctrl = new ClippingsCartController; |
|
89 | - $cart = Session::get('cart'); |
|
90 | - |
|
91 | - $controller = new PageController; |
|
92 | - $controller |
|
93 | - ->setPageTitle($this->getTitle()) |
|
94 | - ->pageHeader() |
|
95 | - ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) |
|
96 | - ->addInlineJavascript('autocomplete();'); |
|
97 | - |
|
98 | - echo '<script>'; |
|
99 | - echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}'; |
|
100 | - echo '</script>'; |
|
101 | - |
|
102 | - if (!$cart[$WT_TREE->getTreeId()]) { |
|
103 | - echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>'; |
|
104 | - } |
|
78 | + case 'ajax': |
|
79 | + $html = $this->getSidebarAjaxContent(); |
|
80 | + header('Content-Type: text/html; charset=UTF-8'); |
|
81 | + echo $html; |
|
82 | + break; |
|
83 | + case 'index': |
|
84 | + global $controller, $WT_TREE; |
|
85 | + |
|
86 | + $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); |
|
87 | + |
|
88 | + $clip_ctrl = new ClippingsCartController; |
|
89 | + $cart = Session::get('cart'); |
|
90 | + |
|
91 | + $controller = new PageController; |
|
92 | + $controller |
|
93 | + ->setPageTitle($this->getTitle()) |
|
94 | + ->pageHeader() |
|
95 | + ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) |
|
96 | + ->addInlineJavascript('autocomplete();'); |
|
97 | + |
|
98 | + echo '<script>'; |
|
99 | + echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}'; |
|
100 | + echo '</script>'; |
|
101 | + |
|
102 | + if (!$cart[$WT_TREE->getTreeId()]) { |
|
103 | + echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>'; |
|
104 | + } |
|
105 | 105 | |
106 | - if ($clip_ctrl->action == 'add') { |
|
107 | - $record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE); |
|
108 | - if ($clip_ctrl->type === 'FAM') { ?> |
|
106 | + if ($clip_ctrl->action == 'add') { |
|
107 | + $record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE); |
|
108 | + if ($clip_ctrl->type === 'FAM') { ?> |
|
109 | 109 | <form action="module.php" method="get"> |
110 | 110 | <input type="hidden" name="mod" value="clippings"> |
111 | 111 | <input type="hidden" name="mod_action" value="index"> |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | <td class="optionbox"> |
132 | 132 | <input type="radio" name="others" value="members" checked> |
133 | 133 | <?php echo /* I18N: %s is a family (husband + wife) */ |
134 | - I18N::translate('%s and their children', $record->getFullName()); ?> |
|
134 | + I18N::translate('%s and their children', $record->getFullName()); ?> |
|
135 | 135 | </td> |
136 | 136 | </tr> |
137 | 137 | <tr> |
138 | 138 | <td class="optionbox"> |
139 | 139 | <input type="radio" name="others" value="descendants"> |
140 | 140 | <?php echo /* I18N: %s is a family (husband + wife) */ |
141 | - I18N::translate('%s and their descendants', $record->getFullName()); ?> |
|
141 | + I18N::translate('%s and their descendants', $record->getFullName()); ?> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | 144 | </tbody> |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | <label> |
180 | 180 | <input type="radio" name="others" value="parents"> |
181 | 181 | <?php |
182 | - if ($record->getSex() === 'F') { |
|
183 | - echo /* I18N: %s is a woman's name */ |
|
184 | - I18N::translate('%s, her parents and siblings', $record->getFullName()); |
|
185 | - } else { |
|
186 | - echo /* I18N: %s is a man's name */ |
|
187 | - I18N::translate('%s, his parents and siblings', $record->getFullName()); |
|
188 | - } |
|
189 | - ?> |
|
182 | + if ($record->getSex() === 'F') { |
|
183 | + echo /* I18N: %s is a woman's name */ |
|
184 | + I18N::translate('%s, her parents and siblings', $record->getFullName()); |
|
185 | + } else { |
|
186 | + echo /* I18N: %s is a man's name */ |
|
187 | + I18N::translate('%s, his parents and siblings', $record->getFullName()); |
|
188 | + } |
|
189 | + ?> |
|
190 | 190 | </label> |
191 | 191 | </td> |
192 | 192 | </tr> |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | <label> |
196 | 196 | <input type="radio" name="others" value="members"> |
197 | 197 | <?php |
198 | - if ($record->getSex() === 'F') { |
|
199 | - echo /* I18N: %s is a woman's name */ |
|
200 | - I18N::translate('%s, her spouses and children', $record->getFullName()); |
|
201 | - } else { |
|
202 | - echo /* I18N: %s is a man's name */ |
|
203 | - I18N::translate('%s, his spouses and children', $record->getFullName()); |
|
204 | - } |
|
205 | - ?> |
|
198 | + if ($record->getSex() === 'F') { |
|
199 | + echo /* I18N: %s is a woman's name */ |
|
200 | + I18N::translate('%s, her spouses and children', $record->getFullName()); |
|
201 | + } else { |
|
202 | + echo /* I18N: %s is a man's name */ |
|
203 | + I18N::translate('%s, his spouses and children', $record->getFullName()); |
|
204 | + } |
|
205 | + ?> |
|
206 | 206 | </label> |
207 | 207 | </td> |
208 | 208 | </tr> |
@@ -211,18 +211,18 @@ discard block |
||
211 | 211 | <label> |
212 | 212 | <input type="radio" name="others" value="ancestors" id="ancestors"> |
213 | 213 | <?php |
214 | - if ($record->getSex() === 'F') { |
|
215 | - echo /* I18N: %s is a woman's name */ |
|
216 | - I18N::translate('%s and her ancestors', $record->getFullName()); |
|
217 | - } else { |
|
218 | - echo /* I18N: %s is a man's name */ |
|
219 | - I18N::translate('%s and his ancestors', $record->getFullName()); |
|
220 | - } |
|
221 | - ?> |
|
214 | + if ($record->getSex() === 'F') { |
|
215 | + echo /* I18N: %s is a woman's name */ |
|
216 | + I18N::translate('%s and her ancestors', $record->getFullName()); |
|
217 | + } else { |
|
218 | + echo /* I18N: %s is a man's name */ |
|
219 | + I18N::translate('%s and his ancestors', $record->getFullName()); |
|
220 | + } |
|
221 | + ?> |
|
222 | 222 | </label> |
223 | 223 | <br> |
224 | 224 | <?php echo I18N::translate('Number of generations'); ?> |
225 | - <input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');"> |
|
225 | + <input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestors');"> |
|
226 | 226 | </td> |
227 | 227 | </tr> |
228 | 228 | <tr> |
@@ -230,18 +230,18 @@ discard block |
||
230 | 230 | <label> |
231 | 231 | <input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"> |
232 | 232 | <?php |
233 | - if ($record->getSex() === 'F') { |
|
234 | - echo /* I18N: %s is a woman's name */ |
|
235 | - I18N::translate('%s, her ancestors and their families', $record->getFullName()); |
|
236 | - } else { |
|
237 | - echo /* I18N: %s is a man's name */ |
|
238 | - I18N::translate('%s, his ancestors and their families', $record->getFullName()); |
|
239 | - } |
|
240 | - ?> |
|
233 | + if ($record->getSex() === 'F') { |
|
234 | + echo /* I18N: %s is a woman's name */ |
|
235 | + I18N::translate('%s, her ancestors and their families', $record->getFullName()); |
|
236 | + } else { |
|
237 | + echo /* I18N: %s is a man's name */ |
|
238 | + I18N::translate('%s, his ancestors and their families', $record->getFullName()); |
|
239 | + } |
|
240 | + ?> |
|
241 | 241 | </label> |
242 | 242 | <br> |
243 | 243 | <?php echo I18N::translate('Number of generations'); ?> |
244 | - <input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');"> |
|
244 | + <input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('ancestorsfamilies');"> |
|
245 | 245 | </td> |
246 | 246 | </tr> |
247 | 247 | <tr> |
@@ -249,18 +249,18 @@ discard block |
||
249 | 249 | <label> |
250 | 250 | <input type="radio" name="others" value="descendants" id="descendants"> |
251 | 251 | <?php |
252 | - if ($record->getSex() === 'F') { |
|
253 | - echo /* I18N: %s is a woman's name */ |
|
254 | - I18N::translate('%s, her spouses and descendants', $record->getFullName()); |
|
255 | - } else { |
|
256 | - echo /* I18N: %s is a man's name */ |
|
257 | - I18N::translate('%s, his spouses and descendants', $record->getFullName()); |
|
258 | - } |
|
259 | - ?> |
|
252 | + if ($record->getSex() === 'F') { |
|
253 | + echo /* I18N: %s is a woman's name */ |
|
254 | + I18N::translate('%s, her spouses and descendants', $record->getFullName()); |
|
255 | + } else { |
|
256 | + echo /* I18N: %s is a man's name */ |
|
257 | + I18N::translate('%s, his spouses and descendants', $record->getFullName()); |
|
258 | + } |
|
259 | + ?> |
|
260 | 260 | </label> |
261 | 261 | <br> |
262 | 262 | <?php echo I18N::translate('Number of generations'); ?> |
263 | - <input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');"> |
|
263 | + <input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?>" onfocus="radAncestors('descendants');"> |
|
264 | 264 | </td> |
265 | 265 | </tr> |
266 | 266 | </tbody> |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | <label> |
303 | 303 | <input type="radio" name="others" value="linked"> |
304 | 304 | <?php echo /* I18N: %s is the name of a source */ |
305 | - I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?> |
|
305 | + I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?> |
|
306 | 306 | </label> |
307 | 307 | </td> |
308 | 308 | </tr> |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | </table> |
318 | 318 | </form> |
319 | 319 | <?php } |
320 | - } |
|
320 | + } |
|
321 | 321 | |
322 | - if (!$cart[$WT_TREE->getTreeId()]) { |
|
323 | - if ($clip_ctrl->action != 'add') { |
|
324 | - echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.'); |
|
325 | - ?> |
|
322 | + if (!$cart[$WT_TREE->getTreeId()]) { |
|
323 | + if ($clip_ctrl->action != 'add') { |
|
324 | + echo I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.'); |
|
325 | + ?> |
|
326 | 326 | <form method="get" name="addin" action="module.php"> |
327 | 327 | <input type="hidden" name="mod" value="clippings"> |
328 | 328 | <input type="hidden" name="mod_action" value="index"> |
@@ -342,25 +342,25 @@ discard block |
||
342 | 342 | </td> |
343 | 343 | <td class="optionbox"> |
344 | 344 | <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> |
345 | - <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> |
|
346 | - <?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?> |
|
347 | - <input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>"> |
|
345 | + <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> |
|
346 | + <?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?> |
|
347 | + <input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>"> |
|
348 | 348 | </td> |
349 | 349 | </tr> |
350 | 350 | </tbody> |
351 | 351 | </table> |
352 | 352 | </form> |
353 | 353 | <?php |
354 | - } |
|
354 | + } |
|
355 | 355 | |
356 | - // -- end new lines |
|
357 | - echo I18N::translate('Your clippings cart is empty.'); |
|
358 | - } else { |
|
359 | - // Keep track of the INDI from the parent page, otherwise it will |
|
360 | - // get lost after ajax updates |
|
361 | - $pid = Filter::get('pid', WT_REGEX_XREF); |
|
356 | + // -- end new lines |
|
357 | + echo I18N::translate('Your clippings cart is empty.'); |
|
358 | + } else { |
|
359 | + // Keep track of the INDI from the parent page, otherwise it will |
|
360 | + // get lost after ajax updates |
|
361 | + $pid = Filter::get('pid', WT_REGEX_XREF); |
|
362 | 362 | |
363 | - if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?> |
|
363 | + if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?> |
|
364 | 364 | <form method="get" action="module.php"> |
365 | 365 | <input type="hidden" name="mod" value="clippings"> |
366 | 366 | <input type="hidden" name="mod_action" value="index"> |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | </td> |
469 | 469 | <td class="optionbox"> |
470 | 470 | <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> |
471 | - <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> |
|
472 | - <?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?> |
|
473 | - <input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>"> |
|
471 | + <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> |
|
472 | + <?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?> |
|
473 | + <input type="submit" value="<?php echo /* I18N: A button label. */ I18N::translate('add'); ?>"> |
|
474 | 474 | </td> |
475 | 475 | </tr> |
476 | 476 | </tbody> |
@@ -500,32 +500,32 @@ discard block |
||
500 | 500 | </thead> |
501 | 501 | <tbody> |
502 | 502 | <?php |
503 | - foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) { |
|
504 | - $record = GedcomRecord::getInstance($xref, $WT_TREE); |
|
505 | - if ($record) { |
|
506 | - switch ($record::RECORD_TYPE) { |
|
507 | - case 'INDI': |
|
508 | - $icon = 'icon-indis'; |
|
509 | - break; |
|
510 | - case 'FAM': |
|
511 | - $icon = 'icon-sfamily'; |
|
512 | - break; |
|
513 | - case 'SOUR': |
|
514 | - $icon = 'icon-source'; |
|
515 | - break; |
|
516 | - case 'REPO': |
|
517 | - $icon = 'icon-repository'; |
|
518 | - break; |
|
519 | - case 'NOTE': |
|
520 | - $icon = 'icon-note'; |
|
521 | - break; |
|
522 | - case 'OBJE': |
|
523 | - $icon = 'icon-media'; |
|
524 | - break; |
|
525 | - default: |
|
526 | - $icon = 'icon-clippings'; |
|
527 | - break; |
|
528 | - } |
|
503 | + foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) { |
|
504 | + $record = GedcomRecord::getInstance($xref, $WT_TREE); |
|
505 | + if ($record) { |
|
506 | + switch ($record::RECORD_TYPE) { |
|
507 | + case 'INDI': |
|
508 | + $icon = 'icon-indis'; |
|
509 | + break; |
|
510 | + case 'FAM': |
|
511 | + $icon = 'icon-sfamily'; |
|
512 | + break; |
|
513 | + case 'SOUR': |
|
514 | + $icon = 'icon-source'; |
|
515 | + break; |
|
516 | + case 'REPO': |
|
517 | + $icon = 'icon-repository'; |
|
518 | + break; |
|
519 | + case 'NOTE': |
|
520 | + $icon = 'icon-note'; |
|
521 | + break; |
|
522 | + case 'OBJE': |
|
523 | + $icon = 'icon-media'; |
|
524 | + break; |
|
525 | + default: |
|
526 | + $icon = 'icon-clippings'; |
|
527 | + break; |
|
528 | + } |
|
529 | 529 | ?> |
530 | 530 | <tr> |
531 | 531 | <td class="list_value"> |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | <?php |
545 | 545 | } |
546 | 546 | break; |
547 | - default: |
|
548 | - http_response_code(404); |
|
549 | - break; |
|
547 | + default: |
|
548 | + http_response_code(404); |
|
549 | + break; |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | |
@@ -695,12 +695,12 @@ discard block |
||
695 | 695 | $record = GedcomRecord::getInstance($xref, $WT_TREE); |
696 | 696 | if ($record instanceof Individual || $record instanceof Family) { |
697 | 697 | switch ($record::RECORD_TYPE) { |
698 | - case 'INDI': |
|
699 | - $icon = 'icon-indis'; |
|
700 | - break; |
|
701 | - case 'FAM': |
|
702 | - $icon = 'icon-sfamily'; |
|
703 | - break; |
|
698 | + case 'INDI': |
|
699 | + $icon = 'icon-indis'; |
|
700 | + break; |
|
701 | + case 'FAM': |
|
702 | + $icon = 'icon-sfamily'; |
|
703 | + break; |
|
704 | 704 | } |
705 | 705 | $out .= '<li>'; |
706 | 706 | if (!empty($icon)) { |
@@ -169,22 +169,22 @@ discard block |
||
169 | 169 | } |
170 | 170 | // Now construct an object of the correct type |
171 | 171 | switch ($cal) { |
172 | - case '@#DGREGORIAN@': |
|
173 | - return new GregorianDate(array($y, $m, $d)); |
|
174 | - case '@#DJULIAN@': |
|
175 | - return new JulianDate(array($y, $m, $d)); |
|
176 | - case '@#DHEBREW@': |
|
177 | - return new JewishDate(array($y, $m, $d)); |
|
178 | - case '@#DHIJRI@': |
|
179 | - return new HijriDate(array($y, $m, $d)); |
|
180 | - case '@#DFRENCH R@': |
|
181 | - return new FrenchDate(array($y, $m, $d)); |
|
182 | - case '@#DJALALI@': |
|
183 | - return new JalaliDate(array($y, $m, $d)); |
|
184 | - case '@#DROMAN@': |
|
185 | - return new RomanDate(array($y, $m, $d)); |
|
186 | - default: |
|
187 | - throw new \DomainException('Invalid calendar'); |
|
172 | + case '@#DGREGORIAN@': |
|
173 | + return new GregorianDate(array($y, $m, $d)); |
|
174 | + case '@#DJULIAN@': |
|
175 | + return new JulianDate(array($y, $m, $d)); |
|
176 | + case '@#DHEBREW@': |
|
177 | + return new JewishDate(array($y, $m, $d)); |
|
178 | + case '@#DHIJRI@': |
|
179 | + return new HijriDate(array($y, $m, $d)); |
|
180 | + case '@#DFRENCH R@': |
|
181 | + return new FrenchDate(array($y, $m, $d)); |
|
182 | + case '@#DJALALI@': |
|
183 | + return new JalaliDate(array($y, $m, $d)); |
|
184 | + case '@#DROMAN@': |
|
185 | + return new RomanDate(array($y, $m, $d)); |
|
186 | + default: |
|
187 | + throw new \DomainException('Invalid calendar'); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -291,42 +291,42 @@ discard block |
||
291 | 291 | |
292 | 292 | // Localise the date |
293 | 293 | switch ($q1 . $q2) { |
294 | - case '': |
|
295 | - $tmp = $d1 . $conv1; |
|
296 | - break; |
|
297 | - case 'ABT': |
|
298 | - $tmp = /* I18N: Gedcom ABT dates */ I18N::translate('about %s', $d1 . $conv1); |
|
299 | - break; |
|
300 | - case 'CAL': |
|
301 | - $tmp = /* I18N: Gedcom CAL dates */ I18N::translate('calculated %s', $d1 . $conv1); |
|
302 | - break; |
|
303 | - case 'EST': |
|
304 | - $tmp = /* I18N: Gedcom EST dates */ I18N::translate('estimated %s', $d1 . $conv1); |
|
305 | - break; |
|
306 | - case 'INT': |
|
307 | - $tmp = /* I18N: Gedcom INT dates */ I18N::translate('interpreted %s (%s)', $d1 . $conv1, Filter::escapeHtml($this->text)); |
|
308 | - break; |
|
309 | - case 'BEF': |
|
310 | - $tmp = /* I18N: Gedcom BEF dates */ I18N::translate('before %s', $d1 . $conv1); |
|
311 | - break; |
|
312 | - case 'AFT': |
|
313 | - $tmp = /* I18N: Gedcom AFT dates */ I18N::translate('after %s', $d1 . $conv1); |
|
314 | - break; |
|
315 | - case 'FROM': |
|
316 | - $tmp = /* I18N: Gedcom FROM dates */ I18N::translate('from %s', $d1 . $conv1); |
|
317 | - break; |
|
318 | - case 'TO': |
|
319 | - $tmp = /* I18N: Gedcom TO dates */ I18N::translate('to %s', $d1 . $conv1); |
|
320 | - break; |
|
321 | - case 'BETAND': |
|
322 | - $tmp = /* I18N: Gedcom BET-AND dates */ I18N::translate('between %s and %s', $d1 . $conv1, $d2 . $conv2); |
|
323 | - break; |
|
324 | - case 'FROMTO': |
|
325 | - $tmp = /* I18N: Gedcom FROM-TO dates */ I18N::translate('from %s to %s', $d1 . $conv1, $d2 . $conv2); |
|
326 | - break; |
|
327 | - default: |
|
328 | - $tmp = I18N::translate('Invalid date'); |
|
329 | - break; // e.g. BET without AND |
|
294 | + case '': |
|
295 | + $tmp = $d1 . $conv1; |
|
296 | + break; |
|
297 | + case 'ABT': |
|
298 | + $tmp = /* I18N: Gedcom ABT dates */ I18N::translate('about %s', $d1 . $conv1); |
|
299 | + break; |
|
300 | + case 'CAL': |
|
301 | + $tmp = /* I18N: Gedcom CAL dates */ I18N::translate('calculated %s', $d1 . $conv1); |
|
302 | + break; |
|
303 | + case 'EST': |
|
304 | + $tmp = /* I18N: Gedcom EST dates */ I18N::translate('estimated %s', $d1 . $conv1); |
|
305 | + break; |
|
306 | + case 'INT': |
|
307 | + $tmp = /* I18N: Gedcom INT dates */ I18N::translate('interpreted %s (%s)', $d1 . $conv1, Filter::escapeHtml($this->text)); |
|
308 | + break; |
|
309 | + case 'BEF': |
|
310 | + $tmp = /* I18N: Gedcom BEF dates */ I18N::translate('before %s', $d1 . $conv1); |
|
311 | + break; |
|
312 | + case 'AFT': |
|
313 | + $tmp = /* I18N: Gedcom AFT dates */ I18N::translate('after %s', $d1 . $conv1); |
|
314 | + break; |
|
315 | + case 'FROM': |
|
316 | + $tmp = /* I18N: Gedcom FROM dates */ I18N::translate('from %s', $d1 . $conv1); |
|
317 | + break; |
|
318 | + case 'TO': |
|
319 | + $tmp = /* I18N: Gedcom TO dates */ I18N::translate('to %s', $d1 . $conv1); |
|
320 | + break; |
|
321 | + case 'BETAND': |
|
322 | + $tmp = /* I18N: Gedcom BET-AND dates */ I18N::translate('between %s and %s', $d1 . $conv1, $d2 . $conv2); |
|
323 | + break; |
|
324 | + case 'FROMTO': |
|
325 | + $tmp = /* I18N: Gedcom FROM-TO dates */ I18N::translate('from %s to %s', $d1 . $conv1, $d2 . $conv2); |
|
326 | + break; |
|
327 | + default: |
|
328 | + $tmp = I18N::translate('Invalid date'); |
|
329 | + break; // e.g. BET without AND |
|
330 | 330 | } |
331 | 331 | if ($this->text && !$q1) { |
332 | 332 | $tmp = I18N::translate('%1$s (%2$s)', $tmp, $this->text); |
@@ -445,33 +445,33 @@ discard block |
||
445 | 445 | } |
446 | 446 | |
447 | 447 | switch ($format) { |
448 | - case 0: |
|
449 | - // Years - integer only (for statistics, rather than for display) |
|
450 | - if ($jd && $d1->minimumJulianDay() && $d1->minimumJulianDay() <= $jd) { |
|
451 | - return $d1->minimumDate()->getAge(false, $jd, false); |
|
452 | - } else { |
|
453 | - return -1; |
|
454 | - } |
|
455 | - case 1: |
|
456 | - // Days - integer only (for sorting, rather than for display) |
|
457 | - if ($jd && $d1->minimumJulianDay()) { |
|
458 | - return $jd - $d1->minimumJulianDay(); |
|
459 | - } else { |
|
460 | - return -1; |
|
461 | - } |
|
462 | - case 2: |
|
463 | - // Just years, in local digits, with warning for negative/ |
|
464 | - if ($jd && $d1->minimumJulianDay()) { |
|
465 | - if ($d1->minimumJulianDay() > $jd) { |
|
466 | - return '<i class="icon-warning"></i>'; |
|
448 | + case 0: |
|
449 | + // Years - integer only (for statistics, rather than for display) |
|
450 | + if ($jd && $d1->minimumJulianDay() && $d1->minimumJulianDay() <= $jd) { |
|
451 | + return $d1->minimumDate()->getAge(false, $jd, false); |
|
467 | 452 | } else { |
468 | - return I18N::number($d1->minimumDate()->getAge(false, $jd)); |
|
453 | + return -1; |
|
469 | 454 | } |
470 | - } else { |
|
471 | - return ''; |
|
472 | - } |
|
473 | - default: |
|
474 | - throw new \InvalidArgumentException('format: ' . $format); |
|
455 | + case 1: |
|
456 | + // Days - integer only (for sorting, rather than for display) |
|
457 | + if ($jd && $d1->minimumJulianDay()) { |
|
458 | + return $jd - $d1->minimumJulianDay(); |
|
459 | + } else { |
|
460 | + return -1; |
|
461 | + } |
|
462 | + case 2: |
|
463 | + // Just years, in local digits, with warning for negative/ |
|
464 | + if ($jd && $d1->minimumJulianDay()) { |
|
465 | + if ($d1->minimumJulianDay() > $jd) { |
|
466 | + return '<i class="icon-warning"></i>'; |
|
467 | + } else { |
|
468 | + return I18N::number($d1->minimumDate()->getAge(false, $jd)); |
|
469 | + } |
|
470 | + } else { |
|
471 | + return ''; |
|
472 | + } |
|
473 | + default: |
|
474 | + throw new \InvalidArgumentException('format: ' . $format); |
|
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
@@ -515,32 +515,32 @@ discard block |
||
515 | 515 | public static function compare(Date $a, Date $b) { |
516 | 516 | // Get min/max JD for each date. |
517 | 517 | switch ($a->qual1) { |
518 | - case 'BEF': |
|
519 | - $amin = $a->minimumJulianDay() - 1; |
|
520 | - $amax = $amin; |
|
521 | - break; |
|
522 | - case 'AFT': |
|
523 | - $amax = $a->maximumJulianDay() + 1; |
|
524 | - $amin = $amax; |
|
525 | - break; |
|
526 | - default: |
|
527 | - $amin = $a->minimumJulianDay(); |
|
528 | - $amax = $a->maximumJulianDay(); |
|
529 | - break; |
|
518 | + case 'BEF': |
|
519 | + $amin = $a->minimumJulianDay() - 1; |
|
520 | + $amax = $amin; |
|
521 | + break; |
|
522 | + case 'AFT': |
|
523 | + $amax = $a->maximumJulianDay() + 1; |
|
524 | + $amin = $amax; |
|
525 | + break; |
|
526 | + default: |
|
527 | + $amin = $a->minimumJulianDay(); |
|
528 | + $amax = $a->maximumJulianDay(); |
|
529 | + break; |
|
530 | 530 | } |
531 | 531 | switch ($b->qual1) { |
532 | - case 'BEF': |
|
533 | - $bmin = $b->minimumJulianDay() - 1; |
|
534 | - $bmax = $bmin; |
|
535 | - break; |
|
536 | - case 'AFT': |
|
537 | - $bmax = $b->maximumJulianDay() + 1; |
|
538 | - $bmin = $bmax; |
|
539 | - break; |
|
540 | - default: |
|
541 | - $bmin = $b->minimumJulianDay(); |
|
542 | - $bmax = $b->maximumJulianDay(); |
|
543 | - break; |
|
532 | + case 'BEF': |
|
533 | + $bmin = $b->minimumJulianDay() - 1; |
|
534 | + $bmax = $bmin; |
|
535 | + break; |
|
536 | + case 'AFT': |
|
537 | + $bmax = $b->maximumJulianDay() + 1; |
|
538 | + $bmin = $bmax; |
|
539 | + break; |
|
540 | + default: |
|
541 | + $bmin = $b->minimumJulianDay(); |
|
542 | + $bmax = $b->maximumJulianDay(); |
|
543 | + break; |
|
544 | 544 | } |
545 | 545 | if ($amax < $bmin) { |
546 | 546 | return -1; |