* This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file * */ // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('news'); OCP\JSON::callCheck(); session_write_close(); $feedId = $_POST['feedId']; $mostRecentItemId = (int) $_POST['mostRecentItemId']; $itemMapper = new OCA\News\ItemMapper(); //echo $mostRecentItem->getDate(); switch ($feedId) { case -2: $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::UNREAD); break; case -1: $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::UNREAD | OCA\News\StatusFlag::IMPORTANT); break; default: $items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD); break; } // FIXME: maybe there is a way to set all items read in the // FeedMapper instead of iterating through every item and updating as // necessary $success = false; if ($mostRecentItemId !== 0) { $mostRecentItem = $itemMapper->findById($mostRecentItemId); }
<?php $feedId = isset($_['feedid']) ? $_['feedid'] : ''; $itemMapper = new OCA\News\ItemMapper(); $showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll'); $specialfeed = false; if ($feedId == -1 || $feedId == -2) { //TODO: change this values, too obscure $specialfeed = true; $status = $feedId == -1 ? OCA\News\StatusFlag::IMPORTANT : OCA\News\StatusFlag::UNREAD; $items = $itemMapper->findEveryItemByStatus($status); } else { if ($showAll) { $items = $itemMapper->findByFeedId($feedId); } else { $items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD); } } echo '<ul>'; foreach ($items as $item) { if ($item->isRead()) { $newsItemClass = "read"; } else { $newsItemClass = ""; } if ($item->isImportant()) { $starClass = 'important'; $startTitle = $l->t('Mark as unimportant'); } else { $starClass = ''; $startTitle = $l->t('Mark as important');