2 require_once(
"./Services/Form/classes/class.ilFormPropertyGUI.php");
107 parent::__construct($a_title, $a_postvar);
118 if (isset($this->hooks[
$key])) {
119 return $this->hooks[
$key];
142 if (isset($this->hooks[
$key])) {
143 unset($this->hooks[$key]);
196 public function setMulti($a_multi, $a_sortable =
false, $a_addremove =
true)
198 $this->multi = $a_multi;
199 $this->multi_sortable = $a_sortable;
210 foreach ($this->inputs as
$key => $item) {
212 $item->setChecked((
bool) $a_value[
$key]);
217 if (method_exists($item,
'setValue')) {
218 $item->setValue($a_value[
$key]);
223 $this->value = $a_value;
235 foreach ($this->inputs as
$key => $item) {
252 $this->line_values =
$data;
271 $out_array = array();
273 foreach ($this->inputs as $input_key => $input) {
274 if (isset($item[$input_key])) {
275 $out_array[$item_num][$input_key] = (is_string($item[$input_key])) ?
ilUtil::stripSlashes($item[$input_key]) : $item[$input_key];
286 foreach ($this->inputs as $input_key =>
$inputs) {
287 foreach ($out_array as $subitem) {
296 $this->
setAlert($lng->txt(
"msg_input_is_required"));
312 if (isset($this->cust_attr[
$key]) && !$override) {
353 public function render($iterator_id = 0, $clean_render =
false)
355 $tpl =
new ilTemplate(
"tpl.prop_generic_multi_line.html",
true,
true,
'Modules/DataCollection');
357 $class =
'multi_input_line';
361 $tpl->setCurrentBlock(
'cust_attr');
362 $tpl->setVariable(
'CUSTOM_ATTR_KEY',
$key);
363 $tpl->setVariable(
'CUSTOM_ATTR_VALUE',
$value);
364 $tpl->parseCurrentBlock();
371 if (!method_exists($input,
'render')) {
373 "Method " . get_class($input)
374 .
"::render() does not exists! You cannot use this input-type in ilMultiLineInputGUI" 378 $is_disabled_hook = $this->
getHook(self::HOOK_IS_INPUT_DISABLED);
379 if ($is_disabled_hook !==
false && !$clean_render) {
380 $input->setDisabled($is_disabled_hook($this->
getValue()));
384 $input->setDisabled(
true);
387 if ($iterator_id == 0 && !isset($this->post_var_cache[
$key])) {
388 $this->post_var_cache[
$key] = $input->getPostVar();
391 $input->setPostVar($this->post_var_cache[$key]);
395 $input->setPostVar($post_var);
397 $before_render_hook = $this->
getHook(self::HOOK_BEFORE_INPUT_RENDER);
398 if ($before_render_hook !==
false && !$clean_render) {
399 $input = $before_render_hook($this->
getValue(), $key, $input);
405 $tpl->setCurrentBlock(
'input_label');
406 $tpl->setVariable(
'LABEL', $input->getTitle());
407 $tpl->setVariable(
'CONTENT', $input->render());
408 $tpl->parseCurrentBlock();
410 $tpl->setCurrentBlock(
'input');
411 $tpl->setVariable(
'CONTENT', $input->render());
412 $tpl->parseCurrentBlock();
420 $is_removeable_hook = $this->
getHook(self::HOOK_IS_LINE_REMOVABLE);
421 if ($is_removeable_hook !==
false && !$clean_render) {
422 $show_remove = $is_removeable_hook($this->
getValue());
426 $tpl->setCurrentBlock(
'multi_icons');
428 $tpl->setVariable(
'IMAGE_MINUS', $image_minus);
429 if ($this->multi_sortable) {
433 $tpl->parseCurrentBlock();
455 if ($this->
getMulti() && is_array($this->line_values) && count($this->line_values) > 0) {
457 foreach ($this->line_values as
$i =>
$data) {
459 $object->setValue(
$data);
469 $tpl->addJavascript(
'Modules/DataCollection/js/generic_multi_line_input.js');
470 $output .=
'<script type="text/javascript">$("#' . $this->
getFieldId() .
'").multi_line_input(' 471 . json_encode($this->input_options) .
', ' 472 . json_encode(array(
'limit' => $this->limit,
'sortable' => $this->multi_sortable,
'locale' => $DIC->language()->getLangKey()))
476 $a_tpl->setCurrentBlock(
"prop_generic");
477 $a_tpl->setVariable(
"PROP_GENERIC",
$output);
478 $a_tpl->parseCurrentBlock();
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled