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