当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Data_Form_Element_Abstract::getHtmlAttributes方法代码示例

本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::getHtmlAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::getHtmlAttributes方法的具体用法?PHP Varien_Data_Form_Element_Abstract::getHtmlAttributes怎么用?PHP Varien_Data_Form_Element_Abstract::getHtmlAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Data_Form_Element_Abstract的用法示例。


在下文中一共展示了Varien_Data_Form_Element_Abstract::getHtmlAttributes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = '<tr>' . "\n";
     $countryId = false;
     if ($country = $element->getForm()->getElement('country_id')) {
         $countryId = $country->getValue();
     }
     $regionCollection = false;
     if ($countryId) {
         if (!isset(self::$_regionCollections[$countryId])) {
             self::$_regionCollections[$countryId] = Mage::getModel('directory/country')->setId($countryId)->getLoadedRegionCollection();
         }
         $regionCollection = self::$_regionCollections[$countryId];
     }
     $regionId = $element->getForm()->getElement('region_id')->getValue();
     if ($regionCollection && $regionCollection->getSize()) {
         $elementClass = $element->getClass();
         $element->setClass(str_replace('input-text', '', $elementClass));
         $html .= '<td class="label">' . $element->getLabelHtml() . '</td>';
         $html .= '<td class="value"><select id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" ' . $element->serialize($element->getHtmlAttributes()) . '>' . "\n";
         foreach ($regionCollection as $region) {
             $selected = $regionId == $region->getId() ? ' selected' : '';
             $html .= '<option value="' . $region->getId() . '"' . $selected . '>' . $region->getName() . '</option>';
         }
         $html .= '</select></td>';
         $element->setClass($elementClass);
     } else {
         $element->setClass('input-text');
         $html .= '<td class="label"><label for="' . $element->getHtmlId() . '">' . $element->getLabel() . ' <span class="required" style="display:none">*</span></label></td>';
         $element->setRequired(false);
         $html .= '<td class="value"><input id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $element->getEscapedValue() . '"' . $element->serialize($element->getHtmlAttributes()) . '/></td>' . "\n";
     }
     $html .= '</tr>' . "\n";
     return $html;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:35,代码来源:Region.php

示例2: _getElementHtml

 /**
  * @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;
 }
开发者ID:WeareJH,项目名称:esendex-magento-extension,代码行数:34,代码来源:CronTime.php

示例3: _getElementHtml

 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = "";
     $html .= '<a id="' . $element->getHtmlId() . '" ' . $element->serialize($element->getHtmlAttributes()) . '>' . $element->getEscapedValue() . "</a>\n";
     $html .= $element->getAfterElementHtml();
     return $html;
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:7,代码来源:Link.php

示例4: render

 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = '<tr>' . "\n";
     $countryId = false;
     if ($country = $element->getForm()->getElement('country_id')) {
         $countryId = $country->getValue();
     }
     $regionCollection = false;
     if ($countryId) {
         if (!isset(self::$_regionCollections[$countryId])) {
             self::$_regionCollections[$countryId] = Mage::getModel('directory/country')->setId($countryId)->getLoadedRegionCollection()->toOptionArray();
         }
         $regionCollection = self::$_regionCollections[$countryId];
     }
     $regionId = intval($element->getForm()->getElement('region_id')->getValue());
     $htmlAttributes = $element->getHtmlAttributes();
     foreach ($htmlAttributes as $key => $attribute) {
         if ('type' === $attribute) {
             unset($htmlAttributes[$key]);
             break;
         }
     }
     // Output two elements - for 'region' and for 'region_id'.
     // Two elements are needed later upon form post - to properly set data to address model,
     // otherwise old value can be left in region_id attribute and saved to DB.
     // Depending on country selected either 'region' (input text) or 'region_id' (selectbox) is visible to user
     $regionHtmlName = $element->getName();
     $regionIdHtmlName = str_replace('region', 'region_id', $regionHtmlName);
     $regionHtmlId = $element->getHtmlId();
     $regionIdHtmlId = str_replace('region', 'region_id', $regionHtmlId);
     if ($regionCollection && count($regionCollection) > 0) {
         $elementClass = $element->getClass();
         $html .= '<td class="label">' . $element->getLabelHtml() . '</td>';
         $html .= '<td class="value">';
         $html .= '<select id="' . $regionIdHtmlId . '" name="' . $regionIdHtmlName . '" ' . $element->serialize($htmlAttributes) . '>' . "\n";
         foreach ($regionCollection as $region) {
             $selected = $regionId == $region['value'] ? ' selected="selected"' : '';
             $value = is_numeric($region['value']) ? (int) $region['value'] : "";
             $html .= '<option value="' . $value . '"' . $selected . '>' . Mage::helper('adminhtml')->escapeHtml(Mage::helper('directory')->__($region['label'])) . '</option>';
         }
         $html .= '</select>' . "\n";
         $html .= '<input type="hidden" name="' . $regionHtmlName . '" id="' . $regionHtmlId . '" value=""/>';
         $html .= '</td>';
         $element->setClass($elementClass);
     } else {
         $element->setClass('input-text');
         $html .= '<td class="label"><label for="' . $element->getHtmlId() . '">' . $element->getLabel() . ' <span class="required" style="display:none">*</span></label></td>';
         $element->setRequired(false);
         $html .= '<td class="value">';
         $html .= '<input id="' . $regionHtmlId . '" name="' . $regionHtmlName . '" value="' . $element->getEscapedValue() . '" ' . $element->serialize($htmlAttributes) . "/>" . "\n";
         $html .= '<input type="hidden" name="' . $regionIdHtmlName . '" id="' . $regionIdHtmlId . '" value=""/>';
         $html .= '</td>' . "\n";
     }
     $html .= '</tr>' . "\n";
     return $html;
 }
开发者ID:okite11,项目名称:frames21,代码行数:56,代码来源:Region.php

示例5: _getElementHtml

 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = "";
     $html .= "<input class=' input-text'  type='hidden' id='" . $element->getHtmlId() . "' name='" . $element->getName() . "' value='" . $element->getEscapedValue() . "' '" . $element->serialize($element->getHtmlAttributes()) . "/>";
     $html .= "\n<script>\n    document.observe('dom:loaded', function(){\n       \n        if(!\$('" . $element->getHtmlId() . "').value.isJSON())\$('" . $element->getHtmlId() . "').value='{\"days\":[],\"hours\":[]}';\n         cron=\$('" . $element->getHtmlId() . "').value.evalJSON();\n       \n        \n        cron.days.each(function(d){\n            if(\$('d-'+d)){\n                \$('d-'+d).checked=true;\n                \$('d-'+d).ancestors()[0].addClassName('checked');\n            }\n            \n        })\n        cron.hours.each(function(h){\n            if( \$('h-'+h.replace(':',''))){\n                \$('h-'+h.replace(':','')).checked=true;\n                \$('h-'+h.replace(':','')).ancestors()[0].addClassName('checked');\n            }\n        })\n        \n        \$\$('.cron-box').each(function(e){\n            e.observe('click',function(){\n                \n                if(e.checked)e.ancestors()[0].addClassName('checked');\n                else e.ancestors()[0].removeClassName('checked');\n               \n                d=new Array\n                \$\$('.cron-d-box INPUT').each(function(e){\n                    if(e.checked) d.push(e.value)\n                })\n                h=new Array;\n                \$\$('.cron-h-box INPUT').each(function(e){\n                    if(e.checked) h.push(e.value)\n                })\n                \n                \$('" . $element->getHtmlId() . "').value=Object.toJSON({days:d,hours:h})\n               \n            }) \n        })\n    })\n    \n</script>\n";
     $html .= "\n<style>\n    .morning .cron-h-box{\n        border: 1px solid #AFAFAF;\n        border-radius: 3px 3px 3px 3px;\n        margin: 2px;\n        padding: 0 3px;\n        background:#efefef;\n    }\n    .afternoon .cron-h-box{\n        border: 1px solid #AFAFAF;\n        border-radius: 3px 3px 3px 3px;\n        margin: 2px;\n        padding: 0 3px;\n        background:#efefef;\n    }\n    .morning-half .cron-h-box{\n        border: 1px solid #AFAFAF;\n        border-radius: 3px 3px 3px 3px;\n        margin: 2px;\n        padding: 0 3px;\n        background:#efefef;\n    }\n    .afternoon-half .cron-h-box{\n\n        border: 1px solid #AFAFAF;\n        border-radius: 3px 3px 3px 3px;\n        margin: 2px;\n        padding: 0 3px;\n        background:#efefef;\n    }\n\n    .cron-d-box{\n\n        background:#efefef;\n        border: 1px solid #AFAFAF;\n        border-radius: 3px 3px 3px 3px;\n        margin: 2px;\n        padding: 0 3px;\n    }\n    .checked{\n        background-color: #EFFFF0!important;\n    }\n</style>";
     $html .= "<table style='width:600px !important'>\n            <thead> \n                <tr><th>Days of the week</th><th width='20'></th><th colspan='4'>Hours of the day</th></tr>\n            </thead>\n            <tr>\n                <td width='300'>\n                    <div class='cron-d-box'><input class='cron-box' value='Monday' id='d-Monday' type='checkbox'/> Monday</div>\n                    <div class='cron-d-box'><input class='cron-box' value='Tuesday' id='d-Tuesday' type='checkbox'/> Tuesday</div>\n                    <div class='cron-d-box'><input class='cron-box' value='Wednesday' id='d-Wednesday' type='checkbox'/> Wednesday</div>\n                    <div class='cron-d-box'><input class='cron-box' value='Thursday' id='d-Thursday' type='checkbox'/> Thursday</div>\n                    <div class='cron-d-box'><input class='cron-box' value='Friday' id='d-Friday' type='checkbox'/> Friday</div>\n                    <div class='cron-d-box'><input class='cron-box' value='Saturday' id='d-Saturday' type='checkbox'/> Saturday</div>\n                    <div class='cron-d-box'><input class='cron-box' value='Sunday' id='d-Sunday' type='checkbox'/> Sunday</div>\n                </td>\n                <td></td>\n                <td width='150' class='morning-half'>\n                    <div class='cron-h-box'><input class='cron-box' value='00:00' id='h-0000'  type='checkbox'/> 00:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='01:00' id='h-0100' type='checkbox'/> 01:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='02:00' id='h-0200' type='checkbox'/> 02:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='03:00' id='h-0300' type='checkbox'/> 03:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='04:00' id='h-0400' type='checkbox'/> 04:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='05:00' id='h-0500' type='checkbox'/> 05:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='06:00' id='h-0600'  type='checkbox'/> 06:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='07:00' id='h-0700' type='checkbox'/> 07:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='08:00' id='h-0800'  type='checkbox'/> 08:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='09:00' id='h-0900' type='checkbox'/> 09:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='10:00' id='h-1000' type='checkbox'/> 10:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='11:00' id='h-1100' type='checkbox'/> 11:00 AM</div>\n\n                </td>\n                <td width='150' class='morning'>\n                    <div class='cron-h-box'><input class='cron-box' value='00:30' id='h-0030' type='checkbox'/> 00:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='01:30' id='h-0130' type='checkbox'/> 01:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='02:30' id='h-0230' type='checkbox'/> 02:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='03:30' id='h-0330' type='checkbox'/> 03:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='04:30' id='h-0430' type='checkbox'/> 04:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='05:30' id='h-0530' type='checkbox'/> 05:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='06:30' id='h-0630' type='checkbox'/> 06:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='07:30' id='h-0730' type='checkbox'/> 07:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='08:30' id='h-0830' type='checkbox'/> 08:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='09:30' id='h-0930' type='checkbox'/> 09:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='10:30' id='h-1030' type='checkbox'/> 10:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='11:30' id='h-1130' type='checkbox'/> 11:30 AM</div>\n\n\n\n\n                </td>\n                <td width='150' class='afternoon-half'>\n                    <div class='cron-h-box'><input class='cron-box' value='12:00' id='h-1200' type='checkbox'/> 12:00 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='13:00' id='h-1300' type='checkbox'/> 01:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='14:00' id='h-1400' type='checkbox'/> 02:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='15:00' id='h-1500' type='checkbox'/> 03:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='16:00' id='h-1600' type='checkbox'/> 04:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='17:00' id='h-1700' type='checkbox'/> 05:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='18:00' id='h-1800' type='checkbox'/> 06:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='19:00' id='h-1900' type='checkbox'/> 07:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='20:00' id='h-2000' type='checkbox'/> 08:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='21:00' id='h-2100' type='checkbox'/> 09:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='22:00' id='h-2200' type='checkbox'/> 10:00 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='23:00' id='h-2300' type='checkbox'/> 11:00 PM</div>\n\n                </td>\n                <td width='150' class='afternoon'>\n                    <div class='cron-h-box'><input class='cron-box' value='12:30' id='h-1230' type='checkbox'/> 12:30 AM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='13:30' id='h-1330' type='checkbox'/> 01:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='14:30' id='h-1430' type='checkbox'/> 02:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='15:30' id='h-1530' type='checkbox'/> 03:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='16:30' id='h-1630' type='checkbox'/> 04:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='17:30' id='h-1730' type='checkbox'/> 05:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='18:30' id='h-1830' type='checkbox'/> 06:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='19:30' id='h-1930' type='checkbox'/> 07:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='20:30' id='h-2030' type='checkbox'/> 08:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='21:30' id='h-2130' type='checkbox'/> 09:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='22:30' id='h-2230' type='checkbox'/> 10:30 PM</div>\n                    <div class='cron-h-box'><input class='cron-box' value='23:30' id='h-2330' type='checkbox'/> 11:30 PM</div>\n\n\n                </td>\n            </tr>\n        </table>";
     $html .= $element->getAfterElementHtml();
     return $html;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:10,代码来源:Cron.php

示例6: _getElementHtml

 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $elementId = $element->getHtmlId();
     /* read configurations from system.xml */
     $configarray = $element->getData('field_config')->asArray();
     $min = $configarray['parameters']['min'];
     $max = $configarray['parameters']['max'];
     $step = $configarray['parameters']['step'];
     $label = $configarray['parameters']['label'];
     $skin = $configarray['parameters']['skin'];
     /* default values when theres no definition in system.xml */
     if ($min == '') {
         $min = '0';
     }
     if ($max == '') {
         $max = '10';
     }
     if ($step == '') {
         $step = '1';
     }
     if ($min >= $max) {
         $min = '0';
         $max = '10';
         $step = '1';
     }
     if ($label == '') {
         $label = 'Unit / Maßeinheit';
     }
     //wrong or no entering of a skin
     switch ($skin) {
         case 'blue':
         case 'plastic':
         case 'round':
         case 'round_plastic':
             break;
         default:
             $skin = 'plastic';
     }
     //normal Inputfield, wolud hidden by the Slider JS
     $html = '<input id="' . $elementId . '" name="' . $element->getName() . '" value="' . $element->getEscapedValue() . '" ' . $element->serialize($element->getHtmlAttributes()) . '/>' . "\n";
     //additional JS with configurations from system.xml
     $html .= '<script type="text/javascript" charset="utf-8">
                     if(typeof jQuery == "function") {//jQuery is a function when the jQuery library was loaded
                         jQuery.noConflict();//get no conflicts with prototype in magento
                         if(typeof jQuery("#' . $elementId . '").slider == "function") {//jQuery.slider is a function when the jQuerySlider library was loaded
                             jQuery("#' . $elementId . '").slider({ from: ' . $min . ', to: ' . $max . ', step: ' . $step . ', dimension: \'&nbsp;' . $label . '\', skin: "' . $skin . '" });
                         }
                     }
              </script>';
     $html .= $element->getAfterElementHtml();
     return $html;
 }
开发者ID:par-orillonsoft,项目名称:JCarouselSlider,代码行数:52,代码来源:Slidingregulation.php

示例7: _getElementHtml

 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->addClass('select');
     $value_hrs = 0;
     $value_min = 0;
     $value_sec = 0;
     if ($value = $element->getValue()) {
         $values = explode(',', $value);
         if (is_array($values) && count($values) == 3) {
             $value_hrs = $values[0];
             $value_min = $values[1];
             $value_sec = $values[2];
         }
     }
     $html = '<input type="hidden" id="' . $element->getHtmlId() . '" />';
     $html .= '<select name="' . $element->getName() . '" ' . $element->serialize($element->getHtmlAttributes()) . ' style="width:50px">' . "\n";
     for ($i = 0; $i < 24; $i++) {
         $hour = str_pad($i, 2, '0', STR_PAD_LEFT);
         $html .= '<option value="' . $hour . '" ' . ($value_hrs == $i ? 'selected="selected"' : '') . '>' . $hour . '</option>';
     }
     $html .= '</select>' . "\n";
     $html .= '&nbsp;:&nbsp;<select name="' . $element->getName() . '" ' . $element->serialize($element->getHtmlAttributes()) . ' style="width:50px">' . "\n";
     for ($i = 0; $i < 60; $i++) {
         $hour = str_pad($i, 2, '0', STR_PAD_LEFT);
         $html .= '<option value="' . $hour . '" ' . ($value_min == $i ? 'selected="selected"' : '') . '>' . $hour . '</option>';
     }
     $html .= '</select>' . "\n";
     $html .= '<select name="' . $element->getName() . '" ' . $element->serialize($element->getHtmlAttributes()) . ' style="width:50px;display:none;">' . "\n";
     for ($i = 0; $i < 60; $i++) {
         $hour = str_pad($i, 2, '0', STR_PAD_LEFT);
         $html .= '<option value="' . $hour . '" ' . ($value_sec == $i ? 'selected="selected"' : '') . '>' . $hour . '</option>';
     }
     $html .= '</select>' . "\n";
     $html .= $element->getAfterElementHtml();
     return $html;
 }
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:36,代码来源:Time.php

示例8: _getElementHtml

 /**
  * Get the element's HTML.
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $value = $this->_getValue();
     $html = '<input id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $value . '" ' . $this->serialize($element->getHtmlAttributes()) . '/>' . "\n";
     $html .= $element->getAfterElementHtml();
     return $html;
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:13,代码来源:Hidden.php


注:本文中的Varien_Data_Form_Element_Abstract::getHtmlAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。