[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/view/ -> view.class.php (sommaire)

\defgroup View A view is the class in pLog that takes care of rendering the content and sending to the user. In pLog each Action class must generate a view that can be sent to the client, which is obtained via the method Action::getView()

Poids: 326 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 13 fois
Nécessite: 0 fichiers

Définit 1 class

View:: (16 méthodes):
  View()
  setValue()
  getValue()
  setContentType()
  setCharset()
  addHeaderResponse()
  setHeaders()
  sendContentType()
  setErrorMessage()
  setError()
  setSuccess()
  setSuccessMessage()
  setSessionValue()
  getSessionValue()
  getCurrentPageFromRequest()
  render()


Classe: View  - X-Ref

\ingroup View

Base class with basic methods related to views. This class should not be used directly since it does
not know anything about blogs, plugins or templates. New blog classes should either extend
BlogView or PluginTemplatedView, while new admin view classes should extend AdminView or
AdminPluginTemplatedView.

This base View class does not know anything about cached views either.

In case it is necessary to create a class extending directly from View, please implement your own rendering
logic in the View::render() method but do not forget to call it at some point in your render() method.
View()   X-Ref
Constructor. Initializes the view with a default content type, character set, etc.


setValue( $name, $value )   X-Ref
Sets a single parameter for the view. These parameters will be passed to the template layer
once it gets processed.

param: name Name of the parameter
param: value Value of the parameter

getValue( $name )   X-Ref
Returns the value identified by the key $key

param: name The key
return: The value associated to that key

setContentType( $contentType )   X-Ref
sets the default content-type of the view. The default content type, if none specified, is
text/html

param: contentType The new content type

setCharset( $charset )   X-Ref
sets the character set. If none is specified, the default content type is ISO-8859-1

param: charset the character set

addHeaderResponse( $headerString )   X-Ref
Adds a new header string to the current list of headers

param: headerString the new header string
return: Always true

setHeaders( $headers = Array()   X-Ref
sets the headers that are going to be sent to the client
from the values in the array. This will remove ALL the headers
that have been set so far!

param: headers An array of strings
return: always true

sendContentType()   X-Ref
prints out the content type and character set to the client, by setting the
Content-Type HTTP response header

return: always true.

setErrorMessage( $message )   X-Ref
sets an error message for the whole form, should that be needed

param: message
return: Always true

setError( $error = true )   X-Ref
Whether the view has to show some error message or not. Views can
show success messages as well as error messages at the same time.

param: error
return: Always true

setSuccess( $success = true )   X-Ref
Whether the view has to show some success message or not. Views can show
sucess messages as well as error messages as the same time!

param: success
return: Always true

setSuccessMessage( $message )   X-Ref
sets an success message for the whole form, should that be needed

param: message
param: formName not used nor required (yet!)
return: Always true

setSessionValue( $param, $value )   X-Ref
stores a value in the session, associated to one key, in case
the view wants to keep some value for later use such as filter settings
for persisten listings, etc.

param: param
param: value
return: Always true

getSessionValue( $param, $defaultValue = "" )   X-Ref
retrieves a parameter from the session

param: param
param: defaultValue
return: The value associated to the parameter or empty if not

getCurrentPageFromRequest()   X-Ref
gets the current page from the HTTP request

return: the page number from the request

render()   X-Ref
Renders the view. Here we would ideally call a template engine, using the
values in $this->_params to fill the template 'context' and then display
everything. All classes extending the main View class (or any of its child classes
such as BlogView) are advised to call parent::render() as the first thing in their
own render() method.

By default does nothing and it has no parameters



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics