|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Implementation of Roblib search for searching several targets.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_menu().
|
|
|
|
*/
|
|
|
|
function roblib_search_menu() {
|
|
|
|
|
|
|
|
$items['admin/roblib_search'] = array(
|
|
|
|
'title' => 'Roblib search',
|
|
|
|
'description' => 'Configure global Roblib search settings.',
|
|
|
|
'access arguments' => array('administer site configuration'),
|
|
|
|
'type' => MENU_NORMAL_ITEM,
|
|
|
|
);
|
|
|
|
$items['admin/roblib_search/configure'] = array(
|
|
|
|
'title' => 'Global Configuration',
|
|
|
|
'description' => 'Configure global Roblib search settings.',
|
|
|
|
'access arguments' => array('administer site configuration'),
|
|
|
|
'page callback' => 'drupal_get_form',
|
|
|
|
'page arguments' => array('roblib_search_config_form'),
|
|
|
|
'type' => MENU_NORMAL_ITEM,
|
|
|
|
);
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_block_info().
|
|
|
|
*/
|
|
|
|
function roblib_search_block_info() {
|
|
|
|
|
|
|
|
$blocks['roblib_search_form'] = array(
|
|
|
|
'info' => t('Roblib Global Search Form'),
|
|
|
|
'cache' => DRUPAL_CACHE_PER_ROLE,
|
|
|
|
);
|
|
|
|
$blocks['roblib_search_other'] = array(
|
|
|
|
'info' => t('Roblib Search Other Sources'),
|
|
|
|
'cache' => DRUPAL_CACHE_PER_ROLE,
|
|
|
|
);
|
|
|
|
|
|
|
|
return $blocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_theme().
|
|
|
|
*/
|
|
|
|
function roblib_search_theme($existing, $type, $theme, $path) {
|
|
|
|
return [
|
|
|
|
'roblib_search_results' => [
|
|
|
|
'variables' => ['query' => NULL],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_init().
|
|
|
|
*/
|
|
|
|
/*function roblib_search_init() {
|
|
|
|
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/imagesloaded.pkg.min.js');
|
|
|
|
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/roblib_search.js');
|
|
|
|
drupal_add_css(drupal_get_path('module', 'roblib_search') . '/css/jquery.qtip.min.css');
|
|
|
|
}*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_block_view().
|
|
|
|
*/
|
|
|
|
function roblib_search_block_view($delta = '') {
|
|
|
|
switch ($delta) {
|
|
|
|
case 'roblib_search_form':
|
|
|
|
$block['subject'] = t('Bento Search');
|
|
|
|
$block['content'] = drupal_get_form('roblib_search_simple_form');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'roblib_search_other':
|
|
|
|
$block['subject'] = t('Other Sources');
|
|
|
|
$block['content'] = theme('roblib_search_other_sources', array('results' => NULL));
|
|
|
|
}
|
|
|
|
return $block;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_help().
|
|
|
|
*/
|
|
|
|
function roblib_search_help($path, $arg) {
|
|
|
|
switch ($path) {
|
|
|
|
case 'admin/help#roblib_search':
|
|
|
|
return t(
|
|
|
|
'<p>
|
|
|
|
The Roblib Search is a module to allow searching across multiple targets.
|
|
|
|
This module does not know how to retrieve results but fires hooks that other
|
|
|
|
modules can implement to gather and display results.
|
|
|
|
</p>'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|