Beispiel #1
0
/**
 * View an item in a list
 *
 * @param ElggEntity|ElggAnnotation $item
 * @param array  $vars Additional parameters for the rendering
 *
 * @return string
 * @since 1.8.0
 * @access private
 */
function elgg_view_list_item($item, array $vars = array())
{
    global $CONFIG;
    $type = $item->getType();
    if (in_array($type, $CONFIG->entity_types)) {
        return elgg_view_entity($item, $vars);
    } else {
        if ($type == 'annotation') {
            return elgg_view_annotation($item, $vars);
        } else {
            if ($type == 'river') {
                return elgg_view_river_item($item, $vars);
            }
        }
    }
    return '';
}
Beispiel #2
0
/**
 * View an item in a list
 *
 * @param \ElggEntity|\ElggAnnotation $item
 * @param array  $vars Additional parameters for the rendering
 *      'item_view' Alternative view used to render list items
 * @return string
 * @since 1.8.0
 * @access private
 */
function elgg_view_list_item($item, array $vars = array())
{
    if ($item instanceof \ElggEntity) {
        return elgg_view_entity($item, $vars);
    } else {
        if ($item instanceof \ElggAnnotation) {
            return elgg_view_annotation($item, $vars);
        } else {
            if ($item instanceof \ElggRiverItem) {
                return elgg_view_river_item($item, $vars);
            }
        }
    }
    return '';
}
Beispiel #3
0
/**
 * View an item in a list
 *
 * @param object $item ElggEntity or ElggAnnotation
 * @param array  $vars Additional parameters for the rendering
 *
 * @return string
 * @since 1.8.0
 * @access private
 */
function elgg_view_list_item($item, array $vars = array())
{
    switch ($item->getType()) {
        case 'user':
        case 'object':
        case 'group':
        case 'site':
            return elgg_view_entity($item, $vars);
        case 'annotation':
            return elgg_view_annotation($item, $vars);
        case 'river':
            return elgg_view_river_item($item, $vars);
        default:
            return false;
            break;
    }
}
Beispiel #4
0
/**
 * Returns a view of a list of annotations, plus navigation. It is intended that this function
 * be called from other wrapper functions.
 * 
 * @param array $annotations List of annotations
 * @param int $count The total number of annotations across all pages
 * @param int $offset The current indexing offset
 * @param int $limit The number of annotations to display per page
 * @return string The list of annotations
 */
function elgg_view_annotation_list($annotations, $count, $offset, $limit)
{
    $count = (int) $count;
    $offset = (int) $offset;
    $limit = (int) $limit;
    $html = "";
    $nav = elgg_view('navigation/pagination', array('baseurl' => $_SERVER['REQUEST_URI'], 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'word' => 'annoff', 'nonefound' => false));
    $html .= $nav;
    if (is_array($annotations) && sizeof($annotations) > 0) {
        foreach ($annotations as $annotation) {
            $html .= elgg_view_annotation($annotation, "", false);
        }
    }
    if ($count) {
        $html .= $nav;
    }
    return $html;
}