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	$labels = $triples ->fetchTriples ($scope.$hint,null,$value,null,$scope);
18	$label = ($labels? $labels[0]['predicate']: '#NA');
19	$R->internallink($scope.':'.$hint,$label);
20    return true;
21    }
22
23    function getInfo() {
24        return array(
25            'desc'=>'Displays a value or a key  by using the corresponding prefix  in a given data fragment',
26            'tags'=>array('string'),
27            'hint'=>'data fragment'
28        );
29    }
30}
31
32