Permalink
Browse files

Added action cloud and cleaned out output of pagination links.

Signed-off-by: Joachim Nyqvist <Joachim@JNyqvist.se>
  • Loading branch information...
CalvinMcGee committed Nov 22, 2010
1 parent ec47455 commit 36af782d7a9867c2bef00730c73a147ce400dfcf
@@ -25,6 +25,13 @@ function index($category = null, $name = null) {
'Item.actors LIKE' => '%'.$name.'%'
));
break;
+
+ case 'country':
+ $title = $name;
+ $data = $this->paginate('Item', array(
+ 'Item.country LIKE' => '%'.$name.'%'
+ ));
+ break;
case 'director':
$title = $name;
@@ -39,6 +46,13 @@ function index($category = null, $name = null) {
'Item.genre LIKE' => '%'.$name.'%'
));
break;
+
+ case 'date':
+ $title = $name;
+ $data = $this->paginate('Item', array(
+ 'Item.date LIKE' => '%'.$name.'%'
+ ));
+ break;
default:
$title = __('Index', true);
@@ -53,5 +67,18 @@ function index($category = null, $name = null) {
'title' => $title
));
}
+
+ function cloud($category = null, $name = null) {
+ $title = 'Cloud';
+ $this->set(array(
+ 'title_for_layout' => $title . ' : ' . Configure::read('Visual.title'),
+ 'actors' => $this->Item->find('all', array('fields' => 'Item.actors')),
+ 'countries' => $this->Item->find('all', array('fields' => 'Item.country')),
+ 'directors' => $this->Item->find('all', array('fields' => 'Item.director')),
+ 'genres' => $this->Item->find('all', array('fields' => 'Item.genre')),
+ 'title' => $title,
+ 'years' => $this->Item->find('all', array('fields' => 'Item.date'))
+ ));
+ }
}
?>
@@ -1,8 +1,9 @@
<?php
+$_key = '';
$_tags = array();
foreach ($data as $post) {
foreach ($post as $model) {
- foreach ($model as $key => $value){
+ foreach ($model as $_key => $value){
/**
* Tags are comma separated.
*/
@@ -46,8 +47,8 @@ foreach ($_tags as $tag => $t_i) {
}
foreach ($tagcloud as $_tag => $s_i) {
- echo $this->Html->link($_tag,
- array('controller' => 'items', 'action' => 'index', 'genre', $_tag),
+ echo $this->Html->link(trim($_tag),
+ array('controller' => 'items', 'action' => 'index', $_key, trim($_tag)),
array(
'style' => 'font-size: '.$s_i.'%;')
)."\n";
@@ -0,0 +1,22 @@
+<?php
+echo $this->Html->div('tagcloud',
+ $this->Html->tag('h2', __('Genres', true), array('escape' => true)).
+ $this->element('tagcloud', array('data' => $genres, 'escape' => true))
+ )."\n";
+echo $this->Html->div('tagcloud',
+ $this->Html->tag('h2', __('Directors', true), array('escape' => true)).
+ $this->element('tagcloud', array('data' => $directors, 'escape' => true))
+ )."\n";
+echo $this->Html->div('tagcloud',
+ $this->Html->tag('h2', __('Actors', true), array('escape' => true)).
+ $this->element('tagcloud', array('data' => $actors, 'escape' => true))
+ )."\n";
+echo $this->Html->div('tagcloud',
+ $this->Html->tag('h2', __('Countries', true), array('escape' => true)).
+ $this->element('tagcloud', array('data' => $countries, 'escape' => true))
+ )."\n";
+echo $this->Html->div('tagcloud',
+ $this->Html->tag('h2', __('Years of publication', true), array('escape' => true)).
+ $this->element('tagcloud', array('data' => $years, 'escape' => true))
+ )."\n";
+?>
@@ -1,5 +1,12 @@
<?php
-echo $this->element('tagcloud', array('data' => $tags));
+echo $this->Html->div('tagcloud', $this->element('tagcloud', array('data' => $tags, 'escape' => true)))."\n";
+
+echo $this->Html->div('paginationlinks', $paginator->numbers()."<br />\n".
+ $paginator->prev('<< '.__('Previous', true).' ')."\n".
+ $paginator->next(' '.__('Next', true).' >>')."<br />\n".
+ $paginator->counter(array('format' => '<span>'.__('Page %page% of %pages%', true).'</span>'))."\n"
+ )."\n";
+
foreach ($data as $post) {
echo "<div class=\"item clearfix\">\n";
@@ -61,8 +68,9 @@ foreach ($data as $post) {
echo "</div>\n";
}
-echo $paginator->numbers()."<br />\n";
-echo $paginator->prev('<< '.__('Previous', true).' ');
-echo $paginator->next(' '.__('Next', true).' >>')."<br />";
-echo $paginator->counter(array('format' => __('Page %page% of %pages%', true)));
+echo $this->Html->div('paginationlinks', $paginator->numbers()."<br />\n".
+ $paginator->prev('<< '.__('Previous', true).' ')."\n".
+ $paginator->next(' '.__('Next', true).' >>')."<br />\n".
+ $paginator->counter(array('format' => '<span>'.__('Page %page% of %pages%', true).'</span>'))."\n"
+ )."\n";
?>

0 comments on commit 36af782

Please sign in to comment.