@@ 177-203 (lines=27) @@ | ||
174 | * @param array $topic_data Topic to be marked as solved. |
|
175 | * @param int $post_id Post to mark as the solution. |
|
176 | */ |
|
177 | public function mark_solved($topic_data, $post_id) |
|
178 | { |
|
179 | // Database column values to set. |
|
180 | $column_data = array('topic_solved' => $post_id); |
|
181 | ||
182 | if ($topic_data['forum_lock_solved'] && |
|
183 | $this->user_can_lock_post($topic_data['forum_id'])) |
|
184 | { |
|
185 | $column_data['topic_status'] = ITEM_LOCKED; |
|
186 | } |
|
187 | ||
188 | $this->update_topic($topic_data['topic_id'], $column_data); |
|
189 | ||
190 | /** |
|
191 | * This event allows you to perform additional actions after a topic has been marked as solved. |
|
192 | * |
|
193 | * @event tierra.topicsolved.mark_solved_after |
|
194 | * @var array topic_data Array with general topic data |
|
195 | * @var array column_data Array with topic data that the database has been updated with |
|
196 | * @since 2.2.0 |
|
197 | */ |
|
198 | $vars = array( |
|
199 | 'topic_data', |
|
200 | 'column_data', |
|
201 | ); |
|
202 | extract($this->dispatcher->trigger_event('tierra.topicsolved.mark_solved_after', compact($vars))); |
|
203 | } |
|
204 | ||
205 | /** |
|
206 | * Marks a topic as unsolved. |
|
@@ 210-236 (lines=27) @@ | ||
207 | * |
|
208 | * @param array $topic_data Topic to be marked as unsolved. |
|
209 | */ |
|
210 | public function mark_unsolved($topic_data) |
|
211 | { |
|
212 | // Database column values to set. |
|
213 | $column_data = array('topic_solved' => 0); |
|
214 | ||
215 | if ($topic_data['forum_lock_solved'] && |
|
216 | $this->auth->acl_get('m_lock', $topic_data['forum_id'])) |
|
217 | { |
|
218 | $column_data['topic_status'] = ITEM_UNLOCKED; |
|
219 | } |
|
220 | ||
221 | $this->update_topic($topic_data['topic_id'], $column_data); |
|
222 | ||
223 | /** |
|
224 | * This event allows you to perform additional actions after a topic has been marked as unsolved. |
|
225 | * |
|
226 | * @event tierra.topicsolved.mark_unsolved_after |
|
227 | * @var array topic_data Array with general topic data |
|
228 | * @var array column_data Array with topic data that the database has been updated with |
|
229 | * @since 2.2.0 |
|
230 | */ |
|
231 | $vars = array( |
|
232 | 'topic_data', |
|
233 | 'column_data', |
|
234 | ); |
|
235 | extract($this->dispatcher->trigger_event('tierra.topicsolved.mark_unsolved_after', compact($vars))); |
|
236 | } |
|
237 | ||
238 | /** |
|
239 | * Checks if the currently logged in user has permission to lock a post. |