Properties

$engine

$engine : 

Type

$session

$session : 

Type

$templateFile

$templateFile : 

Type

$variables

$variables : 

Type

$objects

$objects : 

Type

Methods

__construct()

__construct(\class  $engine, \myMVC_HttpSession  $session) 

Constructor.

This function does nothing! This class will not be used, but just derived (see myMVC_BaseAction and myMVC_BaseView)

Parameters

\class $engine

The engine as subclass of myMVC_BaseEngine

\myMVC_HttpSession $session

The current session

setVariable()

setVariable(string  $key, string  $value) 

Save a variable to be used in the template

Parameters

string $key

The name of the template variable

string $value

The value

setObject()

setObject(string  $key,   $obj) 

Save an object (reference) to be used in the template

Parameters

string $key

The name of the template object

$obj

getTemplateFile()

getTemplateFile() 

Returns the template file for the current view

Throws

\myMVC_MVCException

On problems

getViewToken()

getViewToken() : string

Returns the token used to identify the current View

Returns

string —

The token

preRender()

preRender() : boolean

Prepare to render the View

Returns

boolean —

true if the page can be display, false otherwise

render()

render() 

Render the page and send it to the browser

fetch()

fetch() : string

Render the page and return it as string

Returns

string —

The page as string

createURLPrevious()

createURLPrevious(  $params,   $engine) : string

Template-function to create the URL of the previous used action

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

string —

The created URL

createURL()

createURL(  $params,   $engine) : string

Template-function to create an URL

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

string —

The created URL

getActionCSS()

getActionCSS(  $params,   $engine) : string

Template-function to return the CSS of the given action

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

string —

The CSS class of the given action

getActionMenuItem()

getActionMenuItem(  $params,   $smarty) : string

Template-function to create menu item

Parameters

$params
$smarty

Returns

string —

The action name

callActionStaticFunction()

callActionStaticFunction(  $params,   $smarty) : string

Template-function to call an arbitrary static function of a given Action class

Parameters

$params
$smarty

Returns

string —

The action name

errorMessage()

errorMessage(  $params,   $engine) : string

Template-function to return the error message of the given form field

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

string —

The error message for the given field

errorMessagesAsString()

errorMessagesAsString(  $params,   $engine) : string

Template-function to return all error messages as string

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

string —

All error messages

errorMessagesAsArray()

errorMessagesAsArray(  $params,   $engine) : array

Template-function to return all error messages as numeric array of associative arrays ('field' => <field name>, 'message' => <error message>)

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

array —

All error messages as numeric array of associative arrays

isFieldValid()

isFieldValid(  $params,   $engine) : boolean

Template-function to return whether the form field passed the validation

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

boolean —

true if the field passed the validation, false otherwise

isCalledFromMenu()

isCalledFromMenu(  $params,   $engine) : boolean

Template-function to return whether the action, who called this view, was called from a menu or directly from another action/view

Parameters

$params
$engine

The engine (typically myMVC_SmartyEngine)

Returns

boolean —

true if the field passed the validation, false otherwise

formatNumber()

formatNumber(  $number,   $decimals) : string

Format a number with the actual locale information Example: Locale de_DE: 1.234,56 Locale en_US: 1,234.56 Locale it_IT: 1234,56

Parameters

$number

The number to be formatted

$decimals

How many decimals

Returns

string —

The formatted number

getLoggedUser()

getLoggedUser() : \myMVC_BaseLogin

Returns the current logged user, if any.

This function has to be static, then it will normally called from static functions (eg hasUserRightForAction).

Returns

\myMVC_BaseLogin

The currently logged user, or NULL if no user is logged in, or the user's class is not a subclass of myMVC_BaseLogin

saveParameterForNextPage()

saveParameterForNextPage(string  $key, string  $value) 

Save a variable in the session, to be used by the next page (Action or view).

This variable can be read with the method getParameterFromPreviousPage of the classes BaseAction or BaseView

Parameters

string $key

The name of the variable

string $value

The value

getParameterFromPreviousPage()

getParameterFromPreviousPage(string  $key) 

Returns a variable saved from the previous class with saveParameterForNextPage

Parameters

string $key

The name of the variable

getFromPreviousSubmit()

getFromPreviousSubmit(  $field) 

Returns the value for the given field in the previous submitted form.

WARNING: This function just returns the fields, that passed the validation!!

Parameters

$field

getInvalidFromPreviousSubmit()

getInvalidFromPreviousSubmit(  $field) 

Returns the value for the given field in the previous submitted form.

WARNING: This function just returns the fields, that NOT passed the validation!!

Parameters

$field

isParameterFromPreviousSubmitValid()

isParameterFromPreviousSubmitValid(string  $field) : boolean

Returns whether the given parameter of the previous submitted form passed the validation or not.

Parameters

string $field

The name of the parameter

Returns

boolean —

true if the parameter passed the validation, false otherwise

getParameterErrors()

getParameterErrors() : array

Returns all error messages after the validation of the user's parameters

Returns

array —

An associative array with all the errors in the format 'field' => 'error message'

setTemplate()

setTemplate(string  $file) 

Use $file as template

Parameters

string $file

The template file

setAllSubmitFields()

setAllSubmitFields() 

Set all form fields of the previous form as variable to be displayed by the engine

setAllInvalidFields()

setAllInvalidFields() 

Set all the invalid form fields of the previous form as variable to be displayed by the engine

setAllValidFields()

setAllValidFields() 

Set all the valid form fields of the previous form as variable to be displayed by the engine

prepare()

prepare() 

Prepare to display the page.

Send all variables to the engine