Mage_Downloadable_Product_EditController Class Reference

Inheritance diagram for Mage_Downloadable_Product_EditController:

Mage_Adminhtml_Catalog_ProductController Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 formAction ()
 linkAction ()

Protected Member Functions

 _construct ()
 _processDownload ($resource, $resourceType)


Detailed Description

Definition at line 36 of file EditController.php.


Member Function Documentation

_construct (  )  [protected]

Varien class constructor

Reimplemented from Mage_Adminhtml_Catalog_ProductController.

Definition at line 43 of file EditController.php.

00044     {
00045         $this->setUsedModuleName('Mage_Downloadable');
00046     }

_processDownload ( resource,
resourceType 
) [protected]

Download process

Parameters:
string $resource
string $resourceType

Definition at line 67 of file EditController.php.

00068     {
00069         $helper = Mage::helper('downloadable/download');
00070         /* @var $helper Mage_Downloadable_Helper_Download */
00071 
00072         $helper->setResource($resource, $resourceType);
00073 
00074         $fileName       = $helper->getFilename();
00075         $contentType    = $helper->getContentType();
00076 
00077         $this->getResponse()
00078             ->setHttpResponseCode(200)
00079             ->setHeader('Pragma', 'public', true)
00080             ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
00081             ->setHeader('Content-type', $contentType, true);
00082 
00083         if ($fileSize = $helper->getFilesize()) {
00084             $this->getResponse()
00085                 ->setHeader('Content-Length', $fileSize);
00086         }
00087 
00088         if ($contentDisposition = $helper->getContentDisposition()) {
00089             $this->getResponse()
00090                 ->setHeader('Content-Disposition', $contentDisposition . '; filename='.$fileName);
00091         }
00092 
00093         $this->getResponse()
00094             ->clearBody();
00095         $this->getResponse()
00096             ->sendHeaders();
00097 
00098         $helper->output();
00099     }

formAction (  ) 

Load downloadable tab fieldsets

Definition at line 52 of file EditController.php.

00053     {
00054         $this->_initProduct();
00055         $this->getResponse()->setBody(
00056             $this->getLayout()->createBlock('downloadable/adminhtml_catalog_product_edit_tab_downloadable', 'admin.product.downloadable.information')
00057                 ->toHtml()
00058         );
00059     }

linkAction (  ) 

Download link action

Definition at line 105 of file EditController.php.

00106     {
00107         $linkId = $this->getRequest()->getParam('id', 0);
00108         $link = Mage::getModel('downloadable/link')->load($linkId);
00109         if ($link->getId()) {
00110             $resource = '';
00111             $resourceType = '';
00112             if ($link->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_URL) {
00113                 $resource = $link->getLinkUrl();
00114                 $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_URL;
00115             } elseif ($link->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
00116                 $resource = Mage::helper('downloadable/file')->getFilePath(
00117                     Mage_Downloadable_Model_Link::getBasePath(), $link->getLinkFile()
00118                 );
00119                 $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_FILE;
00120             }
00121             try {
00122                 $this->_processDownload($resource, $resourceType);
00123             } catch (Mage_Core_Exception $e) {
00124                 $this->_getCustomerSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content'));
00125             }
00126         }
00127     }


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

Generated on Sat Jul 4 17:24:09 2009 for Magento by  doxygen 1.5.8