Exemplo n.º 1
0
 /**
  * Retrive config json
  *
  * @return string
  */
 public function getConfigJson($type = 'links')
 {
     $this->getUploaderConfig()->setFileParameterName($type)->setTarget(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/downloadable_file/upload', array('type' => $type, '_secure' => true)));
     $this->getMiscConfig()->setReplaceBrowseWithRemove(true);
     return Mage::helper('core')->jsonEncode(parent::getJsonConfig());
 }
Exemplo n.º 2
0
 /**
  * Prepare image data for uploader
  *
  * @param array $image
  * @return array
  */
 protected function _prepareImagesData($image)
 {
     $this->clearConfig();
     $params = array('image_type' => $image['image_type'], '_secure' => true, 'order' => $image['order'], 'application_id' => $this->getApplicationId());
     if (isset($image['image_id'])) {
         $this->getMiscConfig()->setData('file_save', Mage::getModel('xmlconnect/images')->getImageUrl($image['image_file']))->setImageId($image['image_id'])->setData('thumbnail', Mage::getModel('xmlconnect/images')->getCustomSizeImageUrl($image['image_file'], Mage_XmlConnect_Helper_Data::THUMBNAIL_IMAGE_WIDTH, Mage_XmlConnect_Helper_Data::THUMBNAIL_IMAGE_HEIGHT))->setData('image_id', $image['image_id']);
         $imageActionData = Mage::helper('xmlconnect')->getApplication()->getImageActionModel()->getImageActionData($image['image_id']);
         if ($imageActionData) {
             $this->getMiscConfig()->setData('image_action_data', $imageActionData);
         }
     }
     $this->getUploaderConfig()->setFileParameterName($image['image_type'])->setTarget(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/uploadimages', $params));
     $this->getButtonConfig()->setAttributes(array('accept' => $this->getButtonConfig()->getMimeTypesByExtensions('gif, jpg, jpeg, png')));
     $this->getMiscConfig()->setReplaceBrowseWithRemove(true)->setData('image_count', $this->getImageCount());
     return parent::getJsonConfig();
 }