@@ -24,71 +24,71 @@ |
||
24 | 24 | * Class UserWelcomeModule |
25 | 25 | */ |
26 | 26 | class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface { |
27 | - /** {@inheritdoc} */ |
|
28 | - public function getTitle() { |
|
29 | - return /* I18N: Name of a module */ I18N::translate('My page'); |
|
30 | - } |
|
27 | + /** {@inheritdoc} */ |
|
28 | + public function getTitle() { |
|
29 | + return /* I18N: Name of a module */ I18N::translate('My page'); |
|
30 | + } |
|
31 | 31 | |
32 | - /** {@inheritdoc} */ |
|
33 | - public function getDescription() { |
|
34 | - return /* I18N: Description of the “My page” module */ I18N::translate('A greeting message and useful links for a user.'); |
|
35 | - } |
|
32 | + /** {@inheritdoc} */ |
|
33 | + public function getDescription() { |
|
34 | + return /* I18N: Description of the “My page” module */ I18N::translate('A greeting message and useful links for a user.'); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Generate the HTML content of this block. |
|
39 | - * |
|
40 | - * @param int $block_id |
|
41 | - * @param bool $template |
|
42 | - * @param string[] $cfg |
|
43 | - * |
|
44 | - * @return string |
|
45 | - */ |
|
46 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
47 | - global $WT_TREE; |
|
37 | + /** |
|
38 | + * Generate the HTML content of this block. |
|
39 | + * |
|
40 | + * @param int $block_id |
|
41 | + * @param bool $template |
|
42 | + * @param string[] $cfg |
|
43 | + * |
|
44 | + * @return string |
|
45 | + */ |
|
46 | + public function getBlock($block_id, $template = true, $cfg = array()) { |
|
47 | + global $WT_TREE; |
|
48 | 48 | |
49 | - $id = $this->getName() . $block_id; |
|
50 | - $class = $this->getName() . '_block'; |
|
51 | - $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>'; |
|
52 | - $content = '<table><tr>'; |
|
53 | - $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>'; |
|
49 | + $id = $this->getName() . $block_id; |
|
50 | + $class = $this->getName() . '_block'; |
|
51 | + $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>'; |
|
52 | + $content = '<table><tr>'; |
|
53 | + $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>'; |
|
54 | 54 | |
55 | - $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid'); |
|
55 | + $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid'); |
|
56 | 56 | |
57 | - if ($gedcomid) { |
|
58 | - if (Module::isActiveChart($WT_TREE, 'pedigree_chart')) { |
|
59 | - $content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>'; |
|
60 | - } |
|
61 | - $content .= '<td><a href="individual.php?pid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>'; |
|
62 | - } |
|
63 | - $content .= '</tr></table>'; |
|
57 | + if ($gedcomid) { |
|
58 | + if (Module::isActiveChart($WT_TREE, 'pedigree_chart')) { |
|
59 | + $content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>'; |
|
60 | + } |
|
61 | + $content .= '<td><a href="individual.php?pid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>'; |
|
62 | + } |
|
63 | + $content .= '</tr></table>'; |
|
64 | 64 | |
65 | - if ($template) { |
|
66 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
67 | - } else { |
|
68 | - return $content; |
|
69 | - } |
|
70 | - } |
|
65 | + if ($template) { |
|
66 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
67 | + } else { |
|
68 | + return $content; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - /** {@inheritdoc} */ |
|
73 | - public function loadAjax() { |
|
74 | - return false; |
|
75 | - } |
|
72 | + /** {@inheritdoc} */ |
|
73 | + public function loadAjax() { |
|
74 | + return false; |
|
75 | + } |
|
76 | 76 | |
77 | - /** {@inheritdoc} */ |
|
78 | - public function isUserBlock() { |
|
79 | - return true; |
|
80 | - } |
|
77 | + /** {@inheritdoc} */ |
|
78 | + public function isUserBlock() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** {@inheritdoc} */ |
|
83 | - public function isGedcomBlock() { |
|
84 | - return false; |
|
85 | - } |
|
82 | + /** {@inheritdoc} */ |
|
83 | + public function isGedcomBlock() { |
|
84 | + return false; |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * An HTML form to edit block settings |
|
89 | - * |
|
90 | - * @param int $block_id |
|
91 | - */ |
|
92 | - public function configureBlock($block_id) { |
|
93 | - } |
|
87 | + /** |
|
88 | + * An HTML form to edit block settings |
|
89 | + * |
|
90 | + * @param int $block_id |
|
91 | + */ |
|
92 | + public function configureBlock($block_id) { |
|
93 | + } |
|
94 | 94 | } |
@@ -23,14 +23,17 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class UserWelcomeModule |
25 | 25 | */ |
26 | -class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface { |
|
26 | +class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface |
|
27 | +{ |
|
27 | 28 | /** {@inheritdoc} */ |
28 | - public function getTitle() { |
|
29 | + public function getTitle() |
|
30 | + { |
|
29 | 31 | return /* I18N: Name of a module */ I18N::translate('My page'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | return /* I18N: Description of the “My page” module */ I18N::translate('A greeting message and useful links for a user.'); |
35 | 38 | } |
36 | 39 | |
@@ -43,7 +46,8 @@ discard block |
||
43 | 46 | * |
44 | 47 | * @return string |
45 | 48 | */ |
46 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
49 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
50 | + { |
|
47 | 51 | global $WT_TREE; |
48 | 52 | |
49 | 53 | $id = $this->getName() . $block_id; |
@@ -70,17 +74,20 @@ discard block |
||
70 | 74 | } |
71 | 75 | |
72 | 76 | /** {@inheritdoc} */ |
73 | - public function loadAjax() { |
|
77 | + public function loadAjax() |
|
78 | + { |
|
74 | 79 | return false; |
75 | 80 | } |
76 | 81 | |
77 | 82 | /** {@inheritdoc} */ |
78 | - public function isUserBlock() { |
|
83 | + public function isUserBlock() |
|
84 | + { |
|
79 | 85 | return true; |
80 | 86 | } |
81 | 87 | |
82 | 88 | /** {@inheritdoc} */ |
83 | - public function isGedcomBlock() { |
|
89 | + public function isGedcomBlock() |
|
90 | + { |
|
84 | 91 | return false; |
85 | 92 | } |
86 | 93 | |
@@ -89,6 +96,7 @@ discard block |
||
89 | 96 | * |
90 | 97 | * @param int $block_id |
91 | 98 | */ |
92 | - public function configureBlock($block_id) { |
|
99 | + public function configureBlock($block_id) |
|
100 | + { |
|
93 | 101 | } |
94 | 102 | } |
@@ -28,162 +28,162 @@ |
||
28 | 28 | * Class UserMessagesModule |
29 | 29 | */ |
30 | 30 | class UserMessagesModule extends AbstractModule implements ModuleBlockInterface { |
31 | - /** {@inheritdoc} */ |
|
32 | - public function getTitle() { |
|
33 | - return /* I18N: Name of a module */ I18N::translate('Messages'); |
|
34 | - } |
|
35 | - |
|
36 | - /** {@inheritdoc} */ |
|
37 | - public function getDescription() { |
|
38 | - return /* I18N: Description of the “Messages” module */ I18N::translate('Communicate directly with other users, using private messages.'); |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * This is a general purpose hook, allowing modules to respond to routes |
|
43 | - * of the form module.php?mod=FOO&mod_action=BAR |
|
44 | - * |
|
45 | - * @param string $mod_action |
|
46 | - */ |
|
47 | - public function modAction($mod_action) { |
|
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 | - } |
|
58 | - } |
|
59 | - |
|
60 | - $ged = Filter::post('ged'); |
|
61 | - $ctype = Filter::post('ctype', 'user|gedcom', 'user'); |
|
62 | - |
|
63 | - header('Location: ' . WT_BASE_URL . 'index.php?ged=' . Filter::escapeUrl($ged) . '&ctype=' . $ctype); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * Generate the HTML content of this block. |
|
68 | - * |
|
69 | - * @param int $block_id |
|
70 | - * @param bool $template |
|
71 | - * @param string[] $cfg |
|
72 | - * |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
76 | - global $ctype, $WT_TREE; |
|
77 | - |
|
78 | - $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
79 | - foreach (array('block') as $name) { |
|
80 | - if (array_key_exists($name, $cfg)) { |
|
81 | - $$name = $cfg[$name]; |
|
82 | - } |
|
83 | - } |
|
84 | - $messages = Database::prepare("SELECT message_id, sender, subject, body, UNIX_TIMESTAMP(created) AS created FROM `##message` WHERE user_id=? ORDER BY message_id DESC") |
|
85 | - ->execute(array(Auth::id())) |
|
86 | - ->fetchAll(); |
|
87 | - |
|
88 | - $count = count($messages); |
|
89 | - $id = $this->getName() . $block_id; |
|
90 | - $class = $this->getName() . '_block'; |
|
91 | - $title = I18N::plural('%s message', '%s messages', $count, I18N::number($count)); |
|
92 | - $users = array_filter(User::all(), function (User $user) { |
|
93 | - return $user->getUserId() !== Auth::id() && $user->getPreference('verified_by_admin') && $user->getPreference('contactmethod') !== 'none'; |
|
94 | - }); |
|
95 | - |
|
96 | - $content = '<form id="messageform" name="messageform" method="post" action="module.php?mod=user_messages&mod_action=delete" onsubmit="return confirm(\'' . I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.') . '\');">'; |
|
97 | - $content .= '<input type="hidden" name="ged" value="' . $ctype . '">'; |
|
98 | - $content .= '<input type="hidden" name="ctype" value="' . $WT_TREE->getNameHtml() . '">'; |
|
99 | - if ($users) { |
|
100 | - $content .= '<label for="touser">' . I18N::translate('Send a message') . '</label>'; |
|
101 | - $content .= '<select id="touser" name="touser">'; |
|
102 | - $content .= '<option value="">' . I18N::translate('<select>') . '</option>'; |
|
103 | - foreach ($users as $user) { |
|
104 | - $content .= sprintf('<option value="%1$s">%2$s - %1$s</option>', Filter::escapeHtml($user->getUserName()), Filter::escapeHtml($user->getRealName())); |
|
105 | - } |
|
106 | - $content .= '</select>'; |
|
107 | - $content .= '<input type="button" value="' . I18N::translate('Send') . '" onclick="return message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, \'messaging2\', \'\');"><br><br>'; |
|
108 | - } |
|
109 | - if ($messages) { |
|
110 | - $content .= '<table class="list_table"><tr>'; |
|
111 | - $content .= '<th class="list_label">' . I18N::translate('Delete') . '<br><a href="#" onclick="jQuery(\'#' . $this->getName() . $block_id . ' :checkbox\').prop(\'checked\', true); return false;">' . I18N::translate('All') . '</a></th>'; |
|
112 | - $content .= '<th class="list_label">' . I18N::translate('Subject') . '</th>'; |
|
113 | - $content .= '<th class="list_label">' . I18N::translate('Date sent') . '</th>'; |
|
114 | - $content .= '<th class="list_label">' . I18N::translate('Email address') . '</th>'; |
|
115 | - $content .= '</tr>'; |
|
116 | - foreach ($messages as $message) { |
|
117 | - $content .= '<tr>'; |
|
118 | - $content .= '<td class="list_value_wrap"><input type="checkbox" name="message_id[]" value="' . $message->message_id . '" id="cb_message' . $message->message_id . '"></td>'; |
|
119 | - $content .= '<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message' . $message->message_id . '\');"><i id="message' . $message->message_id . '_img" class="icon-plus"></i> <b dir="auto">' . Filter::escapeHtml($message->subject) . '</b></a></td>'; |
|
120 | - $content .= '<td class="list_value_wrap">' . FunctionsDate::formatTimestamp($message->created + WT_TIMESTAMP_OFFSET) . '</td>'; |
|
121 | - $content .= '<td class="list_value_wrap">'; |
|
122 | - $user = User::findByIdentifier($message->sender); |
|
123 | - if ($user) { |
|
124 | - $content .= $user->getRealNameHtml(); |
|
125 | - $content .= ' - <span dir="auto">' . $user->getEmail() . '</span>'; |
|
126 | - } else { |
|
127 | - $content .= '<a href="mailto:' . Filter::escapeHtml($message->sender) . '">' . Filter::escapeHtml($message->sender) . '</a>'; |
|
128 | - } |
|
129 | - $content .= '</td>'; |
|
130 | - $content .= '</tr>'; |
|
131 | - $content .= '<tr><td class="list_value_wrap" colspan="4"><div id="message' . $message->message_id . '" style="display:none;">'; |
|
132 | - $content .= '<div dir="auto" style="white-space: pre-wrap;">' . Filter::expandUrls($message->body) . '</div><br>'; |
|
133 | - if (strpos($message->subject, /* I18N: When replying to an email, the subject becomes “RE: <subject>” */ I18N::translate('RE: ')) !== 0) { |
|
134 | - $message->subject = I18N::translate('RE: ') . $message->subject; |
|
135 | - } |
|
136 | - if ($user) { |
|
137 | - $content .= '<button type="button" onclick="reply(\'' . Filter::escapeJs($message->sender) . '\', \'' . Filter::escapeJs($message->subject) . '\'); return false;">' . I18N::translate('Reply') . '</button> '; |
|
138 | - } |
|
139 | - $content .= '<button type="button" onclick="if (confirm(\'' . I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.') . '\')) {jQuery(\'#messageform :checkbox\').prop(\'checked\', false); jQuery(\'#cb_message' . $message->message_id . '\').prop(\'checked\', true); document.messageform.submit();}">' . I18N::translate('Delete') . '</button></div></td></tr>'; |
|
140 | - } |
|
141 | - $content .= '</table>'; |
|
142 | - $content .= '<p><button type="submit">' . I18N::translate('Delete selected messages') . '</button></p>'; |
|
143 | - } |
|
144 | - $content .= '</form>'; |
|
145 | - |
|
146 | - if ($template) { |
|
147 | - if ($block) { |
|
148 | - $class .= ' small_inner_block'; |
|
149 | - } |
|
150 | - |
|
151 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
152 | - } else { |
|
153 | - return $content; |
|
154 | - } |
|
155 | - } |
|
156 | - |
|
157 | - /** {@inheritdoc} */ |
|
158 | - public function loadAjax() { |
|
159 | - return false; |
|
160 | - } |
|
161 | - |
|
162 | - /** {@inheritdoc} */ |
|
163 | - public function isUserBlock() { |
|
164 | - return true; |
|
165 | - } |
|
166 | - |
|
167 | - /** {@inheritdoc} */ |
|
168 | - public function isGedcomBlock() { |
|
169 | - return false; |
|
170 | - } |
|
171 | - |
|
172 | - /** |
|
173 | - * An HTML form to edit block settings |
|
174 | - * |
|
175 | - * @param int $block_id |
|
176 | - */ |
|
177 | - public function configureBlock($block_id) { |
|
178 | - if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
179 | - $this->setBlockSetting($block_id, 'block', Filter::postBool('block')); |
|
180 | - } |
|
181 | - |
|
182 | - $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
183 | - echo '<tr><td class="descriptionbox wrap width33">'; |
|
184 | - echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow'); |
|
185 | - echo '</td><td class="optionbox">'; |
|
186 | - echo FunctionsEdit::editFieldYesNo('block', $block); |
|
187 | - echo '</td></tr>'; |
|
188 | - } |
|
31 | + /** {@inheritdoc} */ |
|
32 | + public function getTitle() { |
|
33 | + return /* I18N: Name of a module */ I18N::translate('Messages'); |
|
34 | + } |
|
35 | + |
|
36 | + /** {@inheritdoc} */ |
|
37 | + public function getDescription() { |
|
38 | + return /* I18N: Description of the “Messages” module */ I18N::translate('Communicate directly with other users, using private messages.'); |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * This is a general purpose hook, allowing modules to respond to routes |
|
43 | + * of the form module.php?mod=FOO&mod_action=BAR |
|
44 | + * |
|
45 | + * @param string $mod_action |
|
46 | + */ |
|
47 | + public function modAction($mod_action) { |
|
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 | + } |
|
58 | + } |
|
59 | + |
|
60 | + $ged = Filter::post('ged'); |
|
61 | + $ctype = Filter::post('ctype', 'user|gedcom', 'user'); |
|
62 | + |
|
63 | + header('Location: ' . WT_BASE_URL . 'index.php?ged=' . Filter::escapeUrl($ged) . '&ctype=' . $ctype); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * Generate the HTML content of this block. |
|
68 | + * |
|
69 | + * @param int $block_id |
|
70 | + * @param bool $template |
|
71 | + * @param string[] $cfg |
|
72 | + * |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public function getBlock($block_id, $template = true, $cfg = array()) { |
|
76 | + global $ctype, $WT_TREE; |
|
77 | + |
|
78 | + $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
79 | + foreach (array('block') as $name) { |
|
80 | + if (array_key_exists($name, $cfg)) { |
|
81 | + $$name = $cfg[$name]; |
|
82 | + } |
|
83 | + } |
|
84 | + $messages = Database::prepare("SELECT message_id, sender, subject, body, UNIX_TIMESTAMP(created) AS created FROM `##message` WHERE user_id=? ORDER BY message_id DESC") |
|
85 | + ->execute(array(Auth::id())) |
|
86 | + ->fetchAll(); |
|
87 | + |
|
88 | + $count = count($messages); |
|
89 | + $id = $this->getName() . $block_id; |
|
90 | + $class = $this->getName() . '_block'; |
|
91 | + $title = I18N::plural('%s message', '%s messages', $count, I18N::number($count)); |
|
92 | + $users = array_filter(User::all(), function (User $user) { |
|
93 | + return $user->getUserId() !== Auth::id() && $user->getPreference('verified_by_admin') && $user->getPreference('contactmethod') !== 'none'; |
|
94 | + }); |
|
95 | + |
|
96 | + $content = '<form id="messageform" name="messageform" method="post" action="module.php?mod=user_messages&mod_action=delete" onsubmit="return confirm(\'' . I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.') . '\');">'; |
|
97 | + $content .= '<input type="hidden" name="ged" value="' . $ctype . '">'; |
|
98 | + $content .= '<input type="hidden" name="ctype" value="' . $WT_TREE->getNameHtml() . '">'; |
|
99 | + if ($users) { |
|
100 | + $content .= '<label for="touser">' . I18N::translate('Send a message') . '</label>'; |
|
101 | + $content .= '<select id="touser" name="touser">'; |
|
102 | + $content .= '<option value="">' . I18N::translate('<select>') . '</option>'; |
|
103 | + foreach ($users as $user) { |
|
104 | + $content .= sprintf('<option value="%1$s">%2$s - %1$s</option>', Filter::escapeHtml($user->getUserName()), Filter::escapeHtml($user->getRealName())); |
|
105 | + } |
|
106 | + $content .= '</select>'; |
|
107 | + $content .= '<input type="button" value="' . I18N::translate('Send') . '" onclick="return message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, \'messaging2\', \'\');"><br><br>'; |
|
108 | + } |
|
109 | + if ($messages) { |
|
110 | + $content .= '<table class="list_table"><tr>'; |
|
111 | + $content .= '<th class="list_label">' . I18N::translate('Delete') . '<br><a href="#" onclick="jQuery(\'#' . $this->getName() . $block_id . ' :checkbox\').prop(\'checked\', true); return false;">' . I18N::translate('All') . '</a></th>'; |
|
112 | + $content .= '<th class="list_label">' . I18N::translate('Subject') . '</th>'; |
|
113 | + $content .= '<th class="list_label">' . I18N::translate('Date sent') . '</th>'; |
|
114 | + $content .= '<th class="list_label">' . I18N::translate('Email address') . '</th>'; |
|
115 | + $content .= '</tr>'; |
|
116 | + foreach ($messages as $message) { |
|
117 | + $content .= '<tr>'; |
|
118 | + $content .= '<td class="list_value_wrap"><input type="checkbox" name="message_id[]" value="' . $message->message_id . '" id="cb_message' . $message->message_id . '"></td>'; |
|
119 | + $content .= '<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message' . $message->message_id . '\');"><i id="message' . $message->message_id . '_img" class="icon-plus"></i> <b dir="auto">' . Filter::escapeHtml($message->subject) . '</b></a></td>'; |
|
120 | + $content .= '<td class="list_value_wrap">' . FunctionsDate::formatTimestamp($message->created + WT_TIMESTAMP_OFFSET) . '</td>'; |
|
121 | + $content .= '<td class="list_value_wrap">'; |
|
122 | + $user = User::findByIdentifier($message->sender); |
|
123 | + if ($user) { |
|
124 | + $content .= $user->getRealNameHtml(); |
|
125 | + $content .= ' - <span dir="auto">' . $user->getEmail() . '</span>'; |
|
126 | + } else { |
|
127 | + $content .= '<a href="mailto:' . Filter::escapeHtml($message->sender) . '">' . Filter::escapeHtml($message->sender) . '</a>'; |
|
128 | + } |
|
129 | + $content .= '</td>'; |
|
130 | + $content .= '</tr>'; |
|
131 | + $content .= '<tr><td class="list_value_wrap" colspan="4"><div id="message' . $message->message_id . '" style="display:none;">'; |
|
132 | + $content .= '<div dir="auto" style="white-space: pre-wrap;">' . Filter::expandUrls($message->body) . '</div><br>'; |
|
133 | + if (strpos($message->subject, /* I18N: When replying to an email, the subject becomes “RE: <subject>” */ I18N::translate('RE: ')) !== 0) { |
|
134 | + $message->subject = I18N::translate('RE: ') . $message->subject; |
|
135 | + } |
|
136 | + if ($user) { |
|
137 | + $content .= '<button type="button" onclick="reply(\'' . Filter::escapeJs($message->sender) . '\', \'' . Filter::escapeJs($message->subject) . '\'); return false;">' . I18N::translate('Reply') . '</button> '; |
|
138 | + } |
|
139 | + $content .= '<button type="button" onclick="if (confirm(\'' . I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.') . '\')) {jQuery(\'#messageform :checkbox\').prop(\'checked\', false); jQuery(\'#cb_message' . $message->message_id . '\').prop(\'checked\', true); document.messageform.submit();}">' . I18N::translate('Delete') . '</button></div></td></tr>'; |
|
140 | + } |
|
141 | + $content .= '</table>'; |
|
142 | + $content .= '<p><button type="submit">' . I18N::translate('Delete selected messages') . '</button></p>'; |
|
143 | + } |
|
144 | + $content .= '</form>'; |
|
145 | + |
|
146 | + if ($template) { |
|
147 | + if ($block) { |
|
148 | + $class .= ' small_inner_block'; |
|
149 | + } |
|
150 | + |
|
151 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
152 | + } else { |
|
153 | + return $content; |
|
154 | + } |
|
155 | + } |
|
156 | + |
|
157 | + /** {@inheritdoc} */ |
|
158 | + public function loadAjax() { |
|
159 | + return false; |
|
160 | + } |
|
161 | + |
|
162 | + /** {@inheritdoc} */ |
|
163 | + public function isUserBlock() { |
|
164 | + return true; |
|
165 | + } |
|
166 | + |
|
167 | + /** {@inheritdoc} */ |
|
168 | + public function isGedcomBlock() { |
|
169 | + return false; |
|
170 | + } |
|
171 | + |
|
172 | + /** |
|
173 | + * An HTML form to edit block settings |
|
174 | + * |
|
175 | + * @param int $block_id |
|
176 | + */ |
|
177 | + public function configureBlock($block_id) { |
|
178 | + if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
179 | + $this->setBlockSetting($block_id, 'block', Filter::postBool('block')); |
|
180 | + } |
|
181 | + |
|
182 | + $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
183 | + echo '<tr><td class="descriptionbox wrap width33">'; |
|
184 | + echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow'); |
|
185 | + echo '</td><td class="optionbox">'; |
|
186 | + echo FunctionsEdit::editFieldYesNo('block', $block); |
|
187 | + echo '</td></tr>'; |
|
188 | + } |
|
189 | 189 | } |
@@ -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'); |
@@ -27,14 +27,17 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Class UserMessagesModule |
29 | 29 | */ |
30 | -class UserMessagesModule extends AbstractModule implements ModuleBlockInterface { |
|
30 | +class UserMessagesModule extends AbstractModule implements ModuleBlockInterface |
|
31 | +{ |
|
31 | 32 | /** {@inheritdoc} */ |
32 | - public function getTitle() { |
|
33 | + public function getTitle() |
|
34 | + { |
|
33 | 35 | return /* I18N: Name of a module */ I18N::translate('Messages'); |
34 | 36 | } |
35 | 37 | |
36 | 38 | /** {@inheritdoc} */ |
37 | - public function getDescription() { |
|
39 | + public function getDescription() |
|
40 | + { |
|
38 | 41 | return /* I18N: Description of the “Messages” module */ I18N::translate('Communicate directly with other users, using private messages.'); |
39 | 42 | } |
40 | 43 | |
@@ -44,7 +47,8 @@ discard block |
||
44 | 47 | * |
45 | 48 | * @param string $mod_action |
46 | 49 | */ |
47 | - public function modAction($mod_action) { |
|
50 | + public function modAction($mod_action) |
|
51 | + { |
|
48 | 52 | switch ($mod_action) { |
49 | 53 | case 'delete': |
50 | 54 | $stmt = Database::prepare("DELETE FROM `##message` WHERE user_id = :user_id AND message_id = :message_id"); |
@@ -72,7 +76,8 @@ discard block |
||
72 | 76 | * |
73 | 77 | * @return string |
74 | 78 | */ |
75 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
79 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
80 | + { |
|
76 | 81 | global $ctype, $WT_TREE; |
77 | 82 | |
78 | 83 | $block = $this->getBlockSetting($block_id, 'block', '1'); |
@@ -155,17 +160,20 @@ discard block |
||
155 | 160 | } |
156 | 161 | |
157 | 162 | /** {@inheritdoc} */ |
158 | - public function loadAjax() { |
|
163 | + public function loadAjax() |
|
164 | + { |
|
159 | 165 | return false; |
160 | 166 | } |
161 | 167 | |
162 | 168 | /** {@inheritdoc} */ |
163 | - public function isUserBlock() { |
|
169 | + public function isUserBlock() |
|
170 | + { |
|
164 | 171 | return true; |
165 | 172 | } |
166 | 173 | |
167 | 174 | /** {@inheritdoc} */ |
168 | - public function isGedcomBlock() { |
|
175 | + public function isGedcomBlock() |
|
176 | + { |
|
169 | 177 | return false; |
170 | 178 | } |
171 | 179 | |
@@ -174,7 +182,8 @@ discard block |
||
174 | 182 | * |
175 | 183 | * @param int $block_id |
176 | 184 | */ |
177 | - public function configureBlock($block_id) { |
|
185 | + public function configureBlock($block_id) |
|
186 | + { |
|
178 | 187 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
179 | 188 | $this->setBlockSetting($block_id, 'block', Filter::postBool('block')); |
180 | 189 | } |
@@ -23,42 +23,42 @@ |
||
23 | 23 | * Class RelatedIndividualsReportModule |
24 | 24 | */ |
25 | 25 | class RelatedIndividualsReportModule extends AbstractModule implements ModuleReportInterface { |
26 | - /** {@inheritdoc} */ |
|
27 | - public function getTitle() { |
|
28 | - // This text also appears in the .XML file - update both together |
|
29 | - return /* I18N: Name of a report */ I18N::translate('Related individuals'); |
|
30 | - } |
|
26 | + /** {@inheritdoc} */ |
|
27 | + public function getTitle() { |
|
28 | + // This text also appears in the .XML file - update both together |
|
29 | + return /* I18N: Name of a report */ I18N::translate('Related individuals'); |
|
30 | + } |
|
31 | 31 | |
32 | - /** {@inheritdoc} */ |
|
33 | - public function getDescription() { |
|
34 | - // This text also appears in the .XML file - update both together |
|
35 | - return /* I18N: Description of the “Related individuals” module */ I18N::translate('A report of the individuals that are closely related to an individual.'); |
|
36 | - } |
|
32 | + /** {@inheritdoc} */ |
|
33 | + public function getDescription() { |
|
34 | + // This text also appears in the .XML file - update both together |
|
35 | + return /* I18N: Description of the “Related individuals” module */ I18N::translate('A report of the individuals that are closely related to an individual.'); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * What is the default access level for this module? |
|
40 | - * |
|
41 | - * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
42 | - * |
|
43 | - * @return int |
|
44 | - */ |
|
45 | - public function defaultAccessLevel() { |
|
46 | - return Auth::PRIV_PRIVATE; |
|
47 | - } |
|
38 | + /** |
|
39 | + * What is the default access level for this module? |
|
40 | + * |
|
41 | + * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
42 | + * |
|
43 | + * @return int |
|
44 | + */ |
|
45 | + public function defaultAccessLevel() { |
|
46 | + return Auth::PRIV_PRIVATE; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Return a menu item for this report. |
|
51 | - * |
|
52 | - * @return Menu |
|
53 | - */ |
|
54 | - public function getReportMenu() { |
|
55 | - global $controller, $WT_TREE; |
|
49 | + /** |
|
50 | + * Return a menu item for this report. |
|
51 | + * |
|
52 | + * @return Menu |
|
53 | + */ |
|
54 | + public function getReportMenu() { |
|
55 | + global $controller, $WT_TREE; |
|
56 | 56 | |
57 | - return new Menu( |
|
58 | - $this->getTitle(), |
|
59 | - 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), |
|
60 | - 'menu-report-' . $this->getName(), |
|
61 | - array('rel' => 'nofollow') |
|
62 | - ); |
|
63 | - } |
|
57 | + return new Menu( |
|
58 | + $this->getTitle(), |
|
59 | + 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&pid=' . $controller->getSignificantIndividual()->getXref(), |
|
60 | + 'menu-report-' . $this->getName(), |
|
61 | + array('rel' => 'nofollow') |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | } |
@@ -22,15 +22,18 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class RelatedIndividualsReportModule |
24 | 24 | */ |
25 | -class RelatedIndividualsReportModule extends AbstractModule implements ModuleReportInterface { |
|
25 | +class RelatedIndividualsReportModule extends AbstractModule implements ModuleReportInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | // This text also appears in the .XML file - update both together |
29 | 31 | return /* I18N: Name of a report */ I18N::translate('Related individuals'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | // This text also appears in the .XML file - update both together |
35 | 38 | return /* I18N: Description of the “Related individuals” module */ I18N::translate('A report of the individuals that are closely related to an individual.'); |
36 | 39 | } |
@@ -42,7 +45,8 @@ discard block |
||
42 | 45 | * |
43 | 46 | * @return int |
44 | 47 | */ |
45 | - public function defaultAccessLevel() { |
|
48 | + public function defaultAccessLevel() |
|
49 | + { |
|
46 | 50 | return Auth::PRIV_PRIVATE; |
47 | 51 | } |
48 | 52 | |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | * |
52 | 56 | * @return Menu |
53 | 57 | */ |
54 | - public function getReportMenu() { |
|
58 | + public function getReportMenu() |
|
59 | + { |
|
55 | 60 | global $controller, $WT_TREE; |
56 | 61 | |
57 | 62 | return new Menu( |
@@ -34,110 +34,110 @@ discard block |
||
34 | 34 | * Class CensusAssistantModule |
35 | 35 | */ |
36 | 36 | class CensusAssistantModule extends AbstractModule { |
37 | - /** {@inheritdoc} */ |
|
38 | - public function getTitle() { |
|
39 | - return /* I18N: Name of a module */ I18N::translate('Census assistant'); |
|
40 | - } |
|
41 | - |
|
42 | - /** {@inheritdoc} */ |
|
43 | - public function getDescription() { |
|
44 | - return /* I18N: Description of the “Census assistant” module */ I18N::translate('An alternative way to enter census transcripts and link them to individuals.'); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * This is a general purpose hook, allowing modules to respond to routes |
|
49 | - * of the form module.php?mod=FOO&mod_action=BAR |
|
50 | - * |
|
51 | - * @param string $mod_action |
|
52 | - */ |
|
53 | - public function modAction($mod_action) { |
|
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); |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Find an individual. |
|
71 | - */ |
|
72 | - private static function censusFind() { |
|
73 | - global $WT_TREE; |
|
74 | - |
|
75 | - $controller = new SimpleController; |
|
76 | - $filter = Filter::get('filter'); |
|
77 | - $action = Filter::get('action'); |
|
78 | - $census = Filter::get('census'); |
|
79 | - $census = new $census; |
|
80 | - |
|
81 | - $controller |
|
82 | - ->restrictAccess($census instanceof CensusInterface) |
|
83 | - ->setPageTitle(I18N::translate('Find an individual')) |
|
84 | - ->pageHeader(); |
|
85 | - |
|
86 | - echo '<table class="list_table width90" border="0">'; |
|
87 | - echo '<tr><td style="padding: 10px;" class="facts_label03 width90">'; |
|
88 | - echo I18N::translate('Find an individual'); |
|
89 | - echo '</td>'; |
|
90 | - echo '</table>'; |
|
91 | - echo '<br>'; |
|
92 | - |
|
93 | - if ($action == 'filter') { |
|
94 | - $filter = trim($filter); |
|
95 | - $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
96 | - |
|
97 | - // Output Individual for GEDFact Assistant ====================== |
|
98 | - echo '<table class="list_table width90">'; |
|
99 | - $myindilist = FunctionsDb::searchIndividualNames($filter_array, array($WT_TREE)); |
|
100 | - if ($myindilist) { |
|
101 | - echo '<tr><td class="list_value_wrap"><ul>'; |
|
102 | - usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
103 | - foreach ($myindilist as $indi) { |
|
104 | - echo '<li>'; |
|
105 | - echo '<a href="#" onclick="window.opener.appendCensusRow(\'' . Filter::escapeJs(self::censusTableRow($census, $indi, null)) . '\'); window.close();">'; |
|
106 | - echo '<b>' . $indi->getFullName() . '</b>'; |
|
107 | - echo '</a>'; |
|
108 | - echo $indi->formatFirstMajorFact(WT_EVENTS_BIRT, 1); |
|
109 | - echo $indi->formatFirstMajorFact(WT_EVENTS_DEAT, 1); |
|
110 | - echo '<hr>'; |
|
111 | - echo '</li>'; |
|
112 | - } |
|
113 | - echo '</ul></td></tr>'; |
|
114 | - } else { |
|
115 | - echo '<tr><td class="list_value_wrap">'; |
|
116 | - echo I18N::translate('No results found.'); |
|
117 | - echo '</td></tr>'; |
|
118 | - } |
|
119 | - echo '<tr><td>'; |
|
120 | - echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; |
|
121 | - echo '</td></tr>'; |
|
122 | - echo '</table>'; |
|
123 | - } |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * Find a media object. |
|
128 | - */ |
|
129 | - private static function mediaFind() { |
|
130 | - global $WT_TREE; |
|
131 | - |
|
132 | - $controller = new SimpleController; |
|
133 | - $filter = Filter::get('filter'); |
|
134 | - $multiple = Filter::getBool('multiple'); |
|
135 | - |
|
136 | - $controller |
|
137 | - ->setPageTitle(I18N::translate('Find an individual')) |
|
138 | - ->pageHeader(); |
|
139 | - |
|
140 | - ?> |
|
37 | + /** {@inheritdoc} */ |
|
38 | + public function getTitle() { |
|
39 | + return /* I18N: Name of a module */ I18N::translate('Census assistant'); |
|
40 | + } |
|
41 | + |
|
42 | + /** {@inheritdoc} */ |
|
43 | + public function getDescription() { |
|
44 | + return /* I18N: Description of the “Census assistant” module */ I18N::translate('An alternative way to enter census transcripts and link them to individuals.'); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * This is a general purpose hook, allowing modules to respond to routes |
|
49 | + * of the form module.php?mod=FOO&mod_action=BAR |
|
50 | + * |
|
51 | + * @param string $mod_action |
|
52 | + */ |
|
53 | + public function modAction($mod_action) { |
|
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); |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Find an individual. |
|
71 | + */ |
|
72 | + private static function censusFind() { |
|
73 | + global $WT_TREE; |
|
74 | + |
|
75 | + $controller = new SimpleController; |
|
76 | + $filter = Filter::get('filter'); |
|
77 | + $action = Filter::get('action'); |
|
78 | + $census = Filter::get('census'); |
|
79 | + $census = new $census; |
|
80 | + |
|
81 | + $controller |
|
82 | + ->restrictAccess($census instanceof CensusInterface) |
|
83 | + ->setPageTitle(I18N::translate('Find an individual')) |
|
84 | + ->pageHeader(); |
|
85 | + |
|
86 | + echo '<table class="list_table width90" border="0">'; |
|
87 | + echo '<tr><td style="padding: 10px;" class="facts_label03 width90">'; |
|
88 | + echo I18N::translate('Find an individual'); |
|
89 | + echo '</td>'; |
|
90 | + echo '</table>'; |
|
91 | + echo '<br>'; |
|
92 | + |
|
93 | + if ($action == 'filter') { |
|
94 | + $filter = trim($filter); |
|
95 | + $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
96 | + |
|
97 | + // Output Individual for GEDFact Assistant ====================== |
|
98 | + echo '<table class="list_table width90">'; |
|
99 | + $myindilist = FunctionsDb::searchIndividualNames($filter_array, array($WT_TREE)); |
|
100 | + if ($myindilist) { |
|
101 | + echo '<tr><td class="list_value_wrap"><ul>'; |
|
102 | + usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
103 | + foreach ($myindilist as $indi) { |
|
104 | + echo '<li>'; |
|
105 | + echo '<a href="#" onclick="window.opener.appendCensusRow(\'' . Filter::escapeJs(self::censusTableRow($census, $indi, null)) . '\'); window.close();">'; |
|
106 | + echo '<b>' . $indi->getFullName() . '</b>'; |
|
107 | + echo '</a>'; |
|
108 | + echo $indi->formatFirstMajorFact(WT_EVENTS_BIRT, 1); |
|
109 | + echo $indi->formatFirstMajorFact(WT_EVENTS_DEAT, 1); |
|
110 | + echo '<hr>'; |
|
111 | + echo '</li>'; |
|
112 | + } |
|
113 | + echo '</ul></td></tr>'; |
|
114 | + } else { |
|
115 | + echo '<tr><td class="list_value_wrap">'; |
|
116 | + echo I18N::translate('No results found.'); |
|
117 | + echo '</td></tr>'; |
|
118 | + } |
|
119 | + echo '<tr><td>'; |
|
120 | + echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; |
|
121 | + echo '</td></tr>'; |
|
122 | + echo '</table>'; |
|
123 | + } |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * Find a media object. |
|
128 | + */ |
|
129 | + private static function mediaFind() { |
|
130 | + global $WT_TREE; |
|
131 | + |
|
132 | + $controller = new SimpleController; |
|
133 | + $filter = Filter::get('filter'); |
|
134 | + $multiple = Filter::getBool('multiple'); |
|
135 | + |
|
136 | + $controller |
|
137 | + ->setPageTitle(I18N::translate('Find an individual')) |
|
138 | + ->pageHeader(); |
|
139 | + |
|
140 | + ?> |
|
141 | 141 | <script> |
142 | 142 | function pasterow(id, name, gend, yob, age, bpl) { |
143 | 143 | window.opener.opener.insertRowToTable(id, name, '', gend, '', yob, age, 'Y', '', bpl); |
@@ -178,27 +178,27 @@ discard block |
||
178 | 178 | </script> |
179 | 179 | |
180 | 180 | <?php |
181 | - echo '<div>'; |
|
182 | - echo '<table class="list_table width90" border="0">'; |
|
183 | - echo '<tr><td style="padding: 10px;" class="facts_label03 width90">'; // start column for find text header |
|
184 | - echo $controller->getPageTitle(); |
|
185 | - echo '</td>'; |
|
186 | - echo '</tr>'; |
|
187 | - echo '</table>'; |
|
188 | - echo '<br>'; |
|
189 | - echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; |
|
190 | - echo '<br>'; |
|
191 | - |
|
192 | - $filter = trim($filter); |
|
193 | - $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
194 | - echo '<table class="tabs_table width90"><tr>'; |
|
195 | - $myindilist = FunctionsDb::searchIndividualNames($filter_array, array($WT_TREE)); |
|
196 | - if ($myindilist) { |
|
197 | - echo '<td class="list_value_wrap"><ul>'; |
|
198 | - usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
199 | - foreach ($myindilist as $indi) { |
|
200 | - $nam = Filter::escapeHtml($indi->getFullName()); |
|
201 | - echo "<li><a href=\"#\" onclick=\"pasterow( |
|
181 | + echo '<div>'; |
|
182 | + echo '<table class="list_table width90" border="0">'; |
|
183 | + echo '<tr><td style="padding: 10px;" class="facts_label03 width90">'; // start column for find text header |
|
184 | + echo $controller->getPageTitle(); |
|
185 | + echo '</td>'; |
|
186 | + echo '</tr>'; |
|
187 | + echo '</table>'; |
|
188 | + echo '<br>'; |
|
189 | + echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; |
|
190 | + echo '<br>'; |
|
191 | + |
|
192 | + $filter = trim($filter); |
|
193 | + $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
194 | + echo '<table class="tabs_table width90"><tr>'; |
|
195 | + $myindilist = FunctionsDb::searchIndividualNames($filter_array, array($WT_TREE)); |
|
196 | + if ($myindilist) { |
|
197 | + echo '<td class="list_value_wrap"><ul>'; |
|
198 | + usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
199 | + foreach ($myindilist as $indi) { |
|
200 | + $nam = Filter::escapeHtml($indi->getFullName()); |
|
201 | + echo "<li><a href=\"#\" onclick=\"pasterow( |
|
202 | 202 | '" . $indi->getXref() . "' , |
203 | 203 | '" . $nam . "' , |
204 | 204 | '" . $indi->getSex() . "' , |
@@ -207,44 +207,44 @@ discard block |
||
207 | 207 | '" . $indi->getBirthPlace() . "'); return false;\"> |
208 | 208 | <b>" . $indi->getFullName() . "</b> "; |
209 | 209 | |
210 | - $born = GedcomTag::getLabel('BIRT'); |
|
211 | - echo "</span><br><span class=\"list_item\">", $born, " ", $indi->getBirthYear(), " ", $indi->getBirthPlace(), "</span></a></li>"; |
|
212 | - echo "<hr>"; |
|
213 | - } |
|
214 | - echo '</ul></td></tr><tr><td class="list_label">', I18N::translate('Total individuals: %s', count($myindilist)), '</tr></td>'; |
|
215 | - } else { |
|
216 | - echo "<td class=\"list_value_wrap\">"; |
|
217 | - echo I18N::translate('No results found.'); |
|
218 | - echo "</td></tr>"; |
|
219 | - } |
|
220 | - echo "</table>"; |
|
221 | - echo '</div>'; |
|
222 | - } |
|
223 | - |
|
224 | - /** |
|
225 | - * Search for a media object. |
|
226 | - */ |
|
227 | - private static function mediaQuery() { |
|
228 | - global $WT_TREE; |
|
229 | - |
|
230 | - $iid2 = Filter::get('iid', WT_REGEX_XREF); |
|
231 | - |
|
232 | - $controller = new SimpleController; |
|
233 | - $controller |
|
234 | - ->setPageTitle(I18N::translate('Link to an existing media object')) |
|
235 | - ->pageHeader(); |
|
236 | - |
|
237 | - $record = GedcomRecord::getInstance($iid2, $WT_TREE); |
|
238 | - if ($record) { |
|
239 | - $headjs = ''; |
|
240 | - if ($record instanceof Family) { |
|
241 | - if ($record->getHusband()) { |
|
242 | - $headjs = $record->getHusband()->getXref(); |
|
243 | - } elseif ($record->getWife()) { |
|
244 | - $headjs = $record->getWife()->getXref(); |
|
245 | - } |
|
246 | - } |
|
247 | - ?> |
|
210 | + $born = GedcomTag::getLabel('BIRT'); |
|
211 | + echo "</span><br><span class=\"list_item\">", $born, " ", $indi->getBirthYear(), " ", $indi->getBirthPlace(), "</span></a></li>"; |
|
212 | + echo "<hr>"; |
|
213 | + } |
|
214 | + echo '</ul></td></tr><tr><td class="list_label">', I18N::translate('Total individuals: %s', count($myindilist)), '</tr></td>'; |
|
215 | + } else { |
|
216 | + echo "<td class=\"list_value_wrap\">"; |
|
217 | + echo I18N::translate('No results found.'); |
|
218 | + echo "</td></tr>"; |
|
219 | + } |
|
220 | + echo "</table>"; |
|
221 | + echo '</div>'; |
|
222 | + } |
|
223 | + |
|
224 | + /** |
|
225 | + * Search for a media object. |
|
226 | + */ |
|
227 | + private static function mediaQuery() { |
|
228 | + global $WT_TREE; |
|
229 | + |
|
230 | + $iid2 = Filter::get('iid', WT_REGEX_XREF); |
|
231 | + |
|
232 | + $controller = new SimpleController; |
|
233 | + $controller |
|
234 | + ->setPageTitle(I18N::translate('Link to an existing media object')) |
|
235 | + ->pageHeader(); |
|
236 | + |
|
237 | + $record = GedcomRecord::getInstance($iid2, $WT_TREE); |
|
238 | + if ($record) { |
|
239 | + $headjs = ''; |
|
240 | + if ($record instanceof Family) { |
|
241 | + if ($record->getHusband()) { |
|
242 | + $headjs = $record->getHusband()->getXref(); |
|
243 | + } elseif ($record->getWife()) { |
|
244 | + $headjs = $record->getWife()->getXref(); |
|
245 | + } |
|
246 | + } |
|
247 | + ?> |
|
248 | 248 | <script> |
249 | 249 | function insertId() { |
250 | 250 | if (window.opener.document.getElementById('addlinkQueue')) { |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | } |
256 | 256 | </script> |
257 | 257 | <?php |
258 | - } else { |
|
259 | - ?> |
|
258 | + } else { |
|
259 | + ?> |
|
260 | 260 | <script> |
261 | 261 | function insertId() { |
262 | 262 | window.opener.alert('<?php echo $iid2; ?> - <?php echo I18N::translate('Not a valid individual, family, or source ID'); ?>'); |
@@ -264,178 +264,178 @@ discard block |
||
264 | 264 | } |
265 | 265 | </script> |
266 | 266 | <?php |
267 | - } |
|
268 | - ?> |
|
267 | + } |
|
268 | + ?> |
|
269 | 269 | <script>window.onLoad = insertId();</script> |
270 | 270 | <?php |
271 | - } |
|
272 | - |
|
273 | - /** |
|
274 | - * Convert custom markup into HTML |
|
275 | - * |
|
276 | - * @param Note $note |
|
277 | - * |
|
278 | - * @return string |
|
279 | - */ |
|
280 | - public static function formatCensusNote(Note $note) { |
|
281 | - global $WT_TREE; |
|
282 | - |
|
283 | - if (preg_match('/(.*)((?:\n.*)*)\n\.start_formatted_area\.\n(.+)\n(.+(?:\n.+)*)\n.end_formatted_area\.((?:\n.*)*)/', $note->getNote(), $match)) { |
|
284 | - // This looks like a census-assistant shared note |
|
285 | - $title = Filter::escapeHtml($match[1]); |
|
286 | - $preamble = Filter::escapeHtml($match[2]); |
|
287 | - $header = Filter::escapeHtml($match[3]); |
|
288 | - $data = Filter::escapeHtml($match[4]); |
|
289 | - $postamble = Filter::escapeHtml($match[5]); |
|
290 | - |
|
291 | - // Get the column headers for the census to which this note refers |
|
292 | - // requires the fact place & date to match the specific census |
|
293 | - // censusPlace() (Soundex match) and censusDate() functions |
|
294 | - $fmt_headers = array(); |
|
295 | - $linkedRecords = array_merge($note->linkedIndividuals('NOTE'), $note->linkedFamilies('NOTE')); |
|
296 | - $firstRecord = array_shift($linkedRecords); |
|
297 | - if ($firstRecord) { |
|
298 | - $countryCode = ''; |
|
299 | - $date = ''; |
|
300 | - foreach ($firstRecord->getFacts('CENS') as $fact) { |
|
301 | - if (trim($fact->getAttribute('NOTE'), '@') === $note->getXref()) { |
|
302 | - $date = $fact->getAttribute('DATE'); |
|
303 | - $place = explode(',', strip_tags($fact->getPlace()->getFullName())); |
|
304 | - $countryCode = Soundex::daitchMokotoff(array_pop($place)); |
|
305 | - break; |
|
306 | - } |
|
307 | - } |
|
308 | - |
|
309 | - foreach (Census::allCensusPlaces() as $censusPlace) { |
|
310 | - if (Soundex::compare($countryCode, Soundex::daitchMokotoff($censusPlace->censusPlace()))) { |
|
311 | - foreach ($censusPlace->allCensusDates() as $census) { |
|
312 | - if ($census->censusDate() == $date) { |
|
313 | - foreach ($census->columns() as $column) { |
|
314 | - $abbrev = $column->abbreviation(); |
|
315 | - if ($abbrev) { |
|
316 | - $description = $column->title() ? $column->title() : I18N::translate('Description unavailable'); |
|
317 | - $fmt_headers[$abbrev] = '<span title="' . $description . '">' . $abbrev . '</span>'; |
|
318 | - } |
|
319 | - } |
|
320 | - break 2; |
|
321 | - } |
|
322 | - } |
|
323 | - } |
|
324 | - } |
|
325 | - } |
|
326 | - // Substitute header labels and format as HTML |
|
327 | - $thead = '<tr><th>' . strtr(str_replace('|', '</th><th>', $header), $fmt_headers) . '</th></tr>'; |
|
328 | - $thead = str_replace('.b.', '', $thead); |
|
329 | - |
|
330 | - // Format data as HTML |
|
331 | - $tbody = ''; |
|
332 | - foreach (explode("\n", $data) as $row) { |
|
333 | - $tbody .= '<tr>'; |
|
334 | - foreach (explode('|', $row) as $column) { |
|
335 | - $tbody .= '<td>' . $column . '</td>'; |
|
336 | - } |
|
337 | - $tbody .= '</tr>'; |
|
338 | - } |
|
339 | - |
|
340 | - return |
|
341 | - $title . "\n" . // The newline allows the framework to expand the details and turn the first line into a link |
|
342 | - '<div class="markdown">' . |
|
343 | - '<p>' . $preamble . '</p>' . |
|
344 | - '<table>' . |
|
345 | - '<thead>' . $thead . '</thead>' . |
|
346 | - '<tbody>' . $tbody . '</tbody>' . |
|
347 | - '</table>' . |
|
348 | - '<p>' . $postamble . '</p>' . |
|
349 | - '</div>'; |
|
350 | - } else { |
|
351 | - // Not a census-assistant shared note - apply default formatting |
|
352 | - return Filter::formatText($note->getNote(), $WT_TREE); |
|
353 | - } |
|
354 | - } |
|
355 | - |
|
356 | - /** |
|
357 | - * Generate an HTML row of data for the census header |
|
358 | - * |
|
359 | - * Add prefix cell (store XREF and drag/drop) |
|
360 | - * Add suffix cell (delete button) |
|
361 | - * |
|
362 | - * @param CensusInterface $census |
|
363 | - * |
|
364 | - * @return string |
|
365 | - */ |
|
366 | - public static function censusTableHeader(CensusInterface $census) { |
|
367 | - $html = ''; |
|
368 | - foreach ($census->columns() as $column) { |
|
369 | - $html .= '<th title="' . $column->title() . '">' . $column->abbreviation() . '</th>'; |
|
370 | - } |
|
371 | - |
|
372 | - return '<tr><th hidden></th>' . $html . '<th></th></tr>'; |
|
373 | - } |
|
374 | - |
|
375 | - /** |
|
376 | - * Generate an HTML row of data for the census |
|
377 | - * |
|
378 | - * Add prefix cell (store XREF and drag/drop) |
|
379 | - * Add suffix cell (delete button) |
|
380 | - * |
|
381 | - * @param CensusInterface $census |
|
382 | - * |
|
383 | - * @return string |
|
384 | - */ |
|
385 | - public static function censusTableEmptyRow(CensusInterface $census) { |
|
386 | - return '<tr><td hidden></td>' . str_repeat('<td><input type="text"></td>', count($census->columns())) . '<td><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
387 | - } |
|
388 | - |
|
389 | - /** |
|
390 | - * Generate an HTML row of data for the census |
|
391 | - * |
|
392 | - * Add prefix cell (store XREF and drag/drop) |
|
393 | - * Add suffix cell (delete button) |
|
394 | - * |
|
395 | - * @param CensusInterface $census |
|
396 | - * @param Individual $individual |
|
397 | - * @param Individual|null $head |
|
398 | - * |
|
399 | - * @return string |
|
400 | - */ |
|
401 | - public static function censusTableRow(CensusInterface $census, Individual $individual, Individual $head = null) { |
|
402 | - $html = ''; |
|
403 | - foreach ($census->columns() as $column) { |
|
404 | - $html .= '<td><input type="text" value="' . $column->generate($individual, $head) . '"></td>'; |
|
405 | - } |
|
406 | - |
|
407 | - return '<tr><td hidden>' . $individual->getXref() . '</td>' . $html . '<td><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
408 | - } |
|
409 | - |
|
410 | - /** |
|
411 | - * Create a family on the census navigator. |
|
412 | - * |
|
413 | - * @param CensusInterface $census |
|
414 | - * @param Family $family |
|
415 | - * @param Individual $head |
|
416 | - * |
|
417 | - * @return string |
|
418 | - */ |
|
419 | - public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) { |
|
420 | - $headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>'; |
|
421 | - |
|
422 | - foreach ($family->getSpouses() as $spouse) { |
|
423 | - $menu = new Menu(Functions::getCloseRelationshipName($head, $spouse)); |
|
424 | - foreach ($spouse->getChildFamilies() as $grandparents) { |
|
425 | - foreach ($grandparents->getSpouses() as $grandparent) { |
|
426 | - $submenu = new Menu( |
|
427 | - Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), |
|
428 | - '#', |
|
429 | - '', |
|
430 | - array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");') |
|
431 | - ); |
|
432 | - $submenu->addClass('submenuitem', ''); |
|
433 | - $menu->addSubmenu($submenu); |
|
434 | - $menu->addClass('', 'submenu'); |
|
435 | - } |
|
436 | - } |
|
437 | - |
|
438 | - ?> |
|
271 | + } |
|
272 | + |
|
273 | + /** |
|
274 | + * Convert custom markup into HTML |
|
275 | + * |
|
276 | + * @param Note $note |
|
277 | + * |
|
278 | + * @return string |
|
279 | + */ |
|
280 | + public static function formatCensusNote(Note $note) { |
|
281 | + global $WT_TREE; |
|
282 | + |
|
283 | + if (preg_match('/(.*)((?:\n.*)*)\n\.start_formatted_area\.\n(.+)\n(.+(?:\n.+)*)\n.end_formatted_area\.((?:\n.*)*)/', $note->getNote(), $match)) { |
|
284 | + // This looks like a census-assistant shared note |
|
285 | + $title = Filter::escapeHtml($match[1]); |
|
286 | + $preamble = Filter::escapeHtml($match[2]); |
|
287 | + $header = Filter::escapeHtml($match[3]); |
|
288 | + $data = Filter::escapeHtml($match[4]); |
|
289 | + $postamble = Filter::escapeHtml($match[5]); |
|
290 | + |
|
291 | + // Get the column headers for the census to which this note refers |
|
292 | + // requires the fact place & date to match the specific census |
|
293 | + // censusPlace() (Soundex match) and censusDate() functions |
|
294 | + $fmt_headers = array(); |
|
295 | + $linkedRecords = array_merge($note->linkedIndividuals('NOTE'), $note->linkedFamilies('NOTE')); |
|
296 | + $firstRecord = array_shift($linkedRecords); |
|
297 | + if ($firstRecord) { |
|
298 | + $countryCode = ''; |
|
299 | + $date = ''; |
|
300 | + foreach ($firstRecord->getFacts('CENS') as $fact) { |
|
301 | + if (trim($fact->getAttribute('NOTE'), '@') === $note->getXref()) { |
|
302 | + $date = $fact->getAttribute('DATE'); |
|
303 | + $place = explode(',', strip_tags($fact->getPlace()->getFullName())); |
|
304 | + $countryCode = Soundex::daitchMokotoff(array_pop($place)); |
|
305 | + break; |
|
306 | + } |
|
307 | + } |
|
308 | + |
|
309 | + foreach (Census::allCensusPlaces() as $censusPlace) { |
|
310 | + if (Soundex::compare($countryCode, Soundex::daitchMokotoff($censusPlace->censusPlace()))) { |
|
311 | + foreach ($censusPlace->allCensusDates() as $census) { |
|
312 | + if ($census->censusDate() == $date) { |
|
313 | + foreach ($census->columns() as $column) { |
|
314 | + $abbrev = $column->abbreviation(); |
|
315 | + if ($abbrev) { |
|
316 | + $description = $column->title() ? $column->title() : I18N::translate('Description unavailable'); |
|
317 | + $fmt_headers[$abbrev] = '<span title="' . $description . '">' . $abbrev . '</span>'; |
|
318 | + } |
|
319 | + } |
|
320 | + break 2; |
|
321 | + } |
|
322 | + } |
|
323 | + } |
|
324 | + } |
|
325 | + } |
|
326 | + // Substitute header labels and format as HTML |
|
327 | + $thead = '<tr><th>' . strtr(str_replace('|', '</th><th>', $header), $fmt_headers) . '</th></tr>'; |
|
328 | + $thead = str_replace('.b.', '', $thead); |
|
329 | + |
|
330 | + // Format data as HTML |
|
331 | + $tbody = ''; |
|
332 | + foreach (explode("\n", $data) as $row) { |
|
333 | + $tbody .= '<tr>'; |
|
334 | + foreach (explode('|', $row) as $column) { |
|
335 | + $tbody .= '<td>' . $column . '</td>'; |
|
336 | + } |
|
337 | + $tbody .= '</tr>'; |
|
338 | + } |
|
339 | + |
|
340 | + return |
|
341 | + $title . "\n" . // The newline allows the framework to expand the details and turn the first line into a link |
|
342 | + '<div class="markdown">' . |
|
343 | + '<p>' . $preamble . '</p>' . |
|
344 | + '<table>' . |
|
345 | + '<thead>' . $thead . '</thead>' . |
|
346 | + '<tbody>' . $tbody . '</tbody>' . |
|
347 | + '</table>' . |
|
348 | + '<p>' . $postamble . '</p>' . |
|
349 | + '</div>'; |
|
350 | + } else { |
|
351 | + // Not a census-assistant shared note - apply default formatting |
|
352 | + return Filter::formatText($note->getNote(), $WT_TREE); |
|
353 | + } |
|
354 | + } |
|
355 | + |
|
356 | + /** |
|
357 | + * Generate an HTML row of data for the census header |
|
358 | + * |
|
359 | + * Add prefix cell (store XREF and drag/drop) |
|
360 | + * Add suffix cell (delete button) |
|
361 | + * |
|
362 | + * @param CensusInterface $census |
|
363 | + * |
|
364 | + * @return string |
|
365 | + */ |
|
366 | + public static function censusTableHeader(CensusInterface $census) { |
|
367 | + $html = ''; |
|
368 | + foreach ($census->columns() as $column) { |
|
369 | + $html .= '<th title="' . $column->title() . '">' . $column->abbreviation() . '</th>'; |
|
370 | + } |
|
371 | + |
|
372 | + return '<tr><th hidden></th>' . $html . '<th></th></tr>'; |
|
373 | + } |
|
374 | + |
|
375 | + /** |
|
376 | + * Generate an HTML row of data for the census |
|
377 | + * |
|
378 | + * Add prefix cell (store XREF and drag/drop) |
|
379 | + * Add suffix cell (delete button) |
|
380 | + * |
|
381 | + * @param CensusInterface $census |
|
382 | + * |
|
383 | + * @return string |
|
384 | + */ |
|
385 | + public static function censusTableEmptyRow(CensusInterface $census) { |
|
386 | + return '<tr><td hidden></td>' . str_repeat('<td><input type="text"></td>', count($census->columns())) . '<td><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
387 | + } |
|
388 | + |
|
389 | + /** |
|
390 | + * Generate an HTML row of data for the census |
|
391 | + * |
|
392 | + * Add prefix cell (store XREF and drag/drop) |
|
393 | + * Add suffix cell (delete button) |
|
394 | + * |
|
395 | + * @param CensusInterface $census |
|
396 | + * @param Individual $individual |
|
397 | + * @param Individual|null $head |
|
398 | + * |
|
399 | + * @return string |
|
400 | + */ |
|
401 | + public static function censusTableRow(CensusInterface $census, Individual $individual, Individual $head = null) { |
|
402 | + $html = ''; |
|
403 | + foreach ($census->columns() as $column) { |
|
404 | + $html .= '<td><input type="text" value="' . $column->generate($individual, $head) . '"></td>'; |
|
405 | + } |
|
406 | + |
|
407 | + return '<tr><td hidden>' . $individual->getXref() . '</td>' . $html . '<td><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
408 | + } |
|
409 | + |
|
410 | + /** |
|
411 | + * Create a family on the census navigator. |
|
412 | + * |
|
413 | + * @param CensusInterface $census |
|
414 | + * @param Family $family |
|
415 | + * @param Individual $head |
|
416 | + * |
|
417 | + * @return string |
|
418 | + */ |
|
419 | + public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) { |
|
420 | + $headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>'; |
|
421 | + |
|
422 | + foreach ($family->getSpouses() as $spouse) { |
|
423 | + $menu = new Menu(Functions::getCloseRelationshipName($head, $spouse)); |
|
424 | + foreach ($spouse->getChildFamilies() as $grandparents) { |
|
425 | + foreach ($grandparents->getSpouses() as $grandparent) { |
|
426 | + $submenu = new Menu( |
|
427 | + Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), |
|
428 | + '#', |
|
429 | + '', |
|
430 | + array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");') |
|
431 | + ); |
|
432 | + $submenu->addClass('submenuitem', ''); |
|
433 | + $menu->addSubmenu($submenu); |
|
434 | + $menu->addClass('', 'submenu'); |
|
435 | + } |
|
436 | + } |
|
437 | + |
|
438 | + ?> |
|
439 | 439 | <tr> |
440 | 440 | <td class="optionbox"> |
441 | 441 | <?php echo $menu->getMenu(); ?> |
@@ -454,38 +454,38 @@ discard block |
||
454 | 454 | </td> |
455 | 455 | </tr> |
456 | 456 | <?php |
457 | - } |
|
458 | - |
|
459 | - foreach ($family->getChildren() as $child) { |
|
460 | - $menu = new Menu(Functions::getCloseRelationshipName($head, $child)); |
|
461 | - foreach ($child->getSpouseFamilies() as $spouse_family) { |
|
462 | - foreach ($spouse_family->getSpouses() as $spouse_family_spouse) { |
|
463 | - if ($spouse_family_spouse != $child) { |
|
464 | - $submenu = new Menu( |
|
465 | - Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), |
|
466 | - '#', |
|
467 | - '', |
|
468 | - array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");') |
|
469 | - ); |
|
470 | - $submenu->addClass('submenuitem', ''); |
|
471 | - $menu->addSubmenu($submenu); |
|
472 | - $menu->addClass('', 'submenu'); |
|
473 | - } |
|
474 | - } |
|
475 | - foreach ($spouse_family->getChildren() as $spouse_family_child) { |
|
476 | - $submenu = new Menu( |
|
477 | - Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), |
|
478 | - '#', |
|
479 | - '', |
|
480 | - array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");') |
|
481 | - ); |
|
482 | - $submenu->addClass('submenuitem', ''); |
|
483 | - $menu->addSubmenu($submenu); |
|
484 | - $menu->addClass('', 'submenu'); |
|
485 | - } |
|
486 | - } |
|
487 | - |
|
488 | - ?> |
|
457 | + } |
|
458 | + |
|
459 | + foreach ($family->getChildren() as $child) { |
|
460 | + $menu = new Menu(Functions::getCloseRelationshipName($head, $child)); |
|
461 | + foreach ($child->getSpouseFamilies() as $spouse_family) { |
|
462 | + foreach ($spouse_family->getSpouses() as $spouse_family_spouse) { |
|
463 | + if ($spouse_family_spouse != $child) { |
|
464 | + $submenu = new Menu( |
|
465 | + Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), |
|
466 | + '#', |
|
467 | + '', |
|
468 | + array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");') |
|
469 | + ); |
|
470 | + $submenu->addClass('submenuitem', ''); |
|
471 | + $menu->addSubmenu($submenu); |
|
472 | + $menu->addClass('', 'submenu'); |
|
473 | + } |
|
474 | + } |
|
475 | + foreach ($spouse_family->getChildren() as $spouse_family_child) { |
|
476 | + $submenu = new Menu( |
|
477 | + Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), |
|
478 | + '#', |
|
479 | + '', |
|
480 | + array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");') |
|
481 | + ); |
|
482 | + $submenu->addClass('submenuitem', ''); |
|
483 | + $menu->addSubmenu($submenu); |
|
484 | + $menu->addClass('', 'submenu'); |
|
485 | + } |
|
486 | + } |
|
487 | + |
|
488 | + ?> |
|
489 | 489 | <tr> |
490 | 490 | <td class="optionbox"> |
491 | 491 | <?php echo $menu->getMenu(); ?> |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | </td> |
505 | 505 | </tr> |
506 | 506 | <?php |
507 | - } |
|
508 | - echo '<tr><td><br></td></tr>'; |
|
509 | - } |
|
507 | + } |
|
508 | + echo '<tr><td><br></td></tr>'; |
|
509 | + } |
|
510 | 510 | } |
@@ -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 |
@@ -33,14 +33,17 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Class CensusAssistantModule |
35 | 35 | */ |
36 | -class CensusAssistantModule extends AbstractModule { |
|
36 | +class CensusAssistantModule extends AbstractModule |
|
37 | +{ |
|
37 | 38 | /** {@inheritdoc} */ |
38 | - public function getTitle() { |
|
39 | + public function getTitle() |
|
40 | + { |
|
39 | 41 | return /* I18N: Name of a module */ I18N::translate('Census assistant'); |
40 | 42 | } |
41 | 43 | |
42 | 44 | /** {@inheritdoc} */ |
43 | - public function getDescription() { |
|
45 | + public function getDescription() |
|
46 | + { |
|
44 | 47 | return /* I18N: Description of the “Census assistant” module */ I18N::translate('An alternative way to enter census transcripts and link them to individuals.'); |
45 | 48 | } |
46 | 49 | |
@@ -50,7 +53,8 @@ discard block |
||
50 | 53 | * |
51 | 54 | * @param string $mod_action |
52 | 55 | */ |
53 | - public function modAction($mod_action) { |
|
56 | + public function modAction($mod_action) |
|
57 | + { |
|
54 | 58 | switch ($mod_action) { |
55 | 59 | case 'census_find': |
56 | 60 | self::censusFind(); |
@@ -69,7 +73,8 @@ discard block |
||
69 | 73 | /** |
70 | 74 | * Find an individual. |
71 | 75 | */ |
72 | - private static function censusFind() { |
|
76 | + private static function censusFind() |
|
77 | + { |
|
73 | 78 | global $WT_TREE; |
74 | 79 | |
75 | 80 | $controller = new SimpleController; |
@@ -126,7 +131,8 @@ discard block |
||
126 | 131 | /** |
127 | 132 | * Find a media object. |
128 | 133 | */ |
129 | - private static function mediaFind() { |
|
134 | + private static function mediaFind() |
|
135 | + { |
|
130 | 136 | global $WT_TREE; |
131 | 137 | |
132 | 138 | $controller = new SimpleController; |
@@ -224,7 +230,8 @@ discard block |
||
224 | 230 | /** |
225 | 231 | * Search for a media object. |
226 | 232 | */ |
227 | - private static function mediaQuery() { |
|
233 | + private static function mediaQuery() |
|
234 | + { |
|
228 | 235 | global $WT_TREE; |
229 | 236 | |
230 | 237 | $iid2 = Filter::get('iid', WT_REGEX_XREF); |
@@ -277,7 +284,8 @@ discard block |
||
277 | 284 | * |
278 | 285 | * @return string |
279 | 286 | */ |
280 | - public static function formatCensusNote(Note $note) { |
|
287 | + public static function formatCensusNote(Note $note) |
|
288 | + { |
|
281 | 289 | global $WT_TREE; |
282 | 290 | |
283 | 291 | if (preg_match('/(.*)((?:\n.*)*)\n\.start_formatted_area\.\n(.+)\n(.+(?:\n.+)*)\n.end_formatted_area\.((?:\n.*)*)/', $note->getNote(), $match)) { |
@@ -363,7 +371,8 @@ discard block |
||
363 | 371 | * |
364 | 372 | * @return string |
365 | 373 | */ |
366 | - public static function censusTableHeader(CensusInterface $census) { |
|
374 | + public static function censusTableHeader(CensusInterface $census) |
|
375 | + { |
|
367 | 376 | $html = ''; |
368 | 377 | foreach ($census->columns() as $column) { |
369 | 378 | $html .= '<th title="' . $column->title() . '">' . $column->abbreviation() . '</th>'; |
@@ -382,7 +391,8 @@ discard block |
||
382 | 391 | * |
383 | 392 | * @return string |
384 | 393 | */ |
385 | - public static function censusTableEmptyRow(CensusInterface $census) { |
|
394 | + public static function censusTableEmptyRow(CensusInterface $census) |
|
395 | + { |
|
386 | 396 | return '<tr><td hidden></td>' . str_repeat('<td><input type="text"></td>', count($census->columns())) . '<td><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
387 | 397 | } |
388 | 398 | |
@@ -398,7 +408,8 @@ discard block |
||
398 | 408 | * |
399 | 409 | * @return string |
400 | 410 | */ |
401 | - public static function censusTableRow(CensusInterface $census, Individual $individual, Individual $head = null) { |
|
411 | + public static function censusTableRow(CensusInterface $census, Individual $individual, Individual $head = null) |
|
412 | + { |
|
402 | 413 | $html = ''; |
403 | 414 | foreach ($census->columns() as $column) { |
404 | 415 | $html .= '<td><input type="text" value="' . $column->generate($individual, $head) . '"></td>'; |
@@ -416,7 +427,8 @@ discard block |
||
416 | 427 | * |
417 | 428 | * @return string |
418 | 429 | */ |
419 | - public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) { |
|
430 | + public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) |
|
431 | + { |
|
420 | 432 | $headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>'; |
421 | 433 | |
422 | 434 | foreach ($family->getSpouses() as $spouse) { |
@@ -23,24 +23,24 @@ |
||
23 | 23 | * Upgrade the database schema from version 2 to version 3. |
24 | 24 | */ |
25 | 25 | class Migration2 implements MigrationInterface { |
26 | - /** {@inheritDoc} */ |
|
27 | - public function upgrade() { |
|
28 | - // Delete any data that might violate the new constraints |
|
29 | - Database::exec( |
|
30 | - "DELETE FROM `##news`" . |
|
31 | - " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" . |
|
32 | - " OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)" |
|
33 | - ); |
|
26 | + /** {@inheritDoc} */ |
|
27 | + public function upgrade() { |
|
28 | + // Delete any data that might violate the new constraints |
|
29 | + Database::exec( |
|
30 | + "DELETE FROM `##news`" . |
|
31 | + " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" . |
|
32 | + " OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)" |
|
33 | + ); |
|
34 | 34 | |
35 | - // Add the new constraints |
|
36 | - try { |
|
37 | - Database::exec( |
|
38 | - "ALTER TABLE `##news`" . |
|
39 | - " ADD FOREIGN KEY `##news_fk1` (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," . |
|
40 | - " ADD FOREIGN KEY `##news_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE" |
|
41 | - ); |
|
42 | - } catch (PDOException $ex) { |
|
43 | - // Already updated? |
|
44 | - } |
|
45 | - } |
|
35 | + // Add the new constraints |
|
36 | + try { |
|
37 | + Database::exec( |
|
38 | + "ALTER TABLE `##news`" . |
|
39 | + " ADD FOREIGN KEY `##news_fk1` (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," . |
|
40 | + " ADD FOREIGN KEY `##news_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE" |
|
41 | + ); |
|
42 | + } catch (PDOException $ex) { |
|
43 | + // Already updated? |
|
44 | + } |
|
45 | + } |
|
46 | 46 | } |
@@ -22,9 +22,11 @@ |
||
22 | 22 | /** |
23 | 23 | * Upgrade the database schema from version 2 to version 3. |
24 | 24 | */ |
25 | -class Migration2 implements MigrationInterface { |
|
25 | +class Migration2 implements MigrationInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritDoc} */ |
27 | - public function upgrade() { |
|
28 | + public function upgrade() |
|
29 | + { |
|
28 | 30 | // Delete any data that might violate the new constraints |
29 | 31 | Database::exec( |
30 | 32 | "DELETE FROM `##news`" . |
@@ -23,54 +23,54 @@ |
||
23 | 23 | * Upgrade the database schema from version 1 to version 2. |
24 | 24 | */ |
25 | 25 | class Migration1 implements MigrationInterface { |
26 | - /** {@inheritDoc} */ |
|
27 | - public function upgrade() { |
|
28 | - // Add new columns |
|
29 | - try { |
|
30 | - Database::exec( |
|
31 | - "ALTER TABLE `##news`" . |
|
32 | - " ADD user_id INTEGER NULL AFTER n_id," . |
|
33 | - " ADD gedcom_id INTEGER NULL AFTER user_id," . |
|
34 | - " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," . |
|
35 | - " ADD KEY news_ix1 (user_id, updated)," . |
|
36 | - " ADD KEY news_ix2 (gedcom_id, updated)" |
|
37 | - ); |
|
38 | - } catch (PDOException $ex) { |
|
39 | - // Already updated? |
|
40 | - } |
|
26 | + /** {@inheritDoc} */ |
|
27 | + public function upgrade() { |
|
28 | + // Add new columns |
|
29 | + try { |
|
30 | + Database::exec( |
|
31 | + "ALTER TABLE `##news`" . |
|
32 | + " ADD user_id INTEGER NULL AFTER n_id," . |
|
33 | + " ADD gedcom_id INTEGER NULL AFTER user_id," . |
|
34 | + " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," . |
|
35 | + " ADD KEY news_ix1 (user_id, updated)," . |
|
36 | + " ADD KEY news_ix2 (gedcom_id, updated)" |
|
37 | + ); |
|
38 | + } catch (PDOException $ex) { |
|
39 | + // Already updated? |
|
40 | + } |
|
41 | 41 | |
42 | 42 | // Migrate data from the old columns to the new ones |
43 | - try { |
|
44 | - Database::exec( |
|
45 | - "UPDATE `##news` n" . |
|
46 | - " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" . |
|
47 | - " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" . |
|
48 | - " SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)" |
|
49 | - ); |
|
50 | - } catch (PDOException $ex) { |
|
51 | - // Already updated? |
|
52 | - } |
|
43 | + try { |
|
44 | + Database::exec( |
|
45 | + "UPDATE `##news` n" . |
|
46 | + " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" . |
|
47 | + " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" . |
|
48 | + " SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)" |
|
49 | + ); |
|
50 | + } catch (PDOException $ex) { |
|
51 | + // Already updated? |
|
52 | + } |
|
53 | 53 | |
54 | 54 | // Delete orphaned rows |
55 | - try { |
|
56 | - Database::exec( |
|
57 | - "DELETE FROM `##news` WHERE user_id IS NULL AND gedcom_id IS NULL" |
|
58 | - ); |
|
59 | - } catch (PDOException $ex) { |
|
60 | - // Already updated? |
|
61 | - } |
|
55 | + try { |
|
56 | + Database::exec( |
|
57 | + "DELETE FROM `##news` WHERE user_id IS NULL AND gedcom_id IS NULL" |
|
58 | + ); |
|
59 | + } catch (PDOException $ex) { |
|
60 | + // Already updated? |
|
61 | + } |
|
62 | 62 | |
63 | 63 | // Delete/rename old columns |
64 | - try { |
|
65 | - Database::exec( |
|
66 | - "ALTER TABLE `##news`" . |
|
67 | - " DROP n_username, DROP n_date," . |
|
68 | - " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," . |
|
69 | - " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," . |
|
70 | - " CHANGE n_text body TEXT COLLATE utf8_unicode_ci" |
|
71 | - ); |
|
72 | - } catch (PDOException $ex) { |
|
73 | - // Already updated? |
|
74 | - } |
|
75 | - } |
|
64 | + try { |
|
65 | + Database::exec( |
|
66 | + "ALTER TABLE `##news`" . |
|
67 | + " DROP n_username, DROP n_date," . |
|
68 | + " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," . |
|
69 | + " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," . |
|
70 | + " CHANGE n_text body TEXT COLLATE utf8_unicode_ci" |
|
71 | + ); |
|
72 | + } catch (PDOException $ex) { |
|
73 | + // Already updated? |
|
74 | + } |
|
75 | + } |
|
76 | 76 | } |
@@ -22,9 +22,11 @@ |
||
22 | 22 | /** |
23 | 23 | * Upgrade the database schema from version 1 to version 2. |
24 | 24 | */ |
25 | -class Migration1 implements MigrationInterface { |
|
25 | +class Migration1 implements MigrationInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritDoc} */ |
27 | - public function upgrade() { |
|
28 | + public function upgrade() |
|
29 | + { |
|
28 | 30 | // Add new columns |
29 | 31 | try { |
30 | 32 | Database::exec( |
@@ -22,18 +22,18 @@ |
||
22 | 22 | * Upgrade the database schema from version 0 (empty database) to version 1. |
23 | 23 | */ |
24 | 24 | class Migration0 implements MigrationInterface { |
25 | - /** {@inheritDoc} */ |
|
26 | - public function upgrade() { |
|
27 | - Database::exec( |
|
28 | - "CREATE TABLE IF NOT EXISTS `##news` (" . |
|
29 | - " n_id INTEGER AUTO_INCREMENT NOT NULL," . |
|
30 | - " n_username VARCHAR(100) NOT NULL," . |
|
31 | - " n_date INTEGER NOT NULL," . |
|
32 | - " n_title VARCHAR(255) NOT NULL," . |
|
33 | - " n_text TEXT NOT NULL," . |
|
34 | - " PRIMARY KEY (n_id)," . |
|
35 | - " KEY ix1 (n_username)" . |
|
36 | - ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
37 | - ); |
|
38 | - } |
|
25 | + /** {@inheritDoc} */ |
|
26 | + public function upgrade() { |
|
27 | + Database::exec( |
|
28 | + "CREATE TABLE IF NOT EXISTS `##news` (" . |
|
29 | + " n_id INTEGER AUTO_INCREMENT NOT NULL," . |
|
30 | + " n_username VARCHAR(100) NOT NULL," . |
|
31 | + " n_date INTEGER NOT NULL," . |
|
32 | + " n_title VARCHAR(255) NOT NULL," . |
|
33 | + " n_text TEXT NOT NULL," . |
|
34 | + " PRIMARY KEY (n_id)," . |
|
35 | + " KEY ix1 (n_username)" . |
|
36 | + ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | } |
@@ -21,9 +21,11 @@ |
||
21 | 21 | /** |
22 | 22 | * Upgrade the database schema from version 0 (empty database) to version 1. |
23 | 23 | */ |
24 | -class Migration0 implements MigrationInterface { |
|
24 | +class Migration0 implements MigrationInterface |
|
25 | +{ |
|
25 | 26 | /** {@inheritDoc} */ |
26 | - public function upgrade() { |
|
27 | + public function upgrade() |
|
28 | + { |
|
27 | 29 | Database::exec( |
28 | 30 | "CREATE TABLE IF NOT EXISTS `##news` (" . |
29 | 31 | " n_id INTEGER AUTO_INCREMENT NOT NULL," . |
@@ -19,49 +19,49 @@ |
||
19 | 19 | * Interface ModuleTabInterface - Classes and libraries for module system |
20 | 20 | */ |
21 | 21 | interface ModuleTabInterface { |
22 | - /** |
|
23 | - * The user can re-arrange the tab order, but until they do, this |
|
24 | - * is the order in which tabs are shown. |
|
25 | - * |
|
26 | - * @return int |
|
27 | - */ |
|
28 | - public function defaultTabOrder(); |
|
22 | + /** |
|
23 | + * The user can re-arrange the tab order, but until they do, this |
|
24 | + * is the order in which tabs are shown. |
|
25 | + * |
|
26 | + * @return int |
|
27 | + */ |
|
28 | + public function defaultTabOrder(); |
|
29 | 29 | |
30 | - /** |
|
31 | - * Generate the HTML content of this tab. |
|
32 | - * |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function getTabContent(); |
|
30 | + /** |
|
31 | + * Generate the HTML content of this tab. |
|
32 | + * |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function getTabContent(); |
|
36 | 36 | |
37 | - /** |
|
38 | - * Is this tab empty? If so, we don't always need to display it. |
|
39 | - * |
|
40 | - * @return bool |
|
41 | - */ |
|
42 | - public function hasTabContent(); |
|
37 | + /** |
|
38 | + * Is this tab empty? If so, we don't always need to display it. |
|
39 | + * |
|
40 | + * @return bool |
|
41 | + */ |
|
42 | + public function hasTabContent(); |
|
43 | 43 | |
44 | - /** |
|
45 | - * Can this tab load asynchronously? |
|
46 | - * |
|
47 | - * @return bool |
|
48 | - */ |
|
49 | - public function canLoadAjax(); |
|
44 | + /** |
|
45 | + * Can this tab load asynchronously? |
|
46 | + * |
|
47 | + * @return bool |
|
48 | + */ |
|
49 | + public function canLoadAjax(); |
|
50 | 50 | |
51 | - /** |
|
52 | - * Any content (e.g. Javascript) that needs to be rendered before the tabs. |
|
53 | - * |
|
54 | - * This function is probably not needed, as there are better ways to achieve this. |
|
55 | - * |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getPreLoadContent(); |
|
51 | + /** |
|
52 | + * Any content (e.g. Javascript) that needs to be rendered before the tabs. |
|
53 | + * |
|
54 | + * This function is probably not needed, as there are better ways to achieve this. |
|
55 | + * |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getPreLoadContent(); |
|
59 | 59 | |
60 | - /** |
|
61 | - * A greyed out tab has no actual content, but may perhaps have |
|
62 | - * options to create content. |
|
63 | - * |
|
64 | - * @return bool |
|
65 | - */ |
|
66 | - public function isGrayedOut(); |
|
60 | + /** |
|
61 | + * A greyed out tab has no actual content, but may perhaps have |
|
62 | + * options to create content. |
|
63 | + * |
|
64 | + * @return bool |
|
65 | + */ |
|
66 | + public function isGrayedOut(); |
|
67 | 67 | } |
@@ -18,7 +18,8 @@ |
||
18 | 18 | /** |
19 | 19 | * Interface ModuleTabInterface - Classes and libraries for module system |
20 | 20 | */ |
21 | -interface ModuleTabInterface { |
|
21 | +interface ModuleTabInterface |
|
22 | +{ |
|
22 | 23 | /** |
23 | 24 | * The user can re-arrange the tab order, but until they do, this |
24 | 25 | * is the order in which tabs are shown. |
@@ -28,86 +28,86 @@ discard block |
||
28 | 28 | * Class RelativesTabModule |
29 | 29 | */ |
30 | 30 | class RelativesTabModule extends AbstractModule implements ModuleTabInterface { |
31 | - /** |
|
32 | - * How should this module be labelled on tabs, menus, etc.? |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function getTitle() { |
|
37 | - return /* I18N: Name of a module */ I18N::translate('Families'); |
|
38 | - } |
|
31 | + /** |
|
32 | + * How should this module be labelled on tabs, menus, etc.? |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function getTitle() { |
|
37 | + return /* I18N: Name of a module */ I18N::translate('Families'); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * A sentence describing what this module does. |
|
42 | - * |
|
43 | - * @return string |
|
44 | - */ |
|
45 | - public function getDescription() { |
|
46 | - return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); |
|
47 | - } |
|
40 | + /** |
|
41 | + * A sentence describing what this module does. |
|
42 | + * |
|
43 | + * @return string |
|
44 | + */ |
|
45 | + public function getDescription() { |
|
46 | + return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * The user can re-arrange the tab order, but until they do, this |
|
51 | - * is the order in which tabs are shown. |
|
52 | - * |
|
53 | - * @return int |
|
54 | - */ |
|
55 | - public function defaultTabOrder() { |
|
56 | - return 20; |
|
57 | - } |
|
49 | + /** |
|
50 | + * The user can re-arrange the tab order, but until they do, this |
|
51 | + * is the order in which tabs are shown. |
|
52 | + * |
|
53 | + * @return int |
|
54 | + */ |
|
55 | + public function defaultTabOrder() { |
|
56 | + return 20; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Display the age difference between marriages and the births of children. |
|
61 | - * |
|
62 | - * @param Date $prev |
|
63 | - * @param Date $next |
|
64 | - * @param int $child_number |
|
65 | - * |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - private static function ageDifference(Date $prev, Date $next, $child_number = 0) { |
|
69 | - if ($prev->isOK() && $next->isOK()) { |
|
70 | - $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); |
|
71 | - if ($days < 0) { |
|
72 | - // Show warning triangle if dates in reverse order |
|
73 | - $diff = '<i class="icon-warning"></i> '; |
|
74 | - } elseif ($child_number > 1 && $days > 1 && $days < 240) { |
|
75 | - // Show warning triangle if children born too close together |
|
76 | - $diff = '<i class="icon-warning"></i> '; |
|
77 | - } else { |
|
78 | - $diff = ''; |
|
79 | - } |
|
59 | + /** |
|
60 | + * Display the age difference between marriages and the births of children. |
|
61 | + * |
|
62 | + * @param Date $prev |
|
63 | + * @param Date $next |
|
64 | + * @param int $child_number |
|
65 | + * |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + private static function ageDifference(Date $prev, Date $next, $child_number = 0) { |
|
69 | + if ($prev->isOK() && $next->isOK()) { |
|
70 | + $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); |
|
71 | + if ($days < 0) { |
|
72 | + // Show warning triangle if dates in reverse order |
|
73 | + $diff = '<i class="icon-warning"></i> '; |
|
74 | + } elseif ($child_number > 1 && $days > 1 && $days < 240) { |
|
75 | + // Show warning triangle if children born too close together |
|
76 | + $diff = '<i class="icon-warning"></i> '; |
|
77 | + } else { |
|
78 | + $diff = ''; |
|
79 | + } |
|
80 | 80 | |
81 | - $months = round($days * 12 / 365.25); // Approximate - we do not know the calendar |
|
82 | - if (abs($months) == 12 || abs($months) >= 24) { |
|
83 | - $diff .= I18N::plural('%s year', '%s years', round($months / 12), I18N::number(round($months / 12))); |
|
84 | - } elseif ($months != 0) { |
|
85 | - $diff .= I18N::plural('%s month', '%s months', $months, I18N::number($months)); |
|
86 | - } |
|
81 | + $months = round($days * 12 / 365.25); // Approximate - we do not know the calendar |
|
82 | + if (abs($months) == 12 || abs($months) >= 24) { |
|
83 | + $diff .= I18N::plural('%s year', '%s years', round($months / 12), I18N::number(round($months / 12))); |
|
84 | + } elseif ($months != 0) { |
|
85 | + $diff .= I18N::plural('%s month', '%s months', $months, I18N::number($months)); |
|
86 | + } |
|
87 | 87 | |
88 | - return '<div class="elderdate age">' . $diff . '</div>'; |
|
89 | - } else { |
|
90 | - return ''; |
|
91 | - } |
|
92 | - } |
|
88 | + return '<div class="elderdate age">' . $diff . '</div>'; |
|
89 | + } else { |
|
90 | + return ''; |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Print a family group. |
|
96 | - * |
|
97 | - * @param Family $family |
|
98 | - * @param string $type |
|
99 | - * @param string $label |
|
100 | - */ |
|
101 | - private function printFamily(Family $family, $type, $label) { |
|
102 | - global $controller; |
|
94 | + /** |
|
95 | + * Print a family group. |
|
96 | + * |
|
97 | + * @param Family $family |
|
98 | + * @param string $type |
|
99 | + * @param string $label |
|
100 | + */ |
|
101 | + private function printFamily(Family $family, $type, $label) { |
|
102 | + global $controller; |
|
103 | 103 | |
104 | - if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { |
|
105 | - $access_level = Auth::PRIV_HIDE; |
|
106 | - } else { |
|
107 | - $access_level = Auth::accessLevel($family->getTree()); |
|
108 | - } |
|
104 | + if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { |
|
105 | + $access_level = Auth::PRIV_HIDE; |
|
106 | + } else { |
|
107 | + $access_level = Auth::accessLevel($family->getTree()); |
|
108 | + } |
|
109 | 109 | |
110 | - ?> |
|
110 | + ?> |
|
111 | 111 | <table> |
112 | 112 | <tr> |
113 | 113 | <td> |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | <table class="facts_table"> |
123 | 123 | <?php |
124 | 124 | |
125 | - ///// HUSB ///// |
|
126 | - $found = false; |
|
127 | - foreach ($family->getFacts('HUSB', false, $access_level) as $fact) { |
|
128 | - $found |= !$fact->isPendingDeletion(); |
|
129 | - $person = $fact->getTarget(); |
|
130 | - if ($person instanceof Individual) { |
|
131 | - if ($fact->isPendingAddition()) { |
|
132 | - $class = 'facts_label new'; |
|
133 | - } elseif ($fact->isPendingDeletion()) { |
|
134 | - $class = 'facts_label old'; |
|
135 | - } else { |
|
136 | - $class = 'facts_label'; |
|
137 | - } |
|
138 | - ?> |
|
125 | + ///// HUSB ///// |
|
126 | + $found = false; |
|
127 | + foreach ($family->getFacts('HUSB', false, $access_level) as $fact) { |
|
128 | + $found |= !$fact->isPendingDeletion(); |
|
129 | + $person = $fact->getTarget(); |
|
130 | + if ($person instanceof Individual) { |
|
131 | + if ($fact->isPendingAddition()) { |
|
132 | + $class = 'facts_label new'; |
|
133 | + } elseif ($fact->isPendingDeletion()) { |
|
134 | + $class = 'facts_label old'; |
|
135 | + } else { |
|
136 | + $class = 'facts_label'; |
|
137 | + } |
|
138 | + ?> |
|
139 | 139 | <tr> |
140 | 140 | <td class="<?php echo $class; ?>"> |
141 | 141 | <?php echo Functions::getCloseRelationshipName($controller->record, $person); ?> |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | </td> |
146 | 146 | </tr> |
147 | 147 | <?php |
148 | - } |
|
149 | - } |
|
150 | - if (!$found && $family->canEdit()) { |
|
151 | - ?> |
|
148 | + } |
|
149 | + } |
|
150 | + if (!$found && $family->canEdit()) { |
|
151 | + ?> |
|
152 | 152 | <tr> |
153 | 153 | <td class="facts_label"></td> |
154 | 154 | <td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'HUSB');"><?php echo I18N::translate('Add a husband to this family'); ?></a></td> |
155 | 155 | </tr> |
156 | 156 | <?php |
157 | - } |
|
157 | + } |
|
158 | 158 | |
159 | - ///// WIFE ///// |
|
160 | - $found = false; |
|
161 | - foreach ($family->getFacts('WIFE', false, $access_level) as $fact) { |
|
162 | - $person = $fact->getTarget(); |
|
163 | - if ($person instanceof Individual) { |
|
164 | - $found |= !$fact->isPendingDeletion(); |
|
165 | - if ($fact->isPendingAddition()) { |
|
166 | - $class = 'facts_label new'; |
|
167 | - } elseif ($fact->isPendingDeletion()) { |
|
168 | - $class = 'facts_label old'; |
|
169 | - } else { |
|
170 | - $class = 'facts_label'; |
|
171 | - } |
|
172 | - ?> |
|
159 | + ///// WIFE ///// |
|
160 | + $found = false; |
|
161 | + foreach ($family->getFacts('WIFE', false, $access_level) as $fact) { |
|
162 | + $person = $fact->getTarget(); |
|
163 | + if ($person instanceof Individual) { |
|
164 | + $found |= !$fact->isPendingDeletion(); |
|
165 | + if ($fact->isPendingAddition()) { |
|
166 | + $class = 'facts_label new'; |
|
167 | + } elseif ($fact->isPendingDeletion()) { |
|
168 | + $class = 'facts_label old'; |
|
169 | + } else { |
|
170 | + $class = 'facts_label'; |
|
171 | + } |
|
172 | + ?> |
|
173 | 173 | <tr> |
174 | 174 | <td class="<?php echo $class; ?>"> |
175 | 175 | <?php echo Functions::getCloseRelationshipName($controller->record, $person); ?> |
@@ -179,30 +179,30 @@ discard block |
||
179 | 179 | </td> |
180 | 180 | </tr> |
181 | 181 | <?php |
182 | - } |
|
183 | - } |
|
184 | - if (!$found && $family->canEdit()) { |
|
185 | - ?> |
|
182 | + } |
|
183 | + } |
|
184 | + if (!$found && $family->canEdit()) { |
|
185 | + ?> |
|
186 | 186 | <tr> |
187 | 187 | <td class="facts_label"></td> |
188 | 188 | <td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'WIFE');"><?php echo I18N::translate('Add a wife to this family'); ?></a></td> |
189 | 189 | </tr> |
190 | 190 | <?php |
191 | - } |
|
191 | + } |
|
192 | 192 | |
193 | - ///// MARR ///// |
|
194 | - $found = false; |
|
195 | - $prev = new Date(''); |
|
196 | - foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { |
|
197 | - $found |= !$fact->isPendingDeletion(); |
|
198 | - if ($fact->isPendingAddition()) { |
|
199 | - $class = ' new'; |
|
200 | - } elseif ($fact->isPendingDeletion()) { |
|
201 | - $class = ' old'; |
|
202 | - } else { |
|
203 | - $class = ''; |
|
204 | - } |
|
205 | - ?> |
|
193 | + ///// MARR ///// |
|
194 | + $found = false; |
|
195 | + $prev = new Date(''); |
|
196 | + foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { |
|
197 | + $found |= !$fact->isPendingDeletion(); |
|
198 | + if ($fact->isPendingAddition()) { |
|
199 | + $class = ' new'; |
|
200 | + } elseif ($fact->isPendingDeletion()) { |
|
201 | + $class = ' old'; |
|
202 | + } else { |
|
203 | + $class = ''; |
|
204 | + } |
|
205 | + ?> |
|
206 | 206 | <tr> |
207 | 207 | <td class="facts_label"> |
208 | 208 | </td> |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | </td> |
212 | 212 | </tr> |
213 | 213 | <?php |
214 | - if (!$prev->isOK() && $fact->getDate()->isOK()) { |
|
215 | - $prev = $fact->getDate(); |
|
216 | - } |
|
217 | - } |
|
218 | - if (!$found && $family->canShow() && $family->canEdit()) { |
|
219 | - // Add a new marriage |
|
220 | - ?> |
|
214 | + if (!$prev->isOK() && $fact->getDate()->isOK()) { |
|
215 | + $prev = $fact->getDate(); |
|
216 | + } |
|
217 | + } |
|
218 | + if (!$found && $family->canShow() && $family->canEdit()) { |
|
219 | + // Add a new marriage |
|
220 | + ?> |
|
221 | 221 | <tr> |
222 | 222 | <td class="facts_label"> |
223 | 223 | </td> |
@@ -228,30 +228,30 @@ discard block |
||
228 | 228 | </td> |
229 | 229 | </tr> |
230 | 230 | <?php |
231 | - } |
|
231 | + } |
|
232 | 232 | |
233 | - ///// CHIL ///// |
|
234 | - $child_number = 0; |
|
235 | - foreach ($family->getFacts('CHIL', false, $access_level) as $fact) { |
|
236 | - $person = $fact->getTarget(); |
|
237 | - if ($person instanceof Individual) { |
|
238 | - if ($fact->isPendingAddition()) { |
|
239 | - $child_number++; |
|
240 | - $class = 'facts_label new'; |
|
241 | - } elseif ($fact->isPendingDeletion()) { |
|
242 | - $class = 'facts_label old'; |
|
243 | - } else { |
|
244 | - $child_number++; |
|
245 | - $class = 'facts_label'; |
|
246 | - } |
|
247 | - $next = new Date(''); |
|
248 | - foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { |
|
249 | - if ($bfact->getDate()->isOK()) { |
|
250 | - $next = $bfact->getDate(); |
|
251 | - break; |
|
252 | - } |
|
253 | - } |
|
254 | - ?> |
|
233 | + ///// CHIL ///// |
|
234 | + $child_number = 0; |
|
235 | + foreach ($family->getFacts('CHIL', false, $access_level) as $fact) { |
|
236 | + $person = $fact->getTarget(); |
|
237 | + if ($person instanceof Individual) { |
|
238 | + if ($fact->isPendingAddition()) { |
|
239 | + $child_number++; |
|
240 | + $class = 'facts_label new'; |
|
241 | + } elseif ($fact->isPendingDeletion()) { |
|
242 | + $class = 'facts_label old'; |
|
243 | + } else { |
|
244 | + $child_number++; |
|
245 | + $class = 'facts_label'; |
|
246 | + } |
|
247 | + $next = new Date(''); |
|
248 | + foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { |
|
249 | + if ($bfact->getDate()->isOK()) { |
|
250 | + $next = $bfact->getDate(); |
|
251 | + break; |
|
252 | + } |
|
253 | + } |
|
254 | + ?> |
|
255 | 255 | <tr> |
256 | 256 | <td class="<?php echo $class; ?>"> |
257 | 257 | <?php echo self::ageDifference($prev, $next, $child_number); ?> |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | </td> |
263 | 263 | </tr> |
264 | 264 | <?php |
265 | - $prev = $next; |
|
266 | - } |
|
267 | - } |
|
268 | - // Re-order children / add a new child |
|
269 | - if ($family->canEdit()) { |
|
270 | - if ($type == 'FAMS') { |
|
271 | - $add_child_text = I18N::translate('Add a son or daughter'); |
|
272 | - } else { |
|
273 | - $add_child_text = I18N::translate('Add a brother or sister'); |
|
274 | - } |
|
275 | - ?> |
|
265 | + $prev = $next; |
|
266 | + } |
|
267 | + } |
|
268 | + // Re-order children / add a new child |
|
269 | + if ($family->canEdit()) { |
|
270 | + if ($type == 'FAMS') { |
|
271 | + $add_child_text = I18N::translate('Add a son or daughter'); |
|
272 | + } else { |
|
273 | + $add_child_text = I18N::translate('Add a brother or sister'); |
|
274 | + } |
|
275 | + ?> |
|
276 | 276 | <tr class="noprint"> |
277 | 277 | <td class="facts_label"> |
278 | 278 | <?php if (count($family->getChildren()) > 1) { ?> |
@@ -288,25 +288,25 @@ discard block |
||
288 | 288 | </td> |
289 | 289 | </tr> |
290 | 290 | <?php |
291 | - } |
|
291 | + } |
|
292 | 292 | |
293 | - echo '</table>'; |
|
293 | + echo '</table>'; |
|
294 | 294 | |
295 | - return; |
|
296 | - } |
|
295 | + return; |
|
296 | + } |
|
297 | 297 | |
298 | - /** {@inheritdoc} */ |
|
299 | - public function getTabContent() { |
|
300 | - global $show_full, $controller; |
|
298 | + /** {@inheritdoc} */ |
|
299 | + public function getTabContent() { |
|
300 | + global $show_full, $controller; |
|
301 | 301 | |
302 | - if (isset($show_full)) { |
|
303 | - $saved_show_full = $show_full; |
|
304 | - } |
|
305 | - // We always want to see full details here |
|
306 | - $show_full = 1; |
|
302 | + if (isset($show_full)) { |
|
303 | + $saved_show_full = $show_full; |
|
304 | + } |
|
305 | + // We always want to see full details here |
|
306 | + $show_full = 1; |
|
307 | 307 | |
308 | - ob_start(); |
|
309 | - ?> |
|
308 | + ob_start(); |
|
309 | + ?> |
|
310 | 310 | <table class="facts_table"> |
311 | 311 | <tr class="noprint"> |
312 | 312 | <td class="descriptionbox rela"> |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | </tr> |
319 | 319 | </table> |
320 | 320 | <?php |
321 | - $families = $controller->record->getChildFamilies(); |
|
322 | - if (!$families && $controller->record->canEdit()) { |
|
323 | - ?> |
|
321 | + $families = $controller->record->getChildFamilies(); |
|
322 | + if (!$families && $controller->record->canEdit()) { |
|
323 | + ?> |
|
324 | 324 | <table class="facts_table"> |
325 | 325 | <tr> |
326 | 326 | <td class="facts_value"><a href="#" onclick="return add_parent_to_individual('<?php echo $controller->record->getXref(); ?>', 'M');"><?php echo I18N::translate('Add a father'); ?></td> |
@@ -330,34 +330,34 @@ discard block |
||
330 | 330 | </tr> |
331 | 331 | </table> |
332 | 332 | <?php |
333 | - } |
|
333 | + } |
|
334 | 334 | |
335 | - // parents |
|
336 | - foreach ($families as $family) { |
|
337 | - $this->printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family)); |
|
338 | - } |
|
335 | + // parents |
|
336 | + foreach ($families as $family) { |
|
337 | + $this->printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family)); |
|
338 | + } |
|
339 | 339 | |
340 | - // step-parents |
|
341 | - foreach ($controller->record->getChildStepFamilies() as $family) { |
|
342 | - $this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family)); |
|
343 | - } |
|
340 | + // step-parents |
|
341 | + foreach ($controller->record->getChildStepFamilies() as $family) { |
|
342 | + $this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family)); |
|
343 | + } |
|
344 | 344 | |
345 | - // spouses |
|
346 | - $families = $controller->record->getSpouseFamilies(); |
|
347 | - foreach ($families as $family) { |
|
348 | - $this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record)); |
|
349 | - } |
|
345 | + // spouses |
|
346 | + $families = $controller->record->getSpouseFamilies(); |
|
347 | + foreach ($families as $family) { |
|
348 | + $this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record)); |
|
349 | + } |
|
350 | 350 | |
351 | - // step-children |
|
352 | - foreach ($controller->record->getSpouseStepFamilies() as $family) { |
|
353 | - $this->printFamily($family, 'FAMS', $family->getFullName()); |
|
354 | - } |
|
351 | + // step-children |
|
352 | + foreach ($controller->record->getSpouseStepFamilies() as $family) { |
|
353 | + $this->printFamily($family, 'FAMS', $family->getFullName()); |
|
354 | + } |
|
355 | 355 | |
356 | - if ($controller->record->canEdit()) { |
|
357 | - ?> |
|
356 | + if ($controller->record->canEdit()) { |
|
357 | + ?> |
|
358 | 358 | <br><table class="facts_table noprint"> |
359 | 359 | <?php |
360 | - if (count($families) > 1) { ?> |
|
360 | + if (count($families) > 1) { ?> |
|
361 | 361 | <tr> |
362 | 362 | <td class="facts_value"> |
363 | 363 | <a href="#" onclick="return reorder_families('<?php echo $controller->record->getXref(); ?>');"><?php echo I18N::translate('Re-order families'); ?></a> |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | </td> |
382 | 382 | </tr> |
383 | 383 | <?php } |
384 | - if ($controller->record->getSex() != "M") { ?> |
|
384 | + if ($controller->record->getSex() != "M") { ?> |
|
385 | 385 | <tr> |
386 | 386 | <td class="facts_value"> |
387 | 387 | <a href="#" onclick="return add_spouse_to_individual('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo I18N::translate('Add a husband'); ?></a> |
@@ -406,29 +406,29 @@ discard block |
||
406 | 406 | </script> |
407 | 407 | <?php |
408 | 408 | |
409 | - unset($show_full); |
|
410 | - if (isset($saved_show_full)) { |
|
411 | - $show_full = $saved_show_full; |
|
412 | - } |
|
409 | + unset($show_full); |
|
410 | + if (isset($saved_show_full)) { |
|
411 | + $show_full = $saved_show_full; |
|
412 | + } |
|
413 | 413 | |
414 | - return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; |
|
415 | - } |
|
414 | + return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; |
|
415 | + } |
|
416 | 416 | |
417 | - /** {@inheritdoc} */ |
|
418 | - public function hasTabContent() { |
|
419 | - return true; |
|
420 | - } |
|
421 | - /** {@inheritdoc} */ |
|
422 | - public function isGrayedOut() { |
|
423 | - return false; |
|
424 | - } |
|
425 | - /** {@inheritdoc} */ |
|
426 | - public function canLoadAjax() { |
|
427 | - return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
|
428 | - } |
|
417 | + /** {@inheritdoc} */ |
|
418 | + public function hasTabContent() { |
|
419 | + return true; |
|
420 | + } |
|
421 | + /** {@inheritdoc} */ |
|
422 | + public function isGrayedOut() { |
|
423 | + return false; |
|
424 | + } |
|
425 | + /** {@inheritdoc} */ |
|
426 | + public function canLoadAjax() { |
|
427 | + return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
|
428 | + } |
|
429 | 429 | |
430 | - /** {@inheritdoc} */ |
|
431 | - public function getPreLoadContent() { |
|
432 | - return ''; |
|
433 | - } |
|
430 | + /** {@inheritdoc} */ |
|
431 | + public function getPreLoadContent() { |
|
432 | + return ''; |
|
433 | + } |
|
434 | 434 | } |
@@ -27,13 +27,15 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Class RelativesTabModule |
29 | 29 | */ |
30 | -class RelativesTabModule extends AbstractModule implements ModuleTabInterface { |
|
30 | +class RelativesTabModule extends AbstractModule implements ModuleTabInterface |
|
31 | +{ |
|
31 | 32 | /** |
32 | 33 | * How should this module be labelled on tabs, menus, etc.? |
33 | 34 | * |
34 | 35 | * @return string |
35 | 36 | */ |
36 | - public function getTitle() { |
|
37 | + public function getTitle() |
|
38 | + { |
|
37 | 39 | return /* I18N: Name of a module */ I18N::translate('Families'); |
38 | 40 | } |
39 | 41 | |
@@ -42,7 +44,8 @@ discard block |
||
42 | 44 | * |
43 | 45 | * @return string |
44 | 46 | */ |
45 | - public function getDescription() { |
|
47 | + public function getDescription() |
|
48 | + { |
|
46 | 49 | return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); |
47 | 50 | } |
48 | 51 | |
@@ -52,7 +55,8 @@ discard block |
||
52 | 55 | * |
53 | 56 | * @return int |
54 | 57 | */ |
55 | - public function defaultTabOrder() { |
|
58 | + public function defaultTabOrder() |
|
59 | + { |
|
56 | 60 | return 20; |
57 | 61 | } |
58 | 62 | |
@@ -65,7 +69,8 @@ discard block |
||
65 | 69 | * |
66 | 70 | * @return string |
67 | 71 | */ |
68 | - private static function ageDifference(Date $prev, Date $next, $child_number = 0) { |
|
72 | + private static function ageDifference(Date $prev, Date $next, $child_number = 0) |
|
73 | + { |
|
69 | 74 | if ($prev->isOK() && $next->isOK()) { |
70 | 75 | $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); |
71 | 76 | if ($days < 0) { |
@@ -98,7 +103,8 @@ discard block |
||
98 | 103 | * @param string $type |
99 | 104 | * @param string $label |
100 | 105 | */ |
101 | - private function printFamily(Family $family, $type, $label) { |
|
106 | + private function printFamily(Family $family, $type, $label) |
|
107 | + { |
|
102 | 108 | global $controller; |
103 | 109 | |
104 | 110 | if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { |
@@ -296,7 +302,8 @@ discard block |
||
296 | 302 | } |
297 | 303 | |
298 | 304 | /** {@inheritdoc} */ |
299 | - public function getTabContent() { |
|
305 | + public function getTabContent() |
|
306 | + { |
|
300 | 307 | global $show_full, $controller; |
301 | 308 | |
302 | 309 | if (isset($show_full)) { |
@@ -415,20 +422,24 @@ discard block |
||
415 | 422 | } |
416 | 423 | |
417 | 424 | /** {@inheritdoc} */ |
418 | - public function hasTabContent() { |
|
425 | + public function hasTabContent() |
|
426 | + { |
|
419 | 427 | return true; |
420 | 428 | } |
421 | 429 | /** {@inheritdoc} */ |
422 | - public function isGrayedOut() { |
|
430 | + public function isGrayedOut() |
|
431 | + { |
|
423 | 432 | return false; |
424 | 433 | } |
425 | 434 | /** {@inheritdoc} */ |
426 | - public function canLoadAjax() { |
|
435 | + public function canLoadAjax() |
|
436 | + { |
|
427 | 437 | return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
428 | 438 | } |
429 | 439 | |
430 | 440 | /** {@inheritdoc} */ |
431 | - public function getPreLoadContent() { |
|
441 | + public function getPreLoadContent() |
|
442 | + { |
|
432 | 443 | return ''; |
433 | 444 | } |
434 | 445 | } |