Elgg  Version 1.10
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  <?php echo elgg_view('input/hidden', array('name' => $vars['name'])); ?>
40  <label><?php echo elgg_echo('userpicker:only_friends'); ?></label>
41  <ul class="elgg-user-picker-list">
42  <?php
43  foreach ($guids as $guid) {
44  $entity = get_entity($guid);
45  if ($entity) {
46  echo elgg_view('input/userpicker/item', array(
47  'entity' => $entity,
48  'input_name' => $vars['name'],
49  ));
50  }
51  }
52  ?>
53  </ul>
54 </div>
55 <script>
56 require(['elgg/UserPicker'], function (UserPicker) {
57  UserPicker.setup('.elgg-user-picker[data-name="<?php echo $name ?>"]');
58 });
59 </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:1349
fieldset div
Definition: admin.php:470
$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
$site name
elgg_load_js($name)
Load a JavaScript resource on this page.
Definition: elgglib.php:189
font size
Definition: admin.php:81
label
Definition: admin.php:460
$entity
Definition: delete.php:10
list style type
Definition: admin.php:747
elgg table input[type=checkbox]
Definition: admin.php:400
if(empty($vars['name'])) $name
Definition: userpicker.php:25
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:382
if(file_exists($welcome)) $vars
Definition: upgrade.php:93