1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Class to provide a footnote.
|
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
|
* Provides a footnote.
|
18
|
*/
|
19
|
class Footnote {
|
20
|
public $key, $object, $theme, $themeArguments;
|
21
|
|
22
|
/**
|
23
|
* Private constructor.
|
24
|
*/
|
25
|
public function __construct($footnoteKey, $object, $theme = NULL, array $themeArguments = array()) {
|
26
|
$this->key = $footnoteKey;
|
27
|
$this->object = $object;
|
28
|
$this->theme = $theme;
|
29
|
if (!is_array($themeArguments)) {
|
30
|
$themeArguments = array();
|
31
|
}
|
32
|
$this->themeArguments = $themeArguments;
|
33
|
}
|
34
|
|
35
|
/**
|
36
|
* @todo please document this function.
|
37
|
*/
|
38
|
public function doRender() {
|
39
|
if ($this->theme) {
|
40
|
$args = $this->themeArguments;
|
41
|
array_unshift($this->object);
|
42
|
array_unshift($this->theme);
|
43
|
$out = call_user_func_array('theme', $args);
|
44
|
}
|
45
|
else {
|
46
|
$out = $this->object;
|
47
|
}
|
48
|
return theme('cdm_footnote', array('footnoteKey' => $this->key, 'footnoteText' => $out));
|
49
|
}
|
50
|
}
|