loadXML($xml); return new DOMXPath($dom); } //TODO: move this into a template function badge_render_section($params) { global $path_prefix, $base_url; // organise input into headings and rows $current_section = ""; $sections = array("" => array()); foreach ($params as $item) { list($k, $v) = $item; if ($k == 'heading') { $current_section = $v; $sections[$v] = array(); } else { $sections[$current_section][] = $v; } } $html = '
| '.$section_name.' | |
| '.$items[$pos].' | '; } $html .= '|
User has not yet created a sidebar widget.
"; break; default: throw $e; } $badge = array(); } $profile =& $badge['profile']; if (@$profile['enabled']) { $html .= ''.htmlspecialchars($prof['first_name'].' '.$prof['last_name']).'
'; $prof = get_profile_info($user->user_id, "flickr"); if (count($prof)) { $html .= 'Flickr: '.htmlspecialchars($prof['username']).'
'; } $prof = get_profile_info($user->user_id, "facebook"); if (count($prof)) { $html .= "School: ".htmlspecialchars($xp->query("name/text()")->item(0)->data.", ". $xp->query("year/text()")->item(0)->data).'
'; } $xp = badge_parse_xml($prof['affiliations']); if ($xp) { $html .= "Affiliations: ".htmlspecialchars($xp->query("name/text()")->item(0)->data." ". $xp->query("status/text()")->item(0)->data.", ". $xp->query("year/text()")->item(0)->data).'
'; } } } foreach (array( array("friends", "friends", "internal"), array("friends_ext", "imported friends", "external"), ) as $args) { list ($group_key, $display_name, $rel_scope) = $args; $friends =& $badge[$group_key]; if (@$friends['enabled']) { $html .= "user_id\">$user->first_name $user->last_name's $show_what:
"; $show_all_url = ""; switch ($show_what) { case 'friends': $perpage = (int)$param; $relations = Relation::get_all_relations($user->user_id, 0, FALSE, $param, $page); $n = count($relations); $rows = intval($n/3) + ($n % 3 ? 1 : 0); $pos = 0; $html .= "| ';
$rel = $relations[$pos];
$html .= '';
if ($rel['picture'] && file_exists("files/".$rel['picture'])) {
$html .= uihelper_resize_mk_user_img($rel['picture'], 50, 50) . " "; } $html .= htmlspecialchars($rel['login_name']).''; $html .= " | ";
}
$html .= "|
| '; $html .= " | show all |