PHP Class CroogoComponent

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

Public Properties

Property Type Description
$blocksData array Blocks data: contains parsed value of bb-code like strings
$components array Other components used by this component

Protected Properties

Property Type Description
$_controller Controller controller
$_defaultRoleId integer Default is 3 (public)

Public Methods

Method 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

Protected Methods

Method 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 method

Method to lazy load classes
public __get ( $name ) : Object
return Object

_adminData() protected method

Set variables for admin layout
protected _adminData ( ) : void
return void

_adminMenus() protected method

Setup admin menu
protected _adminMenus ( )

_setupViewPaths() protected method

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
return array A list of view paths

addAco() public method

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
return void

addPluginBootstrap() public method

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

checkPluginDependency() public method

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)
return boolean

extractFilter() public method

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

fieldToggle() public method

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 method

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
return array

getPlugins() public method

Get plugin alises (folder names)
Deprecation: use CroogoPlugin::getPlugins()
public getPlugins ( ) : array
return array

getRelativePath() public method

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

getThemeData() public method

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
return array

getThemes() public method

Get theme aliases (folder names)
Deprecation: use CroogoTheme::getThemes()
public getThemes ( ) : array
return array

pluginIsActive() public method

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

redirect() public method

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
return void

removeAco() public method

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

removePluginBootstrap() public method

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

roleId() public method

Gets the Role Id of the current user
public roleId ( ) : integer
return integer Role Id

setReferer() public method

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

startup() public method

Startup
public startup ( Controller $controller ) : void
$controller Controller instance of controller
return void

viewFallback() public method

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
return void

Property Details

$_controller protected_oe property

controller
protected Controller $_controller
return Controller

$_defaultRoleId protected_oe property

Default is 3 (public)
protected int $_defaultRoleId
return integer

$blocksData public_oe property

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

$components public_oe property

Other components used by this component
public array $components
return array