VbzCart/v1/class/vcPageContent ckout/DetectPageRequest

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to: navigation, search

Calls

Code

    /*----
      ACTION: Checks form input to see which (if any) navigation button was pressed,
	and therefore which form is being requested for display next.
	
	Does not enforce rules about whether to advance or not.
    */
    protected function DetectPageRequest() {
	$gotPgDest = FALSE;
	if (fcHTTP::Request()->GetBool(KSQ_ARG_PAGE_DEST)) {
	    $gotPgDest = TRUE;
	    $this->SetPageKey_forShow(fcHTTP::Request()->GetString(KSQ_ARG_PAGE_DEST));
	}
	
	// DEBUGGING
	//echo 'DETECTING PAGE REQUEST...<br>';
	
	if (!$gotPgDest) {
	// destination page unknown, so calculate it from data/source page:
	    if (fcHTTP::Request()->GetBool('btn-go-prev')) {
		switch ($this->GetPageKey_forData()) {
		  case KSQ_PAGE_CART:
		    $this->SetPageKey_forShow(KSQ_PAGE_CART);	// can't go back any further
		    break;
		  case KSQ_PAGE_SHIP:
		    $this->SetPageKey_forShow(KSQ_PAGE_CART);
		    break;
		  case KSQ_PAGE_PAY:
		    $this->SetPageKey_forShow(KSQ_PAGE_SHIP);
		    break;
		  case KSQ_PAGE_CONF:
		    $this->SetPageKey_forShow(KSQ_PAGE_PAY);
		    break;
		  default:	// source page name not recognized; default to cart
		    $this->SetPageKey_forShow(KSQ_PAGE_CART);	// can't go back any further
		}
	    } elseif (fcHTTP::Request()->GetBool('btn-go-next')) {
		switch ($this->GetPageKey_forData()) {
		  case KSQ_PAGE_CART:
		    $this->SetPageKey_forShow(KSQ_PAGE_SHIP);
		    break;
		  case KSQ_PAGE_SHIP:
		    $this->SetPageKey_forShow(KSQ_PAGE_PAY);
		    break;
		  case KSQ_PAGE_PAY:
		    $this->SetPageKey_forShow(KSQ_PAGE_CONF);
		    break;
		  case KSQ_PAGE_CONF:
		    $this->SetPageKey_forShow(KSQ_PAGE_RCPT);
		    break;
		  default:	// not sure how we got here; use default
		    $this->SetPageKey_forShow(KSQ_PAGE_DEFAULT);
		}
	    } elseif (fcHTTP::Request()->GetBool('btn-go-same')) {
		$this->SetPageKey_forShow($this->PageKey_forData());
	    } elseif (fcHTTP::Request()->GetBool('btn-go-order')) {
		$this->SetPageKey_forShow(KSQ_PAGE_RCPT);		// receipt page - submits order too
	    } else {
		$this->SetPageKey_forShow(KSQ_PAGE_DEFAULT);	// default page to display
	    }
	}
    }