atkAttribute atkAttribute(
String
$name, [int
$flags = 0], [mixed
$size = 0]
)
|
|
Constructor
Example: $this->add(new atkAttribute("name",AF_OBLIGATORY, 30));
Note: If you want to use the db/ddl utility class to automatically generate the table, the $size parameter must be set, for it will use the size specified here to determine the field length. (Derived classes might have reasonable default values, but the standard atkAttribute doesn't.)
Parameters:
|
String |
$name: |
Name of the attribute (unique within a node, and for most attributes, corresponds to a field in the database. |
|
int |
$flags: |
Flags for the attribute. |
|
mixed |
$size: |
The size(s) of the attribute. See the $size parameter of the setAttribSize() method for more information on the possible values of this parameter. |
void addCSSClass(
String
$classname
)
|
|
Add a CSS class for this attribute on an HTML form.
Parameters:
|
String |
$classname: |
The name of a class. |
Indicate that another attribute depends on this attribute, and that if this attribute is updated, the dependent attribute needs to be updated as well.
(This is mostly relevant to Ajax calls.)
Parameters:
|
String |
$attribName: |
The attribute you wish to update. |
API Tags:
void addDisabledMode(
int
$flag
)
|
|
Adds a disabled mode flag to the attribute (use DISABLED_VIEW and DISABLED_EDIT flags).
Parameters:
|
int |
$flag: |
The flag to add to the attribute |
Adds a flag to the attribute.
Note that adding flags at any time after the constructor might not always work. There are flags that are processed only at constructor time.
Parameters:
|
int |
$flag: |
The flag to add to the attribute |
API Tags:
| Return: | The instance of this atkAttribute |
Redefined in descendants as:
Add a javascript onchange event handler.
Parameters:
|
string |
$jscode: |
A block of valid javascript code. |
API Tags:
| Return: | Returns the instance of this attribute. |
Redefined in descendants as:
void addToEditArray(
String
$mode,
&$arr,
&$defaults,
&$error, String
$fieldprefix, array
$arr, array
$defaults, array
$error
)
|
|
Adds the attribute's edit / hide HTML code to the edit array.
This method is called by the node if it wants the data needed to create an edit form.
This is a framework method, it should never be called directly.
Parameters:
|
String |
$mode: |
the edit mode ("add" or "edit") |
|
array |
$arr: |
pointer to the edit array |
|
array |
$defaults: |
pointer to the default values array |
|
array |
$error: |
pointer to the error array |
|
String |
$fieldprefix: |
the fieldprefix |
|
|
&$arr: |
|
|
|
&$defaults: |
|
|
|
&$error: |
|
Redefined in descendants as:
void addToListArrayHeader(
String
$action,
&$arr, String
$fieldprefix, int
$flags, array
$atksearch,
&$columnConfig, [atkDataGrid
$grid = null], array
$arr, atkColumnConfig
$columnConfig
)
|
|
Adds the attribute / field to the list header. This includes the column name and search field.
Framework method. It should not be necessary to call this method directly.
Parameters:
|
String |
$action: |
the action that is being performed on the node |
|
array |
$arr: |
reference to the the recordlist array |
|
String |
$fieldprefix: |
the fieldprefix |
|
int |
$flags: |
the recordlist flags |
|
array |
$atksearch: |
the current ATK search list (if not empty) |
|
atkColumnConfig |
$columnConfig: |
Column configuration object |
|
atkDataGrid |
$grid: |
The atkDataGrid this attribute lives on. |
|
|
&$arr: |
|
|
|
&$columnConfig: |
|
API Tags:
Redefined in descendants as:
void addToListArrayRow(
String
$action,
&$arr, int
$nr, String
$fieldprefix, int
$flags, [
$edit = false], array
$arr
)
|
|
Adds the attribute / field to the list row. And if the row is totalisable also to the total.
Framework method. It should not be necessary to call this method directly.
Parameters:
|
String |
$action: |
the action that is being performed on the node |
|
array |
$arr: |
reference to the the recordlist array |
|
int |
$nr: |
the current row number |
|
String |
$fieldprefix: |
the fieldprefix |
|
int |
$flags: |
the recordlist flags |
|
|
&$arr: |
|
|
|
$edit: |
|
API Tags:
Redefined in descendants as:
void addToQuery(
&$query, [String
$tablename = ""], [String
$fieldaliasprefix = ""], [
&$rec = ""], int
$level, String
$mode, atkQuery
$query, Array
$rec
)
|
|
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.
Framework method. It should not be necessary to call this method directly. Derived attributes that consist of more than a single simple database field (like relations for example), may have to reimplement this method.
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: |
|
|
|
&$rec: |
|
Redefined in descendants as:
void addToSearchformFields(
&$fields,
&$node,
&$record, [array
$fieldprefix = ""], [array
$currentSearchMode = array()], array
$fields, atkNode
$node, array
$record
)
|
|
Adds the needed searchbox(es) for this attribute to the fields array. This method should only be called by the atkSearchHandler.
Parameters:
|
array |
$fields: |
The array containing fields to use in the extended search |
|
atkNode |
$node: |
The node where the field is in |
|
array |
$record: |
A record containing default values to put into the search fields. |
|
array |
$fieldprefix: |
search / mode field prefix |
|
array |
$currentSearchMode: |
current search mode |
|
|
&$fields: |
|
|
|
&$node: |
|
|
|
&$record: |
|
Redefined in descendants as:
void addToViewArray(
String
$mode,
&$arr,
&$defaults, array
$arr, array
$defaults
)
|
|
Adds the attribute's view / hide HTML code to the view array.
This method is called by the node if it wants the data needed to create a view form.
This is a framework method, it should never be called directly.
Parameters:
|
String |
$mode: |
the mode ("view") |
|
array |
$arr: |
pointer to the view array |
|
array |
$defaults: |
pointer to the default values array |
|
|
&$arr: |
|
|
|
&$defaults: |
|
Redefined in descendants as:
mixed db2value(
array
$rec
)
|
|
Converts a database value to an internal value.
For the regular atkAttribute Derived attributes may reimplement this for their own conversion. (In which case, the return type might be 'mixed')
This is the exact opposite of the value2db method.
Parameters:
|
array |
$rec: |
The database record that holds this attribute's value |
API Tags:
| Return: | The internal value |
Redefined in descendants as:
Return the size of the field in the database.
If 0 is returned, the size is unknown. In this case, the return value should not be used to create table columns.
Ofcourse, the size does not make sense for every field type. So only interpret the result if a size has meaning for the field type of this attribute. (For example, if the database field is of type 'date', the size has no meaning)
Note that derived attributes might set a dot separated size, for example to store decimal numbers. The number after the dot should be interpreted as the number of decimals.
API Tags:
| Return: | The database field size |
Redefined in descendants as:
Return the database field type of the attribute.
Note that the type returned is a 'generic' type. Each database vendor might have his own types, therefor, the type should be converted to a database specific type using $db->fieldType().
If the type was read from the table metadata, that value will be used. Else, the attribute will analyze its flags to guess what type it should be. If AF_AUTO_INCREMENT is set, the field is probaly "number". If not, it's probably "string".
Note: Derived attributes should override this method if they use other field types than string or number. If the derived attribute is one that can not be stored in the database, an empty string should be returned.
API Tags:
| Return: | The 'generic' type of the database field for this attribute. |
Redefined in descendants as:
boolean delete(
array
$record
)
|
|
The delete method is called by the framework to inform the attribute that a record is deleted.
The regular atkAttribute has no implementation for this method, but derived attributes may override this, to take care of cleanups, cascade deletes etc. Note, that the framework only calls this method if the attribute has the AF_CASCADE_DELETE flag.
Parameters:
|
array |
$record: |
The record that is deleted. |
API Tags:
| Return: | true if cleanup was successful, false otherwise. |
Redefined in descendants as:
Check if delete of the record is allowed.
This method is called by the framework to check if the attribute allows the record to be deleted. The default implementation always returns true, but derived attributes may implement their own logic to prevent deletion of the record.
API Tags:
| Return: | True if delete is allowed, false if not. |
Redefined in descendants as:
String display(
array
$record, [String
$mode = ""]
)
|
|
Returns a displayable string for this value, to be used in HTML pages.
The regular atkAttribute uses PHP's nl2br() and htmlspecialchars() methods to prepare a value for display, unless $mode is "cvs".
Parameters:
|
array |
$record: |
The record that holds the value for this attribute |
|
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:
Redefined in descendants as:
-
atkAggregatedColumn::display()
: The display function for this attribute
-
atkBoolAttribute::display()
: Returns a displayable string for this value.
-
atkCalculatorAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkDateAttribute::display()
: Function display's the date
-
atkDateTimeAttribute::display()
: Display's html version of Record
-
atkDummyAttribute::display()
: Display a record Here it will only return the text.
-
atkDocumentAttribute::display()
: Gets the display code for the document selector in the specified mode
-
atkRowCounter::display()
: Returns a number corresponding to the row count per record.
-
atkDurationAttribute::display()
: This function displays the time
-
atkEmailAttribute::display()
: Returns a displayable string for this value.
-
atkFieldSet::display()
: Display fieldset.
-
atkFileAttribute::display()
: Display values
-
atkMultipleFileAttribute::display()
: Display values
-
atkTagAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkListAttribute::display()
: Display's text version of Record
-
atkMultiSelectAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkMlAttribute::display()
: Returns a displayable string for this value.
-
atkMlHtmlAttribute::display()
: Returns a displayable string for this value.
-
atkMlWrapper::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkNumberAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkCurrencyAttribute::display()
: overrides the display function to put the currencysymbol in front of the input field
-
atkWeekdayAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkParserAttribute::display()
: Parses a record
-
atkPasswordAttribute::display()
: We don't display the password
-
atkProfileAttribute::display()
: Display rights.
-
atkRadioDetailsAttribute::display()
: Display.
-
atkTabbedPane::display()
: Display a tabbed pane with attributes
-
atkFckAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages
-
atkHtmlAttribute::display()
: Returns a displayable string for this value.
-
atkWysiwygAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkTimeAttribute::display()
: Display's text version of Record
-
atkUrlAttribute::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkRelation::display()
: Return a displayable string for a record.
-
atkManyToManyRelation::display()
: Returns a displayable string for this value.
-
atkExtendableShuttleRelation::display()
: Display the value of this relation
-
atkManyToOneRelation::display()
: Returns a displayable string for this value.
-
atkMatrixRelation::display()
: Empty display function
-
atkOneToManyRelation::display()
: Returns a displayable string for this value, to be used in HTML pages.
-
atkOneToOneRelation::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 |
Redefined in descendants as:
boolean equal(
array
$recA, array
$recB
)
|
|
This function is called to compare if two records are considered equal by this attribute.
The regular atkAttribute performs a simple string match; derived classes may override this method to perform more complex comparisons.
Parameters:
|
array |
$recA: |
The first record holding a value for this attribute. |
|
array |
$recB: |
The second record holding a value for the attribute. |
API Tags:
| Return: | True if the attribute considers the records equal, false if not. |
Redefined in descendants as:
String escapeSQL(
string
$value, [boolean
$wildcards = false]
)
|
|
Escape string for use in a query.
Parameters:
|
string |
$value: |
value to escape |
|
boolean |
$wildcards: |
escape wildcards too? |
API Tags:
| Return: | The escaped value. |
Retrieves the sort options and sort order.
Parameters:
|
atkColumnConfig |
$columnConfig: |
The config that contains options for extended sorting and grouping to a recordlist. |
|
String |
$fieldprefix: |
The prefix of the attribute |
|
atkDataGrid |
$grid: |
The grid that this attribute lives on. |
|
|
&$columnConfig: |
|
API Tags:
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. |
Redefined in descendants as:
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 |
Redefined in descendants as:
Returns the name of the attribute.
For most attributes, this corresponds to the name of the field in the database. For some attributes though (like one2many relations), the name is a mere identifier within a node. This method always returns the attribute name, despite the 'field' prefix of the method.
API Tags:
Retrieve the name of the attribute in HTML forms.
API Tags:
| Return: | Name of the attribute in HTML forms |
| Deprecated: | HTML formname and fieldname are equal, use fieldName instead. |
array getAdditionalTabs(
String
$action
)
|
|
Get list of additional tabs.
Attributes can add new tabs to tabbed screens. This method will be called to retrieve the tabs. The regular atkAttribute has no implementation for this method. Derived attributes may override this.
Parameters:
|
String |
$action: |
The action for which additional tabs should be loaded. |
API Tags:
| Return: | The list of tabs to add to the screen. |
Redefined in descendants as:
String getAttributeHtmlId(
)
|
|
Returns the html identifier of the attribute without setting it Created because getHtmlId would always SET the htmlid while getting it.
API Tags:
| Return: | The HTML id of this attribute |
Get column.
API Tags:
| Return: | column name |
| Access: | public |
String getCSSClassAttribute(
[mixed
$additionalclasses = array()]
)
|
|
Retrieve the attribute for the HTML-tag for this atkAttribute.
Parameters:
|
mixed |
$additionalclasses: |
A string or an array with classnames. |
API Tags:
| Return: | HTML The attributes classname(s) |
Retrieve the CSS classes that were registered for this attribute
API Tags:
| Return: | A list of css classes |
Get database instance for this attribute. Will return the owner instance database instance unless the owner instance is not set in which case the default instance will be returned.
API Tags:
| Return: | database instance |
Retrieve the dependees for this attribute.
API Tags:
String getEdit(
String
$mode,
&$defaults, String
$fieldprefix, array
$defaults
)
|
|
Retrieve the HTML code for placing this attribute in an edit page.
The difference with the edit() method is that the edit() method just generates the HTML code for editing the attribute, while the getEdit() method is 'smart', and implements a hide/readonly policy based on flags and/or custom override methodes in the node. (<attributename>_edit() and <attributename>_display() methods)
Framework method, it should not be necessary to call this method directly.
Parameters:
|
String |
$mode: |
The edit mode ("add" or "edit") |
|
array |
$defaults: |
The record holding the values for this attribute |
|
String |
$fieldprefix: |
The fieldprefix to put in front of the name of any html form element for this attribute. |
|
|
&$defaults: |
|
API Tags:
| Return: | the HTML code for this attribute that can be used in an editpage. |
Redefined in descendants as:
boolean getError(
array
$errors
)
|
|
Check if this attribute has errors in the specified error list.
Parameters:
|
array |
$errors: |
The error list is one that is stored in the "atkerror" section of a record, for example generated by validate() methods. |
Returns the full set of flags of the attribute.
API Tags:
| Return: | The full set of flags |
Getter for wether or not an attribute is forced to insert
API Tags:
| Return: | Wether or not an attribute is forced to insert |
Getter for wether or not an attribute is forced to update
API Tags:
| Return: | Wether or not an attribute is forced to update |
String getHtmlId(
String
$fieldprefix
)
|
|
Return the html identifier (id="") of the attribute. (unique within a
page)
Parameters:
|
String |
$fieldprefix: |
The fieldprefix to put in front of the name of any html form element for this attribute. |
API Tags:
| Return: | the HTML identifier. |
String getLabel(
[array
$record = array()], [string
$mode = '']
)
|
|
Get the HTML label of the attribute.
The difference with the label() method is that the label method always returns the HTML label, while the getLabel() method is 'smart', by taking the AF_NOLABEL and AF_BLANKLABEL flags into account.
Parameters:
|
array |
$record: |
The record holding the value for this attribute. |
|
string |
$mode: |
The mode ("add", "edit" or "view") |
API Tags:
| Return: | The HTML compatible label for this attribute, or an empty string if the label should be blank, or NULL if no label at all should be displayed. |
Redefined in descendants as:
Get the module that this attribute originated from.
By default, this is the module of the owning node of this attribute. However, if the attribute was added using a modifier from a different module, then the module that added the attribute is returned.
API Tags:
| Return: | The name of the module of this attribute |
String getOrderByStatement(
[Array
$extra = ''], [String
$table = ''], [String
$direction = 'ASC']
)
|
|
Retrieves the ORDER BY statement for this attribute's node.
Derived attributes may override this functionality to implement other ordering statements using the given parameters.
Parameters:
|
Array |
$extra: |
A list of attribute names to add to the order by statement |
|
String |
$table: |
The table name (if not given uses the owner node's table name) |
|
String |
$direction: |
Sorting direction (ASC or DESC) |
API Tags:
| Return: | The ORDER BY statement for this attribute |
Redefined in descendants as:
Returns the owner instance.
API Tags:
String getRefreshCall(
[String
$mode = 'edit'], [String
$fieldprefix = ''], [bool
$focusFirstFormEl = false], [bool
$registerScript = true]
)
|
|
Returns a JavaScript call for refreshing this attribute.
Parameters:
|
String |
$mode: |
add/edit mode |
|
String |
$fieldprefix: |
The prefix for this attribute in an HTML form |
|
bool |
$focusFirstFormEl: |
??? |
|
bool |
$registerScript: |
Does the javascript for this attribute need to be registered. |
API Tags:
| Return: | javascript Returns the javascript call to refresh this attribute. |
| Access: | protected |
Information Tags:
| Todo: | add documentation for $focusFirstFormEl. |
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. |
Redefined in descendants as:
-
atkAggregatedColumn::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkBoolAttribute::getSearchCondition()
: Creates a searchcondition for the field
-
atkDateAttribute::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkExpressionAttribute::getSearchCondition()
: Creates a search condition for this attribute.
-
atkFuzzySearchAttribute::getSearchCondition()
: Dummy method to prevent loading/storing of data.
-
atkTagAttribute::getSearchCondition()
: Dummy implementation
-
atkListAttribute::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkMultiSelectAttribute::getSearchCondition()
-
atkFlagAttribute::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkMlAttribute::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkMlWrapper::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkNumberAttribute::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkTimeAttribute::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkManyToOneRelation::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkOneToManyRelation::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkOneToOneRelation::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
-
atkSecureRelation::getSearchCondition()
: Creates a searchcondition for the field, was once part of searchCondition, however, searchcondition() also immediately adds the search condition.
String getSearchFieldName(
String
$prefix
)
|
|
Retrieve the fieldname of the attribute in an atksearch form.
Parameters:
|
String |
$prefix: |
The prefix |
API Tags:
| Return: | Name of the attribute in an atksearch |
String getSearchMode(
[boolean
$extended = false]
)
|
|
Retrieve the current set or default searchmode of this attribute
Parameters:
|
boolean |
$extended: |
Whether extended search is being used |
API Tags:
| Return: | the default searchmode for this attribute. |
String getSearchModeFieldname(
String
$prefix
)
|
|
Retrieve the searchmode name of the attribute in an atksearch form.
Parameters:
|
String |
$prefix: |
The prefix |
API Tags:
| Return: | Name of the attribute in an atksearch |
Retrieve the list of searchmodes supported by the attribute.
Note that not all modes may be supported by the database driver. Compare this list to the one returned by the databasedriver, to determine which searchmodes may be used.
API Tags:
| Return: | List of supported searchmodes |
Redefined in descendants as:
retrieve the tabs and/or sections for this attribute.
array getTabs(
[string
$mode = ""]
)
|
|
retrieve the tabs for this attribute.
Parameters:
Retrieve the html/javascript code for showing the tooltip for this attribute.
API Tags:
String getView(
String
$mode,
&$defaults, array
$defaults
)
|
|
Retrieve the html code for placing this attribute in a view page.
Method is 'smart' and can be overridden in the node using the <attributename>_display() methods.
Framework method, it should not be necessary to call this method directly.
Parameters:
|
String |
$mode: |
The mode ("view") |
|
array |
$defaults: |
The record holding the values for this attribute |
|
|
&$defaults: |
|
API Tags:
| Return: | the HTML code for this attribute that can be used in a viewpage. |
boolean hasDisabledMode(
int
$flag
)
|
|
Check if the attribute is disabled in some mode (use DISABLED_VIEW and DISABLED_EDIT flags).
Parameters:
|
int |
$flag: |
The flag you want to check |
boolean hasFlag(
int
$flag
)
|
|
Check if the attribute has a certain flag.
Parameters:
|
int |
$flag: |
The flag you want to check |
boolean hasStore(
string
$mode
)
|
|
This function is used to check whether a attribute has a store function or not.
It can be overridden to determine when to use store() and when not to use it.
Parameters:
|
string |
$mode: |
The storage mode ("add", "update" or null for all) |
API Tags:
| Return: | true if it has a store method or false if it hasn't. |
| Deprecated: | Use storageType($mode) instead, which has more detailed information about storage. |
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. |
Redefined in descendants as:
-
atkBoolAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkDateAttribute::hide()
: Returns a piece of html code that can be used in a form to display hidden values for this attribute.
-
atkDateTimeAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkUpdateStampAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkDurationAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkFileAttribute::hide()
: Returns a piece of html code that can be used in a form to display hidden values for this attribute.
-
atkFuzzySearchAttribute::hide()
: Dummy method to prevent loading/storing of data.
-
atkTagAttribute::hide()
: Dummy implementation
-
atkMultiSelectAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkFlagAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkMlAttribute::hide()
: Returns a piece of html code that can be used in a form to display hidden values for this attribute.
-
atkMlSelectorAttribute::hide()
: Returns a piece of html code that can be used in a form to display hidden values for this attribute.
-
atkMlWrapper::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkPasswordAttribute::hide()
: Returns a piece of html code that can be used in a form to display hidden values for this attribute.
-
atkProfileAttribute::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkTabbedPane::hide()
: No function, but is necessary
-
atkTimeAttribute::hide()
: Returns a piece of html code that can be used in a form to display hidden values for this attribute.
-
atkManyToManyRelation::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkManyToOneRelation::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
-
atkOneToManyRelation::hide()
: Returns a piece of html code for hiding this attribute in an HTML form.
-
atkOneToOneRelation::hide()
: Returns a piece of html code for hiding this attribute in an HTML form, while still posting its values. (<input type="hidden">)
This function is called right after the attribute is added to the node.
The regular atkAttribute has no implementation for this method, but derived attributes may override this method to perform custom initialization.
Redefined in descendants as:
Initial value. Returns the initial value for this attribute which will be used in the add form etc.
API Tags:
| Return: | initial value for this attribute |
Redefined in descendants as:
Check whether this attribute depends on other attributes.
API Tags:
| Return: | whether the attribute depends on other attribute(s) |
boolean isEmpty(
array
$record
)
|
|
Check if a record has an empty value for this attribute.
Parameters:
|
array |
$record: |
The record that holds this attribute's value. |
Redefined in descendants as:
initially isInitialHidden(
array
$record
)
|
|
check whether initially hidden or not
Parameters:
|
array |
$record: |
the record |
API Tags:
Check wether this attribute should be manually painted (call the edit method) or not.
API Tags:
| Return: | Manually painted? |
Checks if this attribute is really not null in the database.
This method does not look at the AF_OBLIGATORY flag, it only checks in the database if the attribute's column is really not null.
API Tags:
| Return: | attribute's database column not null? |
boolean isPosted(
array
$postvars
)
|
|
Is there a value posted for this attribute?
Parameters:
API Tags:
String label(
[array
$record = array()]
)
|
|
Return the label of the attribute.
The regular atkAttribute does not make use of the $record parameter; The label is based on the attribute name, but is automatically translated. Derived attributes may override this behavior.
Parameters:
|
array |
$record: |
The record holding the value for this attribute. |
API Tags:
| Return: | HTML compatible label for this attribute |
Redefined in descendants as:
String listHeaderSortOrder(
&$columnConfig, atkColumnConfig
$columnConfig
)
|
|
Retrieve the sortorder for the listheader based on the atkColumnConfig
Parameters:
|
atkColumnConfig |
$columnConfig: |
The config that contains options for extended sorting and grouping to a recordlist. |
|
|
&$columnConfig: |
|
API Tags:
| Return: | Returns sort order ASC or DESC |
Redefined in descendants as:
int loadType(
String
$mode, [boolean
$searching = false]
)
|
|
Determine the load type of this attribute.
With this method, the attribute tells the framework whether it wants to be loaded in the main query (addToQuery) or whether the attribute has its own load() implementation. The regular atkAttribute checks if a load() method is present, and returns POSTLOAD in this case, or ADDTOQUERY otherwise. Derived attributes may override this behavior.
Framework method. It should not be necesary to call this method directly.
Parameters:
|
String |
$mode: |
The type of load (view,admin,edit etc) |
|
boolean |
$searching: |
??? |
API Tags:
| Return: | Bitmask containing information about load requirements. Note that since it is a bitmask, multiple load types could be returned at once. POSTLOAD - load() method must be called, after the master record is loaded. PRELOAD - load() must be called, before the master record is loaded. ADDTOQUERY - addtoquery() must be called, so the attribute can nest itself in the master query. NOLOAD - nor load(), nor addtoquery() should be called (attribute can not be loaded from the database) |
Information Tags:
| Todo: | add documentation about the searching argument. What does it do? |
Redefined in descendants as:
Determine the maximum length an input field may be.
Redefined in descendants as:
boolean needsInsert(
array
$record
)
|
|
This function is called by the framework to determine if the attribute needs to be saved to the database in an addDb call.
The regular atkAttribute returns false if the value is empty, or if AF_HIDE is set; true in other cases. Exception: when AF_AUTO_INCREMENT is set, the method always returns true. Derived attributes may override this behavior.
Parameters:
|
array |
$record: |
The record that is going to be saved |
API Tags:
| Return: | True if this attribute should participate in the add query; false if not. |
Redefined in descendants as:
boolean needsUpdate(
array
$record
)
|
|
This function is called by the framework to determine if the attribute needs to be saved to the database in an updateDb call.
The regular atkAttribute returns false if AF_READONLY_EDIT or AF_HIDE_EDIT are set, but derived attributes may override this behavior.
Parameters:
|
array |
$record: |
The record that is going to be saved. |
API Tags:
| Return: | True if this attribute should participate in the update query; false if not. |
Redefined in descendants as:
mixed parseStringValue(
String
$stringvalue
)
|
|
Convert a String representation into an internal value.
Used by CSV imports and the like, to convert string values to internal values. This is somewhat similar to db2value, but this method should, when derived in other attributes, act 'smart' and treat the value as a user string. The default implementation returns the string unmodified, but derived classes may override this method to alter that behaviour.
Parameters:
|
String |
$stringvalue: |
The value to parse. |
API Tags:
Redefined in descendants as:
String partial(
String
$partial, String
$mode
)
|
|
Handle a partial request for this attribute, different attributes support different partials.
Parameters:
|
String |
$partial: |
The name of the partial (i.e. refresh) |
|
String |
$mode: |
The current add/edit mode |
API Tags:
| Return: | HTML Returns the result of the call to the partial handling method |
String partial_refresh(
String
$mode
)
|
|
Partial method to refresh the add/edit field for this attribute.
Parameters:
|
String |
$mode: |
add/edit mode |
API Tags:
| Return: | HTML the output needed to refresh the attribute. |
This function is called at the end of the node's init method.
The regular atkAttribute has no implementation for this method, but derived attributes may override this method to perform custom initialization.
Redefined in descendants as:
void registerKeyListener(
String
$id, [int
$navkeys = KB_CTRLCURSOR]
)
|
|
Register keyboard navigation for this attribute.
This method is called by the attribute itself to register the keyboard navigation, usually from its edit() method. The regular atkAttribute calls this method once for its default text input box. Derived classes may call this for any input box or control they have.
Parameters:
|
String |
$id: |
The unique HTML id of the form element to which navigation is added. |
|
int |
$navkeys: |
The mask indicating which keys to support for navigation. |
void removeDisabledMode(
int
$flag
)
|
|
Removes a disabled mode from the attribute.
Parameters:
|
int |
$flag: |
The flag to remove from the attribute |
Removes a flag from the attribute.
Note that removing flags at any time after the constructor might not always work. There are flags that have already been processed at constructor time, so removing them will be futile.
Parameters:
|
int |
$flag: |
The flag to remove from the attribute |
API Tags:
| Return: | The instance of this atkAttribute |
String search(
[array
$record = array()], [boolean
$extended = false], [string
$fieldprefix = ""]
)
|
|
Returns a piece of html code that can be used to get search terms input from the user.
The framework calls this method to display the searchbox in the search bar of the recordlist, and to display a more extensive search in the 'extended' search screen. The regular atkAttributes returns a simple text input box for entering a keyword to search for.
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 |
| Access: | public |
Information Tags:
| Todo: | find a better way to search on onetomanys that does not require something evil in atkAttribute |
Redefined in descendants as:
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: |
|
Redefined in descendants as:
string searchMode(
[boolean
$extended = false], [string
$fieldprefix = '']
)
|
|
Returns piece of html which is used for setting/selecting the search mode for this attribute.
It will show a pulldown if using extended search and multiple searchmodes are supported otherwise the default searchmode is selected.
Parameters:
|
boolean |
$extended: |
using extended search? |
|
string |
$fieldprefix: |
optional fieldprefix |
API Tags:
| Return: | html which is used for selecting searchmode |
| Access: | public |
void setAttribSize(
mixed
$size
)
|
|
Set the size(s) of the attribute
Parameters:
|
mixed |
$size: |
The max. number of characters that can be entered. If not specified, or set to 0, the max. size is automatically retrieved from the table metadata. By default, the size of the edit box is the same as the maximum number of chars that can be entered (as long as it fits on screen). You can however pass an array of 2 or 3 numbers instead of a single number. In this case, the array is interpreted as follows: - $size[0] - The maximum size that can be entered
- $size[1] - The size of the input box in add/edit forms
- $size[2] - The size of the search box
If $size[2] is not specified, $size[1] will be used instead. If $size[1] is not specified, or the passed value is not an array, all 3 sizes will default to the first value.Note: The sizes that are actually used depend both on the specified size and the size of the field in the database. Usually, these are the same. In the case they differ, the smallest of the 2 will be used. |
void setAttributeSearchmode(
String
$searchmode
)
|
|
Sets the searchmode for an attribute This will cause attributes that respect this to use the attributes searchmode for that particulair attribute instead of the general searchmode.
Parameters:
|
String |
$searchmode: |
The searchmode we want to set on the attribute |
void setColumn(
string
$name
)
|
|
Set column.
Parameters:
|
string |
$name: |
column name |
API Tags:
void setDisabledModes(
[int
$flags = 0]
)
|
|
Sets the disabled mode flag of the attribute
Note that if you assign nothing or 0, this will remove all the flags from the attribute. You can assign multiple flags by using the pipe symbol. Setting the flags will overwrite all previous flag-settings.
Parameters:
|
int |
$flags: |
The flags to be set to the attribute. |
void setFlags(
[int
$flags = 0]
)
|
|
Sets the flags of the attribute
Note that if you assign nothing or 0, this will remove all the flags from the attribute. You can assign multiple flags by using the pipe symbol. Setting the flags will overwrite all previous flag-settings.
Parameters:
|
int |
$flags: |
The flags to be set to the attribute. |
Used to force an attribute to update with every addDb() call
Parameters:
|
bool |
$force: |
Wether or not to force the attribute to insert |
API Tags:
| Return: | Returns the instance of this attribute |
Used to force an attribute to update with every updateDb() call
Parameters:
|
bool |
$force: |
Wether or not to force the attribute to update |
API Tags:
| Return: | Returns the instance of this attribute |
void setInitialHidden(
boolean
$bool
)
|
|
Set whether initially hidden or not. A field is "hidden" by adding the class atkAttrRowHidden.
Parameters:
|
boolean |
$bool: |
Initially hidden? |
void setInitialValue(
mixed
$value
)
|
|
Set initial value for this attribute.
NOTE: the initial value only works if there is no initial_values override in the node or if the override properly calls parent::initial_values!
Parameters:
|
mixed |
$value: |
initial value |
Redefined in descendants as:
-
atkShuttleRelation::setInitialValue()
: AtkShuttleRelation expect or an array whith primary keys of the destionation node or a single value that contains the primary key of the destination node.
Set the label of the attribute
Parameters:
API Tags:
| Return: | The instance of this atkAttribute |
void setLoadType(
int
$type, [string
$mode = null]
)
|
|
Sets the load type.
Parameters:
|
int |
$type: |
Bitmask containg information about load requirements. |
|
string |
$mode: |
The load mode ("view", "admin" etc. or null for all) |
API Tags:
void setManualPaint(
bool
$bool
)
|
|
Set wether the edit() method of this attribute should be called by the framework, or if the edit method is called manually.
Parameters:
|
bool |
$bool: |
TRUE if it is called manually, FALSE if ATK should call it. |
void setOwnerInstance(
&$instance, atkNode
$instance
)
|
|
Sets the owner instance.
Parameters:
void setSections(
array
$sections
)
|
|
Put the attribute on one or more tabs and/or sections.
Example:
$attribute->setSections(array('tab.section','tab.othersection));
Parameters:
|
array |
$sections: |
An array of tabs and/or sections on which the attribute should be displayed. |
void setStorageType(
int
$type, [string
$mode = null]
)
|
|
Sets the storage type.
Parameters:
|
int |
$type: |
Bitmask containg information about storage requirements. |
|
string |
$mode: |
The storage mode ("add", "update" or null for all) |
API Tags:
void setTabs(
array
$tabs
)
|
|
Put the attribute on one or more tabs.
Parameters:
|
array |
$tabs: |
An array of tabs on which the attribute should be displayed. |
boolean showOnTab(
String
$tab
)
|
|
Check if the attribute wants to be shown on a certain tab.
Parameters:
|
String |
$tab: |
The name of the tab to check. |
Redefined in descendants as:
void smartSearchCondition(
Integer
$id, Integer
$nr, Array
$path,
&$query, String
$ownerAlias, Mixed
$value, String
$mode, atkQuery
$query
)
|
|
Creates a smart search condition for a given search value, and adds it to the query that will be used for performing the actual search.
Parameters:
|
Integer |
$id: |
The unique smart search criterium identifier. |
|
Integer |
$nr: |
The element number in the path. |
|
Array |
$path: |
The remaining attribute path. |
|
atkQuery |
$query: |
The query to which the condition will be added. |
|
String |
$ownerAlias: |
The owner table alias to use. |
|
Mixed |
$value: |
The value the user has entered in the searchbox. |
|
String |
$mode: |
The searchmode to use. |
|
|
&$query: |
|
Redefined in descendants as:
Retrieves the sort options for this attribute which is used in recordlists and search actions.
Parameters:
|
atkColumnConfig |
$columnConfig: |
The config that contains options for extended sorting and grouping to a recordlist. |
|
String |
$fieldprefix: |
The prefix of the attribute |
|
atkDataGrid |
$grid: |
The grid that this attribute lives on. |
|
|
&$columnConfig: |
|
API Tags:
Sets the sortorder options for this attribute which is used in recordlists and search actions.
Parameters:
|
atkColumnConfig |
$columnConfig: |
The config that contains options for extended sorting and grouping to a recordlist. |
|
String |
$fieldprefix: |
The prefix of the attribute on HTML forms |
|
atkDataGrid |
$grid: |
The grid that this attribute lives on. |
|
|
&$columnConfig: |
|
API Tags:
int storageType(
[String
$mode = null]
)
|
|
Determine the storage type of this attribute.
With this method, the attribute tells the framework whether it wants to be stored in the main query (addToQuery) or whether the attribute has its own store() implementation. The regular atkAttribute checks if a store() method is present, and returns POSTSTORE in this case, or ADDTOQUERY otherwise. Derived attributes may override this behavior.
Framework method. It should not be necesary to call this method directly.
Parameters:
|
String |
$mode: |
The type of storage ("add" or "update") |
API Tags:
| Return: | Bitmask containing information about storage requirements. Note that since it is a bitmask, multiple storage types could be returned at once. POSTSTORE - store() method must be called, after the master record is saved. PRESTORE - store() must be called, before the master record is saved. ADDTOQUERY - addtoquery() must be called, so the attribute can nest itself in the master query. NOSTORE - nor store(), nor addtoquery() should be called (attribute can not be stored in the database) |
Redefined in descendants as:
array sum(
array
$rec1, array
$rec2, [String
$fieldprefix = ""]
)
|
|
Calculate the sum of 2 records.
This is called by the framework for the auto-totalling feature. Two records are passed, and a record is returned. The reason that the params are entire records instead of plain values, is that derived classes or custom attributes may need information from other attributes too.
Parameters:
|
array |
$rec1: |
The first record |
|
array |
$rec2: |
The second record |
|
String |
$fieldprefix: |
The prefix that values in $rec1 and $rec2 have |
API Tags:
| Return: | A record containing the sum of $rec1 and $rec2 |
String text(
String
$string
)
|
|
Translate using the owner instance's module and type.
Parameters:
|
String |
$string: |
The string to be translated |
API Tags:
| Return: | The translated string. |
void validate(
&$record, String
$mode, array
$record
)
|
|
Checks if a value is valid.
The regular atkAttribute has no specific validation. Derived attributes may override this method to perform custom validation. Note that obligatory and unique fields are checked by the atkNodeValidator, and not by the validate() method itself.
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: |
|
Redefined in descendants as:
String value2db(
array
$rec
)
|
|
Converts the internal attribute value to one that is understood by the database.
For the regular atkAttribute, this means escaping things like quotes and slashes. Derived attributes may reimplement this for their own conversion. This is the exact opposite of the db2value method.
Parameters:
|
array |
$rec: |
The record that holds this attribute's value. |
API Tags:
| Return: | The database compatible value |
Redefined in descendants as:
void _registerDependees(
[String
$mode = ""], [String
$fieldprefix = ""]
)
|
|
Register change handlers for dependees.
A dependee is a different attribute (mostly part of the same node) that needs to be refreshed through an AJAX call if the value of this attribute changes.
Parameters:
|
String |
$mode: |
add/edit mode |
|
String |
$fieldprefix: |
The prefix for this attribute in an HTML form |
API Tags:
void _renderChangeHandler(
String
$fieldprefix
)
|
|
Renders the onchange code on the page.
Parameters:
|
String |
$fieldprefix: |
The prefix to the field |
API Tags:
Redefined in descendants as:
String representation for this attribute (PHP5 only).
API Tags:
| Return: | attribute name prefixed with node type |