Public Member Functions | |
render (Varien_Object $row) | |
Protected Member Functions | |
_toOptionHtml ($action, Varien_Object $row) | |
_toLinkHtml ($action, Varien_Object $row) | |
_transformActionData (&$action, &$actionCaption, Varien_Object $row) |
Definition at line 34 of file Action.php.
_toLinkHtml | ( | $ | action, | |
Varien_Object $ | row | |||
) | [protected] |
Render single action as link html
array | $action | |
Varien_Object | $row |
Definition at line 97 of file Action.php.
00098 { 00099 $actionAttributes = new Varien_Object(); 00100 00101 $actionCaption = ''; 00102 $this->_transformActionData($action, $actionCaption, $row); 00103 00104 if(isset($action['confirm'])) { 00105 $action['onclick'] = 'return window.confirm(\'' 00106 . addslashes($this->htmlEscape($action['confirm'])) 00107 . '\')'; 00108 unset($action['confirm']); 00109 } 00110 00111 $actionAttributes->setData($action); 00112 return '<a ' . $actionAttributes->serialize() . '>' . $actionCaption . '</a>'; 00113 }
_toOptionHtml | ( | $ | action, | |
Varien_Object $ | row | |||
) | [protected] |
Render single action as dropdown option html
unknown_type | $action | |
Varien_Object | $row |
Definition at line 78 of file Action.php.
00079 { 00080 $actionAttributes = new Varien_Object(); 00081 00082 $actionCaption = ''; 00083 $this->_transformActionData($action, $actionCaption, $row); 00084 00085 $htmlAttibutes = array('value'=>$this->htmlEscape(Zend_Json::encode($action))); 00086 $actionAttributes->setData($htmlAttibutes); 00087 return '<option ' . $actionAttributes->serialize() . '>' . $actionCaption . '</option>'; 00088 }
_transformActionData | ( | &$ | action, | |
&$ | actionCaption, | |||
Varien_Object $ | row | |||
) | [protected] |
Prepares action data for html render
array | $action | |
string | $actionCaption | |
Varien_Object | $row |
Definition at line 123 of file Action.php.
00124 { 00125 foreach ( $action as $attibute => $value ) { 00126 if(isset($action[$attibute]) && !is_array($action[$attibute])) { 00127 $this->getColumn()->setFormat($action[$attibute]); 00128 $action[$attibute] = parent::render($row); 00129 } else { 00130 $this->getColumn()->setFormat(null); 00131 } 00132 00133 switch ($attibute) { 00134 case 'caption': 00135 $actionCaption = $action['caption']; 00136 unset($action['caption']); 00137 break; 00138 00139 case 'url': 00140 if(is_array($action['url'])) { 00141 $params = array($action['field']=>$this->_getValue($row)); 00142 if(isset($action['url']['params'])) { 00143 $params = array_merge($action['url']['params'], $params); 00144 } 00145 $action['href'] = $this->getUrl($action['url']['base'], $params); 00146 unset($action['field']); 00147 } else { 00148 $action['href'] = $action['url']; 00149 } 00150 unset($action['url']); 00151 break; 00152 00153 case 'popup': 00154 $action['onclick'] = 'popWin(this.href, \'windth=800,height=700,resizable=1,scrollbars=1\');return false;'; 00155 break; 00156 00157 } 00158 } 00159 return $this; 00160 }
render | ( | Varien_Object $ | row | ) |
Renders column
Varien_Object | $row |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract.
Reimplemented in Mage_Adminhtml_Block_Extensions_Local_Grid_Renderer_Action, Mage_Adminhtml_Block_Extensions_Remote_Grid_Renderer_Action, Mage_Adminhtml_Block_Newsletter_Queue_Grid_Renderer_Action, Mage_Adminhtml_Block_Newsletter_Template_Grid_Renderer_Action, Mage_Adminhtml_Block_Sitemap_Grid_Renderer_Action, and Mage_Adminhtml_Block_System_Email_Template_Grid_Renderer_Action.
Definition at line 43 of file Action.php.
00044 { 00045 $actions = $this->getColumn()->getActions(); 00046 if ( empty($actions) || !is_array($actions) ) { 00047 return ' '; 00048 } 00049 00050 if(sizeof($actions)==1 && !$this->getColumn()->getNoLink()) { 00051 foreach ($actions as $action){ 00052 if ( is_array($action) ) { 00053 return $this->_toLinkHtml($action, $row); 00054 } 00055 } 00056 } 00057 00058 $out = '<select class="action-select" onchange="varienGridAction.execute(this);">' 00059 . '<option value=""></option>'; 00060 $i = 0; 00061 foreach ($actions as $action){ 00062 $i++; 00063 if ( is_array($action) ) { 00064 $out .= $this->_toOptionHtml($action, $row); 00065 } 00066 } 00067 $out .= '</select>'; 00068 return $out; 00069 }