示例#1
0
	<ul>
	<?php 
foreach ($this->items as $keyi => $valuei) {
    ?>
		<?php 
    $field = JArrayHelper::getValue($operators, $keyi);
    ?>
		<?php 
    foreach ($valuei as $keyj => $valuej) {
        ?>
			<?php 
        $vars = array(JFactory::getApplication()->input->get('name') => Helper::getOriginalFacet($keyj), 'o' => JFactory::getApplication()->input->get('o'));
        if ($this->params->get('show_count')) {
            $facet = JText::sprintf('%s [%s]', Helper::getOriginalFacet($keyj), $valuej);
        } else {
            $facet = JText::sprintf('%s', Helper::getOriginalFacet($keyj));
        }
        ?>

			<li><?php 
        echo JHTML::_('link', JRoute::_(\JSolr\Search\Factory::getSearchRoute($vars)), $facet);
        ?>
</li>
		<?php 
    }
    ?>
	<?php 
}
?>
	</ul>
</div>
示例#2
0
文件: Facets.php 项目: bellodox/jsolr
 /**
  * (non-PHPdoc)
  * @see JFormFieldList::getOptions()
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     $facets = $this->getFacets();
     foreach ($facets as $key => $value) {
         $html = array("<li>", "%s", "</li>");
         $key = \JSolr\Helper::getOriginalFacet($key);
         if ($this->isSelected($key)) {
             $html = array("<li class=\"active\">", "%s", "</li>");
         }
         $count = '';
         if (JArrayHelper::getValue($this->element, 'count', 'false', 'string') === 'true') {
             $count = '<span>(' . $value . ')</span>';
         }
         $facet = '<a href="' . $this->getFilterURI($key) . '">' . $key . '</a>' . $count;
         $options[] = JText::sprintf(implode($html), $facet);
     }
     reset($options);
     return $options;
 }