.

ViewFactoryBase Class Reference
[View]

Default implementation of view factory. More...

Inheritance diagram for ViewFactoryBase:
IViewFactory ViewFactoryAjax ViewFactoryConsole ViewFactoryMime

List of all members.

Public Member Functions

  create_view ($type, $template_name, $params)
  Create a suitable view.
  set_old_implementation (IViewFactory $implementation)
  Set old implementation.

Detailed Description

Default implementation of view factory.

Author:
Gerd Riesselmann

Definition at line 9 of file viewfactorybase.cls.php.


Member Function Documentation

ViewFactoryBase::create_view ( type,
template_name,
params  
)

Create a suitable view.

Parameters:
$type  The type of view to create as 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

Implements IViewFactory.

Reimplemented in ViewFactoryAjax, ViewFactoryConsole, and ViewFactoryMime.

Definition at line 25 of file viewfactorybase.cls.php.

00025                                                                     {
00026                 if ($this->delegate) {
00027                         return $this->delegate->create_view($type, $template_name, $params);
00028                 }
00029                 else {
00030                         switch ($type) {
00031                                 case IViewFactory::PAGE:
00032                                         require_once(dirname(__FILE__) . '/pageviewbase.cls.php');
00033                                         return new PageViewBase($params, $template_name);
00034                                 case IViewFactory::CONTENT:
00035                                         require_once(dirname(__FILE__) . '/contentviewbase.cls.php');
00036                                         return new ContentViewBase($template_name, $params);
00037                                 case IViewFactory::MESSAGE:
00038                                         require_once(dirname(__FILE__) . '/messageviewbase.cls.php');
00039                                         return new MessageViewBase($template_name);
00040                                 case IViewFactory::XML:
00041                                         require_once(dirname(__FILE__) . '/xmlviewbase.cls.php');
00042                                         return new XmlViewBase($template_name, $params);
00043                         }
00044                 }
00045                 throw new Exception(tr('Unkown view type %t','core', array('%t' => $type)));
00046         }
ViewFactoryBase::set_old_implementation ( IViewFactory implementation  ) 

Set old implementation.

Requests not handled should be delegated to this

Parameters:
$implementation  Another IViewFactory

Implements IViewFactory.

Definition at line 53 of file viewfactorybase.cls.php.

00053                                                                              {
00054                 $this->delegate = $implementation;
00055         }

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