Current Record: Application_Delegate_Class #12

Table of Contents Synopsis Location Example Available Methods Triggers Preferences Permissions Registration Forgot Password Accou...

Current Record: Application_Delegate_Class #12

Table of Contents Synopsis Location Example Available Methods Triggers Preferences Permissions Registration Forgot Password Accou...

Application Delegate Class

[Permalink]

Synopsis

The application delegate class is similar to the table_delegate_class except that it is applicable to the application as a whole, not just one table. It allows the developer to implement hooks that will be executed by Xataface to modify behavior.

Examples of customizations that can be made with the Application Delegate class include:

  • Permissions
  • User Preferences
  • Custom content to be inserted into templates.
  • Triggers
  • more.

Location

The delegate class is optional and should be located in the conf/ApplicationDelegate.php file in the application directory.

Example

<?php
class conf_ApplicationDelegate {
   function getPermissions(&$record){
       return Dataface_PermissionsTool::NO_ACCESS();
   }
}

Available Methods

Triggers

Name Description Version
after_action_activate Trigger called after activation is complete. Activation occurs after a user registers and responds to the registration confirmation email. 1.2.5
after_action_login Trigger called after a user logs in 1.0
after_action_logout Trigger called after a user logs out 1.0
after_action_edit Trigger called after the edit action completes. 1.0
after_action_new Trigger called after new action completes. 1.0
after_action_delete Trigger called after the delete action completes. 1.0
after_action_activate Trigger called after successfully email validation (after registering). 1.2
before_authenticate Trigger called just before authentication is carried out. This allows you to change the authentication type based on such things as SESSION variables etc... 1.2.5
beforeHandleRequest Trigger called on each page request immediately before the action handler is called. This is handy if you need to perform some action on each page request, such as changing the default action depending on the logged in user. 1.0
loginFailed Trigger called after a failed login attempt. Allows you to provide your own logging. 2.0.1
startSession? If implemented, this overrides how Xataface starts its sessions. If you implement this method, your custom method should at least include a call to session_start. 1.2.5

Preferences

Name Description Version
getPreferences Returns the user preference settings. 0.6

Permissions

Name Description Version
getPermissions Returns the permissions available for a given record. 0.6
getRoles Returns the roles allowed for a given record. 1.0
__field__permissions Returns the default permissions for a field of a given record. 1.0
__field__roles Returns the default roles for a field of a given record. 1.0
fieldname__permissions Returns the permissions that are allowed for the field "fieldname" on a given record. 0.7
fieldname__roles Returns the roles that are allowed for the field "fieldname" on a given record. 1.0
rel_relationshipname__permissions Returns the permissions pertaining to the relationship relationshipname on a given record. 1.0
rel_relationshiopname__roles Returns the role or roles pertaining to the relationship relationshipname on a given record. 1.0

See permissions? for more information about Xataface's permissions architecture and how to implement custom application permissions.

Registration

Name Description Version
beforeRegister Trigger called before the user registration form is saved. 1.0
afterRegister Trigger called after registration form is saved. 1.0
validateRegistrationForm Validates the input into the registration form. 1.0
sendRegistrationActivationEmail Overrides the sending of the registration activation email. 1.0
getRegistrationActivationEmailInfo Overrides the activation email info. Returns an associative array of the email details (e.g. subject, to, headers, etc... 1.0
getRegistrationActivationEmailSubject Returns the subject of the activation email. 1.0
getRegistrationActivationEmailMessage Returns the message body for the activation email. 1.0
getRegistrationActivationEmailParameters? Returns the parameters for the actication email. 1.0
getRegistrationActivationEmailHeaders? Returns the headers for the activation email. 1.0
after_action_activate Trigger fired after activation is complete. 1.2

See registration form for more information about Xataface's registration system and how to allow users to register for an account on your application.

Forgot Password

Name Description Version
generateTemporaryPassword? Optional method to override the generation of a random temporary password for users when they use the forgot password function. 2.0.2
getPasswordChangedEmailInfo Optional method to define the settings for the email that is sent to the user upon successful resetting of their password using the password reset function. 1.3
getResetPasswordEmailInfo Optional method to define the settings for the email that is sent when a user requests to reset their password. This step comes before the password changed email as first the user requests a password reset and receives this email. Then they click a link in this email to reset the password upon which time they receive a second email containing their temporary password. That email is generated by the getPasswordChangedEmailInfo method if defined. If this method is not defined then a generic email predefined in Xataface will be sent instead. 1.3

Account Management

Name Description Version
setPassword Hook called to override attempts to set the password of the current user, via the change_password action. 2.0.2

RSS Feed Customization

Name Description Version
getFeedItem For RSS Feeds, overrides the defaults and returns an associative array with feed elements for a particular record 1.0
getFeed For RSS feeds, overrides the default feed for a query, returning an array of feed items. 1.0
getFeedSource Overrides the default feed source parameter for an RSS feed. 1.0
getRelatedFeed? For RSS feeds, overrides the default feed for a related feed. 1.0
getRSSDescription Overrides the default generated RSS description for a record. 1.0

Template Customization

Name Description Version
block__blockname Outputs content that is meant to override a slot or a block named "blockname". 0.6
getNavItem Overrides the navigation menu item for a particular table. 1.3
navItemIsSelected? Overrides the "selected" setting for nav menu items. This is used by the default implementation of getNavItem. 1.3
getTemplateContext? Returns an associative array of variables that should be made available to all templates. 1.0

Output Cache Customization

Name Description Version
getOutputCacheUserId? Returns a unique user id that is used by the output cache to ensure that different users don't use the same cached page (unless appropriate). This is generally not necessary as the output cache by default uses a different cache for each user... but in some cases you may want to use a different cache for the same user. 2.0

Valuelist Customization

Name Description Version
valuelist__valuelistname? Defines a valuelist named valuelistname. 0.7
blog comments powered by Disqus
Powered by Xataface
(c) 2005-2024 All rights reserved