2 require_once(
"./Services/Form/classes/class.ilFormPropertyGUI.php");
108 parent::__construct($a_title, $a_postvar);
119 if (isset($this->hooks[
$key])) {
120 return $this->hooks[
$key];
143 if (isset($this->hooks[
$key])) {
144 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]);
215 } elseif (method_exists($item,
'setValue')) {
216 $item->setValue($a_value[
$key]);
219 $this->value = $a_value;
231 foreach ($this->inputs as
$key => $item) {
248 $this->line_values =
$data;
267 $out_array =
array();
269 foreach ($this->inputs as $input_key => $input) {
270 if (isset($item[$input_key])) {
271 $out_array[$item_num][$input_key] = (is_string($item[$input_key])) ?
ilUtil::stripSlashes($item[$input_key]) : $item[$input_key];
282 foreach ($this->inputs as $input_key =>
$inputs) {
283 foreach ($out_array as $subitem) {
292 $this->
setAlert($lng->txt(
"msg_input_is_required"));
308 if (isset($this->cust_attr[
$key]) && !$override) {
349 public function render($iterator_id = 0, $clean_render =
false)
351 $tpl =
new ilTemplate(
"tpl.prop_generic_multi_line.html",
true,
true,
'Modules/DataCollection');
353 $class =
'multi_input_line';
357 $tpl->setCurrentBlock(
'cust_attr');
358 $tpl->setVariable(
'CUSTOM_ATTR_KEY',
$key);
359 $tpl->setVariable(
'CUSTOM_ATTR_VALUE',
$value);
360 $tpl->parseCurrentBlock();
366 $input = clone $input;
367 if (!method_exists($input,
'render')) {
368 throw new ilException(
"Method " . get_class($input)
369 .
"::render() does not exists! You cannot use this input-type in ilMultiLineInputGUI");
372 $is_disabled_hook = $this->
getHook(self::HOOK_IS_INPUT_DISABLED);
373 if ($is_disabled_hook !==
false && !$clean_render) {
374 $input->setDisabled($is_disabled_hook($this->
getValue()));
378 $input->setDisabled(
true);
381 if ($iterator_id == 0 && !isset($this->post_var_cache[
$key])) {
382 $this->post_var_cache[
$key] = $input->getPostVar();
385 $input->setPostVar($this->post_var_cache[$key]);
389 $input->setPostVar($post_var);
391 $before_render_hook = $this->
getHook(self::HOOK_BEFORE_INPUT_RENDER);
392 if ($before_render_hook !==
false && !$clean_render) {
393 $input = $before_render_hook($this->
getValue(), $key, $input);
399 $tpl->setCurrentBlock(
'input_label');
400 $tpl->setVariable(
'LABEL', $input->getTitle());
401 $tpl->setVariable(
'CONTENT', $input->render());
402 $tpl->parseCurrentBlock();
404 $tpl->setCurrentBlock(
'input');
405 $tpl->setVariable(
'CONTENT', $input->render());
406 $tpl->parseCurrentBlock();
414 $is_removeable_hook = $this->
getHook(self::HOOK_IS_LINE_REMOVABLE);
415 if ($is_removeable_hook !==
false && !$clean_render) {
416 $show_remove = $is_removeable_hook($this->
getValue());
420 $tpl->setCurrentBlock(
'multi_icons');
422 $tpl->setVariable(
'IMAGE_MINUS', $image_minus);
423 if ($this->multi_sortable) {
427 $tpl->parseCurrentBlock();
449 if ($this->
getMulti() && is_array($this->line_values) && count($this->line_values) > 0) {
451 foreach ($this->line_values as
$i =>
$data) {
453 $object->setValue(
$data);
463 $tpl->addJavascript(
'Modules/DataCollection/js/generic_multi_line_input.js');
464 $output .=
'<script type="text/javascript">$("#' . $this->
getFieldId() .
'").multi_line_input(' 465 . json_encode($this->input_options) .
', ' 466 . json_encode(
array(
'limit' => $this->limit,
'sortable' => $this->multi_sortable,
'locale' => $DIC->language()->getLangKey()))
470 $a_tpl->setCurrentBlock(
"prop_generic");
471 $a_tpl->setVariable(
"PROP_GENERIC",
$output);
472 $a_tpl->parseCurrentBlock();
static get($a_glyph, $a_text="")
Get glyph html.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
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
Create styles array
The data for the language used.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options