atkDateTimeAttribute atkDateTimeAttribute(
string
$name, [string|int
$default_date = ""], [string
$default_time = ""], [int
$flags = 0]
)
|
|
Constructor
Parameters:
|
string |
$name: |
Name of the attribute |
|
string|int |
$default_date: |
start date |
|
string |
$default_time: |
start time |
|
int |
$flags: |
Flags for this attribute |
Information Tags:
| Todo: | I don't know who added the default_date and default_time parameters, but at least the atkDateAttribute doesn't support a default date. if you want to set a default date you should use initial_values anyways so I think the default_date / default_time parameters should be removed. But can we keep this backwards compatible somehow? At least now we are certain it doesn't work. ;) (PCV) |
void addToQuery(
&$query, [String
$tablename = ""], [String
$fieldaliasprefix = ""], [Array
$rec = ""], int
$level, String
$mode, atkQuery
$query
)
|
|
Adds this attribute to database queries.
Parameters:
|
atkQuery |
$query: |
The SQL query object |
|
String |
$tablename: |
The name of the table of this attribute |
|
String |
$fieldaliasprefix: |
Prefix to use in front of the alias in the query. |
|
Array |
$rec: |
The record that contains the value of this attribute. |
|
int |
$level: |
Recursion level if relations point to eachother, an endless loop could occur if they keep loading eachothers data. The $level is used to detect this loop. If overriden in a derived class, any subcall to an addToQuery method should pass the $level+1. |
|
String |
$mode: |
Indicates what kind of query is being processing: This can be any action performed on a node (edit, add, etc) Mind you that "add" and "update" are the actions that store something in the database, whereas the rest are probably select queries. |
|
|
&$query: |
|
Redefinition of:
- atkAttribute::addToQuery()
- Adds this attribute to database queries.
int arrayToDateTime(
array
$dateArray
)
|
|
Converts a date array to a timestamp year, month, day are obligatory !!
Parameters:
|
array |
$dateArray: |
Date Array |
API Tags:
array datetimeArray(
[string
$datetime = NULL]
)
|
|
Converts a date/time string (YYYYMMDDHHMISS) to an array with 5 fields (day, month, year, hours, minutes, seconds).
Defaults to current date/time.
Parameters:
|
string |
$datetime: |
the time string |
API Tags:
| Return: | with 6 fields (day, month, year, hours, minutes, seconds) |
array db2value(
array
$rec
)
|
|
Convert database value to datetime array
Parameters:
|
array |
$rec: |
database record with date field |
API Tags:
| Return: | with 3 fields (hours:minutes:seconds) |
Redefinition of:
- atkAttribute::db2value()
- Converts a database value to an internal value.
Return the database field type of the attribute.
API Tags:
| Return: | The 'generic' type of the database field for this attribute. |
Redefinition of:
- atkAttribute::dbFieldType()
- Return the database field type of the attribute.
text display(
array
$record, [String
$mode = ""]
)
|
|
Display's html version of Record
Parameters:
|
array |
$record: |
The record |
|
String |
$mode: |
The display mode ("view" for viewpages, or "list" for displaying in recordlists, "edit" for displaying in editscreens, "add" for displaying in add screens. "csv" for csv files. Applications can use additional modes. |
API Tags:
| Return: | string of $record |
Redefinition of:
- atkAttribute::display()
- Returns a displayable string for this value, to be used in HTML pages.
String edit(
[array
$record = ""], [String
$fieldprefix = ""], [String
$mode = ""]
)
|
|
Returns a piece of html code that can be used in a form to edit this attribute's value.
Parameters:
|
array |
$record: |
The record that holds the value for this attribute. |
|
String |
$fieldprefix: |
The fieldprefix to put in front of the name of any html form element for this attribute. |
|
String |
$mode: |
The mode we're in ('add' or 'edit') |
API Tags:
| Return: | A piece of htmlcode for editing this attribute |
Redefinition of:
- atkAttribute::edit()
- Returns a piece of html code that can be used in a form to edit this attribute's value.
void fetchMeta(
array
$metadata
)
|
|
Fetch the metadata about this attrib from the table metadata, and process it.
Lengths for the edit and searchboxes, and maximum lengths are retrieved from the table metadata by this method.
Parameters:
|
array |
$metadata: |
The table metadata from the table for this attribute. |
Redefinition of:
- atkAttribute::fetchMeta()
- Fetch the metadata about this attrib from the table metadata, and process it.
String fetchValue(
array
$postvars
)
|
|
Convert values from an HTML form posting to an internal value for this attribute.
For the regular atkAttribute, this means getting the field with the same name as the attribute from the html posting.
Parameters:
|
array |
$postvars: |
The array with html posted values ($_POST, for example) that holds this attribute's value. |
API Tags:
| Return: | The internal value |
Redefinition of:
- atkAttribute::fetchValue()
- Convert values from an HTML form posting to an internal value for this attribute.
int|array fromUTC(
mixed
$value,
&$record, array
$record
)
|
|
Convert the given UTC ATK date/time array to a date/time array in a certain timezone.
Parameters:
|
mixed |
$value: |
UNIX timestamp or ATK date/time array |
|
array |
$record: |
record |
|
|
&$record: |
|
API Tags:
| Return: | UNIX timestamp or ATK date/time array (depending on input) |
Retrieve the list of searchmodes supported by the attribute.
API Tags:
| Return: | List of supported searchmodes |
Redefinition of:
- atkAttribute::getSearchModes()
- Retrieve the list of searchmodes supported by the attribute.
Redefined in descendants as:
string getTimezoneAttribute(
)
|
|
Returns the timezone attribute name.
API Tags:
| Return: | timezone attribute name |
Returns the UTC offset if set.
API Tags:
| Return: | UTC offset in seconds if set. |
String hide(
[array
$record = ""], [String
$fieldprefix = ""]
)
|
|
Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
Parameters:
|
array |
$record: |
The record that holds the value for this attribute |
|
String |
$fieldprefix: |
The fieldprefix to put in front of the name of any html form element for this attribute. |
API Tags:
| Return: | A piece of htmlcode with hidden form elements that post this attribute's value without showing it. |
Redefinition of:
- atkAttribute::hide()
- Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
Redefined in descendants as:
-
atkUpdateStampAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
Init this attribute
Redefinition of:
- atkAttribute::init()
- This function is called right after the attribute is added to the node.
array parseStringValue(
string
$stringvalue
)
|
|
Parse the string to convert a datetime string to an array
Parameters:
API Tags:
| Return: | with date and time information |
Redefinition of:
- atkAttribute::parseStringValue()
- Convert a String representation into an internal value.
If a timezone attribute is set, make sure it's always loaded.
Redefinition of:
- atkAttribute::postInit()
- This function is called at the end of the node's init method.
String search(
[array
$record = ""], [boolean
$extended = false], [string
$fieldprefix = ""]
)
|
|
Returns a piece of html code that can be used to get search terms input from the user.
Parameters:
|
array |
$record: |
Array with values |
|
boolean |
$extended: |
if set to false, a simple search input is returned for use in the searchbar of the recordlist. If set to true, a more extended search may be returned for the 'extended' search page. The atkAttribute does not make a difference for $extended is true, but derived attributes may reimplement this. |
|
string |
$fieldprefix: |
The fieldprefix of this attribute's HTML element. |
API Tags:
| Return: | A piece of html-code |
Redefinition of:
- atkAttribute::search()
- Returns a piece of html code that can be used to get search terms input from the user.
void searchCondition(
&$query, String
$table, mixed
$value, String
$searchmode, [string
$fieldaliasprefix = ''], atkQuery
$query
)
|
|
Creates a search condition for a given search value, and adds it to the query that will be used for performing the actual search.
Parameters:
|
atkQuery |
$query: |
The query to which the condition will be added. |
|
String |
$table: |
The name of the table in which this attribute is stored |
|
mixed |
$value: |
The value the user has entered in the searchbox |
|
String |
$searchmode: |
The searchmode to use. This can be any one of the supported modes, as returned by this attribute's getSearchModes() method. |
|
string |
$fieldaliasprefix: |
optional prefix for the fieldalias in the table |
|
|
&$query: |
|
Redefinition of:
- atkAttribute::searchCondition()
- Creates a search condition for a given search value, and adds it to the query that will be used for performing the actual search.
void setDateMax(
[mixed
$max = 0]
)
|
|
Set the maximum date that may be select (0 means unlimited).
It can be set in 3 formats:
- Unix timestamp.
- String (parsed by strtotime)
- Array (with year,month,day,hour,min,sec)
Parameters:
|
mixed |
$max: |
The maximum date that may be selected. |
void setDateMin(
[mixed
$min = 0]
)
|
|
Set the minimum date that may be select (0 means unlimited).
It can be set in 3 formats:
- Unix timestamp.
- String (parsed by strtotime)
- Array (with year,month,day,hour,min,sec)
Parameters:
|
mixed |
$min: |
The minimum date that may be selected. |
void setTimezoneAttribute(
string
$attrName
)
|
|
Sets the timezone attribute. This can also be a timezone attribute retrieved from a atkManyToOneRelation. If so then please use the dot notation.
Parameters:
|
string |
$attrName: |
attribute name |
void setUTCOffset(
int
$offset
)
|
|
Sets the UTF offset in seconds.
Parameters:
|
int |
$offset: |
UTC offset in seconds |
int|array toUTC(
mixed
$value,
&$record, array
$record
)
|
|
Convert the given ATK date/time array to a UTC date/time array.
Parameters:
|
mixed |
$value: |
UNIX timestamp or ATK date/time array |
|
array |
$record: |
record |
|
|
&$record: |
|
API Tags:
| Return: | UNIX timestamp or ATK date/time array (depending on input) |
void validate(
&$record, String
$mode, array
$record
)
|
|
Validate the value of this attribute
Parameters:
|
array |
$record: |
The record that holds the value for this attribute. If an error occurs, the error will be stored in the 'atkerror' field of the record. |
|
String |
$mode: |
The mode for which should be validated ("add" or "update") |
|
|
&$record: |
|
Redefinition of:
- atkAttribute::validate()
- Checks if a value is valid.
String value2db(
array
$rec
)
|
|
Converts the internal attribute value to one that is understood by the database.
Parameters:
|
array |
$rec: |
The record that holds this attribute's value. |
API Tags:
| Return: | The database compatible value |
Redefinition of:
- atkAttribute::value2db()
- Converts the internal attribute value to one that is understood by the database.
Redefined in descendants as:
int _getUTCOffset(
&$record, [string
$stamp = null], array
$record
)
|
|
Returns the UTC offset in seconds. If the UTC offset is set explicitly
using the setUTCOffset method this offset is returned. Else if a timezone attribute is set the offset is determined by looking at the timezone using the given timezone attribute. If no offset and no attribute are set an offset of 0 is returned.
Parameters:
|
array |
$record: |
record |
|
string |
$stamp: |
timestamp |
|
|
&$record: |
|
API Tags:
| Return: | UTC offset in seconds |