ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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...
 
 enableDateActivation ($a_title, $a_postvar, $a_checked=true)
 Enable date activation. More...
 
 enableToggleFullTime ($a_title, $a_checked)
 Enable toggling between date and time. More...
 
 enabledToggleFullTime ()
 Check if toggling between date and time enabled. More...
 
 getActivationPostVar ()
 Get activation post var. More...
 
 setStart (ilDateTime $a_date)
 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)
 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...
 
 setShowEmpty ($a_empty)
 Set Show Empty Information. More...
 
 getShowEmpty ()
 Get Show Empty Information. 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...
 
- 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 

Protected Attributes

 $start = null
 
 $startyear = null
 
 $start_text = ''
 
 $end_text = ''
 
 $minute_step_size = 5
 
 $end = null
 
 $activation_title = ''
 Activation full day events. More...
 
 $activation_post_var = ''
 
 $activation_checked = true
 
 $toggle_fulltime = false
 Toggle datetime. More...
 
 $toggle_fulltime_txt = ''
 
 $toggle_fulltime_checked = false
 
 $show_empty = false
 
 $showtime = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. 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 48 of file class.ilDateDurationInputGUI.php.

References ilFormPropertyGUI\setType().

49  {
50  parent::__construct($a_title, $a_postvar);
51  $this->setType("dateduration");
52  }
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 340 of file class.ilDateDurationInputGUI.php.

References $_POST, $ilUser, $lng, $ok, ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getPostVar(), getShowTime(), IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, ilFormPropertyGUI\setAlert(), setEnd(), setStart(), and ilUtil\stripSlashes().

341  {
342  global $lng,$ilUser;
343 
344  if($this->getDisabled())
345  {
346  return true;
347  }
348 
349 
350  $ok = true;
351 
352  // Start
353  $_POST[$this->getPostVar()]['start']["date"]["y"] =
354  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["date"]["y"]);
355  $_POST[$this->getPostVar()]['start']["date"]["m"] =
356  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["date"]["m"]);
357  $_POST[$this->getPostVar()]['start']["date"]["d"] =
358  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["date"]["d"]);
359  $_POST[$this->getPostVar()]['start']["time"]["h"] =
360  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["time"]["h"]);
361  $_POST[$this->getPostVar()]['start']["time"]["m"] =
362  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["time"]["m"]);
363  $_POST[$this->getPostVar()]['start']["time"]["s"] =
364  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["time"]["s"]);
365 
366  // verify date
367  $dt['year'] = (int) $_POST[$this->getPostVar()]['start']['date']['y'];
368  $dt['mon'] = (int) $_POST[$this->getPostVar()]['start']['date']['m'];
369  $dt['mday'] = (int) $_POST[$this->getPostVar()]['start']['date']['d'];
370  $dt['hours'] = (int) $_POST[$this->getPostVar()]['start']['time']['h'];
371  $dt['minutes'] = (int) $_POST[$this->getPostVar()]['start']['time']['m'];
372  $dt['seconds'] = (int) $_POST[$this->getPostVar()]['start']['time']['s'];
373 
374 
375  if($this->getShowTime())
376  {
377  $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
378  }
379  else
380  {
381  $date = new ilDate($dt,IL_CAL_FKT_GETDATE);
382  }
383  if ($_POST[$this->getPostVar()]['start']["date"]["d"] != $date->get(IL_CAL_FKT_DATE,'d',$ilUser->getTimeZone()) ||
384  $_POST[$this->getPostVar()]['start']["date"]["m"] != $date->get(IL_CAL_FKT_DATE,'m',$ilUser->getTimeZone()) ||
385  $_POST[$this->getPostVar()]['start']["date"]["y"] != $date->get(IL_CAL_FKT_DATE,'Y',$ilUser->getTimeZone()))
386  {
387  // #11847
388  $this->invalid_input['start'] = $_POST[$this->getPostVar()]['start']["date"];
389  $this->setAlert($lng->txt("exc_date_not_valid"));
390  $ok = false;
391  }
392 
393  #$_POST[$this->getPostVar()]['start']['date'] = $date->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
394  #$_POST[$this->getPostVar()]['start']['time'] = $date->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
395 
396  $this->setStart($date);
397 
398  // End
399  $_POST[$this->getPostVar()]['end']["date"]["y"] =
400  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["date"]["y"]);
401  $_POST[$this->getPostVar()]['end']["date"]["m"] =
402  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["date"]["m"]);
403  $_POST[$this->getPostVar()]['end']["date"]["d"] =
404  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["date"]["d"]);
405  $_POST[$this->getPostVar()]['end']["time"]["h"] =
406  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["time"]["h"]);
407  $_POST[$this->getPostVar()]['end']["time"]["m"] =
408  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["time"]["m"]);
409  $_POST[$this->getPostVar()]['end']["time"]["s"] =
410  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["time"]["s"]);
411 
412  // verify date
413  $dt['year'] = (int) $_POST[$this->getPostVar()]['end']['date']['y'];
414  $dt['mon'] = (int) $_POST[$this->getPostVar()]['end']['date']['m'];
415  $dt['mday'] = (int) $_POST[$this->getPostVar()]['end']['date']['d'];
416  $dt['hours'] = (int) $_POST[$this->getPostVar()]['end']['time']['h'];
417  $dt['minutes'] = (int) $_POST[$this->getPostVar()]['end']['time']['m'];
418  $dt['seconds'] = (int) $_POST[$this->getPostVar()]['end']['time']['s'];
419 
420  if($this->getShowTime())
421  {
422  $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
423  }
424  else
425  {
426  $date = new ilDate($dt,IL_CAL_FKT_GETDATE);
427  }
428  if ($_POST[$this->getPostVar()]['end']["date"]["d"] != $date->get(IL_CAL_FKT_DATE,'d',$ilUser->getTimeZone()) ||
429  $_POST[$this->getPostVar()]['end']["date"]["m"] != $date->get(IL_CAL_FKT_DATE,'m',$ilUser->getTimeZone()) ||
430  $_POST[$this->getPostVar()]['end']["date"]["y"] != $date->get(IL_CAL_FKT_DATE,'Y',$ilUser->getTimeZone()))
431  {
432  $this->invalid_input['end'] = $_POST[$this->getPostVar()]['end']["date"];
433  $this->setAlert($lng->txt("exc_date_not_valid"));
434  $ok = false;
435  }
436 
437  #$_POST[$this->getPostVar()]['end']['date'] = $date->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
438  #$_POST[$this->getPostVar()]['end']['time'] = $date->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
439 
440  $this->setEnd($date);
441 
442  return $ok;
443  }
$_POST['username']
Definition: cron.php:12
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
getShowTime()
Get Show Time Information.
Class for single dates.
const IL_CAL_FKT_DATE
Date and time handling
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const IL_CAL_FKT_GETDATE
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
setStart(ilDateTime $a_date)
Set start date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilD...
setEnd(ilDateTime $a_date)
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:

◆ enableDateActivation()

ilDateDurationInputGUI::enableDateActivation (   $a_title,
  $a_postvar,
  $a_checked = true 
)

Enable date activation.

If chosen a checkbox will be shown that gives the possibility to en/disable the date selection.

public

Parameters
stringtext displayed after the checkbox
stringname of postvar
boolcheckbox checked

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

65  {
66  $this->activation_title = $a_title;
67  $this->activation_post_var = $a_postvar;
68  $this->activation_checked = $a_checked;
69  }

◆ enabledToggleFullTime()

ilDateDurationInputGUI::enabledToggleFullTime ( )

Check if toggling between date and time enabled.

Returns

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

References $toggle_fulltime.

Referenced by render().

89  {
91  }
+ 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 77 of file class.ilDateDurationInputGUI.php.

78  {
79  $this->toggle_fulltime_txt = $a_title;
80  $this->toggle_fulltime_checked = $a_checked;
81  $this->toggle_fulltime = true;
82  }

◆ getActivationPostVar()

ilDateDurationInputGUI::getActivationPostVar ( )

Get activation post var.

public

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

References $activation_post_var.

Referenced by render().

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

References $end.

Referenced by getValue(), and render().

190  {
191  return $this->end;
192  }
+ Here is the caller graph for this function:

◆ getEndText()

ilDateDurationInputGUI::getEndText ( )

Get end text.

Returns

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

References $end_text.

Referenced by render().

+ Here is the caller graph for this function:

◆ getMinuteStepSize()

ilDateDurationInputGUI::getMinuteStepSize ( )

Get minute step size.

public

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

References $minute_step_size.

Referenced by render().

+ Here is the caller graph for this function:

◆ getShowEmpty()

ilDateDurationInputGUI::getShowEmpty ( )

Get Show Empty Information.

Returns
boolean Show Empty Information

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

References $show_empty.

Referenced by render().

+ Here is the caller graph for this function:

◆ getShowSeconds()

ilDateDurationInputGUI::getShowSeconds ( )

Show seconds not implemented yet.

Returns

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

Referenced by render().

240  {
241  return false;
242  }
+ Here is the caller graph for this function:

◆ getShowTime()

ilDateDurationInputGUI::getShowTime ( )

Get Show Time Information.

Returns
boolean Show Time Information

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

References $showtime.

Referenced by checkInput(), and render().

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

References $start.

Referenced by getValue(), and render().

+ Here is the caller graph for this function:

◆ getStartText()

ilDateDurationInputGUI::getStartText ( )

get start text

Returns

Definition at line 134 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 259 of file class.ilDateDurationInputGUI.php.

References $startyear.

Referenced by render().

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilDateDurationInputGUI::getTableFilterHTML ( )

Used for table filter presentation.

Returns
string

Implements ilTableFilterItem.

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

References render().

634  {
635  return $this->render();
636  }
+ 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 642 of file class.ilDateDurationInputGUI.php.

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

643  {
644  return array(
645  'start' => $this->getStart()->get(IL_CAL_UNIX),
646  'end' => $this->getEnd()->get(IL_CAL_UNIX)
647  );
648  }
const IL_CAL_UNIX
+ Here is the call graph for this function:

◆ insert()

ilDateDurationInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

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

References render().

621  {
622  $html = $this->render();
623 
624  $a_tpl->setCurrentBlock("prop_generic");
625  $a_tpl->setVariable("PROP_GENERIC", $html);
626  $a_tpl->parseCurrentBlock();
627  }
+ Here is the call graph for this function:

◆ render()

ilDateDurationInputGUI::render ( )

Insert property html.

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

References $ilUser, $lng, $tpl, ilCalendarUserSettings\_getInstance(), ilGlyphGUI\CALENDAR, enabledToggleFullTime(), ilGlyphGUI\get(), getActivationPostVar(), ilFormPropertyGUI\getDisabled(), getEnd(), getEndText(), getMinuteStepSize(), ilFormPropertyGUI\getPostVar(), getShowEmpty(), getShowSeconds(), getShowTime(), getStart(), getStartText(), getStartYear(), IL_CAL_FKT_GETDATE, IL_CAL_UNIX, ilCalendarUtil\initJSCalendar(), ilUtil\makeDateSelect(), ilUtil\makeTimeSelect(), setEnd(), and setStart().

Referenced by getTableFilterHTML(), and insert().

450  {
451  global $lng,$ilUser;
452 
453  $tpl = new ilTemplate("tpl.prop_datetime_duration.html", true, true, "Services/Form");
454 
455  // Init start
456  if(is_a($this->getStart(),'ilDate'))
457  {
458  $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE,'','UTC');
459  }
460  elseif(is_a($this->getStart(),'ilDateTime'))
461  {
462  $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
463  }
464  else
465  {
466  $this->setStart(new ilDateTime(time(), IL_CAL_UNIX));
467  $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
468  }
469  // display invalid input again
470  if(is_array($this->invalid_input['start']))
471  {
472  $start_info['year'] = $this->invalid_input['start']['y'];
473  $start_info['mon'] = $this->invalid_input['start']['m'];
474  $start_info['mday'] = $this->invalid_input['start']['d'];
475  }
476 
477  // Init end
478  if(is_a($this->getEnd(),'ilDate'))
479  {
480  $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE,'','UTC');
481  }
482  elseif(is_a($this->getEnd(),'ilDateTime'))
483  {
484  $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
485  }
486  else
487  {
488  $this->setEnd(new ilDateTime(time(), IL_CAL_UNIX));
489  $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
490  }
491  // display invalid input again
492  if(is_array($this->invalid_input['end']))
493  {
494  $end_info['year'] = $this->invalid_input['end']['y'];
495  $end_info['mon'] = $this->invalid_input['end']['m'];
496  $end_info['mday'] = $this->invalid_input['end']['d'];
497  }
498 
499  $lng->loadLanguageModule("jscalendar");
500  require_once("./Services/Calendar/classes/class.ilCalendarUtil.php");
502 
503  if(strlen($this->getActivationPostVar()))
504  {
505  $tpl->setCurrentBlock('prop_date_activation');
506  $tpl->setVariable('CHECK_ENABLED_DATE',$this->getActivationPostVar());
507  $tpl->setVariable('TXT_DATE_ENABLED',$this->activation_title);
508  $tpl->setVariable('CHECKED_ENABLED',$this->activation_checked ? 'checked="checked"' : '');
509  $tpl->setVariable('CHECKED_DISABLED',$this->getDisabled() ? 'disabled="disabled" ' : '');
510  $tpl->parseCurrentBlock();
511  }
512 
513  if(strlen($this->getStartText()))
514  {
515  $tpl->setVariable('TXT_START',$this->getStartText());
516  }
517  if(strlen($this->getEndText()))
518  {
519  $tpl->setVariable('TXT_END',$this->getEndText());
520  }
521 
522  // Toggle fullday
523  if($this->enabledToggleFullTime())
524  {
525  $tpl->setCurrentBlock('toggle_fullday');
526  $tpl->setVariable('FULLDAY_POSTVAR',$this->getPostVar());
527  $tpl->setVariable('FULLDAY_TOGGLE_NAME',$this->getPostVar().'[fulltime]');
528  $tpl->setVariable('FULLDAY_TOGGLE_CHECKED',$this->toggle_fulltime_checked ? 'checked="checked"' : '');
529  $tpl->setVariable('FULLDAY_TOGGLE_DISABLED',$this->getDisabled() ? 'disabled="disabled"' : '');
530  $tpl->setVariable('TXT_TOGGLE_FULLDAY',$this->toggle_fulltime_txt);
531  $tpl->parseCurrentBlock();
532  }
533 
534  $tpl->setVariable('POST_VAR',$this->getPostVar());
535  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
536  $tpl->setVariable("IMG_START_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar")));
537 
538  $tpl->setVariable("START_ID", $this->getPostVar());
539  $tpl->setVariable("DATE_ID_START", $this->getPostVar());
540 
541  $tpl->setVariable("INPUT_FIELDS_START", $this->getPostVar()."[start][date]");
542  include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
543  $tpl->setVariable('DATE_FIRST_DAY',ilCalendarUserSettings::_getInstance()->getWeekStart());
544  $tpl->setVariable("START_SELECT",
546  $this->getPostVar()."[start][date]",
547  $start_info['year'], $start_info['mon'], $start_info['mday'],
548  $this->getStartYear(),
549  true,
550  array(
551  'disabled' => $this->getDisabled(),
552  'select_attributes' => array('onchange' => 'ilUpdateEndDate();')
553  ),
554  $this->getShowEmpty()));
555 
556  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
557  $tpl->setVariable("IMG_END_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar")));
558 
559  $tpl->setVariable("END_ID", $this->getPostVar());
560  $tpl->setVariable("DATE_ID_END", $this->getPostVar());
561  $tpl->setVariable("INPUT_FIELDS_END", $this->getPostVar()."[end][date]");
562  $tpl->setVariable("END_SELECT",
564  $this->getPostVar()."[end][date]",
565  $end_info['year'], $end_info['mon'], $end_info['mday'],
566  $this->getStartYear(),
567  true,
568  array(
569  'disabled' => $this->getDisabled()
570  ),
571  $this->getShowEmpty()));
572 
573  if($this->getShowTime())
574  {
575  $tpl->setCurrentBlock("show_start_time");
576  $tpl->setVariable("START_TIME_SELECT",
578  $this->getPostVar()."[start][time]",
579  !$this->getShowSeconds(),
580  $start_info['hours'], $start_info['minutes'], $start_info['seconds'],
581  true,
582  array(
583  'minute_steps' => $this->getMinuteStepSize(),
584  'disabled' => $this->getDisabled(),
585  'select_attributes' => array('onchange' => 'ilUpdateEndDate();')
586  )
587  ));
588 
589  $tpl->setVariable("TXT_START_TIME", $this->getShowSeconds()
590  ? "(".$lng->txt("hh_mm_ss").")"
591  : "(".$lng->txt("hh_mm").")");
592  $tpl->parseCurrentBlock();
593 
594  $tpl->setCurrentBlock("show_end_time");
595  $tpl->setVariable("END_TIME_SELECT",
596  ilUtil::makeTimeSelect($this->getPostVar()."[end][time]", !$this->getShowSeconds(),
597  $end_info['hours'], $end_info['minutes'], $end_info['seconds'],
598  true,array('minute_steps' => $this->getMinuteStepSize(),
599  'disabled' => $this->getDisabled())));
600 
601  $tpl->setVariable("TXT_END_TIME", $this->getShowSeconds()
602  ? "(".$lng->txt("hh_mm_ss").")"
603  : "(".$lng->txt("hh_mm").")");
604  $tpl->parseCurrentBlock();
605  }
606 
607  if ($this->getShowTime())
608  {
609  $tpl->setVariable("DELIM", "<br />");
610  }
611 
612  return $tpl->get();
613  }
getShowSeconds()
Show seconds not implemented yet.
getShowEmpty()
Get Show Empty Information.
getPostVar()
Get Post Variable.
enabledToggleFullTime()
Check if toggling between date and time enabled.
static get($a_glyph, $a_text="")
Get glyph html.
const IL_CAL_UNIX
static makeTimeSelect($prefix, $short=true, $hour="", $minute="", $second="", $a_use_default=true, $a_further_options=array())
Creates a combination of HTML selects for time inputs.
getShowTime()
Get Show Time Information.
global $tpl
Definition: ilias.php:8
getMinuteStepSize()
Get minute step size.
static _getInstance()
get instance for logged in user
special template class to simplify handling of ITX/PEAR
Date and time handling
static makeDateSelect($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true, $a_further_options=array(), $emptyoption=false)
Creates a combination of HTML selects for date inputs.
const IL_CAL_FKT_GETDATE
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
setStart(ilDateTime $a_date)
Set start date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilD...
static initJSCalendar()
Init Javascript Calendar.
setEnd(ilDateTime $a_date)
Set end date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDat...
getActivationPostVar()
Get activation post var.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEnd()

ilDateDurationInputGUI::setEnd ( ilDateTime  $a_date)

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

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

180  {
181  $this->end = $a_date;
182  }
+ 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 144 of file class.ilDateDurationInputGUI.php.

145  {
146  $this->end_text = $a_txt;
147  }

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

273  {
274  $this->minute_step_size = $a_step_size;
275  }

◆ setShowEmpty()

ilDateDurationInputGUI::setShowEmpty (   $a_empty)

Set Show Empty Information.

Parameters
booleanShow Empty Information

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

200  {
201  $this->show_empty = $a_empty;
202  }

◆ setShowTime()

ilDateDurationInputGUI::setShowTime (   $a_showtime)

Set Show Time Information.

Parameters
boolean$a_showtimeShow Time Information

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

Referenced by ilObjTestSettingsGeneralGUI\addAvailabilityProperties(), ilObjPollGUI\initEditCustomForm(), ilObjPortfolioTemplateGUI\initEditCustomForm(), ilObjCourseGUI\initEditForm(), and ilObjSurveyGUI\initPropertiesForm().

221  {
222  $this->showtime = $a_showtime;
223  }
+ Here is the caller graph for this function:

◆ setStart()

ilDateDurationInputGUI::setStart ( ilDateTime  $a_date)

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

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

116  {
117  $this->start = $a_date;
118  }
+ 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 125 of file class.ilDateDurationInputGUI.php.

Referenced by ilChatroomFormFactory\applyValues(), ilCalendarAppointmentGUI\initForm(), ilObjSessionGUI\initForm(), ilObjGroupGUI\initForm(), and ilTermsOfServiceAcceptanceHistoryTableGUI\numericOrdering().

126  {
127  $this->start_text = $a_txt;
128  }
+ Here is the caller graph for this function:

◆ setStartYear()

ilDateDurationInputGUI::setStartYear (   $a_year)

Set start year.

Parameters
integerStart year

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

250  {
251  $this->startyear = $a_year;
252  }

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

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

657  {
658  if(is_array($value))
659  {
660  $this->setStart(new ilDateTime($value['start'], IL_CAL_UNIX));
661  $this->setEnd(new ilDateTime($value['end'], IL_CAL_UNIX));
662  }
663  }
const IL_CAL_UNIX
Date and time handling
setStart(ilDateTime $a_date)
Set start date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilD...
setEnd(ilDateTime $a_date)
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 293 of file class.ilDateDurationInputGUI.php.

References $ilUser, ilFormPropertyGUI\getPostVar(), ilSubEnabledFormPropertyGUI\getSubItems(), IL_CAL_DATE, IL_CAL_DATETIME, setEnd(), and setStart().

294  {
295  global $ilUser;
296 
297  try {
298  if(isset($a_values[$this->getPostVar()]['start']["time"]))
299  {
300  $this->setStart(new ilDateTime($a_values[$this->getPostVar()]['start']["date"].' '.$a_values[$this->getPostVar()]['start']["time"],
301  IL_CAL_DATETIME,$ilUser->getTimeZone()));
302  }
303  else
304  {
305  if (isset($a_values[$this->getPostVar()]['start']["date"]))
306  {
307  $this->setStart(new ilDate($a_values[$this->getPostVar()]['start']["date"],
308  IL_CAL_DATE));
309  }
310  }
311  if(isset($a_values[$this->getPostVar()]['end']["time"]))
312  {
313  $this->setEnd(new ilDateTime($a_values[$this->getPostVar()]['end']["date"].' '.$a_values[$this->getPostVar()]['end']["time"],
314  IL_CAL_DATETIME,$ilUser->getTimeZone()));
315  }
316  else
317  {
318  if (isset($a_values[$this->getPostVar()]['end']["date"]))
319  {
320  $this->setEnd(new ilDate($a_values[$this->getPostVar()]['end']["date"],
321  IL_CAL_DATE));
322  }
323  }
324  foreach($this->getSubItems() as $item)
325  {
326  $item->setValueByArray($a_values);
327  }
328  }
329  catch(ilDateTimeException $e)
330  {
331  // Nothing
332  }
333  }
const IL_CAL_DATETIME
getPostVar()
Get Post Variable.
Class for DateTime exceptions.
Class for single dates.
Date and time handling
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
setStart(ilDateTime $a_date)
Set start date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilD...
setEnd(ilDateTime $a_date)
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

◆ $activation_checked

ilDateDurationInputGUI::$activation_checked = true
protected

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

◆ $activation_post_var

ilDateDurationInputGUI::$activation_post_var = ''
protected

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

Referenced by getActivationPostVar().

◆ $activation_title

ilDateDurationInputGUI::$activation_title = ''
protected

Activation full day events.

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

◆ $end

ilDateDurationInputGUI::$end = null
protected

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

Referenced by getEnd().

◆ $end_text

ilDateDurationInputGUI::$end_text = ''
protected

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

Referenced by getEndText().

◆ $minute_step_size

ilDateDurationInputGUI::$minute_step_size = 5
protected

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

Referenced by getMinuteStepSize().

◆ $show_empty

ilDateDurationInputGUI::$show_empty = false
protected

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

Referenced by getShowEmpty().

◆ $showtime

ilDateDurationInputGUI::$showtime = false
protected

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

Referenced by getShowTime().

◆ $start

ilDateDurationInputGUI::$start = null
protected

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

Referenced by getStart().

◆ $start_text

ilDateDurationInputGUI::$start_text = ''
protected

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

Referenced by getStartText().

◆ $startyear

ilDateDurationInputGUI::$startyear = null
protected

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

Referenced by getStartYear().

◆ $toggle_fulltime

ilDateDurationInputGUI::$toggle_fulltime = false
protected

Toggle datetime.

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

Referenced by enabledToggleFullTime().

◆ $toggle_fulltime_checked

ilDateDurationInputGUI::$toggle_fulltime_checked = false
protected

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

◆ $toggle_fulltime_txt

ilDateDurationInputGUI::$toggle_fulltime_txt = ''
protected

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


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