ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDateDurationInputGUI Class Reference

input GUI for a time span (start and end date) More...

+ Inheritance diagram for ilDateDurationInputGUI:
+ Collaboration diagram for ilDateDurationInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 enableToggleFullTime (string $a_title, bool $a_checked)
 
 enabledToggleFullTime ()
 
 setStart (?ilDateTime $a_date=null)
 Set start date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTime('2008-06-12 08:00:00',IL_CAL_DATETIME));. More...
 
 setStartText (string $a_txt)
 
 getStartText ()
 
 setEndText (string $a_txt)
 
 getEndText ()
 
 getStart ()
 
 setEnd (?ilDateTime $a_date=null)
 Set end date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTime('2008-06-12 08:00:00',IL_CAL_DATETIME));. More...
 
 getEnd ()
 
 setShowTime (bool $a_showtime)
 
 getShowTime ()
 
 setStartYear (int $a_year)
 
 getStartYear ()
 
 setMinuteStepSize (int $a_step_size)
 Set minute step size E.g 5 => The selection will only show 00,05,10... minutes. More...
 
 getMinuteStepSize ()
 Fixed to one minute increments, see https://mantis.ilias.de/view.php?id=42740. More...
 
 setValueByArray (array $a_values)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 render ()
 
 insert (ilTemplate $a_tpl)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getValue ()
 
 setValue ($value)
 Called from table gui with the stored session value Attention: If the user resets the table filter, a boolean false is passed by the table gui. More...
 
 hideSubForm ()
 
 openIntervalsAllowed ()
 
 setAllowOpenIntervals (bool $allowOpenInterval)
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Protected Member Functions

 getDatePickerTimeFormat ()
 
 getDatetimeFormatForInput ()
 
 prepareInvalidInputAsValue (string $invalid_input)
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Protected Attributes

ilObjUser $user
 
ilDateTime $start = null
 
int $startyear = null
 
string $start_text = null
 
string $end_text = null
 
int $minute_step_size = 5
 
ilDateTime $end = null
 
bool $showtime = false
 
bool $toggle_fulltime = false
 
string $toggle_fulltime_txt = ''
 
bool $toggle_fulltime_checked = false
 
bool $allowOpenIntervals = false
 
string $invalid_input_start = ''
 
string $invalid_input_end = ''
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 

Detailed Description

input GUI for a time span (start and end date)

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Deprecated:
12 This component will be removed with ILIAS 12

Definition at line 27 of file class.ilDateDurationInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDateDurationInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

Reimplemented from ilFormPropertyGUI.

Definition at line 45 of file class.ilDateDurationInputGUI.php.

48 {
49 global $DIC;
50
51 $this->lng = $DIC->language();
52 $this->user = $DIC->user();
53 parent::__construct($a_title, $a_postvar);
54 $this->setType("dateduration");
55 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), ilFormPropertyGUI\setType(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilDateDurationInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

Definition at line 207 of file class.ilDateDurationInputGUI.php.

207 : bool
208 {
210
211 if ($this->getDisabled()) {
212 return true;
213 }
214
215 $post = $this->strArray($this->getPostVar());
216
217 $start = $post["start"] ?? '';
218 $end = $post["end"] ?? '';
219
220 // if full day is active, ignore time format
221 $format = isset($post['tgl'])
222 ? 0
223 : $this->getDatePickerTimeFormat();
224
225 // always done to make sure there are no obsolete values left
226 $this->setStart();
227 $this->setEnd();
228
229 $valid_start = false;
230 if (trim($start)) {
231 $parsed = ilCalendarUtil::parseIncomingDate($start, (bool) $format);
232 if ($parsed) {
233 $this->setStart($parsed);
234 $valid_start = true;
235 }
236 } elseif (!$this->getRequired() && !trim($end)) {
237 $valid_start = true;
238 } elseif ($this->openIntervalsAllowed() && !strlen(trim($start))) {
239 $valid_start = true;
240 }
241
242 $valid_end = false;
243 if (trim($end)) {
244 $parsed = ilCalendarUtil::parseIncomingDate($end, (bool) $format);
245 if ($parsed) {
246 $this->setEnd($parsed);
247 $valid_end = true;
248 }
249 } elseif (!$this->getRequired() && !trim($start)) {
250 $valid_end = true;
251 } elseif ($this->openIntervalsAllowed() && !strlen(trim($end))) {
252 $valid_end = true;
253 }
254
255 if ($this->getStartYear()) {
256 if ($valid_start &&
257 $this->getStart()->get(IL_CAL_FKT_DATE, "Y") < $this->getStartYear()) {
258 $valid_start = false;
259 }
260 if ($valid_end &&
261 $this->getEnd()->get(IL_CAL_FKT_DATE, "Y") < $this->getStartYear()) {
262 $valid_end = false;
263 }
264 }
265 $valid = ($valid_start && $valid_end);
266
267 if ($valid &&
268 $this->getStart() &&
269 $this->getEnd() &&
270 ilDateTime::_after($this->getStart(), $this->getEnd())) {
271 $valid = false;
272 }
273
274 if ($this->openIntervalsAllowed()) {
275 $valid = true;
276 } elseif (!$valid) {
277 $this->invalid_input_start = $start;
278 $this->invalid_input_end = $end;
279 $this->setAlert($lng->txt("form_msg_wrong_date"));
280 }
281
282 if ($valid) {
283 $valid = $this->checkSubItemsInput();
284 }
285
286 return $valid;
287 }
const IL_CAL_FKT_DATE
static parseIncomingDate($value, bool $add_time=false)
Try to parse incoming value to date object.
setEnd(?ilDateTime $a_date=null)
Set end date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDat...
setStart(?ilDateTime $a_date=null)
Set start date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilD...
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$valid
$post
Definition: ltitoken.php:46

References $lng, $post, $valid, ilDateTime\_after(), IL_CAL_FKT_DATE, ilCalendarUtil\parseIncomingDate(), and ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ enabledToggleFullTime()

ilDateDurationInputGUI::enabledToggleFullTime ( )

Definition at line 67 of file class.ilDateDurationInputGUI.php.

67 : bool
68 {
70 }

◆ enableToggleFullTime()

ilDateDurationInputGUI::enableToggleFullTime ( string  $a_title,
bool  $a_checked 
)

Definition at line 58 of file class.ilDateDurationInputGUI.php.

61 : void {
62 $this->toggle_fulltime_txt = $a_title;
63 $this->toggle_fulltime_checked = $a_checked;
64 $this->toggle_fulltime = true;
65 }

◆ getDatePickerTimeFormat()

ilDateDurationInputGUI::getDatePickerTimeFormat ( )
protected

Definition at line 312 of file class.ilDateDurationInputGUI.php.

312 : int
313 {
314 return (int) $this->getShowTime();
315 }

◆ getDatetimeFormatForInput()

ilDateDurationInputGUI::getDatetimeFormatForInput ( )
protected

Definition at line 317 of file class.ilDateDurationInputGUI.php.

317 : string
318 {
319 $format = 'Y-m-d';
320 if ($this->getShowTime()) {
321 $format .= '\TH:i';
322 }
323 return $format;
324 }

◆ getEnd()

ilDateDurationInputGUI::getEnd ( )

Definition at line 125 of file class.ilDateDurationInputGUI.php.

125 : ?ilDateTime
126 {
127 return $this->end;
128 }
@classDescription Date and time handling

Referenced by ilCmiXapiDateDurationInputGUI\getEndXapiDateTime(), and ilCmiXapiDateDurationInputGUI\getValue().

+ Here is the caller graph for this function:

◆ getEndText()

ilDateDurationInputGUI::getEndText ( )

Definition at line 101 of file class.ilDateDurationInputGUI.php.

101 : ?string
102 {
103 return $this->end_text;
104 }

◆ getFormLabelFor()

ilDateDurationInputGUI::getFormLabelFor ( )

Get label "for" attribute value for form.

Reimplemented from ilFormPropertyGUI.

Definition at line 517 of file class.ilDateDurationInputGUI.php.

517 : string
518 {
519 return $this->getFieldId() . "[start]";
520 }

◆ getInput()

ilDateDurationInputGUI::getInput ( )

Definition at line 289 of file class.ilDateDurationInputGUI.php.

289 : array
290 {
291 $ret = $this->strArray($this->getPostVar());
292
293 if ($this->openIntervalsAllowed()) {
294 if (!$this->getStart()) {
295 $ret["start"] = null;
296 }
297
298 if (!$this->getEnd()) {
299 $ret["end"] = null;
300 }
301 } elseif (
302 !$this->getStart() ||
303 !$this->getEnd()
304 ) {
305 $ret["start"] = null;
306 $ret["end"] = null;
307 }
308 $ret["fullday"] = (bool) ($ret["tgl"] ?? false);
309 return $ret;
310 }

References ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ getMinuteStepSize()

ilDateDurationInputGUI::getMinuteStepSize ( )

Fixed to one minute increments, see https://mantis.ilias.de/view.php?id=42740.

Definition at line 163 of file class.ilDateDurationInputGUI.php.

163 : int
164 {
165 return 1;
166 }

◆ getShowTime()

ilDateDurationInputGUI::getShowTime ( )

Definition at line 135 of file class.ilDateDurationInputGUI.php.

135 : bool
136 {
137 return $this->showtime;
138 }

◆ getStart()

ilDateDurationInputGUI::getStart ( )

Definition at line 106 of file class.ilDateDurationInputGUI.php.

106 : ?ilDateTime
107 {
108 return $this->start;
109 }

Referenced by ilCmiXapiDateDurationInputGUI\getStartXapiDateTime(), and ilCmiXapiDateDurationInputGUI\getValue().

+ Here is the caller graph for this function:

◆ getStartText()

ilDateDurationInputGUI::getStartText ( )

Definition at line 91 of file class.ilDateDurationInputGUI.php.

91 : ?string
92 {
93 return $this->start_text;
94 }

◆ getStartYear()

ilDateDurationInputGUI::getStartYear ( )

Definition at line 145 of file class.ilDateDurationInputGUI.php.

145 : ?int
146 {
147 return $this->startyear;
148 }

◆ getTableFilterHTML()

ilDateDurationInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Implements ilTableFilterItem.

Definition at line 464 of file class.ilDateDurationInputGUI.php.

464 : string
465 {
466 return $this->render();
467 }

◆ getTableFilterLabelFor()

ilDateDurationInputGUI::getTableFilterLabelFor ( )

Get label "for" attribute value.

Implements ilTableFilterItem.

Definition at line 512 of file class.ilDateDurationInputGUI.php.

512 : string
513 {
514 return $this->getFieldId() . "[start]";
515 }

◆ getValue()

ilDateDurationInputGUI::getValue ( )

Reimplemented in ilCmiXapiDateDurationInputGUI.

Definition at line 469 of file class.ilDateDurationInputGUI.php.

469 : array
470 {
471 return array(
472 'start' => $this->getStart() ? $this->getStart()->get(IL_CAL_UNIX) : null,
473 'end' => $this->getEnd() ? $this->getEnd()->get(IL_CAL_UNIX) : null
474 );
475 }
const IL_CAL_UNIX

References IL_CAL_UNIX.

◆ hideSubForm()

ilDateDurationInputGUI::hideSubForm ( )

Reimplemented from ilFormPropertyGUI.

Definition at line 491 of file class.ilDateDurationInputGUI.php.

491 : bool
492 {
493 if ($this->invalid_input_start ||
494 $this->invalid_input_end) {
495 return false;
496 }
497
498 return ((!$this->getStart() || $this->getStart()->isNull()) &&
499 (!$this->getEnd() || $this->getEnd()->isNull()));
500 }

◆ insert()

ilDateDurationInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 455 of file class.ilDateDurationInputGUI.php.

455 : void
456 {
457 $html = $this->render();
458
459 $a_tpl->setCurrentBlock("prop_generic");
460 $a_tpl->setVariable("PROP_GENERIC", $html);
461 $a_tpl->parseCurrentBlock();
462 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ openIntervalsAllowed()

ilDateDurationInputGUI::openIntervalsAllowed ( )

Definition at line 502 of file class.ilDateDurationInputGUI.php.

502 : bool
503 {
505 }

◆ prepareInvalidInputAsValue()

ilDateDurationInputGUI::prepareInvalidInputAsValue ( string  $invalid_input)
protected

Definition at line 445 of file class.ilDateDurationInputGUI.php.

445 : string
446 {
447 $timestamp = strtotime(htmlspecialchars($invalid_input));
448 if ($timestamp === false) {
449 return '';
450 }
451 return date($this->getDatetimeFormatForInput(), $timestamp);
452 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70

References $timestamp.

◆ render()

ilDateDurationInputGUI::render ( )

Definition at line 326 of file class.ilDateDurationInputGUI.php.

326 : string
327 {
328 $ilUser = $this->user;
330 $toggle_id = null;
331
332 $tpl = new ilTemplate("tpl.prop_datetime_duration.html", true, true, "components/ILIAS/Form");
333
334 if ($this->enabledToggleFullTime()) {
335 $this->setShowTime(true);
336
337 $toggle_id = 't' . md5($this->getPostVar() . '_fulltime'); // :TODO: unique?
338
339 $tpl->setCurrentBlock('toggle_fullday');
340 $tpl->setVariable('DATE_TOGGLE_ID', $this->getPostVar() . '[tgl]');
341 $tpl->setVariable('FULLDAY_TOGGLE_ID', $toggle_id);
342 $tpl->setVariable('FULLDAY_TOGGLE_CHECKED', $this->toggle_fulltime_checked ? 'checked="checked"' : '');
343 $tpl->setVariable('FULLDAY_TOGGLE_DISABLED', $this->getDisabled() ? 'disabled="disabled"' : '');
344 $tpl->setVariable('TXT_TOGGLE_FULLDAY', $this->toggle_fulltime_txt);
345 $tpl->parseCurrentBlock();
346 }
347
348 // config picker
349 if (!$this->getDisabled()) {
350 // :TODO: unique?
351 $picker_start_id = 'p' . md5($this->getPostVar() . '_start');
352 $picker_end_id = 'p' . md5($this->getPostVar() . '_end');
353
354 $tpl->setVariable('DATEPICKER_START_ID', $picker_start_id);
355 $tpl->setVariable('DATEPICKER_END_ID', $picker_end_id);
356
357 $this->global_tpl->addOnLoadCode(
358 'il.Form.initDateDurationPicker("' .
359 $picker_start_id . '","' .
360 $picker_end_id . '","' .
361 $toggle_id .
362 '");'
363 );
364 } else {
365 $tpl->setVariable('DATEPICKER_START_DISABLED', 'disabled="disabled" ');
366 $tpl->setVariable('DATEPICKER_END_DISABLED', 'disabled="disabled" ');
367 }
368
369 $type = 'date';
370 if ($this->getShowTime()) {
371 $type = 'datetime-local';
372 }
373 $tpl->setVariable('DATEPICKER_START_TYPE', $type);
374 $tpl->setVariable('DATEPICKER_END_TYPE', $type);
375
376 $start_txt = $this->getStartText();
377 if ($start_txt === null) {
378 $start_txt = $lng->txt("form_date_duration_start");
379 }
380 if (trim($start_txt)) {
381 $tpl->setVariable('START_LABEL', $start_txt);
382 $tpl->setVariable('START_ARIA_LABEL', ilLegacyFormElementsUtil::prepareFormOutput($start_txt));
383 $tpl->touchBlock('start_width_bl');
384 }
385
386 $end_txt = $this->getEndText();
387 if ($end_txt === null) {
388 $end_txt = $lng->txt("form_date_duration_end");
389 }
390 if (trim($end_txt)) {
391 $tpl->setVariable('END_LABEL', $end_txt);
392 $tpl->setVariable('END_ARIA_LABEL', ilLegacyFormElementsUtil::prepareFormOutput($end_txt));
393 $tpl->touchBlock('end_width_bl');
394 }
395
396
397 $tpl->setVariable('DATE_START_ID', $this->getPostVar() . '[start]');
398 $tpl->setVariable('DATE_END_ID', $this->getPostVar() . '[end]');
399
400 /*
401 * For date input, step is in days, for datetime-local
402 * it is in seconds.
403 */
404 $step_size = 60;
405 if (!$this->getShowTime()) {
406 $step_size = 1;
407 }
408 $tpl->setVariable('DATEPICKER_START_STEP', $step_size);
409 $tpl->setVariable('DATEPICKER_END_STEP', $step_size);
410
411 if ($this->getStartYear()) {
412 $min = DateTimeImmutable::createFromFormat(
413 'Y',
414 (string) $this->getStartYear()
415 )->format($this->getDatetimeFormatForInput());
416 $tpl->setVariable('DATEPICKER_START_MIN', $min);
417 $tpl->setVariable('DATEPICKER_END_MIN', $min);
418 }
419
420 // values
421
422 $out_format = $this->getDatetimeFormatForInput();
423 $date_value = $this->prepareInvalidInputAsValue($this->invalid_input_start);
424 if (!$date_value &&
425 $this->getStart()) {
426 $date_value = $this->getStart()->get(IL_CAL_FKT_DATE, $out_format, $ilUser->getTimeZone());
427 }
428 $tpl->setVariable('DATEPICKER_START_VALUE', $date_value);
429
430 $date_value = $this->prepareInvalidInputAsValue($this->invalid_input_end);
431 if (!$date_value &&
432 $this->getEnd()) {
433 $date_value = $this->getEnd()->get(IL_CAL_FKT_DATE, $out_format, $ilUser->getTimeZone());
434 }
435 $tpl->setVariable('DATEPICKER_END_VALUE', $date_value);
436
437 if ($this->getRequired()) {
438 $tpl->setVariable("START_REQUIRED", "required=\"required\"");
439 $tpl->setVariable("END_REQUIRED", "required=\"required\"");
440 }
441
442 return $tpl->get();
443 }
prepareInvalidInputAsValue(string $invalid_input)
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR

References $lng, IL_CAL_FKT_DATE, and ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ setAllowOpenIntervals()

ilDateDurationInputGUI::setAllowOpenIntervals ( bool  $allowOpenInterval)

Definition at line 507 of file class.ilDateDurationInputGUI.php.

507 : void
508 {
509 $this->allowOpenIntervals = $allowOpenInterval;
510 }

◆ setEnd()

ilDateDurationInputGUI::setEnd ( ?ilDateTime  $a_date = null)

Set end date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTime('2008-06-12 08:00:00',IL_CAL_DATETIME));.

For fullday (no timezone conversion) events use:

            $dt_form->setDate(new ilDate('2008-08-01',IL_CAL_DATE));

Definition at line 120 of file class.ilDateDurationInputGUI.php.

120 : void
121 {
122 $this->end = $a_date;
123 }

Referenced by ILIAS\LegalDocuments\Legacy\ResettingDurationInputGUI\setValueByArray().

+ Here is the caller graph for this function:

◆ setEndText()

ilDateDurationInputGUI::setEndText ( string  $a_txt)

Definition at line 96 of file class.ilDateDurationInputGUI.php.

96 : void
97 {
98 $this->end_text = $a_txt;
99 }

◆ setMinuteStepSize()

ilDateDurationInputGUI::setMinuteStepSize ( int  $a_step_size)

Set minute step size E.g 5 => The selection will only show 00,05,10... minutes.

Parameters
int$a_step_sizeminute step_size 1,5,10,15,20...

Definition at line 155 of file class.ilDateDurationInputGUI.php.

155 : void
156 {
157 $this->minute_step_size = $a_step_size;
158 }

◆ setShowTime()

ilDateDurationInputGUI::setShowTime ( bool  $a_showtime)

Definition at line 130 of file class.ilDateDurationInputGUI.php.

130 : void
131 {
132 $this->showtime = $a_showtime;
133 }

◆ setStart()

ilDateDurationInputGUI::setStart ( ?ilDateTime  $a_date = null)

Set start date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTime('2008-06-12 08:00:00',IL_CAL_DATETIME));.

For fullday (no timezone conversion) events use:

            $dt_form->setDate(new ilDate('2008-08-01',IL_CAL_DATE));

Definition at line 81 of file class.ilDateDurationInputGUI.php.

81 : void
82 {
83 $this->start = $a_date;
84 }

Referenced by ILIAS\LegalDocuments\Legacy\ResettingDurationInputGUI\setValueByArray().

+ Here is the caller graph for this function:

◆ setStartText()

ilDateDurationInputGUI::setStartText ( string  $a_txt)

Definition at line 86 of file class.ilDateDurationInputGUI.php.

86 : void
87 {
88 $this->start_text = $a_txt;
89 }

◆ setStartYear()

ilDateDurationInputGUI::setStartYear ( int  $a_year)

Definition at line 140 of file class.ilDateDurationInputGUI.php.

140 : void
141 {
142 $this->startyear = $a_year;
143 }

◆ setValue()

ilDateDurationInputGUI::setValue (   $value)

Called from table gui with the stored session value Attention: If the user resets the table filter, a boolean false is passed by the table gui.

Parameters
array | bool$value
Exceptions
ilDateTimeException

Definition at line 483 of file class.ilDateDurationInputGUI.php.

483 : void
484 {
485 if (is_array($value)) {
486 $this->setStart(new ilDateTime($value['start'], IL_CAL_UNIX));
487 $this->setEnd(new ilDateTime($value['end'], IL_CAL_UNIX));
488 }
489 }

References IL_CAL_UNIX.

◆ setValueByArray()

ilDateDurationInputGUI::setValueByArray ( array  $a_values)

Reimplemented in ILIAS\LegalDocuments\Legacy\ResettingDurationInputGUI.

Definition at line 168 of file class.ilDateDurationInputGUI.php.

168 : void
169 {
170 $incoming = $a_values[$this->getPostVar()] ?? [];
171 if (is_array($incoming) && $incoming !== []) {
172 $format = isset($incoming['tgl']) ? 0 : $this->getDatePickerTimeFormat();
173 $this->toggle_fulltime_checked = (bool) ($incoming['tgl'] ?? false);
174
175 if ($this->openIntervalsAllowed()) {
176 if (isset($incoming['start']) && is_string($incoming['start']) && trim($incoming['start']) !== '') {
177 $this->setStart(ilCalendarUtil::parseIncomingDate($incoming["start"], (bool) $format));
178 } else {
179 $this->setStart(new ilDate(null, IL_CAL_UNIX));
180 }
181
182 if (isset($incoming['end']) && is_string($incoming['end']) && trim($incoming['end']) !== '') {
183 $this->setEnd(ilCalendarUtil::parseIncomingDate($incoming["end"], (bool) $format));
184 } else {
185 $this->setEnd(new ilDate(null, IL_CAL_UNIX));
186 }
187 } else {
188 # 0033160
189 if ($incoming['start'] instanceof ilDateTime) {
190 $this->setStart($incoming['start']);
191 } else {
192 $this->setStart(ilCalendarUtil::parseIncomingDate((string) $incoming["start"], (bool) $format));
193 }
194 if ($incoming['end'] instanceof ilDateTime) {
195 $this->setEnd($incoming['end']);
196 } else {
197 $this->setEnd(ilCalendarUtil::parseIncomingDate((string) $incoming["end"], (bool) $format));
198 }
199 }
200 }
201
202 foreach ($this->getSubItems() as $item) {
203 $item->setValueByArray($a_values);
204 }
205 }
Class for single dates.

References IL_CAL_UNIX, and ilCalendarUtil\parseIncomingDate().

+ Here is the call graph for this function:

Field Documentation

◆ $allowOpenIntervals

bool ilDateDurationInputGUI::$allowOpenIntervals = false
protected

Definition at line 41 of file class.ilDateDurationInputGUI.php.

◆ $end

ilDateTime ilDateDurationInputGUI::$end = null
protected

Definition at line 36 of file class.ilDateDurationInputGUI.php.

◆ $end_text

string ilDateDurationInputGUI::$end_text = null
protected

Definition at line 34 of file class.ilDateDurationInputGUI.php.

◆ $invalid_input_end

string ilDateDurationInputGUI::$invalid_input_end = ''
protected

Definition at line 43 of file class.ilDateDurationInputGUI.php.

◆ $invalid_input_start

string ilDateDurationInputGUI::$invalid_input_start = ''
protected

Definition at line 42 of file class.ilDateDurationInputGUI.php.

◆ $minute_step_size

int ilDateDurationInputGUI::$minute_step_size = 5
protected

Definition at line 35 of file class.ilDateDurationInputGUI.php.

◆ $showtime

bool ilDateDurationInputGUI::$showtime = false
protected

Definition at line 37 of file class.ilDateDurationInputGUI.php.

◆ $start

ilDateTime ilDateDurationInputGUI::$start = null
protected

Definition at line 31 of file class.ilDateDurationInputGUI.php.

◆ $start_text

string ilDateDurationInputGUI::$start_text = null
protected

Definition at line 33 of file class.ilDateDurationInputGUI.php.

◆ $startyear

int ilDateDurationInputGUI::$startyear = null
protected

Definition at line 32 of file class.ilDateDurationInputGUI.php.

◆ $toggle_fulltime

bool ilDateDurationInputGUI::$toggle_fulltime = false
protected

Definition at line 38 of file class.ilDateDurationInputGUI.php.

◆ $toggle_fulltime_checked

bool ilDateDurationInputGUI::$toggle_fulltime_checked = false
protected

Definition at line 40 of file class.ilDateDurationInputGUI.php.

◆ $toggle_fulltime_txt

string ilDateDurationInputGUI::$toggle_fulltime_txt = ''
protected

Definition at line 39 of file class.ilDateDurationInputGUI.php.

◆ $user

ilObjUser ilDateDurationInputGUI::$user
protected

Definition at line 29 of file class.ilDateDurationInputGUI.php.


The documentation for this class was generated from the following file: