ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables 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 ($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...
 
 setShowDate ($a_showdate)
 Set Show Date Information. More...
 
 getShowDate ()
 Get Show Date Information. 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...
 

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_date = true
 
 $show_empty = false
 
 $show_time = true
 
- 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 49 of file class.ilDateDurationInputGUI.php.

References ilFormPropertyGUI\setType().

50  {
51  parent::__construct($a_title, $a_postvar);
52  $this->setType("dateduration");
53  }
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 361 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().

362  {
363  global $lng,$ilUser;
364 
365  if($this->getDisabled())
366  {
367  return true;
368  }
369 
370 
371  $ok = true;
372 
373  // Start
374  $_POST[$this->getPostVar()]['start']["date"]["y"] =
375  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["date"]["y"]);
376  $_POST[$this->getPostVar()]['start']["date"]["m"] =
377  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["date"]["m"]);
378  $_POST[$this->getPostVar()]['start']["date"]["d"] =
379  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["date"]["d"]);
380  $_POST[$this->getPostVar()]['start']["time"]["h"] =
381  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["time"]["h"]);
382  $_POST[$this->getPostVar()]['start']["time"]["m"] =
383  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["time"]["m"]);
384  $_POST[$this->getPostVar()]['start']["time"]["s"] =
385  ilUtil::stripSlashes($_POST[$this->getPostVar()]['start']["time"]["s"]);
386 
387  // verify date
388  $dt['year'] = (int) $_POST[$this->getPostVar()]['start']['date']['y'];
389  $dt['mon'] = (int) $_POST[$this->getPostVar()]['start']['date']['m'];
390  $dt['mday'] = (int) $_POST[$this->getPostVar()]['start']['date']['d'];
391  $dt['hours'] = (int) $_POST[$this->getPostVar()]['start']['time']['h'];
392  $dt['minutes'] = (int) $_POST[$this->getPostVar()]['start']['time']['m'];
393  $dt['seconds'] = (int) $_POST[$this->getPostVar()]['start']['time']['s'];
394 
395 
396  if($this->getShowTime())
397  {
398  $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
399  }
400  else
401  {
402  $date = new ilDate($dt,IL_CAL_FKT_GETDATE);
403  }
404  if ($_POST[$this->getPostVar()]['start']["date"]["d"] != $date->get(IL_CAL_FKT_DATE,'d',$ilUser->getTimeZone()) ||
405  $_POST[$this->getPostVar()]['start']["date"]["m"] != $date->get(IL_CAL_FKT_DATE,'m',$ilUser->getTimeZone()) ||
406  $_POST[$this->getPostVar()]['start']["date"]["y"] != $date->get(IL_CAL_FKT_DATE,'Y',$ilUser->getTimeZone()))
407  {
408  // #11847
409  $this->invalid_input['start'] = $_POST[$this->getPostVar()]['start']["date"];
410  $this->setAlert($lng->txt("exc_date_not_valid"));
411  $ok = false;
412  }
413 
414  #$_POST[$this->getPostVar()]['start']['date'] = $date->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
415  #$_POST[$this->getPostVar()]['start']['time'] = $date->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
416 
417  $this->setStart($date);
418 
419  // End
420  $_POST[$this->getPostVar()]['end']["date"]["y"] =
421  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["date"]["y"]);
422  $_POST[$this->getPostVar()]['end']["date"]["m"] =
423  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["date"]["m"]);
424  $_POST[$this->getPostVar()]['end']["date"]["d"] =
425  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["date"]["d"]);
426  $_POST[$this->getPostVar()]['end']["time"]["h"] =
427  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["time"]["h"]);
428  $_POST[$this->getPostVar()]['end']["time"]["m"] =
429  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["time"]["m"]);
430  $_POST[$this->getPostVar()]['end']["time"]["s"] =
431  ilUtil::stripSlashes($_POST[$this->getPostVar()]['end']["time"]["s"]);
432 
433  // verify date
434  $dt['year'] = (int) $_POST[$this->getPostVar()]['end']['date']['y'];
435  $dt['mon'] = (int) $_POST[$this->getPostVar()]['end']['date']['m'];
436  $dt['mday'] = (int) $_POST[$this->getPostVar()]['end']['date']['d'];
437  $dt['hours'] = (int) $_POST[$this->getPostVar()]['end']['time']['h'];
438  $dt['minutes'] = (int) $_POST[$this->getPostVar()]['end']['time']['m'];
439  $dt['seconds'] = (int) $_POST[$this->getPostVar()]['end']['time']['s'];
440 
441  if($this->getShowTime())
442  {
443  $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
444  }
445  else
446  {
447  $date = new ilDate($dt,IL_CAL_FKT_GETDATE);
448  }
449  if ($_POST[$this->getPostVar()]['end']["date"]["d"] != $date->get(IL_CAL_FKT_DATE,'d',$ilUser->getTimeZone()) ||
450  $_POST[$this->getPostVar()]['end']["date"]["m"] != $date->get(IL_CAL_FKT_DATE,'m',$ilUser->getTimeZone()) ||
451  $_POST[$this->getPostVar()]['end']["date"]["y"] != $date->get(IL_CAL_FKT_DATE,'Y',$ilUser->getTimeZone()))
452  {
453  $this->invalid_input['end'] = $_POST[$this->getPostVar()]['end']["date"];
454  $this->setAlert($lng->txt("exc_date_not_valid"));
455  $ok = false;
456  }
457 
458  #$_POST[$this->getPostVar()]['end']['date'] = $date->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
459  #$_POST[$this->getPostVar()]['end']['time'] = $date->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
460 
461  $this->setEnd($date);
462 
463  return $ok;
464  }
$_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 65 of file class.ilDateDurationInputGUI.php.

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

◆ enabledToggleFullTime()

ilDateDurationInputGUI::enabledToggleFullTime ( )

Check if toggling between date and time enabled.

Returns

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

References $toggle_fulltime.

Referenced by render().

90  {
92  }
+ 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 78 of file class.ilDateDurationInputGUI.php.

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

◆ getActivationPostVar()

ilDateDurationInputGUI::getActivationPostVar ( )

Get activation post var.

public

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

References $end.

Referenced by getValue(), and render().

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

◆ getEndText()

ilDateDurationInputGUI::getEndText ( )

Get end text.

Returns

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

References $minute_step_size.

Referenced by render().

+ Here is the caller graph for this function:

◆ getShowDate()

ilDateDurationInputGUI::getShowDate ( )

Get Show Date Information.

Returns
boolean Show Date Information

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

Referenced by render().

211  {
212  return $this->showdate;
213  }
+ Here is the caller graph for this function:

◆ getShowEmpty()

ilDateDurationInputGUI::getShowEmpty ( )

Get Show Empty Information.

Returns
boolean Show Empty Information

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

Referenced by render().

261  {
262  return false;
263  }
+ Here is the caller graph for this function:

◆ getShowTime()

ilDateDurationInputGUI::getShowTime ( )

Get Show Time Information.

Returns
boolean Show Time Information

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

Referenced by checkInput(), and render().

252  {
253  return $this->showtime;
254  }
+ 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 164 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 135 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 280 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 655 of file class.ilDateDurationInputGUI.php.

References render().

656  {
657  return $this->render();
658  }
+ 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 664 of file class.ilDateDurationInputGUI.php.

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

665  {
666  return array(
667  'start' => $this->getStart()->get(IL_CAL_UNIX),
668  'end' => $this->getEnd()->get(IL_CAL_UNIX)
669  );
670  }
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 642 of file class.ilDateDurationInputGUI.php.

References render().

643  {
644  $html = $this->render();
645 
646  $a_tpl->setCurrentBlock("prop_generic");
647  $a_tpl->setVariable("PROP_GENERIC", $html);
648  $a_tpl->parseCurrentBlock();
649  }
+ Here is the call graph for this function:

◆ render()

ilDateDurationInputGUI::render ( )

Insert property html.

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

References $ilUser, $lng, $tpl, ilCalendarUserSettings\_getInstance(), enabledToggleFullTime(), getActivationPostVar(), ilFormPropertyGUI\getDisabled(), getEnd(), getEndText(), ilUtil\getImagePath(), getMinuteStepSize(), ilFormPropertyGUI\getPostVar(), getShowDate(), 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().

471  {
472  global $lng,$ilUser;
473 
474  $tpl = new ilTemplate("tpl.prop_datetime_duration.html", true, true, "Services/Form");
475 
476  // Init start
477  if(is_a($this->getStart(),'ilDate'))
478  {
479  $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE,'','UTC');
480  }
481  elseif(is_a($this->getStart(),'ilDateTime'))
482  {
483  $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
484  }
485  else
486  {
487  $this->setStart(new ilDateTime(time(), IL_CAL_UNIX));
488  $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
489  }
490  // display invalid input again
491  if(is_array($this->invalid_input['start']))
492  {
493  $start_info['year'] = $this->invalid_input['start']['y'];
494  $start_info['mon'] = $this->invalid_input['start']['m'];
495  $start_info['mday'] = $this->invalid_input['start']['d'];
496  }
497 
498  // Init end
499  if(is_a($this->getEnd(),'ilDate'))
500  {
501  $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE,'','UTC');
502  }
503  elseif(is_a($this->getEnd(),'ilDateTime'))
504  {
505  $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
506  }
507  else
508  {
509  $this->setEnd(new ilDateTime(time(), IL_CAL_UNIX));
510  $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
511  }
512  // display invalid input again
513  if(is_array($this->invalid_input['end']))
514  {
515  $end_info['year'] = $this->invalid_input['end']['y'];
516  $end_info['mon'] = $this->invalid_input['end']['m'];
517  $end_info['mday'] = $this->invalid_input['end']['d'];
518  }
519 
520  $lng->loadLanguageModule("jscalendar");
521  require_once("./Services/Calendar/classes/class.ilCalendarUtil.php");
523 
524  if(strlen($this->getActivationPostVar()))
525  {
526  $tpl->setCurrentBlock('prop_date_activation');
527  $tpl->setVariable('CHECK_ENABLED_DATE',$this->getActivationPostVar());
528  $tpl->setVariable('TXT_DATE_ENABLED',$this->activation_title);
529  $tpl->setVariable('CHECKED_ENABLED',$this->activation_checked ? 'checked="checked"' : '');
530  $tpl->setVariable('CHECKED_DISABLED',$this->getDisabled() ? 'disabled="disabled" ' : '');
531  $tpl->parseCurrentBlock();
532  }
533 
534  if(strlen($this->getStartText()))
535  {
536  $tpl->setVariable('TXT_START',$this->getStartText());
537  }
538  if(strlen($this->getEndText()))
539  {
540  $tpl->setVariable('TXT_END',$this->getEndText());
541  }
542 
543  // Toggle fullday
544  if($this->enabledToggleFullTime())
545  {
546  $tpl->setCurrentBlock('toggle_fullday');
547  $tpl->setVariable('FULLDAY_POSTVAR',$this->getPostVar());
548  $tpl->setVariable('FULLDAY_TOGGLE_NAME',$this->getPostVar().'[fulltime]');
549  $tpl->setVariable('FULLDAY_TOGGLE_CHECKED',$this->toggle_fulltime_checked ? 'checked="checked"' : '');
550  $tpl->setVariable('FULLDAY_TOGGLE_DISABLED',$this->getDisabled() ? 'disabled="disabled"' : '');
551  $tpl->setVariable('TXT_TOGGLE_FULLDAY',$this->toggle_fulltime_txt);
552  $tpl->parseCurrentBlock();
553  }
554 
555 
556  if ($this->getShowDate() or 1)
557  {
558  $tpl->setVariable('POST_VAR',$this->getPostVar());
559  $tpl->setVariable("IMG_START_CALENDAR", ilUtil::getImagePath("calendar.png"));
560  $tpl->setVariable("TXT_START_CALENDAR", $lng->txt("open_calendar"));
561  $tpl->setVariable("START_ID", $this->getPostVar());
562  $tpl->setVariable("DATE_ID_START", $this->getPostVar());
563 
564  $tpl->setVariable("INPUT_FIELDS_START", $this->getPostVar()."[start][date]");
565  include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
566  $tpl->setVariable('DATE_FIRST_DAY',ilCalendarUserSettings::_getInstance()->getWeekStart());
567  $tpl->setVariable("START_SELECT",
569  $this->getPostVar()."[start][date]",
570  $start_info['year'], $start_info['mon'], $start_info['mday'],
571  $this->getStartYear(),
572  true,
573  array(
574  'disabled' => $this->getDisabled(),
575  'select_attributes' => array('onchange' => 'ilUpdateEndDate();')
576  ),
577  $this->getShowEmpty()));
578 
579  $tpl->setVariable("IMG_END_CALENDAR", ilUtil::getImagePath("calendar.png"));
580  $tpl->setVariable("TXT_END_CALENDAR", $lng->txt("open_calendar"));
581  $tpl->setVariable("END_ID", $this->getPostVar());
582  $tpl->setVariable("DATE_ID_END", $this->getPostVar());
583  $tpl->setVariable("INPUT_FIELDS_END", $this->getPostVar()."[end][date]");
584  $tpl->setVariable("END_SELECT",
586  $this->getPostVar()."[end][date]",
587  $end_info['year'], $end_info['mon'], $end_info['mday'],
588  $this->getStartYear(),
589  true,
590  array(
591  'disabled' => $this->getDisabled()
592  ),
593  $this->getShowEmpty()));
594  }
595  if($this->getShowTime())
596  {
597  $tpl->setCurrentBlock("show_start_time");
598  $tpl->setVariable("START_TIME_SELECT",
600  $this->getPostVar()."[start][time]",
601  !$this->getShowSeconds(),
602  $start_info['hours'], $start_info['minutes'], $start_info['seconds'],
603  true,
604  array(
605  'minute_steps' => $this->getMinuteStepSize(),
606  'disabled' => $this->getDisabled(),
607  'select_attributes' => array('onchange' => 'ilUpdateEndDate();')
608  )
609  ));
610 
611  $tpl->setVariable("TXT_START_TIME", $this->getShowSeconds()
612  ? "(".$lng->txt("hh_mm_ss").")"
613  : "(".$lng->txt("hh_mm").")");
614  $tpl->parseCurrentBlock();
615 
616  $tpl->setCurrentBlock("show_end_time");
617  $tpl->setVariable("END_TIME_SELECT",
618  ilUtil::makeTimeSelect($this->getPostVar()."[end][time]", !$this->getShowSeconds(),
619  $end_info['hours'], $end_info['minutes'], $end_info['seconds'],
620  true,array('minute_steps' => $this->getMinuteStepSize(),
621  'disabled' => $this->getDisabled())));
622 
623  $tpl->setVariable("TXT_END_TIME", $this->getShowSeconds()
624  ? "(".$lng->txt("hh_mm_ss").")"
625  : "(".$lng->txt("hh_mm").")");
626  $tpl->parseCurrentBlock();
627  }
628 
629  if ($this->getShowTime() && $this->getShowDate())
630  {
631  $tpl->setVariable("DELIM", "<br />");
632  }
633 
634  return $tpl->get();
635  }
getShowSeconds()
Show seconds not implemented yet.
getShowEmpty()
Get Show Empty Information.
getPostVar()
Get Post Variable.
enabledToggleFullTime()
Check if toggling between date and time enabled.
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.
getMinuteStepSize()
Get minute step size.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _getInstance()
get instance for logged in user
special template class to simplify handling of ITX/PEAR
Date and time handling
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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.
getShowDate()
Get Show Date Information.
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 180 of file class.ilDateDurationInputGUI.php.

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

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

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

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

294  {
295  $this->minute_step_size = $a_step_size;
296  }

◆ setShowDate()

ilDateDurationInputGUI::setShowDate (   $a_showdate)

Set Show Date Information.

Parameters
boolean$a_showdateShow Date Information

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

201  {
202  $this->showdate = $a_showdate;
203  }

◆ setShowEmpty()

ilDateDurationInputGUI::setShowEmpty (   $a_empty)

Set Show Empty Information.

Parameters
booleanShow Empty Information

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

221  {
222  $this->show_empty = $a_empty;
223  }

◆ setShowTime()

ilDateDurationInputGUI::setShowTime (   $a_showtime)

Set Show Time Information.

Parameters
boolean$a_showtimeShow Time Information

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

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

242  {
243  $this->showtime = $a_showtime;
244  }
+ 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 116 of file class.ilDateDurationInputGUI.php.

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

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

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

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

◆ setStartYear()

ilDateDurationInputGUI::setStartYear (   $a_year)

Set start year.

Parameters
integerStart year

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

271  {
272  $this->startyear = $a_year;
273  }

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

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

679  {
680  if(is_array($value))
681  {
682  $this->setStart(new ilDateTime($value['start'], IL_CAL_UNIX));
683  $this->setEnd(new ilDateTime($value['end'], IL_CAL_UNIX));
684  }
685  }
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 314 of file class.ilDateDurationInputGUI.php.

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

315  {
316  global $ilUser;
317 
318  try {
319  if(isset($a_values[$this->getPostVar()]['start']["time"]))
320  {
321  $this->setStart(new ilDateTime($a_values[$this->getPostVar()]['start']["date"].' '.$a_values[$this->getPostVar()]['start']["time"],
322  IL_CAL_DATETIME,$ilUser->getTimeZone()));
323  }
324  else
325  {
326  if (isset($a_values[$this->getPostVar()]['start']["date"]))
327  {
328  $this->setStart(new ilDate($a_values[$this->getPostVar()]['start']["date"],
329  IL_CAL_DATE));
330  }
331  }
332  if(isset($a_values[$this->getPostVar()]['end']["time"]))
333  {
334  $this->setEnd(new ilDateTime($a_values[$this->getPostVar()]['end']["date"].' '.$a_values[$this->getPostVar()]['end']["time"],
335  IL_CAL_DATETIME,$ilUser->getTimeZone()));
336  }
337  else
338  {
339  if (isset($a_values[$this->getPostVar()]['end']["date"]))
340  {
341  $this->setEnd(new ilDate($a_values[$this->getPostVar()]['end']["date"],
342  IL_CAL_DATE));
343  }
344  }
345  foreach($this->getSubItems() as $item)
346  {
347  $item->setValueByArray($a_values);
348  }
349  }
350  catch(ilDateTimeException $e)
351  {
352  // Nothing
353  }
354  }
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_date

ilDateDurationInputGUI::$show_date = true
protected

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

◆ $show_empty

ilDateDurationInputGUI::$show_empty = false
protected

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

Referenced by getShowEmpty().

◆ $show_time

ilDateDurationInputGUI::$show_time = true
protected

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

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