public static function get($param) { $l = \OCP\Util::getL10N('activity'); $data = new \OCA\Activity\Data(\OC::$server->getActivityManager()); $groupHelper = new \OCA\Activity\GroupHelper(\OC::$server->getActivityManager(), new \OCA\Activity\DataHelper(\OC::$server->getActivityManager(), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), \OC::$server->getConfig(), $l), $l), false); $start = isset($_GET['start']) ? $_GET['start'] : 0; $count = isset($_GET['count']) ? $_GET['count'] : self::DEFAULT_LIMIT; $activities = $data->read($groupHelper, $start, $count, 'all'); $data = array(); foreach ($activities as $entry) { $data[] = array('id' => $entry['activity_id'], 'subject' => (string) $entry['subjectformatted']['full'], 'message' => (string) $entry['messageformatted']['full'], 'file' => $entry['file'], 'link' => $entry['link'], 'date' => date('c', $entry['timestamp'])); } return new \OC_OCS_Result($data); }
if (sizeof($users) !== 1) { // User not found header('HTTP/1.0 404 Not Found'); exit; } // Token found login as that user \OC_User::setUserId(array_shift($users)); $forceUserLogout = true; } // check if the user has the right permissions. \OCP\User::checkLoggedIn(); // rss is of content type text/xml if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/rss+xml')) { header('Content-Type: application/rss+xml'); } else { header('Content-Type: text/xml; charset=UTF-8'); } // generate and show the rss feed $l = \OCP\Util::getL10N('activity'); $data = new \OCA\Activity\Data(\OC::$server->getActivityManager()); $groupHelper = new \OCA\Activity\GroupHelper(\OC::$server->getActivityManager(), new \OCA\Activity\DataHelper(\OC::$server->getActivityManager(), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), $l), $l), false); $tmpl = new \OCP\Template('activity', 'rss'); $tmpl->assign('rssLang', \OC_Preferences::getValue(\OCP\User::getUser(), 'core', 'lang')); $tmpl->assign('rssLink', \OCP\Util::linkToAbsolute('activity', 'rss.php')); $tmpl->assign('rssPubDate', date('r')); $tmpl->assign('user', \OCP\User::getUser()); $tmpl->assign('activities', $data->read($groupHelper, 0, 30, 'all')); $tmpl->printPage(); if ($forceUserLogout) { \OC_User::logout(); }
* @copyright 2013 Frank Karlitschek frank@owncloud.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library 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 library. If not, see <http://www.gnu.org/licenses/>. * */ // some housekeeping \OCP\JSON::checkLoggedIn(); \OCP\JSON::checkAppEnabled('activity'); $l = \OCP\Util::getL10N('activity'); $data = new \OCA\Activity\Data(\OC::$server->getActivityManager()); $groupHelper = new \OCA\Activity\GroupHelper(\OC::$server->getActivityManager(), new \OCA\Activity\DataHelper(\OC::$server->getActivityManager(), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), $l), $l), true); $page = $data->getPageFromParam() - 1; $filter = $data->getFilterFromParam(); // Read the next 30 items for the endless scrolling $count = 30; $activity = $data->read($groupHelper, $page * $count, $count, $filter); // show the next 30 entries $tmpl = new \OCP\Template('activity', 'activities.part', ''); $tmpl->assign('activity', $activity); $tmpl->printPage();
*/ // check if the user has the right permissions to access the activities OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('activity'); // activate the right navigation entry OCP\App::setActiveNavigationEntry('activity'); // load the needed js scripts and css OCP\Util::addScript('activity', 'jquery.masonry.min'); OCP\Util::addScript('activity', 'jquery.infinitescroll.min'); OCP\Util::addScript('activity', 'script'); OCP\Util::addStyle('activity', 'style'); // get the page that is requested. Needed for endless scrolling if (isset($_GET['page'])) { $page = intval($_GET['page']) - 1; } else { $page = 0; } // get rss url $rsslink = \OCP\Util::linkToAbsolute('activity', 'rss.php'); $nextpage = \OCP\Util::linkToAbsolute('activity', 'index.php', array('page' => $page + 2)); // read activities data $count = 30; $activity = OCA\Activity\Data::read($page * $count, 30); // show activity template $tmpl = new \OCP\Template('activity', 'list', 'user'); $tmpl->assign('rsslink', $rsslink); $tmpl->assign('activity', $activity); if ($page == 0) { $tmpl->assign('nextpage', $nextpage); } $tmpl->printPage();
<?php /** * ownCloud - Activity app * * @author Frank Karlitschek * @copyright 2013 Frank Karlitschek frank@owncloud.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library 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 Lesser General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ // check if the user has the right permissions. OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('activity'); // read the data $activities = OCA\Activity\Data::read(0, 30); // generate an absolute link to the rss feed. $rsslink = \OCP\Util::linkToAbsolute('activity', 'rss.php'); // generate and show the rss feed echo OCA\Activity\Data::generaterss($rsslink, $activities);