public static function getSearch($params) { $application = JFactory::getApplication(); $search = new stdClass(); $search->action = JRoute::_(K2HelperRoute::getSearchRoute()); $search->text = $params->get('text', JText::_('K2_SEARCH')); $search->width = intval($params->get('width', 20)); $search->maxLength = $search->width > 20 ? $search->width : 20; $search->button = $params->get('button'); $search->buttonText = htmlspecialchars($params->get('button_text', JText::_('K2_SEARCH'))); $search->imageButton = $params->get('imagebutton'); $search->buttonPosition = $params->get('button_pos', 'left'); $search->sef = $application->getCfg('sef'); $search->filter = ''; $filter = $params->get('category_id'); if ($filter && isset($filter->enabled) && $filter->enabled) { $model = K2Model::getInstance('Categories'); $categories = K2ModelCategories::getCategoryFilter($filter->categories, $filter->recursive, true); $search->filter = implode(',', $categories); } if ($params->get('liveSearch')) { $document = JFactory::getDocument(); if ($document->getType() == 'html') { $document->addScript(JURI::root(true) . '/media/k2app/vendor/underscore/underscore-min.js?v=3.0.0'); $document->addScriptDeclaration('var K2Site = "' . JURI::root(true) . '";'); } } return $search; }
*/ // no direct access defined('_JEXEC') or die; ?> <?php $labels = explode(',', $field->get('value')); ?> <?php if (is_array($labels)) { ?> <?php foreach ($labels as $label) { ?> <?php if ($label = trim($label)) { ?> <a href="<?php echo JRoute::_(K2HelperRoute::getSearchRoute() . '&searchword=' . urlencode($label)) . '">' . $label; ?> </a> <?php } ?> <?php } } ?>
require JModuleHelper::getLayoutPath('mod_k2_tools', 'calendar'); break; case '3': $breadcrumbs = modK2ToolsHelper::breadcrumbs($params); $path = $breadcrumbs[0]; $title = $breadcrumbs[1]; require JModuleHelper::getLayoutPath('mod_k2_tools', 'breadcrumbs'); break; case '4': $output = modK2ToolsHelper::treerecurse($params, 0, 0, true); require JModuleHelper::getLayoutPath('mod_k2_tools', 'categories'); break; case '5': echo modK2ToolsHelper::treeselectbox($params); break; case '6': $categoryFilter = modK2ToolsHelper::getSearchCategoryFilter($params); $action = JRoute::_(K2HelperRoute::getSearchRoute()); require JModuleHelper::getLayoutPath('mod_k2_tools', 'search'); break; case '7': $tags = modK2ToolsHelper::tagCloud($params); if (count($tags)) { require JModuleHelper::getLayoutPath('mod_k2_tools', 'tags'); } break; case '8': $customcode = modK2ToolsHelper::renderCustomCode($params); require JModuleHelper::getLayoutPath('mod_k2_tools', 'customcode'); break; }
protected function getSearchItems($count = false) { // Get application $application = JFactory::getApplication(); // Get input $search = trim($application->input->get('searchword', '', 'string')); // Determine offset and limit based on document type if ($this->type == 'html' || $this->type == 'raw') { $this->limit = $application->input->get('limit', 10, 'int'); } else { $this->limit = $this->params->get('feedLimit', 10, 'int'); } // Get items if ($search) { $model = K2Model::getInstance('Items'); $model->setState('site', true); $model->setState('search', $search); $model->setState('limit', $this->limit); $model->setState('limitstart', $this->offset); $this->items = $model->getRows(); // Count items if ($count) { $this->total = $model->countRows(); } } else { $this->items = array(); $this->total = 0; } // Form action $this->action = JRoute::_(K2HelperRoute::getSearchRoute()); // Search word $this->searchword = $search; }