Beispiel #1
0
<?php

/** shows as floating tag for a searched entity when showing in the combined search listing */
if (!elgg_in_context('combined_search')) {
    return;
}
$search_params = elgg_extract('params', $vars);
$search_type = elgg_extract('search_type', $search_params);
if ($search_type !== 'entities') {
    return;
}
$entity = elgg_extract('entity', $vars);
$type = $entity->getType();
$subtype = $entity->getSubtype();
$href = search_advanced_get_search_url(['entity_type' => $type, 'entity_subtype' => $subtype, 'search_type' => $search_type]);
echo elgg_view('output/url', ['class' => 'float-alt elgg-quiet', 'href' => $href, 'text' => elgg_echo(rtrim("item:{$type}:{$subtype}", ':'))]);
Beispiel #2
0
} elseif ($type) {
    $title = elgg_echo("item:{$type}");
} elseif (in_array('entities', [$type, $search_type])) {
    $title = elgg_echo("search_advanced:content:title");
} else {
    $title = elgg_echo('search:unknown_entity');
}
// allow overrides for titles
if (elgg_language_key_exists("search_types:{$search_type}")) {
    $title = elgg_echo("search_types:{$search_type}");
}
$list_items = '';
foreach ($entities as $entity) {
    $view = search_advanced_get_search_view(['type' => $entity->type, 'subtype' => $entity->getSubtype(), 'search_type' => $search_type], search_advanced_get_list_type());
    if (empty($view)) {
        continue;
    }
    $entity_params = ['entity' => $entity, 'params' => $vars['params'], 'results' => $vars['results']];
    $list_item = elgg_view('search_advanced/search/floating_tag', $entity_params);
    $list_item .= elgg_view($view, $entity_params);
    $list_items .= elgg_format_element('li', ['id' => "elgg-{$entity->getType()}-{$entity->getGUID()}", 'class' => 'elgg-item'], $list_item);
}
$header = elgg_format_element('h3', [], $title);
if ($show_more) {
    $url = search_advanced_get_search_url(['limit' => null, 'search_type' => $search_type, 'entity_type' => $type, 'entity_subtype' => $subtype]);
    $more_link = elgg_view('output/url', ['href' => $url, 'text' => elgg_echo('search:more', array($count, $title)), 'class' => 'search-more float-alt']);
    $header = $more_link . $header;
}
$body = elgg_format_element('ul', ['class' => 'elgg-list search-list search-list-type-' . search_advanced_get_list_type()], $list_items);
$body .= $nav;
echo elgg_view_module('info', '', $body, ['header' => $header]);
Beispiel #3
0
$query = elgg_extract('query', $vars);
if ($search_type) {
    echo elgg_view("input/hidden", ["name" => "search_type", "value" => $search_type]);
}
if ($type) {
    echo elgg_view("input/hidden", ["name" => "entity_type", "value" => $type]);
}
if ($subtype) {
    echo elgg_view("input/hidden", ["name" => "entity_subtype", "value" => $subtype]);
}
echo elgg_view("input/text", ["name" => "q", "value" => $query, "class" => "ui-front mbs"]);
if ($container_guid) {
    $container_entity = get_entity($container_guid);
    if ($container_entity instanceof ElggGroup) {
        $container_link = elgg_view('output/url', ['text' => $container_entity->name, 'href' => $container_entity->getURL()]);
        $undo_url = search_advanced_get_search_url(['container_guid' => null]);
        $undo_container_link = elgg_view('output/url', ['text' => elgg_view_icon('delete'), 'href' => $undo_url, 'title' => elgg_echo('search_advanced:results:container:undo')]);
        $text = elgg_echo('search_advanced:results:container:title', [$container_link]);
        $text .= $undo_container_link;
        echo elgg_format_element('div', [], $text);
    }
    echo elgg_view("input/hidden", ["name" => "container_guid", "value" => $container_guid]);
}
$vars['filter_position'] = 'content';
$filter = elgg_view('search/filter', $vars);
$submit_options = ['value' => elgg_echo('submit'), 'class' => 'hidden'];
if (!empty($filter)) {
    echo $filter;
    unset($submit_options['class']);
}
echo elgg_view("input/submit", $submit_options);
Beispiel #4
0
/**
 * Registers menu items related to search results listing
 *
 * @param string       $hook   name of hook
 * @param string       $type   type of hook
 * @param unknown_type $value  current value
 * @param array        $params parameters
 *
 * @return array
 */
function search_advanced_register_menu_list($hook, $type, $value, $params)
{
    $result = $value;
    $url = search_advanced_get_search_url();
    $current_list_type = search_advanced_get_list_type();
    $title = elgg_echo('search_advanced:menu:search_list:list:title');
    $result[] = ElggMenuItem::factory(['name' => 'list', 'text' => elgg_view_icon('list'), 'href' => '#', 'title' => $title, 'priority' => 999]);
    $result[] = ElggMenuItem::factory(['name' => 'list_entity', 'text' => elgg_echo('search_advanced:menu:search_list:entity'), 'href' => elgg_http_add_url_query_elements($url, ['list_type' => 'entity']), 'parent_name' => 'list', 'selected' => $current_list_type === 'entity', 'title' => $title]);
    $result[] = ElggMenuItem::factory(['name' => 'list_compact', 'text' => elgg_echo('search_advanced:menu:search_list:compact'), 'href' => elgg_http_add_url_query_elements($url, ['list_type' => 'compact']), 'parent_name' => 'list', 'selected' => $current_list_type === 'compact', 'title' => $title]);
    return $result;
}