当前位置: 首页>>代码示例>>PHP>>正文


PHP elgg_view_list_item函数代码示例

本文整理汇总了PHP中elgg_view_list_item函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_view_list_item函数的具体用法?PHP elgg_view_list_item怎么用?PHP elgg_view_list_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了elgg_view_list_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: elgg_view

$list_class = 'elgg-list';
if (isset($vars['list_class'])) {
    $list_class = "{$list_class} {$vars['list_class']}";
}
$item_class = 'elgg-item';
if (isset($vars['item_class'])) {
    $item_class = "{$item_class} {$vars['item_class']}";
}
$html = "";
$nav = "";
if ($pagination && $count) {
    $nav .= elgg_view('navigation/pagination', array('base_url' => $base_url, 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'offset_key' => $offset_key));
}
$html .= "<ul class=\"{$list_class}\">";
foreach ($items as $item) {
    $li = elgg_view_list_item($item, $vars);
    if ($li) {
        if (elgg_instanceof($item)) {
            $id = "elgg-{$item->getType()}-{$item->getGUID()}";
        } else {
            $id = "item-{$item->getType()}-{$item->id}";
        }
        $html .= "<li id=\"{$id}\" class=\"{$item_class}\">{$li}</li>";
    }
}
$html .= '</ul>';
if ($position == 'before' || $position == 'both') {
    $html = $nav . $html;
}
if ($position == 'after' || $position == 'both') {
    $html .= $nav;
开发者ID:tjcaverly,项目名称:Elgg,代码行数:31,代码来源:list.php

示例2: elgg_view

}
if ($pagination && $count) {
    $nav = elgg_view('navigation/pagination', array('base_url' => $base_url, 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'offset_key' => $offset_key));
}
echo '<div class="maps-container maps-list">';
$mapbox_attrs = $map->getMapboxAttributes();
$mapbox_attrs = elgg_format_attributes($mapbox_attrs);
echo elgg_view('output/url', array('href' => 'javascript:void(0);', 'text' => elgg_echo('maps:findme'), 'class' => 'maps-find-me'));
echo "<div {$mapbox_attrs}></div>";
if ($position == 'before' || $position == 'both') {
    echo $nav;
}
echo "<ul class=\"{$list_class}\">";
foreach ($items as $item) {
    $has_items = true;
    $view = elgg_view_list_item($item, $options);
    if (!$view) {
        continue;
    }
    $item_attrs = $map->getItemAttributes($item);
    $proximity = '';
    if (!is_null($item_attrs['data-proximity'])) {
        $proximity = elgg_view('output/maps/proximity', array('value' => $item_attrs['data-proximity'], 'class' => 'elgg-text-help maps-item-proximity'));
        $view .= $proximity;
    }
    $pin = '&nbsp;';
    if ($item_attrs['data-pin']) {
        $pin = elgg_view('output/maps/pin', array('value' => $item_attrs['data-pin'], 'class' => 'maps-item-pin', 'alt' => $item_attrs['data-title'], 'title' => $proximity ? elgg_echo('maps:proximity:info', array(strip_tags($proximity), $map->getLocation())) : $item_attrs['data-title']));
    }
    $view = elgg_view_image_block($pin, $view, array('class' => 'maps-item-pin-block'));
    $id = elgg_instanceof($item) ? "elgg-{$item->getType()}-{$item->getGUID()}" : "item-{$item->getType()}-{$item->id}";
开发者ID:hypejunction,项目名称:hypemaps,代码行数:31,代码来源:mapbox.php

示例3: elgg_push_context

elgg_push_context('gallery');
$list_classes = ['elgg-gallery'];
if (isset($vars['gallery_class'])) {
    $list_classes[] = $vars['gallery_class'];
}
$item_classes = ['elgg-item'];
if (isset($vars['item_class'])) {
    $item_classes[] = $vars['item_class'];
}
$nav = $pagination ? elgg_view('navigation/pagination', $vars) : '';
$index = 0;
$list_items = '';
foreach ($items as $item) {
    $item_view_vars = $vars;
    $item_view_vars['list_item_index'] = $index;
    $item_view = elgg_view_list_item($item, $item_view_vars);
    if (!$item_view) {
        continue;
    }
    $li_attrs = ['class' => $item_classes];
    if ($item instanceof \ElggEntity) {
        $li_attrs['id'] = "elgg-{$item->getType()}-{$item->getGUID()}";
    } else {
        if (is_callable(array($item, 'getType'))) {
            $li_attrs['id'] = "item-{$item->getType()}-{$item->id}";
        }
    }
    $list_items .= elgg_format_element('li', $li_attrs, $item_view);
    $index++;
}
if ($position == 'before' || $position == 'both') {
开发者ID:elgg,项目名称:elgg,代码行数:31,代码来源:gallery.php

示例4: elgg_view

}
$item_class = 'elgg-list-item';
if (isset($vars['item_class'])) {
    $item_class = "{$vars['item_class']} {$item_class}";
}
$html = "";
$nav = "";
if ($pagination && $count) {
    $nav .= elgg_view('navigation/pagination', array('baseurl' => $base_url, 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'offset_key' => $offset_key));
}
if (is_array($items) && count($items) > 0) {
    $html .= "<ul class=\"{$list_class}\">";
    foreach ($items as $item) {
        if (elgg_instanceof($item)) {
            $id = "elgg-{$item->getType()}-{$item->getGUID()}";
        } else {
            $id = "item-{$item->getType()}-{$item->id}";
        }
        $html .= "<li id=\"{$id}\" class=\"{$item_class}\">";
        $html .= elgg_view_list_item($item, $vars);
        $html .= '</li>';
    }
    $html .= '</ul>';
}
if ($position == 'before' || $position == 'both') {
    $html = $nav . $html;
}
if ($position == 'after' || $position == 'both') {
    $html .= $nav;
}
echo $html;
开发者ID:rasul,项目名称:Elgg,代码行数:31,代码来源:list.php

示例5: viewList

 /**
  * Display an html list of the entities
  * @param string $class		CSS class to attach to the table
  * @return string
  */
 public function viewList()
 {
     $context = isset($this->options['list_type']) ? $this->options['list_type'] : 'list';
     elgg_push_context($context);
     $items = $this->getItems();
     $options = $this->getOptions();
     $count = $this->getCount();
     $offset = elgg_extract('offset', $options);
     $limit = elgg_extract('limit', $options);
     $base_url = elgg_extract('base_url', $options, '');
     $pagination = elgg_extract('pagination', $options, true);
     $offset_key = elgg_extract('offset_key', $options, 'offset');
     $position = elgg_extract('position', $options, 'after');
     if ($pagination && $count) {
         $nav = elgg_view('navigation/pagination', array('base_url' => $base_url, 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'offset_key' => $offset_key));
     }
     $html .= '<div class="elgg-list-container">';
     if ($position == 'before' || $position == 'both') {
         $html .= $nav;
     }
     $list_attrs = elgg_format_attributes($this->getListAttributes());
     $html .= "<ul {$list_attrs}>";
     foreach ($items as $item) {
         $view = elgg_view_list_item($item, $options);
         if (!$view) {
             continue;
         }
         $has_items = true;
         $item_attrs = elgg_format_attributes($this->getItemAttributes($item));
         $html .= "<li {$item_attrs}>{$view}</li>";
     }
     if (!$has_items) {
         $html .= '<li class="elgg-list-placeholder">' . elgg_echo('list:empty') . '</li>';
     }
     $html .= '</ul>';
     if ($position == 'after' || $position == 'both') {
         $html .= $nav;
     }
     $html .= '</div>';
     elgg_pop_context();
     return $html;
 }
开发者ID:hypejunction,项目名称:api-lists,代码行数:47,代码来源:ElggList.php

示例6: elgg_view

    $content = elgg_view('core/river/filter', array('selector' => $selector));
    $sidebar = elgg_view('core/river/sidebar');
    $params = array('content' => $content . $activity, 'sidebar' => $sidebar, 'filter_context' => $page_filter, 'class' => 'elgg-river-layout');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
} else {
    $sync = get_input('sync');
    $ts = (int) get_input('time');
    if (!$ts) {
        $ts = time();
    }
    $options = get_input('options');
    if ($sync == 'new') {
        $options['wheres'] = array("rv.posted > {$ts}");
        $options['order_by'] = 'rv.posted asc';
        $options['limit'] = 0;
    }
    $items = elgg_get_river($options);
    if (is_array($items) && count($items) > 0) {
        foreach ($items as $key => $item) {
            $id = "item-{$item->getType()}-{$item->id}";
            $time = $item->posted;
            $html = "<li id=\"{$id}\" class=\"elgg-item\" data-timestamp=\"{$time}\">";
            $html .= elgg_view_list_item($item, $vars = array());
            $html .= '</li>';
            $output[] = $html;
        }
    }
    print json_encode($output);
    exit;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:river.php

示例7: elgg_view_list_item

<?php

/**
 * Render a regular list item
 *
 * @uses $vars['item']      The item being rendered
 * @uses $vars['item_vars'] Vars received from the page/components/table view
 * @uses $vars['type']      The item type or ""
 */
$item = $vars['item'];
if ($vars['type']) {
    // recognized type
    echo elgg_view_list_item($item, $vars['item_vars']);
}
开发者ID:elgg,项目名称:elgg,代码行数:14,代码来源:item.php

示例8: group_tools_route_livesearch_handler

/**
 * Take over the livesearch pagehandler in case of group search
 *
 * @param string $hook         'route'
 * @param string $type         'livessearch'
 * @param array  $return_value the current params for the pagehandler
 * @param null   $params       null
 *
 * @return bool|void
 */
function group_tools_route_livesearch_handler($hook, $type, $return_value, $params)
{
    // only return results to logged in users.
    if (!($user = elgg_get_logged_in_user_entity())) {
        exit;
    }
    if (!($q = get_input("term", get_input("q")))) {
        exit;
    }
    $input_name = get_input("name", "groups");
    $q = sanitise_string($q);
    // replace mysql vars with escaped strings
    $q = str_replace(array("_", "%"), array("\\_", "\\%"), $q);
    $match_on = get_input("match_on", "all");
    if (!is_array($match_on)) {
        $match_on = array($match_on);
    }
    // only take over groups search
    if (count($match_on) > 1 || !in_array("groups", $match_on)) {
        return $return_value;
    }
    if (get_input("match_owner", false)) {
        $owner_guid = $user->getGUID();
    } else {
        $owner_guid = ELGG_ENTITIES_ANY_VALUE;
    }
    $limit = sanitise_int(get_input("limit", 10));
    // grab a list of entities and send them in json.
    $results = array();
    $options = array("type" => "group", "limit" => $limit, "owner_guid" => $owner_guid, "joins" => array("JOIN " . elgg_get_config("dbprefix") . "groups_entity ge ON e.guid = ge.guid"), "wheres" => array("(ge.name LIKE '%" . $q . "%' OR ge.description LIKE '%" . $q . "%')"));
    $entities = elgg_get_entities($options);
    if (!empty($entities)) {
        foreach ($entities as $entity) {
            $output = elgg_view_list_item($entity, array("use_hover" => false, "class" => "elgg-autocomplete-item", "full_view" => false));
            $icon = elgg_view_entity_icon($entity, "tiny", array("use_hover" => false));
            $result = array("type" => "group", "name" => $entity->name, "desc" => $entity->description, "guid" => $entity->getGUID(), "label" => $output, "value" => $entity->getGUID(), "icon" => $icon, "url" => $entity->getURL(), "html" => elgg_view("input/grouppicker/item", array("entity" => $entity, "input_name" => $input_name)));
            $results[$entity->name . rand(1, 100)] = $result;
        }
    }
    ksort($results);
    header("Content-Type: application/json");
    echo json_encode(array_values($results));
    exit;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:54,代码来源:hooks.php

示例9: elgg_view

$nav = '';
if ($pagination && $count) {
    $nav .= elgg_view('navigation/pagination', array('offset' => $offset, 'count' => $count, 'limit' => $limit, 'offset_key' => $offset_key));
}
if ($position == 'before' || $position == 'both') {
    echo $nav;
}
?>
<ul class="<?php 
echo $gallery_class;
?>
">
	<?php 
foreach ($items as $item) {
    if (elgg_instanceof($item)) {
        $id = "elgg-{$item->getType()}-{$item->getGUID()}";
    } else {
        $id = "item-{$item->getType()}-{$item->id}";
    }
    echo "<li id=\"{$id}\" class=\"{$item_class}\">";
    echo elgg_view_list_item($item, $vars);
    echo "</li>";
}
?>
</ul>

<?php 
if ($position == 'after' || $position == 'both') {
    echo $nav;
}
elgg_pop_context();
开发者ID:duanhv,项目名称:mdg-social,代码行数:31,代码来源:gallery.php

示例10: input_livesearch_page_handler

/**
 * Page handler for autocomplete endpoint.
 *
 * @todo split this into functions/objects, this is way too big
 *
 * /livesearch?q=<query>
 *
 * Other options include:
 *     match_on	   string all or array(groups|users|friends)
 *     match_owner int    0/1
 *     limit       int    default is 10
 *     name        string default "members"
 *
 * @param array $page
 * @return string JSON string is returned and then exit
 * @access private
 */
function input_livesearch_page_handler($page)
{
    $dbprefix = elgg_get_config('dbprefix');
    // only return results to logged in users.
    if (!($user = elgg_get_logged_in_user_entity())) {
        exit;
    }
    if (!($q = get_input('term', get_input('q')))) {
        exit;
    }
    $input_name = get_input('name', 'members');
    $q = sanitise_string($q);
    // replace mysql vars with escaped strings
    $q = str_replace(array('_', '%'), array('\\_', '\\%'), $q);
    $match_on = get_input('match_on', 'all');
    if (!is_array($match_on)) {
        $match_on = array($match_on);
    }
    // all = users and groups
    if (in_array('all', $match_on)) {
        $match_on = array('users', 'groups');
    }
    $owner_guid = ELGG_ENTITIES_ANY_VALUE;
    if (get_input('match_owner', false)) {
        $owner_guid = $user->getGUID();
    }
    $limit = sanitise_int(get_input('limit', elgg_get_config('default_limit')));
    // grab a list of entities and send them in json.
    $results = array();
    foreach ($match_on as $match_type) {
        switch ($match_type) {
            case 'users':
                $options = array('type' => 'user', 'limit' => $limit, 'joins' => array("JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"), 'wheres' => array("ue.banned = 'no'", "(ue.name LIKE '{$q}%' OR ue.name LIKE '% {$q}%' OR ue.username LIKE '{$q}%')"));
                $entities = elgg_get_entities($options);
                if (!empty($entities)) {
                    foreach ($entities as $entity) {
                        if (in_array('groups', $match_on)) {
                            $value = $entity->guid;
                        } else {
                            $value = $entity->username;
                        }
                        $output = elgg_view_list_item($entity, array('use_hover' => false, 'use_link' => false, 'class' => 'elgg-autocomplete-item', 'title' => $entity->name));
                        $icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
                        $result = array('type' => 'user', 'name' => $entity->name, 'desc' => $entity->username, 'guid' => $entity->guid, 'label' => $output, 'value' => $value, 'icon' => $icon, 'url' => $entity->getURL(), 'html' => elgg_view('input/userpicker/item', array('entity' => $entity, 'input_name' => $input_name)));
                        $results[$entity->name . rand(1, 100)] = $result;
                    }
                }
                break;
            case 'groups':
                // don't return results if groups aren't enabled.
                if (!elgg_is_active_plugin('groups')) {
                    continue;
                }
                $options = array('type' => 'group', 'limit' => $limit, 'owner_guid' => $owner_guid, 'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), 'wheres' => array("(ge.name LIKE '{$q}%' OR ge.name LIKE '% {$q}%' OR ge.description LIKE '% {$q}%')"));
                $entities = elgg_get_entities($options);
                if (!empty($entities)) {
                    foreach ($entities as $entity) {
                        $output = elgg_view_list_item($entity, array('use_hover' => false, 'class' => 'elgg-autocomplete-item', 'full_view' => false, 'href' => false, 'title' => $entity->name));
                        $icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
                        $result = array('type' => 'group', 'name' => $entity->name, 'desc' => strip_tags($entity->description), 'guid' => $entity->guid, 'label' => $output, 'value' => $entity->guid, 'icon' => $icon, 'url' => $entity->getURL());
                        $results[$entity->name . rand(1, 100)] = $result;
                    }
                }
                break;
            case 'friends':
                $options = array('type' => 'user', 'limit' => $limit, 'relationship' => 'friend', 'relationship_guid' => $user->getGUID(), 'joins' => array("JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"), 'wheres' => array("ue.banned = 'no'", "(ue.name LIKE '{$q}%' OR ue.name LIKE '% {$q}%' OR ue.username LIKE '{$q}%')"));
                $entities = elgg_get_entities_from_relationship($options);
                if (!empty($entities)) {
                    foreach ($entities as $entity) {
                        $output = elgg_view_list_item($entity, array('use_hover' => false, 'use_link' => false, 'class' => 'elgg-autocomplete-item', 'title' => $entity->name));
                        $icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
                        $result = array('type' => 'user', 'name' => $entity->name, 'desc' => $entity->username, 'guid' => $entity->guid, 'label' => $output, 'value' => $entity->username, 'icon' => $icon, 'url' => $entity->getURL(), 'html' => elgg_view('input/userpicker/item', array('entity' => $entity, 'input_name' => $input_name)));
                        $results[$entity->name . rand(1, 100)] = $result;
                    }
                }
                break;
            default:
                header("HTTP/1.0 400 Bad Request", true);
                echo "livesearch: unknown match_on of {$match_type}";
                exit;
                break;
        }
    }
//.........这里部分代码省略.........
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:101,代码来源:input.php

示例11: messages_page_handler

/**
 * Messages page handler
 *
 * @param array $page Array of URL components for routing
 * @return bool
 */
function messages_page_handler($page)
{
    global $CONFIG;
    elgg_load_library('elgg:messages');
    elgg_push_breadcrumb(elgg_echo('messages'), 'messages/inbox/' . elgg_get_logged_in_user_entity()->username);
    if (!isset($page[0])) {
        $page[0] = 'inbox';
    }
    // supporting the old inbox url /messages/<username>
    $user = get_user_by_username($page[0]);
    if ($user) {
        $page[1] = $page[0];
        $page[0] = 'inbox';
    }
    if (!isset($page[1])) {
        $page[1] = elgg_get_logged_in_user_entity()->username;
    }
    $base_dir = elgg_get_plugins_path() . 'messages/pages/messages';
    switch ($page[0]) {
        case 'inbox':
            set_input('username', $page[1]);
            include "{$base_dir}/inbox.php";
            break;
        case 'sent':
            set_input('username', $page[1]);
            include "{$base_dir}/sent.php";
            break;
        case 'read':
            set_input('guid', $page[1]);
            include "{$base_dir}/read.php";
            break;
        case 'compose':
        case 'add':
            include "{$base_dir}/send.php";
            break;
        case 'forward':
            set_input('guid', $page[1]);
            include "{$base_dir}/forward.php";
            break;
        case 'download':
            set_input('file_guid', $page[1]);
            include "{$base_dir}/download.php";
            break;
        case 'search':
            if (!($q = get_input('term', get_input('q')))) {
                exit;
            }
            $q = sanitise_string($q);
            $limit = sanitise_int(get_input('limit', 10));
            // grab a list of entities and send them in json.
            $results = array();
            $query = "SELECT * FROM {$CONFIG->dbprefix}users_entity as ue, {$CONFIG->dbprefix}entities as e\n\t\t\t\t\tWHERE e.guid = ue.guid\n\t\t\t\t\t\tAND e.enabled = 'yes'\n\t\t\t\t\t\tAND ue.banned = 'no'\n\t\t\t\t\t\tAND (ue.name LIKE '{$q}%' OR ue.username LIKE '{$q}%')\n\t\t\t\t\tLIMIT {$limit}\n\t\t\t";
            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('use_hover' => false, 'class' => 'elgg-autocomplete-item'));
                    $icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
                    $results = array('type' => 'user', 'name' => $entity->name, 'desc' => $entity->username, 'guid' => $entity->guid, 'label' => $entity->name, 'value' => $value, 'icon' => $icon, 'url' => $entity->getURL());
                    $results[$entity->name . rand(1, 100)] = $results;
                }
            }
            ksort($results);
            header("Content-Type: application/json");
            echo json_encode(array_values($results));
            exit;
            break;
        case 'find':
            set_input('username', $page[1]);
            include "{$base_dir}/find.php";
            break;
        case 'label':
            if (!$page[1]) {
                forward(REFERER);
            }
            set_input('label', $page[1]);
            include "{$base_dir}/label.php";
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:96,代码来源:start.php

示例12: elgg_get_logged_in_user_entity

$user = elgg_get_logged_in_user_entity();
$time_created = get_input('time_created');
$guid = get_input('guid');
$chat = get_entity($guid);
if (!elgg_instanceof($chat, 'object', 'chat') || !$chat->isMember()) {
    echo false;
    exit;
}
$options = array('type' => 'object', 'subtype' => 'chat_message', 'container_guid' => $guid, 'order_by' => 'e.time_created asc');
$pagination = get_input('pagination', false);
if ($pagination) {
    // Get old messages
    $options['wheres'] = array("time_created < {$time_created}");
    $options['limit'] = 6;
} else {
    // Get the newest messages
    $options['wheres'] = array("time_created > {$time_created}");
    $options['limit'] = false;
}
$messages = elgg_get_entities($options);
$html = '';
if ($messages) {
    elgg_load_library('chat');
    foreach ($messages as $message) {
        $id = "elgg-object-{$message->getGUID()}";
        $item = elgg_view_list_item($message);
        $html .= "<li id=\"{$id}\" class=\"elgg-item\">{$item}</li>";
    }
    $chat->resetUnreadMessageCount();
}
echo $html;
开发者ID:juho-jaakkola,项目名称:elgg-chat,代码行数:31,代码来源:messages.php

示例13: livesearch

 /**
  * Take over the livesearch when searching for groups
  *
  * @param string $hook         the name of the hook
  * @param string $type         the type of the hook
  * @param array  $return_value current return value
  * @param null   $params       supplied params
  *
  * @see input_livesearch_page_handler()
  *
  * @return void|false
  */
 public static function livesearch($hook, $type, $return_value, $params)
 {
     // only return results to logged in users.
     $user = elgg_get_logged_in_user_entity();
     if (empty($user)) {
         exit;
     }
     $q = get_input('term', get_input('q'));
     if (empty($q)) {
         exit;
     }
     // sanitise search query
     $q = sanitise_string($q);
     // replace mysql vars with escaped strings
     $q = str_replace(['_', '%'], ['\\_', '\\%'], $q);
     $match_on = get_input('match_on', 'all');
     if (!is_array($match_on)) {
         $match_on = [$match_on];
     }
     // only take over groups search
     if (count($match_on) > 1 || !in_array('groups', $match_on)) {
         return;
     }
     $owner_guid = ELGG_ENTITIES_ANY_VALUE;
     if (get_input('match_owner', false)) {
         $owner_guid = $user->getGUID();
     }
     $input_name = get_input('name', 'groups');
     $limit = sanitise_int(get_input('limit', elgg_get_config('default_limit')));
     // fetch groups
     $results = [];
     $dbprefix = elgg_get_config('dbprefix');
     $options = ['type' => 'group', 'limit' => $limit, 'owner_guid' => $owner_guid, 'joins' => ["JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"], 'wheres' => ["(ge.name LIKE '%{$q}%' OR ge.description LIKE '%{$q}%')"]];
     $entities = elgg_get_entities($options);
     if (!empty($entities)) {
         foreach ($entities as $entity) {
             $output = elgg_view_list_item($entity, ['use_hover' => false, 'class' => 'elgg-autocomplete-item', 'full_view' => false, 'href' => false, 'title' => $entity->name]);
             $icon = elgg_view_entity_icon($entity, 'tiny', ['use_hover' => false]);
             $result = ['type' => 'group', 'name' => $entity->name, 'desc' => strip_tags($entity->description), 'guid' => $entity->getGUID(), 'label' => $output, 'value' => $entity->getGUID(), 'icon' => $icon, 'url' => $entity->getURL(), 'html' => elgg_view('input/grouppicker/item', ['entity' => $entity, 'input_name' => $input_name])];
             $results[$entity->name . rand(1, 100)] = $result;
         }
     }
     ksort($results);
     header('Content-Type: application/json;charset=utf-8');
     echo json_encode(array_values($results));
     exit;
 }
开发者ID:coldtrick,项目名称:group_tools,代码行数:59,代码来源:Router.php

示例14: elgg_view

                            if (!$col_options) {
                                continue;
                            }
                            if (isset($col_options['override_view']) && elgg_view_exists($col_options['override_view'])) {
                                $cell = elgg_view($col_options['override_view'], $vars);
                            } else {
                                if (elgg_view_exists("{$type}/{$subtype}/elements/{$col_header}")) {
                                    $cell .= elgg_view("{$type}/{$subtype}/elements/{$col_header}", $vars);
                                } else {
                                    if (elgg_view_exists("framework/bootstrap/{$type}/elements/{$col_header}")) {
                                        $cell .= elgg_view("framework/bootstrap/{$type}/elements/{$col_header}", $vars);
                                    } else {
                                        $cell .= '<div>' . $item->{$col_header} . '</div>';
                                    }
                                }
                            }
                        }
                        //$colspan = ' colspan="' . count($options['colspan']) . '"';
                    } else {
                        $cell = '<div>' . $item->{$header} . '</div>';
                    }
                }
            }
        }
        $header_ns = preg_replace('/[^a-z0-9\\-]/i', '-', $header);
        $item_view .= "<td {$colspan} class=\"table-cell-{$header_ns}\">{$cell}</td>";
    }
} else {
    $item_view .= elgg_view_list_item($entity, $vars);
}
echo "<tr {$attributes}>{$item_view}</tr>";
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:row.php

示例15: sanitise_string

if (!elgg_is_logged_in()) {
    exit;
}
$q = sanitise_string(get_input('term'));
// replace mysql vars with escaped strings
$q = str_replace(array('_', '%'), array('\\_', '\\%'), $q);
$user_guid = elgg_get_logged_in_user_guid();
$entities = elgg_get_entities(array('type' => 'group', 'owner_guid' => $user_guid, 'limit' => 0));
$entities = array_merge($entities, elgg_get_entities_from_relationship(array('type' => 'group', 'relationship' => 'operator', 'relationship_guid' => $user_guid, 'limit' => 0)));
$all_entities = array();
while (!empty($entities)) {
    $entity = array_pop($entities);
    $childs = elgg_get_entities(array('type' => 'group', 'container_guid' => $entity->guid));
    foreach ($childs as $child) {
        array_push($entities, $child);
    }
    $all_entities[] = $entity;
}
$results = array();
foreach ($all_entities as $entity) {
    if (!preg_match("/^{$q}/i", $entity->name)) {
        continue;
    }
    $output = elgg_view_list_item($entity, array('use_hover' => false, 'class' => 'elgg-autocomplete-item'));
    $icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
    $results[$entity->name . $entity->guid] = array('type' => 'group', 'name' => $entity->name, 'desc' => strip_tags($entity->description), 'guid' => $entity->guid, 'label' => $output, 'value' => $entity->guid, 'icon' => $icon, 'url' => $entity->getURL());
}
ksort($results);
header("Content-Type: application/json");
echo json_encode(array_values($results));
exit;
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:groups_i_can_edit.php


注:本文中的elgg_view_list_item函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。