Example #1
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->setStyle('display:block')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = array();
     }
     $payments = Mage::getSingleton('payment/config')->getActiveMethods();
     $allowedDefault = array();
     $elementsJs = array();
     foreach ($payments as $paymentCode => $paymentModel) {
         $paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title');
         $methodsAllowed[$paymentCode] = array('label' => $paymentTitle, 'value' => $paymentCode . "_allow");
         array_push($allowedDefault, $paymentCode . "_allow");
         $elementsJs[] = $element->getId() . '_' . $paymentCode . "";
     }
     foreach ($payments as $paymentCode => $paymentModel) {
         $paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title');
         $methodsDenied[$paymentCode] = array('label' => $paymentTitle, 'value' => $paymentCode . "_deny");
     }
     if (empty($values)) {
         $values = $allowedDefault;
     }
     $from = $element->setValues($methodsAllowed)->setValue($values)->getElementHtml();
     $to = $element->setValues($methodsDenied)->setValue($values)->getElementHtml();
     $script = "";
     foreach ($elementsJs as $elementj) {
         $script .= "\n            document.getElementById('" . $elementj . "_allow').addEventListener('click', function() {\n                if (document.getElementById('" . $elementj . "_deny').checked == true) {\n                    document.getElementById('" . $elementj . "_deny').checked = false;\n                } else {\n                    document.getElementById('" . $elementj . "_deny').checked = true;\n                }\n            }, false);\n            document.getElementById('" . $elementj . "_deny').addEventListener('click', function() {\n                if (document.getElementById('" . $elementj . "_allow').checked == true) {\n                    document.getElementById('" . $elementj . "_allow').checked = false;\n                } else {\n                    document.getElementById('" . $elementj . "_allow').checked = true;\n\n                }\n            }, false);\n            if (document.getElementById('" . $elementj . "_deny').checked == false && document.getElementById('" . $elementj . "_allow').checked == false) {\n                document.getElementById('" . $elementj . "_allow').checked = true;\n            }\n            ";
     }
     return '<div style="white-space: nowrap;"><div style="display:inline-block;padding: 0 5px 0 0; width:50%">' . $from . '</div> <div style="display:inline-block;padding: 0 5px 0 0; width:50%">' . $to . '</div></div><script>' . $script . '</script>';
 }
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $_years = array(null => "Year");
     for ($i = 0, $y = (int) date("Y"); $i < 5; $i++, $y++) {
         $_years[$y] = $y;
     }
     $_months = array(null => "Month");
     for ($i = 1; $i <= 12; $i++) {
         $_months[$i] = Mage::app()->getLocale()->date(mktime(null, null, null, $i))->get(Zend_date::MONTH_NAME);
     }
     $_days = array(null => "Day");
     for ($i = 1; $i <= 31; $i++) {
         $_days[$i] = $i < 10 ? '0' . $i : $i;
     }
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = array();
     }
     $element->setName($element->getName() . '[]');
     $_yearsHtml = $element->setStyle('width:75px;')->setValues($_years)->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $_monthsHtml = $element->setStyle('width:100px;')->setValues($_months)->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     $_daysHtml = $element->setStyle('width:50px;')->setValues($_days)->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
     return sprintf('%s %s %s', $_yearsHtml, $_monthsHtml, $_daysHtml);
 }
Example #3
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $extra = '';
     if ($element->getValue()) {
         $extra = '<img style="max-height:100px;" src="' . $element->getValue() . '" /><br />';
     }
     return $extra . parent::_getElementHtml($element);
 }
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->setStyle('width:80px;')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $value = $element->getValue();
     } else {
         $value = 0;
     }
     $from = $element->setValue(isset($value) ? $value : null)->getElementHtml();
     return $from . '   ' . Mage::helper('adminhtml')->__('X pt');
 }
Example #5
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->setStyle('width:70px;')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = array();
     }
     $from = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $to = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     return Mage::helper('adminhtml')->__('from') . ' ' . $from . ' ' . Mage::helper('adminhtml')->__('to') . ' ' . $to;
 }
Example #6
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->setStyle('width:70px;')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = array();
     }
     $width = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $height = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     return Mage::helper('sales')->__('Width') . ' ' . $width . ' ' . Mage::helper('sales')->__('Height') . ' ' . $height;
 }
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->setStyle('height:6em;')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $value = $element->getValue();
     } else {
         $value = '';
     }
     $from = $element->setValue(isset($value) ? $value : null)->getElementHtml();
     return $from;
     //.'   '.Mage::helper('adminhtml')->__('items');
 }
 /**
  * Render Media Chooser HTML (buttons and image preview) and set it after the form element HTML
  *
  * @param Varien_Data_Form_Element_Abstract $element
  *
  * @return Varien_Data_Form_Element_Abstract
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) {
         $layout = Mage::app()->getLayout();
         $id = $element->getHtmlId();
         if ($url = $element->getValue()) {
             $linkStyle = "display:inline;";
             if (!preg_match("/^http\\:\\/\\/|https\\:\\/\\//", $url)) {
                 $url = Mage::getBaseUrl('media') . $url;
             }
         } else {
             $linkStyle = "display:none;";
             $url = "#";
         }
         $imagePreview = '<a id="' . $id . '_link" href="' . $url . '" style="text-decoration: none; ' . $linkStyle . '"' . ' onclick="imagePreview(\'' . $id . '_image\'); return false;">' . ' <img src="' . $url . '" id="' . $id . '_image" title="' . $element->getValue() . '"' . ' alt="' . $element->getValue() . '" height="30" class="small-image-preview v-middle"/>' . ' </a>';
         $selectButtonId = 'add-image-' . mt_rand();
         $chooserUrl = Mage::getUrl('adminhtml/cms_wysiwyg_images_chooser/index', array('target_element_id' => $id));
         $label = $element->getValue() ? $this->__('Change Image') : $this->__('Select Image');
         // Select/Change Image Button
         $chooseButton = $layout->createBlock('adminhtml/widget_button')->setType('button')->setClass('add-image')->setId($selectButtonId)->setLabel($label)->setOnclick('MediabrowserUtility.openDialog(\'' . $chooserUrl . '\')')->setDisabled($element->getReadonly())->setStyle('display:inline;margin-top:7px');
         // Remove Image Button
         $onclickJs = '
             document.getElementById(\'' . $id . '\').value=\'\';
             if(document.getElementById(\'' . $id . '_image\')){
                 document.getElementById(\'' . $id . '_image\').parentNode.style.display = \'none\';
             }
             document.getElementById(\'' . $selectButtonId . '\').innerHTML=\'<span><span><span>' . addslashes($this->__('Select Image')) . '</span></span></span>\';
         ';
         $removeButton = $layout->createBlock('adminhtml/widget_button')->setType('button')->setClass('delete')->setLabel($this->__('Remove Image'))->setOnclick($onclickJs)->setDisabled($element->getReadonly())->setStyle('margin-top:7px');
         $wrapperStart = '<div id="buttons_' . $id . '" class="buttons-set" style=" width: 325px;">';
         $wrapperEnd = '</div>';
         $wrapperEnd .= '
             <script type="text/javascript">
                 //<![CDATA[
                     varienGlobalEvents.clearEventHandlers(\'mediachooserChange' . $id . '\');
                     varienGlobalEvents.attachEventHandler(\'mediachooserChange' . $id . '\', function(url){
                         document.getElementById(\'' . $id . '_image\').src = \'' . Mage::getBaseUrl('media') . '\' + url;
                         document.getElementById(\'' . $id . '_image\').title = url;
                         document.getElementById(\'' . $id . '_image\').alt = url;
                         document.getElementById(\'' . $id . '_link\').href = \'' . Mage::getBaseUrl('media') . '\' + url;
                         document.getElementById(\'' . $id . '_link\').style.display = \'inline\';
                         document.getElementById(\'' . $selectButtonId . '\').innerHTML=\'<span><span><span>' . addslashes($this->__('Change Image')) . '</span></span></span>\';
                     });
                 //]]>
             </script>
         ';
         // Add our custom HTML after the form element
         $element->setAfterElementHtml($wrapperStart . $imagePreview . $chooseButton->toHtml() . $removeButton->toHtml() . $wrapperEnd);
     }
     return $element;
 }
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->setStyle('width:40px;')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = array();
     }
     $top = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $right = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     $bottom = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
     $left = $element->setValue(isset($values[3]) ? $values[3] : null)->getElementHtml();
     return $top . '  ' . Mage::helper('adminhtml')->__('Top, pt') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $right . '  ' . Mage::helper('adminhtml')->__('Right, pt') . '<br />' . $bottom . '  ' . Mage::helper('adminhtml')->__('Bottom, pt') . '    ' . $left . '  ' . Mage::helper('adminhtml')->__('Left, pt');
 }
Example #10
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $_options = array('d' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Day'), 'm' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Month'), 'y' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Year'));
     $element->setValues($_options)->setStyle('width:70px;')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = array();
     }
     $_parts = array();
     $_parts[] = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $_parts[] = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     $_parts[] = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
     return implode(' / ', $_parts);
 }
Example #11
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $_options = array('d' => Mage::helper('adminhtml')->__('Day'), 'm' => Mage::helper('adminhtml')->__('Month'), 'y' => Mage::helper('adminhtml')->__('Year'));
     $element->setValues($_options)->setClass('select-date')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = array();
     }
     $_parts = array();
     $_parts[] = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $_parts[] = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     $_parts[] = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
     return implode(' <span>/</span> ', $_parts);
 }
Example #12
0
 public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $config = $this->getConfig();
     $chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setClass('scalable btn-chooser')->setLabel($config['button']['open'])->setOnclick('MediabrowserUtility.openDialog(\'' . $this->getUrl('*/cms_wysiwyg_images/index', array('target_element_id' => $element->getName())) . '\')')->setDisabled($element->getReadonly());
     $text = new Varien_Data_Form_Element_Text();
     $text->setForm($element->getForm())->setId($element->getName())->setName($element->getName())->setClass('widget-option input-text');
     if ($element->getRequired()) {
         $text->addClass('required-entry');
     }
     if ($element->getValue()) {
         $text->setValue($element->getValue());
     }
     $element->setData('after_element_html', $text->getElementHtml() . $chooseButton->toHtml());
     return $element;
 }
 /**
  * @param Varien_Data_Form_Element_Abstract $element
  *
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->addClass('select');
     $hours = 0;
     $minutes = 0;
     if ($value = $element->getValue()) {
         $values = explode(',', $value);
         if (is_array($values) && count($values) == 2) {
             $hours = $values[0];
             $minutes = $values[1];
         }
     }
     $optionTemplate = '<option value="%s" %s>%s</option>';
     $html = sprintf('<input type="hidden" id="%s" />', $element->getHtmlId());
     $html .= sprintf('<select name="%s" %s style="width:60px">', $element->getName(), $element->serialize($element->getHtmlAttributes()));
     for ($i = 0; $i < 24; $i++) {
         $hour = str_pad($i, 2, '0', STR_PAD_LEFT);
         $html .= sprintf($optionTemplate, $hour, (int) $hours === $i ? 'selected="selected"' : '', $hour);
     }
     $html .= '</select>&nbsp;:&nbsp;';
     $html .= sprintf('<select name="%s" %s style="width:60px">', $element->getName(), $element->serialize($element->getHtmlAttributes()));
     for ($i = 0; $i < 60; $i++) {
         $minute = str_pad($i, 2, '0', STR_PAD_LEFT);
         $html .= sprintf($optionTemplate, $minute, (int) $minutes === $i ? 'selected="selected"' : '', $minute);
     }
     $html .= '</select>';
     $html .= $element->getAfterElementHtml();
     return $html;
 }
 /**
  * Enter description here...
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $partsId = explode("_", $element->getId());
     $method_code = $partsId[1] . "_" . $partsId[2];
     $rule = Mage::getModel('hipay/rule');
     $rule->setMethodCode($method_code);
     if ($element->getValue()) {
         $rule->load($element->getValue());
     }
     if ($rule->getConfigPath() == "") {
         $rule->setConfigPath($element->getId());
     }
     $element->setRule($rule);
     $this->setElement($element);
     return $this->_toHtml();
 }
 /**
  * Inform the user there version will not work
  * @return string
  */
 private function getCurrencyTableHtml(Varien_Data_Form_Element_Abstract $element)
 {
     // Store ID = scope ID
     $storeId = Mage::getSingleton('adminhtml/config_data')->getScopeId();
     // Retrieve the currencies
     $currencies = Mage::app()->getStore($storeId)->getAvailableCurrencyCodes();
     // Retrieve the values
     $values = $element->getValue();
     // Build our response
     $response = '<input type="hidden" id="payment_gene_braintree_multi_currency_mapping" />
     <table width="100%" cellspacing="6" cellpadding="4">
         <tr>
             <th width="35%">' . $this->__('Currency Code') . '</th>
             <th width="65%">' . $this->__('Merchant Account ID') . '</th>
         </tr>';
     // Loop through each currency and add a value
     foreach ($currencies as $currency) {
         $response .= '<tr>
             <td> ' . $currency . '</td>
             <td><input class="input-text" type="text" name=" ' . $element->getName() . '[' . $currency . ']" style="width: 100%;" value="' . (isset($values->{$currency}) ? $values->{$currency} : '') . '" /></td>
         </tr>';
     }
     $response .= '</table>';
     return $response;
 }
Example #16
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $element->addClass('element-value-changer');
     $valueName = $element->getValueName();
     if ($valueName === '') {
         $valueName = '...';
     }
     $valueLabel = htmlspecialchars(Mage::helper('core/string')->truncate($valueName, 150, '...'));
     switch ($this->getFormat()) {
         case 'text':
             $html = $valueLabel;
             break;
         case 'html':
             $html = '<strong>' . $valueLabel . '</strong>';
             break;
         default:
             if ($element->getIsMeta()) {
                 $html = '<input type="hidden" class="hidden" id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $element->getValue() . '"/>';
                 $html .= htmlspecialchars($valueName);
             } else {
                 $html = '<span class="rule-param"' . ($element->getParamId() ? ' id="' . $element->getParamId() . '"' : '') . '>';
                 $html .= '<a href="javascript:void(0)" class="label">' . $valueLabel . '</a>';
                 $html .= '<span class="element">';
                 $html .= $element->getElementHtml();
                 if ($element->getExplicitApply()) {
                     $html .= '<a href="javascript:void(0)" class="rule-param-apply"><img src="' . $this->getSkinUrl('images/rule_component_apply.gif') . '" class="v-middle" alt="' . $this->__('Apply') . '" title="' . $this->__('Apply') . '" /></a>';
                 }
                 $html .= '</span></span>';
             }
     }
     return $html;
 }
Example #17
0
 /**
  * Override method to output our custom HTML with JavaScript
  *
  * @param Varien_Data_Form_Element_Abstract $element
  *
  * @return String
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     if (!extension_loaded('soap') || !extension_loaded('openssl')) {
         $element->setDisabled('disabled')->setValue(0);
     } else {
         // Get Config Link
         $configLink = Mage::helper('bronto_common')->getScopeUrl('/system_config/edit/section/bronto');
         if (!Mage::helper('bronto_verify/apitoken')->getStatus()) {
             if (trim($element->getLabel()) === 'Enable Module') {
                 $element->setDisabled('disabled')->setValue(0);
                 $link = '<a href="' . $configLink . '">Fix it Here</a>';
                 $element->setComment('<span style="color:red;font-weight: bold">A valid Bronto API key is required. ' . $link . '</span>');
             }
         } else {
             if (!Mage::helper('bronto_common')->isEnabled()) {
                 if (trim($element->getLabel()) === 'Enable Module') {
                     $element->setDisabled('disabled')->setValue(0);
                     $link = '<a href="' . $configLink . '">Enable It Here</a>';
                     $element->setComment('<span style="color:red;font-weight: bold">The Bronto Extension for Magento is not enabled. ' . $link . '</span>');
                 }
             } else {
                 if (!Mage::helper('bronto_common/support')->isRegistered()) {
                     if (trim($element->getLabel()) !== 'Enable Module' || !$element->getValue()) {
                         $link = '<a href="' . $configLink . '#bronto_support-head">Register Here</a>';
                         $element->setDisabled('disabled');
                         $element->setComment('<span style="color:red;font-weight:bold">Extension registration is required. ' . $link . '</span>');
                     }
                 }
             }
         }
     }
     return parent::_getElementHtml($element);
 }
Example #18
0
 public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $targetId = $this->getFieldsetId() . '_' . $this->getConfig('target');
     $block = $this->getLayout()->createBlock('mtwidget/adminhtml_widget_renderer_depend', '', array('target' => $targetId, 'url' => $this->getUrl('mtwidget/adminhtml_widget_attribute/option'), 'me' => $element->getHtmlId(), 'value' => implode(',', (array) $element->getValue())));
     $element->setData('after_element_html', $block->toHtml());
     return $element;
 }
Example #19
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = '';
     $data = Mage::getStoreConfig('auspost/activation/data');
     $ele_value = explode(',', str_replace($data, '', Mage::helper('core')->decrypt($element->getValue())));
     $ele_name = $element->getName();
     $ele_id = $element->getId();
     $element->setName($ele_name . '[]');
     $data_info = Mage::helper('auspost')->getDataInfo();
     if (isset($data_info['dom']) && intval($data_info['c']) > 0 && intval($data_info['suc']) == 1) {
         foreach (Mage::app()->getWebsites() as $website) {
             $url = $website->getConfig('web/unsecure/base_url');
             $url = Mage::helper('auspost')->getFormatUrl(trim(preg_replace('/^.*?\\/\\/(.*)?\\//', '$1', $url)));
             foreach ($data_info['dom'] as $web) {
                 if ($web['dom'] == $url && $web['suc'] == 1) {
                     $element->setChecked(false);
                     $id = $website->getId();
                     $name = $website->getName();
                     $element->setId($ele_id . '_' . $id);
                     $element->setValue($id);
                     if (in_array($id, $ele_value) !== false) {
                         $element->setChecked(true);
                     }
                     if ($id != 0) {
                         $html .= '<div><label>' . $element->getElementHtml() . ' ' . $name . ' </label></div>';
                     }
                 }
             }
         }
     } else {
         $html = sprintf('<strong class="required">%s</strong>', $this->__('Please enter a valid key'));
     }
     return $html;
 }
Example #20
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $element->addClass('element-value-changer');
     $valueName = $element->getLabel();
     if ($valueName === '' || $valueName === null) {
         $valueName = '...';
     }
     if ($element->getShowAsText()) {
         $html = ' <input type="hidden" class="hidden" id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $element->getValue() . '"/> ' . htmlspecialchars($valueName) . '&nbsp;';
     } else {
         $html = '&nbsp;<span class="rule-param">';
         /** @var Mage_Core_Model_Translate_Inline $translate */
         $translate = Mage::getSingleton('core/translate_inline');
         if ($translate->isAllowed()) {
             $valueName = Mage::helper('core/string')->truncate($valueName, 33, '...');
         }
         $html .= '<a href="javascript:void(0)" class="label">';
         $html .= Mage::helper('core')->escapeHtml($valueName);
         $html .= '</a>';
         $html .= '<span class="element"> ';
         $html .= $element->getElementHtml();
         if ($element->getExplicitApply()) {
             /** @var Aoe_FraudManager_Helper_Data $helper */
             $helper = Mage::helper('Aoe_FraudManager/Data');
             $url = $helper->getConditionApplyImageUrl();
             $label = $helper->getConditionApplyLabel();
             $html .= ' <a href="javascript:void(0)" class="rule-param-apply">';
             $html .= '<img src="' . $url . '" class="v-middle" alt="' . $label . '" title="' . $label . '" />';
             $html .= '</a> ';
         }
         $html .= '</span>';
         $html .= '</span>&nbsp;';
     }
     return $html;
 }
Example #21
0
    /**
     * Enter description here...
     *
     * @param Varien_Data_Form_Element_Abstract $element
     * @return string
     */
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
    {
        $htmlname = $element->getName();
        $htmlvalue = $element->getValue();
        $htmlid = $element->getHtmlId();
        $macros = array('[[report_total_value]]' => 'Total sales value', '[[report_total_count]]' => 'Total count of orders', '[[report_dayonday_value]]' => 'Day on day comparison percentage based on value', '[[report_dayonday_count]]' => 'Day on day comparison percentage based on count');
        $html = 'Automatic values: <select name="' . $htmlname . 'macros" id="' . $htmlid . 'macros" onchange="inserterfor' . $htmlid . '();">';
        $html .= '<option value="-- Please select --" disabled="disabled">-- Select automatic values to insert --</option>';
        foreach ($macros as $value => $label) {
            $html .= '<option value="' . $value . '">' . $label . '</option>';
        }
        $html .= '</select><br /><small>Automatic text is inserted as message generates.</small>';
        $html .= '<textarea id="' . $htmlid . '" name="' . $htmlname . '">';
        $html .= $htmlvalue;
        $html .= '</textarea>';
        $html .= '<script type="text/javascript">
					function inserterfor' . $htmlid . '(){
						// so, htmlid macros has just been changed.
						var macroholder' . $htmlid . ' = document.getElementById("' . $htmlid . 'macros");
						var target' . $htmlid . ' = document.getElementById("' . $htmlid . '");
						
						target' . $htmlid . '.value = target' . $htmlid . '.value + macroholder' . $htmlid . '.options[macroholder' . $htmlid . '.selectedIndex].value;
						macroholder' . $htmlid . '.selectedIndex = 0;
						target' . $htmlid . '.focus();
					}
				  </script>';
        return $html;
    }
Example #22
0
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
        $value = $element->getValue();
        $element->setStyle('width:70px;')
                ->setType('hidden');
        $inputHidden = $element->setValue(isset($value) ? $value : 'pattern10')->getElementHtml();

		$skinDir = str_replace('adminhtml'.DS,'',Mage::getSingleton('core/design_package')->getSkinBaseDir(array('_package' => 'frontend\default')));
		$index = strrpos($skinDir, DS);
		$theme = substr($skinDir,$index + 1);
		
 
		$baseURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/default/' . $theme . '/images/patterns/';
		
        $html = '<div class="bgpattern">';
        $html .= $inputHidden;

        $helper = Mage::helper('ves_tempcp/data');
        $data = $helper->getThemeInfo(1);
		
//		echo "<br/>";
//		var_dump($data); die;
		
        $patterns = $data['patterns'];
        
        foreach ($patterns as $p) {
            $html .='<div style="background:url(\'' . $baseURL . $p . '\');" onclick="return false;" href="#" title="' . $p . '" id="' . preg_replace("#\.\w+$#", "", $p) . '"></div>';
        }

        $html .= '</div>';
        return $html;
    }
Example #23
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $days = new Varien_Data_Form_Element_Text();
     $data = array('name' => $element->getName(), 'html_id' => $element->getId());
     $days->setData($data);
     if (is_numeric($element->getValue())) {
         $days->setValue($element->getValue());
     } else {
         $days->setValue(30);
     }
     $days->setForm($element->getForm());
     $html = $days->getElementHtml();
     $javaScript = "\n            <script type=\"text/javascript\">\n                Event.observe(window, 'load', function() {\n                    days=\$('{$element->getHtmlId()}').value;\n                    if (isNaN(days)) {\n                        \$('{$element->getHtmlId()}').value = '';\n                    }\n                });\n                Event.observe('{$element->getHtmlId()}', 'change', function(){\n                    days=\$('{$element->getHtmlId()}').value;\n                    if (isNaN(days)) {\n                        \$('{$element->getHtmlId()}').value = '';\n                    }\n                });\n            </script>";
     $html .= $javaScript;
     return $html;
 }
Example #24
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 #25
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $real_val = $element->getValue();
     $many_val = $element->getValues();
     $output = '';
     if ($many_val) {
         foreach ($many_val as $curr_val) {
             $output .= '<div  style="padding: 0 15px 15px 0; float: left; width: 130px;">';
             $output .= '<input type="radio"' . $element->serialize(array('style', 'class', 'name'));
             if ($curr_val instanceof Varien_Object) {
                 $output .= 'id="' . $element->getHtmlId() . $curr_val->getValue() . '" ' . $curr_val->serialize(array('title', 'label', 'style', 'class', 'value'));
                 if (in_array($curr_val->getValue(), $real_val)) {
                     $output .= ' checked="checked"';
                 }
                 $output .= ' /><span>' . $curr_val->getLabel() . '</span>';
             } elseif (is_array($curr_val)) {
                 $output .= 'id="' . $element->getHtmlId() . $curr_val['value'] . '" value="' . htmlspecialchars($curr_val['value'], ENT_COMPAT) . '"';
                 if ($curr_val['value'] == $real_val) {
                     $output .= ' checked="checked"';
                 }
                 $output .= ' /><span>' . $curr_val['label'] . '</span>';
             }
             if ($curr_val['value']) {
                 $output .= '<div style="height:30px;background:url(' . Mage::getDesign()->getSkinUrl('magentothem/images/' . $curr_val['value'] . '.png') . ')">&nbsp;</div>';
             }
             $output .= '</div>' . "\n";
         }
     }
     return $output . '<div class="clear"></div>';
 }
Example #26
0
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
    {
        $res = '';
        $divId = $element->getId();
        $res .= <<<EOD
\t\t<input name="{$element->getName()}" id="{$divId}_date" value="{$element->getValue()}" type="text" style="width:130px !important;" /> <img src="{$this->getSkinUrl('images/grid-cal.gif')}" alt="" id="{$divId}_date_trig" title="{$this->__('Select Date')}" style="" />
\t\t<script type="text/javascript">
\t\t//<![CDATA[
\t\t\t//this example uses dd.MM.yyyy hh:mm format.
\t\t\tCalendar.setup({
\t\t\t\tinputField: "{$divId}_date",
\t\t\t\tifFormat: "%Y-%m-%d %H:%M:%S",
\t\t\t\tshowsTime: true,
\t\t\t\tfirstDay: 1,
\t\t\t\ttimeFormat: "24",
\t\t\t\tbutton: "{$divId}_date_trig",
\t\t\t\talign: "Bl",
\t\t\t\tsingleClick : true
\t\t\t});
\t\t\t
\t\t//]]>
\t\t</script>
EOD;
        return $res;
    }
    /**
     * Enter description here...
     *
     * @param Varien_Data_Form_Element_Abstract $element
     * @return string
     */
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
    {
        $htmlname = $element->getName();
        $htmlvalue = $element->getValue();
        $htmlid = $element->getHtmlId();
        $macros = array('[[customer_fname]]' => 'Customer Firstname', '[[customer_sname]]' => 'Customer Surname', '[[customer_password]]' => 'Customer Password', '[[email]]' => 'Email');
        $html = 'Automatic values: <select name="' . $htmlname . 'macros" id="' . $htmlid . 'macros" onchange="inserterfor' . $htmlid . '();">';
        $html .= '<option value="-- Please select --" disabled="disabled">-- Select automatic values to insert --</option>';
        foreach ($macros as $value => $label) {
            $html .= '<option value="' . $value . '">' . $label . '</option>';
        }
        $html .= '</select><br /><small>Automatic text is inserted as message generates.</small>';
        $html .= '<textarea id="' . $htmlid . '" name="' . $htmlname . '">';
        $html .= $htmlvalue;
        $html .= '</textarea>';
        $html .= '<script type="text/javascript">
					function inserterfor' . $htmlid . '(){
						// so, htmlid macros has just been changed.
						var macroholder' . $htmlid . ' = document.getElementById("' . $htmlid . 'macros");
						var target' . $htmlid . ' = document.getElementById("' . $htmlid . '");
						
						target' . $htmlid . '.value = target' . $htmlid . '.value + macroholder' . $htmlid . '.options[macroholder' . $htmlid . '.selectedIndex].value;
						macroholder' . $htmlid . '.selectedIndex = 0;
						target' . $htmlid . '.focus();
					}
				  </script>';
        return $html;
    }
Example #28
0
 public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $tree = Mage::getResourceModel('cms/page_tree')->load();
     $element->setData('after_element_html', $tree->toSelectHtml($element->getName(), $element->getValue(), $element->getId()));
     $element->setValue();
     // Not needed because page is already selected in select box
     return $element;
 }
Example #29
0
 /**
  * Returns Element HTML
  *
  * @param  Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $value = (string) $element->getValue();
     if (empty($value)) {
         return Mage::helper('oro_asset')->__('Never');
     }
     return Mage::app()->getLocale()->storeDate(null, $value, true);
 }
Example #30
0
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $element->getBold() ? '<strong>' : '';
     $html .= $element->getValue();
     $html .= $element->getBold() ? '</strong>' : '';
     $html .= $element->getAfterElementHtml();
     return $html;
 }