<?php


class ATPCurierat_Ship_Model_Observer 
{
   public function addButtonShip($event)
    { 
         $container = $event->getBlock();

        if (null !== $container && $container->getType() == 'adminhtml/sales_order_shipment_view') {

            $dataUrgent = array(
                'label' => 'Genereaza awb ATP Transit',
                'class' => 'awb-button',
                'onclick' => 'setLocation(\'' . Mage::helper("adminhtml")->getUrl("atpcurierat_ship/adminhtml_custom/generate",
                        array(
                            'shippment_id' => $container->getShipment()->getId(),
                            'order_id' => $container->getShipment()->getOrderId()                                                     
                        )) . '\')',
            );
            $container->addButton('my_button_identifier1', $dataUrgent);
        }

        return $this;
    }
    
    public function addButtonDelete($event)
    { 
         $container = $event->getBlock();

        if (null !== $container && $container->getType() == 'adminhtml/sales_order_shipment_view') {

            $dataUrgent = array(
                'label' => 'Sterge awb',
                'class' => 'awb-button',
                'onclick' => 'setLocation(\'' . Mage::helper("adminhtml")->getUrl("atpcurierat_ship/adminhtml_custom/delete",
                        array(
                            'shippment_id' => $container->getShipment()->getId(),
                            'order_id' => $container->getShipment()->getOrderId()                                                     
                        )) . '\')',
            );
            $container->addButton('my_button_identifier2', $dataUrgent);
        }

        return $this;
    }
    
      public function addButtonPrint($event)
    { 
         $container = $event->getBlock();

        if (null !== $container && $container->getType() == 'adminhtml/sales_order_shipment_view') {

            $dataUrgent = array(
                'label' => 'Printeaza awb',
                'class' => 'awb-button',
                'onclick' => 'setLocation(\'' . Mage::helper("adminhtml")->getUrl("atpcurierat_ship/adminhtml_custom/print",
                        array(
                            'shippment_id' => $container->getShipment()->getId(),
                            'order_id' => $container->getShipment()->getOrderId()                                                     
                        )) . '\')',
            );
            $container->addButton('my_button_identifier3', $dataUrgent);
        }

        return $this;
    }
}