コード例 #1
0
ファイル: content.php プロジェクト: amcfarlane1251/ongarde
/**
 * Answers widget content view
 */
$content_type = $vars['entity']->content_type;
// Get the current page's owner
$page_owner = elgg_get_page_owner_entity();
if ($page_owner === false || is_null($page_owner)) {
    $page_owner = $_SESSION['user'];
    set_page_owner($page_owner->getGUID());
}
$num = $vars['entity']->num_display;
if ($content_type == 'mine') {
    $objects = $page_owner->getObjects('question', $num);
    $count = $page_owner->countObjects('question');
} else {
    if ($content_type == 'friends') {
        $objects = get_user_friends_objects($page_owner->getGUID(), 'question', $num);
        $count = count_user_friends_objects($page_owner->getGUID(), 'question');
    } else {
        // site
        $options = array('type' => 'object', 'subtype' => 'question', 'limit' => $num);
        $objects = elgg_get_entities($options);
        $options['count'] = true;
        $count = elgg_get_entities($options);
    }
}
if (is_array($objects) && sizeof($objects) > 0) {
    foreach ($objects as $object) {
        echo elgg_view_entity($object);
    }
}
コード例 #2
0
/**
 * Displays a list of a user's friends' objects of a particular subtype, with navigation.
 *
 * @see elgg_view_entity_list
 * 
 * @param int $user_guid The GUID of the user
 * @param string $subtype The object subtype
 * @param int $limit The number of entities to display on a page
 * @param true|false $fullview Whether or not to display the full view (default: true)
 * @param true|false $viewtypetoggle Whether or not to allow you to flip to gallery mode (default: true)
 * @return string The list in a form suitable to display
 */
function list_user_friends_objects($user_guid, $subtype = "", $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true)
{
    $offset = (int) get_input('offset');
    $limit = (int) $limit;
    $count = (int) count_user_friends_objects($user_guid, $subtype);
    $entities = get_user_friends_objects($user_guid, $subtype, $limit, $offset);
    return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
}
コード例 #3
0
ファイル: users.php プロジェクト: riggo/Elgg
/**
 * Displays a list of a user's friends' objects of a particular subtype, with navigation.
 *
 * @see elgg_view_entity_list
 *
 * @param int    $user_guid      The GUID of the user
 * @param string $subtype        The object subtype
 * @param int    $limit          The number of entities to display on a page
 * @param bool   $full_view      Whether or not to display the full view (default: true)
 * @param bool   $listtypetoggle Whether or not to allow you to flip to gallery mode (default: true)
 * @param bool   $pagination     Whether to display pagination (default: true)
 * @param int    $timelower      The earliest time the entity can have been created. Default: all
 * @param int    $timeupper      The latest time the entity can have been created. Default: all
 *
 * @return string
 */
function list_user_friends_objects($user_guid, $subtype = "", $limit = 10, $full_view = true, $listtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0)
{
    $offset = (int) get_input('offset');
    $limit = (int) $limit;
    $count = (int) count_user_friends_objects($user_guid, $subtype, $timelower, $timeupper);
    $entities = get_user_friends_objects($user_guid, $subtype, $limit, $offset, $timelower, $timeupper);
    return elgg_view_entity_list($entities, array('count' => $count, 'offset' => $offset, 'limit' => $limit, 'full_view' => $full_view, 'list_type_toggle' => $listtypetoggle, 'pagination' => $pagination));
}