*/
class Mage_Adminhtml_Block_Sales_Reorder_Renderer_Action
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
/**
* Array to store all options data
*
* @var array
*/
protected $_actions = array();
public function render(Varien_Object $row)
{
$this->_actions = array();
if (Mage::helper('sales/reorder')->canReorder($row)) {
$reorderAction = array(
'@' => array('href' => $this->getUrl('*/sales_order_create/reorder', array('order_id'=>$row->getId()))),
'#' => Mage::helper('sales')->__('Reorder')
);
$this->addToActions($reorderAction);
}
Mage::dispatchEvent('adminhtml_customer_orders_add_action_renderer', array('renderer' => $this, 'row' => $row));
return $this->_actionsToHtml();
}
protected function _getEscapedValue($value)
{
return addcslashes(htmlspecialchars($value),'\\\'');
}
/**
* Render options array as a HTML string
*
* @param array $actions
* @return string
*/
protected function _actionsToHtml(array $actions = array())
{
$html = array();
$attributesObject = new Varien_Object();
if (empty($actions)) {
$actions = $this->_actions;
}
foreach ($actions as $action) {
$attributesObject->setData($action['@']);
$html[] = 'serialize() . '>' . $action['#'] . '';
}
return implode($html, '|');
}
/**
* Add one action array to all options data storage
*
* @param array $actionArray
* @return void
*/
public function addToActions($actionArray)
{
$this->_actions[] = $actionArray;
}
}