/[drupal]/contributions/modules/moat/moat.module
ViewVC logotype

Diff of /contributions/modules/moat/moat.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7, Sat Feb 16 20:09:58 2008 UTC revision 1.8, Sat Feb 16 20:20:09 2008 UTC
# Line 1  Line 1 
1  <?  <?
2  // $Id: moat.module,v 1.6 2008/01/24 10:09:00 terraces Exp $  // $Id: moat.module,v 1.7 2008/02/16 20:09:58 terraces Exp $
3    
4  // MOAT plugin for Drupal  // MOAT plugin for Drupal
5  // Check http://moat-project.org for more details about MOAT  // Check http://moat-project.org for more details about MOAT
# Line 300  function moat_link_alter(&$node, &$links Line 300  function moat_link_alter(&$node, &$links
300    $links = $newlinks;    $links = $newlinks;
301  }  }
302    
303  // This method is called by the sioc:module to provide a sioc:topic link to the URIs  // The following methods are called by the sioc.module to output MOAT information in the RDF export
304    
305    // Providing sioc:topic links to the URIs
306  function moat_get_uris($nid) {  function moat_get_uris($nid) {
307    $res = db_query("SELECT uri FROM {moat_meanings} WHERE nid='$nid'");    $res = db_query("SELECT uri FROM {moat_meanings} WHERE nid='$nid'");
308    while($moat = db_fetch_object($res)) {    while($moat = db_fetch_object($res)) {
# Line 309  function moat_get_uris($nid) { Line 311  function moat_get_uris($nid) {
311    return $uris;    return $uris;
312  }  }
313    
314    // Outputs tag:RestrictedTaggingObjects w/ MOAT information
315    function moat_get_taggings($nid) {
316      $node = node_load(array('nid' => $nid));
317      $uid = $node->uid;
318      $url = url("node/$nid", NULL, NULL, 1);
319      $foaf = url("foaf/$uid#_$uid", NULL, NULL, 1);
320      $sioc = url("sioc/user/$uid#_user", NULL, NULL, 1);
321      $tags = taxonomy_node_get_terms($nid);
322      foreach($tags as $tag) {
323        $tid = $tag->tid;
324        $taguri = moat_tag2uri($tag->name);
325        $uri = db_result(db_query("SELECT uri FROM {moat_meanings} WHERE nid='$nid' AND tid='$tid'"));
326        $output .= "<tag:RestrictedTagging>\n";
327        $output .= "\t<tag:taggedResource rdf:resource=\"$url\"/>\n";
328        if(module_exists('foaf')) $output .= "\t<tag:taggedBy rdf:resource=\"$foaf\"/>\n";
329        $output .= "\t<sioc:has_creator rdf:resource=\"$sioc\"/>\n";
330        $output .= "\t<tag:associatedTag rdf:resource=\"$taguri\"/>\n";
331        if($uri) $output.= "\t<moat:tagMeaning rdf:resource=\"$uri\"/>\n";
332        $output .= "</tag:RestrictedTagging>\n";
333      }
334      return $output;
335    }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.2