.

WidgetItemMenuItem Class Reference
[View]

A widget printing one menu item. More...

Inheritance diagram for WidgetItemMenuItem:
IWidget IRenderer

List of all members.

Public Member Functions

  __construct ($action)
  render ($policy=self::NONE)
  Renders what should be rendered.

Static Public Member Functions

static  output ($action, $policy=self::NONE)
  Convenience wrapper.

Public Attributes

  $action

Detailed Description

A widget printing one menu item.

This widget resuses the templates widgets/menu/action and widgets/menu/command depending on the type of the given action

Author:
Gerd Riesselmann

Definition at line 11 of file menuitem.widget.php.


Constructor & Destructor Documentation

WidgetItemMenuItem::__construct ( action  ) 

Definition at line 24 of file menuitem.widget.php.

00024                                              {
00025                 $this->action = $action;
00026         }

Member Function Documentation

static WidgetItemMenuItem::output ( action,
policy = self::NONE  
) [static]

Convenience wrapper.

Parameters:
IAction  $action

Definition at line 19 of file menuitem.widget.php.

00019                                                                    {
00020                 $w = new WidgetItemMenuItem($action);
00021                 return $w->render($policy);
00022         }
WidgetItemMenuItem::render ( policy = self::NONE  ) 

Renders what should be rendered.

Parameters:
int  $policy Defines how to render, meaning depends on implementation
Returns:
string The rendered content

Implements IRenderer.

Definition at line 28 of file menuitem.widget.php.

00028                                                    {
00029                 $ret = '';
00030                 $is_command = ($this->action instanceof ICommand);  
00031                 $template =  $is_command ? 'widgets/menu/command' : 'widgets/menu/action';
00032                 $view = ViewFactory::create_view(IViewFactory::MESSAGE, $template);
00033                 $view->assign('action', $this->action);
00034                 if ($is_command) {
00035                         Load::tools('formhandler');
00036                         $formhandler = new FormHandler('process_commands', 'process_commands', FormHandler::TOKEN_POLICY_REUSE);
00037                         $formhandler->prepare_view($view);
00038                 }
00039                 
00040                 $ret = $view->render();
00041                 return $ret;
00042         }

Member Data Documentation

WidgetItemMenuItem::$action

Definition at line 12 of file menuitem.widget.php.


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