Mage_Googleoptimizer_Block_Adminhtml_Cms_Page_Edit_Tab_Googleoptimizer Class Reference

Inheritance diagram for Mage_Googleoptimizer_Block_Adminhtml_Cms_Page_Edit_Tab_Googleoptimizer:

Mage_Adminhtml_Block_Widget_Form 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

 getCmsPage ()
 getGoogleOptimizer ()

Protected Member Functions

 _prepareForm ()


Detailed Description

Definition at line 34 of file Googleoptimizer.php.


Member Function Documentation

_prepareForm (  )  [protected]

Prepare form before rendering HTML

Returns:
Mage_Adminhtml_Block_Widget_Form

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 36 of file Googleoptimizer.php.

00037     {
00038         $form = new Varien_Data_Form();
00039 
00040         $fieldset = $form->addFieldset('googleoptimizer_fields',
00041             array('legend'=>Mage::helper('googleoptimizer')->__('Google Optimizer Scripts'))
00042         );
00043 
00044         Mage::helper('googleoptimizer')->setStoreId(Mage::app()->getDefaultStoreView());
00045 
00046         $fieldset->addField('conversion_page', 'select',
00047             array(
00048                 'name'  => 'conversion_page',
00049                 'label' => Mage::helper('googleoptimizer')->__('Conversion Page'),
00050                 'values'=> Mage::getModel('googleoptimizer/adminhtml_system_config_source_googleoptimizer_conversionpages')->toOptionArray(),
00051                 'class' => 'select googleoptimizer validate-googleoptimizer',
00052                 'required' => false,
00053                 'onchange' => 'googleOptimizerConversionPageAction(this)'
00054             )
00055         );
00056 
00057         if (!Mage::app()->isSingleStoreMode()) {
00058             $form->getElement('conversion_page')->setOnchange('googleOptimizerConversionCmsPageAction(this)');
00059             $fieldset->addField('conversion_page_url', 'note',
00060                 array(
00061                     'name'  => 'conversion_page_url',
00062                     'label' => Mage::helper('googleoptimizer')->__('Conversion Page URL'),
00063                 )
00064             )->setRenderer($this->getLayout()->createBlock('googleoptimizer/adminhtml_cms_page_edit_renderer_conversion'));
00065         } else {
00066             $fieldset->addField('conversion_page_url', 'text',
00067                 array(
00068                     'name'  => 'conversion_page_url',
00069                     'label' => Mage::helper('googleoptimizer')->__('Conversion Page URL'),
00070                     'class' => 'input-text',
00071                     'readonly' => 'readonly',
00072                     'required' => false,
00073                     'note' => Mage::helper('googleoptimizer')->__('Please copy and paste this value to experiment edit form')
00074                 )
00075             );
00076         }
00077 
00078         $fieldset->addField('export_controls', 'text',
00079             array(
00080                 'name'  => 'export_controls',
00081             )
00082         );
00083 
00084         $pageTypes = array(
00085             '' => Mage::helper('googleoptimizer')->__('-- Please Select --'),
00086             'original' => Mage::helper('googleoptimizer')->__('Original Page'),
00087             'variant' => Mage::helper('googleoptimizer')->__('Variant Page')
00088         );
00089 
00090         $fieldset->addField('page_type', 'select',
00091             array(
00092                 'name'  => 'page_type',
00093                 'label' => Mage::helper('googleoptimizer')->__('Page Type'),
00094                 'values'=> $pageTypes,
00095                 'class' => 'select googleoptimizer validate-googleoptimizer',
00096                 'required' => false,
00097                 'onchange' => 'googleOptimizerVariantPageAction(this)'
00098             )
00099         );
00100 
00101         $fieldset->addField('control_script', 'textarea',
00102             array(
00103                 'name'  => 'control_script',
00104                 'label' => Mage::helper('googleoptimizer')->__('Control Script'),
00105                 'class' => 'textarea validate-googleoptimizer',
00106                 'required' => false,
00107                 'note' => '',
00108             )
00109         );
00110         $fieldset->addField('tracking_script', 'textarea',
00111             array(
00112                 'name'  => 'tracking_script',
00113                 'label' => Mage::helper('googleoptimizer')->__('Tracking Script'),
00114                 'class' => 'textarea validate-googleoptimizer',
00115                 'required' => false,
00116                 'note' => '',
00117             )
00118         );
00119         $fieldset->addField('conversion_script', 'textarea',
00120             array(
00121                 'name'  => 'conversion_script',
00122                 'label' => Mage::helper('googleoptimizer')->__('Conversion Script'),
00123                 'class' => 'textarea validate-googleoptimizer',
00124                 'required' => false,
00125                 'note' => '',
00126             )
00127         );
00128 
00129         if (Mage::helper('googleoptimizer')->getConversionPagesUrl()
00130             && $this->getGoogleOptimizer()
00131             && $this->getGoogleOptimizer()->getConversionPage())
00132         {
00133             $form->getElement('conversion_page_url')
00134                 ->setValue(Mage::helper('googleoptimizer')
00135                     ->getConversionPagesUrl()->getData($this->getGoogleOptimizer()->getConversionPage())
00136                 );
00137         }
00138 
00139         $renderer = $this->getLayout()->createBlock('adminhtml/catalog_form_renderer_googleoptimizer_import');
00140         $form->getElement('export_controls')->setRenderer($renderer);
00141 
00142         $values = array();
00143         if ($this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getData()) {
00144             $values = $this->getGoogleOptimizer()->getData();
00145             $fieldset->addField('code_id', 'hidden', array('name' => 'code_id'));
00146             if ($this->getGoogleOptimizer()->getData('page_type') == Mage_Googleoptimizer_Model_Code_Page::PAGE_TYPE_VARIANT) {
00147                 foreach ($fieldset->getElements() as $element) {
00148                     if (($element->getId() != 'tracking_script' && $element->getId() != 'page_type')
00149                         && ($element->getType() == 'textarea' || $element->getType() == 'select'))
00150                     {
00151                         $element->setDisabled(true);
00152                     }
00153                 }
00154             }
00155         }
00156 
00157         $form->addValues($values);
00158         $form->setFieldNameSuffix('googleoptimizer');
00159         $this->setForm($form);
00160 
00161         return parent::_prepareForm();
00162     }

getCmsPage (  ) 

Definition at line 164 of file Googleoptimizer.php.

00165     {
00166         return Mage::registry('cms_page');
00167     }

getGoogleOptimizer (  ) 

Definition at line 169 of file Googleoptimizer.php.

00170     {
00171         if ($this->getCmsPage()->getGoogleoptimizer()) {//if data was set from session after exception
00172             $googleOptimizer = new Varien_Object($this->getCmsPage()->getGoogleoptimizer());
00173         } else {
00174             $googleOptimizer = $this->getCmsPage()->getGoogleOptimizerScripts();
00175         }
00176         return $googleOptimizer;
00177     }


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

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