atkTimeAttribute atkTimeAttribute(
string
$name, [int
$beginTime = 0], [int
$endTime = 23], [int|array
$steps = array("00","15","30","45")], [string
$default = ""], [int
$flags = 0]
)
|
|
Constructor
Parameters:
|
string |
$name: |
Name of the attribute |
|
int |
$beginTime: |
Time to start with (eg 8) |
|
int |
$endTime: |
Time to end with (eg 24) |
|
int|array |
$steps: |
containing possible minute or seconds values (eg array("00","15","30","45")) or the interval (eg 5 for 00,05,10,15, etc.) if the flag AF_TIME_SECONDS is set, this is for seconds, the minutes will be range(0, 59) else this is for the minutes and the seconds will not be displayed |
|
string |
$default: |
Start Time (exp: 20:30) |
|
int |
$flags: |
Flags for this attribute |
void addToQuery(
&$query, [String
$tablename = ""], [String
$fieldaliasprefix = ""], [Array
$rec = ""], int
$level, String
$mode, atkQuery
$query
)
|
|
Adds this attribute to database queries.
Database queries (select, insert and update) are passed to this method so the attribute can 'hook' itself into the query.
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.
array db2value(
array
$rec
)
|
|
Convert database value to time 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
)
|
|
Display's text version of Record
Parameters:
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.
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.
String getSearchCondition(
&$query, String
$table, mixed
$value, String
$searchmode, atkQuery
$query
)
|
|
Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
Parameters:
|
atkQuery |
$query: |
The query object where the search condition should be placed on |
|
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. |
|
|
&$query: |
|
API Tags:
| Return: | The searchcondition to use. |
Redefinition of:
- atkAttribute::getSearchCondition()
- Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
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.
Piece hide(
[array
$record = ""], String
$fieldprefix
)
|
|
Returns a piece of html code that can be used in a form to display hidden values for this attribute.
Parameters:
|
array |
$record: |
Array with values |
|
String |
$fieldprefix: |
The fieldprefix to put in front of the name of any html form element for this attribute. |
API Tags:
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">)
array intervalToSteps(
int
$interval
)
|
|
Convert an interval (integer) to an array with steps.
Parameters:
|
int |
$interval: |
The interval to convert |
API Tags:
| Return: | The array with steps. |
array parseTime(
string
$stringvalue
)
|
|
Parse a timestring to an array
Parameters:
|
string |
$stringvalue: |
The time to parse |
API Tags:
| Return: | array with hours, minutes and seconds |
piece search(
[array
$record = ""], [boolean
$extended = false], [string
$fieldprefix = ""]
)
|
|
Returns a piece of html code that can be used in a form to search values
Parameters:
|
array |
$record: |
Array with fields |
|
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: | of html code with a checkbox |
Redefinition of:
- atkAttribute::search()
- Returns a piece of html code that can be used to get search terms input from the user.
array timeArray(
string
$time
)
|
|
Converts a date string (HHMISS) to an array with 2 fields (hours, minutes, seconds).
Parameters:
|
string |
$time: |
the time string |
API Tags:
| Return: | with 3 fields (hours, minutes, seconds) |
void validate(
&$rec, String
$mode, array
$rec
)
|
|
Checks if a value is valid.
Parameters:
|
array |
$rec: |
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") |
|
|
&$rec: |
|
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.