Orion PHP  0.11.12
The PHP5.3 framework
Orion\Core\Controller\Restful Class Reference
+ Inheritance diagram for Orion\Core\Controller\Restful:

List of all members.

Public Member Functions

 load ()
 allow ($slug)
 getPutData ()
 isMethod ($method)
 send ($array, $exit=true, $code=null)
 sendError ($e, $code=401)

Public Attributes

const CLASS_NAME = 'OrionControllerRestful'
const E_LOGIN_ERROR = 2
const E_LOGIN_DISALLOW = 4
const E_ROUTE_NO = 8
const E_FUNCTION_NO = 16
const DELETE = 'DELETE'
const GET = 'GET'
const POST = 'POST'
const PUT = 'PUT'

Detailed Description

Definition at line 17 of file restful.php.


Member Function Documentation

Orion\Core\Controller\Restful::allow ( slug)

Allows access only to logged users that have a level equal to or less than provided role. If permission is not granted, it will send a JSON error object.

Note that while it's doing all login/auth/redirection work automatically, you still have to create the corresponding user table in your database in addition to provide the login module into orion's module directory.

See also:
OrionAuth MainConfig LoginModule
Parameters:
string$slugthe role identifier (ie: 'administrator', 'member', etc.). See your configuration file for a liste of roles and their permission level.

Reimplemented from Orion\Core\Controller.

Definition at line 62 of file restful.php.

Orion\Core\Controller\Restful::getPutData ( )

Gets REST PUT data

Definition at line 84 of file restful.php.

Orion\Core\Controller\Restful::isMethod ( method)

Test method used to access the resource

Parameters:
$methodPOST|GET|PUT|DELETE

Definition at line 95 of file restful.php.

Orion\Core\Controller\Restful::load ( )

Main module function, executed right after module loading by Orion. Handles route parsing and function callbacks.

Reimplemented from Orion\Core\Controller.

Definition at line 35 of file restful.php.

Orion\Core\Controller\Restful::send ( array,
exit = true,
code = null 
)

Encodes $array to JSON format and sends it.

Parameters:
array$array
boolean$exitExit after response ?

Definition at line 105 of file restful.php.

Orion\Core\Controller\Restful::sendError ( e,
code = 401 
)

Sends a standard {"error":X} JSON Object

Parameters:
int$eError code

Definition at line 114 of file restful.php.


Member Data Documentation

const Orion::Core::Controller\Restful::CLASS_NAME = 'OrionControllerRestful'

Definition at line 19 of file restful.php.

const Orion::Core::Controller\Restful::DELETE = 'DELETE'

Definition at line 26 of file restful.php.

const Orion::Core::Controller\Restful::E_FUNCTION_NO = 16

Definition at line 24 of file restful.php.

const Orion::Core::Controller\Restful::E_LOGIN_DISALLOW = 4

Definition at line 22 of file restful.php.

const Orion::Core::Controller\Restful::E_LOGIN_ERROR = 2

Definition at line 21 of file restful.php.

const Orion::Core::Controller\Restful::E_ROUTE_NO = 8

Definition at line 23 of file restful.php.

const Orion::Core::Controller\Restful::GET = 'GET'

Definition at line 27 of file restful.php.

const Orion::Core::Controller\Restful::POST = 'POST'

Definition at line 28 of file restful.php.

const Orion::Core::Controller\Restful::PUT = 'PUT'

Definition at line 29 of file restful.php.


The documentation for this class was generated from the following file: