Mage_GoogleBase_Block_Adminhtml_Types_Edit_Attributes Class Reference

Inheritance diagram for Mage_GoogleBase_Block_Adminhtml_Types_Edit_Attributes:

Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element Mage_Adminhtml_Block_Template Varien_Data_Form_Element_Renderer_Interface Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getFieldId ()
 getFieldName ()
 getGbaseAttributesSelectHtml ()
 getAttributesSelectHtml ($escapeJsQuotes=false)
 getAddButtonHtml ()
 getDeleteButtonHtml ()
 _getAttributes ($setId, $escapeJsQuotes=false)

Protected Member Functions

 _prepareLayout ()
 _toJson ($data)


Detailed Description

Definition at line 34 of file Attributes.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 36 of file Attributes.php.

00037     {
00038         $this->setTemplate('googlebase/types/edit/attributes.phtml');
00039     }


Member Function Documentation

_getAttributes ( setId,
escapeJsQuotes = false 
)

Get attributes of an attribute set Skip attributes not needed for Google Base

Parameters:
int $setId
boolean $escapeJsQuotes
Returns:
array

Definition at line 124 of file Attributes.php.

00125     {
00126         $attributes = Mage::getModel('googlebase/attribute')->getAllowedAttributes($setId);
00127         $result = array();
00128 
00129         foreach ($attributes as $attribute) {
00130             /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
00131             $result[$attribute->getAttributeId()] = $escapeJsQuotes ? $this->jsQuoteEscape($attribute->getFrontendLabel()) : $attribute->getFrontendLabel();
00132         }
00133         return $result;
00134     }

_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 41 of file Attributes.php.

00042     {
00043         $this->setChild('add_button',
00044             $this->getLayout()->createBlock('adminhtml/widget_button')
00045                 ->setData(array(
00046                     'label' => Mage::helper('googlebase')->__('Add New Attribute'),
00047                     'class' => 'add',
00048                     'id'    => 'add_new_attribute',
00049                     'on_click' => 'gBaseAttribute.add()'
00050                 ))
00051         );
00052         $this->setChild('delete_button',
00053             $this->getLayout()->createBlock('adminhtml/widget_button')
00054                 ->setData(array(
00055                     'label' => Mage::helper('googlebase')->__('Remove'),
00056                     'class' => 'delete delete-product-option',
00057                     'on_click' => 'gBaseAttribute.remove(event)'
00058                 ))
00059         );
00060 
00061         parent::_prepareLayout();
00062     }

_toJson ( data  )  [protected]

Definition at line 136 of file Attributes.php.

00137     {
00138         return Zend_Json::encode($data);
00139     }

getAddButtonHtml (  ) 

Definition at line 106 of file Attributes.php.

00107     {
00108         return $this->getChildHtml('add_button');
00109     }

getAttributesSelectHtml ( escapeJsQuotes = false  ) 

Build HTML select element of attribute set attributes

Parameters:
boolean $escapeJsQuotes
Returns:
string

Definition at line 97 of file Attributes.php.

00098     {
00099         $select = $this->getLayout()->createBlock('adminhtml/html_select')
00100             ->setId($this->getFieldId().'_{{index}}_attribute')
00101             ->setName($this->getFieldName().'[{{index}}][attribute_id]')
00102             ->setOptions($this->_getAttributes($this->getAttributeSetId(), $escapeJsQuotes));
00103         return $select->getHtml();
00104     }

getDeleteButtonHtml (  ) 

Definition at line 111 of file Attributes.php.

00112     {
00113         return $this->getChildHtml('delete_button');
00114     }

getFieldId (  ) 

Definition at line 64 of file Attributes.php.

00065     {
00066         return 'gbase_attribute';
00067     }

getFieldName (  ) 

Definition at line 69 of file Attributes.php.

00070     {
00071         return 'attributes';
00072     }

getGbaseAttributesSelectHtml (  ) 

Definition at line 74 of file Attributes.php.

00075     {
00076         $options = array('' => $this->__('Custom attribute, no mapping'));
00077 
00078         $attributes = Mage::getModel('googlebase/service_feed')
00079             ->getAttributes($this->getGbaseItemtype(), $this->getTargetCountry());
00080         foreach ($attributes as $attr) {
00081             $options[$attr->getId()] = $attr->getName();
00082         }
00083 
00084         $select = $this->getLayout()->createBlock('adminhtml/html_select')
00085             ->setId($this->getFieldId().'_{{index}}_gattribute')
00086             ->setName($this->getFieldName().'[{{index}}][gbase_attribute]')
00087             ->setOptions($options);
00088         return $select->getHtml();
00089     }


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

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