Elgg  Version 1.9
userpicker.php
Go to the documentation of this file.
1 <?php
20 elgg_load_js('jquery.ui.autocomplete.html');
21 
22 if (empty($vars['name'])) {
23  $vars['name'] = 'members';
24 }
25 $name = $vars['name'];
26 $name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
27 
28 $guids = (array)elgg_extract('values', $vars, array());
29 
30 $handler = elgg_extract('handler', $vars, 'livesearch');
31 $handler = htmlspecialchars($handler, ENT_QUOTES, 'UTF-8');
32 
33 $limit = (int)elgg_extract('limit', $vars, 0);
34 
35 ?>
36 <div class="elgg-user-picker" data-limit="<?php echo $limit ?>" data-name="<?php echo $name ?>" data-handler="<?php echo $handler ?>">
37  <input type="text" class="elgg-input-user-picker" size="30"/>
38  <input type="checkbox" name="match_on" value="true" />
39  <label><?php echo elgg_echo('userpicker:only_friends'); ?></label>
40  <ul class="elgg-user-picker-list">
41  <?php
42  foreach ($guids as $guid) {
43  $entity = get_entity($guid);
44  if ($entity) {
45  echo elgg_view('input/userpicker/item', array(
46  'entity' => $entity,
47  'input_name' => $vars['name'],
48  ));
49  }
50  }
51  ?>
52  </ul>
53 </div>
54 <script>
55 require(['elgg/UserPicker'], function (UserPicker) {
56  UserPicker.setup('.elgg-user-picker[data-name="<?php echo $name ?>"]');
57 });
58 </script>
ul
Definition: admin.php:44
$guids
Definition: userpicker.php:28
$handler
Definition: userpicker.php:30
$guid
Removes an admin notice.
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1464
fieldset div
Definition: admin.php:462
$limit
Definition: userpicker.php:33
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg echo
Translates a string.
Definition: languages.js:43
elgg require
Throw an error if the required package isn&#39;t present.
Definition: elgglib.js:164
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
elgg_load_js($name)
Load a JavaScript resource on this page.
Definition: elgglib.php:190
font size
Definition: admin.php:81
label
Definition: admin.php:452
$entity
Definition: delete.php:10
list style type
Definition: admin.php:724
elgg table input[type=checkbox]
Definition: admin.php:392
if(empty($vars['name'])) $name
Definition: userpicker.php:25
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604
if(file_exists($welcome)) $vars
Definition: upgrade.php:93