00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Sales_Order_Shipment_View_Tracking extends Mage_Adminhtml_Block_Template
00035 {
00036
00037
00038
00039
00040
00041 protected function _prepareLayout()
00042 {
00043 $onclick = "submitAndReloadArea($('shipment_tracking_info').parentNode, '".$this->getSubmitUrl()."')";
00044 $this->setChild('save_button',
00045 $this->getLayout()->createBlock('adminhtml/widget_button')
00046 ->setData(array(
00047 'label' => Mage::helper('sales')->__('Add'),
00048 'class' => 'save',
00049 'onclick' => $onclick
00050 ))
00051
00052 );
00053 }
00054
00055
00056
00057
00058
00059
00060 public function getShipment()
00061 {
00062 return Mage::registry('current_shipment');
00063 }
00064
00065
00066
00067
00068
00069
00070 public function getSubmitUrl()
00071 {
00072 return $this->getUrl('*/*/addTrack/', array('shipment_id'=>$this->getShipment()->getId()));
00073 }
00074
00075
00076
00077
00078
00079
00080 public function getSaveButtonHtml()
00081 {
00082 return $this->getChildHtml('save_button');
00083 }
00084
00085
00086
00087
00088
00089
00090 public function getRemoveUrl($track)
00091 {
00092 return $this->getUrl('*/*/removeTrack/', array(
00093 'shipment_id' => $this->getShipment()->getId(),
00094 'track_id' => $track->getId()
00095 ));
00096 }
00097
00098
00099
00100
00101
00102
00103 public function getTrackInfoUrl($track)
00104 {
00105 return $this->getUrl('*/*/viewTrack/', array(
00106 'shipment_id' => $this->getShipment()->getId(),
00107 'track_id' => $track->getId()
00108 ));
00109 }
00110
00111
00112
00113
00114
00115
00116 public function getCarriers()
00117 {
00118 $carriers = array();
00119 $carrierInstances = Mage::getSingleton('shipping/config')->getAllCarriers(
00120 $this->getShipment()->getStoreId()
00121 );
00122 $carriers['custom'] = Mage::helper('sales')->__('Custom Value');
00123 foreach ($carrierInstances as $code => $carrier) {
00124 if ($carrier->isTrackingAvailable()) {
00125 $carriers[$code] = $carrier->getConfigData('title');
00126 }
00127 }
00128 return $carriers;
00129 }
00130
00131 public function getCarrierTitle($code)
00132 {
00133 if ($carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($code)) {
00134 return $carrier->getConfigData('title');
00135 }
00136 else {
00137 return Mage::helper('sales')->__('Custom Value');
00138 }
00139 return false;
00140 }
00141 }