Skip to content

Commit

Permalink
indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjikobe committed Dec 9, 2012
1 parent 0740f8d commit c61e845
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 198 deletions.
10 changes: 5 additions & 5 deletions apps/frontend/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public function registerServices($di)

$volt->setOptions(array(
"compiledPath" => __DIR__."/../../var/volt/",
"compiledExtension" => ".php"
));
"compiledExtension" => ".php"
));

return $volt;
}
));
return $volt;
}
));

return $view;

Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/controllers/AboutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
class AboutController extends ControllerBase
{

public function indexAction()
{
public function indexAction()
{

}
}

}

226 changes: 113 additions & 113 deletions apps/frontend/controllers/CatalogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function artistAction($artistId, $artistName)
$key = 'artist'.$artistId;

$exists = $this->view->getCache()->exists($key);
if (!$exists) {
if (!$exists) {

$artist = Artists::findFirst(array(
'id = ?0', 'bind' => array($artistId)
Expand All @@ -41,11 +41,11 @@ public function artistAction($artistId, $artistName)
$tags = $this->modelsManager->executeQuery($phql);

//Top albums
$phql = 'SELECT
al.id,
al.name,
al.uri,
ap.url
$phql = 'SELECT
al.id,
al.name,
al.uri,
ap.url
FROM AlbumOrama\Models\Albums al
JOIN AlbumOrama\Models\AlbumsPhotos ap
WHERE
Expand All @@ -54,14 +54,14 @@ public function artistAction($artistId, $artistName)
al.playcount > 25000
ORDER BY al.playcount DESC
LIMIT 18';
$albums = $this->modelsManager->executeQuery($phql);

//Similar Artists
$phql = 'SELECT
ar.id,
ar.name,
ar.uri,
ap.url
$albums = $this->modelsManager->executeQuery($phql);

//Similar Artists
$phql = 'SELECT
ar.id,
ar.name,
ar.uri,
ap.url
FROM AlbumOrama\Models\ArtistsSimilar ars,
AlbumOrama\Models\Artists ar,
AlbumOrama\Models\ArtistsPhotos ap
Expand All @@ -72,7 +72,7 @@ public function artistAction($artistId, $artistName)
ars.artists_id = '.$artist->id.'
ORDER BY ar.listeners DESC
LIMIT 10';
$similars = $this->modelsManager->executeQuery($phql);
$similars = $this->modelsManager->executeQuery($phql);

$this->view->setVar('artist', $artist);
$this->view->setVar('albums', $albums);
Expand All @@ -91,7 +91,7 @@ public function albumAction($albumId, $albumName)
$key = 'album'.$albumId;

$exists = $this->view->getCache()->exists($key);
if (!$exists) {
if (!$exists) {

$album = Albums::findFirst(array(
'id = ?0', 'bind' => array($albumId)
Expand All @@ -113,18 +113,18 @@ public function albumAction($albumId, $albumName)
$tags = $this->modelsManager->executeQuery($phql);

//Top albums
$phql = 'SELECT
al.id,
al.name,
al.uri
$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);
$relatedAlbums = $this->modelsManager->executeQuery($phql);

$album->loadPalette();

Expand All @@ -142,14 +142,14 @@ public function albumAction($albumId, $albumName)
}

public function tagAction($tagName, $page=1)
{
{

$page = $this->filter->sanitize($page, 'int');
if ($page < 1) {
$page = 1;
}
$page = $this->filter->sanitize($page, 'int');
if ($page < 1) {
$page = 1;
}

$tag = Tags::findFirst(array(
$tag = Tags::findFirst(array(
'name = ?0', 'bind' => array($tagName)
));
if ($tag == false) {
Expand All @@ -162,16 +162,16 @@ public function tagAction($tagName, $page=1)
$key = 'tag'.$tag->id.'p'.$page;

$exists = $this->view->getCache()->exists($key);
if (!$exists) {

//Top albums
$phql = 'SELECT
al.id,
al.name,
ar.uri,
ar.id as artist_id,
ar.name as artist,
ap.url
if (!$exists) {

//Top albums
$phql = 'SELECT
al.id,
al.name,
ar.uri,
ar.id as artist_id,
ar.name as artist,
ap.url
FROM AlbumOrama\Models\Albums al
JOIN AlbumOrama\Models\Artists ar
JOIN AlbumOrama\Models\AlbumsTags at
Expand All @@ -182,29 +182,29 @@ public function tagAction($tagName, $page=1)
ORDER BY al.playcount DESC
LIMIT 30
OFFSET '.(($page-1)*30);
$albums = $this->modelsManager->executeQuery($phql);
$albums = $this->modelsManager->executeQuery($phql);

$this->view->setVar('tag', $tag);
$this->view->setVar('albums', $albums);
$this->view->setVar('page', $page);
$this->view->setVar('prev', $page == 1 ? 0 : $page-1);
$this->view->setVar('next', count($albums) == 30 ? $page+1 : 0);
$this->view->setVar('tag', $tag);
$this->view->setVar('albums', $albums);
$this->view->setVar('page', $page);
$this->view->setVar('prev', $page == 1 ? 0 : $page-1);
$this->view->setVar('next', count($albums) == 30 ? $page+1 : 0);

}
}

$this->view->cache(array("key" => $key));
$this->view->cache(array("key" => $key));

}
}

public function searchAction()
{
public function searchAction()
{

//Top albums
$phql = 'SELECT
ar.id,
ar.name,
ar.uri,
ap.url
//Top albums
$phql = 'SELECT
ar.id,
ar.name,
ar.uri,
ap.url
FROM AlbumOrama\Models\Artists ar
JOIN AlbumOrama\Models\ArtistsPhotos ap
WHERE
Expand All @@ -213,67 +213,67 @@ public function searchAction()
ORDER BY ar.listeners DESC
LIMIT 30';

$artists = $this->modelsManager->executeQuery($phql, array(
'%'.preg_replace('/[ ]+/', '%', $this->request->getPost('s')).'%'
));
$artists = $this->modelsManager->executeQuery($phql, array(
'%'.preg_replace('/[ ]+/', '%', $this->request->getPost('s')).'%'
));

$this->view->setVar('artists', $artists);
$this->view->setVar('artists', $artists);

}
}

public function popularAction()
public function popularAction()
{

$key = 'popular';

$exists = $this->view->getCache()->exists($key);
if (!$exists) {

//Top albums
$phql = 'SELECT
al.id,
al.name,
ar.uri,
ar.id as artist_id,
ar.name as artist,
ap.url
FROM AlbumOrama\Models\Albums al
JOIN AlbumOrama\Models\Artists ar
JOIN AlbumOrama\Models\AlbumsPhotos ap
WHERE
ap.type = "large"
ORDER BY al.playcount DESC
LIMIT 30';
$albums = $this->modelsManager->executeQuery($phql);

$this->view->setVar('albums', $albums);

//Top tags
$phql = 'SELECT t.name, COUNT(*)
FROM AlbumOrama\Models\Tags t
JOIN AlbumOrama\Models\AlbumsTags at
GROUP BY 1
HAVING COUNT(*) > 50
LIMIT 14';
$tags = $this->modelsManager->executeQuery($phql);

$this->view->setVar('tags', $tags);

}

$this->view->cache(array("key" => $key));
}

/**
* This action handles the /charts route
*/
$key = 'popular';

$exists = $this->view->getCache()->exists($key);
if (!$exists) {

//Top albums
$phql = 'SELECT
al.id,
al.name,
ar.uri,
ar.id as artist_id,
ar.name as artist,
ap.url
FROM AlbumOrama\Models\Albums al
JOIN AlbumOrama\Models\Artists ar
JOIN AlbumOrama\Models\AlbumsPhotos ap
WHERE
ap.type = "large"
ORDER BY al.playcount DESC
LIMIT 30';
$albums = $this->modelsManager->executeQuery($phql);

$this->view->setVar('albums', $albums);

//Top tags
$phql = 'SELECT t.name, COUNT(*)
FROM AlbumOrama\Models\Tags t
JOIN AlbumOrama\Models\AlbumsTags at
GROUP BY 1
HAVING COUNT(*) > 50
LIMIT 14';
$tags = $this->modelsManager->executeQuery($phql);

$this->view->setVar('tags', $tags);

}

$this->view->cache(array("key" => $key));
}

/**
* This action handles the /charts route
*/
public function chartsAction()
{

$key = 'charts';

$exists = $this->view->getCache()->exists($key);
if (!$exists) {
$exists = $this->view->getCache()->exists($key);
if (!$exists) {

$tagGenres = array(
'pop', 'rock', 'rap',
Expand All @@ -295,13 +295,13 @@ public function chartsAction()
}

//Top albums
$phql = 'SELECT
al.id,
al.name,
ar.uri,
ar.id as artist_id,
ar.name as artist,
ap.url
$phql = 'SELECT
al.id,
al.name,
ar.uri,
ar.id as artist_id,
ar.name as artist,
ap.url
FROM AlbumOrama\Models\Albums al
JOIN AlbumOrama\Models\Artists ar
JOIN AlbumOrama\Models\AlbumsTags at
Expand All @@ -311,7 +311,7 @@ public function chartsAction()
at.tags_id = '.$tag->id.'
ORDER BY al.playcount DESC
LIMIT 10';
$charts[$tag->name] = $this->modelsManager->executeQuery($phql);
$charts[$tag->name] = $this->modelsManager->executeQuery($phql);
}

$this->view->setVar('charts', $charts);
Expand Down
Loading

0 comments on commit c61e845

Please sign in to comment.