// Go through the list of members/groups allowed and construct an array of formatted names. foreach ($conversation["membersAllowed"] as $member) { // Format the entity's name depending on its type. if ($member["type"] == "group") { $member["avatarFormat"] = null; $member["name"] = groupName($member["name"], true); } else { $member["name"] = name($member["name"]); } // Add the avatar. $name = "<span class='name'>" . avatar($member["id"], $member["avatarFormat"], "thumb"); // If we're able to remove entities from the list, wrap the name in links that will remove them. if (!empty($data["editable"])) { // Make the entity for the owner of the conversation non-removable unless it's the last name left. if ($count == 1 or $member["id"] != $conversation["startMemberId"] or $member["type"] != "member") { $name .= "<a href='" . URL("conversation/removeMember/{$conversation["conversationId"]}?{$member["type"]}={$member["id"]}&token=" . ET::$session->token) . "' class='deleteLink' data-type='{$member["type"]}' data-id='{$member["id"]}'>{$member["name"]}</a>"; } else { $name .= $member["name"]; } } else { $name .= $member["type"] == "member" ? memberLink($member["id"], $member["name"]) : groupLink($member["name"]); } $name .= "</span>"; $names[] = $name; } // Output the list of names. if (count($names)) { echo implode(" ", $names); } else { printf(T("%s " . ($conversation["countPosts"] > 0 ? "can" : "will be able to") . " view this conversation."), T("Everyone")); }
*/ $conversation = $data["conversation"]; $names = array(); $avatars = array(); $model = ET::memberModel(); // Go through the list of members/groups allowed and construct an array of formatted names. foreach ($conversation["membersAllowedSummary"] as $member) { // If this entity is a member, add their name as a link to their profile. Also add an avatar to be // displayed at the start of the list. if ($member["type"] == "member") { $names[] = "<span class='name'>" . memberLink($member["id"], $member["name"]) . "</span>"; if (count($avatars) < 3) { $avatars[] = avatar($member + array("memberId" => $member["id"]), "thumb"); } } else { $names[] = "<span class='name'>" . groupLink($member["name"]) . "</span>"; } } // If there are specific names, output the list! if (count($names)) { // Output a few avatars at the start. echo "<span class='avatars'>" . implode(" ", $avatars) . "</span> "; // If there's more than one name, construct the list so that it has the word "and" in it. if (count($names) > 1) { // If there're more than 3 names, chop off everything after the first 3 and replace them with a // "x others" link. if (count($names) > 3) { $otherNames = array_splice($names, 3); $lastName = "<a href='#' class='showMore name'>" . sprintf(T("%s others"), count($otherNames)) . "</a>"; } else { $lastName = array_pop($names);