public function action_index() { $p = Pagination::factory(array('total_items' => ORM::factory('user_event')->where('scope', '=', Sourcemap_User_Event::EVERYBODY)->count_all())); $announcements = ORM::factory('user_event')->where('scope', '=', Sourcemap_User_Event::EVERYBODY)->order_by('timestamp', 'desc')->limit($p->items_per_page)->offset($p->offset)->find_all()->as_array(null, true); foreach ($announcements as $i => $announcement) { $message = ''; if ($data = @json_decode($announcement->data)) { if (isset($data->message)) { $message = Sourcemap_Markdown::markdown($data->message); } } $announcement->message = $message; } $this->template->announcements = $announcements; $this->template->page_links = $p->render(); }
<?php /* Copyright (C) Sourcemap 2011 * This program is free software: you can redistribute it and/or modify it under the terms * of the GNU Affero General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License along with this * program. If not, see <http://www.gnu.org/licenses/>.*/ ?> <p><?php echo Sourcemap_Markdown::markdown($message); ?> </p>