ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups 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.
 enableDateActivation ($a_title, $a_postvar, $a_checked=true)
 Enable date activation.
 getActivationPostVar ()
 Get activation post var.
 setDate (ilDateTime $a_date)
 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));
 getDate ()
 Get Date, yyyy-mm-dd.
 setShowDate ($a_showdate)
 Set Show Date Information.
 getShowDate ()
 Get Show Date Information.
 setShowTime ($a_showtime)
 Set Show Time Information.
 getShowTime ()
 Get Show Time Information.
 setMinuteStepSize ($a_step_size)
 Set minute step size E.g 5 => The selection will only show 00,05,10...
 getMinuteStepSize ()
 Get minute step size.
 setShowSeconds ($a_showseconds)
 Set Show Seconds.
 getShowSeconds ()
 Get Show Seconds.
 setValueByArray ($a_values)
 Set value by array.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 setSubformMode ($a_subformmode)
 Set Subform Mode.
 getSubformMode ()
 Get Subform Mode.
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
- Public Member Functions inherited from ilFormPropertyGUI
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setPostVar ($a_postvar)
 Set Post Variable.
 getPostVar ()
 Get Post Variable.
 getFieldId ()
 Get Post Variable.
 setInfo ($a_info)
 Set Information Text.
 getInfo ()
 Get Information Text.
 setAlert ($a_alert)
 Set Alert Text.
 getAlert ()
 Get Alert Text.
 setRequired ($a_required)
 Set Required.
 getRequired ()
 Get Required.
 setDisabled ($a_disabled)
 Set Disabled.
 getDisabled ()
 Get Disabled.

Protected Attributes

 $date_obj = null
 $date
 $showdate = true
 $time = "00:00:00"
 $showtime = false
 $showseconds = false
 $minute_step_size = 1
 $activation_title = ''
 $activation_post_var = ''
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 $subformmode = "bottom"
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type.

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

References ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("datetime");
}

+ Here is the call graph for this function:

Member Function Documentation

ilDateTimeInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

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

References $date, $lng, $ok, $timestamp, ilFormPropertyGUI\getPostVar(), IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, IL_CAL_UNIX, ilFormPropertyGUI\setAlert(), setDate(), and ilUtil\stripSlashes().

{
global $lng,$ilUser;
$ok = true;
$_POST[$this->getPostVar()]["date"]["y"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["y"]);
$_POST[$this->getPostVar()]["date"]["m"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["m"]);
$_POST[$this->getPostVar()]["date"]["d"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["d"]);
$_POST[$this->getPostVar()]["time"]["h"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["h"]);
$_POST[$this->getPostVar()]["time"]["m"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["m"]);
$_POST[$this->getPostVar()]["time"]["s"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["s"]);
// verify date
$dt['year'] = (int) $_POST[$this->getPostVar()]['date']['y'];
$dt['mon'] = (int) $_POST[$this->getPostVar()]['date']['m'];
$dt['mday'] = (int) $_POST[$this->getPostVar()]['date']['d'];
$dt['hours'] = (int) $_POST[$this->getPostVar()]['time']['h'];
$dt['minutes'] = (int) $_POST[$this->getPostVar()]['time']['m'];
$dt['seconds'] = (int) $_POST[$this->getPostVar()]['time']['s'];
$date = new ilDateTime($dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
if ($_POST[$this->getPostVar()]["date"]["d"] != $date->get(IL_CAL_FKT_DATE,'d',$ilUser->getTimeZone()) ||
$_POST[$this->getPostVar()]["date"]["m"] != $date->get(IL_CAL_FKT_DATE,'m',$ilUser->getTimeZone()) ||
$_POST[$this->getPostVar()]["date"]["y"] != $date->get(IL_CAL_FKT_DATE,'Y',$ilUser->getTimeZone()))
{
$this->setAlert($lng->txt("exc_date_not_valid"));
$ok = false;
}
$_POST[$this->getPostVar()]['date'] = $date->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
$_POST[$this->getPostVar()]['time'] = $date->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
/*
$_POST[$this->getPostVar()]["time"] =
str_pad($_POST[$this->getPostVar()]["time"]["h"], 2 , "0", STR_PAD_LEFT).":".
str_pad($_POST[$this->getPostVar()]["time"]["m"], 2 , "0", STR_PAD_LEFT).":".
str_pad($_POST[$this->getPostVar()]["time"]["s"], 2 , "0", STR_PAD_LEFT);
$_POST[$this->getPostVar()]["date"] =
str_pad($_POST[$this->getPostVar()]["date"]["y"], 4 , "0", STR_PAD_LEFT)."-".
str_pad($_POST[$this->getPostVar()]["date"]["m"], 2 , "0", STR_PAD_LEFT)."-".
str_pad($_POST[$this->getPostVar()]["date"]["d"], 2 , "0", STR_PAD_LEFT);
*/
$this->setDate($date);
return $ok;
}

+ Here is the call graph for this function:

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

{
$this->activation_title = $a_title;
$this->activation_post_var = $a_postvar;
$this->activation_checked = $a_checked;
}
ilDateTimeInputGUI::getActivationPostVar ( )

Get activation post var.

public

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

References $activation_post_var.

Referenced by insert().

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getDate ( )

Get Date, yyyy-mm-dd.

Returns
object Date, yyyy-mm-dd

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

References $date.

Referenced by insert().

{
return $this->date;
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getMinuteStepSize ( )

Get minute step size.

public

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

References $minute_step_size.

Referenced by insert().

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getShowDate ( )

Get Show Date Information.

Returns
boolean Show Date Information

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

References $showdate.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getShowSeconds ( )

Get Show Seconds.

Returns
boolean Show Seconds

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

References $showseconds.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getShowTime ( )

Get Show Time Information.

Returns
boolean Show Time Information

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

References $showtime.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::insert ( $a_tpl)

Insert property html.

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

References $lng, getActivationPostVar(), getDate(), ilFormPropertyGUI\getDisabled(), ilUtil\getImagePath(), getMinuteStepSize(), ilFormPropertyGUI\getPostVar(), getShowDate(), getShowSeconds(), getShowTime(), IL_CAL_FKT_GETDATE, IL_CAL_UNIX, ilCalendarUtil\initJSCalendar(), ilUtil\makeDateSelect(), ilUtil\makeTimeSelect(), and setDate().

{
global $lng,$ilUser;
if(is_a($this->getDate(),'ilDate'))
{
$date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'','UTC');
}
elseif(is_a($this->getDate(),'ilDateTime'))
{
$date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
}
else
{
$this->setDate(new ilDateTime(time(), IL_CAL_UNIX));
$date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
//$date_info = getdate(time());
}
$lng->loadLanguageModule("jscalendar");
require_once("./Services/Calendar/classes/class.ilCalendarUtil.php");
if(strlen($this->getActivationPostVar()))
{
$a_tpl->setCurrentBlock('prop_date_activation');
$a_tpl->setVariable('CHECK_ENABLED_DATE',$this->getActivationPostVar());
$a_tpl->setVariable('TXT_DATE_ENABLED',$this->activation_title);
$a_tpl->setVariable('CHECKED_ENABLED',$this->activation_checked ? 'checked="checked"' : '');
$a_tpl->setVariable('CHECKED_DISABLED',$this->getDisabled() ? 'disabled="disabled" ' : '');
$a_tpl->parseCurrentBlock();
}
if ($this->getShowDate())
{
$a_tpl->setCurrentBlock("prop_date");
$a_tpl->setVariable("IMG_DATE_CALENDAR", ilUtil::getImagePath("calendar.png"));
$a_tpl->setVariable("TXT_DATE_CALENDAR", $lng->txt("open_calendar"));
$a_tpl->setVariable("DATE_ID", $this->getPostVar());
$a_tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar()."[date]");
$a_tpl->setVariable("DATE_SELECT",
ilUtil::makeDateSelect($this->getPostVar()."[date]", $date_info['year'], $date_info['mon'], $date_info['mday'],
'',true,array('disabled' => $this->getDisabled())));
$a_tpl->parseCurrentBlock();
}
if($this->getShowTime())
{
$a_tpl->setCurrentBlock("prop_time");
#$time = explode(":", $this->getTime());
$a_tpl->setVariable("TIME_SELECT",
ilUtil::makeTimeSelect($this->getPostVar()."[time]", !$this->getShowSeconds(),
$date_info['hours'], $date_info['minutes'], $date_info['seconds'],
true,array('minute_steps' => $this->getMinuteStepSize(),
'disabled' => $this->getDisabled())));
$a_tpl->setVariable("TXT_TIME", $this->getShowSeconds()
? "(".$lng->txt("hh_mm_ss").")"
: "(".$lng->txt("hh_mm").")");
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("prop_datetime");
if ($this->getShowTime() && $this->getShowDate())
{
$a_tpl->setVariable("DELIM", "<br />");
}
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilDateTimeInputGUI::setDate ( ilDateTime  $a_date)

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

Referenced by checkInput(), ilObjRemoteCourseGUI\initEditTable(), ilCalendarAppointmentGUI\initForm(), ilNewsForContextBlockGUI\initSettingsForm(), insert(), and setValueByArray().

{
$this->date = $a_date;
}

+ Here is the caller graph for this function:

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

Referenced by ilObjSessionGUI\initForm().

{
$this->minute_step_size = $a_step_size;
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::setShowDate (   $a_showdate)

Set Show Date Information.

Parameters
boolean$a_showdateShow Date Information

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

{
$this->showdate = $a_showdate;
}
ilDateTimeInputGUI::setShowSeconds (   $a_showseconds)

Set Show Seconds.

Parameters
boolean$a_showsecondsShow Seconds

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

{
$this->showseconds = $a_showseconds;
}
ilDateTimeInputGUI::setShowTime (   $a_showtime)

Set Show Time Information.

Parameters
boolean$a_showtimeShow Time Information

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

Referenced by ilObjCourseGUI\initForm(), ilObjUserGUI\initForm(), ilObjGroupGUI\initForm(), ilCourseItemAdministrationGUI\initFormEdit(), and ilObjExerciseGUI\initPropertiesForm().

{
$this->showtime = $a_showtime;
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

{
global $ilUser;
if(isset($a_values[$this->getPostVar()]["time"]))
{
$this->setDate(new ilDateTime($a_values[$this->getPostVar()]["date"].' '.$a_values[$this->getPostVar()]["time"],
IL_CAL_DATETIME,$ilUser->getTimeZone()));
}
else
{
$this->setDate(new ilDate($a_values[$this->getPostVar()]["date"],
}
foreach($this->getSubItems() as $item)
{
$item->setValueByArray($a_values);
}
}

+ Here is the call graph for this function:

Field Documentation

ilDateTimeInputGUI::$activation_post_var = ''
protected

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

Referenced by getActivationPostVar().

ilDateTimeInputGUI::$activation_title = ''
protected

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

ilDateTimeInputGUI::$date
protected

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

Referenced by checkInput(), and getDate().

ilDateTimeInputGUI::$date_obj = null
protected

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

ilDateTimeInputGUI::$minute_step_size = 1
protected

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

Referenced by getMinuteStepSize().

ilDateTimeInputGUI::$showdate = true
protected

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

Referenced by getShowDate().

ilDateTimeInputGUI::$showseconds = false
protected

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

Referenced by getShowSeconds().

ilDateTimeInputGUI::$showtime = false
protected

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

Referenced by getShowTime().

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

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


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