aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Poche.class.php')
-rwxr-xr-xinc/poche/Poche.class.php31
1 files changed, 15 insertions, 16 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index e7985cf1..33dddf1e 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -595,14 +595,7 @@ class Poche
595 $tpl_vars = array( 595 $tpl_vars = array(
596 'entry_id' => $id, 596 'entry_id' => $id,
597 'tags' => $tags, 597 'tags' => $tags,
598 ); 598 'entry' => $entry,
599 break;
600 case 'tag':
601 $entries = $this->store->retrieveEntriesByTag($id, $this->user->getId());
602 $tag = $this->store->retrieveTag($id, $this->user->getId());
603 $tpl_vars = array(
604 'tag' => $tag,
605 'entries' => $entries,
606 ); 599 );
607 break; 600 break;
608 case 'tags': 601 case 'tags':
@@ -643,22 +636,28 @@ class Poche
643 Tools::logm('error in view call : entry is null'); 636 Tools::logm('error in view call : entry is null');
644 } 637 }
645 break; 638 break;
646 default: # home, favorites and archive views 639 default: # home, favorites, archive and tag views
647 $entries = $this->store->getEntriesByView($view, $this->user->getId());
648 $tpl_vars = array( 640 $tpl_vars = array(
649 'entries' => '', 641 'entries' => '',
650 'page_links' => '', 642 'page_links' => '',
651 'nb_results' => '', 643 'nb_results' => '',
652 ); 644 );
653 645
654 if (count($entries) > 0) { 646 //if id is given - we retrive entries by tag: id is tag id
655 $this->pagination->set_total(count($entries)); 647 if ($id) {
648 $tpl_vars['tag'] = $this->store->retrieveTag($id, $this->user->getId());
649 $tpl_vars['id'] = intval($id);
650 }
651
652 $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id);
653
654 if ($count > 0) {
655 $this->pagination->set_total($count);
656 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), 656 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')),
657 $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&')); 657 $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . (($id)?'&id='.$id:'') . '&' ));
658 $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit()); 658 $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id);
659 $tpl_vars['entries'] = $datas;
660 $tpl_vars['page_links'] = $page_links; 659 $tpl_vars['page_links'] = $page_links;
661 $tpl_vars['nb_results'] = count($entries); 660 $tpl_vars['nb_results'] = $count;
662 } 661 }
663 Tools::logm('display ' . $view . ' view'); 662 Tools::logm('display ' . $view . ' view');
664 break; 663 break;