PHP Class Backend\Core\Installer\ModuleInstaller

Datei anzeigen Open project: forkcms/forkcms

Public Methods

Method Description
__construct ( SpoonDatabase $db, array $languages, array $interfaceLanguages, boolean $example = false, array $variables = [] )
getDefaultExtras ( ) : array Get the default extras.
subscribeToEvent ( string $eventModule, string $eventName, string $module, mixed $callback ) Subscribe to an event, when the subscription already exists, the callback will be updated.

Protected Methods

Method Description
addDefaultExtra ( integer $extraId, string $position ) Adds a default extra to the stack of extras
addModule ( string $module ) Inserts a new module.
addSearchIndex ( string $module, integer $otherId, array $fields, string $language ) Add a search index
execute ( ) Method that will be overridden by the specific installers
getDB ( ) : SpoonDatabase Get the database-handle
getDefaultUserID ( ) : integer Get the default user
getInterfaceLanguages ( ) Get the selected cms interface languages
getLanguages ( ) Get the selected languages
getLocale ( string $name, string $module = 'Core', string $language = 'en', string $type = 'lbl', string $application = 'Backend' ) : string Get a locale item.
getModule ( ) : string Get the module name
getSetting ( string $module, string $name ) : mixed Get a setting
getTemplateId ( string $template, string $theme = null ) : integer Get the id of the requested template of the active theme.
getVariable ( string $name ) : mixed Get a variable
importLocale ( string $filename, boolean $overwriteConflicts = false ) Imports the locale XML file
importSQL ( string $filename ) Imports the sql file
insertDashboardWidget ( string $module, string $widget ) Insert a dashboard widget
insertExtra ( string $module, ModuleExtraType | string $type, string $label, string $action = null, string $data = null, boolean $hidden = false, integer $sequence = null ) : integer Insert an extra
insertMeta ( string $keywords, string $description, string $title, string $url, boolean $keywordsOverwrite = false, boolean $descriptionOverwrite = false, boolean $titleOverwrite = false, boolean $urlOverwrite = false, string $custom = null, array $data = null ) : integer Insert a meta item
insertPage ( array $revision, array $meta = null, array $block = null ) : integer Insert a page
installExample ( ) : boolean Should example data be installed
makeSearchable ( string $module, boolean $searchable = true, integer $weight = 1 ) Make a module searchable
setActionRights ( integer $groupId, string $module, string $action, integer $level = 7 ) Set the rights for an action
setModuleRights ( integer $groupId, string $module ) Sets the rights for a module
setNavigation ( integer $parentId, string $label, string $url = '', array $selectedFor = null, integer $sequence = null ) : integer Set a new navigation item.
setSetting ( string $module, string $name, mixed $value = null, boolean $overwrite = false ) Stores a module specific setting in the database.

Method Details

__construct() public method

public __construct ( SpoonDatabase $db, array $languages, array $interfaceLanguages, boolean $example = false, array $variables = [] )
$db SpoonDatabase The database-connection.
$languages array The selected frontend languages.
$interfaceLanguages array The selected backend languages.
$example boolean Should example data be installed.
$variables array The passed variables.

addDefaultExtra() protected method

Adds a default extra to the stack of extras
protected addDefaultExtra ( integer $extraId, string $position )
$extraId integer The extra id to add to every page.
$position string The position to put the default extra.

addModule() protected method

The getModule method becomes available after using addModule and returns $module parameter.
protected addModule ( string $module )
$module string The name of the module.

addSearchIndex() protected method

Add a search index
protected addSearchIndex ( string $module, integer $otherId, array $fields, string $language )
$module string The module wherein will be searched.
$otherId integer The id of the record.
$fields array A key/value pair of fields to index.
$language string The frontend language for this entry.

execute() protected method

Method that will be overridden by the specific installers
protected execute ( )

getDB() protected method

Get the database-handle
protected getDB ( ) : SpoonDatabase
return SpoonDatabase

getDefaultExtras() public method

Get the default extras.
public getDefaultExtras ( ) : array
return array

getDefaultUserID() protected method

Get the default user
protected getDefaultUserID ( ) : integer
return integer

getInterfaceLanguages() protected method

Get the selected cms interface languages
protected getInterfaceLanguages ( )

getLanguages() protected method

Get the selected languages
protected getLanguages ( )

getLocale() protected method

Get a locale item.
protected getLocale ( string $name, string $module = 'Core', string $language = 'en', string $type = 'lbl', string $application = 'Backend' ) : string
$name string
$module string
$language string The language abbreviation.
$type string The type of locale.
$application string
return string

getModule() protected method

Get the module name
protected getModule ( ) : string
return string

getSetting() protected method

Get a setting
protected getSetting ( string $module, string $name ) : mixed
$module string The name of the module.
$name string The name of the setting.
return mixed

getTemplateId() protected method

Get the id of the requested template of the active theme.
protected getTemplateId ( string $template, string $theme = null ) : integer
$template string
$theme string
return integer

getVariable() protected method

Get a variable
protected getVariable ( string $name ) : mixed
$name string
return mixed

importLocale() protected method

Imports the locale XML file
protected importLocale ( string $filename, boolean $overwriteConflicts = false )
$filename string The full path for the XML-file.
$overwriteConflicts boolean Should we overwrite when there is a conflict?

importSQL() protected method

Imports the sql file
protected importSQL ( string $filename )
$filename string The full path for the SQL-file.

insertDashboardWidget() protected method

Insert a dashboard widget
protected insertDashboardWidget ( string $module, string $widget )
$module string
$widget string

insertExtra() protected method

Insert an extra
protected insertExtra ( string $module, ModuleExtraType | string $type, string $label, string $action = null, string $data = null, boolean $hidden = false, integer $sequence = null ) : integer
$module string The module for the extra.
$type common\ModuleExtraType | string The type, possible values are: homepage, widget, block.
$label string The label for the extra.
$action string The action.
$data string Optional data, will be passed in the extra.
$hidden boolean Is this extra hidden?
$sequence integer The sequence for the extra.
return integer

insertMeta() protected method

Insert a meta item
protected insertMeta ( string $keywords, string $description, string $title, string $url, boolean $keywordsOverwrite = false, boolean $descriptionOverwrite = false, boolean $titleOverwrite = false, boolean $urlOverwrite = false, string $custom = null, array $data = null ) : integer
$keywords string The keyword of the item.
$description string A description of the item.
$title string The page title for the item.
$url string The unique URL.
$keywordsOverwrite boolean Should the keywords be overwritten?
$descriptionOverwrite boolean Should the descriptions be overwritten?
$titleOverwrite boolean Should the page title be overwritten?
$urlOverwrite boolean Should the URL be overwritten?
$custom string Any custom meta-data.
$data array Any custom meta-data.
return integer

insertPage() protected method

Insert a page
protected insertPage ( array $revision, array $meta = null, array $block = null ) : integer
$revision array An array with the revision data.
$meta array The meta-data.
$block array The blocks.
return integer

installExample() protected method

Should example data be installed
protected installExample ( ) : boolean
return boolean

makeSearchable() protected method

Make a module searchable
protected makeSearchable ( string $module, boolean $searchable = true, integer $weight = 1 )
$module string The module to make searchable.
$searchable boolean Enable/disable search for this module by default?
$weight integer Set default search weight for this module.

setActionRights() protected method

Set the rights for an action
protected setActionRights ( integer $groupId, string $module, string $action, integer $level = 7 )
$groupId integer The group wherefore the rights will be set.
$module string The module wherein the action appears.
$action string The action wherefore the rights have to set.
$level integer The level, default is 7 (max).

setModuleRights() protected method

Sets the rights for a module
protected setModuleRights ( integer $groupId, string $module )
$groupId integer The group wherefore the rights will be set.
$module string The module too set the rights for.

setNavigation() protected method

Set a new navigation item.
protected setNavigation ( integer $parentId, string $label, string $url = '', array $selectedFor = null, integer $sequence = null ) : integer
$parentId integer Id of the navigation item under we should add this.
$label string Label for the item.
$url string Url for the item. If omitted the first child is used.
$selectedFor array Set selected when these actions are active.
$sequence integer Sequence to use for this item.
return integer

setSetting() protected method

Stores a module specific setting in the database.
protected setSetting ( string $module, string $name, mixed $value = null, boolean $overwrite = false )
$module string The module wherefore the setting will be set.
$name string The name of the setting.
$value mixed The optional value.
$overwrite boolean Overwrite no matter what.

subscribeToEvent() public method

Subscribe to an event, when the subscription already exists, the callback will be updated.
public subscribeToEvent ( string $eventModule, string $eventName, string $module, mixed $callback )
$eventModule string The module that triggers the event.
$eventName string The name of the event.
$module string The module that subscribes to the event.
$callback mixed The callback that should be executed when the event is triggered.