ICanBoogie
  • Documentation
  • API Reference
  • Module v2.1.0
Namespaces
  • ICanBoogie
    • Module
Classes
  • DeleteOperation
  • Module
  • SaveOperation

Class Module

A module of the framework.

ICanBoogie\Object
┗ ICanBoogie\Module
Namespace: ICanBoogie
Located at Module.php

Methods summary

protected get_id( void ) : string

Returns the identifier of the module as defined by its descriptor.

Returns the identifier of the module as defined by its descriptor.

This method is the getter for the $id magic property.

Returns

string
protected get_path( void ) : string

Returns the path of the module as defined by its descriptor.

Returns the path of the module as defined by its descriptor.

This method is the getter for the $path magic property.

Returns

string
protected get_collection( void ) : ICanBoogie\Module\ModuleCollection

Returns

ICanBoogie\Module\ModuleCollection
protected get_descriptor( void ) : array

Returns the descriptor of the module.

Returns the descriptor of the module.

This method is the getter for the ICanBoogie\Module::$descriptor magic property.

Returns

array
public __construct( ICanBoogie\Module\ModuleCollection $collection, array $descriptor )

Constructor.

Constructor.

Initializes the ICanBoogie\Module::$descriptor property.

Parameters

$collection
$descriptor
public __toString( void ) : string

Returns the identifier of the module.

Returns the identifier of the module.

Returns

string
protected get_flat_id( void ) : string

Returns the flat version of the module's identifier.

Returns the flat version of the module's identifier.

This method is the getter for the $flat_id magic property.

Returns

string
protected get_model( void ) : ActiveRecord\Model

Returns the primary model of the module.

Returns the primary model of the module.

This is the getter for the ICanBoogie\Module::model() magic property.

Returns

ActiveRecord\Model
protected get_title( void ) : string

Returns the module title, translated to the current language.

Returns the module title, translated to the current language.

Returns

string
protected get_parent( void ) : ICanBoogie\Module|null

Returns the parent module.

Returns the parent module.

Returns

ICanBoogie\Module|null
public is_installed( ICanBoogie\Errors $errors ) : mixed

Checks if the module is installed.

Checks if the module is installed.

Parameters

$errors
Error collection.

Returns

mixed

true if the module is installed, false if the module (or parts of) is not installed, null if the module has no installation.

public install( ICanBoogie\Errors $errors ) : boolean|null

Install the module.

Install the module.

If the module has models they are installed.

Parameters

$errors
Error collection.

Returns

boolean|null

true if the module has successfully been installed, false if the module (or parts of the module) fails to install or null if the module has no installation process.

public uninstall( void ) : boolean|null

Uninstall the module.

Uninstall the module.

Basically it uninstall the models installed by the module.

Returns

boolean|null

true if the module was successfully uninstalled. false if the module (or parts of the module) failed to uninstall. null if there is no uninstall process.

public model( string $which = 'primary' ) : ICanBoogie\ActiveRecord\Model

Get a model from the module.

Get a model from the module.

If the model has not been created yet, it is created on the fly.

Parameters

$which
The identifier of the model to get.

Returns

ICanBoogie\ActiveRecord\Model
The requested model.

Throws

ICanBoogie\ActiveRecord\ModelNotDefined
when the model is not defined by the module.
RuntimeException
when the class of the model does not exists.
protected resolve_model_tags( $tags, $which )
public getBlock( string $name ) : mixed

Get a block.

Get a block.

Parameters

$name
The name of the block to get.

Returns

mixed

Depends on the implementation. Should return a string or an object implementing __toString.

Throws

RuntimeException
if the block is not defined.

Constants summary

T_CATEGORY : string

Defines the category for the module.

Defines the category for the module.

When modules are listed they are usually grouped by category. The category is also often used to create the main navigation menu of the admin interface.

The category of the module is translated within the module_category scope.

Deprecated

'category'
T_CLASS : string

Defines the PHP class of the module.

Defines the PHP class of the module.

If the class is not defined it is resolved during indexing using the ICanBoogie\Module::T_NAMESPACE tag and the following pattern : <namespace>\Module.

Deprecated

'class'
T_DESCRIPTION : string

Defines a short description of what the module do.

Defines a short description of what the module do.

Deprecated

'description'
T_DISABLED : boolean

Defines the state of the module.

Defines the state of the module.

Deprecated

'disabled'
T_EXTENDS : string|ICanBoogie\Module

Defines the module that the module extends.

Defines the module that the module extends.

Deprecated

'extends'
T_ID : string

Defines the identifier of the module.

Defines the identifier of the module.

If the identifier is not defined the name of the module directory is used instead.

Deprecated

'id'
T_REQUIRED : boolean

Defines the state of the module.

Defines the state of the module.

Required modules are always enabled.

Deprecated

'required'
T_REQUIRES : array[string]string

Defines the modules that the module requires.

Defines the modules that the module requires.

The required modules are defined using an array where each key/value pair is the identifier of the module and the minimum version required.

Deprecated

'requires'
T_MODELS : array[string]array|string

Defines the models of the module.

Defines the models of the module.

Deprecated

'models'
T_NAMESPACE : string

Defines the namespace of the module.

Defines the namespace of the module.

This attribute must be defined at construct time.

Deprecated

'namespace'
T_PATH : string

Path to the module's directory.

Path to the module's directory.

This tag is resolved when the module is indexed.

Deprecated

'path'
T_PERMISSION : string|integer

General permission of the module.

General permission of the module.

Deprecated

'permission'
T_PERMISSIONS : array[]string

Defines the permissions added by the module.

Defines the permissions added by the module.

Deprecated

'permissions'
T_TITLE : string

Defines the title of the module.

Defines the title of the module.

The title of the module is translated within the module_title scope.

Deprecated

'title'
T_VERSION : string

Defines the version (and revision) of the module.

Defines the version (and revision) of the module.

Deprecated

'version'
T_WEIGHT : integer

Defines the weight of the module.

Defines the weight of the module.

The weight of the module is resolved during modules indexing according to the ICanBoogie\Module::T_EXTENDS and ICanBoogie\Module::T_REQUIRES tags.

Deprecated

'weight'
PERMISSION_NONE : integer
0
PERMISSION_ACCESS : integer
1
PERMISSION_CREATE : integer
2
PERMISSION_MAINTAIN : integer
3
PERMISSION_MANAGE : integer
4
PERMISSION_ADMINISTER : integer
5
OPERATION_SAVE : string

Defines the name of the operation used to save the records of the module.

Defines the name of the operation used to save the records of the module.

'save'
OPERATION_DELETE : string

Defines the name of the operation used to delete the records of the module.

Defines the name of the operation used to delete the records of the module.

'delete'

Properties summary

protected $descriptor : array

The descriptor of the module.

The descriptor of the module.


		
protected $models : ActiveRecord\Model[]

Cache for loaded models.

Cache for loaded models.

[]

Magic properties

public read-only $descriptor : array

The descriptor of the module.

public read-only $flat_id : string

Underscored identifier.

public read-only $id : string

The identifier of the module, defined by ICanBoogie\Descriptor::ID.

public read-only $model : ICanBoogie\ActiveRecord\Model

The primary model of the module.

public read-only $parent : ICanBoogie\Module

The parent module, defined by ICanBoogie\Descriptor::INHERITS.

public read-only $path : string

The path to the module, defined by ICanBoogie\Descriptor::PATH.

public read-only $title : string

The localized title of the module.

public read-only $collection : ICanBoogie\Module\ModuleCollection
public read-only $app : Core
Module v2.1.0 – Check on GitHub – API documentation generated by ApiGen