Skip to content
Snippets Groups Projects

Hotline#17171 autocomplete

Merged Laurent requested to merge hotline#17171_autocomplete into hotline_6.54
Compare and
+ 57
15
Preferences
Compare changes
Files
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Accueil_RechSimple extends ZendAfi_View_Helper_Accueil_Base {
@@ -24,13 +24,22 @@ class ZendAfi_View_Helper_Accueil_RechSimple extends ZendAfi_View_Helper_Accueil
$script_loader
->addJQueryReady('$("input.expressionRecherche").attr("x-webkit-speech","x-webkit-speech")');
if (!defined('DEVELOPMENT'))
return;
if (!$this->_isAutocompleteEnabled())
return $this;
$script_loader
->addOPACPluginScript('search_autocomplete/search_autocomplete')
->addJQueryReady('$("input.expressionRecherche").search_autocomplete('. $this->getAutocompleteOptions() .')');
return $this;
}
protected function _isAutocompleteEnabled() {
$batch_types = Class_Batch::getActiveTypes();
return in_array('AUTOCOMPLETE_RECORD_TITLE', $batch_types) || in_array('AUTOCOMPLETE_RECORD_AUTHOR', $batch_types);
}
protected function getAutocompleteOptions() {
$options = new stdClass();
$options->url = $this->view->url(['controller' => 'recherche',
@@ -43,7 +52,7 @@ class ZendAfi_View_Helper_Accueil_RechSimple extends ZendAfi_View_Helper_Accueil
public function getHtml() {
$this->titre = $this->preferences["titre"];
$this->contenu = $this->view->TagRechercheSimple($this->preferences,
$this->contenu = $this->view->TagRechercheSimple($this->preferences,
$this->id_module,
$this->division);
return $this->getHtmlArray();