Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content:

Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getUploader ()
 getUploaderHtml ()
 getJsObjectName ()
 getAddImagesButton ()
 getImagesJson ()
 getImagesValuesJson ()
 getImageTypes ()
 hasUseDefault ()
 getMediaAttributes ()
 getImageTypesJson ()

Protected Member Functions

 _prepareLayout ()


Detailed Description

Definition at line 35 of file Content.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 38 of file Content.php.

00039     {
00040         parent::__construct();
00041         $this->setTemplate('catalog/product/helper/gallery.phtml');
00042     }


Member Function Documentation

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 44 of file Content.php.

00045     {
00046         $this->setChild('uploader',
00047             $this->getLayout()->createBlock('adminhtml/media_uploader')
00048         );
00049 
00050         $this->getUploader()->getConfig()
00051             ->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/catalog_product_gallery/upload'))
00052             ->setFileField('image')
00053             ->setFilters(array(
00054                 'images' => array(
00055                     'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png)'),
00056                     'files' => array('*.gif', '*.jpg','*.jpeg', '*.png')
00057                 )
00058             ));
00059 
00060         return parent::_prepareLayout();
00061     }

getAddImagesButton (  ) 

Definition at line 88 of file Content.php.

00089     {
00090         return $this->getButtonHtml(
00091             Mage::helper('catalog')->__('Add New Images'),
00092             $this->getJsObjectName() . '.showUploader()',
00093             'add',
00094             $this->getHtmlId() . '_add_images_button'
00095         );
00096     }

getImagesJson (  ) 

Definition at line 98 of file Content.php.

00099     {
00100         if(is_array($this->getElement()->getValue())) {
00101             $value = $this->getElement()->getValue();
00102             if(count($value['images'])>0) {
00103                 foreach ($value['images'] as &$image) {
00104                     $image['url'] = Mage::getSingleton('catalog/product_media_config')
00105                                         ->getMediaUrl($image['file']);
00106                 }
00107                 return Zend_Json::encode($value['images']);
00108             }
00109         }
00110         return '[]';
00111     }

getImagesValuesJson (  ) 

Definition at line 113 of file Content.php.

00114     {
00115         $values = array();
00116         foreach ($this->getMediaAttributes() as $attribute) {
00117             /* @var $attribute Mage_Eav_Model_Entity_Attribute */
00118             $values[$attribute->getAttributeCode()] = $this->getElement()->getDataObject()->getData(
00119                 $attribute->getAttributeCode()
00120             );
00121         }
00122         return Zend_Json::encode($values);
00123     }

getImageTypes (  ) 

Enter description here...

Returns:
array

Definition at line 130 of file Content.php.

00131     {
00132         $imageTypes = array();
00133         foreach ($this->getMediaAttributes() as $attribute) {
00134             /* @var $attribute Mage_Eav_Model_Entity_Attribute */
00135             $imageTypes[$attribute->getAttributeCode()] = array(
00136                 'label' => $attribute->getFrontend()->getLabel() . ' '
00137                          . Mage::helper('catalog')->__($this->getElement()->getScopeLabel($attribute)),
00138                 'field' => $this->getElement()->getAttributeFieldName($attribute)
00139             );
00140         }
00141         return $imageTypes;
00142     }

getImageTypesJson (  ) 

Definition at line 165 of file Content.php.

00166     {
00167         return Zend_Json::encode($this->getImageTypes());
00168     }

getJsObjectName (  ) 

Definition at line 83 of file Content.php.

00084     {
00085         return $this->getHtmlId() . 'JsObject';
00086     }

getMediaAttributes (  ) 

Enter description here...

Returns:
array

Definition at line 160 of file Content.php.

00161     {
00162         return $this->getElement()->getDataObject()->getMediaAttributes();
00163     }

getUploader (  ) 

Retrive uploader block

Returns:
Mage_Adminhtml_Block_Media_Uploader

Definition at line 68 of file Content.php.

00069     {
00070         return $this->getChild('uploader');
00071     }

getUploaderHtml (  ) 

Retrive uploader block html

Returns:
string

Definition at line 78 of file Content.php.

00079     {
00080         return $this->getChildHtml('uploader');
00081     }

hasUseDefault (  ) 

Definition at line 144 of file Content.php.

00145     {
00146         foreach ($this->getMediaAttributes() as $attribute) {
00147             if($this->getElement()->canDisplayUseDefault($attribute))  {
00148                 return true;
00149             }
00150         }
00151 
00152         return false;
00153     }


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

Generated on Sat Jul 4 17:22:46 2009 for Magento by  doxygen 1.5.8