Elgg  Version 1.11
userpicker.php
Go to the documentation of this file.
1 <?php
20 if (empty($vars['name'])) {
21  $vars['name'] = 'members';
22 }
23 $name = $vars['name'];
24 $name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
25 
26 $guids = (array)elgg_extract('values', $vars, array());
27 
28 $handler = elgg_extract('handler', $vars, 'livesearch');
29 $handler = htmlspecialchars($handler, ENT_QUOTES, 'UTF-8');
30 
31 $limit = (int)elgg_extract('limit', $vars, 0);
32 
33 ?>
34 <div class="elgg-user-picker" data-limit="<?php echo $limit ?>" data-name="<?php echo $name ?>" data-handler="<?php echo $handler ?>">
35  <input type="text" class="elgg-input-user-picker" size="30"/>
36  <input type="checkbox" name="match_on" value="true" />
37  <?php echo elgg_view('input/hidden', array('name' => $vars['name'])); ?>
38  <label><?php echo elgg_echo('userpicker:only_friends'); ?></label>
39  <ul class="elgg-user-picker-list">
40  <?php
41  foreach ($guids as $guid) {
42  $entity = get_entity($guid);
43  if ($entity) {
44  echo elgg_view('input/userpicker/item', array(
45  'entity' => $entity,
46  'input_name' => $vars['name'],
47  ));
48  }
49  }
50  ?>
51  </ul>
52 </div>
53 <script>
54 require(['elgg/UserPicker'], function (UserPicker) {
55  UserPicker.setup('.elgg-user-picker[data-name="<?php echo $name ?>"]');
56 });
57 </script>
ul
Definition: admin.php:44
$guids
Definition: userpicker.php:26
$handler
Definition: userpicker.php:28
$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:1246
fieldset div
Definition: admin.php:470
$limit
Definition: userpicker.php:31
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
font size
Definition: admin.php:81
label
Definition: admin.php:460
$entity
Definition: delete.php:10
list style type
Definition: admin.php:748
elgg table input[type=checkbox]
Definition: admin.php:400
if(empty($vars['name'])) $name
Definition: userpicker.php:23
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