Varien_Data_Form_Element_Abstract PHP Class Code Examples

This page contains top rated real world PHP examples of class Varien_Data_Form_Element_Abstract extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: Flatcatalog.php Project: Airmal/Magento-Em
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     if (!Mage::helper('catalog/category_flat')->isRebuilt()) {
         $element->setDisabled('disabled')->setValue(0);
     }
     return parent::_getElementHtml($element);
 }
Example #2
Show file File: Region.php Project: cewolf2002/magento
0
 /**
  * Output the region element and javasctipt that makes it dependent from country element
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $country = $element->getForm()->getElement('country_id');
     if (!is_null($country)) {
         $countryId = $country->getValue();
     } else {
         return $element->getDefaultHtml();
     }
     $regionId = $element->getForm()->getElement('region_id')->getValue();
     $quoteStoreId = $element->getEntityAttribute()->getStoreId();
     $html = '<tr>';
     $element->setClass('input-text');
     $element->setRequired(true);
     $html .= '<td class="label">' . $element->getLabelHtml() . '</td><td class="value">';
     $html .= $element->getElementHtml();
     $selectName = str_replace('region', 'region_id', $element->getName());
     $selectId = $element->getHtmlId() . '_id';
     $html .= '<select id="' . $selectId . '" name="' . $selectName . '" class="select required-entry" style="display:none">';
     $html .= '<option value="">' . $this->_factory->getHelper('customer')->__('Please select') . '</option>';
     $html .= '</select>';
     $html .= '<script type="text/javascript">' . "\n";
     $html .= '$("' . $selectId . '").setAttribute("defaultValue", "' . $regionId . '");' . "\n";
     $html .= 'new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() . '", "' . $selectId . '", ' . $this->helper('directory')->getRegionJsonByStore($quoteStoreId) . ');' . "\n";
     $html .= '</script>' . "\n";
     $html .= '</td></tr>' . "\n";
     return $html;
 }
Example #3
Show file File: Previewfont.php Project: dragontheme1235/project-1
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = parent::_getElementHtml($element);
     $html .= '<br/><div id="font_' . $element->getHtmlId() . '" class="font_preview" style="font-size: 13px; padding: 10px; 0">The quick brown fox jumps over the lazy dog</div>';
     $html .= '
    			<script type="text/javascript">
    				jQuery(document).ready(function(){
    					var font = jQuery("#' . $element->getHtmlId() . '").val();
    					changeFont' . $element->getHtmlId() . '(font);
 					jQuery("#' . $element->getHtmlId() . '").bind("change", function() {
    						value = jQuery("#' . $element->getHtmlId() . '").val();
    						changeFont' . $element->getHtmlId() . '(value); 
			});
    					function changeFont' . $element->getHtmlId() . '(val){ 
    						var link = jQuery("<link>", {
				    type: "text/css",
				    rel: "stylesheet", 
				    href: "//fonts.googleapis.com/css?family=" + val, 
				}).appendTo("head");
				jQuery("#font_' . $element->getHtmlId() . '").css("font-family", val);
 					}
 				});
    			</script>
    			';
     return $html;
 }
Example #4
Show file File: Collection.php Project: hirentricore/devmagento
0
 /**
  * Add element to collection
  *
  * @todo get it straight with $after
  * @param Varien_Data_Form_Element_Abstract $element
  * @param boolean|'^'|string $after
  * @return Varien_Data_Form_Element_Abstract
  */
 public function add(Varien_Data_Form_Element_Abstract $element, $after = false)
 {
     // Set the Form for the node
     if ($this->_container->getForm() instanceof Varien_Data_Form) {
         $element->setContainer($this->_container);
         $element->setForm($this->_container->getForm());
     }
     if ($after === false) {
         $this->_elements[] = $element;
     } elseif ($after === '^') {
         array_unshift($this->_elements, $element);
     } elseif (is_string($after)) {
         $newOrderElements = array();
         foreach ($this->_elements as $index => $currElement) {
             if ($currElement->getId() == $after) {
                 $newOrderElements[] = $currElement;
                 $newOrderElements[] = $element;
                 $this->_elements = array_merge($newOrderElements, array_slice($this->_elements, $index + 1));
                 return $element;
             }
             $newOrderElements[] = $currElement;
         }
         $this->_elements[] = $element;
     }
     return $element;
 }
Example #5
Show file File: Watermark.php Project: SalesOneGit/s1_magento
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $this->_getHeaderHtml($element);
     $renderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
     $attributes = Mage::getConfig()->getNode(self::XML_PATH_IMAGE_TYPES)->asArray();
     foreach ($attributes as $key => $attribute) {
         /**
          * Watermark size field
          */
         $field = new Varien_Data_Form_Element_Text();
         $field->setName("groups[watermark][fields][{$key}_size][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Size for %s', $attribute['title']))->setRenderer($renderer);
         $html .= $field->toHtml();
         /**
          * Watermark upload field
          */
         $field = new Varien_Data_Form_Element_Imagefile();
         $field->setName("groups[watermark][fields][{$key}_image][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Watermark File for %s', $attribute['title']))->setRenderer($renderer);
         $html .= $field->toHtml();
         /**
          * Watermark position field
          */
         $field = new Varien_Data_Form_Element_Select();
         $field->setName("groups[watermark][fields][{$key}_position][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Position of Watermark for %s', $attribute['title']))->setRenderer($renderer)->setValues(Mage::getSingleton('adminhtml/system_config_source_catalog_product_watermark_position')->toOptionArray());
         $html .= $field->toHtml();
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
Example #6
Show file File: Flatcatalog.php Project: SalesOneGit/s1_magento
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     if (!Mage::helper('catalog/category_flat')->isBuilt()) {
         $element->setDisabled(true)->setValue(0);
     }
     return parent::_getElementHtml($element);
 }
Example #7
Show file File: About.php Project: macosxvn/techheroes
0
 /**
  * Render fieldset html
  *
  * @param Varien_Data_Form_Element_Abstract $element
  *
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $this->_getHeaderHtml($element);
     $html .= $this->_getAboutHtml();
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
Example #8
Show file File: Attribute.php Project: santhosh400/ecart
0
 /**
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     /** @var Easylife_Switcher_Block_Adminhtml_System_Attribute_Renderer $block */
     $block = Mage::app()->getLayout()->createBlock('easylife_switcher/adminhtml_system_attribute_renderer');
     $block->setElement($element);
     return $block->toHtml();
 }
Example #9
Show file File: Result.php Project: fatalerrortan/Magento_Yandexmetrica
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $countID = Mage::helper('yandexmetrica/data')->getCountID();
     $resultURL = "https://metrika.yandex.ru/dashboard?id=" . $countID;
     $html = "<button type='button' id='result'><a style='color:white' href='" . $resultURL . "'>Analyse Result bei Yandex Dashboard</a></button>";
     return $html;
 }
Example #10
Show file File: Support.php Project: macosxvn/techheroes
0
 /**
  * Render fieldset html
  *
  * @param Varien_Data_Form_Element_Abstract $element
  *
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $this->_getHeaderHtml($element);
     $html .= $this->__(Mage::helper('turnkeye_all')->getSupportText());
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
Example #11
Show file File: Info.php Project: unifiedarts/Hackathon_MageMonitoring
0
 /**
  * Renders element
  *
  * @param  Varien_Data_Form_Element_Abstract $element Element to render
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $logoSrc = $this->getSkinUrl('monitoring/images/firegento.jpg');
     $html = '
 id="row_%s">
 <td colspan="2">
     <div class="box">
         <p>
             <a href="' . self::URL . '" target="_blank" title="' . $this->__('Go to Firegento Website') . '">
                 <img src="' . $logoSrc . '" alt="' . $this->__('Firegento') . '" />
             </a>
         </p>
         <p>%s</p>
         <ul>%s</ul>
     </div>
 </td>
r>

     $linksHtml = '';
     /** @var $links Mage_Core_Model_Config_Element */
     $links = $element->getFieldConfig()->links;
     if ($links) {
         foreach ($links->children() as $_link) {
             $_linkLabel = $this->__((string) $_link->label);
             $linksHtml .= sprintf('<li><a href="%s" target="_blank">%s</a>', $_link->url, $_linkLabel) . '</li>';
         }
     }
     return sprintf($html, $element->getHtmlId(), $element->getComment(), $linksHtml);
 }
Example #12
Show file File: Address.php Project: hientruong90/ee_14_installer
0
 /**
  * Add additional data to form element
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return Mage_Adminhtml_Block_Sales_Order_Create_Form_Abstract
  */
 protected function _addAdditionalFormElementData(Varien_Data_Form_Element_Abstract $element)
 {
     if ($element->getId() == 'region_id') {
         $element->setNoDisplay(true);
     }
     return $this;
 }
Example #13
Show file File: Color.php Project: klord9x/project-nam1
0
 /**
  * Add color picker
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return String
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $element->getElementHtml();
     //Default HTML
     $jsPath = $this->getJsUrl('infortis/jquery/jquery-for-admin.min.js');
     $mcPath = $this->getJsUrl('infortis/jquery/plugins/mcolorpicker/');
     if (Mage::registry('jqueryLoaded') == false) {
         $html .= '
<script type="text/javascript" src="' . $jsPath . '"></script>
<script type="text/javascript">jQuery.noConflict();</script>
';
         Mage::register('jqueryLoaded', 1);
     }
     if (Mage::registry('colorPickerLoaded') == false) {
         $html .= '
<script type="text/javascript" src="' . $mcPath . 'mcolorpicker.min.js"></script>
<script type="text/javascript">
	jQuery.fn.mColorPicker.init.replace = false;
	jQuery.fn.mColorPicker.defaults.imageFolder = "' . $mcPath . 'images/";
	jQuery.fn.mColorPicker.init.allowTransparency = true;
	jQuery.fn.mColorPicker.init.showLogo = false;
</script>
         ';
         Mage::register('colorPickerLoaded', 1);
     }
     $html .= '
<script type="text/javascript">
	jQuery(function($){
		$("#' . $element->getHtmlId() . '").attr("data-hex", true).width("250px").mColorPicker();
	});
</script>
     ';
     return $html;
 }
Example #14
Show file File: Country.php Project: chucky515/Magento-CE-Mirror
0
 /**
  * Get country selector html
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $configDataModel = Mage::getSingleton('adminhtml/config_data');
     $urlParams = array('section' => $configDataModel->getSection(), 'website' => $configDataModel->getWebsite(), 'store' => $configDataModel->getStore(), self::REQUEST_PARAM_COUNTRY => '__country__');
     $urlString = $this->helper('core')->jsQuoteEscape(Mage::getModel('adminhtml/url')->getUrl('*/*/*', $urlParams));
     $jsString = '
         $("' . $element->getHtmlId() . '").observe("change", function () {
             location.href = \'' . $urlString . '\'.replace("__country__", this.value);
         });
     ';
     if ($this->_defaultCountry) {
         $urlParams[self::REQUEST_PARAM_DEFAULT] = '__default__';
         $urlString = $this->helper('core')->jsQuoteEscape(Mage::getModel('adminhtml/url')->getUrl('*/*/*', $urlParams));
         $jsParentCountry = $this->helper('core')->jsQuoteEscape($this->_defaultCountry);
         $jsString .= '
             $("' . $element->getHtmlId() . '_inherit").observe("click", function () {
                 if (this.checked) {
                     location.href = \'' . $urlString . '\'.replace("__country__", \'' . $jsParentCountry . '\')
                         .replace("__default__", "1");
                 }
             });
         ';
     }
     return parent::_getElementHtml($element) . $this->helper('adminhtml/js')->getScript('document.observe("dom:loaded", function() {' . $jsString . '});');
 }
Example #15
Show file File: Conditions.php Project: okite11/frames21
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     if ($element->getRule() && $element->getRule()->getConditions()) {
         return $element->getRule()->getConditions()->asHtmlRecursive();
     }
     return '';
 }
Example #16
Show file File: Demo.php Project: ausger/myporto
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $el)
 {
     $data = $el->getOriginalData();
     if (isset($data['process'])) {
         $process = $data['process'];
     } else {
         return '<div>Action was not specified</div>';
     }
     if (isset($data['demo'])) {
         $demo = $data['demo'];
     } else {
         return '<div>Demo param was not specified</div>';
     }
     $buttonSuffix = '';
     if (isset($data['label'])) {
         $buttonSuffix = ' ' . $data['label'];
     }
     $url = $this->getUrl('adminhtml/porto_demo/' . $process) . 'demoversion/' . $demo;
     if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) {
         $url .= "/website/" . $code;
     }
     if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) {
         $url .= "/store/" . $code;
     }
     $html = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setClass('import-cms')->setLabel('Import' . $buttonSuffix)->setOnClick("setLocation('{$url}')")->toHtml();
     return $html;
 }
Example #17
Show file File: Adminpass.php Project: hientruong90/ee_14_installer
0
 /**
  * @return string
  */
 protected function _getScriptHtml(Varien_Data_Form_Element_Abstract $element)
 {
     return <<<SCRIPT
ript type="text/javascript">
![CDATA[
 \$\$('#_accountnew_password,#account-send-pass').each(function(elem) {
     \$(elem).on('change', function() {
         if (\$('_accountnew_password').getValue() || \$('account-send-pass').checked) {
             \$('{$element->getHtmlId()}_container').show();
             \$('{$element->getHtmlId()}').enable();
         } else {
             \$('{$element->getHtmlId()}_container').hide();
             \$('{$element->getHtmlId()}').disable();
         }
     });
     \$(elem).on('focus', function() {
         \$('{$element->getHtmlId()}_container').show();
         \$('{$element->getHtmlId()}').enable();
     });
     \$(elem).on('blur', function() {
         if (!\$('_accountnew_password').getValue() && !\$('account-send-pass').checked) {
             \$('{$element->getHtmlId()}_container').hide();
             \$('{$element->getHtmlId()}').disable();
         }
     });
     document.observe("dom:loaded", function() {
         \$('{$element->getHtmlId()}_container').hide();
         \$('{$element->getHtmlId()}').disable();
     });
 });
]></script>
IPT;
 }
Example #18
Show file File: ApiWizard.php Project: SalesOneGit/s1_magento
0
 /**
  * Get the button and scripts contents
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $originalData = $element->getOriginalData();
     $elementHtmlId = $element->getHtmlId();
     $this->addData(array_merge($this->_getButtonData($elementHtmlId, $originalData), $this->_getSandboxButtonData($elementHtmlId, $originalData)));
     return $this->_toHtml();
 }
Example #19
Show file File: Editable.php Project: giuseppemorelli/magento-extension
0
 /**
  * Render element
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @see Varien_Data_Form_Element_Renderer_Interface::render()
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $element->addClass('element-value-changer');
     $valueName = $element->getValueName();
     if ($element instanceof Varien_Data_Form_Element_Select && $valueName == '...') {
         $optionValues = $element->getValues();
         foreach ($optionValues as $option) {
             if ($option['value'] === '') {
                 $valueName = $option['label'];
             }
         }
     }
     if ($valueName === '') {
         $valueName = '...';
     }
     if ($element->getShowAsText()) {
         $html = ' <input type="hidden" class="hidden" id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $element->getValue() . '"/> ' . htmlspecialchars($valueName) . '&nbsp;';
     } else {
         $html = ' <span class="rule-param"' . ($element->getParamId() ? ' id="' . $element->getParamId() . '"' : '') . '>' . '<a href="javascript:void(0)" class="label">';
         $translate = Mage::getSingleton('core/translate_inline');
         $html .= $translate->isAllowed() ? Mage::helper('core')->escapeHtml($valueName) : Mage::helper('core')->escapeHtml(Mage::helper('core/string')->truncate($valueName, 33, '...'));
         $html .= '</a><span class="element"> ' . $element->getElementHtml();
         if ($element->getExplicitApply()) {
             $html .= ' <a href="javascript:void(0)" class="rule-param-apply"><img src="' . $this->getSkinUrl('M2ePro/images/rule_component_apply.gif') . '" class="v-middle" alt="' . Mage::helper('M2ePro')->__('Apply') . '" title="' . Mage::helper('M2ePro')->__('Apply') . '" /></a> ';
         }
         $html .= '</span></span>&nbsp;';
     }
     return $html;
 }
Example #20
Show file File: List.php Project: macosxvn/techheroes
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $this->_getHeaderHtml($element);
     $modules = Mage::getConfig()->getNode('modules')->children();
     $linkTitle = Mage::helper('codall')->__('Goto Extension Page');
     foreach ($modules as $moduleName => $values) {
         if (0 !== strpos($moduleName, 'Codnitive_')) {
             continue;
         }
         /*if($moduleName == 'Codnitive_Codall'){
         			continue;
         		}*/
         if ($values->title) {
             $moduleName = (string) $values->title;
         }
         if ($values->link) {
             $link = (string) $values->link;
             $moduleName = "<a href='{$link}' target='_blank' title='{$linkTitle}'>{$moduleName}</a>";
         }
         $field = $element->addField($moduleName, 'label', array('label' => $moduleName, 'value' => (string) $values->version));
         $html .= $field->toHtml();
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }