.

ViewFactory Class Reference
[View]

Static view factory. More...

List of all members.

Static Public Member Functions

static  create_view ($type, $template_name, $params=false)
  Create a suitable view.
static  set_implementation (IViewFactory $implementation, $keep_old=false)
  Change Implementation.

Detailed Description

Static view factory.

Author:
Gerd Riesselmann

Definition at line 10 of file viewfactory.cls.php.


Member Function Documentation

static ViewFactory::create_view ( type,
template_name,
params = false  
) [static]

Create a suitable view.

Parameters:
$type  The type of view to create as a string, e.g. "page", or "content", or "XML" ...
$template_name  Name of the template
$params  Params to pass to view, may depend on type
Returns:
IView

Definition at line 47 of file viewfactory.cls.php.

00047                                                                                   {
00048                 if (empty(self::$implementation)) {
00049                         self::set_implementation(new ViewFactoryBase());
00050                 }
00051                 return self::$implementation->create_view($type, $template_name, $params);
00052         }
static ViewFactory::set_implementation ( IViewFactory implementation,
keep_old = false  
) [static]

Change Implementation.

Parameters:
$implementation  The new implementation
$keep_old  If set to TRUE, an existing implementation will not get replaced. Don't mix this with a call to set_old_implementation() of the new factory implementation, since this will always be done.

Definition at line 28 of file viewfactory.cls.php.

00028                                                                                                    {
00029                 // keep old, if told so 
00030                 if (!empty(self::$implementation)) {
00031                         if ($keep_old) {
00032                                 return;
00033                         }
00034                         $implementation->set_old_implementation(self::$implementation); 
00035                 }
00036                 self::$implementation = $implementation;
00037         }

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