Esempio n. 1
0
 /**
  * Get route to tag view
  *
  * @param int $application_id
  * @param string $tag
  * @param int $force_id
  *
  * @return string the route
  * @since 2.0
  */
 public function tag($application_id, $tag, $force_id = 0)
 {
     $key = $this->_active_menu_item_id . '-tag-' . $application_id . '_' . $tag . '_' . $force_id;
     if ($this->_cache && ($link = $this->_cache->get($key))) {
         return $link;
     }
     if (!$force_id && $this->app->request->getBool('f') && $this->app->request->getString('tag') == $tag) {
         $force_id = $this->app->request->getInt('Itemid');
     }
     // build tag link
     $link = $this->getLinkBase() . '&task=tag&tag=' . $tag . '&app_id=' . $application_id;
     // Priority 1: link to frontpage || Priority 2: current item id
     $item_id = '';
     if ($menu_item = $this->_find('frontpage', $application_id) or $menu_item = $this->app->menu->getActive()) {
         if ($force_id && $force_id != $menu_item->id) {
             $item_id = '&Itemid=' . $force_id;
             $link .= '&f=1&task=tag&tag=' . $tag . '&app_id=' . $application_id;
         } else {
             $item_id = '&Itemid=' . $menu_item->id;
         }
     }
     $link .= $item_id;
     // store link for future lookups
     if ($this->_cache) {
         $this->_cache->set($key, $link)->save();
     }
     return $link;
 }