ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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... More...
 
 getMinuteStepSize ()
 Fixed to one minute increments, see https://mantis.ilias.de/view.php?id=42740. More...
 
 setValueByArray (array $a_values)
 
 checkInput ()
 
 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 ()
 
- 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)
 
- 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...
 

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilDateDurationInputGUI::checkInput ( )

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

References $end, ilFormPropertyGUI\$lng, $post, $start, $valid, ilDateTime\_after(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), getDatePickerTimeFormat(), ilFormPropertyGUI\getDisabled(), getEnd(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getStart(), getStartYear(), IL_CAL_FKT_DATE, openIntervalsAllowed(), ilCalendarUtil\parseIncomingDate(), ilFormPropertyGUI\setAlert(), setEnd(), setStart(), ilFormPropertyGUI\strArray(), and ilLanguage\txt().

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

◆ enabledToggleFullTime()

ilDateDurationInputGUI::enabledToggleFullTime ( )

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

References $toggle_fulltime.

Referenced by render().

66  : bool
67  {
69  }
+ Here is the caller graph for this function:

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

References getShowTime().

Referenced by checkInput(), and setValueByArray().

311  : int
312  {
313  return (int) $this->getShowTime();
314  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDatetimeFormatForInput()

ilDateDurationInputGUI::getDatetimeFormatForInput ( )
protected

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

References getShowTime().

Referenced by prepareInvalidInputAsValue(), and render().

316  : string
317  {
318  $format = 'Y-m-d';
319  if ($this->getShowTime()) {
320  $format .= '\TH:i';
321  }
322  return $format;
323  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEnd()

ilDateDurationInputGUI::getEnd ( )

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

References $end.

Referenced by checkInput(), ilCmiXapiDateDurationInputGUI\getEndXapiDateTime(), getInput(), ilCmiXapiDateDurationInputGUI\getValue(), getValue(), hideSubForm(), and render().

124  : ?ilDateTime
125  {
126  return $this->end;
127  }
+ Here is the caller graph for this function:

◆ getEndText()

ilDateDurationInputGUI::getEndText ( )

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

References $end_text.

Referenced by render().

100  : ?string
101  {
102  return $this->end_text;
103  }
+ Here is the caller graph for this function:

◆ getFormLabelFor()

ilDateDurationInputGUI::getFormLabelFor ( )

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

References ilFormPropertyGUI\getFieldId().

516  : string
517  {
518  return $this->getFieldId() . "[start]";
519  }
+ Here is the call graph for this function:

◆ getInput()

ilDateDurationInputGUI::getInput ( )

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

References getEnd(), ilFormPropertyGUI\getPostVar(), getStart(), null, openIntervalsAllowed(), and ilFormPropertyGUI\strArray().

288  : array
289  {
290  $ret = $this->strArray($this->getPostVar());
291 
292  if ($this->openIntervalsAllowed()) {
293  if (!$this->getStart()) {
294  $ret["start"] = null;
295  }
296 
297  if (!$this->getEnd()) {
298  $ret["end"] = null;
299  }
300  } elseif (
301  !$this->getStart() ||
302  !$this->getEnd()
303  ) {
304  $ret["start"] = null;
305  $ret["end"] = null;
306  }
307  $ret["fullday"] = (bool) ($ret["tgl"] ?? false);
308  return $ret;
309  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 162 of file class.ilDateDurationInputGUI.php.

162  : int
163  {
164  return 1;
165  }

◆ getShowTime()

ilDateDurationInputGUI::getShowTime ( )

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

References $showtime.

Referenced by getDatePickerTimeFormat(), getDatetimeFormatForInput(), and render().

134  : bool
135  {
136  return $this->showtime;
137  }
+ Here is the caller graph for this function:

◆ getStart()

ilDateDurationInputGUI::getStart ( )

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

References $start.

Referenced by checkInput(), getInput(), ilCmiXapiDateDurationInputGUI\getStartXapiDateTime(), ilCmiXapiDateDurationInputGUI\getValue(), getValue(), hideSubForm(), and render().

105  : ?ilDateTime
106  {
107  return $this->start;
108  }
+ Here is the caller graph for this function:

◆ getStartText()

ilDateDurationInputGUI::getStartText ( )

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

References $start_text.

Referenced by render().

90  : ?string
91  {
92  return $this->start_text;
93  }
+ Here is the caller graph for this function:

◆ getStartYear()

ilDateDurationInputGUI::getStartYear ( )

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

References $startyear.

Referenced by checkInput(), and render().

144  : ?int
145  {
146  return $this->startyear;
147  }
+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilDateDurationInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Implements ilTableFilterItem.

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

References render().

463  : string
464  {
465  return $this->render();
466  }
+ Here is the call graph for this function:

◆ getTableFilterLabelFor()

ilDateDurationInputGUI::getTableFilterLabelFor ( )

Get label "for" attribute value.

Implements ilTableFilterItem.

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

References ilFormPropertyGUI\getFieldId().

511  : string
512  {
513  return $this->getFieldId() . "[start]";
514  }
+ Here is the call graph for this function:

◆ getValue()

ilDateDurationInputGUI::getValue ( )

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

References getEnd(), getStart(), IL_CAL_UNIX, and null.

468  : array
469  {
470  return array(
471  'start' => $this->getStart() ? $this->getStart()->get(IL_CAL_UNIX) : null,
472  'end' => $this->getEnd() ? $this->getEnd()->get(IL_CAL_UNIX) : null
473  );
474  }
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ hideSubForm()

ilDateDurationInputGUI::hideSubForm ( )

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

References getEnd(), and getStart().

490  : bool
491  {
492  if ($this->invalid_input_start ||
493  $this->invalid_input_end) {
494  return false;
495  }
496 
497  return ((!$this->getStart() || $this->getStart()->isNull()) &&
498  (!$this->getEnd() || $this->getEnd()->isNull()));
499  }
+ Here is the call graph for this function:

◆ insert()

ilDateDurationInputGUI::insert ( ilTemplate  $a_tpl)

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

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

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

◆ openIntervalsAllowed()

ilDateDurationInputGUI::openIntervalsAllowed ( )

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

References $allowOpenIntervals.

Referenced by checkInput(), getInput(), and setValueByArray().

501  : bool
502  {
504  }
+ Here is the caller graph for this function:

◆ prepareInvalidInputAsValue()

ilDateDurationInputGUI::prepareInvalidInputAsValue ( string  $invalid_input)
protected

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

References $timestamp, and getDatetimeFormatForInput().

Referenced by render().

444  : string
445  {
446  $timestamp = strtotime(htmlspecialchars($invalid_input));
447  if ($timestamp === false) {
448  return '';
449  }
450  return date($this->getDatetimeFormatForInput(), $timestamp);
451  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilDateDurationInputGUI::render ( )

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

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\$type, $user, enabledToggleFullTime(), getDatetimeFormatForInput(), ilFormPropertyGUI\getDisabled(), getEnd(), getEndText(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getShowTime(), getStart(), getStartText(), getStartYear(), IL_CAL_FKT_DATE, null, ilLegacyFormElementsUtil\prepareFormOutput(), prepareInvalidInputAsValue(), setShowTime(), and ilLanguage\txt().

Referenced by getTableFilterHTML(), and insert().

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

◆ setAllowOpenIntervals()

ilDateDurationInputGUI::setAllowOpenIntervals ( bool  $allowOpenInterval)

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

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

◆ 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.

Referenced by checkInput(), setValue(), ILIAS\LegalDocuments\Legacy\ResettingDurationInputGUI\setValueByArray(), and setValueByArray().

119  : void
120  {
121  $this->end = $a_date;
122  }
+ Here is the caller graph for this function:

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

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

◆ setShowTime()

ilDateDurationInputGUI::setShowTime ( bool  $a_showtime)

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

Referenced by render().

129  : void
130  {
131  $this->showtime = $a_showtime;
132  }
+ Here is the caller graph for this function:

◆ 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.

Referenced by checkInput(), setValue(), ILIAS\LegalDocuments\Legacy\ResettingDurationInputGUI\setValueByArray(), and setValueByArray().

80  : void
81  {
82  $this->start = $a_date;
83  }
+ Here is the caller graph for this function:

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

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

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

References IL_CAL_UNIX, setEnd(), and setStart().

482  : void
483  {
484  if (is_array($value)) {
485  $this->setStart(new ilDateTime($value['start'], IL_CAL_UNIX));
486  $this->setEnd(new ilDateTime($value['end'], IL_CAL_UNIX));
487  }
488  }
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...
const IL_CAL_UNIX
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...
+ Here is the call graph for this function:

◆ setValueByArray()

ilDateDurationInputGUI::setValueByArray ( array  $a_values)

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

References getDatePickerTimeFormat(), ilFormPropertyGUI\getPostVar(), ilSubEnabledFormPropertyGUI\getSubItems(), IL_CAL_UNIX, null, openIntervalsAllowed(), ilCalendarUtil\parseIncomingDate(), setEnd(), and setStart().

167  : void
168  {
169  $incoming = $a_values[$this->getPostVar()] ?? [];
170  if (is_array($incoming) && $incoming !== []) {
171  $format = isset($incoming['tgl']) ? 0 : $this->getDatePickerTimeFormat();
172  $this->toggle_fulltime_checked = (bool) ($incoming['tgl'] ?? false);
173 
174  if ($this->openIntervalsAllowed()) {
175  if (isset($incoming['start']) && is_string($incoming['start']) && trim($incoming['start']) !== '') {
176  $this->setStart(ilCalendarUtil::parseIncomingDate($incoming["start"], (bool) $format));
177  } else {
178  $this->setStart(new ilDate(null, IL_CAL_UNIX));
179  }
180 
181  if (isset($incoming['end']) && is_string($incoming['end']) && trim($incoming['end']) !== '') {
182  $this->setEnd(ilCalendarUtil::parseIncomingDate($incoming["end"], (bool) $format));
183  } else {
184  $this->setEnd(new ilDate(null, IL_CAL_UNIX));
185  }
186  } else {
187  # 0033160
188  if ($incoming['start'] instanceof ilDateTime) {
189  $this->setStart($incoming['start']);
190  } else {
191  $this->setStart(ilCalendarUtil::parseIncomingDate((string) $incoming["start"], (bool) $format));
192  }
193  if ($incoming['end'] instanceof ilDateTime) {
194  $this->setEnd($incoming['end']);
195  } else {
196  $this->setEnd(ilCalendarUtil::parseIncomingDate((string) $incoming["end"], (bool) $format));
197  }
198  }
199  }
200 
201  foreach ($this->getSubItems() as $item) {
202  $item->setValueByArray($a_values);
203  }
204  }
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 parseIncomingDate($value, bool $add_time=false)
Try to parse incoming value to date object.
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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...
+ 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.

Referenced by openIntervalsAllowed().

◆ $end

ilDateTime ilDateDurationInputGUI::$end = null
protected

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

Referenced by checkInput(), and getEnd().

◆ $end_text

string ilDateDurationInputGUI::$end_text = null
protected

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

Referenced by getEndText().

◆ $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.

Referenced by getShowTime().

◆ $start

ilDateTime ilDateDurationInputGUI::$start = null
protected

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

Referenced by checkInput(), and getStart().

◆ $start_text

string ilDateDurationInputGUI::$start_text = null
protected

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

Referenced by getStartText().

◆ $startyear

int ilDateDurationInputGUI::$startyear = null
protected

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

Referenced by getStartYear().

◆ $toggle_fulltime

bool ilDateDurationInputGUI::$toggle_fulltime = false
protected

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

Referenced by enabledToggleFullTime().

◆ $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.

Referenced by render().


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