ILIAS  Release_4_0_x_branch Revision 61816
 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.
 setShowEmpty ($a_empty)
 Set Show Empty Information.
 getShowEmpty ()
 Get Show Empty Information.
 setStartYear ($a_year)
 Set start year.
 getStartYear ()
 Get start year.
 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.
 render ()
 Insert property html.
 insert (&$a_tpl)
 Insert property html.
 getTableFilterHTML ()
 Get HTML for table filter.
 serializeData ()
 serialize data
 unserializeData ($a_data)
 unserialize data
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
 getItemByPostVar ($a_post_var)
 Get item by post var.
- Public Member Functions inherited from ilFormPropertyGUI
executeCommand ()
 Execute command.
 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.
 setParentForm ($a_parentform)
 Set Parent Form.
 getParentForm ()
 Get Parent Form.
 setParent ($a_val)
 Set Parent GUI object.
 getParent ()
 Get Parent GUI object.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 writeToSession ()
 Write to session.
 clearFromSession ()
 Clear session value.
 readFromSession ()
 Read from session.
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties)

Protected Attributes

 $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

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 11 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 32 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.

Reimplemented in ilBirthdayInputGUI.

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

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

{
global $lng,$ilUser;
$ok = true;
if (!$this->getDisabled())
{
$_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 48 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 61 of file class.ilDateTimeInputGUI.php.

References $activation_post_var.

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

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getDate ( )

Get Date, yyyy-mm-dd.

Returns
object Date, yyyy-mm-dd

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

References $date.

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

{
return $this->date;
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getMinuteStepSize ( )

Get minute step size.

public

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

References $minute_step_size.

Referenced by render().

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getShowDate ( )

Get Show Date Information.

Returns
boolean Show Date Information

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

References $showdate.

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

{
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getShowEmpty ( )

Get Show Empty Information.

Returns
boolean Show Empty Information

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

References $show_empty.

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

{
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getShowSeconds ( )

Get Show Seconds.

Returns
boolean Show Seconds

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

References $showseconds.

Referenced by render().

{
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getShowTime ( )

Get Show Time Information.

Returns
boolean Show Time Information

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

References $showtime.

Referenced by render().

{
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::getStartYear ( )

Get start year.

Returns
integer Start year

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

References $startyear.

{
}
ilDateTimeInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

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

References render().

{
$html = $this->render();
return $html;
}

+ Here is the call graph for this function:

ilDateTimeInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

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

References render().

{
$html = $this->render();
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $html);
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilDateTimeInputGUI::render ( )

Insert property html.

Reimplemented in ilBirthdayInputGUI.

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

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

Referenced by getTableFilterHTML(), and insert().

{
global $lng,$ilUser;
$tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form");
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()))
{
$tpl->setCurrentBlock('prop_date_activation');
$tpl->setVariable('CHECK_ENABLED_DATE',$this->getActivationPostVar());
$tpl->setVariable('TXT_DATE_ENABLED',$this->activation_title);
$tpl->setVariable('CHECKED_ENABLED',$this->activation_checked ? 'checked="checked"' : '');
$tpl->setVariable('CHECKED_DISABLED',$this->getDisabled() ? 'disabled="disabled" ' : '');
$tpl->parseCurrentBlock();
}
if ($this->getShowDate())
{
$tpl->setCurrentBlock("prop_date");
$tpl->setVariable("IMG_DATE_CALENDAR", ilUtil::getImagePath("calendar.png"));
$tpl->setVariable("TXT_DATE_CALENDAR", $lng->txt("open_calendar"));
$tpl->setVariable("DATE_ID", $this->getPostVar());
$tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar()."[date]");
include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
$tpl->setVariable('DATE_FIRST_DAY',ilCalendarUserSettings::_getInstance()->getWeekStart());
$tpl->setVariable("DATE_SELECT",
ilUtil::makeDateSelect($this->getPostVar()."[date]", $date_info['year'], $date_info['mon'], $date_info['mday'],
$this->startyear,true,array('disabled' => $this->getDisabled()), $this->getShowEmpty()));
$tpl->parseCurrentBlock();
}
if($this->getShowTime())
{
$tpl->setCurrentBlock("prop_time");
#$time = explode(":", $this->getTime());
$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())));
$tpl->setVariable("TXT_TIME", $this->getShowSeconds()
? "(".$lng->txt("hh_mm_ss").")"
: "(".$lng->txt("hh_mm").")");
$tpl->parseCurrentBlock();
}
if ($this->getShowTime() && $this->getShowDate())
{
$tpl->setVariable("DELIM", "<br />");
}
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDateTimeInputGUI::serializeData ( )

serialize data

Reimplemented from ilFormPropertyGUI.

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

References getDate().

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

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

Referenced by ilBirthdayInputGUI\checkInput(), checkInput(), ilECSSettingsGUI\initCategoryMappingForm(), ilObjRemoteCourseGUI\initEditTable(), ilUserTableGUI\initFilter(), ilCalendarAppointmentGUI\initForm(), ilNewsForContextBlockGUI\initSettingsForm(), render(), ilBirthdayInputGUI\setValueByArray(), setValueByArray(), and unserializeData().

{
$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 180 of file class.ilDateTimeInputGUI.php.

{
$this->minute_step_size = $a_step_size;
}
ilDateTimeInputGUI::setShowDate (   $a_showdate)

Set Show Date Information.

Parameters
boolean$a_showdateShow Date Information

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

Referenced by ilObjAssessmentFolderGUI\logsObject().

{
$this->showdate = $a_showdate;
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::setShowEmpty (   $a_empty)

Set Show Empty Information.

Parameters
booleanShow Empty Information

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

{
$this->show_empty = $a_empty;
}
ilDateTimeInputGUI::setShowSeconds (   $a_showseconds)

Set Show Seconds.

Parameters
boolean$a_showsecondsShow Seconds

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

Referenced by ilPageObjectGUI\initActivationForm(), ilObjCourseGUI\initForm(), ilObjUserGUI\initForm(), ilCourseItemAdministrationGUI\initFormEdit(), ilObjSearchSettingsGUI\initFormLuceneSettings(), and ilObjExerciseGUI\initPropertiesForm().

{
$this->showtime = $a_showtime;
}

+ Here is the caller graph for this function:

ilDateTimeInputGUI::setStartYear (   $a_year)

Set start year.

Parameters
integerStart year

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

{
$this->startyear = $a_year;
}
ilDateTimeInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Reimplemented in ilBirthdayInputGUI.

Definition at line 223 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
{
if (isset($a_values[$this->getPostVar()]["date"]))
{
$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:

ilDateTimeInputGUI::unserializeData (   $a_data)

unserialize data

Reimplemented from ilFormPropertyGUI.

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

References $data, and setDate().

{
$data = unserialize($a_data);
if (is_object($data))
{
$this->setDate($data);
}
}

+ Here is the call graph for this function:

Field Documentation

ilDateTimeInputGUI::$activation_post_var = ''
protected

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

Referenced by getActivationPostVar().

ilDateTimeInputGUI::$activation_title = ''
protected

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

ilDateTimeInputGUI::$date
protected

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

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

ilDateTimeInputGUI::$date_obj = null
protected

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

ilDateTimeInputGUI::$minute_step_size = 1
protected

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

Referenced by getMinuteStepSize().

ilDateTimeInputGUI::$show_empty = false
protected

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

Referenced by getShowEmpty().

ilDateTimeInputGUI::$showdate = true
protected

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

Referenced by getShowDate().

ilDateTimeInputGUI::$showseconds = false
protected

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

Referenced by getShowSeconds().

ilDateTimeInputGUI::$showtime = false
protected

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

Referenced by getShowTime().

ilDateTimeInputGUI::$startyear = ''
protected

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

Referenced by getStartYear().

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

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


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