primo commit
This commit is contained in:
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_search
|
||||
*
|
||||
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the component HTML helpers.
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_search&view=searches'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if (!empty( $this->sidebar)) : ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => false))); ?>
|
||||
<div class="clearfix"> </div>
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="nowrap">
|
||||
<?php echo JHtml::_('searchtools.sort', 'COM_SEARCH_HEADING_PHRASE', 'a.search_term', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="15%" class="nowrap">
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="1%" class="nowrap center">
|
||||
<?php echo JText::_('COM_SEARCH_HEADING_RESULTS'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="break-word">
|
||||
<?php echo $this->escape($item->search_term); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo (int) $item->hits; ?>
|
||||
</td>
|
||||
<?php if ($this->state->get('show_results')) : ?>
|
||||
|
||||
<td class="center btns">
|
||||
<a class="badge <?php if ($item->returns > 0) echo 'badge-success'; ?>" target="_blank" href="<?php echo JUri::root(); ?>index.php?option=com_search&view=search&searchword=<?php echo JFilterOutput::stringURLSafe($item->search_term); ?>">
|
||||
<?php echo $item->returns; ?><span class="icon-out-2" aria-hidden="true"></span><span class="element-invisible"><?php echo JText::_('JBROWSERTARGET_NEW'); ?></span></a>
|
||||
</td>
|
||||
<?php else : ?>
|
||||
<td class="center">
|
||||
<?php echo JText::_('COM_SEARCH_NO_RESULTS'); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_SEARCH_SEARCH_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_SEARCH_SEARCH_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
</metadata>
|
||||
104
administrator/components/com_search/views/searches/view.html.php
Normal file
104
administrator/components/com_search/views/searches/view.html.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_search
|
||||
*
|
||||
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* View class for a list of search terms.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class SearchViewSearches extends JViewLegacy
|
||||
{
|
||||
protected $enabled;
|
||||
|
||||
protected $items;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return mixed A string if successful, otherwise an Error object.
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->filterForm = $this->get('FilterForm');
|
||||
$this->activeFilters = $this->get('ActiveFilters');
|
||||
$this->enabled = $this->state->params->get('enabled');
|
||||
$this->canDo = JHelperContent::getActions('com_search');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Check if plugin is enabled
|
||||
if ($this->enabled)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_SEARCH_LOGGING_ENABLED'), 'notice');
|
||||
}
|
||||
else
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_SEARCH_LOGGING_DISABLED'), 'warning');
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
$canDo = $this->canDo;
|
||||
|
||||
JToolbarHelper::title(JText::_('COM_SEARCH_MANAGER_SEARCHES'), 'search');
|
||||
|
||||
$showResults = $this->state->get('show_results', 1, 'int');
|
||||
|
||||
if ($showResults === 0)
|
||||
{
|
||||
JToolbarHelper::custom('searches.toggleresults', 'zoom-in.png', null, 'COM_SEARCH_SHOW_SEARCH_RESULTS', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
JToolbarHelper::custom('searches.toggleresults', 'zoom-out.png', null, 'COM_SEARCH_HIDE_SEARCH_RESULTS', false);
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit.state'))
|
||||
{
|
||||
JToolbarHelper::custom('searches.reset', 'refresh.png', 'refresh_f2.png', 'JSEARCH_RESET', false);
|
||||
}
|
||||
|
||||
JToolbarHelper::divider();
|
||||
|
||||
if ($canDo->get('core.admin') || $canDo->get('core.options'))
|
||||
{
|
||||
JToolbarHelper::preferences('com_search');
|
||||
}
|
||||
|
||||
JToolbarHelper::divider();
|
||||
JToolbarHelper::help('JHELP_COMPONENTS_SEARCH');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user