function _views_rdf_sioc_xml_user_render in Views Datasource 7
Same name and namespace in other branches
- 6 theme/views_views_rdf_style.theme.inc \_views_rdf_sioc_xml_user_render()
1 call to _views_rdf_sioc_xml_user_render()
- views-views-rdf-style-sioc.tpl.php in views/
theme/ views-views-rdf-style-sioc.tpl.php - views-views-rdf-style-sioc.tpl.php Default template for the Views RDF style plugin using the SIOC vocabulary
File
- views/
theme/ views_views_rdf_style.theme.inc, line 423 - View template to render view fields as rdf.
Code
function _views_rdf_sioc_xml_user_render($user) {
$xml = "<foaf:Person rdf:about=\"" . url('user/' . $user["uid"], array(
'absolute' => TRUE,
)) . "\">\n";
$xml .= " <foaf:name>" . $user["name"] . "</foaf:name>\n";
$xml .= " <foaf:mbox_sha1sum>" . md5('mailto:' . $user["mail"]) . "</foaf:mbox_sha1sum>\n";
$xml .= " <foaf:holdsAccount>\n";
$xml .= " <sioc:User rdf:nodeID=\"" . $user["uid"] . "\">\n";
$xml .= " <sioc:name>" . $user["name"] . "</sioc:name>\n";
$xml .= " <sioc:email rdf:resource=\"mailto:." . $user["mail"] . "\"/>\n";
$xml .= " <sioc:email_sha1>" . md5('mailto:' . $user["mail"]) . "</sioc:email_sha1>\n";
$xml .= " <sioc:link rdf:resource=\"" . url('user/' . $user["uid"], array(
'absolute' => TRUE,
)) . "\" rdfs:label=\"" . $user["name"] . "\"/>\n";
$roles = array();
$roles_query = db_query("SELECT r.name AS name, r.rid AS rid FROM {users_roles} ur, {role} r WHERE ur.uid = %d AND ur.rid = r.rid", $user["uid"]);
while ($role = db_fetch_object($roles_query)) {
$roles[$role->rid] = $role->name;
}
if (count($roles) > 0) {
$xml .= " <sioc:has_function>\n";
foreach ($roles as $rid => $name) {
$xml .= " <sioc:Role><rdfs:label><![CDATA[{$name}]]></rdfs:label></sioc:Role>\n";
}
$xml .= " </sioc:has_function>\n";
}
$xml .= " </sioc:User>\n";
$xml .= " </foaf:holdsAccount>\n";
$xml .= "</foaf:Person>\n";
return $xml;
}