PHP Class Scalr_UI_Controller

Mostra file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$cryptoKey
$db ADODB_mysqli
$request Scalr_UI_Request
$response Scalr_UI_Response
$uiCacheKeyPattern string
$unusedPathChunks
$user Scalr_Account_User

Protected Properties

Property Type Description
$_environment Scalr\Model\Entity\Account\Environment
$environment Scalr_Environment
$sortParams

Public Methods

Method Description
__construct ( )
addUiCacheKeyPatternChunk ( $chunk )
auditLog ( string $event, variadic $extra ) : boolean AuditLogger wrapper
call ( $pathChunks = [], $permissionFlag = true )
callActionMethod ( $method )
controller ( boolean $checkPermissions = false ) : Scalr_UI_Controller Create controller object from current class
getContainer ( ) : Container Gets DI Container
getEnvironment ( ) : Scalr_Environment Gets current environment
getEnvironmentEntity ( ) : Environment Get current environment as Entity
getEnvironmentId ( boolean $silent = false ) : integer Returns identifier of the current Environment which is selected by the User.
getParam ( string $key, boolean $rawValue = false ) : mixed
getUser ( ) : User | null Gets the User Entity for the current request
handleRequest ( $pathChunks )
hasAccess ( ) : boolean Restricts access to controller's actions
init ( )
loadController ( $controller, $prefix = 'Scalr_UI_Controller', $checkPermissions = false ) : Scalr_UI_Controller

Protected Methods

Method Description
buildResponseFromData ( array $data, array $filterFields = [], boolean $ignoreLimit = false ) : array
buildResponseFromSql ( string $sql, array $filterFields = [], string $groupSQL = "", boolean | true $simpleQuery = true, boolean | false $noLimit = false ) : mixed
buildResponseFromSql2 ( $sql, $sortFields = [], $filterFields = [], $args = [], $noLimit = false )
getCrypto ( ) : Scalr\Util\CryptoTool
getSortOrder ( ) : array Parse and validate input parameter sort (json-encoded array), and return as array [[property, direction], .
sort ( $item1, $item2 )

Method Details

__construct() public method

public __construct ( )

addUiCacheKeyPatternChunk() public method

public addUiCacheKeyPatternChunk ( $chunk )

auditLog() public method

AuditLogger wrapper
public auditLog ( string $event, variadic $extra ) : boolean
$event string Event name, aka tag
$extra variadic optional Array of additionally provided information
return boolean Whether operation was successful

buildResponseFromData() protected method

protected buildResponseFromData ( array $data, array $filterFields = [], boolean $ignoreLimit = false ) : array
$data array
$filterFields array New format: [field1 => query, ... ], old format: [field1, field2] For new format: - Conjuction: AND (all fields should be found) - Field could be list of fields ('field1,field2,field3'), in that case any of given fields should be found
$ignoreLimit boolean If true return all results
return array

buildResponseFromSql() protected method

Deprecation:
protected buildResponseFromSql ( string $sql, array $filterFields = [], string $groupSQL = "", boolean | true $simpleQuery = true, boolean | false $noLimit = false ) : mixed
$sql string
$filterFields array
$groupSQL string
$simpleQuery boolean | true
$noLimit boolean | false
return mixed

buildResponseFromSql2() protected method

protected buildResponseFromSql2 ( $sql, $sortFields = [], $filterFields = [], $args = [], $noLimit = false )

call() public method

public call ( $pathChunks = [], $permissionFlag = true )

callActionMethod() public method

public callActionMethod ( $method )

controller() public static method

Create controller object from current class
public static controller ( boolean $checkPermissions = false ) : Scalr_UI_Controller
$checkPermissions boolean
return Scalr_UI_Controller

getContainer() public method

Gets DI Container
public getContainer ( ) : Container
return Scalr\DependencyInjection\Container Returns DI Container

getCrypto() protected method

protected getCrypto ( ) : Scalr\Util\CryptoTool
return Scalr\Util\CryptoTool

getEnvironment() public method

Gets current environment
public getEnvironment ( ) : Scalr_Environment
return Scalr_Environment

getEnvironmentEntity() public method

Get current environment as Entity
public getEnvironmentEntity ( ) : Environment
return Scalr\Model\Entity\Account\Environment Current environment

getEnvironmentId() public method

If environment hasn't been set it will throw an exception unless silent is turned on.
public getEnvironmentId ( boolean $silent = false ) : integer
$silent boolean optional On false throw Exception
return integer Returns identifier of the Environment

getParam() public method

Deprecation:
public getParam ( string $key, boolean $rawValue = false ) : mixed
$key string
$rawValue boolean if true returns rawValue (not stripped) only once, don't save in cache
return mixed

getSortOrder() protected method

..]
protected getSortOrder ( ) : array
return array Array of sort orders [[property => '', direction => '']]

getUser() public method

Gets the User Entity for the current request
public getUser ( ) : User | null
return Scalr\Model\Entity\Account\User | null Returns the User entity for the current Request

handleRequest() public static method

public static handleRequest ( $pathChunks )

hasAccess() public method

Restricts access to controller's actions
public hasAccess ( ) : boolean
return boolean Returns true if user has access.

init() public method

public init ( )

loadController() public static method

public static loadController ( $controller, $prefix = 'Scalr_UI_Controller', $checkPermissions = false ) : Scalr_UI_Controller
return Scalr_UI_Controller

sort() protected method

protected sort ( $item1, $item2 )

Property Details

$_environment protected_oe property

protected Environment,Scalr\Model\Entity\Account $_environment
return Scalr\Model\Entity\Account\Environment

$cryptoKey public_oe property

public $cryptoKey

$db public_oe property

public ADODB_mysqli $db
return ADODB_mysqli

$environment protected_oe property

protected Scalr_Environment $environment
return Scalr_Environment

$request public_oe property

public Scalr_UI_Request $request
return Scalr_UI_Request

$response public_oe property

public Scalr_UI_Response $response
return Scalr_UI_Response

$sortParams protected_oe property

protected $sortParams

$uiCacheKeyPattern public_oe property

public string $uiCacheKeyPattern
return string

$unusedPathChunks public_oe property

public $unusedPathChunks

$user public_oe property

public Scalr_Account_User $user
return Scalr_Account_User