function showtags($tags) { $html = ''; $html .= '<div class="tags">'; $html .= '<span class="tag_label">' . JText::_('HG_TAGS') . ': </span>'; $count = count($tags); $i = 1; foreach ($tags as $tag) { $html .= '<span class="tag" style="font-size:12px;">'; $html .= '<a href="' . JRoute::_(hotelguideHelperRoute::getTagRoute($tag->slug)) . '" style="color:#fff; font-weight: bold;">'; $html .= JText::_($tag->name) . '</a></span>'; if ($i < $count) { $html .= ' | '; } $i++; } $html .= '</div>'; return $html; }
/** * Creates the item page * * @since 1.0 */ function display($tpl = null) { global $mainframe, $hgconf; //initialize variables $db = JFactory::getDBO(); $document =& JFactory::getDocument(); $menus =& JSite::getMenu(); $lang =& JFactory::getLanguage(); $menu = $menus->getActive(); $uri =& JFactory::getURI(); $params = $mainframe->getParams('com_hotelguide'); JHTML::_('behavior.mootools'); $filter_order = JRequest::getCmd('filter_order', 'i.title'); $filter_order_Dir = JRequest::getCmd('filter_order_Dir', 'ASC'); /* $search = JRequest::getString('search'); $search = $db->getEscaped( trim(JString::strtolower( $search ) ) ); if ($hgconf->tag_search) { $filter_country = JRequest::getInt('filter_country', 0); $filter_states = JRequest::getInt('filter_states', 0); $filter_city = JRequest::getInt('filter_city', 0); $filter_facility = JRequest::getVar('facility_search', array(), '', 'array'); $filter_type = JRequest::getVar('type_search', array(), '', 'array'); } */ $limitstart = JRequest::getInt('limitstart'); $limit = $mainframe->getUserStateFromRequest('com_hotelguide.' . $this->getLayout() . '.limit', 'limit', $hgconf->search_limit, 'int'); /* if ($hgconf->tag_search && ($hgconf->search_option == 1 || $hgconf->search_option == 3 || $hgconf->search_option == 5)) { $document->addScript( $this->baseurl.'/components/com_hotelguide/assets/js/slider.js'); $document->addScript( $this->baseurl.'/components/com_hotelguide/assets/js/jquery-1.4.2.js'); $document->addScript( $this->baseurl.'/components/com_hotelguide/assets/js/jquery.dependClass.js'); $document->addScript( $this->baseurl.'/components/com_hotelguide/assets/js/jquery.slider-min.js'); } if ($hgconf->tag_search && ($hgconf->search_option == 1 || $hgconf->search_option == 5)) { $document->addScript( $this->baseurl.'/components/com_hotelguide/assets/js/datepicker.packed.js'); } */ $model =& $this->getModel(); $items =& $this->get('Data'); $tag =& $this->get('Tag'); $total =& $this->get('Total'); $alltags = $model->getAlltags($items[0]->user_id, 30); $counttags = $model->getLimitTags($items[0]->user_id, 150); //set 404 if tag doesn't exist or access isn't permitted if (empty($tag)) { return JError::raiseError(404, JText::sprintf('Tag #%d not found', $tid)); } $title = JTEXT::_("HG_TAGS") . JTEXT::_(":: ") . $tag->name; $params->set('page_title', $title); //pathway $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::sprintf('HG_ACCOMMODATIONS_IN', $title)); //Set Page title // if (!@$item->name) { $document->setTitle($params->get('page_title')); $document->setMetadata('keywords', $params->get('page_title')); // } $max = (int) $alltags[0]; $min = (int) $alltags[sizeof($alltags) - 1]; $minsize = 1; $maxsize = 10; $i = 0; $taglists = array(); foreach ($counttags as $subtag) { $taglists[$i]->size = $this->sizer($min, $max, $subtag->no, $minsize, $maxsize); $taglists[$i]->name = $subtag->name . ' '; $taglists[$i]->screenreader = JText::sprintf('NR_ITEMS_TAGGED', $subtag->no); $taglists[$i]->link = JRoute::_(hotelguideHelperRoute::getTagRoute($subtag->slug)); $i++; } //ordering $lists = array(); $lists['filter_order'] = $filter_order; $lists['filter_order_Dir'] = $filter_order_Dir; // $lists['search'] = $search; $sort_links = array(); $sort_links[] = $this->sort('HG_POPULARITY', 'hits', $lists['filter_order_Dir'], $lists['filter_order']); $sort_links[] = $this->sort('HG_HIGHEST_RATED', 'votes', $lists['filter_order_Dir'], $lists['filter_order']); $sort_links[] = $this->sort('HG_NAME', 'title', $lists['filter_order_Dir'], $lists['filter_order']); $sort_links[] = $this->sort('HG_TYPE', 'type', $lists['filter_order_Dir'], $lists['filter_order']); $modelguide =& $this->getModel('hotelguide'); if ($hgconf->tag_topdesti) { $topdestinations = $modelguide->getTopDestinations($hgconf->tag_top_limit); } if ($hgconf->tag_desti) { $destinations = $modelguide->getDestinations($hgconf->tag_city_limit, $hgconf->tag_hotel_limit); } // Create the pagination object jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $currentpage = 'tags'; $this->assign('action', $uri->toString()); $this->assignRef('items', $items); $this->assignRef('tag', $tag); $this->assignRef('alltags', $alltags); $this->assignRef('taglists', $taglists); $this->assignRef('user', $user); $this->assignRef('params', $params); $this->assignRef('pageNav', $pageNav); $this->assignRef('lists', $lists); $this->assignRef('hgconf', $hgconf); $this->assignRef('sort_links', $sort_links); $this->assignRef('topdestinations', $topdestinations); $this->assignRef('destinations', $destinations); $this->assignRef('filter_country', $filter_country); $this->assignRef('filter_states', $filter_states); $this->assignRef('filter_city', $filter_city); $this->assignRef('filter_rate', $filter_rate); $this->assignRef('filter_facility', $filter_facility); $this->assignRef('filter_type', $filter_type); $this->assignRef('currentpage', $currentpage); /* echo "<pre>"; echo "view="; print_r($destinations); echo "</pre>"; */ parent::display($tpl); }