Mage_Adminhtml_Block_Widget_Grid_Column Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Widget_Grid_Column:

Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ($data=array())
 setGrid ($grid)
 getGrid ()
 isLast ()
 getHtmlProperty ()
 getHeaderHtml ()
 getCssClass ()
 getCssProperty ()
 getHeaderCssClass ()
 getHeaderHtmlProperty ()
 getRowField (Varien_Object $row)
 getRowFieldExport (Varien_Object $row)
 setRenderer ($renderer)
 getRenderer ()
 setFilter ($column)
 getFilter ()
 getFilterHtml ()
 getExportHeader ()

Protected Member Functions

 _getRendererByType ()
 _getFilterByType ()

Protected Attributes

 $_grid
 $_renderer
 $_filter
 $_type
 $_cssClass = null


Detailed Description

Definition at line 34 of file Column.php.


Constructor & Destructor Documentation

__construct ( data = array()  ) 

Definition at line 42 of file Column.php.

00043     {
00044         parent::__construct($data);
00045     }


Member Function Documentation

_getFilterByType (  )  [protected]

Definition at line 238 of file Column.php.

00239     {
00240         $type = strtolower($this->getType());
00241         $filters = $this->getGrid()->getColumnFilters();
00242         if (is_array($filters) && isset($filters[$type])) {
00243             return $filters[$type];
00244         }
00245 
00246         switch ($type) {
00247             case 'datetime':
00248                 $filterClass = 'adminhtml/widget_grid_column_filter_datetime';
00249                 break;
00250             case 'date':
00251                 $filterClass = 'adminhtml/widget_grid_column_filter_date';
00252                 break;
00253             case 'range':
00254             case 'number':
00255             case 'currency':
00256                 $filterClass = 'adminhtml/widget_grid_column_filter_range';
00257                 break;
00258             case 'price':
00259                 $filterClass = 'adminhtml/widget_grid_column_filter_price';
00260                 break;
00261             case 'country':
00262                 $filterClass = 'adminhtml/widget_grid_column_filter_country';
00263                 break;
00264             case 'options':
00265                 $filterClass = 'adminhtml/widget_grid_column_filter_select';
00266                 break;
00267 
00268             case 'massaction':
00269                 $filterClass = 'adminhtml/widget_grid_column_filter_massaction';
00270                 break;
00271 
00272             case 'checkbox':
00273                 $filterClass = 'adminhtml/widget_grid_column_filter_checkbox';
00274                 break;
00275 
00276             case 'radio':
00277                 $filterClass = 'adminhtml/widget_grid_column_filter_radio';
00278                 break;
00279             case 'store':
00280                 $filterClass = 'adminhtml/widget_grid_column_filter_store';
00281                 break;
00282             default:
00283                 $filterClass = 'adminhtml/widget_grid_column_filter_text';
00284                 break;
00285         }
00286         return $filterClass;
00287     }

_getRendererByType (  )  [protected]

Definition at line 148 of file Column.php.

00149     {
00150         $type = strtolower($this->getType());
00151         $renderers = $this->getGrid()->getColumnRenderers();
00152 
00153         if (is_array($renderers) && isset($renderers[$type])) {
00154             return $renderers[$type];
00155         }
00156 
00157         switch ($type) {
00158             case 'date':
00159                 $rendererClass = 'adminhtml/widget_grid_column_renderer_date';
00160                 break;
00161             case 'datetime':
00162                 $rendererClass = 'adminhtml/widget_grid_column_renderer_datetime';
00163                 break;
00164             case 'number':
00165                 $rendererClass = 'adminhtml/widget_grid_column_renderer_number';
00166                 break;
00167             case 'currency':
00168                 $rendererClass = 'adminhtml/widget_grid_column_renderer_currency';
00169                 break;
00170             case 'price':
00171                 $rendererClass = 'adminhtml/widget_grid_column_renderer_price';
00172                 break;
00173             case 'country':
00174                 $rendererClass = 'adminhtml/widget_grid_column_renderer_country';
00175                 break;
00176             case 'concat':
00177                 $rendererClass = 'adminhtml/widget_grid_column_renderer_concat';
00178                 break;
00179             case 'action':
00180                 $rendererClass = 'adminhtml/widget_grid_column_renderer_action';
00181                 break;
00182             case 'options':
00183                 $rendererClass = 'adminhtml/widget_grid_column_renderer_options';
00184                 break;
00185             case 'checkbox':
00186                 $rendererClass = 'adminhtml/widget_grid_column_renderer_checkbox';
00187                 break;
00188             case 'massaction':
00189                 $rendererClass = 'adminhtml/widget_grid_column_renderer_massaction';
00190                 break;
00191             case 'radio':
00192                 $rendererClass = 'adminhtml/widget_grid_column_renderer_radio';
00193                 break;
00194             case 'input':
00195                 $rendererClass = 'adminhtml/widget_grid_column_renderer_input';
00196                 break;
00197             case 'select':
00198                 $rendererClass = 'adminhtml/widget_grid_column_renderer_select';
00199                 break;
00200             case 'text':
00201                 $rendererClass = 'adminhtml/widget_grid_column_renderer_longtext';
00202                 break;
00203             case 'store':
00204                 $rendererClass = 'adminhtml/widget_grid_column_renderer_store';
00205                 break;
00206             case 'wrapline':
00207                 $rendererClass = 'adminhtml/widget_grid_column_renderer_wrapline';
00208                 break;
00209             default:
00210                 $rendererClass = 'adminhtml/widget_grid_column_renderer_text';
00211                 break;
00212         }
00213         return $rendererClass;
00214     }

getCssClass (  ) 

Definition at line 75 of file Column.php.

00076     {
00077         if (is_null($this->_cssClass)) {
00078             if ($this->getAlign()) {
00079                 $this->_cssClass .= 'a-'.$this->getAlign();
00080             }
00081             // Add a custom css class for column
00082             if ($this->hasData('column_css_class')) {
00083                 $this->_cssClass .= ' '. $this->getData('column_css_class');
00084             }
00085         }
00086 
00087         return $this->_cssClass;
00088     }

getCssProperty (  ) 

Definition at line 90 of file Column.php.

00091     {
00092         return $this->getRenderer()->renderCss();
00093     }

getExportHeader (  ) 

Retrieve Header Name for Export

Returns:
string

Definition at line 324 of file Column.php.

00325     {
00326         if ($this->getHeaderExport()) {
00327             return $this->getHeaderExport();
00328         }
00329         return $this->getHeader();
00330     }

getFilter (  ) 

Definition at line 289 of file Column.php.

00290     {
00291         if (!$this->_filter) {
00292             $filterClass = $this->getData('filter');
00293             if ($filterClass === false) {
00294                 return false;
00295             }
00296             if (!$filterClass) {
00297                 $filterClass = $this->_getFilterByType();
00298                 if ($filterClass === false) {
00299                     return false;
00300                 }
00301             }
00302             $this->_filter = $this->getLayout()->createBlock($filterClass)
00303                 ->setColumn($this);
00304         }
00305 
00306         return $this->_filter;
00307     }

getFilterHtml (  ) 

Definition at line 309 of file Column.php.

00310     {
00311         if ($this->getFilter()) {
00312             return $this->getFilter()->getHtml();
00313         } else {
00314             return ' ';
00315         }
00316         return null;
00317     }

getGrid (  ) 

Definition at line 55 of file Column.php.

00056     {
00057         return $this->_grid;
00058     }

getHeaderCssClass (  ) 

Definition at line 95 of file Column.php.

00096     {
00097         $class = $this->getData('header_css_class');
00098         if (($this->getSortable()===false) || ($this->getGrid()->getSortable()===false)) {
00099             $class .= 'no-link';
00100         }
00101         if ($this->isLast()) {
00102             $class .= ' last';
00103         }
00104         return $class;
00105     }

getHeaderHtml (  ) 

Definition at line 70 of file Column.php.

00071     {
00072         return $this->getRenderer()->renderHeader();
00073     }

getHeaderHtmlProperty (  ) 

Definition at line 107 of file Column.php.

00108     {
00109         $str = '';
00110         if ($class = $this->getHeaderCssClass()) {
00111             $str.= ' class="'.$class.'"';
00112         }
00113         if ($this->getEditable()) {
00114             $str.= ' colspan="2"';
00115         }
00116 
00117         return $str;
00118     }

getHtmlProperty (  ) 

Definition at line 65 of file Column.php.

00066     {
00067         return $this->getRenderer()->renderProperty();
00068     }

getRenderer (  ) 

Retrieve column renderer

Returns:
Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract

Definition at line 221 of file Column.php.

00222     {
00223         if (!$this->_renderer) {
00224             $rendererClass = $this->getData('renderer');
00225             if (!$rendererClass) {
00226                 $rendererClass = $this->_getRendererByType();
00227             }
00228             $this->_renderer = $this->getLayout()->createBlock($rendererClass)
00229                 ->setColumn($this);
00230         }
00231         return $this->_renderer;
00232     }

getRowField ( Varien_Object row  ) 

Retrieve row column field value for display

Parameters:
Varien_Object $row
Returns:
string

Definition at line 126 of file Column.php.

00127     {
00128         return $this->getRenderer()->render($row);
00129     }

getRowFieldExport ( Varien_Object row  ) 

Retrieve row column field value for export

Parameters:
Varien_Object $row
Returns:
string

Definition at line 137 of file Column.php.

00138     {
00139         return $this->getRenderer()->renderExport($row);
00140     }

isLast (  ) 

Definition at line 60 of file Column.php.

00061     {
00062         return $this->getId() == $this->getGrid()->getLastColumnId();
00063     }

setFilter ( column  ) 

Definition at line 234 of file Column.php.

00235     {
00236     }

setGrid ( grid  ) 

Definition at line 47 of file Column.php.

00048     {
00049         $this->_grid = $grid;
00050         // Init filter object
00051         $this->getFilter();
00052         return $this;
00053     }

setRenderer ( renderer  ) 

Definition at line 142 of file Column.php.

00143     {
00144         $this->_renderer = $renderer;
00145         return $this;
00146     }


Member Data Documentation

$_cssClass = null [protected]

Definition at line 40 of file Column.php.

$_filter [protected]

Definition at line 38 of file Column.php.

$_grid [protected]

Definition at line 36 of file Column.php.

$_renderer [protected]

Definition at line 37 of file Column.php.

$_type [protected]

Definition at line 39 of file Column.php.


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

Generated on Sat Jul 4 17:23:08 2009 for Magento by  doxygen 1.5.8