Example #1
0
 function countReadFeeds($user_id)
 {
     require_once APPPATH . 'models/cacheManagers/lu_cm.php';
     $cm = new lu_cm($user_id);
     $cache = $cm->fetch();
     if ($cache) {
         return $cache;
     }
     $sql = "SELECT count(item_sid) AS count, feed_id " . "FROM lus " . "WHERE lus.user_id = '{$user_id}' GROUP BY feed_id";
     $result = $this->query($sql);
     $count = array();
     foreach ($result as $row) {
         $count[$row->feed_id] = intVal($row->count);
     }
     $cm->add($count);
     return $count;
 }
Example #2
0
 function markAllFeedsAsReadAjax()
 {
     $response = array();
     $user = $this->auth->getUser();
     $this->load->model('subscription');
     $feed_ids = $this->subscription->getSubscriptionIds($user->id);
     $items = $this->item->getSIDsInFeeds($feed_ids, $user->id);
     $this->item->markAllAsRead($items, $user->id);
     require_once APPPATH . 'models/cacheManagers/lu_cm.php';
     $cm = new lu_cm($user->id);
     $cm->delete();
     $this->sendToAjax($response);
 }