1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Singleton class to provide render hints.
|
5
|
*
|
6
|
* @copyright
|
7
|
* (C) 2007-2012 EDIT
|
8
|
* European Distributed Institute of Taxonomy
|
9
|
* http://www.e-taxonomy.eu
|
10
|
*
|
11
|
* The contents of this module are subject to the Mozilla
|
12
|
* Public License Version 1.1.
|
13
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14
|
*/
|
15
|
|
16
|
/**
|
17
|
* Singleton to provide render hints.
|
18
|
*/
|
19
|
class RenderHints {
|
20
|
private static $renderStack = array();
|
21
|
private static $footnoteListKey = FALSE;
|
22
|
|
23
|
/**
|
24
|
* Private constructor.
|
25
|
*/
|
26
|
private function __construct() {}
|
27
|
|
28
|
/**
|
29
|
* @todo document this function.
|
30
|
*/
|
31
|
public static function getFootnoteListKey() {
|
32
|
return self::$footnoteListKey;
|
33
|
}
|
34
|
|
35
|
/**
|
36
|
* @todo document this function.
|
37
|
*/
|
38
|
public static function setFootnoteListKey($key) {
|
39
|
self::$footnoteListKey = $key;
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* @todo document this function.
|
44
|
*/
|
45
|
public static function pushToRenderStack($pathelement) {
|
46
|
array_push(self::$renderStack, $pathelement);
|
47
|
}
|
48
|
|
49
|
/**
|
50
|
* @todo document this function.
|
51
|
*/
|
52
|
public static function popFromRenderStack() {
|
53
|
return array_pop(self::$renderStack);
|
54
|
}
|
55
|
|
56
|
/**
|
57
|
* @todo document this function.
|
58
|
*/
|
59
|
public static function sizeof() {
|
60
|
return sizeof(self::$renderStack);
|
61
|
}
|
62
|
|
63
|
/**
|
64
|
* @todo document this function.
|
65
|
*/
|
66
|
public static function getRenderPath() {
|
67
|
return join('.', array_reverse(self::$renderStack));
|
68
|
}
|
69
|
|
70
|
/**
|
71
|
* @todo document this function.
|
72
|
*/
|
73
|
public static function getHtmlElementID($cdmBase) {
|
74
|
return 'id="' . RenderHints::getRenderPath() . '(' . $cdmBase->class . ':' . $cdmBase->uuid . ')"';
|
75
|
}
|
76
|
|
77
|
/**
|
78
|
* Stop users from cloning.
|
79
|
*/
|
80
|
public function __clone() {
|
81
|
trigger_error('Cloning instances of the singleton class RenderHints is prohibited', E_USER_ERROR);
|
82
|
}
|
83
|
}
|