static int bitOr(
int
$a, int
$b
)
|
|
Utility method to bit-or two integers.
Parameters:
|
int |
$a: |
integer a |
|
int |
$b: |
integer b |
API Tags:
| Return: | result of bit-or |
| Access: | public |
static int cmpAttributes(
array
$a, array
$b
)
|
|
Compares two attributes based on their order.
Parameters:
|
array |
$a: |
attribute |
|
array |
$b: |
attribute |
API Tags:
| Return: | order (a == b ? 0 : (a < b ? -1 : 1)) |
| Access: | public |
Returns an instance of the meta policy using the given class. If no class is specified the default meta policy is used determined using the $config_meta_policy variable.
Parameters:
|
atkMetaNode |
$node: |
policy node |
|
string |
$class: |
full ATK policy class path |
API Tags:
| Return: | meta policy |
| Access: | public |
Constructor.
Parameters:
API Tags:
atkMetaAttributeModifier add(
string|array
$name, [string
$type = 'atkattribute'], [array
$params = array()], [int
$flags = 0], [string|array
$sections = NULL], [int
$order = NULL], [mixed
$default = self::NO_DEFAULT_VALUE]
)
|
|
Add / replace (custom) attribute.
Parameters:
|
string|array |
$name: |
attribute name or list of attributes |
|
string |
$type: |
attribute type |
|
array |
$params: |
attribute parameters, excluding flags (optional) |
|
int |
$flags: |
attribute flags (optional) |
|
string|array |
$sections: |
sections/tabs to display the attribute on |
|
int |
$order: |
order of the attribute |
|
mixed |
$default: |
default value |
API Tags:
void addDefaultFlags(
array|string
$exclude_attrs, [int
$flags = 0]
)
|
|
Add default flag(s) to all attributes, except the specifed attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the flag(s).
Parameters:
|
array|string |
$exclude_attrs: |
list of attribute names or single attribute name to exclude |
|
int |
$flags: |
flag(s) |
API Tags:
atkMetaAttributeModifier addFieldSet(
string
$name, string
$template, [int
$flags = 0], [string|array
$sections = NULL], [int
$order = NULL]
)
|
|
Add fieldset.
To include an attribute label use [attribute.label] inside your template. To include an attribute edit/display field use [attribute.field] inside your template.
Parameters:
|
string |
$name: |
name |
|
string |
$template: |
template string |
|
int |
$flags: |
attribute flags |
|
string|array |
$sections: |
sections/tabs to display the attribute on |
|
int |
$order: |
order of the attribute |
API Tags:
void addFlag(
array|string
$attrs, int
$flags
)
|
|
Add flag(s) for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the flag(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
int |
$flags: |
flag(s) |
API Tags:
void addFlags(
array|string
$attrs, int
$flags
)
|
|
Add flag(s) for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the flag(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
int |
$flags: |
flag(s) |
API Tags:
void addForceInsert(
string|array
$attrs
)
|
|
Enable force insert for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
void addForceUpdate(
string|array
$attrs
)
|
|
Enable force update for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
Build / setup node using the collected attributes.
API Tags:
void exists(
string
$name
)
|
|
Does the given attribute exist?
Parameters:
|
string |
$name: |
attribute name |
API Tags:
Returns the attribute modifier for the given attributes. The modifier allows you to add flags, set tabs etc. through a fluent interface.
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
Returns an attribute modifier for all attributes.The modifier allows you to add flags, set tabs etc. through a fluent interface.
API Tags:
array getAttributeNames(
)
|
|
Returns the attribute names.
API Tags:
| Return: | string attribute names |
| Access: | public |
Returns a reference to the attributes array.
Be very careful when using this array, modifying it might void your warranty!
API Tags:
| Return: | reference to the attributes array |
| Access: | public |
Returns the meta compiler.
API Tags:
| Return: | the meta compiler |
| Access: | public |
Returns the currently set excludes (if applicable).
API Tags:
| Return: | excludes list |
| Access: | public |
Returns the meta grammar.
API Tags:
| Return: | the meta grammar |
| Access: | public |
Returns the meta handler.
API Tags:
| Return: | the meta handler |
| Access: | public |
Returns the currently set includes (if applicable).
API Tags:
| Return: | includes list |
| Access: | public |
Returns the meta data for this policy's table.
API Tags:
| Return: | meta data |
| Access: | public |
Returns the node for this policy.
API Tags:
| Return: | policy node |
| Access: | public |
string getNodeDatabase(
)
|
|
Returns the node database.
API Tags:
| Return: | database name |
| Access: | public |
string getNodeDescriptor(
)
|
|
Returns the node descriptor.
API Tags:
| Return: | descriptor |
| Access: | public |
Returns the node filter.
API Tags:
| Return: | filter |
| Access: | public |
Returns the node flags.
API Tags:
| Return: | node flags |
| Access: | public |
Returns the index column.
API Tags:
| Return: | index column |
| Access: | public |
Returns the (default) node order.
API Tags:
| Return: | node order |
| Access: | public |
string getNodeSecurityAlias(
)
|
|
Returns the node security alias.
API Tags:
| Return: | security alias |
| Access: | public |
array getNodeSecurityMap(
)
|
|
Returns the additional node security map
API Tags:
| Return: | security map |
| Access: | public |
string getNodeSequence(
)
|
|
Returns the node sequence.
API Tags:
| Return: | sequence name |
| Access: | public |
Returns the node table.
API Tags:
| Return: | table name |
| Access: | public |
atkMetaAttributeModifier hasMany(
string
$accessor, [string|array
$templateOrOptions = array()], [array
$options = array()], [int
$flags = 0]
)
|
|
One-to-many / many-to-many relation support. You can call the hasMany method to indicate that this node has a one-to-many or a many-to-many relationship with another node. The meta policy will then try to guess, amongst other things, which fields should be used for this relation.
This method uses a smart name guessing scheme for the (optional intermediate) and destination node. If you enter the plural form of the (singular) node name it will still be able to find the node. You can ommit the module name prefix if the destination node resides in the same module as the source node. Ofcourse you can also just use the real module/node name combination.
The options list may contain several parameters to make more complex relations work. The supported parameters are as follows:
- dest(-ination) destination attribute name
- filter destination filter
- through intermediary node name (for many-to-many relations)
- local if ATK can't determine the key in the intermediary node
automatically, use local to tell it which key points to
the source node.
- remote if ATK can't determine the key in the intermediary node
use remote to tell it which key points to the
destination node.
- type type of many-to-many relation (shuttle, select,
eshuttle, bool(ean) or list, defaults to shuttle)
- cols/columns number of columns (many-to-many bool relations only)
- rows number of rows (many-to-many list relations only)
- name name for this relation (by default getNodeType($accessor))
Parameters:
|
string |
$accessor: |
accessor name (complete description is given above) |
|
string|array |
$templateOrOptions: |
template or list of options (complete description is given above) |
|
array |
$options: |
list op options (complete description is given above) |
|
int |
$flags: |
the flags for the relation |
API Tags:
atkMetaAttributeModifier hasOne(
string
$accessor, [string|array
$templateOrOptions = array()], [array
$options = array()], [int
$flags = 0]
)
|
|
Many-to-one / one-to-one relation support. You can call the hasOne method to indicate that this node has a many-to-one or a one-to-one relation with another node. The meta policy will then try to guess, amongst other things, which fields should be used for this relation.
To determine if a many-to-one or a one-to-one relation should be used the system will check if the source node contains an attribute for storing the relation. If so the system will use a many-to-one relation, else a one-to-one relation will be used.
This method uses a smart name guessing scheme for the destination node. If you enter the singular form of the (plural) node name it will still be able to find the node. You can ommit the module name prefix if the destination node resides in the same module as the source node. Ofcourse you can also just use the real module/node name combination.
The options list may contain several parameters to make more complex relations work. The supported parameters are as follows:
- source source attribute name (should only be used for
many-to-one relations and will act as an indicator
for whatever this is a many-to-one relation or not)
- dest(-ination) destination attribute name (should only be used for
one-to-one relations and will act as an indicator
for whatever this is a one-to-one relation or not)
- filter destination filter
- large boolean indicating if there will be lots and lots of
records in case of a many-to-one relation, same as
the AF_LARGE flag (defaults to false)
Parameters:
|
string |
$accessor: |
accessor name (complete description is given above) |
|
string|array |
$templateOrOptions: |
template or list of options (complete description is given above) |
|
array |
$options: |
list op options (complete description is given above) |
|
int |
$flags: |
the flags for the relation |
API Tags:
void importAttribute(
string
$type
)
|
|
Import attribute of the given type, we do this as soon as attributes are added to the meta node or the type has been changed so that the flags for the attribute are available.
Parameters:
|
string |
$type: |
attribute type |
API Tags:
void remove(
string|array
$name
)
|
|
Remove attribute.
Parameters:
|
string|array |
$name: |
attribute name |
API Tags:
void removeFlag(
array|string
$attrs, int
$flags
)
|
|
Remove flag(s) from the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the flag(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
int |
$flags: |
flag(s) |
API Tags:
void removeFlags(
array|string
$attrs, int
$flags
)
|
|
Remove flag(s) from the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the flag(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
int |
$flags: |
flag(s) |
API Tags:
void removeForceInsert(
string|array
$attrs
)
|
|
Disable force insert for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
void removeForceUpdate(
string|array
$attrs
)
|
|
Disable force update for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
void setColumn(
array|string
$attrs, array|string
$column
)
|
|
Set the column for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the section name(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
array|string |
$column: |
colum name |
API Tags:
Sets the meta compiler.
Parameters:
API Tags:
void setDefaultValue(
array|string
$attrs, mixed
$value
)
|
|
Set the default value for the given attribute(s).
This method can also be called with multiple attribute string arguments as long as the last argument contains the default value.
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
mixed |
$value: |
default value |
API Tags:
void setExcludes(
string|array
$attrs
)
|
|
Set excludes.
NOTE: Attributes manually added through the policy will always be included unless they are explicitly removed using the remove method!
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
void setFlag(
array|string
$attrs, int
$flags
)
|
|
Set flag(s) for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the flag(s).
NOTE: this method will overwrite all currently set flags, including automatically detected flags!
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
int |
$flags: |
flag(s) |
API Tags:
void setFlags(
array|string
$attrs, int
$flags
)
|
|
Set flag(s) for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the flag(s).
NOTE: this method will overwrite all currently set flags, including automatically detected flags!
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
int |
$flags: |
flag(s) |
API Tags:
Sets the meta grammar.
Parameters:
API Tags:
void setHandler(
mixed
$handler
)
|
|
Sets the meta handler.
Parameters:
|
mixed |
$handler: |
the meta compiler |
API Tags:
void setIncludes(
string|array
$attrs
)
|
|
Set includes. Implicitly sets the order!
NOTE: Attributes manually added through the policy will always be included unless they are explicitly removed using the remove method!
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
Sets the node for this policy.
Parameters:
API Tags:
void setNodeDescriptor(
string
$descriptor
)
|
|
Sets the node descriptor.
Parameters:
|
string |
$descriptor: |
descriptor |
API Tags:
void setNodeFilter(
string
$filter
)
|
|
Sets the node filter.
Parameters:
API Tags:
void setNodeFlags(
int
$flags
)
|
|
Sets the node flags
Parameters:
API Tags:
void setNodeIndex(
string
$column
)
|
|
Sets the node index column.
Parameters:
|
string |
$column: |
index column |
API Tags:
void setNodeOrder(
string
$order
)
|
|
Sets the (default) node order.
Parameters:
|
string |
$order: |
node order |
API Tags:
void setNodeSecurityAlias(
string
$alias
)
|
|
Sets the node security alias.
Parameters:
|
string |
$alias: |
security alias |
API Tags:
void setNodeSecurityMap(
array
$map
)
|
|
Sets the node additional security map.
Parameters:
|
array |
$map: |
security map array |
API Tags:
void setNodeSequence(
string
$sequence
)
|
|
Sets the node sequence name.
Parameters:
|
string |
$sequence: |
sequence name |
API Tags:
void setOrder(
string|array
$attrs
)
|
|
Sets the attribute order. All attributes not mentioned will be moved to the bottom using their current order.
This method can also be called with multiple attribute string arguments.
Parameters:
|
string|array |
$attrs: |
attribute name(s) |
API Tags:
void setSection(
array|string
$attrs, array|string
$sections
)
|
|
Set the sections/tabs for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the section name(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
array|string |
$sections: |
section name(s) |
API Tags:
void setSections(
array|string
$attrs, array|string
$sections
)
|
|
Set the sections/tabs for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the section name(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
array|string |
$sections: |
section name(s) |
API Tags:
void setTab(
array|string
$attrs, array|string
$tabs
)
|
|
Set the sections/tabs for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the section name(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
array|string |
$tabs: |
tab name(s) |
void setTabs(
array|string
$attrs, array|string
$tabs
)
|
|
Set the sections/tabs for the given attribute or list of attributes.
This method can also be called with multiple attribute string arguments as long as the last argument contains the section name(s).
Parameters:
|
array|string |
$attrs: |
list of attribute names or single attribute name |
|
array|string |
$tabs: |
tab name(s) |
API Tags:
void setType(
string|array
$attr, string
$type, mixed
2
)
|
|
Sets the attribute type. All extra arguments after the two standard arguments will be threated as parameters for the attribute. If you need to pass arguments by reference you can better use the setTypeAndParams method.
Parameters:
|
string|array |
$attr: |
the attribute name or a list of attributes |
|
string |
$type: |
full ATK attribute class (e.g. atk.attributes.atkboolattribute) |
|
mixed |
2: |
... all other arguments will be threated as parameters |
API Tags:
void setTypeAndParams(
string|array
$attr, string
$type, [array
$params = array()]
)
|
|
Sets the attribute type and parameters.
Parameters:
|
string|array |
$attr: |
the attribute name or a list of attributes |
|
string |
$type: |
full ATK attribute class (e.g. atk.attributes.atkboolattribute) |
|
array |
$params: |
parameters for the attribute (optional) |
API Tags:
Sort the attributes based on their order.
API Tags:
String text(
mixed
$string, [String
$module = NULL], [String
$language = ''], [String
$firstFallback = ""], [boolean
$nodeDefaultText = false]
)
|
|
Translate using the node's module and type.
Parameters:
|
mixed |
$string: |
string or array of strings containing the name(s) of the string to return when an array of strings is passed, the second will be the fallback if the first one isn't found, and so forth |
|
String |
$module: |
module in which the language file should be looked for, defaults to core module with fallback to ATK |
|
String |
$language: |
ISO 639-1 language code, defaults to config variable |
|
String |
$firstFallback: |
the first module to check as part of the fallback |
|
boolean |
$nodeDefaultText: |
if true, then it doesn't return a default text when it can't find a translation |
API Tags:
| Return: | the string from the languagefile |
| Access: | public |
string _cache(
string
$code
)
|
|
Write compiled meta node code to cache.
Parameters:
|
string |
$code: |
compiled code |
API Tags:
| Return: | file path |
| Access: | protected |
mixed _call(
string
$method, array
$params
)
|
|
Calls a method of this object with the given parameters.
Parameters:
|
string |
$method: |
the method name |
|
array |
$params: |
the method parameters |
API Tags:
| Return: | result |
| Access: | protected |
Compile policy.
API Tags:
| Return: | code compiled code |
| Access: | protected |
string _detectNodeSequence(
)
|
|
Detect node sequence name.
API Tags:
| Return: | sequence name |
| Access: | protected |
string _detectNodeTable(
)
|
|
Detect node table name.
API Tags:
| Return: | table name |
| Access: | protected |
string _findDestination(
string
$accessor, bool
$toMany
)
|
|
Find destination node for the given meta relation.
Parameters:
|
string |
$accessor: |
accessor name |
|
bool |
$toMany: |
accessor name might be in plural form? |
API Tags:
| Return: | destination node name for the given relation |
| Access: | protected |
string _findSourceAttribute(
string
$destination
)
|
|
Find source attribute for a many-to-one relation that point to the given destination node.
Parameters:
|
string |
$destination: |
destination node type |
API Tags:
| Return: | source attribute name |
| Access: | protected |
mixed _getDefaultValue(
string
$name, array
$meta
)
|
|
Get auto-detected default value for the given attribute.
Parameters:
|
string |
$name: |
column/attribute name |
|
array |
$meta: |
column meta data |
API Tags:
| Return: | default value |
| Access: | protected |
array _getDestinationAttributeVariants(
[string
$destination = null]
)
|
|
Returns a list of possible attribute name variants for relations which reference this node or the given destination node.
Parameters:
|
string |
$destination: |
destination node |
API Tags:
| Return: | list of attribute variants |
| Access: | protected |
int _getFlags(
string
$name, array
$meta
)
|
|
Returns the auto-detected flags for the given attribute.
Parameters:
|
string |
$name: |
attribute/column name |
|
array |
$meta: |
column meta data |
API Tags:
| Return: | flags |
| Access: | protected |
Returns the current maximum order in the attribute list.
API Tags:
| Return: | max order |
| Access: | protected |
int _getOrder(
string
$name, array
$meta
)
|
|
Get auto-detected order for the given attribute.
Parameters:
|
string |
$name: |
column/attribute name |
|
array |
$meta: |
column meta data |
API Tags:
| Return: | order |
| Access: | protected |
array _getTypeAndParams(
string
$name, array
$meta
)
|
|
Get attribute type and params for the given attribute/column.
Returns an array which looks like the following: array("type" => ..., "params" => array(...))
Parameters:
|
string |
$name: |
attribute/column name |
|
array |
$meta: |
column meta data |
API Tags:
| Return: | type and params |
| Access: | protected |
Initialize attributes using policy.
API Tags:
void _initAttribute(
string
$name, array
$meta
)
|
|
Intialize attribute for node using the given column meta data.
Parameters:
|
string |
$name: |
column name |
|
array |
$meta: |
column meta data |
API Tags:
Modify meta policy, by default the meta method of the node is called.
API Tags:
void _setMetaData(
array
$metaData
)
|
|
Sets the meta data for this policy's table.
Parameters:
|
array |
$metaData: |
meta data |
API Tags:
void _setNodeDatabase(
string
$database
)
|
|
Sets the node database.
Only for internal use, because it's too late to set this from inside the meta method.
Parameters:
|
string |
$database: |
database name |
API Tags:
void _setNodeTable(
string
$table
)
|
|
Sets the node table name.
Only for internal use, because it's too late to set this from inside the meta method.
Parameters:
|
string |
$table: |
table name |
API Tags: