CMS  Version 3.9
GlossaryManager Class Reference

Provides a central management class for event handlers and common functionality for the glossary component. More...

Public Member Functions

 GlossaryManager ()
 

Static Public Member Functions

static setDefaults ()
 
static glossarizeContent ()
 
static upgradeComponent ($version)
 

Detailed Description

Provides a central management class for event handlers and common functionality for the glossary component.

Definition at line 13 of file glossary_manager.inc.

Member Function Documentation

◆ glossarizeContent()

static GlossaryManager::glossarizeContent ( )
static

Definition at line 31 of file glossary_manager.inc.

32  {
33  global $script;
34 
35  if (!Settings::getValue("glossary", "glossarize_terms")) return;
36 
37  $container = Settings::getValue("glossary", "container_element");
38  $targets = Settings::getValue("glossary", "target_elements");
39  $onlyFirst = Settings::getValue("glossary", "only_first_match") ? "true" : "false";
40  $tooltipClass = Settings::getValue("glossary", "tooltip_class");
41  $termClass = Settings::getValue("glossary", "term_class");
42  $excludeClass = Settings::getValue("glossary", "exclude_class");
43 
44  $script .= <<<ENDSCRIPT
45 <script>
46 window.addEvent('domready', function()
47 {
48  new Glossarizer('{$container}', '/action/glossary/glossary_list',
49  {
50  selector: '{$targets}',
51  firstOnly: {$onlyFirst},
52  termClass: '{$termClass}',
53  tooltipClass: '{$tooltipClass}',
54  excludeClass: '{$excludeClass}'
55  });
56 });
57 </script>
58 ENDSCRIPT;
59  }
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104

◆ GlossaryManager()

GlossaryManager::GlossaryManager ( )

Definition at line 15 of file glossary_manager.inc.

16  {
17 
18  }

◆ setDefaults()

static GlossaryManager::setDefaults ( )
static

Definition at line 20 of file glossary_manager.inc.

21  {
22  Settings::setDefaultValue("glossary", "glossarize_terms", false, "Boolean", "Adds definition tooltips to matching terms within page content", null, null, 1);
23  Settings::setDefaultValue("glossary", "container_element", "body", "String", "DOM ID of the element to substitute within.", null, null, 2);
24  Settings::setDefaultValue("glossary", "target_elements", "p,div,li", "String", "CSS Selector for the elements for which content can be glossarized", null, null, 3);
25  Settings::setDefaultValue("glossary", "only_first_match", true, "Boolean", "Only attach the tooltip to the first matching term within the content area", null, null, 4);
26  Settings::setDefaultValue("glossary", "tooltip_class", "glossary_tooltip", "String", "CSS class to use for the generated tooltips", null, null, 5);
27  Settings::setDefaultValue("glossary", "term_class", "glossary_term", "String", "CSS class to use to wrap glossarized terms", null, null, 6);
28  Settings::setDefaultValue("glossary", "exclude_class", "no_glossarize", "String", "CSS class used to indicate not to glossarize a page or element", null, null, 7);
29  }
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
Definition: settings.inc:174

◆ upgradeComponent()

static GlossaryManager::upgradeComponent (   $version)
static

Definition at line 61 of file glossary_manager.inc.

62  {
64  $mgr->upgrade($version);
65  }

The documentation for this class was generated from the following file: