13.3. Components

Modules are composed of the following components. The only required file is module.ini. All other files are optional.

Table 13.1. Module Components

File(s) Description
module.ini Identifies the module to Perforce Chronicle and provides its default entry configuration.
Module.php The integration point that enables a module to participate in existing facilities provided by Chronicle. Modules can participate in initialization, subscribing to pub/sub topics, and other actions.
ACLs/Asserts Access control lists (ACLs) declare resources, privileges and default "allow" rules that are relevant to the module. Asserts enable developers to define logic that determines whether the conditions required to obtain access have been met.
Controllers Contains action(s) which respond to requests and provides logic that determine the model(s) and view(s) to be used to form the response.
Filters Filters modify data, and the filter infrastructure provides a simple chaining mechanism so that filters can be applied in a specified order.
Forms The primary mechanism for accepting information from users, and can be composed of elements, decorators, validators, filters, and sub-forms.
Layouts An HTML file that provides the markup for the overall look of a page. A layout can implement headers/footers/sidebars, output the stylesheets and scripts to use, and define the locations for content and regions. Layouts can include PHP code.
Models A class that manages the behavior and structure for a particular type of data in Chronicle. Models provide an API for retrieving, updating, and removing data.
Resources Any file that assists with presentation, such as CSS stylesheets, images, applets, movies, MP3s, etc.
Tests Unit tests that ensure that your module is working as intended.
Validators Examine data by comparing it to a set of requirements, and returns a Boolean value indicating whether the data is valid.
Views Scripts / View Helpers A view script is composed of HTML with embedded PHP directives, and controls the markup for a particular action. The view script is wrapped by the Layout if one is enabled. View helpers are PHP classes that can reduce code/HTML duplication when producing repetitive or complex markup.
Workflows Workflows are collections of states that help guide content from creation to publication. Before content can transition from one state to another, any specified conditions must be met. If all conditions have been met, any specified actions are executed. Modules can provide conditions and actions to any workflow.

Perforce Chronicle - Release: 2012.2/486814