The atkNode class represents a piece of information that is part of an application. This class provides standard functionality for adding, editing and deleting nodes.
This class must be seen as an abstract base class: For every piece of information in an application, a class must be derived from this class with specific implementations for that type of node.
Located in /class.atknode.inc (line 280)
| Class | Description |
|---|---|
| atkFileEditor | File editing node. |
| atkMetaNode | The ATK Meta Node class. |
| atkTreeNode | Extension on the atkNode class. Here you will find all functions for the tree view. If you want to use the treeview, you must define the atkTreeNode instead of atkNode. |
| test | The atkNode class represents a piece of information that is part of an application. This class provides standard functionality for adding, editing and deleting nodes. |
| atkMockNode | The atkMockNode class is an atkNode mock object for testing purposes |
| atkDataNode | The ATK data node can be used to create nodes that don't retrieve their data from the database. |
The action that the node is currently performing.
List of action listeners
The database that the node is using for storing and loading its data.
Default language used by Multilanguage Nodes.
Default order by statement.
Descriptor handler.
Descriptor template.
A list of mra actions that need to be accessed through a dialog.
Bitwise mask of node flags (NF_* flags).
The active action handler.
For speed, we keep track of a list of attributes that we don't have to load in recordlists.
The lock instance
The module of the node.
Number to use with numbering
Contains the definition of what needs to rendered partially.
If set to NULL not in partial rendering mode.
The postvars (or getvars) that are passed to a page will be passed to the class using the dispatch function. We store them in a member variable for easy access.
List of names of the attributes that form this node's primary key.
The right to execute certain actions can be implied by the fact that you
have some other right. For example, if you have the right to access a feature (admin right), you may also view that record, and don't need explicit rights to view it. So the 'view' right is said to be 'implied' by the 'admin' right. This is a subtle difference with m_securityMap.
Actions are mapped to security units.
For example, both actions "save" and "add" require access "add". If an item is not in this list, it's treated 'as-is'. Derived nodes may add more mappings to tell the systems that some custom actions require the same privilege as others. Structure: array($action=>$requiredPrivilege)
The name of the sequence used for autoincrement fields.
The table to use for data storage.
List of trigger listeners
The nodetype.
For speed, we keep track of a list of attributes that we don't have to load when in view pages.
Constructor.
This initialises the node. Derived classes should always call their parent constructor ($this->atkNode($name, $flags), to initialize the base class.
Example:
Generate a title for a certain action on a certain action.
The default implementation displayes the action name, and the descriptor of the current record between brackets. This can be overridden by derived classes.
Add an atkAttribute (or one of its derivatives) to the node.
Disable privilege checking for an action.
This method disables privilege checks for the specified action, for the duration of the current http request.
Save a new record to the database.
The record is passed by reference, because any autoincrement field gets its value when stored to the database. The record is updated, so after the call to addDb you can use access the primary key fields.
Add sections that must be expanded by default.
Add an mra action that need to be accessed through a dialog.
Add a recordset filter.
Add a flag to the node.
Add an atkActionListener to the node.
Set the security of one or more actions action the same as other actions.
If $mapped is empty $action has to be an array. The key would be used as action and would be mapped to the value. If $mapped is not empty $action kan be a string containing one action of an array with one or more action. In both cases al actions would be mapped to $mappped
Add a stylesheet to the page.
The theme engine is used to determine the path, and load the correct stylesheet.
Add this node to an existing query.
Framework method, it should not be necessary to call this method directly. This method is used when adding the entire node to an existing query, as part of a join.
Add a unique field set.
When you add a set of attributes using this method, any combination of values for the attributes should be unique. For example, if you pass array("name", "parent_id"), name does not have to be unique, parent_id does not have to be unique, but the combination should be unique.
This function determines if the user has the privilege to perform a certain action on the node.
Apply the given search criteria to the given query object.
Apply the given smart search criteria to the given query object.
Get the full atknodetype of this node (module.nodetype notation).
This function resorts the attribIndexList.
This is necessary if you add attributes *after* init() is already called, and you set an order for those attributes.
Builds a list of tabs.
This doesn't generate the actual HTML code, but returns the data for the tabs (title, selected, urls that should be loaded upon click of the tab etc).
Invoke the handler for an action.
If there is a known registered external handler method for the specified action, this method will call it. If there is no custom external handler, the atkActionHandler object is determined and the actionis invoked on the actionhandler.
change the securitymap that already exist. Where actions are mapped on $oldmapped change it by $newmapped
Check attribute security.
Makes some attributes read-only, or hides the attribute based on the current mode / record.
Remove tabs without attribs from the tablist
Check if the user has the rights to access existing tabs and removes tabs from the list that may not be accessed
Function returns a page in which the user is asked if he really wants to perform a certain action.
Determine the confirmation message.
Copy a record in the database.
Primarykeys are automatically regenerated for the copied record. Any detail records (onetomanyrelation) are copied too. Refered records manytoonerelation) are not copied.
Count the number of records in the database that a call to selectDb would return.
Retrieve an array with the default actions for a certain mode.
This will return a list of actions that can be performed on records of this node in an admin screen. The actions may contain a [pk] template variable to reference a record, so for each record you should run the stringparser on the action.
Delete record(s) from the database.
After deletion, the postDel() trigger in the node method is called, and on any attribute that has the AF_CASCADE_DELETE flag set, the delete() method is invoked.
Determine a descriptor of a record.
The descriptor is a string that describes a record for the user. For person records, this may be the firstname and the lastname, for companies it may be the company name plus the city etc. The descriptor is used when displaying records in a dropdown for example, or in the title of editpages, delete confirmations etc.
The descriptor method calls a method named descriptor_def() on the node to retrieve a template for the descriptor (string with attributenames between blockquotes, for example "[lastname], [firstname]".
If the node has no descriptor_def() method, the first attribute of the node is used as descriptor.
Derived classes may override this method to implement custom descriptor logic.
Retrieve the list of attributes that are used in the descriptor definition.
This is the wrapper method for all http requests on a node.
The method looks at the atkaction from the postvars and determines what should be done. If possible, it instantiates actionHandlers for handling the actual action.
Function outputs an array with edit fields. For each field the array contains the name, edit HTML code etc. (name, html, obligatory, error, label)
Retrieve new values for an existing record.
The system calls this method to override the values of a record before editing the record. The default implementation does not do anything to the record, but derived classes may override this method to make modifications to. the record.
Executes a trigger on a add,update or delete action
To prevent triggers from executing twice, the method stores an indication in the record when a trigger is executed. ('__executed<triggername>')
Determine the url for the feedbackpage.
Output is dependent on the feedback configuration. If feedback is not enabled for the action, this method returns an empty string, so the result of this method can be passed directly to the redirect() method after completing the action.
The $record parameter is ignored by the default implementation, but derived classes may override this method to perform record-specific feedback.
Checks if the user has filled in something: return true if he has, otherwise return false
Render a generic page, with a box, title, stacktrace etc.
Get the active sections.
Returns the currently active tab.
Note that in themes which use dhtml tabs (tabs without reloads), this method will always return the name of the first tab.
Get an attribute by name.
Returns a list of attribute names.
Gets the attribute order.
Gets all the attributes.
Determine the default form parameters for an action template.
Get descriptor handler.
Returns the descriptor template for this node.
Retrieve the mra actions that need to be accessed through a dialog.
Get extended search action.
Returns the node flags.
Returns the form buttons for a certain page.
Can be overridden by derived classes to define custom buttons.
Get the atkActionHandler object for a certain action.
The default implementation returns a default handler for the action, but derived classes may override this to return a custom handler.
Retrieve help link for the current node.
Get img tag for lock icon.
Returns the multi-record-action selection mode.
Gets the numbering of the attributes
Get default sort order for the node.
Get the page instance of the page on which the node can render output.
Get search condition for this node.
Get the current searchmode.
Retrieve the sections for the active tab.
Returns the node's security alias (if set).
Strip section part from a section and return the tab.
If no tab name is provided, the default tab is returned.
Returns the table name for this node.
Get a list of tabs for a certain action.
Retrieve the tabnames from the sections string (tab.section).
Get the template to use for a certain action.
The system calls this method to determine which template to use when rendering a certain screen. The default implementation always returns the same template for the same action (it ignores parameter 2 and 3). You can override this method in derived classes however, to determine on the fly which template to use. The action, the current record (if any) and the tab are passed as parameter. By using these params, you can have custom templates per action, and/or per tab, and even per record.
Get the ui instance for drawing and templating purposes.
Group fields by section.
Checks if the node has a certain flag set.
Get the help url for this node.
Retrieves the url of the help popup, if there is help available for this node.
Function outputs a form with all values hidden.
This is probably only useful for the atkOneToOneRelation's hide method.
This function initialises certain elements of the node.
This must be called right after the constructor. The function has a check to prevent it from being executed twice. If you construct a node using 'new', you have to call this method. If you construct it with the getNode or newNode method, you don't have to call this method.
Retrieve the initial values for a new record.
The system calls this method to create a new record. By default this method returns an empty record, but derived nodes may override this method to perform record initialization.
Add sections to the edit/view fields array.
Checks if the attribute is needed in a select query
Is partial request?
Generate a box displaying a message that the current record is locked.
Update a record with variables from a form posting.
Similar to updateRecord(), but here you can pass an existing record (for example loaded from the db), and update it with the the variables from the request. Instead of returning a record, the record you pass is modified directly.
Notify all listeners of the occurance of a certain action.
Function that is called by the framework, right after a new record has been saved to the database.
This function does essentially nothing, but it can be overriden in derived classes if you want to do something special after you saved a record.
Deprecated function that is called by the framework, right after a record has been deleted.
Please use postDelete() instead.
Function that is called by the framework, right after a record has been deleted.
This function does essentially nothing, but it can be overriden in derived classes if you want to do something special after a record is deleted.
Function that is called by the framework, right after an existing record has been updated in the database.
This function does essentially nothing, but it can be overriden in derived classes if you want to do something special after the record is updated.
If the NF_TRACK_CHANGES flag is present for the node, both the new and the original record are passed to this method. The original record is stored in the new record, in $record["atkorgrec"].
Function that is called by the framework, just before a new record will be saved to the database.
This function does essentially nothing, but it can be overriden in derived classes if you want to modify the record just before it will be saved.
The preAddToEditArray method is called from within the editArray
method prior to letting the attributes add themselves to the edit array, but after the edit record values have been collected (a combination of the current record, initial/edit values and the forced values). This makes it possible to do some last-minute modifications to the record data and possibily add some last-minute attributes etc.
Function that is called by the framework, right before a copied record is stored to the database.
This function does nothing, but it can be overriden in derived classes if you want to do some processing on a record before it is being copied. Typical usage would be: Suppose you have a field named 'title' in a record. In the preCopy method, you could change the title field of the record to 'Copy of ..', so the user can distinguish between the original and the copy.
Function that is called by the framework, right before a record will be deleted. Should this method return false the deleting will halt.
This function does essentially nothing, but it can be overriden in derived classes if you want to do something special after a record is deleted.
If this function returns false the delete action will not continue.
Notify all listeners in advance of the occurance of a certain action.
Function that is called by the framework, just before an existing record will be saved to the database.
This function does essentially nothing, but it can be overriden in derived classes if you want to modify the record just before it will be saved.
Returns the primary key sql expression of a record.
Retrieve the name of the primary key attribute.
Note: If a node has a primary key that consists of multiple attributes, this method will retrieve only the first attribute!
Returns a primary key template.
Like primaryKey(), this method returns a sql expression, but in this case, no actual data is used. Instead, template fields are inserted into the expression. This is useful for rendering multiple primary keys later with a record and a template parser.
Function that is called for each record in a recordlist, to determine what actions may be performed on the record.
This function does nothing, but it can be overriden in derived classes, to make custom actions for certain records. The array with actions (edit, delete, etc.) is passed to the function and can be modified. To create a new action, just do $actions["new_action"]=$url; in the derived function. To disable existing actions, for example the edit action, for a record, use: unset($actions["edit"]);
Redirect the browser to a different location.
This is usually used at the end of actions that have no output. An example: when the user clicks 'save and close' in an edit screen, the action 'save' is executed. If the save is succesful, this method is called to redirect the user back to the adminpage. When $config_debug is set to 2, redirects are paused and you can click a link to execute the redirect (useful for debugging the action that called the redirect). Note: this method should be called before any output has been sent to the browser, i.e. before any echo or before the call to atkOutput::outputFlush().
Remove an attribute.
Completely removes an attribute from a node. Note: Since other functionality may already depend on the attribute that you are about to remove, it's often better to just hide an attribute if you don't need it.
Remove sections that must be expanded by default.
Search and remove a recordset filter.
Removes a flag from the node.
Render a generic action.
Renders actionpage.tpl for the desired action. This includes the given block(s) and a pagetrial, but not a box.
Resolves a possible node / action alias for the given node / action.
The given node alias and action are updated depending on the found mapping.
Resolve section. If a section is only prefixed by a dot this means we need to add the default tab before the dot.
Resolve sections.
Resolve sections, tabs and the order based on the given argument to the attribute add method.
Search all records for the occurance of a certain expression.
This function searches in all fields that are not AF_HIDE_SEARCH, for a certain expression (substring match). The search performed is an 'or' search. If any of the fields contains the expression, the record is added to the resultset.\
Currently, searchDb only searches those attributes that are of type string or text.
Retrieve the security key of an action.
Returns the privilege required to perform a certain action. Usually, the privilege and the action are equal, but in m_securityMap, aliasses may be defined.
Retrieve records from the database using a handy helper class. PHP5 only.
Retrieve records from the database.
Note that if 'atksearch' is set in the request vars, the search expressions are automatically added as extra where-clauses.
This function reads meta information from the database and initialises its attributes with the metadata.
This method should be called before rendering a form, if you want the sizes of all the inputs to match the fieldlengths from the database.
Sets an attributes order
Set default tab being displayed in view/add/edit mode.
After calling this method, all attributes which are added after the method call without specification of tab will be placed on the default tab. This means you should use this method before you add any attributes to the node. If you accept the default name for the first tab ("default") you do not need to call this method.
Set descriptor handler.
Sets the descriptor template for this node.
Sets the editable list attributes. If you supply this method with one or more string arguments, all arguments are collected in an array. Else the first parameter will be used.
Set extended search action.
Use this function to enable feedback for one or more actions.
When feedback is enabled, the action does not immediately return to the previous screen, but first displays a message to the user. (e.g. 'The record has been saved').
Create an alphabetical index.
Any string- or textbased attribute can be used to create an alphabetical index in admin- and selectpages.
Sets the multi-record-action selection mode. Can either be MRA_MULTI_SELECT (default), MRA_SINGLE_SELECT or MRA_NO_SELECT.
Sets numbering of the attributes to begin with the number that was passed to it, or defaults to 1.
Set default sort order for the node.
Sets the possible multi-record-priority actions.
Sets the priority range, for multi-record-priority actions.
Sets the search action.
The search action is the action that will be performed if only a single record is found after doing a certain search query.
You can specify more then 1 action. If the user isn't allowed to execute the 1st action, the 2nd action will be used, etc. If you want to pass multiple actions, just pass multiple params (function has a variable number of arguments).
Set the security alias of a node.
By default a node has it's own set of privileges. With this method, the privileges of another node can be used. This is useful when you have a master/detail relationship, and people may manipulate details when they have privileges on the master node. Note: When setting an alias for the node, the node no longer has to have a registerNode call in the getNodes method in module.inc.
Set tab index
Set the table that the node should use.
Note: This should be called in the constructor of derived classes, after the base class constructor is called.
Display a statusbar with a stacktrace and a help button.
Place a set of tabs around content.
Translate using this node's module and type.
Update a record in the database.
The record should already exist in the database, or this method will fail.
Parse a set of url vars into a valid record structure.
When attributes are posted in a formposting, the values may not be valid yet. After posting, a call to updateRecord should be made to translate the html values into the internal values that the attributes work with.
Validates a record.
Validates unique fields, required fields, dataformat etc.
Validates if a filter is valid for this node.
A filter is considered valid if it doesn't contain any fields that are not part of the node.
Why isn't this used more often???
Function outputs an array with view fields. For each field the array contains the name, view HTML code etc.
String representation for this node (PHP5 only).
Documentation generated on Thu, 30 Aug 2007 11:22:16 +0200 by phpDocumentor 1.3.0RC6