Ejemplo n.º 1
0
        }
    }
    if (!empty($counter)) {
        $counter = "(" . $counter . ")";
    } else {
        $counter = "";
    }
}
$groups = elgg_view_module("newsletter-recipients", elgg_echo("groups") . "<span class='newsletter-counter mls'>" . $counter . "</span>", $groups_content, array("class" => $class, "id" => "newsletter-recipients-groups"));
// add specific emails
$email_content = "";
$class = "hidden";
if (!empty($emails)) {
    $counter = 0;
    foreach ($emails as $email) {
        $email_listing = newsletter_format_recipient($email);
        if (!empty($email_listing)) {
            $class = "";
            $counter++;
            $email_content .= elgg_extract("content", $email_listing);
        }
    }
    if (!empty($counter)) {
        $counter = "(" . $counter . ")";
    } else {
        $counter = "";
    }
}
$emails = elgg_view_module("newsletter-recipients", elgg_echo("newsletter:recipients:email") . "<span class='newsletter-counter mls'>" . $counter . "</span>", $email_content, array("class" => $class, "id" => "newsletter-recipients-emails"));
$icon_options = array("class" => array("elgg-icon-info", "mlm"), "title" => elgg_echo("newsletter:recipients:tooltip"));
$wrapper_title = elgg_echo("newsletter:recipients") . elgg_view("output/icon", $icon_options);
Ejemplo n.º 2
0
                $key = strtolower($user->name) . $user->getGUID();
                $result[$key] = newsletter_format_recipient($user);
            }
        }
        if (!elgg_instanceof($entity->getContainerEntity(), "group")) {
            // search for groups
            $options = array("type" => "group", "limit" => $limit, "joins" => array("JOIN " . $dbprefix . "groups_entity ge ON e.guid = ge.guid"), "wheres" => array("(ge.name LIKE '%" . $filtered_query . "%' OR ge.description LIKE '%" . $filtered_query . "%')"));
            $groups = elgg_get_entities($options);
            if (!empty($groups)) {
                foreach ($groups as $group) {
                    $key = strtolower($group->name) . $group->getGUID();
                    $result[$key] = newsletter_format_recipient($group);
                }
            }
        }
        // email input
        if (newsletter_is_email_address($query)) {
            if ($users = get_user_by_email($query)) {
                // found a user with this email address
                $key = strtolower($users[0]->name) . $users[0]->getGUID();
                $result[$key] = newsletter_format_recipient($users[0]);
            } else {
                // no user found
                $result[$query] = newsletter_format_recipient($query);
            }
        }
    }
}
ksort($result);
header("Content-Type: application/json");
echo json_encode(array_values($result));