View Manager Class. More...
Public Member Functions | |
__construct ($layout, $view_paths=null, $default_format= 'html', array $layout_vars=array()) | |
Constructor. | |
add ($view) | |
Add a view directory. | |
load () | |
Loads a view. | |
setOutputCallback ($callback) | |
Set the output callback. | |
setOutputFormat ($format) | |
Set the output format (sends the content-type header) | |
setLayout ($layout, $format=null) | |
Set the layout name and optionaly format. | |
getVar ($name) | |
Get the given layout variable. | |
setVar ($name, $value) | |
Set the given layout variable. | |
addAll (array $vars, $method=self::MERGE_VARS) | |
Add a collection to the registered view variables. | |
__get ($key) | |
__get implementeation, alias of axViewManager::getVar() | |
__set ($key, $value) | |
__set implementeation, alias of axViewManager::setVar() | |
__isset ($key) | |
__isset implementation, check whenever a layout variable is set or not | |
__unset ($key) | |
__unset implementation, unset the given layout variable | |
Data Fields | |
const | MERGE_VARS = "merge" |
const | ADD_VARS = "add" |
Protected Member Functions | |
_findLayout ($layout, $format) | |
_findView ($section, $view, $format) | |
Find the proper view according to the $section , $view , and $format parameters. | |
_loadView ($__path, array $__vars=array()) | |
Load (include) the view and returns the produced buffer. | |
_loadLayout ($__path, array $__vars=array()) | |
Load (include) the layout and returns the produced buffer. | |
Protected Attributes | |
$_viewPaths | |
Registered view paths. | |
$_outputCallback | |
Output (transformation) callback. | |
$_layout | |
Layout name. | |
$_defaultFormat | |
Default view format. | |
$_layoutVars | |
Layout variables. |
View Manager Class.
Definition at line 17 of file axViewManager.class.php.
axViewManager::__construct | ( | $ | layout, |
$ | view_paths = null , |
||
$ | default_format = 'html' , |
||
array $ | layout_vars = array() |
||
) |
Constructor.
string | $layout | |
array | $view_paths | [optional] [default null ] |
string | $default_format | [optional] [default "html" ] |
array | $layout_vars | [optional] [default array() ] |
Definition at line 56 of file axViewManager.class.php.
axViewManager::__get | ( | $ | key | ) |
__get implementeation, alias of axViewManager::getVar()
string | $key |
Definition at line 270 of file axViewManager.class.php.
axViewManager::__isset | ( | $ | key | ) |
__isset implementation, check whenever a layout variable is set or not
string | $key |
Definition at line 292 of file axViewManager.class.php.
axViewManager::__set | ( | $ | key, |
$ | value | ||
) |
__set implementeation, alias of axViewManager::setVar()
string | $key | |
mixed | $value |
Definition at line 282 of file axViewManager.class.php.
axViewManager::__unset | ( | $ | key | ) |
__unset implementation, unset the given layout variable
string | $key |
Definition at line 302 of file axViewManager.class.php.
axViewManager::_findLayout | ( | $ | layout, |
$ | format | ||
) | [protected] |
Find the proper layout according to the `$layout` and `$format` parameters
Returns the path in case of success, false on errors.
string | $layout | |
string | $format |
Definition at line 315 of file axViewManager.class.php.
axViewManager::_findView | ( | $ | section, |
$ | view, | ||
$ | format | ||
) | [protected] |
Find the proper view according to the $section
, $view
, and $format
parameters.
Return the path in case of success, false on errors.
string | $section | |
string | $view | |
string | $format |
Definition at line 338 of file axViewManager.class.php.
axViewManager::_loadLayout | ( | $ | __path, |
array $ | __vars = array() |
||
) | [protected] |
Load (include) the layout and returns the produced buffer.
string | $__path | |
array | $__vars | [optional] [default array() ] |
Definition at line 376 of file axViewManager.class.php.
axViewManager::_loadView | ( | $ | __path, |
array $ | __vars = array() |
||
) | [protected] |
Load (include) the view and returns the produced buffer.
string | $__path | |
array | $__vars | [optional] [default array() ] |
Definition at line 357 of file axViewManager.class.php.
axViewManager::add | ( | $ | view | ) |
Add a view directory.
string | $view | The directory path to add |
axMissingFileException | If the directory does'nt exists |
Definition at line 71 of file axViewManager.class.php.
axViewManager::addAll | ( | array $ | vars, |
$ | method = self::MERGE_VARS |
||
) |
Add a collection to the registered view variables.
array | $vars | The map of variables to add |
string | $method | [optional] [default axViewManager::MERGE_VARS ] The adding method |
Definition at line 249 of file axViewManager.class.php.
axViewManager::getVar | ( | $ | name | ) |
Get the given layout variable.
sring | $name |
Definition at line 228 of file axViewManager.class.php.
Loads a view.
This methods has 3 different prototypes:
In the first and third forms, the view path is determined using the $section
and $view
parameters (which are extracted from the $response
object in the first form) and by seeking for the appropriate file according to registered view paths (added with axViewManager::add()).
In all cases, the complete page buffer is returned.
A RuntimeException is thrown if
RuntimeException |
First form: axViewManager::load(axResponse $response);
Second Form: axViewManager::load($path, array $vars = array());
Third From: axViewManager::load($section, $view, $format = "html", array $vars = array(), $layout = null);
Definition at line 101 of file axViewManager.class.php.
axViewManager::setLayout | ( | $ | layout, |
$ | format = null |
||
) |
Set the layout name and optionaly format.
string | $layout | |
string | $format | [optional] [default null ] If not provided, the default format is used (as per set in the constructor) |
Definition at line 218 of file axViewManager.class.php.
axViewManager::setOutputCallback | ( | $ | callback | ) |
Set the output callback.
callback | $callback |
Definition at line 186 of file axViewManager.class.php.
axViewManager::setOutputFormat | ( | $ | format | ) |
Set the output format (sends the content-type header)
string | $format | Must be one of `html`,`json`,`csv`,`xml`,`text` |
Definition at line 198 of file axViewManager.class.php.
axViewManager::setVar | ( | $ | name, |
$ | value | ||
) |
Set the given layout variable.
string | $name | |
mixed | $value |
Definition at line 238 of file axViewManager.class.php.
string axViewManager::$_defaultFormat [protected] |
Default view format.
Definition at line 41 of file axViewManager.class.php.
string axViewManager::$_layout [protected] |
Layout name.
Definition at line 35 of file axViewManager.class.php.
array axViewManager::$_layoutVars [protected] |
Layout variables.
Definition at line 47 of file axViewManager.class.php.
callback axViewManager::$_outputCallback [protected] |
Output (transformation) callback.
Definition at line 29 of file axViewManager.class.php.
array axViewManager::$_viewPaths [protected] |
Registered view paths.
Definition at line 23 of file axViewManager.class.php.
const axViewManager::ADD_VARS = "add" |
Definition at line 396 of file axViewManager.class.php.
const axViewManager::MERGE_VARS = "merge" |
Definition at line 395 of file axViewManager.class.php.