gyro/core/view/widgets/listitem.widget.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * A generic list's item 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup View 00007 */ 00008 class WidgetListItem implements IWidget { 00009 protected $page_data; 00010 protected $item; 00011 00012 public static function output($item, $policy = self::NONE) { 00013 $widget = new WidgetListItem($item); 00014 return $widget->render($policy); 00015 } 00016 00017 public function __construct($item) { 00018 $this->item = $item; 00019 } 00020 00021 public function render($policy = self::NONE) { 00022 $ret = ''; 00023 if ($this->item instanceof IDataObject) { 00024 $model = $this->item->get_table_name(); 00025 $view = $this->create_item_view($model); 00026 $view->assign('item', $this->item); 00027 $view->assign('policy', $policy); 00028 $ret = $view->render(); 00029 } 00030 return $ret; 00031 } 00032 00033 protected function create_item_view($model) { 00034 $paths = array( 00035 $model . '/inc/listitem', 00036 'widgets/listitem' 00037 ); 00038 return ViewFactory::create_view(IViewFactory::MESSAGE, $paths); 00039 } 00040 }