ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 enableToggleFullTime ($a_title, $a_checked)
 Enable toggling between date and time. More...
 
 enabledToggleFullTime ()
 Check if toggling between date and time enabled. More...
 
 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 ($a_txt)
 Set text, which will be shown before the start date. More...
 
 getStartText ()
 get start text More...
 
 setEndText ($a_txt)
 Set text, which will be shown before the end date. More...
 
 getEndText ()
 Get end text. More...
 
 getStart ()
 Get Date, yyyy-mm-dd. More...
 
 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 ()
 Get Date, yyyy-mm-dd. More...
 
 setShowTime ($a_showtime)
 Set Show Time Information. More...
 
 getShowTime ()
 Get Show Time Information. More...
 
 getShowSeconds ()
 Show seconds not implemented yet. More...
 
 setStartYear ($a_year)
 Set start year. More...
 
 getStartYear ()
 Get start year. More...
 
 setMinuteStepSize ($a_step_size)
 Set minute step size E.g 5 => The selection will only show 00,05,10... More...
 
 getMinuteStepSize ()
 Get minute step size. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ()
 Insert property html. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Used for table filter presentation. More...
 
 getValue ()
 Used for storing the date duration data in session for table gui filters. More...
 
 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 ()
 
 getFormLabelFor ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($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...
 

Protected Member Functions

 getDatePickerTimeFormat ()
 
 parseDatePickerConfig ()
 parse properties to datepicker config More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Protected Attributes

 $lng
 
 $user
 
 $start = null
 
 $startyear = null
 
 $start_text = null
 
 $end_text = null
 
 $minute_step_size = 5
 
 $end = null
 
 $showtime = false
 
 $toggle_fulltime = false
 
 $toggle_fulltime_txt = ''
 
 $toggle_fulltime_checked = false
 
 $allowOpenIntervals = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References $DIC, ilFormPropertyGUI\setType(), and user().

45  {
46  global $DIC;
47 
48  $this->lng = $DIC->language();
49  $this->user = $DIC->user();
50  parent::__construct($a_title, $a_postvar);
51  $this->setType("dateduration");
52  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
setType($a_type)
Set Type.
+ 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.

Returns
boolean Input ok, true/false

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

References $_POST, $end, $format, $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(), and setStart().

280  {
281  $lng = $this->lng;
282 
283  if ($this->getDisabled()) {
284  return true;
285  }
286 
287  $post = $_POST[$this->getPostVar()];
288  if (!is_array($post)) {
289  return false;
290  }
291 
292  $start = $post["start"];
293  $end = $post["end"];
294 
295  // if full day is active, ignore time format
296  $format = $post['tgl']
297  ? 0
298  : $this->getDatePickerTimeFormat();
299 
300  // always done to make sure there are no obsolete values left
301  $this->setStart(null);
302  $this->setEnd(null);
303 
304  $valid_start = false;
305  if (trim($start)) {
307  if ($parsed) {
308  $this->setStart($parsed);
309  $valid_start = true;
310  }
311  } else {
312  if (!$this->getRequired() && !trim($end)) {
313  $valid_start = true;
314  } else {
315  if ($this->openIntervalsAllowed() && !strlen(trim($start))) {
316  $valid_start = true;
317  }
318  }
319  }
320 
321  $valid_end = false;
322  if (trim($end)) {
324  if ($parsed) {
325  $this->setEnd($parsed);
326  $valid_end = true;
327  }
328  } else {
329  if (!$this->getRequired() && !trim($start)) {
330  $valid_end = true;
331  } else {
332  if ($this->openIntervalsAllowed() && !strlen(trim($end))) {
333  $valid_end = true;
334  }
335  }
336  }
337 
338  if ($this->getStartYear()) {
339  if ($valid_start &&
340  $this->getStart()->get(IL_CAL_FKT_DATE, "Y") < $this->getStartYear()) {
341  $valid_start = false;
342  }
343  if ($valid_end &&
344  $this->getEnd()->get(IL_CAL_FKT_DATE, "Y") < $this->getStartYear()) {
345  $valid_end = false;
346  }
347  }
348  $valid = ($valid_start && $valid_end);
349 
350  if ($valid &&
351  $this->getStart() &&
352  $this->getEnd() &&
353  ilDateTime::_after($this->getStart(), $this->getEnd())) {
354  $valid = false;
355  }
356 
357  if ($this->openIntervalsAllowed()) {
358  if (!$this->getStart()) {
359  $_POST[$this->getPostVar()]["start"] = null;
360  }
361 
362  if (!$this->getEnd()) {
363  $_POST[$this->getPostVar()]["end"] = null;
364  }
365  $valid = true;
366  } elseif (!$valid) {
367  $this->invalid_input_start = $start;
368  $this->invalid_input_end = $end;
369 
370  $_POST[$this->getPostVar()]["start"] = null;
371  $_POST[$this->getPostVar()]["end"] = null;
372 
373  $this->setAlert($lng->txt("form_msg_wrong_date"));
374  } else {
375  if (
376  !$this->getStart() ||
377  !$this->getEnd()
378  ) {
379  $_POST[$this->getPostVar()]["start"] = null;
380  $_POST[$this->getPostVar()]["end"] = null;
381  }
382  }
383 
384  if ($valid) {
385  $valid = $this->checkSubItemsInput();
386  }
387 
388  return $valid;
389  }
$format
Definition: metadata.php:141
getPostVar()
Get Post Variable.
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
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...
$valid
setAlert($a_alert)
Set Alert Text.
const IL_CAL_FKT_DATE
$post
Definition: post.php:34
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["username"]
static parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
+ Here is the call graph for this function:

◆ enabledToggleFullTime()

ilDateDurationInputGUI::enabledToggleFullTime ( )

Check if toggling between date and time enabled.

Returns

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

References $toggle_fulltime.

Referenced by render().

+ Here is the caller graph for this function:

◆ enableToggleFullTime()

ilDateDurationInputGUI::enableToggleFullTime (   $a_title,
  $a_checked 
)

Enable toggling between date and time.

Parameters
object$a_title
object$a_checked
Returns

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

61  {
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 391 of file class.ilDateDurationInputGUI.php.

References getShowSeconds(), and getShowTime().

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

392  {
393  return (int) $this->getShowTime() + (int) $this->getShowSeconds();
394  }
getShowSeconds()
Show seconds not implemented yet.
getShowTime()
Get Show Time Information.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEnd()

ilDateDurationInputGUI::getEnd ( )

Get Date, yyyy-mm-dd.

Returns
object Date, yyyy-mm-dd

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

References $end.

Referenced by checkInput(), getValue(), hideSubForm(), and render().

162  {
163  return $this->end;
164  }
+ Here is the caller graph for this function:

◆ getEndText()

ilDateDurationInputGUI::getEndText ( )

Get end text.

Returns

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

References $end_text.

Referenced by render().

+ Here is the caller graph for this function:

◆ getFormLabelFor()

ilDateDurationInputGUI::getFormLabelFor ( )

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

References ilFormPropertyGUI\getFieldId().

610  {
611  return $this->getFieldId()."[start]";
612  }
getFieldId()
Get Post Variable.
+ Here is the call graph for this function:

◆ getMinuteStepSize()

ilDateDurationInputGUI::getMinuteStepSize ( )

Get minute step size.

public

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

References $minute_step_size.

Referenced by parseDatePickerConfig().

+ Here is the caller graph for this function:

◆ getShowSeconds()

ilDateDurationInputGUI::getShowSeconds ( )

Show seconds not implemented yet.

Returns

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

Referenced by getDatePickerTimeFormat().

191  {
192  return false;
193  }
+ Here is the caller graph for this function:

◆ getShowTime()

ilDateDurationInputGUI::getShowTime ( )

Get Show Time Information.

Returns
boolean Show Time Information

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

References $showtime.

Referenced by getDatePickerTimeFormat().

+ Here is the caller graph for this function:

◆ getStart()

ilDateDurationInputGUI::getStart ( )

Get Date, yyyy-mm-dd.

Returns
object Date, yyyy-mm-dd

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

References $start.

Referenced by checkInput(), getValue(), hideSubForm(), and render().

+ Here is the caller graph for this function:

◆ getStartText()

ilDateDurationInputGUI::getStartText ( )

get start text

Returns

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

References $start_text.

Referenced by render().

+ Here is the caller graph for this function:

◆ getStartYear()

ilDateDurationInputGUI::getStartYear ( )

Get start year.

Returns
integer Start year

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

References $startyear.

Referenced by checkInput(), and parseDatePickerConfig().

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilDateDurationInputGUI::getTableFilterHTML ( )

Used for table filter presentation.

Returns
string

Implements ilTableFilterItem.

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

References render().

543  {
544  return $this->render();
545  }
+ Here is the call graph for this function:

◆ getTableFilterLabelFor()

ilDateDurationInputGUI::getTableFilterLabelFor ( )

Implements ilTableFilterItem.

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

References ilFormPropertyGUI\getFieldId().

603  {
604  return $this->getFieldId()."[start]";
605  }
getFieldId()
Get Post Variable.
+ Here is the call graph for this function:

◆ getValue()

ilDateDurationInputGUI::getValue ( )

Used for storing the date duration data in session for table gui filters.

Returns
array

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

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

552  {
553  return array(
554  'start' => $this->getStart()->get(IL_CAL_UNIX),
555  'end' => $this->getEnd()->get(IL_CAL_UNIX)
556  );
557  }
const IL_CAL_UNIX
+ Here is the call graph for this function:

◆ hideSubForm()

ilDateDurationInputGUI::hideSubForm ( )

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

References getEnd(), and getStart().

574  {
575  if ($this->invalid_input_start ||
576  $this->invalid_input_end) {
577  return false;
578  }
579 
580  return ((!$this->getStart() || $this->getStart()->isNull()) &&
581  (!$this->getEnd() || $this->getEnd()->isNull()));
582  }
+ Here is the call graph for this function:

◆ insert()

ilDateDurationInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

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

References $html, and render().

530  {
531  $html = $this->render();
532 
533  $a_tpl->setCurrentBlock("prop_generic");
534  $a_tpl->setVariable("PROP_GENERIC", $html);
535  $a_tpl->parseCurrentBlock();
536  }
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ openIntervalsAllowed()

ilDateDurationInputGUI::openIntervalsAllowed ( )
Returns
bool

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

References $allowOpenIntervals.

Referenced by checkInput(), and setValueByArray().

587  : bool
588  {
590  }
+ Here is the caller graph for this function:

◆ parseDatePickerConfig()

ilDateDurationInputGUI::parseDatePickerConfig ( )
protected

parse properties to datepicker config

Returns
array

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

References $config, getMinuteStepSize(), and getStartYear().

Referenced by render().

402  {
403  $config = null;
404  if ($this->getMinuteStepSize()) {
405  $config['stepping'] = (int) $this->getMinuteStepSize();
406  }
407  if ($this->getStartYear()) {
408  $config['minDate'] = $this->getStartYear() . '-01-01';
409  }
410  return $config;
411  }
$config
Definition: bootstrap.php:15
getMinuteStepSize()
Get minute step size.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilDateDurationInputGUI::render ( )

Insert property html.

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

References $ilUser, $lng, $tpl, $user, ilCalendarUtil\addDateTimePicker(), enabledToggleFullTime(), getDatePickerTimeFormat(), ilFormPropertyGUI\getDisabled(), getEnd(), getEndText(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getStart(), getStartText(), ilCalendarUtil\getUserDateFormat(), IL_CAL_FKT_DATE, parseDatePickerConfig(), ilUtil\prepareFormOutput(), and setShowTime().

Referenced by getTableFilterHTML(), and insert().

418  {
420  $lng = $this->lng;
421 
422  $tpl = new ilTemplate("tpl.prop_datetime_duration.html", true, true, "Services/Form");
423 
424  if ($this->enabledToggleFullTime()) {
425  $this->setShowTime(true);
426 
427  $toggle_id = md5($this->getPostVar() . '_fulltime'); // :TODO: unique?
428 
429  $tpl->setCurrentBlock('toggle_fullday');
430  $tpl->setVariable('DATE_TOGGLE_ID', $this->getPostVar() . '[tgl]');
431  $tpl->setVariable('FULLDAY_TOGGLE_ID', $toggle_id);
432  $tpl->setVariable('FULLDAY_TOGGLE_CHECKED', $this->toggle_fulltime_checked ? 'checked="checked"' : '');
433  $tpl->setVariable('FULLDAY_TOGGLE_DISABLED', $this->getDisabled() ? 'disabled="disabled"' : '');
434  $tpl->setVariable('TXT_TOGGLE_FULLDAY', $this->toggle_fulltime_txt);
435  $tpl->parseCurrentBlock();
436  }
437 
438  // config picker
439  if (!$this->getDisabled()) {
440  // :TODO: unique?
441  $picker_start_id = md5($this->getPostVar() . '_start');
442  $picker_end_id = md5($this->getPostVar() . '_end');
443 
444  $tpl->setVariable('DATEPICKER_START_ID', $picker_start_id);
445  $tpl->setVariable('DATEPICKER_END_ID', $picker_end_id);
446 
448  $picker_start_id,
449  $this->getDatePickerTimeFormat(),
450  $this->parseDatePickerConfig(),
451  $picker_end_id,
452  $this->parseDatePickerConfig(),
453  $toggle_id,
454  "subform_" . $this->getPostVar()
455  );
456  } else {
457  $tpl->setVariable('DATEPICKER_START_DISABLED', 'disabled="disabled" ');
458  $tpl->setVariable('DATEPICKER_END_DISABLED', 'disabled="disabled" ');
459  }
460 
461  $start_txt = $this->getStartText();
462  if ($start_txt === null) {
463  $start_txt = $lng->txt("form_date_duration_start");
464  }
465  if (trim($start_txt)) {
466  $tpl->setVariable('START_LABEL', $start_txt);
467  $tpl->setVariable('START_ARIA_LABEL', ilUtil::prepareFormOutput($start_txt));
468  $tpl->touchBlock('start_width_bl');
469  }
470 
471  $end_txt = $this->getEndText();
472  if ($end_txt === null) {
473  $end_txt = $lng->txt("form_date_duration_end");
474  }
475  if (trim($end_txt)) {
476  $tpl->setVariable('END_LABEL', $end_txt);
477  $tpl->setVariable('END_ARIA_LABEL', ilUtil::prepareFormOutput($end_txt));
478  $tpl->touchBlock('end_width_bl');
479  }
480 
481 
482  $tpl->setVariable('DATE_START_ID', $this->getPostVar() . '[start]');
483  $tpl->setVariable('DATE_END_ID', $this->getPostVar() . '[end]');
484 
485  // placeholder
486  // :TODO: i18n?
488  $tpl->setVariable('START_PLACEHOLDER', $pl_format);
489  $tpl->setVariable('END_PLACEHOLDER', $pl_format);
490 
491  // accessibility description
492  $tpl->setVariable(
493  'DESCRIPTION',
494  ilUtil::prepareFormOutput($lng->txt("form_date_aria_desc") . " " . $pl_format)
495  );
496 
497 
498  // values
499 
500  $date_value = htmlspecialchars($this->invalid_input_start);
501  if (!$date_value &&
502  $this->getStart()) {
503  $out_format = ilCalendarUtil::getUserDateFormat($this->getDatePickerTimeFormat(), true);
504  $date_value = $this->getStart()->get(IL_CAL_FKT_DATE, $out_format, $ilUser->getTimeZone());
505  }
506  $tpl->setVariable('DATEPICKER_START_VALUE', $date_value);
507 
508  $date_value = htmlspecialchars($this->invalid_input_end);
509  if (!$date_value &&
510  $this->getEnd()) {
511  $out_format = ilCalendarUtil::getUserDateFormat($this->getDatePickerTimeFormat(), true);
512  $date_value = $this->getEnd()->get(IL_CAL_FKT_DATE, $out_format, $ilUser->getTimeZone());
513  }
514  $tpl->setVariable('DATEPICKER_END_VALUE', $date_value);
515 
516  if ($this->getRequired()) {
517  $tpl->setVariable("START_REQUIRED", "required=\"required\"");
518  $tpl->setVariable("END_REQUIRED", "required=\"required\"");
519  }
520 
521  return $tpl->get();
522  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
enabledToggleFullTime()
Check if toggling between date and time enabled.
parseDatePickerConfig()
parse properties to datepicker config
static getUserDateFormat($a_add_time=false, $a_for_parsing=false)
Parse current user setting into date/time format.
static addDateTimePicker($a_id, $a_add_time=null, array $a_custom_config=null, $a_id2=null, $a_custom_config2=null, $a_toggle_id=null, $a_subform_id=null)
Add date time picker to element.
special template class to simplify handling of ITX/PEAR
const IL_CAL_FKT_DATE
$ilUser
Definition: imgupload.php:18
setShowTime($a_showtime)
Set Show Time Information.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAllowOpenIntervals()

ilDateDurationInputGUI::setAllowOpenIntervals ( bool  $allowOpenInterval)
Parameters
bool$allowOpenInterval

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

596  {
597  $this->allowOpenIntervals = $allowOpenInterval;
598  }

◆ 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));
Parameters
object$a_dateilDate or ilDateTime object

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

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

152  {
153  $this->end = $a_date;
154  }
+ Here is the caller graph for this function:

◆ setEndText()

ilDateDurationInputGUI::setEndText (   $a_txt)

Set text, which will be shown before the end date.

Parameters
object$a_txt
Returns

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

117  {
118  $this->end_text = $a_txt;
119  }

◆ setMinuteStepSize()

ilDateDurationInputGUI::setMinuteStepSize (   $a_step_size)

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

minutes

public

Parameters
intminute step_size 1,5,10,15,20...

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

224  {
225  $this->minute_step_size = $a_step_size;
226  }

◆ setShowTime()

ilDateDurationInputGUI::setShowTime (   $a_showtime)

Set Show Time Information.

Parameters
boolean$a_showtimeShow Time Information

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

Referenced by ilChatroomFormFactory\getSettingsForm(), ilObjPollGUI\initEditCustomForm(), ilObjPortfolioTemplateGUI\initEditCustomForm(), ilObjCourseGUI\initEditForm(), ilObjGroupGUI\initForm(), ilObjSurveyGUI\initPropertiesForm(), and render().

172  {
173  $this->showtime = $a_showtime;
174  }
+ 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));
Parameters
object$a_dateilDate or ilDateTime object

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

Referenced by checkInput(), ilPCLearningHistoryGUI\initForm(), setValue(), and setValueByArray().

88  {
89  $this->start = $a_date;
90  }
+ Here is the caller graph for this function:

◆ setStartText()

ilDateDurationInputGUI::setStartText (   $a_txt)

Set text, which will be shown before the start date.

Parameters
object$a_txt
Returns

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

Referenced by ilChatroomFormFactory\getPeriodForm().

98  {
99  $this->start_text = $a_txt;
100  }
+ Here is the caller graph for this function:

◆ setStartYear()

ilDateDurationInputGUI::setStartYear (   $a_year)

Set start year.

Parameters
integerStart year

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

201  {
202  $this->startyear = $a_year;
203  }

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

See also
getValue()
Parameters
array | bool$value

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

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

566  {
567  if (is_array($value)) {
568  $this->setStart(new ilDateTime($value['start'], IL_CAL_UNIX));
569  $this->setEnd(new ilDateTime($value['end'], IL_CAL_UNIX));
570  }
571  }
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
Date and time handling
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 (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

245  {
246  $incoming = $a_values[$this->getPostVar()];
247  if (is_array($incoming)) {
248  $format = $incoming['tgl'] ? 0 : $this->getDatePickerTimeFormat();
249  $this->toggle_fulltime_checked = (bool) $incoming['tgl'];
250 
251  if ($this->openIntervalsAllowed()) {
252  if (is_string($incoming['start']) && trim($incoming['start']) !== '') {
253  $this->setStart(ilCalendarUtil::parseIncomingDate($incoming["start"], $format));
254  } else {
255  $this->setStart(new ilDate(null, IL_CAL_UNIX));
256  }
257 
258  if (is_string($incoming['end']) && trim($incoming['end']) !== '') {
259  $this->setEnd(ilCalendarUtil::parseIncomingDate($incoming["end"], $format));
260  } else {
261  $this->setEnd(new ilDate(null, IL_CAL_UNIX));
262  }
263  } else {
264  $this->setStart(ilCalendarUtil::parseIncomingDate($incoming["start"], $format));
265  $this->setEnd(ilCalendarUtil::parseIncomingDate($incoming["end"], $format));
266  }
267  }
268 
269  foreach ($this->getSubItems() as $item) {
270  $item->setValueByArray($a_values);
271  }
272  }
$format
Definition: metadata.php:141
getPostVar()
Get Post Variable.
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
Class for single dates.
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 parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
+ Here is the call graph for this function:

Field Documentation

◆ $allowOpenIntervals

ilDateDurationInputGUI::$allowOpenIntervals = false
protected

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

Referenced by openIntervalsAllowed().

◆ $end

ilDateDurationInputGUI::$end = null
protected

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

Referenced by checkInput(), and getEnd().

◆ $end_text

ilDateDurationInputGUI::$end_text = null
protected

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

Referenced by getEndText().

◆ $lng

ilDateDurationInputGUI::$lng
protected

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

Referenced by checkInput(), and render().

◆ $minute_step_size

ilDateDurationInputGUI::$minute_step_size = 5
protected

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

Referenced by getMinuteStepSize().

◆ $showtime

ilDateDurationInputGUI::$showtime = false
protected

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

Referenced by getShowTime().

◆ $start

ilDateDurationInputGUI::$start = null
protected

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

Referenced by checkInput(), and getStart().

◆ $start_text

ilDateDurationInputGUI::$start_text = null
protected

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

Referenced by getStartText().

◆ $startyear

ilDateDurationInputGUI::$startyear = null
protected

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

Referenced by getStartYear().

◆ $toggle_fulltime

ilDateDurationInputGUI::$toggle_fulltime = false
protected

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

Referenced by enabledToggleFullTime().

◆ $toggle_fulltime_checked

ilDateDurationInputGUI::$toggle_fulltime_checked = false
protected

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

◆ $toggle_fulltime_txt

ilDateDurationInputGUI::$toggle_fulltime_txt = ''
protected

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

◆ $user

ilDateDurationInputGUI::$user
protected

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

Referenced by render().


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