aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/input.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-10-17 19:37:30 -0700
committerCash Costello <cash.costello@gmail.com>2011-10-17 19:37:30 -0700
commit63ebe7b121105beb7e4c8b9b82e3c649f6a9a489 (patch)
tree79f51f8b6e94203297cbbc899f3daa400475de34 /engine/lib/input.php
parent9a3ec606cfe2cbbe08949a56198bf9d4bb2e1e64 (diff)
parent34c968355231216624c2beae59ea9ad17f7ef2c0 (diff)
downloadelgg-63ebe7b121105beb7e4c8b9b82e3c649f6a9a489.tar.gz
elgg-63ebe7b121105beb7e4c8b9b82e3c649f6a9a489.tar.bz2
Merge pull request #74 from cash/autocomplete
Fixes #2102, #2712, #3450 Finishes autocomplete and userpicker for 1.8.1
Diffstat (limited to 'engine/lib/input.php')
-rw-r--r--engine/lib/input.php72
1 files changed, 63 insertions, 9 deletions
diff --git a/engine/lib/input.php b/engine/lib/input.php
index 5c1a6299c..4900817a5 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -289,13 +289,35 @@ function input_livesearch_page_handler($page) {
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
+ $entity = get_entity($entity->guid);
+ if (!$entity) {
+ continue;
+ }
+
+ if (in_array('groups', $match_on)) {
+ $value = $entity->guid;
+ } else {
+ $value = $entity->username;
+ }
+
+ $output = elgg_view_list_item($entity, array(
+ 'hover' => false,
+ 'class' => 'elgg-autocomplete-item',
+ ));
+
+ $icon = elgg_view_entity_icon($entity, 'tiny', array(
+ 'hover' => false,
+ ));
+
$result = array(
'type' => 'user',
'name' => $entity->name,
'desc' => $entity->username,
- 'icon' => '<img class="elgg-livesearch-icon" src="' .
- get_entity($entity->guid)->getIconURL('tiny') . '" />',
- 'guid' => $entity->guid
+ 'guid' => $entity->guid,
+ 'label' => $output,
+ 'value' => $value,
+ 'icon' => $icon,
+ 'url' => $entity->getURL(),
);
$results[$entity->name . rand(1, 100)] = $result;
}
@@ -316,13 +338,29 @@ function input_livesearch_page_handler($page) {
";
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
+ $entity = get_entity($entity->guid);
+ if (!$entity) {
+ continue;
+ }
+
+ $output = elgg_view_list_item($entity, array(
+ 'hover' => false,
+ 'class' => 'elgg-autocomplete-item',
+ ));
+
+ $icon = elgg_view_entity_icon($entity, 'tiny', array(
+ 'hover' => false,
+ ));
+
$result = array(
'type' => 'group',
'name' => $entity->name,
'desc' => strip_tags($entity->description),
- 'icon' => '<img class="elgg-livesearch-icon" src="'
- . get_entity($entity->guid)->getIconURL('tiny') . '" />',
- 'guid' => $entity->guid
+ 'guid' => $entity->guid,
+ 'label' => $output,
+ 'value' => $entity->guid,
+ 'icon' => $icon,
+ 'url' => $entity->getURL(),
);
$results[$entity->name . rand(1, 100)] = $result;
@@ -347,13 +385,29 @@ function input_livesearch_page_handler($page) {
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
+ $entity = get_entity($entity->guid);
+ if (!$entity) {
+ continue;
+ }
+
+ $output = elgg_view_list_item($entity, array(
+ 'hover' => false,
+ 'class' => 'elgg-autocomplete-item',
+ ));
+
+ $icon = elgg_view_entity_icon($entity, 'tiny', array(
+ 'hover' => false,
+ ));
+
$result = array(
'type' => 'user',
'name' => $entity->name,
'desc' => $entity->username,
- 'icon' => '<img class="elgg-livesearch-icon" src="'
- . get_entity($entity->guid)->getIconURL('tiny') . '" />',
- 'guid' => $entity->guid
+ 'guid' => $entity->guid,
+ 'label' => $output,
+ 'value' => $entity->username,
+ 'icon' => $icon,
+ 'url' => $entity->getURL(),
);
$results[$entity->name . rand(1, 100)] = $result;
}