PHP Class CroogoComponent

PHP version 5
Author: Fahad Ibnay Heylaal ([email protected])
Inheritance: extends Object
Afficher le fichier Open project: croogo/croogo Class Usage Examples

Méthodes publiques

Свойство Type Description
$blocksData array Blocks data: contains parsed value of bb-code like strings
$components array Other components used by this component

Protected Properties

Свойство Type Description
$_controller Controller controller
$_defaultRoleId integer Default is 3 (public)

Méthodes publiques

Méthode Description
__get ( $name ) : Object Method to lazy load classes
addAco ( string $action, array $allowRoles = [] ) : void ACL: add ACO
addPluginBootstrap ( string $plugin ) : void Loads plugin's bootstrap.php file
checkPluginDependency ( string $plugin = null ) : boolean Check if plugin is dependent on any other plugin.
extractFilter ( ) : array Extracts parameters from 'filter' named parameter.
fieldToggle ( Model $model, $id, $status, $field = 'status' ) Toggle field status
getPluginData ( string $alias = null ) : array Get the content of plugin.json file of a plugin
getPlugins ( ) : array Get plugin alises (folder names)
getRelativePath ( array $url = '/' ) : array Get URL relative to the app
getThemeData ( string $alias = null ) : array Get the content of theme.json file from a theme
getThemes ( ) : array Get theme aliases (folder names)
pluginIsActive ( string $plugin ) : boolean Check if plugin is active
redirect ( string $url, integer $status = null, boolean $exit = true, array $indexUrl = [] ) : void Croogo flavored redirect
removeAco ( string $action ) : void ACL: remove ACO
removePluginBootstrap ( string $plugin ) : void Plugin name will be removed from Hook.bootstraps
roleId ( ) : integer Gets the Role Id of the current user
setReferer ( ) : void Sets the referer page
startup ( Controller $controller ) : void Startup
viewFallback ( string | array $views ) : void View Fallback

Méthodes protégées

Méthode Description
_adminData ( ) : void Set variables for admin layout
_adminMenus ( ) Setup admin menu
_setupViewPaths ( Controller $controller ) : array Get a list of possible view paths for current request

Method Details

__get() public méthode

Method to lazy load classes
public __get ( $name ) : Object
Résultat Object

_adminData() protected méthode

Set variables for admin layout
protected _adminData ( ) : void
Résultat void

_adminMenus() protected méthode

Setup admin menu
protected _adminMenus ( )

_setupViewPaths() protected méthode

The default view paths are retrieved view App::path('View'). This method injects the theme path and also considers whether a plugin is used. The paths that will be used for fallback is typically: - APP/View/ - APP/Themed// - APP/Themed//Plugin// - APP/Plugin/ - APP/Vendor/croogo/croogo/Croogo/View
protected _setupViewPaths ( Controller $controller ) : array
$controller Controller
Résultat array A list of view paths

addAco() public méthode

Creates ACOs with permissions for roles.
public addAco ( string $action, array $allowRoles = [] ) : void
$action string possible values: ControllerName, ControllerName/method_name
$allowRoles array Role aliases
Résultat void

addPluginBootstrap() public méthode

Loads plugin's bootstrap.php file
Deprecation: use CroogoPlugin::addBootstrap()
public addPluginBootstrap ( string $plugin ) : void
$plugin string Plugin name (underscored)
Résultat void

checkPluginDependency() public méthode

If yes, check if that plugin is available in plugins directory.
Deprecation: use CroogoPlugin::checkDependency()
public checkPluginDependency ( string $plugin = null ) : boolean
$plugin string plugin alias (underscrored)
Résultat boolean

extractFilter() public méthode

Extracts parameters from 'filter' named parameter.
Deprecation: use Search plugin to perform filtering
public extractFilter ( ) : array
Résultat array

fieldToggle() public méthode

Toggle field status
public fieldToggle ( Model $model, $id, $status, $field = 'status' )
$model Model Model instance
$id integer Model id
$status integer current status
$field string field name to toggle

getPluginData() public méthode

Get the content of plugin.json file of a plugin
Deprecation: use CroogoPlugin::getData
public getPluginData ( string $alias = null ) : array
$alias string plugin folder name
Résultat array

getPlugins() public méthode

Get plugin alises (folder names)
Deprecation: use CroogoPlugin::getPlugins()
public getPlugins ( ) : array
Résultat array

getRelativePath() public méthode

Get URL relative to the app
Deprecation: Use Croogo::getRelativePath
public getRelativePath ( array $url = '/' ) : array
$url array
Résultat array

getThemeData() public méthode

Get the content of theme.json file from a theme
Deprecation: use CroogoTheme::getData()
public getThemeData ( string $alias = null ) : array
$alias string theme folder name
Résultat array

getThemes() public méthode

Get theme aliases (folder names)
Deprecation: use CroogoTheme::getThemes()
public getThemes ( ) : array
Résultat array

pluginIsActive() public méthode

Check if plugin is active
Deprecation: use CroogoPlugin::isActive
public pluginIsActive ( string $plugin ) : boolean
$plugin string Plugin name (underscored)
Résultat boolean

redirect() public méthode

If 'save' pressed, redirect to referer or $indexUrl instead of 'edit'
See also: CroogoComponent::setReferer()
public redirect ( string $url, integer $status = null, boolean $exit = true, array $indexUrl = [] ) : void
$url string
$status integer
$exit boolean
$indexUrl array
Résultat void

removeAco() public méthode

Removes ACOs and their Permissions
public removeAco ( string $action ) : void
$action string possible values: ControllerName, ControllerName/method_name
Résultat void

removePluginBootstrap() public méthode

Plugin name will be removed from Hook.bootstraps
Deprecation: use CroogoPlugin::removeBootstrap()
public removePluginBootstrap ( string $plugin ) : void
$plugin string Plugin name (underscored)
Résultat void

roleId() public méthode

Gets the Role Id of the current user
public roleId ( ) : integer
Résultat integer Role Id

setReferer() public méthode

We need to know where were you, to get you back there
See also: CroogoComponent::redirect()
public setReferer ( ) : void
Résultat void

startup() public méthode

Startup
public startup ( Controller $controller ) : void
$controller Controller instance of controller
Résultat void

viewFallback() public méthode

Looks for view file through the available view paths. If the view is found, set Controller::$view variable.
public viewFallback ( string | array $views ) : void
$views string | array view path or array of view paths
Résultat void

Property Details

$_controller protected_oe property

controller
protected Controller $_controller
Résultat Controller

$_defaultRoleId protected_oe property

Default is 3 (public)
protected int $_defaultRoleId
Résultat integer

$blocksData public_oe property

Blocks data: contains parsed value of bb-code like strings
public array $blocksData
Résultat array

$components public_oe property

Other components used by this component
public array $components
Résultat array