function userForm() { // make sure we have some billing options saved. //if (empty($this->opts)) return false; //exponent_javascript_toFoot('creditcard',"",null,'', URL_FULL.'framework/core/subsystems/forms/js/AuthorizeNet.validate.js'); //$opts->first_name = isset($this->opts->first_name) ? $this->opts->first_name : null; //$opts->last_name = isset($this->opts->last_name) ? $this->opts->last_name : null; $this->opts = expSession::get('billing_options'); $opts->cc_type = isset($this->opts->cc_type) ? $this->opts->cc_type : null; $opts->cc_number = isset($this->opts->cc_number) ? $this->opts->cc_number : null; $opts->exp_month = isset($this->opts->exp_month) ? $this->opts->exp_month : null; $opts->exp_year = isset($this->opts->exp_year) ? $this->opts->exp_year : null; $opts->cvv = isset($this->opts->cvv) ? $this->opts->cvv : null; $form = ''; /* FIXME: hard coded options!! if ($config_object->accept_amex) $cards["AmExCard"] = "American Express"; if ($config_object->accept_discover) $cards["DiscoverCard"] = "Discover"; if ($config_object->accept_mastercard) $cards["MasterCard"] = "MasterCard"; if ($config_object->accept_visa) $cards["VisaCard"] = "Visa"; */ //$fname = new textcontrol($opts->first_name); //$lname = new textcontrol($opts->last_name); /* $cardtypes = new dropdowncontrol($opts->cc_type,$this->getAvailableCards()); $cardnumber = new textcontrol($opts->cc_number,20,false,20,"integer", true); $expiration = new monthyearcontrol($opts->exp_month, $opts->exp_year); $cvv = new textcontrol($opts->cvv,4,false,4,"integer", true); $cvvhelp = new htmlcontrol("<a href='http://en.wikipedia.org/wiki/Card_Verification_Value' target='_blank'>What's this?</a>"); */ $cardtypes = new dropdowncontrol("", $this->getAvailableCards()); $cardnumber = new textcontrol("", 20, false, 20, "integer", true); $expiration = new monthyearcontrol("", ""); $cvv = new textcontrol("", 4, false, 4, "integer", true); //$cvvhelp = new htmlcontrol("<a href='http://en.wikipedia.org/wiki/Card_Verification_Value' target='_blank'>What's this?</a>"); $cardtypes->id = "cc_type"; $cardnumber->id = "cc_number"; $expiration->id = "expiration"; $cvv->id = "cvv"; $cvv->size = 5; //$cvvhelp->id = "cvvhelp"; //$form .= $fname->toHTML("First Name", "first_name"); //$form .= $lname->toHTML("Last Name", "last_name"); $form .= $cardtypes->toHTML("Card Type", "cc_type"); $form .= $cardnumber->toHTML("Card #", "cc_number"); //$form .= "<strong class=\"example\">Example: 1234567890987654</strong>"; $form .= $expiration->toHTML("Expiration", "expiration"); $form .= $cvv->toHTML("CVV # <br /><a href='http://en.wikipedia.org/wiki/Card_Verification_Value' target='_blank'>What's this?</a>", 'cvv'); //$form .= $cvvhelp->toHTML('', 'cvvhelp'); //$form .= "<a class=\"exp-ecom-link-dis continue\" href=\"#\" id=\"checkoutnow\"><strong><em>Continue Checkout</em></strong></a>"; //$form .= '<input id="cont-checkout" type="submit" value="Continue Checkout">'; return $form; }
function controlToHTML($name) { $html = ""; if (!defined("SYS_GEO")) { require_once BASE . "subsystems/geo.php"; } $countries = pathos_geo_listCountriesOnly(); $c_dd = new dropdowncontrol($this->country_default, $countries); $c_dd->jsHooks["onChange"] = "geo_rebuildRegions(this,'" . $name . "_region_id'," . ($this->allow_entire_country ? 'true' : 'false') . ");"; if (!defined("GEO_JS_INCLUDED")) { define("GEO_JS_INCLUDED", 1); $html .= "<script language='JavaScript'>function geo_rebuildRegions(c_select,r_id,allow_all) {"; $html .= "\tvar r_select = document.getElementById(r_id);"; $html .= "\twhile (r_select.childNodes.length) r_select.removeChild(r_select.firstChild);"; $html .= "\tvar country = c_select.options[c_select.selectedIndex].value;"; //alert(country); $html .= " if (allow_all) {"; $html .= "\t\tvar o = document.createElement('option');"; $html .= "\t\to.setAttribute('value',0);"; $html .= "\t\to.appendChild(document.createTextNode('[ Entire Country ]'));"; $html .= "\t\tr_select.appendChild(o);"; $html .= "\t}"; $html .= " var count = 0;"; $html .= "\tfor (i = 0; i < geo_regions.length; i++) {"; $html .= "\t\tif (geo_regions[i].var_parent_id == country) {"; $html .= "\t\t\tcount++;"; $html .= "\t\t\tvar o = document.createElement('option');"; $html .= "\t\t\to.setAttribute('value',\tgeo_regions[i].var_id);"; $html .= "\t\t\to.appendChild(document.createTextNode(geo_regions[i].var_name));"; $html .= "\t\t\tr_select.appendChild(o);"; $html .= "\t\t}"; $html .= "\t}"; $html .= "\tif (!allow_all && count == 0) {"; $html .= " \t\tvar o = document.createElement('option');"; $html .= "\t\to.setAttribute('value',0);"; $html .= "\t\to.appendChild(document.createTextNode('[ None Specified ]'));"; $html .= "\t\tr_select.appendChild(o);"; $html .= "\t}"; $html .= "}"; if (!defined("SYS_JAVACSRIPT")) { require_once BASE . "subsystems/javascript.php"; } $region = null; $region->parent_id = 0; $region->id = 0; $region->name = ""; $html .= pathos_javascript_class($region, "geoRegion"); $html .= "var geo_regions = new Array();\n"; foreach ($countries as $cid => $cname) { $region = null; $region->parent_id = $cid; foreach (pathos_geo_listRegions($cid) as $rid => $rname) { $region->id = $rid; $region->name = $rname; $html .= "geo_regions.push("; $html .= pathos_javascript_object($region, "geoRegion"); $html .= ");\n"; } } $html .= "</script>\n"; } $regions = pathos_geo_listRegions($this->country_default); if ($this->allow_entire_country) { array_unshift($regions, "[ Entire Country ]"); } elseif ($regions == null) { array_unshift($regions, "[ None Specified ]"); } $r_dd = new dropdowncontrol($this->region_default, $regions); $html .= $c_dd->controlToHTML($name . "_country_id"); $html .= "<br>"; $html .= $r_dd->controlToHTML($name . "_region_id"); return $html; }