Beispiel #1
0
 /**
  * Pass data from config.xml describe section to _data array
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $block = $this->getLayout()->createBlock('xcom_xfabric/adminhtml_system_config_form_fieldset_element_button');
     if (isset($element->getFieldConfig()->config)) {
         // Pass all nodes from <config> to block configuration
         foreach ($element->getFieldConfig()->config->children() as $key => $value) {
             if ($key == 'redirect') {
                 $key = 'onclick';
                 $value = 'window.location.href=\'' . $this->getUrl('*/' . $value) . '\'';
             }
             $block->setData($key, $value);
         }
     }
     return $block->toHtml();
 }
    /**
     * 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 = '
<tr 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>
</tr>
';
        $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);
    }
Beispiel #3
0
 /**
  * Enter description here...
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $fieldConfig = $element->getFieldConfig();
     $clonePath = (string) $fieldConfig->clone_path;
     $clonePaths = explode('/', $clonePath);
     // Prepare value for cloned element
     $name = 'groups[' . $clonePaths[1] . '][fields][' . $clonePaths[2] . '][value]';
     if (isset($this->_affiliateConfigData[$clonePath])) {
         $data = $this->_affiliateConfigData[$clonePath];
         $inherit = false;
     } else {
         $data = $this->_affiliateConfigRoot->descend($clonePath);
         $inherit = true;
     }
     if ($fieldConfig->backend_model) {
         $model = Mage::getModel((string) $fieldConfig->backend_model);
         if (!$model instanceof Mage_Core_Model_Config_Data) {
             Mage::throwException('Invalid config field backend model: ' . (string) $fieldConfig->backend_model);
         }
         $model->setPath($clonePath)->setValue($data)->afterLoad();
         $data = $model->getValue();
     }
     $element->setName($name)->setValue($data)->setInherit($inherit);
     // Render Element to HTML
     $html = parent::render($element);
     // Prepare Javascript for cloned element
     $cloneId = $element->getHtmlId();
     $origId = implode('_', $clonePaths);
     $html .= "<script type='text/javascript'>\r\nEvent.observe(window, 'load', function() {\r\n    \$('{$cloneId}').observe('change', function(){\r\n        Form.Element.setValue(\$('{$origId}'), Form.Element.getValue(\$('{$cloneId}')));\r\n    });\r\n    \$('{$origId}').observe('change', function(){\r\n        Form.Element.setValue(\$('{$cloneId}'), Form.Element.getValue(\$('{$origId}')));\r\n    });";
     if ($element->getCanUseWebsiteValue() || $element->getCanUseDefaultValue()) {
         $html .= "\r\n    \$('{$cloneId}_inherit').observe('click', function(){\r\n        var el = \$('{$origId}_inherit');\r\n        el.checked = \$('{$cloneId}_inherit').checked;\r\n        toggleValueElements(el, Element.previous(el.parentNode));\r\n    });\r\n    \$('{$origId}_inherit').observe('click', function(){\r\n        var el = \$('{$cloneId}_inherit');\r\n        el.checked = \$('{$origId}_inherit').checked;\r\n        toggleValueElements(el, Element.previous(el.parentNode));\r\n    });";
     }
     $html .= "\r\n});\r\n</script>";
     return $html;
 }
Beispiel #4
0
 /**
  * Copy data level up from _data['field_config'] so it could be later used by button element
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     /**
      * There's no way to unset the renderer from the element. We need to clone the current one and set additional
      * data and default renderer to keep standard look and feel.
      */
     /* @see Varien_Data_Form_Abstract::addField() */
     $elementClassName = 'Varien_Data_Form_Element_' . ucfirst(strtolower($element->getType()));
     /* @var $newElement Varien_Data_Form_Element_Abstract */
     $newElement = new $elementClassName($element->getData());
     $newElement->setId($element->getHtmlId());
     $newElement->setForm($this->getForm());
     /* @see Mage_Adminhtml_Block_System_Config_Form::_initObjects() */
     $newElement->setRenderer(Mage::getBlockSingleton('adminhtml/system_config_form_field'));
     if (isset($element->getFieldConfig()->config)) {
         // Push data into internal array from <config> section, so we can reach it later in element building model.
         $newElement->addData((array) $element->getFieldConfig()->config);
     }
     return $newElement->toHtml();
 }
Beispiel #5
0
 /**
  * render separator config row
  * 
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $fieldConfig = $element->getFieldConfig();
     $htmlId = $element->getHtmlId();
     $html = '<tr id="row_' . $htmlId . '">' . '<td class="label" colspan="3">';
     $marginTop = $fieldConfig->margin_top ? (string) $fieldConfig->margin_top : '0px';
     $customStyle = $fieldConfig->style ? (string) $fieldConfig->style : '';
     $html .= '<div style="margin-top: ' . $marginTop . '; font-weight: bold; border-bottom: 1px solid #dfdfdf;' . $customStyle . '">';
     $html .= $element->getLabel();
     $html .= '</div></td></tr>';
     return $html;
 }
Beispiel #6
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $date = new Varien_Data_Form_Element_Date();
     $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $data = array('name' => $element->getName(), 'html_id' => $element->getId(), 'image' => $this->getSkinUrl('images/grid-cal.gif'));
     $date->setData($data);
     $date->setValue($element->getValue(), $format);
     $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
     $date->setClass($element->getFieldConfig()->validate->asArray());
     $date->setForm($element->getForm());
     return $date->getElementHtml();
 }
Beispiel #7
0
 /**
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     if (false === isset($element) || true === empty($element)) {
         \Mage::helper('bitpay')->debugData('[ERROR] In Bitpay_Core_Block_Adminhtml_System_Config_Form_Field_Extension::_getElementHtml(): Missing or invalid $element parameter passed to function.');
         throw new \Exception('In Bitpay_Core_Block_Adminhtml_System_Config_Form_Field_Extension::_getElementHtml(): Missing or invalid $element parameter passed to function.');
     }
     $phpExtension = $element->getFieldConfig()->php_extension;
     if (true === in_array($phpExtension, get_loaded_extensions())) {
         return 'Installed';
     }
     return 'Not Installed';
 }
 /**
  * renderer notification config callback api
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $fieldConfig = $element->getFieldConfig();
     $htmlId = $element->getHtmlId();
     $html = '<tr id="row_' . $htmlId . '">' . '<td class="label" colspan="3">';
     $marginTop = $fieldConfig->margin_top ? (string) $fieldConfig->margin_top : '0px';
     $customStyle = $fieldConfig->style ? (string) $fieldConfig->style : '';
     $html .= '<ul style="margin-top: ' . $marginTop . '" class="messages' . $customStyle . '">';
     $html .= '<li class="notice-msg">' . str_replace('{{your_domain}}', Mage::getBaseUrl(true), $element->getLabel()) . '</li>';
     $html .= '</ul></td></tr>';
     return $html;
 }
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $date = new Varien_Data_Form_Element_Date();
     $format = 'M/dd/yy';
     $data = array('name' => $element->getName(), 'html_id' => $element->getId(), 'image' => $this->getSkinUrl('images/grid-cal.gif'));
     $date->setData($data);
     $date->setValue($element->getValue(), $format);
     $date->setFormat($format);
     $date->setClass($element->getFieldConfig()->validate->asArray());
     $date->setForm($element->getForm());
     return $date->getElementHtml();
 }
Beispiel #10
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $scope = $element->getScope();
     $scope_id = $element->getScopeId();
     $inherit = $element->getInherit();
     $factoryName = (string) $element->getFieldConfig()->source_model;
     $sourceModel = Mage::getSingleton($factoryName);
     $optionArray = $sourceModel->toOptionArray(True, $scope, $scope_id);
     $element->setValues($optionArray);
     $html = $this->getElementHtml($element);
     return $html;
     //        return parent::_getElementHtml($element);
 }
Beispiel #11
0
 /**
  * Return backend config for element like JSON
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element)
 {
     $config = $element->getFieldConfig()->backend_congif;
     if (!$config) {
         return false;
     }
     $config = $config->asCanonicalArray();
     if (isset($config['enable_for_countries'])) {
         $config['enable_for_countries'] = explode(',', str_replace(' ', '', $config['enable_for_countries']));
     }
     if (isset($config['disable_for_countries'])) {
         $config['disable_for_countries'] = explode(',', str_replace(' ', '', $config['disable_for_countries']));
     }
     return Mage::helper('core')->jsonEncode($config);
 }
Beispiel #12
0
 /**
  * Return backend config for element like JSON
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element)
 {
     $config = $element->getFieldConfig();
     if (!array_key_exists('backend_congif', $config)) {
         return false;
     }
     $config = $config['backend_congif'];
     if (isset($config['enable_for_countries'])) {
         $config['enable_for_countries'] = explode(',', str_replace(' ', '', $config['enable_for_countries']));
     }
     if (isset($config['disable_for_countries'])) {
         $config['disable_for_countries'] = explode(',', str_replace(' ', '', $config['disable_for_countries']));
     }
     return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($config);
 }
 /**
  * Enter description here...
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $hint = (array) $element->getFieldConfig()->hint;
     if (!count($hint)) {
         return parent::render($element);
     }
     // Generate Tooltip
     /** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
     $tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
     $tooltip->initFormElement($element);
     $tooltipHtml = $tooltip->toHtml();
     $element->setHint('__tooltip_html__');
     $html = parent::render($element);
     $hintToReplace = '<div class="hint" ><div style="display: none;">__tooltip_html__</div></div>';
     $html = str_replace($hintToReplace, $tooltipHtml, $html);
     return $html;
 }
Beispiel #14
0
 /**
  * Render element html
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $hint = (array) $element->getFieldConfig()->hint;
     if (!count($hint)) {
         return $this->getHtmlTable($element);
     }
     // Generate Tooltip
     /** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
     $tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
     $tooltip->initFormElement($element);
     $tooltip->setHintText($this->getHintText());
     $tooltipHtml = $tooltip->toHtml();
     $html = sprintf('<tr id="row_%s">', $element->getHtmlId());
     $html .= '<td class=""  colspan="3">';
     $html .= '<table class="payone-config-info"><tr><td>' . $tooltipHtml . ' </td></tr></table>';
     $html .= '</td>';
     $html .= '</tr>';
     return $html;
 }
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $elementId = $element->getHtmlId();
     preg_match("/[^_\\W]+\$/", $elementId, $fileName);
     //Grab last word
     $moduleName = Mage::helper('dpd/data')->module;
     //getModule name
     $newElement = str_replace($moduleName, "", $elementId);
     //remove module name from string
     $newElement = str_replace($fileName[0], "", $newElement);
     //remove file name from string
     $elementName = trim($newElement, "_");
     $url = Mage::helper("adminhtml")->getUrl("dpd/adminhtml_buttons/export", array('element' => $elementName, 'fileName' => $fileName[0], 'scope' => $this->getForm()->getScope(), 'scope_id' => $this->getForm()->getScopeId()));
     $label = $element->getFieldConfig()->button_label->__toString();
     if (empty($label)) {
         $label = trim($element->getLabel());
     }
     $html = $this->getLayout()->createBlock('adminhtml/widget_button')->setId($elementId)->setType($element->gettype())->setLabel(__($label))->setOnClick("setLocation('{$url}')")->toHtml();
     return $html;
 }
Beispiel #16
0
 /**
  * Renders block and returns its output
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     // Specified in <block> node in the field description
     $blockType = isset($element->getFieldConfig()->block) ? (string) $element->getFieldConfig()->block : '';
     if (!$blockType) {
         return '';
     }
     /* @var $block Mage_Adminhtml_Block_Template */
     $block = Mage::app()->getLayout()->createBlock($blockType);
     if (isset($element->getFieldConfig()->config)) {
         // Pass data to created block from <config> node
         foreach ($element->getFieldConfig()->config->children() as $key => $value) {
             $block->setData($key, (string) $value);
         }
     }
     if (isset($element->getFieldConfig()->template)) {
         $block->setTemplate((string) $element->getFieldConfig()->template);
     }
     return $block->toHtml();
 }
Beispiel #17
0
 /**
  * Returns HTML code of fieldset row
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     return isset($element->getFieldConfig()->html) ? $element->getFieldConfig()->html : '';
 }