AlbumOrama\Frontend\Controllers\CatalogController::albumAction PHP Method

albumAction() public method

public albumAction ( $albumId, $albumName )
    public function albumAction($albumId, $albumName)
    {
        $key = 'album' . $albumId;
        $exists = $this->view->getCache()->exists($key);
        if (!$exists) {
            $album = Albums::findFirst(array('id = ?0', 'bind' => array($albumId)));
            if ($album == false) {
                return $this->dispatcher->forward(array('controller' => 'index', 'action' => 'index'));
            }
            //Top tags
            $phql = 'SELECT t.name
            FROM AlbumOrama\\Models\\AlbumsTags at
            JOIN AlbumOrama\\Models\\Tags t
            WHERE
            at.albums_id = ' . $album->id . '
            LIMIT 10';
            $tags = $this->modelsManager->executeQuery($phql);
            //Top albums
            $phql = 'SELECT
            al.id,
            al.name,
            al.uri
            FROM AlbumOrama\\Models\\Albums al
            WHERE
            al.id <> ' . $album->id . ' AND
            al.artists_id = ' . $album->artists_id . ' AND
            al.playcount > 25000
            ORDER BY al.playcount DESC
            LIMIT 5';
            $relatedAlbums = $this->modelsManager->executeQuery($phql);
            $album->loadPalette();
            $this->view->setVar('album', $album);
            $this->view->setVar('relatedAlbums', $relatedAlbums);
            $this->view->setVar('artist', $album->getArtist());
            $this->view->setVar('tags', $tags);
            $this->view->setVar('tracks', $album->getTracks());
            $this->view->setVar('photo', $album->getPhoto('extralarge'));
        }
        $this->view->cache(array("key" => $key));
    }