public static function parse($data) { $default_value = null; foreach ($data['data'] as $variant) { if ($variant['default'] === true) { $default_value = (string) $variant['id']; break; } } $string = '<table border="0" cellspacing="0" cellpadding="2">' . ' <tr>' . ' <td width="100">' . $data['title'] . ':</td>' . ' <td>' . HTML::radioField('variants[' . $data['group_id'] . ']', $data['data'], $default_value, 'onchange="refreshVariants();" id="variants_' . $data['group_id'] . '"') . '</td>' . ' </tr>' . '</table>'; return $string; }
* @license BSD License; http://www.oscommerce.com/bsdlicense.txt */ use osCommerce\OM\Core\HTML; use osCommerce\OM\Core\OSCOM; use osCommerce\OM\Core\Site\Shop\Address; ?> <ol> <?php if (ACCOUNT_GENDER > -1) { $gender_array = array(array('id' => 'm', 'text' => OSCOM::getDef('gender_male')), array('id' => 'f', 'text' => OSCOM::getDef('gender_female'))); ?> <li><?php echo HTML::label(OSCOM::getDef('field_customer_gender'), 'gender_1', null, ACCOUNT_GENDER > 0) . HTML::radioField('gender', $gender_array, isset($osC_oiAddress) && $osC_oiAddress->exists('gender') ? $osC_oiAddress->get('gender') : (!$OSCOM_Customer->hasDefaultAddress() ? $OSCOM_Customer->getGender() : null)); ?> </li> <?php } ?> <li><?php echo HTML::label(OSCOM::getDef('field_customer_first_name'), 'firstname', null, true) . HTML::inputField('firstname', isset($osC_oiAddress) && $osC_oiAddress->exists('firstname') ? $osC_oiAddress->get('firstname') : (!$OSCOM_Customer->hasDefaultAddress() ? $OSCOM_Customer->getFirstName() : null)); ?> </tli> <li><?php echo HTML::label(OSCOM::getDef('field_customer_last_name'), 'lastname', null, true) . HTML::inputField('lastname', isset($osC_oiAddress) && $osC_oiAddress->exists('lastname') ? $osC_oiAddress->get('lastname') : (!$OSCOM_Customer->hasDefaultAddress() ? $OSCOM_Customer->getLastName() : null)); ?> </li>
<p><?php echo OSCOM::getDef('introduction_import_language'); ?> </p> <fieldset> <p><label for="language_import"><?php echo OSCOM::getDef('field_language_selection'); ?> </label><?php echo HTML::selectMenu('language_import', $languages_array); ?> </p> <p><label for="import_type"><?php echo OSCOM::getDef('field_import_type'); ?> </label><br /><?php echo HTML::radioField('import_type', array(array('id' => 'add', 'text' => OSCOM::getDef('only_add_new_records')), array('id' => 'update', 'text' => OSCOM::getDef('only_update_existing_records')), array('id' => 'replace', 'text' => OSCOM::getDef('replace_all'))), 'add', null, '<br />'); ?> </p> </fieldset> <p><?php echo HTML::button(array('priority' => 'primary', 'icon' => 'triangle-1-se', 'title' => OSCOM::getDef('button_import'))) . ' ' . HTML::button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?> </p> </form> </div>
?> </h3> <form name="cUpdate" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'UpdateRates&Process'); ?> " method="post"> <p><?php echo OSCOM::getDef('introduction_update_exchange_rates'); ?> </p> <fieldset> <p><?php echo HTML::radioField('service', $services, null, null, '<br />'); ?> </p> </fieldset> <p><?php echo OSCOM::getDef('service_terms_agreement'); ?> </p> <p><?php echo HTML::button(array('priority' => 'primary', 'icon' => 'refresh', 'title' => OSCOM::getDef('button_update'))) . ' ' . HTML::button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?> </p> </form>
</li> <li><?php echo HTML::label(OSCOM::getDef('field_customer_email_address'), 'customer_email_address') . HTML::inputField('customer_email_address'); ?> </li> <?php } ?> <li><?php echo HTML::textareaField('review', null, null, 15, 'style="width: 98%;"'); ?> </li> <li><?php echo OSCOM::getDef('field_review_rating') . ' ' . OSCOM::getDef('review_lowest_rating_title') . ' ' . HTML::radioField('rating', array('1', '2', '3', '4', '5')) . ' ' . OSCOM::getDef('review_highest_rating_title'); ?> </li> </ol> </div> </div> <div class="submitFormButtons"> <span style="float: right;"><?php echo HTML::button(array('icon' => 'triangle-1-e', 'title' => OSCOM::getDef('button_continue'))); ?> </span> <?php echo HTML::button(array('href' => OSCOM::getLink(null, null, 'Reviews&' . $OSCOM_Product->getID()), 'icon' => 'triangle-1-w', 'title' => OSCOM::getDef('button_back'))); ?>
<h6><?php echo OSCOM::getDef('my_account_title'); ?> </h6> <div class="content"> <ol> <?php if (ACCOUNT_GENDER > -1) { $gender_array = array(array('id' => 'm', 'text' => OSCOM::getDef('gender_male')), array('id' => 'f', 'text' => OSCOM::getDef('gender_female'))); ?> <li><?php echo HTML::label(OSCOM::getDef('field_customer_gender'), 'gender_1', null, ACCOUNT_GENDER > 0) . HTML::radioField('gender', $gender_array); ?> </li> <?php } ?> <li><?php echo HTML::label(OSCOM::getDef('field_customer_first_name'), 'firstname', null, true) . HTML::inputField('firstname'); ?> </li> <li><?php echo HTML::label(OSCOM::getDef('field_customer_last_name'), 'lastname', null, true) . HTML::inputField('lastname'); ?> </li>
} ?> <td width="10"> </td> <td width="75%"><?php echo $methods['title']; ?> </td> <?php if ($OSCOM_Shipping->numberOfQuotes() > 1 || count($quotes['methods']) > 1) { ?> <td><?php echo $OSCOM_Currencies->displayPrice($methods['cost'], $quotes['tax_class_id']); ?> </td> <td align="right"><?php echo HTML::radioField('shipping_mod_sel', $quotes['id'] . '_' . $methods['id'], $OSCOM_ShoppingCart->getShippingMethod('id')); ?> </td> <?php } else { ?> <td align="right" colspan="2"><?php echo $OSCOM_Currencies->displayPrice($methods['cost'], $quotes['tax_class_id']) . HTML::hiddenField('shipping_mod_sel', $quotes['id'] . '_' . $methods['id']); ?> </td> <?php } ?> <td width="10"> </td> </tr> <?php
} else { echo '<h3>' . HTML::icon('edit.png') . ' ' . $OSCOM_ObjectInfo->getProtected('customers_name') . '</h3>'; } ?> <fieldset> <?php if (ACCOUNT_GENDER > -1) { ?> <p id="abGenderFields"><label for="ab_gender"><?php echo OSCOM::getDef('field_gender'); ?> </label><?php echo HTML::radioField('ab_gender', $gender_array, 'm', null, ''); ?> </p> <script> $('input[name="ab_gender"]').removeAttr('checked'); $('input[name="ab_gender"]').filter('[value="' + $('input[name="gender"]:checked').val() + '"]').attr('checked', true); $('#abGenderFields').buttonset(); </script> <?php } ?> <p><label for="ab_firstname"><?php echo OSCOM::getDef('field_first_name');
<h1><?php echo $OSCOM_Template->getIcon(32) . HTML::link(OSCOM::getLink(), $OSCOM_Template->getPageTitle()); ?> </h1> <?php if ($OSCOM_MessageStack->exists()) { echo $OSCOM_MessageStack->get(); } ?> <div id="sectionMenuContainer" style="float: left; padding-bottom: 10px;"> <span class="ui-widget-header ui-corner-all" style="padding: 10px 4px;"> <span id="sectionMenu"><?php echo HTML::radioField('sections', array(array('id' => 'personal', 'text' => OSCOM::getDef('section_personal')), array('id' => 'password', 'text' => OSCOM::getDef('section_password')), array('id' => 'addressBook', 'text' => OSCOM::getDef('section_address_book')), array('id' => 'newsletters', 'text' => OSCOM::getDef('section_newsletters')), array('id' => 'map', 'text' => OSCOM::getDef('section_map')), array('id' => 'social', 'text' => OSCOM::getDef('section_social'))), isset($_GET['tabIndex']) ? $_GET['tabIndex'] : null, null, ''); ?> </span> </span> </div> <script> $(function() { $('#sectionMenu').buttonsetTabs(); }); </script> <form id="cEditForm" name="cEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Save&Process'); ?> " method="post">
<h6><?php echo OSCOM::getDef('my_account_title'); ?> </h6> <div class="content"> <ol> <?php if (ACCOUNT_GENDER > -1) { $gender_array = array(array('id' => 'm', 'text' => OSCOM::getDef('gender_male')), array('id' => 'f', 'text' => OSCOM::getDef('gender_female'))); ?> <li><?php echo HTML::label(OSCOM::getDef('field_customer_gender'), 'gender_1', null, ACCOUNT_GENDER > 0) . HTML::radioField('gender', $gender_array, $Qaccount->value('customers_gender')); ?> </li> <?php } ?> <li><?php echo HTML::label(OSCOM::getDef('field_customer_first_name'), 'firstname', null, true) . ' ' . HTML::inputField('firstname', $Qaccount->value('customers_firstname')); ?> </li> <li><?php echo HTML::label(OSCOM::getDef('field_customer_last_name'), 'lastname', null, true) . ' ' . HTML::inputField('lastname', $Qaccount->value('customers_lastname')); ?> </li>
} else { echo '<h3>' . HTML::icon('edit.png') . ' ' . $OSCOM_ObjectInfo->getProtected('customers_name') . '</h3>'; } ?> <fieldset> <?php if (ACCOUNT_GENDER > -1) { ?> <p id="genderFields"><label for="gender"><?php echo OSCOM::getDef('field_gender'); ?> </label><?php echo HTML::radioField('gender', $gender_array, $new_customer ? 'm' : $OSCOM_ObjectInfo->get('customers_gender'), null, ''); ?> </p> <script>$('#genderFields').buttonset();</script> <?php } ?> <p><label for="firstname"><?php echo OSCOM::getDef('field_first_name'); ?> </label><?php echo HTML::inputField('firstname', $new_customer ? null : $OSCOM_ObjectInfo->get('customers_firstname')); ?>
</ul> </fieldset> </td> <td width="70%" valign="top"> <h4><?php echo OSCOM::getDef('subsection_price'); ?></h4> <fieldset> <p><label for="variants_price_tax_class"><?php echo OSCOM::getDef('field_tax_class'); ?></label><?php echo HTML::selectMenu('variants_price_tax_class', $OSCOM_Application->getTaxClassesList(), null, 'onchange="updateGross(\'variants_price\');"'); ?></p> <p><label for="variants_price"><?php echo OSCOM::getDef('field_price_net'); ?></label><?php echo HTML::inputField('variants_price', null, 'onkeyup="updateGross(\'variants_price\')"'); ?></p> <p><label for="variants_price_gross"><?php echo OSCOM::getDef('field_price_gross'); ?></label><?php echo HTML::inputField('variants_price_gross', null, 'onkeyup="updateNet(\'variants_price\')"'); ?></p> </fieldset> <h4><?php echo OSCOM::getDef('subsection_data'); ?></h4> <fieldset> <p id="vstatus"><label for="variants_status"><?php echo OSCOM::getDef('field_status'); ?></label><?php echo HTML::radioField('variants_status', array(array('id' => '1', 'text' => OSCOM::getDef('status_enabled')), array('id' => '0', 'text' => OSCOM::getDef('status_disabled')))); ?></p> <p><label for="variants_model"><?php echo OSCOM::getDef('field_model'); ?></label><?php echo HTML::inputField('variants_model', null); ?></p> <p><label for="variants_quantity"><?php echo OSCOM::getDef('field_quantity'); ?></label><?php echo HTML::inputField('variants_quantity', null); ?></p> <p><label for="variants_weight"><?php echo OSCOM::getDef('field_weight'); ?></label><?php echo HTML::inputField('variants_weight', null, 'size="6"'). HTML::selectMenu('variants_weight_class', $OSCOM_Application->getWeightClassesList(), SHIPPING_WEIGHT_UNIT); ?></p> <p><label for="variants_default"><?php echo OSCOM::getDef('field_default'); ?></label><?php echo HTML::checkboxField('variants_default'); ?></p> </fieldset> <script> $(function() { $('#vstatus').buttonset(); }); </script> </td> </tr> </table>
<?php $Qadmins = $OSCOM_PDO->query('select id, user_name from :table_administrators where id in ("' . implode('", "', array_unique(array_filter(array_slice($_POST['batch'], 0, MAX_DISPLAY_SEARCH_RESULTS), 'is_numeric'))) . '") order by user_name'); $Qadmins->execute(); $names_string = ''; while ($Qadmins->fetch()) { $names_string .= HTML::hiddenField('batch[]', $Qadmins->valueInt('id')) . '<b>' . $Qadmins->valueProtected('user_name') . '</b>, '; } if (!empty($names_string)) { $names_string = substr($names_string, 0, -2); } echo '<p>' . $names_string . '</p>'; ?> <fieldset> <p><?php echo HTML::radioField('mode', array(array('id' => Administrators::ACCESS_MODE_ADD, 'text' => OSCOM::getDef('add_to')), array('id' => Administrators::ACCESS_MODE_REMOVE, 'text' => OSCOM::getDef('remove_from')), array('id' => Administrators::ACCESS_MODE_SET, 'text' => OSCOM::getDef('set_to'))), Administrators::ACCESS_MODE_ADD); ?> </p> <p><select name="accessModules" id="modulesList"><option value="-1" disabled="disabled">-- Access Modules --</option><option value="0"><?php echo OSCOM::getDef('global_access'); ?> </option></select></p> <ul id="accessToModules" class="modulesListing"></ul> </fieldset> <p><?php echo HTML::button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . HTML::button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?> </p>
<fieldset> <p><label for="products_price_tax_class"><?php echo OSCOM::getDef('field_tax_class'); ?></label><?php echo HTML::selectMenu('products_tax_class_id', $OSCOM_Application->getTaxClassesList(), (!$new_product ? $OSCOM_ObjectInfo->getInt('products_tax_class_id') : null), 'id="products_price_tax_class" onchange="updateGross(\'products_price\');"'); ?></p> <p><label for="products_price"><?php echo OSCOM::getDef('field_price_net'); ?></label><?php echo HTML::inputField('products_price', (!$new_product ? $OSCOM_ObjectInfo->get('products_price') : null), 'onkeyup="updateGross(\'products_price\')"'); ?></p> <p><label for="products_price_gross"><?php echo OSCOM::getDef('field_price_gross'); ?></label><?php echo HTML::inputField('products_price_gross', (!$new_product ? $OSCOM_ObjectInfo->get('products_price') : null), 'onkeyup="updateNet(\'products_price\')"'); ?></p> </fieldset> </td> <?php } ?> <td width="<?php echo $data_width;?>" height="100%" valign="top"> <h4><?php echo OSCOM::getDef('subsection_data'); ?></h4> <fieldset> <p id="productStatusField"><label for="products_status"><?php echo OSCOM::getDef('field_status'); ?></label><?php echo HTML::radioField('products_status', array(array('id' => '1', 'text' => OSCOM::getDef('status_enabled')), array('id' => '0', 'text' => OSCOM::getDef('status_disabled'))), (!$new_product ? $OSCOM_ObjectInfo->get('products_status') : '0')); ?></p> <script>$('#productStatusField').buttonset();</script> <?php if ( $new_product || ($OSCOM_ObjectInfo->getInt('has_children') !== 1) ) { ?> <p><label for="products_model"><?php echo OSCOM::getDef('field_model'); ?></label><?php echo HTML::inputField('products_model', (!$new_product ? $OSCOM_ObjectInfo->get('products_model') : null)); ?></p> <p><label for="products_quantity"><?php echo OSCOM::getDef('field_quantity'); ?></label><?php echo HTML::inputField('products_quantity', (!$new_product ? $OSCOM_ObjectInfo->get('products_quantity') : null)); ?></p> <p><label for="products_weight"><?php echo OSCOM::getDef('field_weight'); ?></label><?php echo HTML::inputField('products_weight', (!$new_product ? $OSCOM_ObjectInfo->get('products_weight') : null)) . HTML::selectMenu('products_weight_class', $OSCOM_Application->getWeightClassesList(), (!$new_product ? $OSCOM_ObjectInfo->get('products_weight_class') : SHIPPING_WEIGHT_UNIT)); ?></p> <?php } ?>
echo OSCOM::getLink(null, null, 'BatchSave&Process'); ?> " method="post"> <p><?php echo OSCOM::getDef('introduction_batch_edit_cards'); ?> </p> <?php $Qcc = $OSCOM_PDO->query('select id, credit_card_name from :table_credit_cards where id in ("' . implode('", "', array_unique(array_filter(array_slice($_POST['batch'], 0, MAX_DISPLAY_SEARCH_RESULTS), 'is_numeric'))) . '") order by credit_card_name'); $Qcc->execute(); $names_string = ''; while ($Qcc->fetch()) { $names_string .= HTML::hiddenField('batch[]', $Qcc->valueInt('id')) . '<b>' . $Qcc->valueProtected('credit_card_name') . '</b>, '; } if (!empty($names_string)) { $names_string = substr($names_string, 0, -2); } echo '<p>' . $names_string . '</p>'; echo '<p>' . HTML::radioField('type', array(array('id' => 'activate', 'text' => OSCOM::getDef('activate')), array('id' => 'deactivate', 'text' => OSCOM::getDef('deactivate'))), 'activate') . '</p>'; ?> <p><?php echo HTML::button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . HTML::button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?> </p> </form> </div>
use osCommerce\OM\Core\OSCOM; $new_product = true; ?> <h1><?php echo $OSCOM_Template->getIcon(32) . HTML::link(OSCOM::getLink(), $OSCOM_Template->getPageTitle()); ?></h1> <?php if ( $OSCOM_MessageStack->exists() ) { echo $OSCOM_MessageStack->get(); } ?> <div id="sectionMenuContainer" style="float: left; padding-bottom: 10px;"> <span class="ui-widget-header ui-corner-all" style="padding: 10px 4px;"> <span id="sectionMenu"><?php echo HTML::radioField('sections', array(array('id' => 'general', 'text' => OSCOM::getDef('section_general')), array('id' => 'data', 'text' => OSCOM::getDef('section_data')), array('id' => 'images', 'text' => OSCOM::getDef('section_images')), array('id' => 'variants', 'text' => OSCOM::getDef('section_variants')), array('id' => 'categories', 'text' => OSCOM::getDef('section_categories'))), (isset($_GET['tabIndex']) ? $_GET['tabIndex'] : null), null, ''); ?></span> </span> </div> <form id="pEditForm" name="product" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Save&Process&cid=' . $OSCOM_Application->getCurrentCategoryID()); ?>" method="post"> <div id="formButtons" style="float: right;"><?php echo HTML::button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . HTML::button(array('type' => 'button', 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'), 'params' => 'onclick="$.safetynet.suppressed(true); window.location.href=\'' . OSCOM::getLink(null, null, 'cid=' . $OSCOM_Application->getCurrentCategoryID()) . '\';"')); ?></div> <div style="clear: both;"></div> <?php // HPDL Modularize, zack zack! include('section_general.php'); include('section_data.php'); include('section_images.php'); include('section_variants.php');
echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td width="10"> </td> <?php if ($n > 1) { ?> <td colspan="3"><?php echo '<b>' . $selection[$i]['module'] . '</b>'; ?> </td> <td align="right"><?php echo HTML::radioField('payment_method', $selection[$i]['id'], $OSCOM_ShoppingCart->hasBillingMethod() ? $OSCOM_ShoppingCart->getBillingMethod('id') : null); ?> </td> <?php } else { ?> <td colspan="4"><?php echo '<b>' . $selection[$i]['module'] . '</b>' . HTML::hiddenField('payment_method', $selection[$i]['id']); ?> </td> <?php } ?>
<?php if ($Qaddresses->valueInt('address_book_id') == $OSCOM_ShoppingCart->getBillingAddress('id')) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } /* HPDL osc_draw_radio_field() does not like integer default values */ ?> <td width="10"> </td> <td colspan="2"><b><?php echo $Qaddresses->valueProtected('firstname') . ' ' . $Qaddresses->valueProtected('lastname'); ?> </b></td> <td align="right"><?php echo HTML::radioField('ab', $Qaddresses->valueInt('address_book_id'), (string) $OSCOM_ShoppingCart->getBillingAddress('id')); ?> </td> <td width="10"> </td> </tr> <tr> <td width="10"> </td> <td colspan="3"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td width="10"> </td> <td><?php echo Address::format($Qaddresses->toArray(), ', '); ?> </td> <td width="10"> </td> </tr>
public function testRadioField() { $list_array = array(array('id' => 'one', 'text' => 'First'), array('id' => 'two', 'text' => 'Second'), array('id' => 'three', 'text' => 'Third')); $this->assertEquals('<input type="radio" name="selection" id="selection_1" value="one" checked="checked" /><label for="selection1" class="fieldLabel"> First</label> <input type="radio" name="selection" id="selection_2" value="two" /><label for="selection2" class="fieldLabel"> Second</label> <input type="radio" name="selection" id="selection_3" value="three" /><label for="selection3" class="fieldLabel"> Third</label>', HTML::radioField('selection', $list_array, 'one')); }