29 'basic_latin' =>
array(
'Basic Latin',
'0020',
'007F'),
30 'latin_1_supplement' =>
array(
'Latin-1 Supplement',
'00A0',
'00FF'),
31 'latin_extended_a' =>
array(
'Latin Extended-A',
'0100',
'017F'),
32 'latin_extended_b' =>
array(
'Latin Extended-B',
'0180',
'024F'),
33 'ipa_extensions' =>
array(
'IPA Extensions',
'0250',
'02AF'),
34 'spacing_modifier_letters' =>
array(
'Spacing Modifier Letters',
'02B0',
'02FF'),
35 'combining_diacritical_marks' =>
array(
'Combining Diacritical Marks',
'0300',
'036F'),
36 'greek_and_coptic' =>
array(
'Greek and Coptic',
'0370',
'03FF'),
37 'cyrillic' =>
array(
'Cyrillic',
'0400',
'04FF'),
38 'cyrillic_supplement' =>
array(
'Cyrillic Supplement',
'0500',
'052F'),
39 'armenian' =>
array(
'Armenian',
'0530',
'058F'),
40 'hebrew' =>
array(
'Hebrew',
'0590',
'05FF'),
41 'arabic' =>
array(
'Arabic',
'0600',
'06FF'),
42 'syriac' =>
array(
'Syriac',
'0700',
'074F'),
43 'arabic_supplement' =>
array(
'Arabic Supplement',
'0750',
'077F'),
44 'thaana' =>
array(
'Thaana',
'0780',
'07BF'),
45 'nko' =>
array(
'NKo',
'07C0',
'07FF'),
46 'samaritan' =>
array(
'Samaritan',
'0800',
'083F'),
47 'mandaic' =>
array(
'Mandaic',
'0840',
'085F'),
48 'arabic_extended_a' =>
array(
'Arabic Extended-A',
'08A0',
'08FF'),
49 'devanagari' =>
array(
'Devanagari',
'0900',
'097F'),
50 'bengali' =>
array(
'Bengali',
'0980',
'09FF'),
51 'gurmukhi' =>
array(
'Gurmukhi',
'0A00',
'0A7F'),
52 'gujarati' =>
array(
'Gujarati',
'0A80',
'0AFF'),
53 'oriya' =>
array(
'Oriya',
'0B00',
'0B7F'),
54 'tamil' =>
array(
'Tamil',
'0B80',
'0BFF'),
55 'telugu' =>
array(
'Telugu',
'0C00',
'0C7F'),
56 'kannada' =>
array(
'Kannada',
'0C80',
'0CFF'),
57 'malayalam' =>
array(
'Malayalam',
'0D00',
'0D7F'),
58 'sinhala' =>
array(
'Sinhala',
'0D80',
'0DFF'),
59 'thai' =>
array(
'Thai',
'0E00',
'0E7F'),
60 'lao' =>
array(
'Lao',
'0E80',
'0EFF'),
61 'tibetan' =>
array(
'Tibetan',
'0F00',
'0FFF'),
62 'myanmar' =>
array(
'Myanmar',
'1000',
'109F'),
63 'georgian' =>
array(
'Georgian',
'10A0',
'10FF'),
64 'hangul_jamo' =>
array(
'Hangul Jamo',
'1100',
'11FF'),
65 'ethiopic' =>
array(
'Ethiopic',
'1200',
'137F'),
66 'ethiopic_supplement' =>
array(
'Ethiopic Supplement',
'1380',
'139F'),
67 'cherokee' =>
array(
'Cherokee',
'13A0',
'13FF'),
68 'unified_canadian_aboriginal_syllabics' =>
array(
'Unified Canadian Aboriginal Syllabics',
'1400',
'167F'),
69 'ogham' =>
array(
'Ogham',
'1680',
'169F'),
70 'runic' =>
array(
'Runic',
'16A0',
'16FF'),
71 'tagalog' =>
array(
'Tagalog',
'1700',
'171F'),
72 'hanunoo' =>
array(
'Hanunoo',
'1720',
'173F'),
73 'buhid' =>
array(
'Buhid',
'1740',
'175F'),
74 'tagbanwa' =>
array(
'Tagbanwa',
'1760',
'177F'),
75 'khmer' =>
array(
'Khmer',
'1780',
'17FF'),
76 'mongolian' =>
array(
'Mongolian',
'1800',
'18AF'),
77 'unified_canadian_aboriginal_syllabics_extended' =>
array(
'Unified Canadian Aboriginal Syllabics Extended',
'18B0',
'18FF'),
78 'limbu' =>
array(
'Limbu',
'1900',
'194F'),
79 'tai_le' =>
array(
'Tai Le',
'1950',
'197F'),
80 'new_tai_lue' =>
array(
'New Tai Lue',
'1980',
'19DF'),
81 'khmer_symbols' =>
array(
'Khmer Symbols',
'19E0',
'19FF'),
82 'buginese' =>
array(
'Buginese',
'1A00',
'1A1F'),
83 'tai_tham' =>
array(
'Tai Tham',
'1A20',
'1AAF'),
84 'balinese' =>
array(
'Balinese',
'1B00',
'1B7F'),
85 'sundanese' =>
array(
'Sundanese',
'1B80',
'1BBF'),
86 'batak' =>
array(
'Batak',
'1BC0',
'1BFF'),
87 'lepcha' =>
array(
'Lepcha',
'1C00',
'1C4F'),
88 'ol_chiki' =>
array(
'Ol Chiki',
'1C50',
'1C7F'),
89 'sundanese_supplement' =>
array(
'Sundanese Supplement',
'1CC0',
'1CCF'),
90 'vedic_extensions' =>
array(
'Vedic Extensions',
'1CD0',
'1CFF'),
91 'phonetic_extensions' =>
array(
'Phonetic Extensions',
'1D00',
'1D7F'),
92 'phonetic_extensions_supplement' =>
array(
'Phonetic Extensions Supplement',
'1D80',
'1DBF'),
93 'combining_diacritical_marks_supplement' =>
array(
'Combining Diacritical Marks Supplement',
'1DC0',
'1DFF'),
94 'latin_extended_additional' =>
array(
'Latin Extended Additional',
'1E00',
'1EFF'),
95 'greek_extended' =>
array(
'Greek Extended',
'1F00',
'1FFF'),
96 'general_punctuation' =>
array(
'General Punctuation',
'2000',
'206F'),
97 'superscripts_and_subscripts' =>
array(
'Superscripts and Subscripts',
'2070',
'209F'),
98 'currency_symbols' =>
array(
'Currency Symbols',
'20A0',
'20CF'),
99 'combining_diacritical_marks_for_symbols' =>
array(
'Combining Diacritical Marks for Symbols',
'20D0',
'20FF'),
100 'letterlike_symbols' =>
array(
'Letterlike Symbols',
'2100',
'214F'),
101 'number_forms' =>
array(
'Number Forms',
'2150',
'218F'),
102 'arrows' =>
array(
'Arrows',
'2190',
'21FF'),
103 'mathematical_operators' =>
array(
'Mathematical Operators',
'2200',
'22FF'),
104 'miscellaneous_technical' =>
array(
'Miscellaneous Technical',
'2300',
'23FF'),
105 'control_pictures' =>
array(
'Control Pictures',
'2400',
'243F'),
106 'optical_character_recognition' =>
array(
'Optical Character Recognition',
'2440',
'245F'),
107 'enclosed_alphanumerics' =>
array(
'Enclosed Alphanumerics',
'2460',
'24FF'),
108 'box_drawing' =>
array(
'Box Drawing',
'2500',
'257F'),
109 'block_elements' =>
array(
'Block Elements',
'2580',
'259F'),
110 'geometric_shapes' =>
array(
'Geometric Shapes',
'25A0',
'25FF'),
111 'miscellaneous_symbols' =>
array(
'Miscellaneous Symbols',
'2600',
'26FF'),
112 'dingbats' =>
array(
'Dingbats',
'2700',
'27BF'),
113 'miscellaneous_mathematical_symbols_a' =>
array(
'Miscellaneous Mathematical Symbols-A',
'27C0',
'27EF'),
114 'supplemental_arrows_a' =>
array(
'Supplemental Arrows-A',
'27F0',
'27FF'),
115 'braille_patterns' =>
array(
'Braille Patterns',
'2800',
'28FF'),
116 'supplemental_arrows_b' =>
array(
'Supplemental Arrows-B',
'2900',
'297F'),
117 'miscellaneous_mathematical_symbols_b' =>
array(
'Miscellaneous Mathematical Symbols-B',
'2980',
'29FF'),
118 'supplemental_mathematical_operators' =>
array(
'Supplemental Mathematical Operators',
'2A00',
'2AFF'),
119 'miscellaneous_symbols_and_arrows' =>
array(
'Miscellaneous Symbols and Arrows',
'2B00',
'2BFF'),
120 'glagolitic' =>
array(
'Glagolitic',
'2C00',
'2C5F'),
121 'latin_extended_c' =>
array(
'Latin Extended-C',
'2C60',
'2C7F'),
122 'coptic' =>
array(
'Coptic',
'2C80',
'2CFF'),
123 'georgian_supplement' =>
array(
'Georgian Supplement',
'2D00',
'2D2F'),
124 'tifinagh' =>
array(
'Tifinagh',
'2D30',
'2D7F'),
125 'ethiopic_extended' =>
array(
'Ethiopic Extended',
'2D80',
'2DDF'),
126 'cyrillic_extended_a' =>
array(
'Cyrillic Extended-A',
'2DE0',
'2DFF'),
127 'supplemental_punctuation' =>
array(
'Supplemental Punctuation',
'2E00',
'2E7F'),
128 'cjk_radicals_supplement' =>
array(
'CJK Radicals Supplement',
'2E80',
'2EFF'),
129 'kangxi_radicals' =>
array(
'Kangxi Radicals',
'2F00',
'2FDF'),
130 'ideographic_description_characters' =>
array(
'Ideographic Description Characters',
'2FF0',
'2FFF'),
131 'cjk_symbols_and_punctuation' =>
array(
'CJK Symbols and Punctuation',
'3000',
'303F'),
132 'hiragana' =>
array(
'Hiragana',
'3040',
'309F'),
133 'katakana' =>
array(
'Katakana',
'30A0',
'30FF'),
134 'bopomofo' =>
array(
'Bopomofo',
'3100',
'312F'),
135 'hangul_compatibility_jamo' =>
array(
'Hangul Compatibility Jamo',
'3130',
'318F'),
136 'kanbun' =>
array(
'Kanbun',
'3190',
'319F'),
137 'bopomofo_extended' =>
array(
'Bopomofo Extended',
'31A0',
'31BF'),
138 'cjk_strokes' =>
array(
'CJK Strokes',
'31C0',
'31EF'),
139 'katakana_phonetic_extensions' =>
array(
'Katakana Phonetic Extensions',
'31F0',
'31FF'),
140 'enclosed_cjk_letters_and_months' =>
array(
'Enclosed CJK Letters and Months',
'3200',
'32FF'),
141 'cjk_compatibility' =>
array(
'CJK Compatibility',
'3300',
'33FF'),
142 'cjk_unified_ideographs_extension_a' =>
array(
'CJK Unified Ideographs Extension A',
'3400',
'4DBF'),
143 'yijing_hexagram_symbols' =>
array(
'Yijing Hexagram Symbols',
'4DC0',
'4DFF'),
144 'cjk_unified_ideographs' =>
array(
'CJK Unified Ideographs',
'4E00',
'9FFF'),
145 'yi_syllables' =>
array(
'Yi Syllables',
'A000',
'A48F'),
146 'yi_radicals' =>
array(
'Yi Radicals',
'A490',
'A4CF'),
147 'lisu' =>
array(
'Lisu',
'A4D0',
'A4FF'),
148 'vai' =>
array(
'Vai',
'A500',
'A63F'),
149 'cyrillic_extended_b' =>
array(
'Cyrillic Extended-B',
'A640',
'A69F'),
150 'bamum' =>
array(
'Bamum',
'A6A0',
'A6FF'),
151 'modifier_tone_letters' =>
array(
'Modifier Tone Letters',
'A700',
'A71F'),
152 'latin_extended_d' =>
array(
'Latin Extended-D',
'A720',
'A7FF'),
153 'syloti_nagri' =>
array(
'Syloti Nagri',
'A800',
'A82F'),
154 'common_indic_number_forms' =>
array(
'Common Indic Number Forms',
'A830',
'A83F'),
155 'phags_pa' =>
array(
'Phags-pa',
'A840',
'A87F'),
156 'saurashtra' =>
array(
'Saurashtra',
'A880',
'A8DF'),
157 'devanagari_extended' =>
array(
'Devanagari Extended',
'A8E0',
'A8FF'),
158 'kayah_li' =>
array(
'Kayah Li',
'A900',
'A92F'),
159 'rejang' =>
array(
'Rejang',
'A930',
'A95F'),
160 'hangul_jamo_extended_a' =>
array(
'Hangul Jamo Extended-A',
'A960',
'A97F'),
161 'javanese' =>
array(
'Javanese',
'A980',
'A9DF'),
162 'cham' =>
array(
'Cham',
'AA00',
'AA5F'),
163 'myanmar_extended_a' =>
array(
'Myanmar Extended-A',
'AA60',
'AA7F'),
164 'tai_viet' =>
array(
'Tai Viet',
'AA80',
'AADF'),
165 'meetei_mayek_extensions' =>
array(
'Meetei Mayek Extensions',
'AAE0',
'AAFF'),
166 'ethiopic_extended_a' =>
array(
'Ethiopic Extended-A',
'AB00',
'AB2F'),
167 'meetei_mayek' =>
array(
'Meetei Mayek',
'ABC0',
'ABFF'),
168 'hangul_syllables' =>
array(
'Hangul Syllables',
'AC00',
'D7AF'),
169 'hangul_jamo_extended_b' =>
array(
'Hangul Jamo Extended-B',
'D7B0',
'D7FF'),
170 'high_surrogates' =>
array(
'High Surrogates',
'D800',
'DB7F'),
171 'high_private_use_surrogates' =>
array(
'High Private Use Surrogates',
'DB80',
'DBFF'),
172 'low_surrogates' =>
array(
'Low Surrogates',
'DC00',
'DFFF'),
173 'private_use_area' =>
array(
'Private Use Area',
'E000',
'F8FF'),
174 'cjk_compatibility_ideographs' =>
array(
'CJK Compatibility Ideographs',
'F900',
'FAFF'),
175 'alphabetic_presentation_forms' =>
array(
'Alphabetic Presentation Forms',
'FB00',
'FB4F'),
176 'arabic_presentation_forms_a' =>
array(
'Arabic Presentation Forms-A',
'FB50',
'FDFF'),
177 'variation_selectors' =>
array(
'Variation Selectors',
'FE00',
'FE0F'),
178 'vertical_forms' =>
array(
'Vertical Forms',
'FE10',
'FE1F'),
179 'combining_half_marks' =>
array(
'Combining Half Marks',
'FE20',
'FE2F'),
180 'cjk_compatibility_forms' =>
array(
'CJK Compatibility Forms',
'FE30',
'FE4F'),
181 'small_form_variants' =>
array(
'Small Form Variants',
'FE50',
'FE6F'),
182 'arabic_presentation_forms_b' =>
array(
'Arabic Presentation Forms-B',
'FE70',
'FEFF'),
183 'halfwidth_and_fullwidth_forms' =>
array(
'Halfwidth and Fullwidth Forms',
'FF00',
'FFEF'),
184 'specials' =>
array(
'Specials',
'FFF0',
'FFFF'),
288 case self::CONTEXT_ADMIN:
289 case self::CONTEXT_TEST:
290 case self::CONTEXT_USER:
291 $this->context = $a_context;
294 $this->context = self::CONTEXT_NONE;
308 $admin_config =
new self(self::CONTEXT_ADMIN,
true);
309 $admin_config->setAvailability($ilSetting->get(
'char_selector_availability'));
310 $admin_config->setDefinition($ilSetting->get(
'char_selector_definition'));
311 if ($admin_config->getAvailability() == self::INACTIVE)
314 return $admin_config;
318 if (isset($a_test_obj))
320 $test_config =
new self(self::CONTEXT_TEST,
false);
321 $test_config->setAvailability($a_test_obj->getCharSelectorAvailability());
322 $test_config->setDefinition($a_test_obj->getCharSelectorDefinition());
323 if ($test_config->getAvailability() != self::INHERIT)
331 $user_config =
new self(self::CONTEXT_USER,
true);
332 $user_config->setAvailability($ilUser->getPref(
'char_selector_availability'));
333 $user_config->setDefinition($ilUser->getPref(
'char_selector_definition'));
334 if ($user_config->getAvailability() != self::INHERIT)
342 return $admin_config;
364 switch((
int) $a_availability)
370 $this->availability = (int) $a_availability;
373 $this->availability = self::INHERIT;
393 $this->added_blocks =
array();
394 foreach ($a_blocks as $block_name)
396 if ($block_name ==
"all" or 397 in_array($block_name, array_keys(self::$unicode_blocks)))
399 array_push($this->added_blocks, $block_name);
420 $this->custom_items = explode(
' ', $a_items);
430 return implode(
' ', $this->custom_items);
452 $this->added_blocks =
array();
453 $this->custom_items =
array();
456 if (trim($a_definition) ==
'')
458 $a_definition =
"[all]";
462 $items = explode(
' ', $a_definition);
463 foreach ($items as $item)
467 array_push($this->added_blocks, $block_name);
469 else if ($item !=
'')
471 array_push($this->custom_items, trim($item));
483 $definition = implode(
' ', $this->custom_items);
484 foreach($this->added_blocks as $block_name)
486 $definition = $definition .
' [' . $block_name .
']';
488 return trim($definition);
501 '' => $lng->txt(
'please_select'),
502 'all' => $lng->txt(
'char_selector_unicode_all')
504 foreach (array_keys(self::$unicode_blocks) as $block_name)
523 $langvar =
'char_selector_unicode_'. $a_block_name;
524 if ($lng->txt($langvar) !=
'-'.$langvar.
'-' )
526 return $lng->txt($langvar);
530 return self::$unicode_blocks[$a_block_name][0];
542 $a_item = trim($a_item);
544 if (preg_match(
'/^\[(.+)\]$/', $a_item, $matches))
546 $block_name = $matches[1];
547 if ($block_name ==
'all' 548 or in_array($block_name, array_keys(self::$unicode_blocks)))
570 $page =
array($lng->txt(
'char_selector_custom_items'));
571 foreach ($this->custom_items as $item)
573 if (strpos($item,
'-') > 0)
576 $subitems = explode(
'-', $item);
587 if (count($page) > 1)
589 array_push($pages, $page);
594 $blocks = in_array(
'all', $this->added_blocks) ?
595 array_keys(self::$unicode_blocks) :
598 foreach ($blocks as $block_name)
600 $start = hexdec(self::$unicode_blocks[$block_name][1]);
601 $end = hexdec(self::$unicode_blocks[$block_name][2]);
603 array_push($pages, $page);
616 if (preg_match(
'/^[uU]\+[0-9a-fA-F]+$/', $a_item))
618 return (
int) hexdec(substr($a_item, 2));
623 require_once
"include/Unicode/UtfNormalUtil.php";
635 return preg_replace_callback(
636 '/[uU]\+[0-9a-fA-F]+/',
637 array($this,
'getItemParsedCallback'),
649 require_once
"include/Unicode/UtfNormalUtil.php";
getAddedBlocks()
set the added unicode blocks
getItemParsedCallback($matches)
callback for replacement of unicode notations
codepointToUtf8( $codepoint)
Return UTF-8 sequence for a given Unicode code point.
getBlockOptions()
get the options for a block selection
const CONTEXT_NONE
Configuration contexts.
static _getCurrentConfig(ilObjTest $a_test_obj=null)
Get the configuration that should be used for the current selector.
utf8ToCodepoint( $char)
Determine the Unicode codepoint of a single-character UTF-8 sequence.
getItemCodepoint($a_item)
get the unicode index of an item
getAvailability()
get the availability of the selector
setDefinition($a_definition='')
const INACTIVE
Availabilities INACTIVE/INHERIT corresponds to an unconfigured selector (no database entries) ...
setCustomItems($a_items='')
set the custom items
if(!is_array($argv)) $options
extractUnicodeBlock($a_item='')
Extract the unicode block name from a definition item.
Create styles array
The data for the language used.
__construct($a_context=self::CONTEXT_NONE)
Constructor.
getDefinition()
Set the definition of the available characters.
setAvailability($a_availability)
set the availability of the selector
getItemParsed($a_item)
replace unicode notations with their utf8 chars in a string
getBlockTitle($a_block_name)
Get the title of a unicode block for display or selection A translation is used if it exists...
getCharPages()
Get the character pages.
getCustomItems()
set the custom items
getContext()
get the context of the configuration (the context is set at initialisation and can't be changed) ...
setAddedBlocks($a_blocks=array())
set the added unicode blocks