5require_once(
'Services/UIComponent/CharSelector/classes/ilCharSelectorConfig.php');
33 'ilAssQuestionFeedbackEditingGUI',
34 'ilAssQuestionHintGUI',
35 'ilObjTestSettingsGeneralGUI',
63 $this->lng =
$DIC->language();
64 $this->ctrl =
$DIC->ctrl();
65 $this->tpl =
$DIC[
"tpl"];
81 foreach (
$ilCtrl->getCallHistory() as $call) {
82 if ($call[
'mode'] ==
'execComm') {
83 $class = $call[
'class'];
88 while ($class !=
false) {
89 if (in_array($class, self::$allowed_guis)) {
92 $class = get_parent_class($class);
107 if (!isset(self::$current_gui)) {
120 $this->config = $a_config;
139 $lng->loadLanguageModule(
'adve');
141 require_once(
'Services/UIComponent/CharSelector/classes/class.ilCharSelectorRadioGroupInputGUI.php');
144 $inactive->setInfo(
$lng->txt(
'char_selector_inactive_info_' . $this->config->getContext()));
146 $inherit->setInfo(
$lng->txt(
'char_selector_inherit_info_' . $this->config->getContext()));
148 $enabled->setInfo(
$lng->txt(
'char_selector_enabled_info_' . $this->config->getContext()));
150 $disabled->setInfo(
$lng->txt(
'char_selector_disabled_info_' . $this->config->getContext()));
153 $blocks->setInfo(
$lng->txt(
'char_selector_blocks_info'));
154 $blocks->setOptions($this->config->getBlockOptions());
155 $blocks->setMulti(
true);
156 $enabled->addSubItem($blocks);
158 $custom_items =
new ilTextAreaInputGUI(
$lng->txt(
'char_selector_custom_items'),
'char_selector_custom_items');
159 $tpl =
new ilTemplate(
"tpl.char_selector_custom_info.html",
true,
true,
"Services/UIComponent/CharSelector");
160 $tpl->setVariable(
'1',
$lng->txt(
'char_selector_custom_items_info1'));
161 $tpl->setVariable(
'2a',
$lng->txt(
'char_selector_custom_items_info2a'));
162 $tpl->setVariable(
'2b',
$lng->txt(
'char_selector_custom_items_info2b'));
163 $tpl->setVariable(
'3a',
$lng->txt(
'char_selector_custom_items_info3a'));
164 $tpl->setVariable(
'3b',
$lng->txt(
'char_selector_custom_items_info3b'));
165 $tpl->setVariable(
'4a',
$lng->txt(
'char_selector_custom_items_info4a'));
166 $tpl->setVariable(
'4b',
$lng->txt(
'char_selector_custom_items_info4b'));
167 $tpl->setVariable(
'5a',
$lng->txt(
'char_selector_custom_items_info5a'));
168 $tpl->setVariable(
'5b',
$lng->txt(
'char_selector_custom_items_info5b'));
169 $tpl->setVariable(
'6a',
$lng->txt(
'char_selector_custom_items_info6a'));
170 $tpl->setVariable(
'6b',
$lng->txt(
'char_selector_custom_items_info6b'));
171 $custom_items->setInfo(
$tpl->get());
172 $enabled->addSubItem($custom_items);
174 switch ($this->config->getContext()) {
176 $availability->addOption($inactive);
177 $availability->addOption($enabled);
178 $availability->addOption($disabled);
179 $a_form->
addItem($availability);
184 $availability->addOption($inherit);
185 $availability->addOption($enabled);
186 $availability->addOption($disabled);
187 $a_form->
addItem($availability);
200 $a_form->
getItemByPostVar(
'char_selector_availability')->setValue($this->config->getAvailability());
201 $a_form->
getItemByPostVar(
'char_selector_blocks')->setValue($this->config->getAddedBlocks());
202 $a_form->
getItemByPostVar(
'char_selector_custom_items')->setValue($this->config->getCustomItems());
213 $this->config->setAvailability($a_form->
getInput(
'char_selector_availability'));
214 $this->config->setAddedBlocks($a_form->
getInput(
'char_selector_blocks'));
215 $this->config->setCustomItems($a_form->
getInput(
'char_selector_custom_items'));
230 if ($this->added_to_page) {
234 $lng->loadLanguageModule(
'adve');
237 $this->jsconfig =
new stdClass();
238 $this->jsconfig->pages = $this->config->getCharPages();
239 $this->jsconfig->ajax_url =
$ilCtrl->getLinkTargetByClass(
"ilcharselectorgui",
"saveState",
"",
true);
240 $this->jsconfig->open = (int)
$_SESSION[
'char_selector_open'];
241 $this->jsconfig->current_page = (int)
$_SESSION[
'char_selector_current_page'];
242 $this->jsconfig->current_subpage = (int)
$_SESSION[
'char_selector_current_subpage'];
245 $this->jstexts =
new stdClass();
246 $this->jstexts->page =
$lng->txt(
'page');
248 $this->jstexts->open =
$lng->txt(
'char_selector_menu_open');
249 $this->jstexts->close =
$lng->txt(
'char_selector_menu_close');
257 $tpl->addJavascript(
'./Services/UIComponent/CharSelector/js/ilCharSelector.js');
259 $tpl->addOnLoadCode(
'il.CharSelector.init(' . json_encode($this->jsconfig) .
',' . json_encode($this->jstexts) .
')');
260 $this->added_to_page =
true;
270 $tpl =
new ilTemplate(
"tpl.char_selector_panel.html",
true,
true,
"Services/UIComponent/CharSelector");
272 if (count($this->jsconfig->pages) > 1) {
274 foreach ($this->jsconfig->pages as $page) {
275 $tpl->setCurrentBlock(
'page_option');
277 $tpl->setVariable(
"PAGE_NAME", $page[0]);
278 $tpl->parseCurrentBlock();
283 $tpl->setVariable(
'TXT_PREVIOUS_PAGE',
$lng->txt(
'previous'));
284 $tpl->setVariable(
'TXT_NEXT_PAGE',
$lng->txt(
'next'));
285 $tpl->setVariable(
'TXT_PAGE',
$lng->txt(
'page'));
287 $tpl->touchBlock(
'chars');
288 return '<script type="text/html" id="ilCharSelectorTemplate">' .
$tpl->get() .
'</script>';
300 $_SESSION[
'char_selector_current_page'] = (int)
$_GET[
'current_page'];
301 $_SESSION[
'char_selector_current_subpage'] = (int)
$_GET[
'current_subpage'];
304 echo json_encode(array(
305 'open' =>
$_SESSION[
'char_selector_open'],
306 'current_page' =>
$_SESSION[
'char_selector_current_page'],
307 'current_subpage' =>
$_SESSION[
'char_selector_current_subpage'],
318 $cmd =
$ilCtrl->getCmd(
"saveState");
An exception for terminatinating execution or to throw for unit testing.
const INACTIVE
Availabilities INACTIVE/INHERIT corresponds to an unconfigured selector (no database entries)
static _getCurrentConfig(ilObjTest $a_test_obj=null)
Get the configuration that should be used for the current selector.
const CONTEXT_NONE
Configuration contexts.
This shows a character selector.
getConfig()
Get the configuraton object.
static $current_gui
ilCharSelectorGUI instance used for the current selector
executeCommand()
execute command
__construct($a_context=ilCharSelectorConfig::CONTEXT_NONE)
Constructor.
addToPage()
Adds the the character selector to the ilias page Initializes the selector according to the state sav...
static _isAllowed()
Check if the CharSelector is allowed for the current GUI.
static $allowed_guis
list of command classes for which the char selector is allowed (can also be a parent class of the act...
saveState()
Save the selector panel state in the user session (This keeps the panel state between page moves)
getSelectorHTML()
Get the HTML code of the selector panel.
getFormValues(ilPropertyFormGUI $a_form)
Set the configuration based on the values of a property form.
addFormProperties(ilPropertyFormGUI $a_form)
add the configuration elements to a property form
setConfig(ilCharSelectorConfig $a_config)
Set the configuraton object.
static _getCurrentGUI(ilObjTest $a_test_obj=null)
Get the GUI that is used for the currently available selector (other GUI instances may exist for conf...
setFormValues(ilPropertyFormGUI $a_form)
Set the values in a property form based on the configuration.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user