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