ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 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... minutes. 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Data Fields

const MODE_SELECT = 1
 
const MODE_INPUT = 2
 

Protected Attributes

 $mode = null
 
 $date_obj = null
 
 $date
 
 $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

Reimplemented from ilFormPropertyGUI.

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

37 {
38 parent::__construct($a_title, $a_postvar);
39 $this->setType("datetime");
40 $this->setMode(self::MODE_SELECT);
41 }
setMode($mode)
Set Display Mode.
setType($a_type)
Set Type.

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

+ 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

Reimplemented from ilFormPropertyGUI.

Reimplemented in ilBirthdayInputGUI.

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

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

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.

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

@access public

Parameters
stringtext displayed after the checkbox
stringname of postvar
boolcheckbox checked

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

77 {
78 $this->activation_title = $a_title;
79 $this->activation_post_var = $a_postvar;
80 $this->activation_checked = $a_checked;
81 }

◆ getActivationPostVar()

ilDateTimeInputGUI::getActivationPostVar ( )

Get activation post var.

@access public

Definition at line 89 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 115 of file class.ilDateTimeInputGUI.php.

116 {
117 return $this->date;
118 }

References $date.

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

+ Here is the caller graph for this function:

◆ getMinuteStepSize()

ilDateTimeInputGUI::getMinuteStepSize ( )

Get minute step size.

@access public

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

References $minute_step_size.

Referenced by render().

+ Here is the caller graph for this function:

◆ getMode()

ilDateTimeInputGUI::getMode ( )

Get Display Mode.

Returns
int

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

References $mode.

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

+ 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 673 of file class.ilDateTimeInputGUI.php.

674 {
675 return trim($_POST[$this->getPostVar()]["date"]." ". $_POST[$this->getPostVar()]["time"]);
676 }

References $_POST, and ilFormPropertyGUI\getPostVar().

+ Here is the call graph for this function:

◆ getShowEmpty()

ilDateTimeInputGUI::getShowEmpty ( )

Get Show Empty Information.

Returns
boolean Show Empty Information

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

References $show_empty.

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

+ Here is the caller graph for this function:

◆ getShowSeconds()

ilDateTimeInputGUI::getShowSeconds ( )

Get Show Seconds.

Returns
boolean Show Seconds

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

References $showseconds.

Referenced by checkInput(), and render().

+ Here is the caller graph for this function:

◆ getShowTime()

ilDateTimeInputGUI::getShowTime ( )

Get Show Time Information.

Returns
boolean Show Time Information

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

References $showtime.

Referenced by checkInput(), and render().

+ Here is the caller graph for this function:

◆ getStartYear()

ilDateTimeInputGUI::getStartYear ( )

Get start year.

Returns
integer Start year

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

References $startyear.

◆ getTableFilterHTML()

ilDateTimeInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

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

642 {
643 $html = $this->render();
644 return $html;
645 }
render()
Insert property html.
$html
Definition: example_001.php:87

References $html, and render().

+ Here is the call graph for this function:

◆ getToolbarHTML()

ilDateTimeInputGUI::getToolbarHTML ( )

Get HTML for toolbar.

Implements ilToolbarItem.

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

682 {
683 $html = $this->render("toolbar");
684 return $html;
685 }

References $html, and render().

+ Here is the call graph for this function:

◆ insert()

ilDateTimeInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

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

630 {
631 $html = $this->render();
632
633 $a_tpl->setCurrentBlock("prop_generic");
634 $a_tpl->setVariable("PROP_GENERIC", $html);
635 $a_tpl->parseCurrentBlock();
636 }

References $html, and render().

+ Here is the call graph for this function:

◆ render()

ilDateTimeInputGUI::render ( )

Insert property html.

Reimplemented in ilBirthdayInputGUI.

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

422 {
423 global $lng,$ilUser;
424
425 $tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form");
426
427 $lng->loadLanguageModule("jscalendar");
428 require_once("./Services/Calendar/classes/class.ilCalendarUtil.php");
430
431 if(strlen($this->getActivationPostVar()))
432 {
433 if(!$this->activation_checked)
434 {
435 $tpl->setCurrentBlock('sub_form_hide');
436 $tpl->setVariable('DSFID',$this->getFieldId());
437 $tpl->parseCurrentBlock();
438 }
439
440 if($this->getInfo())
441 {
442 $tpl->setCurrentBlock('activation_description');
443 $tpl->setVariable('ACT_DESCRIPTION',$this->getInfo());
444 $tpl->parseCurrentBlock();
445
446 // disable standard info block
447 $this->setInfo(null);
448 }
449
450 $tpl->setCurrentBlock('prop_date_activation');
451 $tpl->setVariable('LAB_ID',$this->getFieldId());
452 $tpl->setVariable('SFID',$this->getFieldId());
453 $tpl->setVariable('CHECK_ENABLED_DATE',$this->getActivationPostVar());
454 $tpl->setVariable('TXT_DATE_ENABLED',$this->activation_title);
455 $tpl->setVariable('CHECKED_ENABLED',$this->activation_checked ? 'checked="checked"' : '');
456 $tpl->setVariable('CHECKED_DISABLED',$this->getDisabled() ? 'disabled="disabled" ' : '');
457 $tpl->parseCurrentBlock();
458
459 $tpl->touchBlock('prop_date_activation_out');
460 }
461
462 if($this->getMode() == self::MODE_SELECT)
463 {
464 if(is_a($this->getDate(),'ilDate'))
465 {
466 $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'','UTC');
467 }
468 elseif(is_a($this->getDate(),'ilDateTime'))
469 {
470 $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
471 }
472 else
473 {
474 $this->setDate(new ilDateTime(time(), IL_CAL_UNIX));
475 $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
476 }
477
478 // display invalid input again
479 if(is_array($this->invalid_input))
480 {
481 $date_info['year'] = $this->invalid_input['y'];
482 $date_info['mon'] = $this->invalid_input['m'];
483 $date_info['mday'] = $this->invalid_input['d'];
484 }
485 }
486
487 if($this->getMode() == self::MODE_SELECT)
488 {
489 $tpl->setCurrentBlock("prop_date_input_select_setup");
490 $tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar()."[date]");
491 $tpl->parseCurrentBlock();
492
493 $tpl->setCurrentBlock("prop_date");
494 $tpl->setVariable("DATE_SELECT",
495 ilUtil::makeDateSelect($this->getPostVar()."[date]", $date_info['year'], $date_info['mon'], $date_info['mday'],
496 $this->startyear,true,array('disabled' => $this->getDisabled()), $this->getShowEmpty()));
497 }
498 else
499 {
500 $value = $this->getDate();
501 if($value)
502 {
503 $value = substr($this->getDate()->get(IL_CAL_DATETIME), 0, 10);
504 $day = substr($value, 8, 2);
505 $month = substr($value, 5, 2);
506 $year = substr($value, 0, 4);
507 }
508
509 switch($ilUser->getDateFormat())
510 {
512 if($value)
513 {
514 $value = date("d.m.Y", mktime(0, 0, 0, $month, $day, $year));
515 }
516 $format = "%d.%m.%Y";
517 $input_hint = $lng->txt("dd_mm_yyyy");
518 break;
519
521 if($value)
522 {
523 $value = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year));
524 }
525 $format = "%Y-%m-%d";
526 $input_hint = $lng->txt("yyyy_mm_dd");
527 break;
528
530 if($value)
531 {
532 $value = date("m/d/Y", mktime(0, 0, 0, $month, $day, $year));
533 }
534 $format = "%m/%d/%Y";
535 $input_hint = $lng->txt("mm_dd_yyyy");
536 break;
537 }
538
539 // #17232
540 if($this->invalid_input)
541 {
542 $value = $this->invalid_input;
543 }
544
545 $tpl->setCurrentBlock("prop_date_input_field");
546 $tpl->setVariable("DATE_ID", $this->getPostVar());
547 $tpl->setVariable("DATE_VALUE", $value);
548 $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : "");
549 $tpl->parseCurrentBlock();
550
551 $tpl->setCurrentBlock("prop_date_input_field_info");
552 $tpl->setVariable("TXT_INPUT_FORMAT", $input_hint);
553 $tpl->parseCurrentBlock();
554
555 $tpl->setCurrentBlock("prop_date_input_field_setup");
556 $tpl->setVariable("DATE_ID", $this->getPostVar());
557 $tpl->setVariable("DATE_FIELD_FORMAT", $format);
558 $tpl->parseCurrentBlock();
559 }
560
561 $tpl->setCurrentBlock("prop_date");
562 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
563 $tpl->setVariable("IMG_DATE_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar")));
564 $tpl->setVariable("DATE_ID", $this->getPostVar());
565
566 include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
567 $tpl->setVariable('DATE_FIRST_DAY',ilCalendarUserSettings::_getInstance()->getWeekStart());
568
569 $tpl->parseCurrentBlock();
570
571 if($this->getShowTime())
572 {
573 if($this->getMode() == self::MODE_INPUT)
574 {
575 $value = $this->getDate();
576 if($value)
577 {
578 if(!$this->getShowSeconds())
579 {
580 $value = substr($value->get(IL_CAL_DATETIME), 11, 5);
581 if($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
582 {
583 $value = date("g:ia", mktime(substr($value, 0, 2), substr($value, 3, 2)));
584 }
585 }
586 else
587 {
588 $value = substr($value->get(IL_CAL_DATETIME), 11, 8);
589 if($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
590 {
591 $value = date("g:i:sa", mktime(substr($value, 0, 2), substr($value, 3, 2), substr($value, 6, 2)));
592 }
593 }
594 }
595
596 $tpl->setCurrentBlock("prop_time_input_field");
597 $tpl->setVariable("DATE_ID", $this->getPostVar());
598 $tpl->setVariable("TIME_VALUE", $value);
599 $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : "");
600 $tpl->parseCurrentBlock();
601 }
602
603 $tpl->setCurrentBlock("prop_time");
604
605 if($this->getMode() == self::MODE_SELECT)
606 {
607 $tpl->setVariable("TIME_SELECT",
608 ilUtil::makeTimeSelect($this->getPostVar()."[time]", !$this->getShowSeconds(),
609 $date_info['hours'], $date_info['minutes'], $date_info['seconds'],
610 true,array('minute_steps' => $this->getMinuteStepSize(),
611 'disabled' => $this->getDisabled())));
612 }
613
614 $tpl->setVariable("TXT_TIME", $this->getShowSeconds()
615 ? "(".$lng->txt("hh_mm_ss").")"
616 : "(".$lng->txt("hh_mm").")");
617
618 $tpl->parseCurrentBlock();
619 }
620
621 return $tpl->get();
622 }
global $tpl
Definition: ilias.php:8
const IL_CAL_UNIX
const IL_CAL_DATETIME
static _getInstance()
get instance for logged in user
static initJSCalendar()
Init Javascript Calendar.
getShowEmpty()
Get Show Empty Information.
getMinuteStepSize()
Get minute step size.
getActivationPostVar()
Get activation post var.
getDate()
Get Date, yyyy-mm-dd.
getInfo()
Get Information Text.
setInfo($a_info)
Set Information Text.
getFieldId()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
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.
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.

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeData()

ilDateTimeInputGUI::serializeData ( )

serialize data

Reimplemented from ilFormPropertyGUI.

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

651 {
652 return serialize($this->getDate());
653 }

References getDate().

+ 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 105 of file class.ilDateTimeInputGUI.php.

106 {
107 $this->date = $a_date;
108 }

Referenced by ilBirthdayInputGUI\checkInput(), checkInput(), render(), ilBirthdayInputGUI\setValueByArray(), setValueByArray(), and unserializeData().

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

@access public

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

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

189 {
190 $this->minute_step_size = $a_step_size;
191 }

◆ setMode()

ilDateTimeInputGUI::setMode (   $mode)

Set Display Mode.

Parameters
int$modeDisplay Mode

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

49 {
50 if(in_array($mode, array(self::MODE_INPUT, self::MODE_SELECT)))
51 {
52 $this->mode = $mode;
53 }
54 }

References $mode.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setShowEmpty()

ilDateTimeInputGUI::setShowEmpty (   $a_empty)

Set Show Empty Information.

Parameters
booleanShow Empty Information

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

146 {
147 $this->show_empty = $a_empty;
148 }

◆ setShowSeconds()

ilDateTimeInputGUI::setShowSeconds (   $a_showseconds)

Set Show Seconds.

Parameters
boolean$a_showsecondsShow Seconds

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

212 {
213 $this->showseconds = $a_showseconds;
214 }

◆ setShowTime()

ilDateTimeInputGUI::setShowTime (   $a_showtime)

Set Show Time Information.

Parameters
boolean$a_showtimeShow Time Information

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

126 {
127 $this->showtime = $a_showtime;
128 }

◆ setStartYear()

ilDateTimeInputGUI::setStartYear (   $a_year)

Set start year.

Parameters
integerStart year

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

166 {
167 $this->startyear = $a_year;
168 }

◆ setValueByArray()

ilDateTimeInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Reimplemented in ilBirthdayInputGUI.

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

232 {
233 global $ilUser;
234
235 if($this->getMode() == self::MODE_INPUT &&
236 (!isset($a_values[$this->getPostVar()]["date"]) || $a_values[$this->getPostVar()]["date"] == ""))
237 {
238 $this->date = NULL;
239 }
240 else if(isset($a_values[$this->getPostVar()]["time"]))
241 {
242 $this->setDate(new ilDateTime($a_values[$this->getPostVar()]["date"].' '.$a_values[$this->getPostVar()]["time"],
243 IL_CAL_DATETIME,$ilUser->getTimeZone()));
244 }
245 else if (isset($a_values[$this->getPostVar()]["date"]))
246 {
247 $this->setDate(new ilDate($a_values[$this->getPostVar()]["date"],
248 IL_CAL_DATE));
249 }
250
251 if($this->activation_post_var)
252 {
253 $this->activation_checked = (bool)$a_values[$this->activation_post_var];
254 }
255
256 foreach($this->getSubItems() as $item)
257 {
258 $item->setValueByArray($a_values);
259 }
260 }
const IL_CAL_DATE

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

+ Here is the call graph for this function:

◆ unserializeData()

ilDateTimeInputGUI::unserializeData (   $a_data)

unserialize data

Reimplemented from ilFormPropertyGUI.

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

659 {
660 $data = unserialize($a_data);
661
662 if (is_object($data))
663 {
664 $this->setDate($data);
665 }
666 }
$data

References $data, and setDate().

+ Here is the call graph for this function:

Field Documentation

◆ $activation_post_var

ilDateTimeInputGUI::$activation_post_var = ''
protected

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

Referenced by getActivationPostVar().

◆ $activation_title

ilDateTimeInputGUI::$activation_title = ''
protected

Definition at line 24 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 20 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 21 of file class.ilDateTimeInputGUI.php.

Referenced by getShowEmpty().

◆ $showseconds

ilDateTimeInputGUI::$showseconds = false
protected

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

Referenced by getShowSeconds().

◆ $showtime

ilDateTimeInputGUI::$showtime = false
protected

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

Referenced by getShowTime().

◆ $startyear

ilDateTimeInputGUI::$startyear = ''
protected

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

Referenced by getStartYear().

◆ $time

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

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

Referenced by checkInput().

◆ MODE_INPUT

◆ MODE_SELECT


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