diff --git a/app/controllers/items_controller.php b/app/controllers/items_controller.php index 24408fda3..574ef8920 100644 --- a/app/controllers/items_controller.php +++ b/app/controllers/items_controller.php @@ -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')) + )); + } } ?> \ No newline at end of file diff --git a/app/views/elements/tagcloud.ctp b/app/views/elements/tagcloud.ctp index edf8aa862..a9da3d69d 100644 --- a/app/views/elements/tagcloud.ctp +++ b/app/views/elements/tagcloud.ctp @@ -1,8 +1,9 @@ $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"; diff --git a/app/views/themed/default/items/cloud.ctp b/app/views/themed/default/items/cloud.ctp new file mode 100644 index 000000000..02319f882 --- /dev/null +++ b/app/views/themed/default/items/cloud.ctp @@ -0,0 +1,22 @@ +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"; +?> diff --git a/app/views/themed/default/items/index.ctp b/app/views/themed/default/items/index.ctp index b532288a0..d838d420f 100644 --- a/app/views/themed/default/items/index.ctp +++ b/app/views/themed/default/items/index.ctp @@ -1,5 +1,12 @@ 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()."
\n". + $paginator->prev('<< '.__('Previous', true).' ')."\n". + $paginator->next(' '.__('Next', true).' >>')."
\n". + $paginator->counter(array('format' => ''.__('Page %page% of %pages%', true).''))."\n" + )."\n"; + foreach ($data as $post) { echo "
\n"; @@ -61,8 +68,9 @@ foreach ($data as $post) { echo "
\n"; } -echo $paginator->numbers()."
\n"; -echo $paginator->prev('<< '.__('Previous', true).' '); -echo $paginator->next(' '.__('Next', true).' >>')."
"; -echo $paginator->counter(array('format' => __('Page %page% of %pages%', true))); +echo $this->Html->div('paginationlinks', $paginator->numbers()."
\n". + $paginator->prev('<< '.__('Previous', true).' ')."\n". + $paginator->next(' '.__('Next', true).' >>')."
\n". + $paginator->counter(array('format' => ''.__('Page %page% of %pages%', true).''))."\n" + )."\n"; ?>