Server IP : 184.154.167.98 / Your IP : 3.144.4.50 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/fotografico/apps/activity/lib/ |
Upload File : |
<?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Joas Schilling <coding@schilljs.com> * @author Roeland Jago Douma <roeland@famdouma.nl> * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * 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, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace OCA\Activity; use OCP\Activity\IFilter; use OCP\Activity\IManager; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; use OCP\Template; /** * Class Navigation * * @package OCA\Activity */ class Navigation { /** @var IL10N */ protected $l; /** @var IManager */ protected $activityManager; /** @var IURLGenerator */ protected $URLGenerator; /** @var IConfig */ protected $config; /** @var CurrentUser */ protected $currentUser; /** * Construct * * @param IL10N $l * @param IManager $manager * @param IURLGenerator $URLGenerator * @param IConfig $config * @param CurrentUser $currentUser */ public function __construct(IL10N $l, IManager $manager, IURLGenerator $URLGenerator, IConfig $config, CurrentUser $currentUser) { $this->l = $l; $this->activityManager = $manager; $this->URLGenerator = $URLGenerator; $this->config = $config; $this->currentUser = $currentUser; } /** * Get the users we want to send an email to * * @param null|string $forceActive Navigation entry that should be marked as active * @return \OCP\Template */ public function getTemplate($forceActive = 'all') { $active = $forceActive ?: 'all'; $template = new Template('activity', 'stream.app.navigation', ''); $template->assign('activeNavigation', $active); $template->assign('navigations', $this->getLinkList()); $template->assign('rssLink', $this->getRSSLink()); return $template; } /** * @return string */ protected function getRSSLink() { $rssToken = $this->config->getUserValue($this->currentUser->getUID(), 'activity', 'rsstoken'); if ($rssToken) { return $this->URLGenerator->linkToRouteAbsolute('activity.Feed.show', array('token' => $rssToken)); } else { return ''; } } /** * Get all items for the users we want to send an email to * * @return array Notification data (user => array of rows from the table) */ public function getLinkList() { $filters = $this->activityManager->getFilters(); usort($filters, function(IFilter $a, IFilter $b) { if ($a->getPriority() === $b->getPriority()) { return $a->getIdentifier() > $b->getIdentifier(); } return $a->getPriority() > $b->getPriority(); }); $entries = []; foreach ($filters as $filter) { $entries[] = [ 'id' => $filter->getIdentifier(), 'icon' => $filter->getIcon(), 'name' => $filter->getName(), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => $filter->getIdentifier())), ]; } return $entries; } }