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. | |
| setUnixTime ($a_time) | |
| Set unix time. | |
| setDate ($a_date) | |
| Set Date, yyyy-mm-dd. | |
| getDate () | |
| Get Date, yyyy-mm-dd. | |
| setShowDate ($a_showdate) | |
| Set Show Date Information. | |
| getShowDate () | |
| Get Show Date Information. | |
| setTime ($a_time) | |
| Set Time, 00:00:00. | |
| getTime () | |
| Get Time, 00:00:00. | |
| 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. | |
Protected Attributes | |
| $date | |
| $showdate = true | |
| $time = "00:00:00" | |
| $showtime = false | |
| $showseconds = false | |
| $minute_step_size = 1 | |
| $activation_title = '' | |
| $activation_post_var = '' | |
This class represents a date/time property in a property form.
Definition at line 31 of file class.ilDateTimeInputGUI.php.
| ilDateTimeInputGUI::__construct | ( | $ | a_title = "", |
|
| $ | a_postvar = "" | |||
| ) |
Constructor.
| string | $a_title Title | |
| string | $a_postvar Post Variable |
Reimplemented from ilFormPropertyGUI.
Definition at line 49 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:| ilDateTimeInputGUI::checkInput | ( | ) |
Check input, strip slashes etc.
set alert, if input is not ok.
Reimplemented from ilFormPropertyGUI.
Definition at line 242 of file class.ilDateTimeInputGUI.php.
References $lng, $ok, $timestamp, ilFormPropertyGUI::getPostVar(), ilFormPropertyGUI::setAlert(), and ilUtil::stripSlashes().
{
global $lng;
$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
$timestamp = mktime(0,0,0,
$_POST[$this->getPostVar()]["date"]["m"],
$_POST[$this->getPostVar()]["date"]["d"],
$_POST[$this->getPostVar()]["date"]["y"]);
if ($_POST[$this->getPostVar()]["date"]["d"] != (int) date("d",$timestamp) ||
$_POST[$this->getPostVar()]["date"]["m"] != (int) date("m",$timestamp) ||
$_POST[$this->getPostVar()]["date"]["y"] != (int) date("Y",$timestamp))
{
$this->setAlert($lng->txt("exc_date_not_valid"));
$ok = false;
}
$_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);
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
| string | text displayed after the checkbox | |
| string | name of postvar | |
| bool | checkbox checked |
Definition at line 65 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 78 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
{
return $this->activation_post_var;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::getDate | ( | ) |
Get Date, yyyy-mm-dd.
Definition at line 115 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
{
return $this->date;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::getMinuteStepSize | ( | ) |
Get minute step size.
public
Definition at line 199 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
{
return $this->minute_step_size;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::getShowDate | ( | ) |
Get Show Date Information.
Definition at line 135 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
{
return $this->showdate;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::getShowSeconds | ( | ) |
Get Show Seconds.
Definition at line 221 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
{
return $this->showseconds;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::getShowTime | ( | ) |
Get Show Time Information.
Definition at line 175 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
{
return $this->showtime;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::getTime | ( | ) |
Get Time, 00:00:00.
Definition at line 155 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
{
return $this->time;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::insert | ( | &$ | a_tpl | ) |
Insert property html.
Definition at line 292 of file class.ilDateTimeInputGUI.php.
References $date, $lng, $time, getActivationPostVar(), getDate(), ilFormPropertyGUI::getDisabled(), ilUtil::getImagePath(), getMinuteStepSize(), ilFormPropertyGUI::getPostVar(), getShowDate(), getShowSeconds(), getShowTime(), getTime(), ilCalendarUtil::initJSCalendar(), ilUtil::makeDateSelect(), and ilUtil::makeTimeSelect().
{
global $lng;
$lng->loadLanguageModule("jscalendar");
require_once("./Services/Calendar/classes/class.ilCalendarUtil.php");
ilCalendarUtil::initJSCalendar();
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]");
$date = explode("-", $this->getDate());
$a_tpl->setVariable("DATE_SELECT",
ilUtil::makeDateSelect($this->getPostVar()."[date]", $date[0], $date[1], $date[2],
'','',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(),
$time[0], $time[1], $time[2],
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 | ( | $ | a_date | ) |
Set Date, yyyy-mm-dd.
| string | $a_date Date, yyyy-mm-dd |
Definition at line 105 of file class.ilDateTimeInputGUI.php.
Referenced by setUnixTime(), 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
| int | minute step_size 1,5,10,15,20... |
Definition at line 188 of file class.ilDateTimeInputGUI.php.
{
$this->minute_step_size = $a_step_size;
}
| ilDateTimeInputGUI::setShowDate | ( | $ | a_showdate | ) |
Set Show Date Information.
| boolean | $a_showdate Show Date Information |
Definition at line 125 of file class.ilDateTimeInputGUI.php.
{
$this->showdate = $a_showdate;
}
| ilDateTimeInputGUI::setShowSeconds | ( | $ | a_showseconds | ) |
Set Show Seconds.
| boolean | $a_showseconds Show Seconds |
Definition at line 211 of file class.ilDateTimeInputGUI.php.
{
$this->showseconds = $a_showseconds;
}
| ilDateTimeInputGUI::setShowTime | ( | $ | a_showtime | ) |
Set Show Time Information.
| boolean | $a_showtime Show Time Information |
Definition at line 165 of file class.ilDateTimeInputGUI.php.
{
$this->showtime = $a_showtime;
}
| ilDateTimeInputGUI::setTime | ( | $ | a_time | ) |
Set Time, 00:00:00.
| string | $a_time Time, 00:00:00 |
Definition at line 145 of file class.ilDateTimeInputGUI.php.
Referenced by setUnixTime(), and setValueByArray().
{
$this->time = $a_time;
}
Here is the caller graph for this function:| ilDateTimeInputGUI::setUnixTime | ( | $ | a_time | ) |
Set unix time.
This function will call setDate() and set
public
Definition at line 90 of file class.ilDateTimeInputGUI.php.
References setDate(), and setTime().
Here is the call graph for this function:| ilDateTimeInputGUI::setValueByArray | ( | $ | a_values | ) |
Set value by array.
| array | $a_values value array |
Definition at line 231 of file class.ilDateTimeInputGUI.php.
References ilFormPropertyGUI::getPostVar(), setDate(), and setTime().
{
$this->setDate($a_values[$this->getPostVar()]["date"]);
$this->setTime($a_values[$this->getPostVar()]["time"]);
}
Here is the call graph for this function:ilDateTimeInputGUI::$activation_post_var = '' [protected] |
Definition at line 41 of file class.ilDateTimeInputGUI.php.
ilDateTimeInputGUI::$activation_title = '' [protected] |
Definition at line 40 of file class.ilDateTimeInputGUI.php.
ilDateTimeInputGUI::$date [protected] |
Definition at line 33 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
ilDateTimeInputGUI::$minute_step_size = 1 [protected] |
Definition at line 38 of file class.ilDateTimeInputGUI.php.
ilDateTimeInputGUI::$showdate = true [protected] |
Definition at line 34 of file class.ilDateTimeInputGUI.php.
ilDateTimeInputGUI::$showseconds = false [protected] |
Definition at line 37 of file class.ilDateTimeInputGUI.php.
ilDateTimeInputGUI::$showtime = false [protected] |
Definition at line 36 of file class.ilDateTimeInputGUI.php.
ilDateTimeInputGUI::$time = "00:00:00" [protected] |
Definition at line 35 of file class.ilDateTimeInputGUI.php.
Referenced by insert().
1.7.1