15 |
15 |
* @author
|
16 |
16 |
* - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
|
17 |
17 |
*/
|
18 |
|
const FOOTNOTE_KEY_SUFFIX_ANNOTATIONS = '-annotations';
|
19 |
18 |
|
20 |
19 |
/**
|
21 |
20 |
* Creates the footnotes for the given CDM instance.
|
... | ... | |
24 |
23 |
* parameters $footnote_list_key_suggestion and $is_bibliography_aware, see parameter $footnote_list_key_suggestion
|
25 |
24 |
* for more details.
|
26 |
25 |
*
|
27 |
|
* possible keys for
|
28 |
|
* - annotation footnotes:
|
|
26 |
* possible keys for annotation and source footnotes:
|
29 |
27 |
* - $footnote_list_key_suggestion
|
30 |
|
* - RenderHints::getFootnoteListKey().FOOTNOTE_KEY_SUFFIX_ANNOTATIONS
|
|
28 |
* - RenderHints::getFootnoteListKey()
|
31 |
29 |
* - original source footnotes
|
32 |
30 |
* - "BIBLIOGRAPHY" (when !$is_bibliography_aware && bibliography_settings['enabled'] == 1 )
|
33 |
31 |
* - "BIBLIOGRAPHY-$footnote_list_key_suggestion" (when !$is_bibliography_aware && bibliography_settings['enabled'] == 0 )
|
... | ... | |
39 |
37 |
* Optional parameter. The separator string to concatenate the footnote ids, default is ','
|
40 |
38 |
* @param $footnote_list_key_suggestion string
|
41 |
39 |
* Optional parameter. If this parameter is left empty (null, 0, "") the footnote key will be determined by the nested
|
42 |
|
* method calls by calling RenderHints::getFootnoteListKey(). NOTE: the footnote key for annotations will be set to
|
43 |
|
* RenderHints::getFootnoteListKey().'-annotations'.
|
|
40 |
* method calls by calling RenderHints::getFootnoteListKey().
|
44 |
41 |
* For original sources the $footnote_list_key_suggestion will be overwritten by bibliography_footnote_list_key() when
|
45 |
42 |
* $is_bibliography_aware is set TRUE.
|
46 |
43 |
* @param bool $do_link_to_reference
|
... | ... | |
107 |
104 |
}
|
108 |
105 |
|
109 |
106 |
/**
|
110 |
|
* Fetches the list of visible annotations for each of the cdm entities and returns the footnote keys for them.
|
111 |
|
*
|
112 |
|
* The footnotes are passed to the FootnoteManager in order to store the annotations and to create the footnote keys.
|
113 |
|
*
|
114 |
|
* @see cdm_fetch_visible_annotations()
|
115 |
|
*
|
116 |
|
* @param array $cdm_entities
|
117 |
|
* An array of CdmBase instances.
|
118 |
|
* @param $footnote_list_key_suggestion string
|
119 |
|
* optional parameter. If this parameter is left empty (null, 0, "") the footnote key will be determined be set to
|
120 |
|
* RenderHints::getFootnoteListKey().FOOTNOTE_KEY_SUFFIX_ANNOTATIONS otherwise the supplied key will be used.
|
121 |
|
*
|
122 |
|
* @return array of footnote keys
|
123 |
|
*
|
124 |
|
* @deprecated unused, needs to be removed
|
125 |
|
*/
|
126 |
|
function cdm_entities_annotations_footnote_keys(array $cdm_entities, $footnote_list_key_suggestion = NULL) {
|
127 |
|
|
128 |
|
$foot_note_keys = [];
|
129 |
|
foreach ($cdm_entities as $cdm_entity) {
|
130 |
|
$foot_note_keys = array_merge($foot_note_keys, cdm_entity_annotations_as_footnote_keys($cdm_entity,$footnote_list_key_suggestion));
|
131 |
|
}
|
132 |
|
|
133 |
|
return $foot_note_keys;
|
134 |
|
}
|
135 |
|
|
136 |
|
/**
|
137 |
107 |
* Fetches the list of visible annotations for the cdm entity or for the comparable
|
138 |
108 |
* object and returns the footnote keys.
|
139 |
109 |
*
|
... | ... | |
142 |
112 |
|
143 |
113 |
* @param stdClass $cdm_entity
|
144 |
114 |
* A single CdmBase instance ore comparable object.
|
145 |
|
* @param $footnote_list_key_suggestion string
|
146 |
|
* optional parameter. If this parameter is left empty (null, 0, "") the footnote key will be determined be set to
|
147 |
|
* RenderHints::getFootnoteListKey().'-annotations' otherwise the supplied key will be used.
|
|
115 |
* @param $footnote_list_key string
|
|
116 |
* optional parameter. If this parameter is left empty (null, 0, "") the
|
|
117 |
* footnote key will be set to RenderHints::getFootnoteListKey()
|
|
118 |
* otherwise the supplied $footnote_list_key will be used.
|
148 |
119 |
* @return array of footnote keys
|
149 |
120 |
*
|
150 |
121 |
* @see cdm_fetch_visible_annotations()
|
151 |
122 |
*/
|
152 |
|
function cdm_entity_annotations_as_footnote_keys(stdClass $cdm_entity, $footnote_list_key_suggestion = NULL) {
|
|
123 |
function cdm_entity_annotations_as_footnote_keys(stdClass $cdm_entity, $footnote_list_key = NULL) {
|
153 |
124 |
|
154 |
125 |
$foot_note_keys = [];
|
155 |
126 |
|
156 |
|
// Getting the key for the FootnoteManager.
|
157 |
|
if (isset($footnote_list_key_suggestion)) {
|
158 |
|
$footnote_list_key = $footnote_list_key_suggestion;
|
159 |
|
} else {
|
160 |
|
$footnote_list_key = RenderHints::getFootnoteListKey() . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS;
|
161 |
|
throw new Exception("FOOTNOTE_KEY_SUFFIX_ANNOTATIONS");
|
|
127 |
if (!isset($footnote_list_key) || !$footnote_list_key) {
|
|
128 |
$footnote_list_key = RenderHints::getFootnoteListKey();
|
162 |
129 |
}
|
163 |
130 |
|
164 |
131 |
// Adding the footnotes keys.
|
... | ... | |
173 |
140 |
}
|
174 |
141 |
|
175 |
142 |
/**
|
176 |
|
* Created and registers footnotes in the FootnoteManager and returns the
|
177 |
|
* footnote keys as markup.
|
178 |
|
*
|
179 |
|
* The following cdm cdm classes are annotatable:
|
180 |
|
*
|
181 |
|
* - DescriptionElementBase
|
182 |
|
* - EventBase
|
183 |
|
* - HomotypicalGroup
|
184 |
|
* - IdentifiableEntity
|
185 |
|
* - DescriptionBase
|
186 |
|
* - IdentifiableMediaEntity
|
187 |
|
* - Media
|
188 |
|
* - Sequence
|
189 |
|
* - TaxonBase
|
190 |
|
* - TaxonName
|
191 |
|
* - TaxonomicTree
|
192 |
|
* - TermBase
|
193 |
|
* - LanguageStringBase
|
194 |
|
* - ReferencedEntityBase
|
195 |
|
* - NomenclaturalStatus
|
196 |
|
* - OriginalSourceBase
|
197 |
|
* - RelationshipBase
|
198 |
|
* - TypeDesignationBase
|
199 |
|
* - TaxonNode
|
200 |
|
* - WorkingSet
|
201 |
|
*
|
202 |
|
* @param array $cdm_entities
|
203 |
|
* An array of CdmBase instances.
|
204 |
|
* @param $footnote_list_key_suggestion string
|
205 |
|
* optional parameter. If this parameter is left empty (null, 0, "") the
|
206 |
|
* footnote key will be determined be set to
|
207 |
|
* RenderHints::getFootnoteListKey().FOOTNOTE_KEY_SUFFIX_ANNOTATIONS otherwise the supplied
|
208 |
|
* key will be used.
|
209 |
|
*
|
210 |
|
* @return string
|
211 |
|
* The markup.
|
212 |
|
* @deprecated unused, needs to be removed
|
213 |
|
*/
|
214 |
|
function render_entities_annotations_as_footnote_keys(array $cdm_entities, $footnote_list_key =null){
|
215 |
|
|
216 |
|
// check if footnotes for annotations are disabled completely
|
217 |
|
if (variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
|
218 |
|
return '';
|
219 |
|
}
|
220 |
|
$markup = '';
|
221 |
|
$footNoteKeys = cdm_entities_annotations_footnote_keys($cdm_entities, $footnote_list_key);
|
222 |
|
foreach ($footNoteKeys as $a) {
|
223 |
|
$markup .= render_footnote_key($a, ($markup ? ',' : ''));
|
224 |
|
}
|
225 |
|
return $markup;
|
226 |
|
}
|
227 |
|
|
228 |
|
/**
|
229 |
143 |
* Creates markup for an array of foot note keys
|
230 |
144 |
*
|
231 |
145 |
* @param array $footnote_keys
|
... | ... | |
247 |
161 |
}
|
248 |
162 |
|
249 |
163 |
/**
|
250 |
|
* Create markup for the footnotes mapped to the $footnoteListKey.
|
251 |
|
*
|
252 |
|
* @param null $footnote_list_key
|
253 |
|
* The footnote list key, see RenderHints::getFootnoteListKey()
|
254 |
|
* @param $element_tag
|
255 |
|
* The tag for the footnote element
|
256 |
|
*
|
257 |
|
* @return string
|
258 |
|
*/
|
259 |
|
function render_annotation_footnotes($footnote_list_key = null, $element_tag = 'span') {
|
260 |
|
if (variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
|
261 |
|
return '';
|
262 |
|
}
|
263 |
|
return render_footnotes($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS, $element_tag);
|
264 |
|
}
|
265 |
|
|
266 |
|
/**
|
267 |
164 |
* Creates markup for a foot note key
|
268 |
165 |
*
|
269 |
166 |
* @param null $footnoteKey
|
... | ... | |
336 |
233 |
return $out;
|
337 |
234 |
}
|
338 |
235 |
|
339 |
|
/**
|
340 |
|
* Renders the footnotes for annotations and sources, etc.
|
341 |
|
*
|
342 |
|
* @param string $footnote_list_key
|
343 |
|
* RenderHints::getFootnoteListKey() will be used if this parameter is undefined.
|
344 |
|
* @param string $enclosingTag
|
345 |
|
* Default tag is 'span'
|
346 |
|
*
|
347 |
|
* @return string
|
348 |
|
* The markup string
|
349 |
|
* @deprecated to be replaced by render_footnotes() once FOOTNOTE_KEY_SUFFIX_ANNOTATIONS is no longer used
|
350 |
|
*/
|
351 |
|
function render_footnotes_annotation_and_sources($footnote_list_key = NULL, $enclosingTag = 'span'){
|
352 |
|
|
353 |
|
if (variable_get('cdm_dataportal_all_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES)) {
|
354 |
|
return '';
|
355 |
|
}
|
356 |
|
if(!$footnote_list_key){
|
357 |
|
$footnote_list_key = RenderHints::getFootnoteListKey();
|
358 |
|
}
|
359 |
|
|
360 |
|
$out = '<' . $enclosingTag . ' class="footnotes footnotes-' . $footnote_list_key . ' ">'
|
361 |
|
. FootnoteManager::renderFootnoteList($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS) . ' ' . FootnoteManager::renderFootnoteList($footnote_list_key)
|
362 |
|
. '</' . $enclosingTag . '>';
|
363 |
|
FootnoteManager::removeFootnoteList($footnote_list_key . FOOTNOTE_KEY_SUFFIX_ANNOTATIONS);
|
364 |
|
FootnoteManager::removeFootnoteList($footnote_list_key);
|
365 |
|
return $out;
|
366 |
|
}
|
ref #8543 complete removal of annotation footnote code, also removing deprecated methods