/** * Modified by shumisha to handle SEF URLs 2008-06-28 * @return string The html for the limit # input box */ function getLimitBox($link = '') { $limits = array(); if (!empty($link) && strpos('limitstart=', $link) === false) { // insert limitstart in url if missing // shumisha $link .= '&limitstart=' . $this->limitstart; } for ($i = 5; $i <= 30; $i += 5) { if (empty($link)) { $limits[$i] = $i; } else { $limits[vmRoute($link . '&limit=' . $i)] = $i; } } if (empty($link)) { $limits[50] = 50; } else { $limits[vmRoute($link . '&limit=50')] = 50; } // build the html select list if (empty($link)) { $html = ps_html::selectList('limit', $this->limit, $limits, 1, '', 'onchange="this.form.submit();"'); } else { $current = vmRoute($link . '&limit=' . $this->limit); $html = ps_html::selectList('limit', $current, $limits, 1, '', 'onchange="location.href=this.value"'); } $html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"{$this->limitstart}\" />"; return $html; }
?> </td> </tr> <tr> <td colspan="2"><br /></td> </tr> <tr> <td ><div align="right"> <?php echo $VM_LANG->_('PHPSHOP_CATEGORY_FORM_FLYPAGE'); ?> :</div> </td> <td valign="top"> <?php echo ps_html::list_template_files("category_flypage", 'product_details', str_replace('shop.', '', $db->sf("category_flypage"))); ?> </td> </tr> </table> <?php $tabs->endTab(); $tabs->startTab("<img src='" . IMAGEURL . "ps_image/image.png' width='16' height='16' align='absmiddle' border='0' /> " . $VM_LANG->_('E_IMAGES'), "status-page"); if (!stristr($db->f("category_thumb_image"), "http")) { echo "<input type=\"hidden\" name=\"category_thumb_image_curr\" value=\"" . $db->f("category_thumb_image") . "\" />"; } if (!stristr($db->f("category_full_image"), "http")) { echo "<input type=\"hidden\" name=\"category_full_image_curr\" value=\"" . $db->f("category_full_image") . "\" />"; } $ps_html->writableIndicator(array(IMAGEPATH . "category")); ?>
/** * Enter description here... * * @param unknown_type $name * @param unknown_type $preselected * @return unknown */ function list_available_classes($name, $preselected = 'ps_xmlexport') { $files = vmReadDirectory(CLASSPATH . "export/", ".php", true, true); $array = array(); foreach ($files as $file) { $file_info = pathinfo($file); $filename = $file_info['basename']; if (stristr($filename, '.cfg')) { continue; } $array[basename($filename, '.php')] = basename($filename, '.php'); } return ps_html::selectList($name, $preselected, $array); }
/** * Creates a Drop Down list of available Shopper Groups * * @param string $name * @param int $shopper_group_id * @param string $extra * @return string */ function list_shopper_groups($name, $shopper_group_id = '0', $extra = '') { $ps_vendor_id = $_SESSION["ps_vendor_id"]; global $perm; $db = new ps_DB(); if (!$perm->check("admin")) { $q = "SELECT shopper_group_id,shopper_group_name,vendor_id,'' AS vendor_name FROM #__{vm}_shopper_group "; $q .= "WHERE vendor_id = '{$ps_vendor_id}' "; } else { $q = "SELECT shopper_group_id,shopper_group_name,#__{vm}_shopper_group.vendor_id,vendor_name FROM #__{vm}_shopper_group "; $q .= ",#__{vm}_vendor WHERE #__{vm}_shopper_group.vendor_id = #__{vm}_vendor.vendor_id "; } $q .= "ORDER BY shopper_group_name"; $db->query($q); while ($db->next_record()) { $shopper_groups[$db->f("shopper_group_id")] = $db->f("shopper_group_name"); // . '; '.$db->f('vendor_name').' (Vendor ID: '.$db->f('vendor_id').")"; } return ps_html::selectList($name, $shopper_group_id, $shopper_groups, 1, '', $extra); }
: </td> <td> <?php ps_html::dropdown_display('display_style[5]', $currency_display['positive'], $currency_style_positive); echo vmToolTip($VM_LANG->_('PHPSHOP_CURRENCY_POSITIVE_DISPLAY_TOOLTIP')); ?> </td> </tr> <tr> <td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_CURRENCY_NEGATIVE_DISPLAY'); ?> : </td> <td> <?php ps_html::dropdown_display('display_style[6]', $currency_display['negative'], $currency_style_negative); echo vmToolTip($VM_LANG->_('PHPSHOP_CURRENCY_NEGATIVE_DISPLAY_TOOLTIP')); ?> </td> </tr> <tr> <td class="labelcell"><?php echo $VM_LANG->_('VM_STORE_FORM_ACCEPTED_CURRENCIES'); ?> :</td> <td><?php $currencies = $db->f('vendor_accepted_currencies') ? $db->f('vendor_accepted_currencies') : $vendor_currency; echo $ps_html->getCurrencyList('vendor_accepted_currencies[]', explode(',', $currencies), 'currency_code', '', 10, 'multiple="multiple"'); echo ' ' . vmToolTip($VM_LANG->_('VM_STORE_FORM_ACCEPTED_CURRENCIES_TIP')); ?> </td>
:</td> <td width="76%" > <?php $module_perms = explode(',', $db->f("module_perms")); $perm->list_perms('module_perms', $module_perms, 5, true); ?> </td> </tr> <tr> <td width="24%" align="right" ><?php echo $VM_LANG->_('PHPSHOP_MODULE_FORM_MENU'); ?> :</td> <td width="76%"> <?php echo ps_html::yesNoSelectList('module_publish', $db->f('module_publish'), 'Y', 'N'); ?> </td> </tr> <tr> <td width="24%" align="right"><?php echo $VM_LANG->_('PHPSHOP_MODULE_FORM_ORDER'); ?> :</td> <td width="76%" > <input type="text" class="inputbox" name="list_order" size="3" maxlength="2" value="<?php $db->sp("list_order"); ?> " /> </td>
/** * Show all configuration parameters for this payment method * @returns boolean False when the Payment method has no configration */ function show_configuration() { global $VM_LANG, $vendor_image_url; $db = new ps_DB(); // Read current Configuration include_once CLASSPATH . "payment/" . __CLASS__ . ".cfg.php"; $lang = jfactory::getLanguage(); $name = $lang->getBackwardLang(); if (file_exists(CLASSPATH . "payment/paypal_api/languages/lang." . $name . ".admin.php")) { include_once CLASSPATH . "payment/paypal_api/languages/lang." . $name . ".admin.php"; } else { include_once CLASSPATH . "payment/paypal_api/languages/lang.english.admin.php"; } ?> <a href="<?php echo PAYPAL_API_PAYPAL_LOGOCENTERURL; ?> " target="_blank" title="Visit the Logo Center"> <img align="left" style="margin-left: 220px;" src="<?php echo PAYPAL_API_PAYPAL_LOGOSRC; ?> " alt="PayPal Logo" border="0" /><?php echo PAYPAL_API_PAYPAL_LOGOCENTER; ?> </a> <table class="adminform"> <tr class="row1"> <td><strong><?php echo PAYPAL_API_TEXT_USERNAME; ?> </strong></td> <td> <input type="text" name="PAYPAL_API_API_USERNAME" class="inputbox" size="50" value="<?php echo PAYPAL_API_API_USERNAME; ?> " /> </td> <td><?php echo $VM_LANG->_(PAYPAL_API_TEXT_USERNAME_EXPLAIN); ?> </td> </tr> <tr class="row0"> <td><strong><?php echo PAYPAL_API_TEXT_PASSWORD; ?> </strong></td> <td> <input type="text" name="PAYPAL_API_API_PASSWORD" class="inputbox" size="50" value="<?php echo PAYPAL_API_API_PASSWORD; ?> " /> </td> <td><?php echo vmtooltip(PAYPAL_API_TEXT_PASSWORD_EXPLAIN); ?> </td> </tr> <tr class="row1"> <td><strong><?php echo PAYPAL_API_TEXT_SIGNATURE; ?> </strong></td> <td> <input type="text" name="PAYPAL_API_API_SIGNATURE" class="inputbox" size="50" value="<?php echo PAYPAL_API_API_SIGNATURE; ?> " /> </td> <td><?php echo vmtooltip(PAYPAL_API_TEXT_SIGNATURE_EXPLAIN); ?> </td> </tr> <tr class="row0"> <td><strong><?php echo PAYPAL_API_TEXT_IMAGE_URL; ?> </strong></td> <td> <input type="text" name="PAYPAL_API_IMAGEURL" class="inputbox" size="100" value="<?php echo constant('PAYPAL_API_IMAGEURL') ? constant('PAYPAL_API_IMAGEURL') : $vendor_image_url; ?> " /> </td> <td><?php echo vmtooltip(PAYPAL_API_TEXT_IMAGE_URL_EXPLAIN); ?> </td> </tr> <tr class="row1"> <td><strong><?php echo PAYPAL_API_TEXT_PAYMENTTYPE; ?> </strong></td> <td> <select name="PAYPAL_API_PAYMENTTYPE" class="inputbox" > <option <?php if (@PAYPAL_API_PAYMENTTYPE == 'Sale') { echo "selected=\"selected\""; } ?> value="Sale"><?php echo PAYPAL_API_TEXT_PAYMENTTYPE_SALE; ?> </option> <option <?php if (@PAYPAL_API_PAYMENTTYPE == 'Authorization') { echo "selected=\"selected\""; } ?> value="Authorization"><?php echo PAYPAL_API_TEXT_PAYMENTTYPE_AUTHORIZATION; ?> </option> </select> </td> <td><?php echo vmtooltip(PAYPAL_API_TEXT_PAYMENTTYPE_EXPLAIN); ?> </td> </tr> <!--<tr class="row1"> <td><strong><?php echo PAYPAL_API_TEXT_SET_CERTIFICATE; ?> </strong></td> <td> <input type="text" name="PAYPAL_API_CERTIFICATE" class="inputbox" size="100" value="<?php echo @constant('PAYPAL_API_CERTIFICATE'); ?> " /> </td> <td><?php echo vmtooltip(PAYPAL_API_TEXT_SET_CERTIFICATE_EXPLAIN); ?> </td> </tr>--> <tr class="row0"> <td><strong><?php echo PAYPAL_API_CVV_TEXT; ?> </strong></td> <td> <?php $options = array('YES' => PAYPAL_API_TEXT_YES, 'NO' => PAYPAL_API_TEXT_NO); ps_html::dropdown_display('PAYPAL_API_CHECK_CARD_CODE', PAYPAL_API_CHECK_CARD_CODE, $options); ?> </td> <td><?php echo vmtooltip(PAYPAL_API_CVV_TEXT_EXPLAIN); ?> </td> </tr> <tr class="row1"> <td><strong><?php echo PAYPAL_API_TEXT_USE_SHIPPING; ?> </strong></td> <td> <?php $options = array('1' => PAYPAL_API_TEXT_YES, '0' => PAYPAL_API_TEXT_NO); ps_html::dropdown_display('PAYPAL_API_USE_SHIPPING', PAYPAL_API_USE_SHIPPING, $options); ?> </td> <td><?php echo vmtooltip(PAYPAL_API_TEXT_USE_SHIPPING_EXPLAIN); ?> </td> </tr> <tr class="row0"><td><strong><?php echo PAYPAL_API_TEXT_CART_BUTTON; ?> </strong></td> <td><select name="PAYPAL_API_CART_BUTTON_ON" class="inputbox"> <option <?php if (@PAYPAL_API_CART_BUTTON_ON == '1') { echo "selected=\"selected\""; } ?> value="1"> <?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES'); ?> </option> <option <?php if (@PAYPAL_API_CART_BUTTON_ON != '1') { echo "selected=\"selected\""; } ?> value="0"> <?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO'); ?> </option> </select> </td> <td><?php echo PAYPAL_API_TEXT_CART_BUTTON_EXPLAIN; ?> </td> </tr> <tr class="row1"><td><strong><?php echo PAYPAL_API_TEXT_DIRECT_PAYMENT_ON; ?> </strong></td> <td><select name="PAYPAL_API_DIRECT_PAYMENT_ON" class="inputbox"> <option <?php if (@PAYPAL_API_DIRECT_PAYMENT_ON == '1') { echo "selected=\"selected\""; } ?> value="1"> <?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES'); ?> </option> <option <?php if (@PAYPAL_API_DIRECT_PAYMENT_ON != '1') { echo "selected=\"selected\""; } ?> value="0"> <?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO'); ?> </option> </select> </td> <td><?php echo PAYPAL_API_TEXT_DIRECT_PAYMENT_EXPLAIN; ?> </td> </tr> <tr class="row0"> <td><strong><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYPAL_ONLYVERIFIED'); ?> </strong></td> <td> <select name="PAYPAL_API_VERIFIED_ONLY" class="inputbox" > <option <?php if (@PAYPAL_API_VERIFIED_ONLY != '1') { echo "selected=\"selected\""; } ?> value="0"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO'); ?> </option> <option <?php if (@PAYPAL_API_VERIFIED_ONLY == '1') { echo "selected=\"selected\""; } ?> value="1"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES'); ?> </option> </select> </td> <td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYPAL_ONLYVERIFIED_EXPLAIN'); ?> </td> </tr> <tr class="row1"> <td><strong><?php echo PAYPAL_API_TEXT_STATUS_SUCCESS; ?> </strong></td> <td> <select name="PAYPAL_API_VERIFIED_STATUS" class="inputbox" > <?php $q = "SELECT order_status_name,order_status_code FROM #__{vm}_order_status ORDER BY list_order"; $db->query($q); $order_status_code = array(); $order_status_name = array(); while ($db->next_record()) { $order_status_code[] = $db->f("order_status_code"); $order_status_name[] = $db->f("order_status_name"); } for ($i = 0; $i < sizeof($order_status_code); $i++) { echo "<option value=\"" . $order_status_code[$i]; if (PAYPAL_API_VERIFIED_STATUS == $order_status_code[$i]) { echo "\" selected=\"selected\">"; } else { echo "\">"; } echo $order_status_name[$i] . "</option>\n"; } ?> </select> </td> <td><?php echo PAYPAL_API_TEXT_STATUS_SUCCESS_EXPLAIN; ?> </td> </tr> <tr class="row0"> <td><strong><?php echo PAYPAL_API_TEXT_STATUS_PENDING; ?> </strong></td> <td> <select name="PAYPAL_API_PENDING_STATUS" class="inputbox" > <?php for ($i = 0; $i < sizeof($order_status_code); $i++) { echo "<option value=\"" . $order_status_code[$i]; if (PAYPAL_API_PENDING_STATUS == $order_status_code[$i]) { echo "\" selected=\"selected\">"; } else { echo "\">"; } echo $order_status_name[$i] . "</option>\n"; } ?> </select> </td> <td><?php echo PAYPAL_API_TEXT_STATUS_PENDING_EXPLAIN; ?> </td> </tr> <tr class="row1"> <td><strong><?php echo PAYPAL_API_TEXT_STATUS_FAILED; ?> </strong></td> <td> <select name="PAYPAL_API_INVALID_STATUS" class="inputbox" > <?php for ($i = 0; $i < sizeof($order_status_code); $i++) { echo "<option value=\"" . $order_status_code[$i]; if (PAYPAL_API_INVALID_STATUS == $order_status_code[$i]) { echo "\" selected=\"selected\">"; } else { echo "\">"; } echo $order_status_name[$i] . "</option>\n"; } ?> </select> </td> <td><?php echo PAYPAL_API_TEXT_STATUS_FAILED_EXPLAIN; ?> </td> </tr> <tr class="row0"> <td><strong><?php echo PAYPAL_API_TEXT_ENABLE_SANDBOX; ?> </strong></td> <td> <?php $options = array('1' => PAYPAL_API_TEXT_YES, '0' => PAYPAL_API_TEXT_NO); ps_html::dropdown_display('PAYPAL_API_DEBUG', PAYPAL_API_DEBUG, $options); ?> </td> <td><?php echo vmtooltip(PAYPAL_API_TEXT_ENABLE_SANDBOX_EXPLAIN); ?> </td> </tr> <tr class="row1"><td><strong><?php echo PAYPAL_API_DEBUG_TEXT; ?> </strong></td> <td><select name="PP_WPP_ERRORS" class="inputbox" > <option <?php if (@PAYPAL_API_DEBUG == '1') { echo "selected=\"selected\""; } ?> value="1"> <?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES'); ?> </option> <option <?php if (@PAYPAL_API_DEBUG != '1') { echo "selected=\"selected\""; } ?> value="0"> <?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO'); ?> </option> </select> </td> <td><?php echo PAYPAL_API_DEBUG_TEXT_EXPLAIN; ?> </td> </tr> </table> <?php }
echo ps_html::list_template_files("conf_CATEGORY_TEMPLATE", 'browse', CATEGORY_TEMPLATE); ?> </td> <td><?php echo vmToolTip($VM_LANG->_('PHPSHOP_ADMIN_CFG_CATEGORY_TEMPLATE_EXPLAIN')); ?> </td> </tr> <tr> <td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_FLYPAGE'); ?> </td> <td> <?php echo ps_html::list_template_files("conf_FLYPAGE", 'product_details', str_replace('shop.', '', FLYPAGE)); ?> </td> <td><?php echo vmToolTip($VM_LANG->_('PHPSHOP_ADMIN_CFG_FLYPAGE_EXPLAIN')); ?> </td> </tr> <?php if (function_exists('imagecreatefromjpeg')) { ?> <tr> <td class="labelcell"> <label for="conf_PSHOP_IMG_RESIZE_ENABLE"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_DYNAMIC_THUMBNAIL_RESIZING');
/** * Prints a drop-down list with all affiliates * * @param unknown_type $affiliate_active */ function get_affiliate_list($affiliate_active = 'Y') { global $ps_vendor_id; $db = new ps_DB(); $i = 0; //get the affiliate id from affiliate table for this user $q = "SELECT affiliate_id,first_name,last_name,name,username FROM #__{vm}_affiliate, #__users"; $q .= " WHERE #__{vm}_affiliate.user_id = #__users.user_info_id"; if ($affiliate_active == 'Y') { $q .= " AND active = 'Y' "; } $db->query($q); $array['*'] = '*'; while ($db->next_record()) { $i++; $array[$db->f("affiliate_id")] = $db->f("first_name") . " " . $db->f("first_name") . " (" . $db->f("username") . ")"; } if (!$i) { $array[''] = '---------------------- No Affiliates to Display ------------------'; } echo ps_html::selectList('affiliate_id', '', $array); }
/** * Creates a Drop Down - List of Credit Card Records * * @param int $payment_method_id */ function creditcard_selector($payment_method_id = "") { $db = new ps_DB(); /*** Select all credit card records ***/ if (empty($payment_method_id)) { $q = "SELECT creditcard_name, creditcard_id,creditcard_code FROM #__{vm}_creditcard WHERE vendor_id='" . $_SESSION['ps_vendor_id'] . "'"; } else { $q = 'SELECT accepted_creditcards FROM #__{vm}_payment_method WHERE payment_method_id=' . (int) $payment_method_id; $db->query($q); $db->next_record(); $cc_array = explode(",", $db->f("accepted_creditcards")); $q = "SELECT creditcard_name,creditcard_id,creditcard_code FROM #__{vm}_creditcard WHERE vendor_id='" . $_SESSION['ps_vendor_id'] . "' AND ("; foreach ($cc_array as $idx => $creditcard_id) { $q .= "creditcard_id='{$creditcard_id}' "; if ($idx + 1 < sizeof($cc_array)) { $q .= "OR "; } else { $q .= ")"; } } } $db->query($q); while ($db->next_record()) { $array[$db->f("creditcard_code")] = $db->f("creditcard_name"); } echo ps_html::selectList('creditcard_code', '', $array); }
</table> </div> <div id="divAgeVerification" > <table class="adminform"> <tr class="row1"> <td class="labelcell"><?php echo $VM_LANG->_('VM_FIELDS_AGEVERIFICATION_MINIMUM'); ?> :</td> <td ><?php $min_age = is_a($params, 'vmparameters') ? $params->get('minimum_age', 18) : 18; $ages = array(); for ($i = 13; $i <= 25; $i++) { $ages[$i] = $i . ' ' . $VM_LANG->_('CMN_YEARS'); } ps_html::dropdown_display('minimum_age', $min_age, $ages); ?> </td> </tr> </table> </div> <div id="divWeb"> <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform"> <tr class="row1"> <td width="20%"><?php echo $VM_LANG->_('VM_FIELDMANAGER_TYPE'); ?> :</td> <td width="20%"><?php echo $lists['webaddresstypes']; ?>
<table class="adminform"> <tr class="row1"> <td style="vertical-align:top;"><br /> <?php echo $VM_LANG->_('VM_PRODUCT_RELATED_SEARCH'); ?> <input type="text" size="40" name="search" id="relatedProductSearch" value="" /> </td> <td><input type="button" name="remove_related" onclick="removeSelectedOptions(relatedSelection, 'related_products');" value=" < " /></td> <td> <?php $relProducts = array(); foreach ($related_products as $relProd) { $relProducts[$relProd] = $ps_product->get_field($relProd, 'product_name'); } echo ps_html::selectList('relProds', '', $relProducts, 10, 'multiple="multiple"', 'id="relatedSelection" ondblclick="removeSelectedOptions(relatedSelection, \'related_products\');"'); ?> <input type="hidden" name="related_products" value="<?php echo implode('|', $related_products); ?> " /> </td> </tr> </table> <!-- Changed Product Type - Begin --> <?php $tabs->endTab(); // Get Product Types $dba = new ps_DB(); ################################ # Alatis Mod
} ?> <tr> <td width="35%" align="right"> <?php echo $VM_LANG->_($field->title) ? $VM_LANG->_($field->title) : $field->title; ?> :</td> <td width="65%" align="left"><?php switch ($field->name) { case 'country': $country = new ps_country(); $dbc = $country->get_country_by_code($dbt->f($field->name)); $country_id = $dbt->f($field->name); //if ($dbc !== false) // echo $dbc->f('country_name'); $ps_html = new ps_html(); $onchange = "onchange=\"changeStateList();\""; $ps_html->list_country("country", $country_id, "id=\"country_field\" {$onchange}"); break; case 'state': $country = new ps_country(); $state = $dbt->f($field->name); $dbc = $country->get_state_by_code($state, $country_id); //if ($dbc !== false) // echo $dbc->f('state_name'); echo $ps_html->dynamic_state_lists("country", "state", $country_id, $state); break; default: $fieldvalue = $dbt->f($field->name); if (0) { echo " ";
/** * Creates a list of Vendor Categories in a HTML SELECT LIST. * * @param int $vendor_category_id */ function list_category($vendor_category_id = 0) { global $VM_LANG; $db = new ps_DB(); $q = "SELECT count(*) as rowcnt FROM #__{vm}_vendor_category ORDER BY vendor_category_name"; $db->query($q); $db->next_record(); $rowcnt = $db->f("rowcnt"); $q = "SELECT vendor_category_id,vendor_category_name \n\t\t\t\tFROM #__{vm}_vendor_category \n\t\t\t\tORDER BY vendor_category_name"; $db->query($q); $array = array('0' => $VM_LANG->_('PHPSHOP_SELECT')); while ($db->next_record()) { $array[$db->f("vendor_category_id")] = $db->f("vendor_category_name"); } ps_html::dropdown_display('vendor_category_id', $vendor_category_id, $array); }
/** * @param string The name of the form element * @param string The value of the element * @param object The xml element for the parameter * @param string The control name * @return string The html for the element */ function _form_radio($name, $value, &$node, $control_name) { $options = array(); foreach ($node->childNodes as $option) { $val = $option->getAttribute('value'); $text = $option->gettext(); $options[$val] = $text; } return ps_html::radioList($control_name . '[' . $name . ']', $value, $options); }
/** * lists all Product Types * * @param int $product_type_id * @param int $list_order * @return string */ function list_order($product_type_id = '0', $list_order = 0) { $db = new ps_DB(); if (!$product_type_id) { return $GLOBALS['VM_LANG']->_('CMN_NEW_ITEM_LAST'); } else { $q = "SELECT product_type_list_order,product_type_name FROM #__{vm}_product_type "; if ($product_type_id) { $q .= 'WHERE product_type_id=' . $product_type_id; } $q .= " ORDER BY product_type_list_order ASC"; $db->query($q); $array = array(); while ($db->next_record()) { $array[$db->f("product_type_list_order")] = $db->f("product_type_list_order") . ". " . $db->f("product_type_name"); } return ps_html::selectList('list_order', $list_order, $array); } }
/** * Creates a list of Manufacturer Categories to be used in a drop down list * * @param int $mf_category_id */ function list_category($mf_category_id = '0') { global $VM_LANG; $db = new ps_DB(); $q = "SELECT count(*) as rowcnt FROM #__{vm}_manufacturer_category ORDER BY mf_category_name"; $db->query($q); $db->next_record(); $rowcnt = $db->f("rowcnt"); $q = "SELECT * FROM #__{vm}_manufacturer_category ORDER BY mf_category_name"; $db->query($q); $array = array(); if ($rowcnt > 1) { $array[0] = $VM_LANG->_('PHPSHOP_SELECT'); } while ($db->next_record()) { $array[$db->f("mf_category_id")] = $db->f("mf_category_name"); } ps_html::dropdown_display('mf_category_id', $mf_category_id, $array); }
/** * prints the HTML code of selectable carrier list * * @param unknown_type $select_name * @param unknown_type $selected_carrier_id */ function carrier_list($select_name, $selected_carrier_id) { global $VM_LANG; $db = new ps_DB(); $carrier_arr[''] = $VM_LANG->_('PHPSHOP_SELECT'); $q = "SELECT shipping_carrier_id,shipping_carrier_name FROM #__{vm}_shipping_carrier"; // Get list of Values $db->query($q); while ($db->next_record()) { $carrier_arr[$db->f("shipping_carrier_id")] = $db->f("shipping_carrier_name"); } echo ps_html::selectList($select_name, $selected_carrier_id, $carrier_arr); }
/** * creates a HTML List of the tax values * * @param string $select_name the name of the select form * @param int $selected_value_id ID of the selected Item * @param string $on_change * @return array An array with all Tax Rates */ function list_tax_value($select_name, $selected_value_id, $on_change = '') { global $VM_LANG; $db = new ps_DB(); // Get list of Values $q = "SELECT `tax_rate_id`, `tax_rate` FROM `#__{vm}_tax_rate` ORDER BY `tax_rate` DESC, `tax_rate_id` ASC"; $db->query($q); if ($on_change != '') { $on_change = " onchange=\"{$on_change}\""; } $ratesArr[0] = $VM_LANG->_('PHPSHOP_INFO_MSG_VAT_ZERO_LBL'); $tax_rates = array(); while ($db->next_record()) { $tax_rates[$db->f("tax_rate_id")] = $db->f("tax_rate"); $ratesArr[$db->f("tax_rate_id")] = $db->f("tax_rate_id") . " (" . $db->f("tax_rate") * 100 . "%)"; } ps_html::dropdown_display($select_name, $selected_value_id, $ratesArr, 1, '', $on_change); return $tax_rates; }
$method_array = array(); if (file_exists(CLASSPATH . $classfile)) { require_once CLASSPATH . $classfile; $class = str_replace('.class', '', $class); $methods = get_class_methods($class); if (empty($methods)) { $methods = get_class_methods('vm' . $class); } foreach ($methods as $method) { if ($method == $class) { continue; } $method_array[$method] = $method; } } vmConnector::sendHeaderAndContent(200, ps_html::selectList('function_method', $function, $method_array)); break; case 'checkforupdate': require_once CLASSPATH . 'update.class.php'; $result = vmUpdate::checkLatestVersion(); if (!empty($result)) { // Convert a String like "1.1.1" => "1.11", so we can use it as float in Javascript $version_as_float = substr($result, 0, 3) . substr($result, 4); $version_as_json = '{version_string:"' . $result . '",version:"' . $version_as_float . '"}'; vmConnector::sendHeaderAndContent('200', $version_as_json); } else { vmConnector::sendHeaderAndContent('200', 'Connection Failed'); } default: die; }
function pane_content($tab) { global $VM_LANG; if (vmGet($_REQUEST, 'order_edit_page') == '1') { ?> <script type="text/javascript"> var current = document.getElementById( "order_edit_page" ); current.tabPage.select(); </script> <?php } if (vmGet($_REQUEST, 'delete_product') != '') { $this->delete_product(); } elseif (vmGet($_REQUEST, 'add_product') != '') { $this->add_product(); } elseif (vmGet($_REQUEST, 'update_quantity') != '') { $this->update_quantity(); } elseif (vmGet($_REQUEST, 'update_coupon_discount') != '') { $this->update_coupon_discount(); } elseif (vmGet($_REQUEST, 'update_discount') != '') { $this->update_discount(); } elseif (vmGet($_REQUEST, 'update_standard_shipping') != '') { $this->update_standard_shipping(); } elseif (vmGet($_REQUEST, 'update_shipping') != '') { $this->update_shipping(); } elseif (vmGet($_REQUEST, 'update_bill_to') != '') { $this->update_bill_to(); } elseif (vmGet($_REQUEST, 'update_ship_to') != '') { $this->update_ship_to(); } elseif (vmGet($_REQUEST, 'update_shipping_tax') != '') { } ?> <form method="post" name="editForm" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <table class="adminlist"> <tr> <th><?php echo $VM_LANG->_('VM_ORDER_EDIT_EDIT_ORDER'); ?> </th> </tr> </table> <table class="adminlist"> <tr> <th><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SKU'); ?> </th> <th><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_NAME'); ?> </th> <th width="5%" align="left"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_QUANTITY'); ?> </th> <th width="5%" align="left" colspan="2"><?php echo $VM_LANG->_('VM_ORDER_EDIT_ACTIONS'); ?> </th> </tr> <?php $dbt = new ps_DB(); $db = new ps_DB(); $qt = "SELECT order_item_id, product_quantity,order_item_name,order_item_sku FROM `#__{vm}_order_item`" . "WHERE #__{vm}_order_item.order_id='" . $this->order_id . "' "; $q = "SELECT * FROM #__{vm}_orders WHERE order_id='" . $this->order_id . "'"; $dbt->query($qt); $db->query($q); $db->next_record(); $i = 0; $rate_details = explode("|", $db->f("ship_method_id")); while ($dbt->next_record()) { if ($i++ % 2) { $bgcolor = 'row0'; } else { $bgcolor = 'row1'; } ?> <tr class="<?php echo $bgcolor; ?> " valign="top"> <td><?php $dbt->p("order_item_sku"); ?> </td> <td><?php $dbt->p("order_item_name"); ?> </td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="text" value="<?php $dbt->p("product_quantity"); ?> " name="product_quantity" size="5" /> </td> <td align="left"> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_quantity" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_item_id" value="<?php $dbt->p("order_item_id"); ?> " /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_DELETE'); ?> " src="<?php echo IMAGEURL; ?> ps_image/delete_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_DELETE'); ?> " /> <input type="hidden" value="1" name="delete_product" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_item_id" value="<?php $dbt->p("order_item_id"); ?> " /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> <?php } ?> </table> <table class="adminlist"> <tr> <th><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING') . " & " . $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT'); ?> </th> <th width="5%" align="left"> </th> <th width="5%" align="left" colspan="1"><?php echo $VM_LANG->_('VM_ORDER_EDIT_ACTIONS'); ?> </th> </tr> <?php if ($db->f('ship_method_id') == "" or preg_match('/^standard_shipping/', $db->f('ship_method_id'))) { ?> <tr> <td align="right"><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING'); ?> : </strong></td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <?php $dbs = new ps_DB(); $q = 'SELECT shipping_rate_id, shipping_rate_name, shipping_rate_weight_start, shipping_rate_weight_end, shipping_rate_value, shipping_rate_package_fee, tax_rate, currency_name FROM #__{vm}_shipping_rate, #__{vm}_currency, #__{vm}_tax_rate WHERE currency_id = shipping_rate_currency_id AND ( tax_rate_id = shipping_rate_vat_id OR shipping_rate_vat_id = 0 ) ORDER BY shipping_rate_list_order'; $dbs->query($q); while ($dbs->next_record()) { $rates[$dbs->f('shipping_rate_id')] = $dbs->f('shipping_rate_name') . "; (" . $dbs->f('shipping_rate_weight_start') . " - " . $dbs->f('shipping_rate_weight_end') . "); " . " " . ($dbs->f('shipping_rate_value') * (1 + $dbs->f('tax_rate')) + $dbs->f('shipping_rate_package_fee')) . " " . $dbs->f('currency_name'); } ps_html::dropdown_display('shipping', $rate_details[4], $rates); ?> </select> </td> <td> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_standard_shipping" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> <?php } else { ?> <tr> <td align="right"><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING'); ?> : </strong></td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="text" value="<?php $db->p("order_shipping"); ?> " size="5" name="order_shipping" /> </td> <td> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_shipping" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> <tr> <td align="right"><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_TAX'); ?> : </strong></td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="text" value="<?php $db->p("order_shipping_tax"); ?> " name="order_shipping_tax" size="5" /> </td> <td> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_shipping_tax" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> <?php } ?> <tr> <td align="right"><strong><?php echo $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT'); ?> : </strong></td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="text" value="<?php $db->p("coupon_discount"); ?> " size="5" name="coupon_discount" /> </td> <td> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_coupon_discount" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> <tr> <td align="right"><strong><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT'); ?> : </strong></td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="text" value="<?php $db->p("order_discount"); ?> " size="5" name="order_discount" /> </td> <td> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_discount" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> </table> <table class="adminlist"> <tr> <th><?php echo $VM_LANG->_('PHPSHOP_USER_FORM_BILLTO_LBL') . " & " . $VM_LANG->_('PHPSHOP_USER_FORM_SHIPTO_LBL'); ?> </th> <th width="5%" align="left"> </th> <th width="5%" align="left" colspan="1"><?php echo $VM_LANG->_('VM_ORDER_EDIT_ACTIONS'); ?> </th> </tr> <tr> <td align="right"><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_BILL_TO_LBL'); ?> : </strong></td> <td align="right"> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <select name="bill_to"> <?php $dbs = new ps_DB(); $q = "SELECT user_id, last_name, first_name FROM #__{vm}_user_info WHERE address_type = 'BT' ORDER BY last_name ASC"; $dbs->query($q); while ($dbs->next_record()) { if (!is_null($dbs->f('last_name'))) { print '<option value="' . $dbs->f('user_id') . '"'; if ($dbs->f('user_id') == $db->f("user_id")) { print " selected "; } print '>'; print $dbs->f('last_name'); print ", " . $dbs->f('first_name'); print '</option>'; } } ?> </select> </td> <td> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_bill_to" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> <?php /* Change ship to form */ ?> <tr> <td align="right"><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIP_TO_LBL'); ?> : </strong></td> <td align="right"> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <select name="ship_to"> <?php $dbs = new ps_DB(); $q = "SELECT user_info_id, address_type_name FROM #__{vm}_user_info WHERE user_id = '" . $db->f("user_id") . "' ORDER BY address_type_name ASC"; $dbs->query($q); while ($dbs->next_record()) { if (!is_null($dbs->f('user_info_id'))) { print '<option value="' . $dbs->f('user_info_id') . '">'; print $dbs->f('address_type_name'); print '</option>'; } } ?> </select> </td> <td> <input type="image" title="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " src="<?php echo VM_THEMEURL; ?> images/edit_f2.gif" border="0" alt="<?php echo $VM_LANG->_('PHPSHOP_UPDATE'); ?> " /> <input type="hidden" value="1" name="update_ship_to" /> <input type="hidden" name="order_edit_page" value="1" /> <input type="hidden" name="page" value="order.order_print" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="func" value="" /> <input type="hidden" name="order_id" value="<?php echo $this->order_id; ?> " /> </form> </td> </tr> </table> <?php $this->display_form_add_product(); ?> <?php }
/** * This allows us to print the user fields on * the various sections of the shop * * @param array $rowFields An array returned from ps_database::loadObjectlist * @param array $skipFields A one-dimensional array holding the names of fields that should NOT be displayed * @param ps_DB $db A ps_DB object holding ovalues for the fields * @param boolean $startform If true, print the starting <form...> tag */ function listUserFields($rowFields, $skipFields = array(), $db = null, $startForm = true) { global $mm_action_url, $ps_html, $VM_LANG, $my, $default, $mainframe, $vm_mainframe, $vendor_country_3_code, $mosConfig_live_site, $mosConfig_absolute_path, $page; $dbf = new ps_DB(); if ($db === null) { $db = new ps_DB(); } $default['country'] = $vendor_country_3_code; $missing = vmGet($_REQUEST, 'missing', ''); // collect all required fields $required_fields = array(); foreach ($rowFields as $field) { if ($field->required == 1) { $required_fields[$field->name] = $field->type; } $allfields[$field->name] = $field->name; } foreach ($skipFields as $skip) { unset($required_fields[$skip]); } // Form validation function if (!vmIsAdminMode()) { ps_userfield::printJS_formvalidation($required_fields, $rowFields); } else { echo vmCommonHTML::scriptTag('', 'function submitregistration() { return true }'); } if (file_exists($mosConfig_absolute_path . '/includes/js/mambojavascript.js')) { $vm_mainframe->addScript('includes/js/mambojavascript.js'); } if ($startForm) { echo '<form action="' . $mm_action_url . basename($_SERVER['PHP_SELF']) . '" method="post" name="adminForm">'; } echo ' <div style="width:90%;">'; if (!empty($required_fields)) { echo '<div style="padding:5px;text-align:center;"><strong>(* = ' . $VM_LANG->_('CMN_REQUIRED') . ')</strong></div>'; } $delimiter = 0; foreach ($rowFields as $field) { if (!isset($default[$field->name])) { $default[$field->name] = $field->default; } $readonly = $field->readonly ? ' readonly="readonly"' : ''; if (in_array($field->name, $skipFields)) { continue; } // Title handling. $key = $field->title; if ($key[0] == '_') { $key = substr($key, 1, strlen($key) - 1); } if ($VM_LANG->exists($key)) { $field->title = $VM_LANG->_($key); } if ($field->name == 'agreed') { $field->title = '<script type="text/javascript">//<![CDATA[ document.write(\'<label for="agreed_field">' . str_replace("'", "\\'", $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS')) . '</label><a href="javascript:void window.open(\\\'' . $mosConfig_live_site . '/index2.php?option=com_virtuemart&page=shop.tos&pop=1\\\', \\\'win2\\\', \\\'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no\\\');">\'); document.write(\' (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ')</a>\'); //]]></script> <noscript> <label for="agreed_field">' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '</label> <a target="_blank" href="' . $mosConfig_live_site . '/index.php?option=com_virtuemart&page=shop.tos" title="' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '"> (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ') </a></noscript>'; } if ($field->name == 'username' && VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') { echo '<div class="formLabel"> <input type="checkbox" id="register_account" name="register_account" value="1" class="inputbox" onchange="showFields( this.checked, new Array(\'username\', \'password\', \'password2\') );if( this.checked ) { document.adminForm.remember.value=\'yes\'; } else { document.adminForm.remember.value=\'yes\'; }" checked="checked" /> </div> <div class="formField"> <label for="register_account">' . $VM_LANG->_('VM_REGISTER_ACCOUNT') . '</label> </div> '; } elseif ($field->name == 'username') { echo '<input type="hidden" id="register_account" name="register_account" value="1" />'; } // a delimiter marks the beginning of a new fieldset and // the end of a previous fieldset if ($field->type == 'delimiter') { if ($delimiter > 0) { echo "</fieldset>\n"; } if (VM_REGISTRATION_TYPE == 'SILENT_REGISTRATION' && $field->title == $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_INFO_LBL') && $page == 'checkout.index') { continue; } echo '<fieldset> <legend class="sectiontableheader">' . $field->title . '</legend> '; $delimiter++; continue; } echo '<div id="' . $field->name . '_div" class="formLabel '; if (stristr($missing, $field->name)) { echo 'missing'; } echo '">'; echo '<label for="' . $field->name . '_field">' . $field->title . '</label>'; if (isset($required_fields[$field->name])) { echo '<strong>* </strong>'; } echo ' </div> <div class="formField" id="' . $field->name . '_input">' . "\n"; /** * This is the most important part of this file * Here we print the field & its contents! */ switch ($field->name) { case 'title': $ps_html->list_user_title($db->sf('title'), "id=\"title_field\""); break; case 'country': if (in_array('state', $allfields)) { $onchange = "onchange=\"changeStateList();\""; } else { $onchange = ""; } $ps_html->list_country("country", $db->sf('country'), "id=\"country_field\" {$onchange}"); break; case 'state': echo $ps_html->dynamic_state_lists("country", "state", $db->sf('country'), $db->sf('state')); echo "<noscript>\n"; $ps_html->list_states("state", $db->sf('state'), "", "id=\"state_field\""); echo "</noscript>\n"; break; case 'agreed': echo '<input type="checkbox" id="agreed_field" name="agreed" value="1" class="inputbox" />'; break; case 'password': case 'password2': echo '<input type="password" id="' . $field->name . '_field" name="' . $field->name . '" size="30" class="inputbox" />' . "\n"; break; default: switch ($field->type) { case 'date': echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/calendar.js'); if (vmIsJoomla('1.5', '>=')) { // in Joomla 1.5, the name of calendar lang file is changed... echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en-GB.js'); } else { echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en.js'); } echo vmCommonHTML::linkTag($mosConfig_live_site . '/includes/js/calendar/calendar-mos.css'); $maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : ''; echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n"; echo '<input name="reset" type="reset" class="button" onclick="return showCalendar(\'' . $field->name . '_field\', \'y-mm-dd\');" value="..." />'; break; case 'text': case 'emailaddress': case 'webaddress': case 'euvatid': $maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : ''; echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n"; break; case 'textarea': echo '<textarea name="' . $field->name . '" id="' . $field->name . '_field" cols="' . $field->cols . '" rows="' . $field->rows . '" ' . $readonly . '>' . $db->sf($field->name) . '</textarea>'; break; case 'editorta': editorArea($field->name, $db->sf($field->name), $field->name, '300', '150', $field->cols, $field->rows); break; case 'checkbox': echo '<input type="checkbox" name="' . $field->name . '" id="' . $field->name . '_field" value="1" ' . ($db->sf($field->name) ? 'checked="checked"' : '') . '/>'; break; case 'age_verification': $year = vmRequest::getInt('birthday_selector_year', date('Y')); if ($db->f($field->name)) { $birthday = $db->f($field->name); $date_array = explode('-', $birthday); $year = $date_array[0]; $month = $date_array[1]; $day = $date_array[2]; } ps_html::list_days('birthday_selector_day', vmRequest::getInt('birthday_selector_day', @$day)); ps_html::list_month('birthday_selector_month', vmRequest::getInt('birthday_selector_month', @$month)); ps_html::list_year('birthday_selector_year', $year, $year - 100, $year); break; case 'captcha': if (file_exists($mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php')) { include $mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php'; // Note that this package name must be used on the validation side too! If both are not equal, validation will fail $packageName = 'securityVMRegistrationCheck'; echo insertSecurityImage($packageName); echo getSecurityImageText($packageName); } else { if (file_exists($mosConfig_absolute_path . '/plugins/system/securityimages.php')) { echo "<script type=\"text/javascript\" src=\"" . JURI::root() . "/components/com_securityimages/js/securityImages.js\"></script>"; echo "<img id='captchaSecurityImages' name='captchaSecurityImages' src=\"" . JURI::root() . "/index.php?option=com_securityimages&task=displayCaptcha\" />"; echo "<a href=\"javascript:askNewSecurityImages('captchaSecurityImages');\">"; echo "<img src=\"" . JURI::root() . "/components/com_securityimages/buttons/reload.gif\" id=\"securityImagesContactCaptchaReload\" name=\"securityImagesContactCaptchaReload\" border=\"0\">"; echo "</a>"; echo "<input type=\"text\" name=\"securityVMRegistrationCheck_try\" />"; } } break; // Begin of a fallthrough // Begin of a fallthrough case 'multicheckbox': case 'select': case 'multiselect': case 'radio': $k = $db->f($field->name); $dbf->setQuery("SELECT fieldtitle,fieldvalue FROM #__{vm}_userfield_values" . "\n WHERE fieldid = " . $field->fieldid . "\n ORDER BY ordering"); $Values = $dbf->loadObjectList(); $multi = ""; $rowFieldValues['lst_' . $field->name] = ''; if ($field->type == 'multiselect') { $multi = "multiple='multiple'"; } if (count($Values) > 0) { if ($field->type == 'radio') { $rowFieldValues['lst_' . $field->name] = vmCommonHTML::radioListTable($Values, $field->name, 'class="inputbox" size="1" ', 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required); } else { $ks = explode("|*|", $k); $k = array(); foreach ($ks as $kv) { $k[]->fieldvalue = $kv; } if ($field->type == 'multicheckbox') { $rowFieldValues['lst_' . $field->name] = vmCommonHTML::checkboxListTable($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required); } else { $rowFieldValues['lst_' . $field->name] = vmCommonHTML::selectList($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k); } } } // no break! still a fallthrough echo $rowFieldValues['lst_' . $field->name]; break; } break; } if ($field->description != '') { echo vmToolTip($field->description); } echo '<br /></div> <br style="clear:both;" />'; } if ($delimiter > 0) { echo "</fieldset>\n"; } echo '</div>'; if (VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') { echo '<script type="text/javascript"> function showFields( show, fields ) { if( fields ) { for (i=0; i<fields.length;i++) { if( show ) { document.getElementById( fields[i] + \'_div\' ).style.display = \'\'; document.getElementById( fields[i] + \'_input\' ).style.display = \'\'; } else { document.getElementById( fields[i] + \'_div\' ).style.display = \'none\'; document.getElementById( fields[i] + \'_input\' ).style.display = \'none\'; } } } } try { showFields( document.getElementById( \'register_account\').checked, new Array(\'username\', \'password\', \'password2\') ); } catch(e){} </script>'; } }
/** * Funtion to create a select list holding all files for a special template section (e.g. order_emails) * * @param string $name * @param string $section * @param string $preselected * @return string */ function list_template_files($name, $section = 'browse', $preselected = '') { $files = vmReadDirectory(VM_THEMEPATH . "templates/{$section}/"); $array = array(); foreach ($files as $file) { if (is_dir($file)) { continue; } $file_info = pathinfo($file); $filename = $file_info['basename']; if ($filename == 'index.html') { continue; } $array[basename($filename, '.' . $file_info['extension'])] = basename($filename, '.' . $file_info['extension']); } if ($section == 'browse') { $array = array_merge(array('managed' => 'managed'), $array); } return ps_html::selectList($name, $preselected, $array); }
/** * Lists all available files from the /classes directory * * @param string $name * @param string $preselected * @return string */ function list_classes($name, $preselected) { global $mosConfig_absolute_path; $classes = vmReadDirectory(CLASSPATH, '\\.php$', false, true); $array = array(); foreach ($classes as $class) { if (is_dir($class) || $class[0] == '.') { continue; } $classname = basename($class, '.php'); if ($classname != 'ps_main' && $classname != 'ps_ini') { $array[$classname] = $classname; } } return ps_html::selectList($name, $preselected, $array, 1, '', 'id="' . $name . '"'); }
/** * Build a Credit Card list for each CreditCard Payment Method * Uses JavsScript from mambojavascript: changeDynaList() * * @param ps_DB $db_cc * @return string */ function creditcard_lists(&$db_cc) { global $mainframe; if (vmIsJoomla('1.5')) { $document = JFactory::getDocument(); $document->addScript('includes/js/joomla.javascript.js'); } $db = new ps_DB(); $db_cc->next_record(); // Build the Credit Card lists for each CreditCard Payment Method $script = "<script language=\"javascript\" type=\"text/javascript\">\n"; $script .= "<!--\n"; $script .= "var originalOrder = '1';\n"; $script .= "var originalPos = '" . $db_cc->f("payment_method_name") . "';\n"; $script .= "var orders = new Array();\t// array in the format [key,value,text]\n"; $i = 0; $db_cc->reset(); while ($db_cc->next_record()) { $accepted_creditcards = explode(",", $db_cc->f("accepted_creditcards")); $cards = array(); foreach ($accepted_creditcards as $value) { if (!empty($value)) { $q = 'SELECT creditcard_code,creditcard_name FROM #__{vm}_creditcard WHERE creditcard_id=' . (int) $value; $db->query($q); $db->next_record(); $cards[$db->f('creditcard_code')] = shopMakeHtmlSafe($db->f('creditcard_name')); } } foreach ($cards as $code => $name) { $script .= "orders[" . $i++ . "] = new Array( '" . addslashes($db_cc->f("payment_method_name")) . "','{$code}','{$name}' );\n"; } } $script .= "function changeCreditCardList() { \n"; $script .= "var selected_payment = null;\n for (var i=0; i<document.adminForm.payment_method_id.length; i++)\n if (document.adminForm.payment_method_id[i].checked)\n selected_payment = document.adminForm.payment_method_id[i].id;\n"; $script .= "changeDynaList('creditcard_code',orders,selected_payment, originalPos, originalOrder);\n"; $script .= "}\n"; $script .= "//-->\n"; $script .= "</script>\n"; $script .= '<noscript>' . ps_html::selectList('creditcard_code', key($cards), $cards) . '</noscript>'; return $script; }
/** * lists the permission levels in a select box * @author pablo * @param string $name The name of the select element * @param string $group_name The preselected key */ function list_perms($name, $group_name, $size = 1, $multi = false) { global $VM_LANG; $auth = $_SESSION['auth']; if ($multi) { $multi = 'multiple="multiple"'; } $db = new ps_DB(); // Get users current permission value $dvalue = $this->user_groups[$auth["perms"]]; $perms = $this->getUserGroups(); arsort($perms); if ($size == 1) { $values[0] = $VM_LANG->_('PHPSHOP_SELECT'); } while (list($key, $value) = each($perms)) { // Display only those permission that this user can set if ($value >= $dvalue) { $values[$key] = $key; } } if ($size > 1) { $name .= '[]'; $values['none'] = $VM_LANG->_('NO_RESTRICTION'); } echo ps_html::selectList($name, $group_name, $values, $size, $multi); }
/** * Returns a DropDown List of all available Order Status Codes * * @param string $order_status_code * @param string $extra * @return string */ function getOrderStatusList($order_status_code, $extra = "") { $db = new ps_DB(); $q = "SELECT order_status_id, order_status_code, order_status_name FROM #__{vm}_order_status ORDER BY list_order"; $db->query($q); $array = array(); while ($db->next_record()) { $array[$db->f("order_status_code")] = $db->f("order_status_name"); } return ps_html::selectList('order_status', $order_status_code, $array, 1, '', $extra); }
/** * Prints a drop-down list of manufacturer names and their ids. * * @param int $manufacturer_id */ function list_manufacturer($manufacturer_id = '0') { $db = new ps_DB(); $q = "SELECT manufacturer_id as id,mf_name as name FROM #__{vm}_manufacturer ORDER BY mf_name"; $db->query($q); $db->next_record(); // If only one vendor do not show list if ($db->num_rows() == 1) { echo '<input type="hidden" name="manufacturer_id" value="' . $db->f("id") . '" />'; echo $db->f("name"); } elseif ($db->num_rows() > 1) { $db->reset(); $array = array(); while ($db->next_record()) { $array[$db->f("id")] = $db->f("name"); } $code = ps_html::selectList('manufacturer_id', $manufacturer_id, $array) . "<br />\n"; echo $code; } else { echo '<input type="hidden" name="manufacturer_id" value="1" />Please create at least one Manufacturer!!'; } }
/** * Prints a drop-down list of vendor names and their ids. * * @param int $vendor_id */ function list_vendor($vendor_id = '1') { $db = new ps_DB(); $q = "SELECT vendor_id,vendor_name FROM #__{vm}_vendor ORDER BY vendor_name"; $db->query($q); $db->next_record(); // If only one vendor do not show list if ($db->num_rows() == 1) { echo '<input type="hidden" name="vendor_id" value="' . $db->f("vendor_id") . '" />'; echo $db->f("vendor_name"); } elseif ($db->num_rows() > 1) { $db->reset(); $array = array(); while ($db->next_record()) { $array[$db->f("vendor_id")] = $db->f("vendor_name"); } echo ps_html::selectList('vendor_id', $vendor_id, $array); } }
case 'getpriceform': include_class('shopper'); include_class('product'); $shopper_group_id = intval(vmGet($_REQUEST, 'shopper_group_id', 5)); $product_id = intval(vmGet($_REQUEST, 'product_id')); $currency_code = vmGet($_REQUEST, 'product_currency', $vendor_currency); $price = $ps_product->getPriceByShopperGroup($product_id, $shopper_group_id); if (isset($price['product_currency'])) { $currency_code = $price['product_currency']; $currency_code = $price['product_currency']; } $formName = 'priceForm'; $content = '<form id="' . $formName . '" method="post" name="priceForm">'; $content .= '<table class="adminform"><tr><td><strong>' . $VM_LANG->_('PHPSHOP_PRICE_FORM_PRICE') . ':</strong></td><td><input type="text" name="product_price" value="' . $price['product_price'] . '" class="inputbox" id="product_price_' . $formName . '" size="11" /></td></tr>'; $content .= '<tr><td><strong>' . $VM_LANG->_('PHPSHOP_PRICE_FORM_GROUP') . ':</strong></td><td>' . $ps_shopper_group->list_shopper_groups('shopper_group_id', $shopper_group_id, 'onchange="reloadForm( \'' . $product_id . '\', \'shopper_group_id\', this.options[this.selectedIndex].value);"') . '</td></tr>'; $content .= '<tr><td><strong>' . $VM_LANG->_('PHPSHOP_PRICE_FORM_CURRENCY') . ':</strong></td><td>' . ps_html::getCurrencyList('product_currency', $currency_code, 'currency_code', 'style="max-width:120px;"') . '</td></tr></table>'; $content .= '<input type="hidden" name="product_price_id" value="' . $price['product_price_id'] . '" id="product_price_id_' . $formName . '" />'; $content .= '<input type="hidden" name="product_id" value="' . $product_id . '" />'; $content .= '<input type="hidden" name="func" value="' . (empty($price['product_price_id']) ? 'productPriceAdd' : 'productPriceUpdate') . '" />'; $content .= '<input type="hidden" name="ajax_request" value="1" />'; $content .= '<input type="hidden" name="no_html" value="1" />'; $content .= '<input type="hidden" name="vmtoken" value="' . vmSpoofValue($sess->getSessionId()) . '" />'; $content .= '<input type="hidden" name="option" value="' . $option . '" />'; $content .= '</form>'; vmConnector::sendHeaderAndContent(200, $content); break; case 'getproducts': if (!defined('SERVICES_JSON_SLICE')) { require_once CLASSPATH . 'JSON.php'; } $db =& new ps_DB();