ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTDateSearchUtil Class Reference

Date form handling helper. More...

+ Collaboration diagram for ilADTDateSearchUtil:

Static Public Member Functions

static handleSelectInputPost ($a_mode, $a_post)
 Import select post data.
static handleTextInputPost ($a_mode, $a_post)
 Import text input post data.

Data Fields

const MODE_DATE = 1
const MODE_DATETIME = 2

Detailed Description

Date form handling helper.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

static ilADTDateSearchUtil::handleSelectInputPost (   $a_mode,
  $a_post 
)
static

Import select post data.

Parameters
int$a_mode
array$a_post
Returns
int timestamp

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

Referenced by ilADTDateSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTDateSearchBridgeRange\importFromPost(), and ilADTDateTimeSearchBridgeRange\importFromPost().

{
if(!is_array($a_post))
{
return;
}
if($a_mode == self::MODE_DATE)
{
return mktime(12, 0, 0,
$a_post["date"]["m"],
$a_post["date"]["d"],
$a_post["date"]["y"]);
}
else
{
return mktime(
$a_post["time"]["h"],
$a_post["time"]["m"],
1,
$a_post["date"]["m"],
$a_post["date"]["d"],
$a_post["date"]["y"]);
}
}

+ Here is the caller graph for this function:

static ilADTDateSearchUtil::handleTextInputPost (   $a_mode,
  $a_post 
)
static

Import text input post data.

Parameters
int$a_mode
array$a_post
Returns
int timestamp

Definition at line 58 of file class.ilADTDateSearchUtil.php.

References $ilUser, ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, ilUtil\stripSlashes(), and ilCalendarSettings\TIME_FORMAT_12.

Referenced by ilADTDateSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTDateSearchBridgeRange\importFromPost(), and ilADTDateTimeSearchBridgeRange\importFromPost().

{
global $ilUser;
// see ilDateTimeInputGUI::checkInput()
$a_post["date"] = ilUtil::stripSlashes($a_post["date"]);
if($a_post["date"])
{
switch($ilUser->getDateFormat())
{
$date = explode(".", $a_post["date"]);
$dt['mday'] = (int)$date[0];
$dt['mon'] = (int)$date[1];
$dt['year'] = (int)$date[2];
break;
$date = explode("-", $a_post["date"]);
$dt['mday'] = (int)$date[2];
$dt['mon'] = (int)$date[1];
$dt['year'] = (int)$date[0];
break;
$date = explode("/", $a_post["date"]);
$dt['mday'] = (int)$date[1];
$dt['mon'] = (int)$date[0];
$dt['year'] = (int)$date[2];
break;
}
if($a_mode == self::MODE_DATE)
{
return mktime(12, 0, 0, $dt["mon"], $dt["mday"], $dt["year"]);
}
$a_post["time"] = ilUtil::stripSlashes($a_post["time"]);
if($a_post["time"])
{
if($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
{
$seconds = "";
if(preg_match("/([0-9]{1,2})\s*:\s*([0-9]{1,2})\s*".$seconds."(am|pm)/", trim(strtolower($a_post["time"])), $matches))
{
$dt['hours'] = (int)$matches[1];
$dt['minutes'] = (int)$matches[2];
if($seconds)
{
$dt['seconds'] = (int)$time[2];
$ampm = $matches[4];
}
else
{
$dt['seconds'] = 0;
$ampm = $matches[3];
}
if($dt['hours'] == 12)
{
if($ampm == "am")
{
$dt['hours'] = 0;
}
}
else if($ampm == "pm")
{
$dt['hours'] += 12;
}
}
}
else
{
$time = explode(":", $a_post["time"]);
$dt['hours'] = (int)$time[0];
$dt['minutes'] = (int)$time[1];
$dt['seconds'] = (int)$time[2];
}
}
return mktime($dt["hours"], $dt["minutes"], $dt["seconds"], $dt["mon"], $dt["mday"], $dt["year"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

const ilADTDateSearchUtil::MODE_DATE = 1
const ilADTDateSearchUtil::MODE_DATETIME = 2

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