Exemplo n.º 1
0
 protected function run($argument)
 {
     // Remove activities that are older then one year
     $expireDays = \OCP\Config::getSystemValue('activity_expire_days', 365);
     $data = new \OCA\Activity\Data(\OC::$server->getActivityManager());
     $data->expire($expireDays);
 }
Exemplo n.º 2
0
 /**
  * @dataProvider getFilterFromParamData
  */
 public function testGetFilterFromParam($globalValue, $expected)
 {
     if ($globalValue !== null) {
         $_GET['filter'] = $globalValue;
     }
     $data = new \OCA\Activity\Data($this->getMock('\\OCP\\Activity\\IManager'));
     $this->assertEquals($expected, $data->getFilterFromParam());
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
    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();
}
Exemplo n.º 5
0
 */
// 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();
Exemplo n.º 6
0
* @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();
Exemplo n.º 7
0
/**
 * 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);
Exemplo n.º 8
0
* 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/>.
*/
\OCP\Util::addScript('activity', 'settings');
\OCP\Util::addStyle('activity', 'settings');
$l = \OCP\Util::getL10N('activity');
$data = new \OCA\Activity\Data(\OC::$server->getActivityManager());
$types = $data->getNotificationTypes($l);
$user = \OCP\User::getUser();
$activities = array();
foreach ($types as $type => $desc) {
    $activities[$type] = array('desc' => $desc, 'email' => \OCA\Activity\UserSettings::getUserSetting($user, 'email', $type), 'stream' => \OCA\Activity\UserSettings::getUserSetting($user, 'stream', $type));
}
$template = new \OCP\Template('activity', 'personal');
$template->assign('activities', $activities);
if (\OCA\Activity\UserSettings::getUserSetting($user, 'setting', 'batchtime') == 3600 * 24 * 7) {
    $template->assign('setting_batchtime', \OCA\Activity\UserSettings::EMAIL_SEND_WEEKLY);
} else {
    if (\OCA\Activity\UserSettings::getUserSetting($user, 'setting', 'batchtime') == 3600 * 24) {
        $template->assign('setting_batchtime', \OCA\Activity\UserSettings::EMAIL_SEND_DAILY);
    } else {
        $template->assign('setting_batchtime', \OCA\Activity\UserSettings::EMAIL_SEND_HOURLY);
Exemplo n.º 9
0
 * 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/>.
 *
 */
// 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', 'script');
\OCP\Util::addStyle('activity', 'style');
$navigation = new \OCA\Activity\Navigation(\OCP\Util::getL10N('activity'), \OC::$server->getActivityManager(), \OC::$server->getURLGenerator());
$navigation->setRSSToken(\OCP\Config::getUserValue(\OCP\User::getUser(), 'activity', 'rsstoken'));
// get the page that is requested. Needed for endless scrolling
$data = new \OCA\Activity\Data(\OC::$server->getActivityManager());
$page = $data->getPageFromParam() - 1;
$filter = $data->getFilterFromParam();
// show activity template
$tmpl = new \OCP\Template('activity', 'list', 'user');
$tmpl->assign('filter', $filter);
$tmpl->assign('appNavigation', $navigation->getTemplate($filter));
$tmpl->printPage();