Files
FreshRSS/app/views/javascript/nbUnreadsPerFeed.phtml
Alexandre Alapetite fe7d9bbcd6 Typed view model classes (#5380)
* Typed view model classes
* Add ability to provide a typed view model class to a controller
* Use `::class` instead of string for referring to classes
* Examplified with `stats` and `javascript` controllers / views (more to do)
* Also useful for extensions (my usecase today), which did not have the ability to define own view model attributes before.

* Typo
2023-05-11 12:53:32 +02:00

17 lines
353 B
PHTML

<?php
/** @var FreshRSS_ViewJavascript $this */
$result = array(
'feeds' => array(),
'tags' => array(),
);
foreach ($this->categories as $cat) {
foreach ($cat->feeds() as $feed) {
$result['feeds'][$feed->id()] = $feed->nbNotRead();
}
}
foreach ($this->tags as $tag) {
$result['tags'][$tag->id()] = $tag->nbUnread();
}
echo json_encode($result);