Elgg  Version 1.9
autocomplete.php
Go to the documentation of this file.
1 <?php
16 if (isset($vars['class'])) {
17  $vars['class'] = "elgg-input-autocomplete {$vars['class']}";
18 } else {
19  $vars['class'] = "elgg-input-autocomplete";
20 }
21 
22 $defaults = array(
23  'value' => '',
24  'disabled' => false,
25 );
26 
27 $vars = array_merge($defaults, $vars);
28 
29 $params = array();
30 if (isset($vars['match_on'])) {
31  $params['match_on'] = $vars['match_on'];
32  unset($vars['match_on']);
33 }
34 if (isset($vars['match_owner'])) {
35  $params['match_owner'] = $vars['match_owner'];
36  unset($vars['match_owner']);
37 }
38 $ac_url_params = http_build_query($params);
39 
40 elgg_load_js('elgg.autocomplete');
41 elgg_load_js('jquery.ui.autocomplete.html');
42 
43 ?>
44 
45 <script type="text/javascript">
46 elgg.provide('elgg.autocomplete');
47 elgg.autocomplete.url = "<?php echo elgg_get_site_url() . 'livesearch?' . $ac_url_params; ?>";
48 </script>
49 <input type="text" <?php echo elgg_format_attributes($vars); ?> />
elgg
Definition: install.js:23
$defaults
$vars
elgg echo
Translates a string.
Definition: languages.js:43
elgg_format_attributes(array $attrs=array())
Converts an associative array into a string of well-formed attributes.
Definition: output.php:118
if(isset($vars['match_on'])) if(isset($vars['match_owner'])) $ac_url_params
elgg_load_js($name)
Load a JavaScript resource on this page.
Definition: elgglib.php:190
$params
list style type
Definition: admin.php:724
elgg table input[type=checkbox]
Definition: admin.php:392