1<?php
2/**
3 * @author     François KAAG (francois.kaag@cardynal.fr)
4 */
5// must be run within Dokuwiki
6if(!defined('DOKU_INC')) die('Meh.');
7
8/**
9 * New enum type for Strata
10 */
11class plugin_strata_type_enum extends plugin_strata_type {
12    function render($mode, &$R, &$triples, $value, $hint) {
13	global $ID;
14            // use the hint if available
15	$scope=getNS($ID);
16	if ($scope != "") $scope .=":";
17	if (substr($hint,0,1)===':')
18	   { $hint = substr($hint,1); }
19	else
20	   { $hint = $scope.$hint; }
21
22	$labels = $triples ->fetchTriples ($hint,null,$value,null,null);
23	$label = ($labels? $labels[0]['predicate']: '#NA');
24
25	$R->internallink($hint,$label);
26    return true;
27    }
28
29    function getInfo() {
30        return array(
31            'desc'=>'Displays a value or a key  by using the corresponding prefix  in a given data fragment',
32            'tags'=>array('string'),
33            'hint'=>'data fragment'
34        );
35    }
36}
37
38