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 fc9a455a..23e51c7e 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -585,14 +585,7 @@ class Poche
585 $tpl_vars = array( 585 $tpl_vars = array(
586 'entry_id' => $id, 586 'entry_id' => $id,
587 'tags' => $tags, 587 'tags' => $tags,
588 ); 588 'entry' => $entry,
589 break;
590 case 'tag':
591 $entries = $this->store->retrieveEntriesByTag($id, $this->user->getId());
592 $tag = $this->store->retrieveTag($id, $this->user->getId());
593 $tpl_vars = array(
594 'tag' => $tag,
595 'entries' => $entries,
596 ); 589 );
597 break; 590 break;
598 case 'tags': 591 case 'tags':
@@ -633,22 +626,28 @@ class Poche
633 Tools::logm('error in view call : entry is null'); 626 Tools::logm('error in view call : entry is null');
634 } 627 }
635 break; 628 break;
636 default: # home, favorites and archive views 629 default: # home, favorites, archive and tag views
637 $entries = $this->store->getEntriesByView($view, $this->user->getId());
638 $tpl_vars = array( 630 $tpl_vars = array(
639 'entries' => '', 631 'entries' => '',
640 'page_links' => '', 632 'page_links' => '',
641 'nb_results' => '', 633 'nb_results' => '',
642 ); 634 );
643 635
644 if (count($entries) > 0) { 636 //if id is given - we retrive entries by tag: id is tag id
645 $this->pagination->set_total(count($entries)); 637 if ($id) {
638 $tpl_vars['tag'] = $this->store->retrieveTag($id, $this->user->getId());
639 $tpl_vars['id'] = intval($id);
640 }
641
642 $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id);
643
644 if ($count > 0) {
645 $this->pagination->set_total($count);
646 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), 646 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')),
647 $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&')); 647 $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . (($id)?'&id='.$id:'') . '&' ));
648 $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit()); 648 $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id);
649 $tpl_vars['entries'] = $datas;
650 $tpl_vars['page_links'] = $page_links; 649 $tpl_vars['page_links'] = $page_links;
651 $tpl_vars['nb_results'] = count($entries); 650 $tpl_vars['nb_results'] = $count;
652 } 651 }
653 Tools::logm('display ' . $view . ' view'); 652 Tools::logm('display ' . $view . ' view');
654 break; 653 break;