You are here

function rdf_sioc_xml_user_render in Views Datasource 5

2 calls to rdf_sioc_xml_user_render()
rdf_sioc_xml_story_render in ./views_rdf.module
views_rdf_sioc_xml_render in ./views_rdf.module

File

./views_rdf.module, line 388
Provides Views plugin for rendering node content as RDF.

Code

function rdf_sioc_xml_user_render($user) {
  $xml .= "<foaf:Person rdf:about=\"" . url('/user/' . $user->uid, NULL, NULL, true) . "\">\n";
  $xml .= "  <foaf:name>{$user->name}</foaf:name>\n";
  $xml .= "  <foaf:mbox_sha1sum>" . md5('mailto:' . $user->email) . "</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->email}\"/>\n";
  $xml .= "      <sioc:email_sha1>" . md5('mailto:' . $user->email) . "</sioc:email_sha1>\n";
  $xml .= "      <sioc:link rdf:resource=\"" . url('/user/' . $user->uid, NULL, NULL, 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;
}