예제 #1
0
파일: Items.php 프로젝트: dled/selfoss
 /**
  * returns current basic stats
  * json
  *
  * @return void
  */
 public function stats()
 {
     $this->needsLoggedInOrPublicMode();
     $itemsDao = new \daos\Items();
     $stats = $itemsDao->stats();
     $stats['unread'] -= $itemsDao->numberOfUnreadForTag("#");
     $tagsDao = new \daos\Tags();
     $tags = $tagsDao->getWithUnread();
     if ($tagsDao->hasTag("#")) {
         foreach ($tags as $tag) {
             if (strcmp($tag["tag"], "#") !== 0) {
                 continue;
             }
             $stats['unread'] -= $tag["unread"];
         }
     }
     if (array_key_exists('tags', $_GET) && $_GET['tags'] == 'true') {
         $tagsDao = new \daos\Tags();
         $tagsController = new \controllers\Tags();
         $stats['tagshtml'] = $tagsController->renderTags($tagsDao->getWithUnread());
     }
     if (array_key_exists('sources', $_GET) && $_GET['sources'] == 'true') {
         $sourcesDao = new \daos\Sources();
         $sourcesController = new \controllers\Sources();
         $stats['sourceshtml'] = $sourcesController->renderSources($sourcesDao->getWithUnread());
     }
     $this->view->jsonSuccess($stats);
 }
예제 #2
0
 /**
  * returns all tags
  * html
  *
  * @return void
  */
 public function listTags()
 {
     $tagsDao = new \daos\Tags();
     $tags = $tagsDao->get();
     $itemsDao = new \daos\Items();
     for ($i = 0; $i < count($tags); $i++) {
         $tags[$i]['unread'] = $itemsDao->numberOfUnreadForTag($tags[$i]['tag']);
     }
     $this->view->jsonSuccess($tags);
 }