Airship\Cabin\Bridge\Landing\Blog::listSeries PHP Method

listSeries() public method

public listSeries ( mixed $page = null )
$page mixed
    public function listSeries($page = null)
    {
        list($offset, $limit) = $this->getOffsetAndLimit($page);
        if ($this->isSuperUser()) {
            $series = $this->blog->getAllSeries($offset, $limit);
            $count = $this->blog->numSeries();
        } else {
            $userId = $this->getActiveUserId();
            $series = $this->blog->getSeriesForUser($userId, $offset, $limit);
            $count = $this->blog->numSeriesForUser($userId);
        }
        $authors = [];
        foreach ($series as $i => $s) {
            $s['seriesid'] = (int) $s['seriesid'];
            $s['author'] = (int) $s['author'];
            if (empty($authors[$s['author']]) && !empty($s['author'])) {
                $authors[$s['author']] = $this->author->getById($s['author']);
            }
            $series[$i]['author_data'] = $authors[$s['author']];
            $series[$i]['num_items'] = $this->blog->numItemsInSeries($s['seriesid']);
        }
        $this->lens('blog/series', ['active_link' => 'bridge-link-blog-series', 'series' => $series, 'pagination' => ['base' => $this->airship_cabin_prefix . '/blog/series', 'suffix' => '/', 'count' => $count, 'page' => (int) \ceil($offset / ($limit ?? 1)) + 1, 'per_page' => $limit]]);
    }