예제 #1
0
<?php

$page_owner = elgg_get_page_owner_entity();
// no page owner set, may the current users
if (empty($page_owner) && elgg_is_logged_in()) {
    $page_owner = elgg_get_logged_in_user_entity();
    // set page owner
    elgg_set_page_owner_guid($page_owner->getGUID());
}
if (empty($page_owner)) {
    register_error(elgg_echo("pageownerunavailable", array(elgg_get_page_owner_guid())));
    forward("birthdays");
}
// can we get the basic selection options
if (!($options = birthdays_get_basic_selection_options(true))) {
    forward(REFERER);
}
// build page elements
$title_text = elgg_echo("birthdays:page:friends:title", array($page_owner->name));
// breadcrumb
elgg_push_breadcrumb(elgg_echo("birthdays:breadcrumb:all"), "birthdays");
elgg_push_breadcrumb($title_text);
// make sure we have the correct relationship
$options["relationship"] = "friend";
$options["relationship_guid"] = $page_owner->getGUID();
// make sure we can see all our friends
unset($options["wheres"]);
if (!($listing = elgg_list_entities_from_relationship($options))) {
    $listing = elgg_echo("birthdays:none");
}
// build page
예제 #2
0
<?php

// get basic selection options
if ($options = birthdays_get_basic_selection_options()) {
    $widget = elgg_extract("entity", $vars);
    $owner = $widget->getOwnerEntity();
    $who_to_show = $widget->who_to_show;
    $num_display = (int) $widget->num_display;
    if ($num_display < 1) {
        $num_display = 10;
    }
    $options["limit"] = $num_display;
    $options["offset"] = 0;
    $options["pagination"] = false;
    switch ($widget->context) {
        case "groups":
            $options["relationship"] = "member";
            $options["relationship_guid"] = $owner->getGUID();
            $options["inverse_relationship"] = true;
            break;
        case "index":
            $options["relationship"] = "member_of_site";
            $options["relationship_guid"] = $owner->getGUID();
            $options["inverse_relationship"] = true;
            break;
        default:
            if ($who_to_show == "all") {
                $options["relationship"] = "member_of_site";
                $options["relationship_guid"] = $widget->site_guid;
                $options["inverse_relationship"] = true;
            } else {