Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: ../phpdbedittk/gadmdatecommand.php
PHPDBEditTk -

gadm_date_command

gadm_command
   |
  +-- gadm_date_command

Handles fields that contain date/time values

 

private class gadm_date_command extends gadm_command

Handles fields that contain date/time values
This class will convert datetime values from a source to a target format.Source and target formats are defined in the global variable $dateformats.For the field, the user can specify a format for the db, the table, detailand form output.

 

Methods inherited from gadm_command

_save_constructor_params, construct

Public Method Summary

void

gadm_date_command()

Constructor
string

execute(string $func_usage, string $value)

Runs a format conversion on a date(time)Warning: documentation is missing.
mixed

checkinput(string $func_usage, string $value)

Performs an input check on the datetime, matching it against the format_formWarning: documentation is missing.
mixed

checkfilterinput(string $func_usage, string $value)

Performs an input check on the datetime, matching it against the format_formWarning: documentation is missing.

Private Method Summary

int

_alpha_mon_2_num_mon(string $amon)

Translate 3 letter month in month number
int

_match_a(array $dateformat, string $val)

Matches a value against a list of dateformats
string

_format_as(array $dateformat, integer $val)

Formats a timestamp in a certain format

Fields inherited from gadm_command

$command_types, $optable, $fieldname, $sender

Private Field Summary

array

$dateformats

Stores the date formats available
array

$alphamons

Provides a translation table for 3 letter month names to month numbers.

Public Method Details

gadm_date_command

public void gadm_date_command( )

  Constructor
Assign global dateformats to local ones

Returns void


execute

public string execute( string $func_usage, string $value )

  Runs a format conversion on a date(time)
Depending on the calling point, determined by $func_usage, it chooses a sourceand a target format for the date and translates it using a unix timestamp. Thesource and target formats are specified in the command definition by the followingfields:
- format_db format in the database layer
- format_tableformat in the table view
- format_detailformat in the detail view
- format_formformat in the form view

There are two other flags used in the class:
- ignore_emptyif set, ignores empty values, when transferring and checking input- perform_inputcheckif set, performs an inputcheck on the datetime (format_form)

Warning: documentation is missing.

Parameter
string $func_usage
calling point in genericadmin
string $value
datetime string
Returns string

date /time string after conversion


checkinput

public mixed checkinput( string $func_usage, string $value )

  Performs an input check on the datetime, matching it against the format_form
The actual check is not run, if ignoreempty is off.
The check is also not run, if perform_inputcheck is off

Warning: documentation is missing.

Parameter
string $func_usage
calling point in genericadmin
string $value
datetime string
Returns mixed

0 if successful, or message


checkfilterinput

public mixed checkfilterinput( string $func_usage, string $value )

  Performs an input check on the datetime, matching it against the format_form
This is nearly identical to inputcheck. Ignoreempty is always assumed on here.

Warning: documentation is missing.

Parameter
string $func_usage
calling point in genericadmin
string $value
datetime string
Returns mixed

0 if successful, or message


Private Method Details

_alpha_mon_2_num_mon

private int _alpha_mon_2_num_mon( string $amon )

  Translate 3 letter month in month number

Parameter
string $amon
month 3 letter name
Returns int

month number


_match_a

private int _match_a( array $dateformat, string $val )

  Matches a value against a list of dateformats
The formats are tried through until one matches or none does.

Parameter
array $dateformat
date format names
string $val
date/time string
Returns int

unix timestamp of the date


_format_as

private string _format_as( array $dateformat, integer $val )

  Formats a timestamp in a certain format
The function uses the first dateformat in the array of formats available

Parameter
array $dateformat
date format names
integer $val
unix timestamp
Returns string

date /time string


Private Field Details

$dateformats

private array $dateformats

>><<

Stores the date formats available
dateformats is an associative array, which stores all necessary information tomatch a string as a date(time) and to format a timestamp in the date format.$dateformat["Formatname"] = array(
    "format" => formatstring,
    "match" => matchstring,
    "match_map" => Match map
)

- formatstring is a date format string as specified in date()
- matchstring is a string that matches the date with preg_match

Match map = array(
    date_format_letter => match_array_number
)

-date_format_letter is a subset of available letters for date formatstrings (date command). Allowed are "d", "m", "M", "y", "Y", "H", "i", "s"
-match_array_number is the number in the array returned bypreg_match with the matchstring as the pattern, which represents the part ofthe date.


$alphamons

private array $alphamons

>>array( "jan" => 1, "feb" => 2, "mar" => 3, "apr" => 4, "may" => 5, "jun" => 6, "jul" => 7, "aug" => 8, "sep" => 9, "oct" => 10, "nov" => 11, "dec" => 12 )<<

Provides a translation table for 3 letter month names to month numbers.



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta