Class: I2CE Date (Development): Difference between revisions
(Created page with '{{otherversions|Class: I2CE_Date}} This article describes the class ''I2CE_Date'' . *Location: Part of the module I2CE in the package [htt…') |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 78: | Line 78: | ||
===addMonthDayElement()=== | ===addMonthDayElement()=== | ||
Add a selection drop down for the month and date to be selected. | Add a selection drop down for the month and date to be selected. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L866 i2ce/lib/I2CE_Date.php] on line 866 | ||
*Signature: static public function addMonthDayElement($template,$name,$default,$showError,$node,$hidden,$blank) | *Signature: static public function addMonthDayElement($template,$name,$default,$showError,$node,$hidden,$blank) | ||
*Parameters: | *Parameters: | ||
Line 92: | Line 92: | ||
===addTimeElement()=== | ===addTimeElement()=== | ||
Add a selection drop down for the hour, minute and second to be selected. | Add a selection drop down for the hour, minute and second to be selected. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L909 i2ce/lib/I2CE_Date.php] on line 909 | ||
*Signature: static public function addTimeElement($template,$name,$default,$showError,$node,$hidden) | *Signature: static public function addTimeElement($template,$name,$default,$showError,$node,$hidden) | ||
*Parameters: | *Parameters: | ||
Line 104: | Line 104: | ||
===addYearElement()=== | ===addYearElement()=== | ||
Add a selection drop down for the year to be selected. | Add a selection drop down for the year to be selected. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L835 i2ce/lib/I2CE_Date.php] on line 835 | ||
*Signature: static public function addYearElement($template,$name,$default,$showError,$node,$year_range,$hidden,$blank) | *Signature: static public function addYearElement($template,$name,$default,$showError,$node,$year_range,$hidden,$blank) | ||
*Parameters: | *Parameters: | ||
Line 119: | Line 119: | ||
===before()=== | ===before()=== | ||
Determines if a date is before the given date. | Determines if a date is before the given date. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L708 i2ce/lib/I2CE_Date.php] on line 708 | ||
*Signature: public function before($date) | *Signature: public function before($date) | ||
*Parameters: | *Parameters: | ||
Line 126: | Line 126: | ||
===blank()=== | ===blank()=== | ||
Create a blank date object with no values set for anything. | Create a blank date object with no values set for anything. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L315 i2ce/lib/I2CE_Date.php] on line 315 | ||
*Signature: static public function blank($type) | *Signature: static public function blank($type) | ||
*Parameters: | *Parameters: | ||
Line 134: | Line 134: | ||
===compare()=== | ===compare()=== | ||
Compares a date to this one and returns -1 if it is before, 0 if the same and 1 if after this date. | Compares a date to this one and returns -1 if it is before, 0 if the same and 1 if after this date. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L730 i2ce/lib/I2CE_Date.php] on line 730 | ||
*Signature: public function compare($date) | *Signature: public function compare($date) | ||
*Parameters: | *Parameters: | ||
Line 140: | Line 140: | ||
*Returns: integer | *Returns: integer | ||
===day()=== | ===day()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L541 i2ce/lib/I2CE_Date.php] on line 541 | ||
*Signature: public function day() | *Signature: public function day() | ||
*Returns: integer<br/>The day part of the date. | *Returns: integer<br/>The day part of the date. | ||
===dbFormat()=== | ===dbFormat()=== | ||
Formats the date to be saved to MySQL Formats the date object to a string that MySQL will recognize based on the date type. | Formats the date to be saved to MySQL Formats the date object to a string that MySQL will recognize based on the date type. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L583 i2ce/lib/I2CE_Date.php] on line 583 | ||
*Signature: public function dbFormat() | *Signature: public function dbFormat($allow_blank) | ||
*Parameters: | |||
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $allow_blank <br/>Defaults to false. If true we allow blank values in which case we return "0000-00-00 00:00:00" | |||
***Default Value: false | |||
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] | *Returns: [http://www.php.net/manual/en/language.types.string.php string ] | ||
===displayDate()=== | ===displayDate()=== | ||
Displays the date in a readable format. | Displays the date in a readable format. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L615 i2ce/lib/I2CE_Date.php] on line 615 | ||
*Signature: public function displayDate() | *Signature: public function displayDate() | ||
===equals()=== | ===equals()=== | ||
Determines if one date is identical to another. | Determines if one date is identical to another. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L718 i2ce/lib/I2CE_Date.php] on line 718 | ||
*Signature: public function equals($date) | *Signature: public function equals($date) | ||
*Parameters: | *Parameters: | ||
Line 161: | Line 164: | ||
===fromDB()=== | ===fromDB()=== | ||
Creates a date from a MySQL database formatted string The type of this date object is determined by the string. The possible types are Month/Day ('0000-MM-DD'), Year Only ('YYYY-00-00'), Date ('YYYY-MM-DD'), Date/Time ('YYYY-MM-DD HH:MM:SS'), and Time Only ('HH:MM:SS'). If the string is blank a blank () blank date is returned. If none of thse formats match the now () current date is returned. | Creates a date from a MySQL database formatted string The type of this date object is determined by the string. The possible types are Month/Day ('0000-MM-DD'), Year Only ('YYYY-00-00'), Date ('YYYY-MM-DD'), Date/Time ('YYYY-MM-DD HH:MM:SS'), and Time Only ('HH:MM:SS'). If the string is blank a blank () blank date is returned. If none of thse formats match the now () current date is returned. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L417 i2ce/lib/I2CE_Date.php] on line 417 | ||
*Signature: static public function fromDB($dateString,$type) | *Signature: static public function fromDB($dateString,$type) | ||
*Parameters: | *Parameters: | ||
Line 170: | Line 173: | ||
===getDate()=== | ===getDate()=== | ||
Creates a date object of the type Date. | Creates a date object of the type Date. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L362 i2ce/lib/I2CE_Date.php] on line 362 | ||
*Signature: static public function getDate($day,$month,$year) | *Signature: static public function getDate($day,$month,$year) | ||
*Parameters: | *Parameters: | ||
Line 182: | Line 185: | ||
===getDateTime()=== | ===getDateTime()=== | ||
Creates a date object of the type Date/Time. | Creates a date object of the type Date/Time. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L379 i2ce/lib/I2CE_Date.php] on line 379 | ||
*Signature: static public function getDateTime($sec,$min,$hour,$day,$month,$year) | *Signature: static public function getDateTime($sec,$min,$hour,$day,$month,$year) | ||
*Parameters: | *Parameters: | ||
Line 200: | Line 203: | ||
===getDay()=== | ===getDay()=== | ||
Create a date object of the type Month/Day | Create a date object of the type Month/Day | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L349 i2ce/lib/I2CE_Date.php] on line 349 | ||
*Signature: static public function getDay($day,$month) | *Signature: static public function getDay($day,$month) | ||
*Parameters: | *Parameters: | ||
Line 210: | Line 213: | ||
===getMonthName()=== | ===getMonthName()=== | ||
The month name text to be displayed for the given month number. | The month name text to be displayed for the given month number. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L560 i2ce/lib/I2CE_Date.php] on line 560 | ||
*Signature: public function getMonthName($mon) | *Signature: public function getMonthName($mon) | ||
*Parameters: | *Parameters: | ||
Line 217: | Line 220: | ||
===getTime()=== | ===getTime()=== | ||
Creates a date object of the type Time. | Creates a date object of the type Time. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L396 i2ce/lib/I2CE_Date.php] on line 396 | ||
*Signature: static public function getTime($sec,$min,$hour) | *Signature: static public function getTime($sec,$min,$hour) | ||
*Parameters: | *Parameters: | ||
Line 234: | Line 237: | ||
===getValues()=== | ===getValues()=== | ||
Get the array of values associated to this date. | Get the array of values associated to this date. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L292 i2ce/lib/I2CE_Date.php] on line 292 | ||
*Signature: public function getValues() | *Signature: public function getValues() | ||
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>The keys of which match the names for generated html elements | *Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>The keys of which match the names for generated html elements | ||
===getYear()=== | ===getYear()=== | ||
Create a date object of the type Year only. | Create a date object of the type Year only. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L338 i2ce/lib/I2CE_Date.php] on line 338 | ||
*Signature: static public function getYear($year) | *Signature: static public function getYear($year) | ||
*Parameters: | *Parameters: | ||
Line 246: | Line 249: | ||
*Returns: [[Class: I2CE_Date (Development) | I2CE_Date]] | *Returns: [[Class: I2CE_Date (Development) | I2CE_Date]] | ||
===hour()=== | ===hour()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L545 i2ce/lib/I2CE_Date.php] on line 545 | ||
*Signature: public function hour() | *Signature: public function hour() | ||
*Returns: integer<br/>The hour part of the time. | *Returns: integer<br/>The hour part of the time. | ||
===isBlank()=== | |||
Checks to see if the I2CE_Date object is the blank value This method will check to see if the date object has blank entries based on the type. | |||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L506 i2ce/lib/I2CE_Date.php] on line 506 | |||
*Signature: public function isBlank() | |||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | |||
===isDay()=== | ===isDay()=== | ||
Checks to see if the date's day matches the given day. | Checks to see if the date's day matches the given day. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L667 i2ce/lib/I2CE_Date.php] on line 667 | ||
*Signature: public function isDay($day) | *Signature: public function isDay($day) | ||
*Parameters: | *Parameters: | ||
Line 258: | Line 266: | ||
===isHour()=== | ===isHour()=== | ||
Checks to see if the date's hour matches the given hour. | Checks to see if the date's hour matches the given hour. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L683 i2ce/lib/I2CE_Date.php] on line 683 | ||
*Signature: public function isHour($hour) | *Signature: public function isHour($hour) | ||
*Parameters: | *Parameters: | ||
Line 265: | Line 273: | ||
===isMinute()=== | ===isMinute()=== | ||
Checks to see if the date's minute matches the given minute. | Checks to see if the date's minute matches the given minute. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L691 i2ce/lib/I2CE_Date.php] on line 691 | ||
*Signature: public function isMinute($minute) | *Signature: public function isMinute($minute) | ||
*Parameters: | *Parameters: | ||
Line 272: | Line 280: | ||
===isMonth()=== | ===isMonth()=== | ||
Checks to see if the date's month matches the given month. | Checks to see if the date's month matches the given month. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L659 i2ce/lib/I2CE_Date.php] on line 659 | ||
*Signature: public function isMonth($month) | *Signature: public function isMonth($month) | ||
*Parameters: | *Parameters: | ||
Line 279: | Line 287: | ||
===isSecond()=== | ===isSecond()=== | ||
Checks to see if the date's second matches the given second. | Checks to see if the date's second matches the given second. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L699 i2ce/lib/I2CE_Date.php] on line 699 | ||
*Signature: public function isSecond($second) | *Signature: public function isSecond($second) | ||
*Parameters: | *Parameters: | ||
Line 286: | Line 294: | ||
===isValid()=== | ===isValid()=== | ||
Checks to see if the I2CE_Date object is valid This method will check to see if the date object has valid entries based on the type. | Checks to see if the I2CE_Date object is valid This method will check to see if the date object has valid entries based on the type. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L479 i2ce/lib/I2CE_Date.php] on line 479 | ||
*Signature: public function isValid() | *Signature: public function isValid() | ||
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] | ||
===isYear()=== | ===isYear()=== | ||
Checks to see if the date's year matches the given year. | Checks to see if the date's year matches the given year. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L675 i2ce/lib/I2CE_Date.php] on line 675 | ||
*Signature: public function isYear($year) | *Signature: public function isYear($year) | ||
*Parameters: | *Parameters: | ||
Line 298: | Line 306: | ||
===listMonths()=== | ===listMonths()=== | ||
Adds the month values to a [[Class: I2CE_Template (Development) | ]] object. | Adds the month values to a [[Class: I2CE_Template (Development) | ]] object. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L797 i2ce/lib/I2CE_Date.php] on line 797 | ||
*Signature: static public function listMonths($template,$selectId) | *Signature: static public function listMonths($template,$selectId) | ||
*Parameters: | *Parameters: | ||
Line 305: | Line 313: | ||
===listYears()=== | ===listYears()=== | ||
Adds a sequence of years to a [[Class: I2CE_Template (Development) | ]] object. It takes two optional arguments to limit the years to use. The initial year to start with is 1990 and it will end with the current year. | Adds a sequence of years to a [[Class: I2CE_Template (Development) | ]] object. It takes two optional arguments to limit the years to use. The initial year to start with is 1990 and it will end with the current year. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L813 i2ce/lib/I2CE_Date.php] on line 813 | ||
*Signature: static public function listYears($template,$selectId,$start,$end) | *Signature: static public function listYears($template,$selectId,$start,$end) | ||
*Parameters: | *Parameters: | ||
Line 315: | Line 323: | ||
***Default Value: 0 | ***Default Value: 0 | ||
===minute()=== | ===minute()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L549 i2ce/lib/I2CE_Date.php] on line 549 | ||
*Signature: public function minute() | *Signature: public function minute() | ||
*Returns: integer<br/>The minute part of the time. | *Returns: integer<br/>The minute part of the time. | ||
===month()=== | ===month()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L537 i2ce/lib/I2CE_Date.php] on line 537 | ||
*Signature: public function month() | *Signature: public function month() | ||
*Returns: integer<br/>The month part of the date. | *Returns: integer<br/>The month part of the date. | ||
Line 335: | Line 343: | ||
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>I2CE_Date or false if failure on strict mode | *Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>I2CE_Date or false if failure on strict mode | ||
===second()=== | ===second()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L553 i2ce/lib/I2CE_Date.php] on line 553 | ||
*Signature: public function second() | *Signature: public function second() | ||
*Returns: integer<br/>the second part of the time. | *Returns: integer<br/>the second part of the time. | ||
===setBlank()=== | ===setBlank()=== | ||
Set the blank string to be used if this date is empty. | Set the blank string to be used if this date is empty. | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L572 i2ce/lib/I2CE_Date.php] on line 572 | ||
*Signature: public function setBlank($text) | *Signature: public function setBlank($text) | ||
*Parameters: | *Parameters: | ||
Line 351: | Line 359: | ||
** integer $type <br/>The type of date object created. It defaults to date and time. | ** integer $type <br/>The type of date object created. It defaults to date and time. | ||
===year()=== | ===year()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php# | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_Date.php#L533 i2ce/lib/I2CE_Date.php] on line 533 | ||
*Signature: public function year() | *Signature: public function year() | ||
*Returns: integer<br/>The year part of the date. | *Returns: integer<br/>The year part of the date. |
Latest revision as of 07:55, 3 August 2010
This article describes the class I2CE_Date .
- Location: Part of the module I2CE in the package I2CE 4.0-dev
- Source: Defined in the file lib/I2CE_Date.php on line 33
- Author: Luke Duncan <lduncan@intrahealth.org>
- Since: v1.0.0
Handles date manipulation. I2CE_Dates are used to manage date and time values for form/HTML display and for interacting with the database.
Constants
I2CE_Date::YEAR_ONLY
Constant value to signify a date only including the year. Defined as: 1
I2CE_Date::MONTH_DAY
Constant value to signify a date only including the month and day of the month. Defined as: 2
I2CE_Date::DATE
Constant value to signify a date only including the date. Defined as: 3
I2CE_Date::DATE_TIME
Constant value to signify a date only including the date and time. Defined as: 4
I2CE_Date::TIME_ONLY
Constant value to signify a date only including the time. Defined as: 5
Variables
$second
The second value for the time.
- Defined in i2ce/lib/I2CE_Date.php on line 38
- Type: private integer $second
$minute
The minute value for the time.
- Defined in i2ce/lib/I2CE_Date.php on line 42
- Type: private integer $minute
$hour
The hour value for the time.
- Defined in i2ce/lib/I2CE_Date.php on line 46
- Type: private integer $hour
$day
The day value for the date.
- Defined in i2ce/lib/I2CE_Date.php on line 50
- Type: private integer $day
$month
The month value for the date.
- Defined in i2ce/lib/I2CE_Date.php on line 54
- Type: private integer $month
$year
The year value for the date.
- Defined in i2ce/lib/I2CE_Date.php on line 58
- Type: private integer $year
$type
The type of I2CE_Date object based on the constant values. Possible date types are YEAR_ONLY Year, MONTH_DAY Month and Day, DATE Date, DATE_TIME Date and Time, and TIME_ONLY Time.
- Defined in i2ce/lib/I2CE_Date.php on line 66
- Type: private integer $type
$months
Array of month names. This should be modified to handle internationalization. The array of month names.
- Defined in i2ce/lib/I2CE_Date.php on line 95
- Type: static public array $months
$types
A list of all valid types for I2CE_Date objects.
- Defined in i2ce/lib/I2CE_Date.php on line 102
- Type: static private array $types
Methods
__construct()
Constructor method to create a new I2CE_Date object.
- Defined in i2ce/lib/I2CE_Date.php on line 109
- Signature: private function __construct($type)
- Parameters:
- integer $type
The type of date object created. It defaults to date and time.- Default Value: self::DATE_TIME
- integer $type
addMonthDayElement()
Add a selection drop down for the month and date to be selected.
- Defined in i2ce/lib/I2CE_Date.php on line 866
- Signature: static public function addMonthDayElement($template,$name,$default,$showError,$node,$hidden,$blank)
- Parameters:
- $template
- string $name
The name of the selection element - I2CE_Date $default
The default I2CE_Date object to use to preset the value. - boolean $showError
A flag if this field is currently invalid to mark it as such. - DOMNode $node
The node to append the element to. - boolean $hidden
Set to true if the form element should be hidden. Defaults to false- Default Value: false
- boolean $blank
Set to true if this element should have a blank entry option. Defaults to false.- Default Value: false
addTimeElement()
Add a selection drop down for the hour, minute and second to be selected.
- Defined in i2ce/lib/I2CE_Date.php on line 909
- Signature: static public function addTimeElement($template,$name,$default,$showError,$node,$hidden)
- Parameters:
- $template
- string $name
The name of the selection element - I2CE_Date $default
The default I2CE_Date object to use to preset the value. - boolean $showError
A flag if this field is currently invalid to mark it as such. - DOMNode $node
The node to append the element to. - boolean $hidden
Set to true if the form element should be hidden.- Default Value: false
addYearElement()
Add a selection drop down for the year to be selected.
- Defined in i2ce/lib/I2CE_Date.php on line 835
- Signature: static public function addYearElement($template,$name,$default,$showError,$node,$year_range,$hidden,$blank)
- Parameters:
- $template
- string $name
The name of the selection element - I2CE_Date $default
The default I2CE_Date object to use to preset the value. - boolean $showError
A flag if this field is currently invalid to mark it as such. - DOMNode $node
The node to append the element to. - array $year_range
The range of years to use for the drop down. - boolean $hidden
Set to true if the form element should be hidden. Defaults to false.- Default Value: false
- boolean $blank
Set to true if this element should have a blank entry option. Defaults to false.- Default Value: false
before()
Determines if a date is before the given date.
- Defined in i2ce/lib/I2CE_Date.php on line 708
- Signature: public function before($date)
- Parameters:
- I2CE_Date $date
- Returns: boolean
blank()
Create a blank date object with no values set for anything.
- Defined in i2ce/lib/I2CE_Date.php on line 315
- Signature: static public function blank($type)
- Parameters:
- integer $type
The type of date object created. It defaults to date and time.- Default Value: self::DATE_TIME
- integer $type
- Returns: I2CE_Date
compare()
Compares a date to this one and returns -1 if it is before, 0 if the same and 1 if after this date.
- Defined in i2ce/lib/I2CE_Date.php on line 730
- Signature: public function compare($date)
- Parameters:
- I2CE_Date $date
- Returns: integer
day()
- Defined in i2ce/lib/I2CE_Date.php on line 541
- Signature: public function day()
- Returns: integer
The day part of the date.
dbFormat()
Formats the date to be saved to MySQL Formats the date object to a string that MySQL will recognize based on the date type.
- Defined in i2ce/lib/I2CE_Date.php on line 583
- Signature: public function dbFormat($allow_blank)
- Parameters:
- boolean $allow_blank
Defaults to false. If true we allow blank values in which case we return "0000-00-00 00:00:00"- Default Value: false
- boolean $allow_blank
- Returns: string
displayDate()
Displays the date in a readable format.
- Defined in i2ce/lib/I2CE_Date.php on line 615
- Signature: public function displayDate()
equals()
Determines if one date is identical to another.
- Defined in i2ce/lib/I2CE_Date.php on line 718
- Signature: public function equals($date)
- Parameters:
- I2CE_Date $date
- Returns: boolean
fromDB()
Creates a date from a MySQL database formatted string The type of this date object is determined by the string. The possible types are Month/Day ('0000-MM-DD'), Year Only ('YYYY-00-00'), Date ('YYYY-MM-DD'), Date/Time ('YYYY-MM-DD HH:MM:SS'), and Time Only ('HH:MM:SS'). If the string is blank a blank () blank date is returned. If none of thse formats match the now () current date is returned.
- Defined in i2ce/lib/I2CE_Date.php on line 417
- Signature: static public function fromDB($dateString,$type)
- Parameters:
- Returns: I2CE_Date
getDate()
Creates a date object of the type Date.
- Defined in i2ce/lib/I2CE_Date.php on line 362
- Signature: static public function getDate($day,$month,$year)
- Parameters:
- integer $day
Sets the day of the month to be used- Default Value: -1
- integer $month
Sets the month to be used- Default Value: -1
- integer $year
Sets the year to be used.- Default Value: -1
- integer $day
- Returns: I2CE_Date
getDateTime()
Creates a date object of the type Date/Time.
- Defined in i2ce/lib/I2CE_Date.php on line 379
- Signature: static public function getDateTime($sec,$min,$hour,$day,$month,$year)
- Parameters:
- integer $sec
Sets the seconds to be used- Default Value: -1
- integer $min
Sets the minutes to be used- Default Value: -1
- integer $hour
Sets the hour to be used.- Default Value: -1
- integer $day
Sets the day of the month to be used- Default Value: -1
- integer $month
Sets the month to be used- Default Value: -1
- integer $year
Sets the year to be used.- Default Value: -1
- integer $sec
- Returns: I2CE_Date
getDay()
Create a date object of the type Month/Day
- Defined in i2ce/lib/I2CE_Date.php on line 349
- Signature: static public function getDay($day,$month)
- Parameters:
- integer $day
Sets the day of the month to be used- Default Value: -1
- integer $month
Sets the month to be used- Default Value: -1
- integer $day
- Returns: I2CE_Date
getMonthName()
The month name text to be displayed for the given month number.
- Defined in i2ce/lib/I2CE_Date.php on line 560
- Signature: public function getMonthName($mon)
- Parameters:
- integer $mon
- Returns: string
getTime()
Creates a date object of the type Time.
- Defined in i2ce/lib/I2CE_Date.php on line 396
- Signature: static public function getTime($sec,$min,$hour)
- Parameters:
- integer $sec
Sets the seconds to be used- Default Value: -1
- integer $min
Sets the minutes to be used- Default Value: -1
- integer $hour
Sets the hour to be used.- Default Value: -1
- integer $sec
- Returns: I2CE_Date
getType()
get the type for this Date.
- Defined in i2ce/lib/I2CE_Date.php on line 130
- Signature: public function getType()
- Returns: integer
$type The type of date object created.
getValues()
Get the array of values associated to this date.
- Defined in i2ce/lib/I2CE_Date.php on line 292
- Signature: public function getValues()
- Returns: array
The keys of which match the names for generated html elements
getYear()
Create a date object of the type Year only.
- Defined in i2ce/lib/I2CE_Date.php on line 338
- Signature: static public function getYear($year)
- Parameters:
- integer $year
Sets the year to be used.- Default Value: -1
- integer $year
- Returns: I2CE_Date
hour()
- Defined in i2ce/lib/I2CE_Date.php on line 545
- Signature: public function hour()
- Returns: integer
The hour part of the time.
isBlank()
Checks to see if the I2CE_Date object is the blank value This method will check to see if the date object has blank entries based on the type.
- Defined in i2ce/lib/I2CE_Date.php on line 506
- Signature: public function isBlank()
- Returns: boolean
isDay()
Checks to see if the date's day matches the given day.
- Defined in i2ce/lib/I2CE_Date.php on line 667
- Signature: public function isDay($day)
- Parameters:
- integer $day
- Returns: boolean
isHour()
Checks to see if the date's hour matches the given hour.
- Defined in i2ce/lib/I2CE_Date.php on line 683
- Signature: public function isHour($hour)
- Parameters:
- integer $hour
- Returns: boolean
isMinute()
Checks to see if the date's minute matches the given minute.
- Defined in i2ce/lib/I2CE_Date.php on line 691
- Signature: public function isMinute($minute)
- Parameters:
- integer $minute
- Returns: boolean
isMonth()
Checks to see if the date's month matches the given month.
- Defined in i2ce/lib/I2CE_Date.php on line 659
- Signature: public function isMonth($month)
- Parameters:
- integer $month
- Returns: boolean
isSecond()
Checks to see if the date's second matches the given second.
- Defined in i2ce/lib/I2CE_Date.php on line 699
- Signature: public function isSecond($second)
- Parameters:
- integer $second
- Returns: boolean
isValid()
Checks to see if the I2CE_Date object is valid This method will check to see if the date object has valid entries based on the type.
- Defined in i2ce/lib/I2CE_Date.php on line 479
- Signature: public function isValid()
- Returns: boolean
isYear()
Checks to see if the date's year matches the given year.
- Defined in i2ce/lib/I2CE_Date.php on line 675
- Signature: public function isYear($year)
- Parameters:
- integer $year
- Returns: boolean
listMonths()
Adds the month values to a object.
- Defined in i2ce/lib/I2CE_Date.php on line 797
- Signature: static public function listMonths($template,$selectId)
- Parameters:
- I2CE_Template $template
- string $selectId
The id of the element in the page to add the selections to.
listYears()
Adds a sequence of years to a object. It takes two optional arguments to limit the years to use. The initial year to start with is 1990 and it will end with the current year.
- Defined in i2ce/lib/I2CE_Date.php on line 813
- Signature: static public function listYears($template,$selectId,$start,$end)
- Parameters:
- I2CE_Template $template
- string $selectId
The id of the element in the page to add the selections to. - integer $start
The year to start with- Default Value: 1990
- integer $end
The year to end with. @see I2CE_Template::setData()- Default Value: 0
minute()
- Defined in i2ce/lib/I2CE_Date.php on line 549
- Signature: public function minute()
- Returns: integer
The minute part of the time.
month()
- Defined in i2ce/lib/I2CE_Date.php on line 537
- Signature: public function month()
- Returns: integer
The month part of the date.
now()
Create a new I2CE_Date object with the current or given date and/or time.
- Defined in i2ce/lib/I2CE_Date.php on line 143
- Signature: static public function now($type,$time_stamp,$strict)
- Parameters:
- integer $type
The type of date object created. It defaults to date and time.- Default Value: self::DATE_TIME
- integer $time_stamp
Defaults to null in which case we use the current time stamp. If it is an array then it should be the same array structture as returned by getdate() or the one returned by I2CE_Date::getValues()- Default Value: null
- mixed $strict
Defaults to false. If true, does not return now. If 'blank', returns the blank date.- Default Value: false
- integer $type
- Returns: mixed
I2CE_Date or false if failure on strict mode
second()
- Defined in i2ce/lib/I2CE_Date.php on line 553
- Signature: public function second()
- Returns: integer
the second part of the time.
setBlank()
Set the blank string to be used if this date is empty.
- Defined in i2ce/lib/I2CE_Date.php on line 572
- Signature: public function setBlank($text)
- Parameters:
- string $text
The text to use.
- string $text
setType()
Set the type for this Date.
- Defined in i2ce/lib/I2CE_Date.php on line 122
- Signature: public function setType($type)
- Parameters:
- integer $type
The type of date object created. It defaults to date and time.
- integer $type
year()
- Defined in i2ce/lib/I2CE_Date.php on line 533
- Signature: public function year()
- Returns: integer
The year part of the date.