Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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 if (!$guids) {
28  // BC with earlier 1.x
29  if (!empty($vars['value'])) {
30  elgg_deprecated_notice("The input/userpicker view option 'value' is deprecated. Use 'values'.", "1.12");
31  $guids = (array)elgg_extract('value', $vars, array());
32  }
33 }
34 
35 $handler = elgg_extract('handler', $vars, 'livesearch');
36 $handler = htmlspecialchars($handler, ENT_QUOTES, 'UTF-8');
37 
38 $limit = (int)elgg_extract('limit', $vars, 0);
39 
40 ?>
41 <div class="elgg-user-picker" data-limit="<?php echo $limit ?>" data-name="<?php echo $name ?>" data-handler="<?php echo $handler ?>">
42  <input type="text" class="elgg-input-user-picker" size="30"/>
43  <input type="checkbox" name="match_on" value="true" />
44  <?php echo elgg_view('input/hidden', array('name' => $vars['name'])); ?>
45  <label><?php echo elgg_echo('userpicker:only_friends'); ?></label>
46  <ul class="elgg-user-picker-list">
47  <?php
48  foreach ($guids as $guid) {
49  $entity = get_entity($guid);
50  if ($entity) {
51  echo elgg_view('input/userpicker/item', array(
52  'entity' => $entity,
53  'input_name' => $vars['name'],
54  ));
55  }
56  }
57  ?>
58  </ul>
59 </div>
60 <script>
61 require(['elgg/UserPicker'], function (UserPicker) {
62  UserPicker.setup('.elgg-user-picker[data-name="<?php echo $name ?>"]');
63 });
64 </script>
font size
$guids
Definition: userpicker.php:26
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$site name
if(!$guids) $handler
Definition: userpicker.php:35
$guid
Removes an admin notice.
$vars['entity']
ul
Definition: admin.css.php:44
$limit
Definition: userpicker.php:38
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:1070
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310
$entity
Definition: delete.php:7
elgg river item input[type=text]
if(empty($vars['name'])) $name
Definition: userpicker.php:23
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204