Class Module

Description

Module Class

This is a parent class that all PICKLES modules should be extending. Each module can specify it's own meta data and whether or not a user must be properly authenticated to view the page. Currently any pages without a template are treated as pages being requested via AJAX and the return will be JSON encoded. In the future this may need to be changed out for logic that allows the requested module to specify what display type(s) it can use.

Located in /classes/Module.php (line 28)

Object
   |
   --Module
Variable Summary
boolean $ajax
object $db
string, $description
string, $engine
string, $keywords
array, $request
boolean, $secure
boolean, $security
boolean, $session
string, $template
string, $title
Method Summary
Module __construct ([boolean $autorun = false])
boolean setRequest (array $request)
void __default ()
mixed __get (string $name)
void __set (string $name, mixed $value)
Variables
boolean $ajax = null (line 101)

AJAX

Whether or not the page must be loaded via AJAX and if so, what pages are allowed to access it and the request method.

  • var: or array, null by default
  • todo: Implement this functionality
  • access: protected
object $db = null (line 36)

Database object

  • access: protected
string, $description = null (line 52)

Meta description

  • var: null by default
  • access: protected
string, $engine = DISPLAY_PHP (line 112)

Default display engine

Defaults to PHP but could be set to JSON, XML or RSS. Value is overwritten by the config value if not set by the module.

  • var: null by default
  • access: protected
string, $keywords = null (line 60)

Meta keywords (comma separated)

  • var: null by default
  • access: protected
array, $request = null (line 138)

Request Data

Modules should not interact with $_REQUEST, $_POST or $_GET directly as the contents could be unsafe. The Controller cleanses this data and sets it into this variable for safe access by the module.

  • var: null by default
  • todo: Not even sure I want to implement this at this point
  • todo: Currently the super globals are not being cleared out
  • access: protected
boolean, $secure = null (line 71)

Secure

Whether or not the page should be loaded via SSL.

  • var: null by default
  • todo: Implement this functionality
  • access: protected
boolean, $security = null (line 79)

Security settings of the page

  • var: null by default
  • access: protected
boolean, $session = null (line 89)

Session

Whether or not a session should be established.

  • var: null by default
  • access: protected
string, $template = null (line 124)

Default template

Defaults to null but could be set to any valid template basename. The value is overwritten by the config value if not set by the module. The display engine determines what the file extension should be.

  • var: null by default
  • access: protected
string, $title = null (line 44)

Page title

  • var: null by default
  • access: protected

Inherited Variables

Inherited from Object

Object::$config
Object::$instances
Methods
Constructor __construct (line 150)

Constructor

The constructor does nothing by default but can be passed a boolean variable to tell it to automatically run the __default() method. This is typically used when a module is called outside of the scope of the controller (the registration page calls the login page in this manner.

  • access: public
Module __construct ([boolean $autorun = false])
  • boolean $autorun: optional flag to autorun __default()

Redefinition of:
Object::__construct()
Constructor
setRequest (line 221)

Sets the Request

  • return: whether or not the assignment was successful
  • access: public
boolean setRequest (array $request)
  • array $request: data to be loaded into the request variable
__default (line 171)

Default "Magic" Method

This function is overloaded by the module. The __default() method is where you want to place any code that needs to be executed at runtime. The reason the code isn't in the constructor is because the module must be instantiated before the code is executed so that the controller script is aware of the authentication requirements.

  • access: public
void __default ()
__get (line 198)

Magic Getter Method

Attempts to load the module variable. If it's not set, will attempt to load from the config.

  • return: value of the variable or boolean false
  • access: public
mixed __get (string $name)
  • string $name: name of the variable requested
__set (line 184)

Magic Setter Method

Prohibits the direct modification of module variables.

  • access: public
void __set (string $name, mixed $value)
  • string $name: name of the variable to be set
  • mixed $value: value of the variable to be set

Inherited Methods

Inherited From Object

Object::__construct()
Object::getInstance()
Object::__destruct()

Documentation generated on Sun, 17 Oct 2010 23:17:23 -0400 by phpDocumentor 1.4.3