60 public function __construct(
string $a_title =
"",
string $a_postvar =
"")
72 if (isset($this->hooks[$key])) {
73 return $this->hooks[
$key];
81 $this->hooks[
$key] = $options;
86 if (isset($this->hooks[$key])) {
87 unset($this->hooks[$key]);
99 $this->input_options[$input->
getPostVar()] = $options;
123 bool $a_sortable =
false,
124 bool $a_addremove =
true 126 $this->multi = $a_multi;
127 $this->multi_sortable = $a_sortable;
137 foreach ($this->inputs as
$key => $item) {
138 if (array_key_exists(
$key, $value)) {
140 $item->setChecked((
bool) $value[
$key]);
149 $item->setValue($value[
$key]);
162 foreach ($this->inputs as
$key => $item) {
176 $this->line_values =
$data;
195 foreach ($value as $item_num => $item) {
196 foreach ($this->inputs as $input_key => $input) {
197 if (isset($item[$input_key])) {
201 $out_array[$item_num][$input_key] =
$out;
204 $this->
setAlert($this->
lng->txt(
"form_msg_wrong_date"));
205 $out_array[$item_num][$input_key] = null;
215 $this->
setAlert($lng->txt(
"msg_input_is_required"));
224 if (isset($this->cust_attr[$key]) && !$override) {
249 public function render(
int $iterator_id = 0,
bool $clean_render =
false): string
251 $tpl =
new ilTemplate(
"tpl.prop_generic_multi_line.html",
true,
true,
'Modules/DataCollection');
253 $class =
'multi_input_line';
257 $tpl->setCurrentBlock(
'cust_attr');
258 $tpl->setVariable(
'CUSTOM_ATTR_KEY',
$key);
259 $tpl->setVariable(
'CUSTOM_ATTR_VALUE', $value);
260 $tpl->parseCurrentBlock();
265 foreach ($inputs as
$key => $input) {
266 $input = clone $input;
267 if (!method_exists($input,
'render')) {
269 "Method " . get_class($input)
270 .
"::render() does not exists! You cannot use this input-type in ilMultiLineInputGUI" 274 $is_disabled_hook = $this->
getHook(self::HOOK_IS_INPUT_DISABLED);
275 if ($is_disabled_hook !==
false && !$clean_render) {
276 $input->setDisabled($is_disabled_hook($this->
getValue()));
280 $input->setDisabled(
true);
283 if ($iterator_id == 0 && !isset($this->post_var_cache[
$key])) {
284 $this->post_var_cache[
$key] = $input->getPostVar();
287 $input->setPostVar($this->post_var_cache[$key]);
291 $input->setPostVar($post_var);
293 $before_render_hook = $this->
getHook(self::HOOK_BEFORE_INPUT_RENDER);
294 if ($before_render_hook !==
false && !$clean_render) {
295 $input = $before_render_hook($this->
getValue(), $key, $input);
301 $tpl->setCurrentBlock(
'input_label');
302 $tpl->setVariable(
'LABEL', $input->getTitle());
304 $tpl->setCurrentBlock(
'input');
306 $tpl->setVariable(
'CONTENT', $input->render());
307 $tpl->parseCurrentBlock();
314 $is_removeable_hook = $this->
getHook(self::HOOK_IS_LINE_REMOVABLE);
315 if ($is_removeable_hook !==
false && !$clean_render) {
316 $show_remove = $is_removeable_hook($this->
getValue());
320 $tpl->setCurrentBlock(
'multi_icons');
322 $tpl->setVariable(
'IMAGE_MINUS', $image_minus);
323 if ($this->multi_sortable) {
327 $tpl->parseCurrentBlock();
340 $output .= $this->
render(0,
true);
342 if ($this->
getMulti() && is_array($this->line_values) && count($this->line_values) > 0) {
344 foreach ($this->line_values as
$i =>
$data) {
346 $object->setValue(
$data);
347 $output .= $object->render(
$i);
351 $output .= $this->
render(1,
true);
355 $output =
'<div id="' . $this->
getFieldId() .
'" class="multi_line_input">' . $output .
'</div>';
356 $this->global_tpl->addJavaScript(
'Modules/DataCollection/js/generic_multi_line_input.js');
358 $element_config = json_encode($this->input_options);
359 $options = json_encode([
'limit' => $this->limit,
360 'sortable' => $this->multi_sortable,
361 'locale' => $this->
lng->getLangKey()]);
362 $this->global_tpl->addOnLoadCode(
"il.DataCollection.genericMultiLineInit('$id',$element_config,$options);");
385 $html = $this->
render(
"toolbar");
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static get(string $a_glyph, string $a_text="")
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static parseIncomingDate($a_value, bool $a_add_time=false)
Try to parse incoming value to date object.