ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDateTimeInputGUI Class Reference

This class represents a date/time property in a property form. More...

+ Inheritance diagram for ilDateTimeInputGUI:
+ Collaboration diagram for ilDateTimeInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setMode ($mode)
 Set Display Mode. More...
 
 getMode ()
 Get Display Mode. More...
 
 enableDateActivation ($a_title, $a_postvar, $a_checked=true)
 Enable date activation. More...
 
 getActivationPostVar ()
 Get activation post var. More...
 
 setDate (ilDateTime $a_date=NULL)
 set 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...
 
 getDate ()
 Get Date, yyyy-mm-dd. More...
 
 setShowDate ($a_showdate)
 Set Show Date Information. More...
 
 getShowDate ()
 Get Show Date Information. More...
 
 setShowTime ($a_showtime)
 Set Show Time Information. More...
 
 getShowTime ()
 Get Show Time Information. More...
 
 setShowEmpty ($a_empty)
 Set Show Empty Information. More...
 
 getShowEmpty ()
 Get Show Empty Information. 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...
 
 setShowSeconds ($a_showseconds)
 Set Show Seconds. More...
 
 getShowSeconds ()
 Get Show Seconds. 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 ()
 Get HTML for table filter. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 getPostValueForComparison ()
 parse post value to make it comparable More...
 
 getToolbarHTML ()
 Get HTML for toolbar. 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...
 

Data Fields

const MODE_SELECT = 1
 
const MODE_INPUT = 2
 

Protected Attributes

 $mode = null
 
 $date_obj = null
 
 $date
 
 $showdate = true
 
 $time = "00:00:00"
 
 $showtime = false
 
 $showseconds = false
 
 $minute_step_size = 1
 
 $show_empty = false
 
 $startyear = ''
 
 $activation_title = ''
 
 $activation_post_var = ''
 
- 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

This class represents a date/time property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilDateTimeInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References setMode(), and ilFormPropertyGUI\setType().

38  {
39  parent::__construct($a_title, $a_postvar);
40  $this->setType("datetime");
41  $this->setMode(self::MODE_SELECT);
42  }
setMode($mode)
Set Display Mode.
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilDateTimeInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

References $_POST, $date, $ilUser, $lng, $time, ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, ilFormPropertyGUI\getDisabled(), getMode(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getShowSeconds(), getShowTime(), IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, ilFormPropertyGUI\setAlert(), setDate(), ilUtil\stripSlashes(), and ilCalendarSettings\TIME_FORMAT_12.

289  {
290  global $ilUser, $lng;
291 
292  if ($this->getDisabled())
293  {
294  return true;
295  }
296 
297  $post = $_POST[$this->getPostVar()];
298 
299  // empty date valid with input field
300  if(!$this->getRequired() && $this->getMode() == self::MODE_INPUT && $post["date"] == "")
301  {
302  return true;
303  }
304 
305  if($this->getMode() == self::MODE_SELECT)
306  {
307  $post["date"]["y"] = ilUtil::stripSlashes($post["date"]["y"]);
308  $post["date"]["m"] = ilUtil::stripSlashes($post["date"]["m"]);
309  $post["date"]["d"] = ilUtil::stripSlashes($post["date"]["d"]);
310  $dt['year'] = (int) $post['date']['y'];
311  $dt['mon'] = (int) $post['date']['m'];
312  $dt['mday'] = (int) $post['date']['d'];
313 
314  if($this->getShowTime())
315  {
316  $post["time"]["h"] = ilUtil::stripSlashes($post["time"]["h"]);
317  $post["time"]["m"] = ilUtil::stripSlashes($post["time"]["m"]);
318  $post["time"]["s"] = ilUtil::stripSlashes($post["time"]["s"]);
319  $dt['hours'] = (int) $post['time']['h'];
320  $dt['minutes'] = (int) $post['time']['m'];
321  $dt['seconds'] = (int) $post['time']['s'];
322  }
323  }
324  else
325  {
326  $post["date"] = ilUtil::stripSlashes($post["date"]);
327  $post["time"] = ilUtil::stripSlashes($post["time"]);
328 
329  if($post["date"])
330  {
331  switch($ilUser->getDateFormat())
332  {
334  $date = explode(".", $post["date"]);
335  $dt['mday'] = (int)$date[0];
336  $dt['mon'] = (int)$date[1];
337  $dt['year'] = (int)$date[2];
338  break;
339 
341  $date = explode("-", $post["date"]);
342  $dt['mday'] = (int)$date[2];
343  $dt['mon'] = (int)$date[1];
344  $dt['year'] = (int)$date[0];
345  break;
346 
348  $date = explode("/", $post["date"]);
349  $dt['mday'] = (int)$date[1];
350  $dt['mon'] = (int)$date[0];
351  $dt['year'] = (int)$date[2];
352  break;
353  }
354 
355  if($this->getShowTime())
356  {
357  if($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
358  {
359  $seconds = "";
360  if($this->getShowSeconds())
361  {
362  $seconds = ":\s*([0-9]{1,2})\s*";
363  }
364  if(preg_match("/([0-9]{1,2})\s*:\s*([0-9]{1,2})\s*".$seconds."(am|pm)/", trim(strtolower($post["time"])), $matches))
365  {
366  $dt['hours'] = (int)$matches[1];
367  $dt['minutes'] = (int)$matches[2];
368  if($seconds)
369  {
370  $dt['seconds'] = (int)$time[2];
371  $ampm = $matches[4];
372  }
373  else
374  {
375  $dt['seconds'] = 0;
376  $ampm = $matches[3];
377  }
378  if($dt['hours'] == 12)
379  {
380  if($ampm == "am")
381  {
382  $dt['hours'] = 0;
383  }
384  }
385  else if($ampm == "pm")
386  {
387  $dt['hours'] += 12;
388  }
389  }
390  }
391  else
392  {
393  $time = explode(":", $post["time"]);
394  $dt['hours'] = (int)$time[0];
395  $dt['minutes'] = (int)$time[1];
396  $dt['seconds'] = (int)$time[2];
397  }
398  }
399  }
400  }
401 
402  // very basic validation
403  if($dt['mday'] == 0 || $dt['mon'] == 0 || $dt['year'] == 0 || $dt['mday'] > 31 || $dt['mon'] > 12)
404  {
405  $dt = false;
406  }
407  else if($this->getShowTime() && ($dt['hours'] > 23 || $dt['minutes'] > 59 || $dt['seconds'] > 59))
408  {
409  $dt = false;
410  }
411 
412  // #11847
413  if(!checkdate($dt['mon'], $dt['mday'], $dt['year']))
414  {
415  $this->invalid_input = $_POST[$this->getPostVar()]['date'];
416  $this->setAlert($lng->txt("exc_date_not_valid"));
417  $dt = false;
418  }
419 
420  $date = new ilDateTime($dt, IL_CAL_FKT_GETDATE, $ilUser->getTimeZone());
421  $this->setDate($date);
422 
423  // post values used to be overwritten anyways - cannot change behaviour
424  $_POST[$this->getPostVar()]['date'] = $date->get(IL_CAL_FKT_DATE, 'Y-m-d', $ilUser->getTimeZone());
425  $_POST[$this->getPostVar()]['time'] = $date->get(IL_CAL_FKT_DATE, 'H:i:s', $ilUser->getTimeZone());
426 
427  return (bool)$dt;
428  }
$_POST['username']
Definition: cron.php:12
getPostVar()
Get Post Variable.
setDate(ilDateTime $a_date=NULL)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
setAlert($a_alert)
Set Alert Text.
getMode()
Get Display Mode.
getShowTime()
Get Show Time Information.
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
getShowSeconds()
Get Show Seconds.
const IL_CAL_FKT_GETDATE
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ enableDateActivation()

ilDateTimeInputGUI::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 77 of file class.ilDateTimeInputGUI.php.

Referenced by ilObjSurveyGUI\initPropertiesForm().

78  {
79  $this->activation_title = $a_title;
80  $this->activation_post_var = $a_postvar;
81  $this->activation_checked = $a_checked;
82  }
+ Here is the caller graph for this function:

◆ getActivationPostVar()

ilDateTimeInputGUI::getActivationPostVar ( )

Get activation post var.

public

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

References $activation_post_var.

Referenced by ilBirthdayInputGUI\render(), and render().

+ Here is the caller graph for this function:

◆ getDate()

ilDateTimeInputGUI::getDate ( )

Get Date, yyyy-mm-dd.

Returns
object Date, yyyy-mm-dd

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

References $date.

Referenced by ilBirthdayInputGUI\render(), render(), and serializeData().

117  {
118  return $this->date;
119  }
+ Here is the caller graph for this function:

◆ getMinuteStepSize()

ilDateTimeInputGUI::getMinuteStepSize ( )

Get minute step size.

public

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

References $minute_step_size.

Referenced by render().

221  {
223  }
+ Here is the caller graph for this function:

◆ getMode()

ilDateTimeInputGUI::getMode ( )

Get Display Mode.

Returns
int

Definition at line 62 of file class.ilDateTimeInputGUI.php.

References $mode.

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

63  {
64  return $this->mode;
65  }
+ Here is the caller graph for this function:

◆ getPostValueForComparison()

ilDateTimeInputGUI::getPostValueForComparison ( )

parse post value to make it comparable

used by combination input gui

Definition at line 666 of file class.ilDateTimeInputGUI.php.

References $_POST, and ilFormPropertyGUI\getPostVar().

667  {
668  return trim($_POST[$this->getPostVar()]["date"]." ". $_POST[$this->getPostVar()]["time"]);
669  }
$_POST['username']
Definition: cron.php:12
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:

◆ getShowDate()

ilDateTimeInputGUI::getShowDate ( )

Get Show Date Information.

Returns
boolean Show Date Information

Definition at line 136 of file class.ilDateTimeInputGUI.php.

References $showdate.

Referenced by ilBirthdayInputGUI\render(), and render().

137  {
138  return $this->showdate;
139  }
+ Here is the caller graph for this function:

◆ getShowEmpty()

ilDateTimeInputGUI::getShowEmpty ( )

Get Show Empty Information.

Returns
boolean Show Empty Information

Definition at line 176 of file class.ilDateTimeInputGUI.php.

References $show_empty.

Referenced by ilBirthdayInputGUI\render(), and render().

177  {
178  return $this->show_empty;
179  }
+ Here is the caller graph for this function:

◆ getShowSeconds()

ilDateTimeInputGUI::getShowSeconds ( )

Get Show Seconds.

Returns
boolean Show Seconds

Definition at line 242 of file class.ilDateTimeInputGUI.php.

References $showseconds.

Referenced by checkInput(), and render().

243  {
244  return $this->showseconds;
245  }
+ Here is the caller graph for this function:

◆ getShowTime()

ilDateTimeInputGUI::getShowTime ( )

Get Show Time Information.

Returns
boolean Show Time Information

Definition at line 156 of file class.ilDateTimeInputGUI.php.

References $showtime.

Referenced by checkInput(), and render().

157  {
158  return $this->showtime;
159  }
+ Here is the caller graph for this function:

◆ getStartYear()

ilDateTimeInputGUI::getStartYear ( )

Get start year.

Returns
integer Start year

Definition at line 196 of file class.ilDateTimeInputGUI.php.

References $startyear.

197  {
198  return $this->startyear;
199  }

◆ getTableFilterHTML()

ilDateTimeInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

Definition at line 634 of file class.ilDateTimeInputGUI.php.

References render().

635  {
636  $html = $this->render();
637  return $html;
638  }
render()
Insert property html.
+ Here is the call graph for this function:

◆ getToolbarHTML()

ilDateTimeInputGUI::getToolbarHTML ( )

Get HTML for toolbar.

Implements ilToolbarItem.

Definition at line 674 of file class.ilDateTimeInputGUI.php.

References render().

675  {
676  $html = $this->render("toolbar");
677  return $html;
678  }
render()
Insert property html.
+ Here is the call graph for this function:

◆ insert()

ilDateTimeInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 622 of file class.ilDateTimeInputGUI.php.

References render().

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

◆ render()

ilDateTimeInputGUI::render ( )

Insert property html.

Definition at line 434 of file class.ilDateTimeInputGUI.php.

References $ilUser, $lng, $tpl, ilCalendarUserSettings\_getInstance(), ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, getActivationPostVar(), getDate(), ilFormPropertyGUI\getDisabled(), ilUtil\getImagePath(), getMinuteStepSize(), getMode(), ilFormPropertyGUI\getPostVar(), getShowDate(), getShowEmpty(), getShowSeconds(), getShowTime(), IL_CAL_DATETIME, IL_CAL_FKT_GETDATE, IL_CAL_UNIX, ilCalendarUtil\initJSCalendar(), ilUtil\makeDateSelect(), ilUtil\makeTimeSelect(), setDate(), and ilCalendarSettings\TIME_FORMAT_12.

Referenced by getTableFilterHTML(), getToolbarHTML(), and insert().

435  {
436  global $lng,$ilUser;
437 
438  $tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form");
439 
440  $lng->loadLanguageModule("jscalendar");
441  require_once("./Services/Calendar/classes/class.ilCalendarUtil.php");
443 
444  if(strlen($this->getActivationPostVar()))
445  {
446  $tpl->setCurrentBlock('prop_date_activation');
447  $tpl->setVariable('CHECK_ENABLED_DATE',$this->getActivationPostVar());
448  $tpl->setVariable('TXT_DATE_ENABLED',$this->activation_title);
449  $tpl->setVariable('CHECKED_ENABLED',$this->activation_checked ? 'checked="checked"' : '');
450  $tpl->setVariable('CHECKED_DISABLED',$this->getDisabled() ? 'disabled="disabled" ' : '');
451  $tpl->parseCurrentBlock();
452  }
453 
454  if($this->getMode() == self::MODE_SELECT)
455  {
456  if(is_a($this->getDate(),'ilDate'))
457  {
458  $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'','UTC');
459  }
460  elseif(is_a($this->getDate(),'ilDateTime'))
461  {
462  $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
463  }
464  else
465  {
466  $this->setDate(new ilDateTime(time(), IL_CAL_UNIX));
467  $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
468  }
469 
470  // display invalid input again
471  if(is_array($this->invalid_input))
472  {
473  $date_info['year'] = $this->invalid_input['y'];
474  $date_info['mon'] = $this->invalid_input['m'];
475  $date_info['mday'] = $this->invalid_input['d'];
476  }
477  }
478 
479  if ($this->getShowDate())
480  {
481  if($this->getMode() == self::MODE_SELECT)
482  {
483  $tpl->setCurrentBlock("prop_date_input_select_setup");
484  $tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar()."[date]");
485  $tpl->parseCurrentBlock();
486 
487  $tpl->setCurrentBlock("prop_date");
488  $tpl->setVariable("DATE_SELECT",
489  ilUtil::makeDateSelect($this->getPostVar()."[date]", $date_info['year'], $date_info['mon'], $date_info['mday'],
490  $this->startyear,true,array('disabled' => $this->getDisabled()), $this->getShowEmpty()));
491  }
492  else
493  {
494  $value = $this->getDate();
495  if($value)
496  {
497  $value = substr($this->getDate()->get(IL_CAL_DATETIME), 0, 10);
498  $day = substr($value, 8, 2);
499  $month = substr($value, 5, 2);
500  $year = substr($value, 0, 4);
501  }
502 
503  switch($ilUser->getDateFormat())
504  {
506  if($value)
507  {
508  $value = date("d.m.Y", mktime(0, 0, 0, $month, $day, $year));
509  }
510  $format = "%d.%m.%Y";
511  $input_hint = $lng->txt("dd_mm_yyyy");
512  break;
513 
515  if($value)
516  {
517  $value = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year));
518  }
519  $format = "%Y-%m-%d";
520  $input_hint = $lng->txt("yyyy_mm_dd");
521  break;
522 
524  if($value)
525  {
526  $value = date("m/d/Y", mktime(0, 0, 0, $month, $day, $year));
527  }
528  $format = "%m/%d/%Y";
529  $input_hint = $lng->txt("mm_dd_yyyy");
530  break;
531  }
532 
533  $tpl->setCurrentBlock("prop_date_input_field");
534  $tpl->setVariable("DATE_ID", $this->getPostVar());
535  $tpl->setVariable("DATE_VALUE", $value);
536  $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : "");
537  $tpl->parseCurrentBlock();
538 
539  $tpl->setCurrentBlock("prop_date_input_field_info");
540  $tpl->setVariable("TXT_INPUT_FORMAT", $input_hint);
541  $tpl->parseCurrentBlock();
542 
543  $tpl->setCurrentBlock("prop_date_input_field_setup");
544  $tpl->setVariable("DATE_ID", $this->getPostVar());
545  $tpl->setVariable("DATE_FIELD_FORMAT", $format);
546  $tpl->parseCurrentBlock();
547  }
548 
549  $tpl->setCurrentBlock("prop_date");
550  $tpl->setVariable("IMG_DATE_CALENDAR", ilUtil::getImagePath("calendar.png"));
551  $tpl->setVariable("TXT_DATE_CALENDAR", $lng->txt("open_calendar"));
552  $tpl->setVariable("DATE_ID", $this->getPostVar());
553 
554  include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
555  $tpl->setVariable('DATE_FIRST_DAY',ilCalendarUserSettings::_getInstance()->getWeekStart());
556 
557  $tpl->parseCurrentBlock();
558  }
559  if($this->getShowTime())
560  {
561  if($this->getMode() == self::MODE_INPUT)
562  {
563  $value = $this->getDate();
564  if($value)
565  {
566  if(!$this->getShowSeconds())
567  {
568  $value = substr($value->get(IL_CAL_DATETIME), 11, 5);
569  if($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
570  {
571  $value = date("g:ia", mktime(substr($value, 0, 2), substr($value, 3, 2)));
572  }
573  }
574  else
575  {
576  $value = substr($value->get(IL_CAL_DATETIME), 11, 8);
577  if($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
578  {
579  $value = date("g:i:sa", mktime(substr($value, 0, 2), substr($value, 3, 2), substr($value, 6, 2)));
580  }
581  }
582  }
583 
584  $tpl->setCurrentBlock("prop_time_input_field");
585  $tpl->setVariable("DATE_ID", $this->getPostVar());
586  $tpl->setVariable("TIME_VALUE", $value);
587  $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : "");
588  $tpl->parseCurrentBlock();
589  }
590 
591  $tpl->setCurrentBlock("prop_time");
592 
593  if($this->getMode() == self::MODE_SELECT)
594  {
595  $tpl->setVariable("TIME_SELECT",
596  ilUtil::makeTimeSelect($this->getPostVar()."[time]", !$this->getShowSeconds(),
597  $date_info['hours'], $date_info['minutes'], $date_info['seconds'],
598  true,array('minute_steps' => $this->getMinuteStepSize(),
599  'disabled' => $this->getDisabled())));
600  }
601 
602  $tpl->setVariable("TXT_TIME", $this->getShowSeconds()
603  ? "(".$lng->txt("hh_mm_ss").")"
604  : "(".$lng->txt("hh_mm").")");
605 
606  $tpl->parseCurrentBlock();
607  }
608 
609  if ($this->getShowTime() && $this->getShowDate() && $this->getMode() == self::MODE_SELECT)
610  {
611  $tpl->setVariable("DELIM", "<br />");
612  }
613 
614  return $tpl->get();
615  }
const IL_CAL_DATETIME
getActivationPostVar()
Get activation post var.
getPostVar()
Get Post Variable.
getDate()
Get Date, yyyy-mm-dd.
getMinuteStepSize()
Get minute step size.
const IL_CAL_UNIX
setDate(ilDateTime $a_date=NULL)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
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.
getMode()
Get Display Mode.
getShowTime()
Get Show Time Information.
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
getShowSeconds()
Get Show Seconds.
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.
getShowEmpty()
Get Show Empty Information.
const IL_CAL_FKT_GETDATE
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
getShowDate()
Get Show Date Information.
static initJSCalendar()
Init Javascript Calendar.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeData()

ilDateTimeInputGUI::serializeData ( )

serialize data

Definition at line 643 of file class.ilDateTimeInputGUI.php.

References getDate().

644  {
645  return serialize($this->getDate());
646  }
getDate()
Get Date, yyyy-mm-dd.
+ Here is the call graph for this function:

◆ setDate()

ilDateTimeInputGUI::setDate ( ilDateTime  $a_date = NULL)

set 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 106 of file class.ilDateTimeInputGUI.php.

Referenced by ilObjRemoteCourseGUI\addCustomEditForm(), ilObjRemoteGroupGUI\addCustomEditForm(), ilObjRemoteTestGUI\addCustomEditForm(), ilBirthdayInputGUI\checkInput(), checkInput(), ilECSSettingsGUI\initCategoryMappingForm(), ilUserTableGUI\initFilter(), ilCalendarAppointmentGUI\initForm(), ilNewsForContextBlockGUI\initSettingsForm(), ilSessionStatisticsGUI\long(), ilSessionStatisticsGUI\periodic(), render(), ilBirthdayInputGUI\setValueByArray(), setValueByArray(), ilSessionStatisticsGUI\short(), and unserializeData().

107  {
108  $this->date = $a_date;
109  }
+ Here is the caller graph for this function:

◆ setMinuteStepSize()

ilDateTimeInputGUI::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 209 of file class.ilDateTimeInputGUI.php.

210  {
211  $this->minute_step_size = $a_step_size;
212  }

◆ setMode()

ilDateTimeInputGUI::setMode (   $mode)

Set Display Mode.

Parameters
int$modeDisplay Mode

Definition at line 49 of file class.ilDateTimeInputGUI.php.

References $mode.

Referenced by __construct().

50  {
51  if(in_array($mode, array(self::MODE_INPUT, self::MODE_SELECT)))
52  {
53  $this->mode = $mode;
54  }
55  }
+ Here is the caller graph for this function:

◆ setShowDate()

ilDateTimeInputGUI::setShowDate (   $a_showdate)

Set Show Date Information.

Parameters
boolean$a_showdateShow Date Information

Definition at line 126 of file class.ilDateTimeInputGUI.php.

Referenced by ilObjAssessmentFolderGUI\logsObject().

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

◆ setShowEmpty()

ilDateTimeInputGUI::setShowEmpty (   $a_empty)

Set Show Empty Information.

Parameters
booleanShow Empty Information

Definition at line 166 of file class.ilDateTimeInputGUI.php.

167  {
168  $this->show_empty = $a_empty;
169  }

◆ setShowSeconds()

ilDateTimeInputGUI::setShowSeconds (   $a_showseconds)

Set Show Seconds.

Parameters
boolean$a_showsecondsShow Seconds

Definition at line 232 of file class.ilDateTimeInputGUI.php.

233  {
234  $this->showseconds = $a_showseconds;
235  }

◆ setShowTime()

ilDateTimeInputGUI::setShowTime (   $a_showtime)

Set Show Time Information.

Parameters
boolean$a_showtimeShow Time Information

Definition at line 146 of file class.ilDateTimeInputGUI.php.

Referenced by ilObjUserFolderGUI\initAccessRestrictionForm(), ilPageObjectGUI\initActivationForm(), ilObjExerciseGUI\initAssignmentForm(), ilDataCollectionTableEditGUI\initForm(), ilObjUserGUI\initForm(), ilObjectActivationGUI\initFormEdit(), ilObjSearchSettingsGUI\initFormLuceneSettings(), and ilConsultationHoursGUI\initFormSequence().

147  {
148  $this->showtime = $a_showtime;
149  }
+ Here is the caller graph for this function:

◆ setStartYear()

ilDateTimeInputGUI::setStartYear (   $a_year)

Set start year.

Parameters
integerStart year

Definition at line 186 of file class.ilDateTimeInputGUI.php.

Referenced by ilDataCollectionDatatype\getInputField().

187  {
188  $this->startyear = $a_year;
189  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilDateTimeInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 252 of file class.ilDateTimeInputGUI.php.

References $ilUser, getMode(), ilFormPropertyGUI\getPostVar(), ilSubEnabledFormPropertyGUI\getSubItems(), IL_CAL_DATE, IL_CAL_DATETIME, and setDate().

253  {
254  global $ilUser;
255 
256  if($this->getMode() == self::MODE_INPUT &&
257  (!isset($a_values[$this->getPostVar()]["date"]) || $a_values[$this->getPostVar()]["date"] == ""))
258  {
259  $this->date = NULL;
260  }
261  else if(isset($a_values[$this->getPostVar()]["time"]))
262  {
263  $this->setDate(new ilDateTime($a_values[$this->getPostVar()]["date"].' '.$a_values[$this->getPostVar()]["time"],
264  IL_CAL_DATETIME,$ilUser->getTimeZone()));
265  }
266  else if (isset($a_values[$this->getPostVar()]["date"]))
267  {
268  $this->setDate(new ilDate($a_values[$this->getPostVar()]["date"],
269  IL_CAL_DATE));
270  }
271 
272  if($this->activation_post_var)
273  {
274  $this->activation_checked = (bool)$a_values[$this->activation_post_var];
275  }
276 
277  foreach($this->getSubItems() as $item)
278  {
279  $item->setValueByArray($a_values);
280  }
281  }
const IL_CAL_DATETIME
getPostVar()
Get Post Variable.
setDate(ilDateTime $a_date=NULL)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
getMode()
Get Display Mode.
Class for single dates.
Date and time handling
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ unserializeData()

ilDateTimeInputGUI::unserializeData (   $a_data)

unserialize data

Definition at line 651 of file class.ilDateTimeInputGUI.php.

References $data, and setDate().

652  {
653  $data = unserialize($a_data);
654 
655  if (is_object($data))
656  {
657  $this->setDate($data);
658  }
659  }
setDate(ilDateTime $a_date=NULL)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:

Field Documentation

◆ $activation_post_var

ilDateTimeInputGUI::$activation_post_var = ''
protected

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

Referenced by getActivationPostVar().

◆ $activation_title

ilDateTimeInputGUI::$activation_title = ''
protected

Definition at line 25 of file class.ilDateTimeInputGUI.php.

◆ $date

ilDateTimeInputGUI::$date
protected

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

Referenced by ilBirthdayInputGUI\checkInput(), checkInput(), and getDate().

◆ $date_obj

ilDateTimeInputGUI::$date_obj = null
protected

Definition at line 15 of file class.ilDateTimeInputGUI.php.

◆ $minute_step_size

ilDateTimeInputGUI::$minute_step_size = 1
protected

Definition at line 21 of file class.ilDateTimeInputGUI.php.

Referenced by getMinuteStepSize().

◆ $mode

ilDateTimeInputGUI::$mode = null
protected

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

Referenced by getMode(), and setMode().

◆ $show_empty

ilDateTimeInputGUI::$show_empty = false
protected

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

Referenced by getShowEmpty().

◆ $showdate

ilDateTimeInputGUI::$showdate = true
protected

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

Referenced by getShowDate().

◆ $showseconds

ilDateTimeInputGUI::$showseconds = false
protected

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

Referenced by getShowSeconds().

◆ $showtime

ilDateTimeInputGUI::$showtime = false
protected

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

Referenced by getShowTime().

◆ $startyear

ilDateTimeInputGUI::$startyear = ''
protected

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

Referenced by getStartYear().

◆ $time

ilDateTimeInputGUI::$time = "00:00:00"
protected

Definition at line 18 of file class.ilDateTimeInputGUI.php.

Referenced by checkInput().

◆ MODE_INPUT

const ilDateTimeInputGUI::MODE_INPUT = 2

◆ MODE_SELECT

const ilDateTimeInputGUI::MODE_SELECT = 1

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