ILIAS  release_8 Revision v8.24
ilDateDurationInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 getShowSeconds ()
 
 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 ()
 
 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 ()
 
 parseDatePickerConfig ()
 parse properties to datepicker config More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

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

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 208 of file class.ilDateDurationInputGUI.php.

208 : bool
209 {
211
212 if ($this->getDisabled()) {
213 return true;
214 }
215
216 $post = $this->strArray($this->getPostVar());
217
218 $start = $post["start"] ?? '';
219 $end = $post["end"] ?? '';
220
221 // if full day is active, ignore time format
222 $format = isset($post['tgl'])
223 ? 0
224 : $this->getDatePickerTimeFormat();
225
226 // always done to make sure there are no obsolete values left
227 $this->setStart();
228 $this->setEnd();
229
230 $valid_start = false;
231 if (trim($start)) {
233 if ($parsed) {
234 $this->setStart($parsed);
235 $valid_start = true;
236 }
237 } else {
238 if (!$this->getRequired() && !trim($end)) {
239 $valid_start = true;
240 } else {
241 if ($this->openIntervalsAllowed() && !strlen(trim($start))) {
242 $valid_start = true;
243 }
244 }
245 }
246
247 $valid_end = false;
248 if (trim($end)) {
250 if ($parsed) {
251 $this->setEnd($parsed);
252 $valid_end = true;
253 }
254 } else {
255 if (!$this->getRequired() && !trim($start)) {
256 $valid_end = true;
257 } else {
258 if ($this->openIntervalsAllowed() && !strlen(trim($end))) {
259 $valid_end = true;
260 }
261 }
262 }
263
264 if ($this->getStartYear()) {
265 if ($valid_start &&
266 $this->getStart()->get(IL_CAL_FKT_DATE, "Y") < $this->getStartYear()) {
267 $valid_start = false;
268 }
269 if ($valid_end &&
270 $this->getEnd()->get(IL_CAL_FKT_DATE, "Y") < $this->getStartYear()) {
271 $valid_end = false;
272 }
273 }
274 $valid = ($valid_start && $valid_end);
275
276 if ($valid &&
277 $this->getStart() &&
278 $this->getEnd() &&
279 ilDateTime::_after($this->getStart(), $this->getEnd())) {
280 $valid = false;
281 }
282
283 if ($this->openIntervalsAllowed()) {
284 $valid = true;
285 } elseif (!$valid) {
286 $this->invalid_input_start = $start;
287 $this->invalid_input_end = $end;
288 $this->setAlert($lng->txt("form_msg_wrong_date"));
289 }
290
291 if ($valid) {
292 $valid = $this->checkSubItemsInput();
293 }
294
295 return $valid;
296 }
const IL_CAL_FKT_DATE
static parseIncomingDate($a_value, bool $a_add_time=false)
Try to parse incoming value to date object.
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...
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...
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:49
$format
Definition: metadata.php:235

References $format, $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 66 of file class.ilDateDurationInputGUI.php.

66 : bool
67 {
69 }

◆ enableToggleFullTime()

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

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

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

◆ getDatePickerTimeFormat()

ilDateDurationInputGUI::getDatePickerTimeFormat ( )
protected

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

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getEnd()

ilDateDurationInputGUI::getEnd ( )

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

124 : ?ilDateTime
125 {
126 return $this->end;
127 }
@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 100 of file class.ilDateDurationInputGUI.php.

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

◆ getFormLabelFor()

ilDateDurationInputGUI::getFormLabelFor ( )

Get label "for" attribute value for form.

Reimplemented from ilFormPropertyGUI.

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

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

◆ getInput()

ilDateDurationInputGUI::getInput ( )

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

298 : array
299 {
300 $ret = $this->strArray($this->getPostVar());
301
302 if ($this->openIntervalsAllowed()) {
303 if (!$this->getStart()) {
304 $ret["start"] = null;
305 }
306
307 if (!$this->getEnd()) {
308 $ret["end"] = null;
309 }
310 } else {
311 if (
312 !$this->getStart() ||
313 !$this->getEnd()
314 ) {
315 $ret["start"] = null;
316 $ret["end"] = null;
317 }
318 }
319 $ret["fullday"] = (bool) ($ret["tgl"] ?? false);
320 return $ret;
321 }

References ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ getMinuteStepSize()

ilDateDurationInputGUI::getMinuteStepSize ( )

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

164 : int
165 {
167 }

◆ getShowSeconds()

ilDateDurationInputGUI::getShowSeconds ( )

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

139 : bool
140 {
141 return false;
142 }

◆ getShowTime()

ilDateDurationInputGUI::getShowTime ( )

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

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

◆ getStart()

ilDateDurationInputGUI::getStart ( )

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

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

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

+ Here is the caller graph for this function:

◆ getStartText()

ilDateDurationInputGUI::getStartText ( )

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

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

◆ getStartYear()

ilDateDurationInputGUI::getStartYear ( )

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

149 : ?int
150 {
151 return $this->startyear;
152 }

◆ getTableFilterHTML()

ilDateDurationInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Implements ilTableFilterItem.

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

461 : string
462 {
463 return $this->render();
464 }

◆ getTableFilterLabelFor()

ilDateDurationInputGUI::getTableFilterLabelFor ( )

Get label "for" attribute value.

Implements ilTableFilterItem.

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

509 : string
510 {
511 return $this->getFieldId() . "[start]";
512 }

◆ getValue()

ilDateDurationInputGUI::getValue ( )

Reimplemented in ilCmiXapiDateDurationInputGUI.

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

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

References IL_CAL_UNIX.

◆ hideSubForm()

ilDateDurationInputGUI::hideSubForm ( )

Reimplemented from ilFormPropertyGUI.

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

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

◆ insert()

ilDateDurationInputGUI::insert ( ilTemplate  $a_tpl)

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

452 : void
453 {
454 $html = $this->render();
455
456 $a_tpl->setCurrentBlock("prop_generic");
457 $a_tpl->setVariable("PROP_GENERIC", $html);
458 $a_tpl->parseCurrentBlock();
459 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 499 of file class.ilDateDurationInputGUI.php.

499 : bool
500 {
502 }

◆ parseDatePickerConfig()

ilDateDurationInputGUI::parseDatePickerConfig ( )
protected

parse properties to datepicker config

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

331 : array
332 {
333 $config = null;
334 if ($this->getMinuteStepSize()) {
335 $config['stepping'] = $this->getMinuteStepSize();
336 }
337 if ($this->getStartYear()) {
338 $config['minDate'] = $this->getStartYear() . '-01-01';
339 }
340 return $config;
341 }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85

References $config.

◆ render()

ilDateDurationInputGUI::render ( )

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

343 : string
344 {
347 $toggle_id = null;
348
349 $tpl = new ilTemplate("tpl.prop_datetime_duration.html", true, true, "Services/Form");
350
351 if ($this->enabledToggleFullTime()) {
352 $this->setShowTime(true);
353
354 $toggle_id = md5($this->getPostVar() . '_fulltime'); // :TODO: unique?
355
356 $tpl->setCurrentBlock('toggle_fullday');
357 $tpl->setVariable('DATE_TOGGLE_ID', $this->getPostVar() . '[tgl]');
358 $tpl->setVariable('FULLDAY_TOGGLE_ID', $toggle_id);
359 $tpl->setVariable('FULLDAY_TOGGLE_CHECKED', $this->toggle_fulltime_checked ? 'checked="checked"' : '');
360 $tpl->setVariable('FULLDAY_TOGGLE_DISABLED', $this->getDisabled() ? 'disabled="disabled"' : '');
361 $tpl->setVariable('TXT_TOGGLE_FULLDAY', $this->toggle_fulltime_txt);
362 $tpl->parseCurrentBlock();
363 }
364
365 // config picker
366 if (!$this->getDisabled()) {
367 // :TODO: unique?
368 $picker_start_id = md5($this->getPostVar() . '_start');
369 $picker_end_id = md5($this->getPostVar() . '_end');
370
371 $tpl->setVariable('DATEPICKER_START_ID', $picker_start_id);
372 $tpl->setVariable('DATEPICKER_END_ID', $picker_end_id);
373
375 $picker_start_id,
377 $this->parseDatePickerConfig(),
378 $picker_end_id,
379 $this->parseDatePickerConfig(),
380 $toggle_id,
381 "subform_" . $this->getPostVar()
382 );
383 } else {
384 $tpl->setVariable('DATEPICKER_START_DISABLED', 'disabled="disabled" ');
385 $tpl->setVariable('DATEPICKER_END_DISABLED', 'disabled="disabled" ');
386 }
387
388 $start_txt = $this->getStartText();
389 if ($start_txt === null) {
390 $start_txt = $lng->txt("form_date_duration_start");
391 }
392 if (trim($start_txt)) {
393 $tpl->setVariable('START_LABEL', $start_txt);
394 $tpl->setVariable('START_ARIA_LABEL', ilLegacyFormElementsUtil::prepareFormOutput($start_txt));
395 $tpl->touchBlock('start_width_bl');
396 }
397
398 $end_txt = $this->getEndText();
399 if ($end_txt === null) {
400 $end_txt = $lng->txt("form_date_duration_end");
401 }
402 if (trim($end_txt)) {
403 $tpl->setVariable('END_LABEL', $end_txt);
404 $tpl->setVariable('END_ARIA_LABEL', ilLegacyFormElementsUtil::prepareFormOutput($end_txt));
405 $tpl->touchBlock('end_width_bl');
406 }
407
408
409 $tpl->setVariable('DATE_START_ID', $this->getPostVar() . '[start]');
410 $tpl->setVariable('DATE_END_ID', $this->getPostVar() . '[end]');
411
412 // placeholder
413 // :TODO: i18n?
415 $tpl->setVariable('START_PLACEHOLDER', $pl_format);
416 $tpl->setVariable('END_PLACEHOLDER', $pl_format);
417
418 // accessibility description
419 $tpl->setVariable(
420 'DESCRIPTION',
421 ilLegacyFormElementsUtil::prepareFormOutput($lng->txt("form_date_aria_desc") . " " . $pl_format)
422 );
423
424
425 // values
426
427 $date_value = htmlspecialchars($this->invalid_input_start);
428 if (!$date_value &&
429 $this->getStart()) {
431 $date_value = $this->getStart()->get(IL_CAL_FKT_DATE, $out_format, $ilUser->getTimeZone());
432 }
433 $tpl->setVariable('DATEPICKER_START_VALUE', $date_value);
434
435 $date_value = htmlspecialchars($this->invalid_input_end);
436 if (!$date_value &&
437 $this->getEnd()) {
439 $date_value = $this->getEnd()->get(IL_CAL_FKT_DATE, $out_format, $ilUser->getTimeZone());
440 }
441 $tpl->setVariable('DATEPICKER_END_VALUE', $date_value);
442
443 if ($this->getRequired()) {
444 $tpl->setVariable("START_REQUIRED", "required=\"required\"");
445 $tpl->setVariable("END_REQUIRED", "required=\"required\"");
446 }
447
448 return $tpl->get();
449 }
static getUserDateFormat(int $a_add_time=0, bool $a_for_parsing=false)
Parse current user setting into date/time format.
static addDateTimePicker(string $a_id, ?int $a_add_time=null, ?array $a_custom_config=null, ?string $a_id2=null, ?array $a_custom_config2=null, ?string $a_toggle_id=null, ?string $a_subform_id=null)
Add date time picker to element.
parseDatePickerConfig()
parse properties to datepicker config
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:34
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

References $ilUser, $lng, $tpl, ilCalendarUtil\addDateTimePicker(), ilCalendarUtil\getUserDateFormat(), IL_CAL_FKT_DATE, and ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ setAllowOpenIntervals()

ilDateDurationInputGUI::setAllowOpenIntervals ( bool  $allowOpenInterval)

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

504 : void
505 {
506 $this->allowOpenIntervals = $allowOpenInterval;
507 }

◆ 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 119 of file class.ilDateDurationInputGUI.php.

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

◆ setEndText()

ilDateDurationInputGUI::setEndText ( string  $a_txt)

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

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

◆ 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 159 of file class.ilDateDurationInputGUI.php.

159 : void
160 {
161 $this->minute_step_size = $a_step_size;
162 }

◆ setShowTime()

ilDateDurationInputGUI::setShowTime ( bool  $a_showtime)

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

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

◆ 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 80 of file class.ilDateDurationInputGUI.php.

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

◆ setStartText()

ilDateDurationInputGUI::setStartText ( string  $a_txt)

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

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

◆ setStartYear()

ilDateDurationInputGUI::setStartYear ( int  $a_year)

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

144 : void
145 {
146 $this->startyear = $a_year;
147 }

◆ 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 480 of file class.ilDateDurationInputGUI.php.

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

References IL_CAL_UNIX.

◆ setValueByArray()

ilDateDurationInputGUI::setValueByArray ( array  $a_values)

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

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

References $format, 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 40 of file class.ilDateDurationInputGUI.php.

◆ $end

ilDateTime ilDateDurationInputGUI::$end = null
protected

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

◆ $end_text

string ilDateDurationInputGUI::$end_text = null
protected

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

◆ $invalid_input_end

string ilDateDurationInputGUI::$invalid_input_end = ''
protected

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

◆ $invalid_input_start

string ilDateDurationInputGUI::$invalid_input_start = ''
protected

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

◆ $minute_step_size

int ilDateDurationInputGUI::$minute_step_size = 5
protected

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

◆ $showtime

bool ilDateDurationInputGUI::$showtime = false
protected

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

◆ $start

ilDateTime ilDateDurationInputGUI::$start = null
protected

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

◆ $start_text

string ilDateDurationInputGUI::$start_text = null
protected

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

◆ $startyear

int ilDateDurationInputGUI::$startyear = null
protected

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

◆ $toggle_fulltime

bool ilDateDurationInputGUI::$toggle_fulltime = false
protected

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

◆ $toggle_fulltime_checked

bool ilDateDurationInputGUI::$toggle_fulltime_checked = false
protected

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

◆ $toggle_fulltime_txt

string ilDateDurationInputGUI::$toggle_fulltime_txt = ''
protected

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

◆ $user

ilObjUser ilDateDurationInputGUI::$user
protected

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


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