Varien_Data_Form_Element_Image Class Reference

Inheritance diagram for Varien_Data_Form_Element_Image:

Varien_Data_Form_Element_Abstract Varien_Data_Form_Abstract Varien_Object Mage_Adminhtml_Block_Catalog_Category_Helper_Image Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Image Mage_Adminhtml_Block_System_Config_Form_Field_Image

List of all members.

Public Member Functions

 __construct ($data)
 getElementHtml ()
 getName ()

Protected Member Functions

 _getDeleteCheckbox ()
 _getHiddenInput ()
 _getUrl ()


Detailed Description

Definition at line 35 of file Image.php.


Constructor & Destructor Documentation

__construct ( data  ) 

Enter description here...

Parameters:
array $data

Reimplemented from Varien_Data_Form_Element_Abstract.

Definition at line 43 of file Image.php.

00044     {
00045         parent::__construct($data);
00046         $this->setType('file');
00047     }


Member Function Documentation

_getDeleteCheckbox (  )  [protected]

Enter description here...

Returns:
string

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Image.

Definition at line 79 of file Image.php.

00080     {
00081         $html = '';
00082         if ($this->getValue()) {
00083             $html .= '<span class="delete-image">';
00084             $html .= '<input type="checkbox" name="'.parent::getName().'[delete]" value="1" class="checkbox" id="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' disabled="disabled"': '').'/>';
00085             $html .= '<label for="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' class="disabled"' : '').'> '.__('Delete Image').'</label>';
00086             $html .= $this->_getHiddenInput();
00087             $html .= '</span>';
00088         }
00089 
00090         return $html;
00091     }

_getHiddenInput (  )  [protected]

Enter description here...

Returns:
string

Definition at line 98 of file Image.php.

00099     {
00100         return '<input type="hidden" name="'.parent::getName().'[value]" value="'.$this->getValue().'" />';
00101     }

_getUrl (  )  [protected]

Get image preview url

Returns:
string

Reimplemented in Mage_Adminhtml_Block_Catalog_Category_Helper_Image, Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Image, and Mage_Adminhtml_Block_System_Config_Form_Field_Image.

Definition at line 108 of file Image.php.

00109     {
00110         return $this->getValue();
00111     }

getElementHtml (  ) 

Enter description here...

Returns:
string

Reimplemented from Varien_Data_Form_Element_Abstract.

Definition at line 54 of file Image.php.

00055     {
00056         $html = '';
00057 
00058         if ($this->getValue()) {
00059             $url = $this->_getUrl();
00060 
00061             if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) {
00062                 $url = Mage::getBaseUrl('media') . $url;
00063             }
00064 
00065             $html = '<a href="'.$url.'" onclick="imagePreview(\''.$this->getHtmlId().'_image\'); return false;"><img src="'.$url.'" id="'.$this->getHtmlId().'_image" title="'.$this->getValue().'" alt="'.$this->getValue().'" height="22" width="22" class="small-image-preview v-middle" /></a> ';
00066         }
00067         $this->setClass('input-file');
00068         $html.= parent::getElementHtml();
00069         $html.= $this->_getDeleteCheckbox();
00070 
00071         return $html;
00072     }

getName (  ) 

Enter description here...

Returns:
string

Reimplemented from Varien_Data_Form_Element_Abstract.

Definition at line 118 of file Image.php.

00119     {
00120         return  $this->getData('name');
00121     }


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

Generated on Sat Jul 4 17:25:00 2009 for Magento by  doxygen 1.5.8