.

WidgetListSimple Class Reference
[View]

A generic list, but without pager, sorting et al. More...

Inheritance diagram for WidgetListSimple:
IWidget IRenderer

List of all members.

Public Member Functions

  __construct ($items, $empty_message= '')
  render ($policy=self::NONE)
  Renders what should be rendered.

Static Public Member Functions

static  output ($items, $empty_message= '', $policy=self::NONE)

Protected Member Functions

  render_items ($page_data, $items, $policy)

Protected Attributes

  $empty_message
  $items

Detailed Description

A generic list, but without pager, sorting et al.

Author:
Gerd Riesselmann

Definition at line 8 of file list.simple.widget.php.


Constructor & Destructor Documentation

WidgetListSimple::__construct ( items,
empty_message = ''  
)

Definition at line 17 of file list.simple.widget.php.

00017                                                                  {
00018                 $this->items = $items;
00019                 $this->empty_message = $empty_message;  
00020         } 

Member Function Documentation

static WidgetListSimple::output ( items,
empty_message = '',
policy = self::NONE  
) [static]

Definition at line 12 of file list.simple.widget.php.

00012                                                                                        {
00013                 $widget = new WidgetListSimple($items, $empty_message);
00014                 return $widget->render($policy);                        
00015         } 
WidgetListSimple::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 22 of file list.simple.widget.php.

00022                                                    {
00023                 $ret = '';
00024                 $items = Arr::force($this->items, false);
00025                 $view = ViewFactory::create_view(IViewFactory::MESSAGE, 'widgets/list.simple');
00026                 $view->assign('items', $this->render_items($this->page_data, $items, $policy));
00027                 $view->assign('policy', $policy);
00028                 $view->assign('empty_message', $this->empty_message);
00029                 $ret = $view->render();
00030                 return $ret;
00031         }
WidgetListSimple::render_items ( page_data,
items,
policy  
) [protected]

Definition at line 33 of file list.simple.widget.php.

00033                                                                      {
00034                 $ret = array();
00035                 $i = 1;
00036                 $c = count($items);
00037                 foreach($items as $item) {
00038                         $cls = array('listitem');
00039                         if ($item instanceof IDataObject) {
00040                                 $cls[] = 'listitem-' . $item->get_table_name();
00041                         }
00042                         if ($i == 1) { $cls[] = 'first'; }
00043                         if ($i == $c) { $cls[] = 'last'; }
00044                         $ret[] = html::div(WidgetListItem::output($item, $policy), implode(' ', $cls));
00045                         $i++;
00046                 }               
00047                 return $ret;
00048         }       

Member Data Documentation

WidgetListSimple::$empty_message [protected]

Definition at line 10 of file list.simple.widget.php.

WidgetListSimple::$items [protected]

Definition at line 9 of file list.simple.widget.php.


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