<?php
/*
* ClientView.php is copyright � 2010. EarthWalk Software.
* Licensed under the Academic Free License version 3.0.
* Refer to the file named License provided with the source.
*/
/**
* ClientView
*
* A simple input/output form generator.
* This class contains form generator logic only.
* @author Jay Wheeler
* @version 1.0
* @copyright � 2010. EarthWalk Software.
* @license refer to License file provided with the source.
* @package IGSGateway
* @subpackage ClientView
*/
class ClientView
{
// ****************************************************
/**
* Form type - Input form
*/
const INPUTFORM = 0;
/**
* Form type - Output form
*/
const OUTPUTFORM = 1;
// ****************************************************
/**
* Html output buffer.
*
* Contains the buffered html output.
* @var string $htmlBuffer
*/
protected $htmlBuffer;
/**
* Url form location
*
* Contains the location of the form.
* @var string $formURL
*/
protected $formURL;
/**
* Transaction data.
*
* An associative array containing the current transaction.
* @var array[string]string $data
*/
protected $data = array();
/**
* Form type.
*
* The type of form (INPUTFORM or OUTPUTFORM) being processed.
* @var integer $formtype
*/
protected $formtype = self::INPUTFORM;
// ******************************************************************************
/*
* __construct.
*
* Class constructor.
* @param string $formURL A string containing the gateway uri
* @return ClientView New class object reference
*/
public function __construct($formURL)
{
$this->formURL = $formURL;
$this->htmlBuffer = '<html>';
$this->data = array();
$this->formtype = self::INPUTFORM;
}
// ******************************************************************************
/*
* __destruct.
*
* Class destructor.
*/
public function __destruct()
{
}
// ******************************************************************************
/*
* formatResult.
*
* Format a transaction input or response output default form.
* @param integer $formtype Form type ClientView::INPUTFORM OR ClientView::OUTPUTFORM
* @param array[string]string $resultArray Default values (input, optional) or result values (output, required)
* @return null
*/
public function formatResult($formtype, $resultArray=array())
{
$this->htmlBuffer = '';
$this->data = $resultArray;
$this->formtype = $formtype;
$this->appendLine('<html><head>');
$this->cssSetup();
$this->appendLine('</head>');
$this->appendLine('<body class="clsBody">');
$this->appendLine(sprintf('<form action="%s" method="POST" name="creditform">', $this->formURL));
$this->appendLine('<table class="clsTable clsColorSchemeBlue clsFontSchemeStdBld">');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableTitleBlock" colspan="2">');
$this->appendLine('Sale Information');
$this->appendLine('<br>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Total Amount');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$this->appendLine('<span style="font-weight:bold;" class="clsFontSchemeStdBld">$</span> ');
$value = '';
if (array_key_exists('fulltotal', $this->data))
{
$value = $this->data['fulltotal'];
}
$this->appendLine(sprintf('<input type="text" name="fulltotal" value="%s" class="clsFontSchemeStdBld" size="10">', $value));
$this->appendLine(' <span style="font-weight:bold;" class="clsFontSchemeStdBld">Charge Type</span> ');
$this->appendLine('<select name="trantype" class="clsFontSchemeStdBld">');
if (array_key_exists('trantype', $this->data) &&
($this->data['trantype']))
{
$value = $this->data['trantype'];
}
foreach(StaticTables::$transType as $fieldValue => $fieldLabel)
{
$this->addOption($fieldLabel, $fieldValue, $value);
}
$this->appendLine('</select>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
if ($this->formtype == self::INPUTFORM)
{
$this->IGSTransactionInfo();
}
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2">');
$this->appendLine('<hr style="width:95%;text-align:center;">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableTitleBlock" colspan="2">');
$this->appendLine('Credit Card Information');
$this->appendLine('<br>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Card Type');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$this->appendLine('<select name="cardtype" class="clsFontSchemeStdBld">');
if (array_key_exists('cardtype', $this->data) &&
($this->data['cardtype']))
{
$value = $this->data['cardtype'];
}
foreach(StaticTables::$cardType as $fieldValue => $fieldLabel)
{
$this->addOption($fieldLabel, $fieldValue, $value);
}
$this->appendLine('</select>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendBuffer('Card Number');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('ccnumber', $this->data))
{
$value = $this->data['ccnumber'];
}
$this->appendBuffer(sprintf('<input type="text" name="ccnumber" value="%s" size="25" class="clsFontSchemeStdBld">', $value));
$this->appendBuffer(' ');
$this->appendLine('<span class="clsFontSchemeStdBld">CVV2</span>');
$this->appendBuffer(' ');
$value = '';
if (array_key_exists('ccidentifier1', $this->data))
{
$value = $this->data['ccidentifier1'];
}
$this->appendBuffer(sprintf('<input type="text" name="ccidentifier1" value="" size="8" class="clsFontSchemeStdBld">', $value));
$this->appendBuffer(' ');
$this->appendLine('<span class="clsFontSchemeStdBld">Expiration</span>');
$this->appendBuffer(' ');
$this->appendBuffer('<select name="month" class="clsFontSchemeStdBld">');
if (array_key_exists('month', $this->data) &&
($this->data['month']))
{
$selectedmonth = $this->data['month'];
}
else
{
$selectedmonth = date("m");
if ($selectedmonth == 12)
{
$selectedmonth = 0;
}
$selectedmonth += 1;
}
$index = 1;
do
{
$month = sprintf('%02u', $index);
$this->addOption($month, $month, $selectedmonth);
$index++;
}
while ($index <= 12);
$this->appendBuffer('</select>');
$this->appendBuffer(' <span style="font-weight:bold;" class="clsFontSchemeStdBld">/</span> ');
$this->appendBuffer('<select name="year" class="clsFontSchemeStdBld">');
if (array_key_exists('year', $this->data) &&
($this->data['year']))
{
$thisyear = $this->data['year'];
if ($thisyear < 2000)
{
$thisyear += 2000;
}
}
else
{
$thisyear = date('Y');
}
$index = 0;
do
{
$year = sprintf('%4u', $index + $thisyear);
$this->addOption($year, $year, $thisyear);
$index++;
}
while ($index < 10);
$this->appendLine('</select>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Name');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('ccname', $this->data))
{
$value = $this->data['ccname'];
}
$this->appendLine(sprintf('<input type="text" name="ccname" value="%s" size="108" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2">');
$this->appendLine('<hr style="width:95%;text-align:center;">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
if ($this->formtype == self::OUTPUTFORM)
{
$this->receivedResults();
}
else
{
$this->customerInformation();
if (array_key_exists('merchantvisible', $this->data))
{
$this->merchantFields();
}
}
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2">');
$this->appendLine('<hr style="width:95%;text-align:center;">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
if ($this->formtype == self::OUTPUTFORM)
{
$this->appendLine('<td class="clsTableDataField" colspan="2" style="text-align:center;">');
$this->appendLine('<INPUT type="submit" name="submit" value="New Transaction" class="clsFontSchemeStdBld"><br><br>');
}
else
{
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('<INPUT type="submit" name="submit" value="Submit" class="clsFontSchemeStdBld"><br><br>');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue" style="text-align:center;">');
$this->appendLine('<INPUT type="reset" value="Reset" class="clsFontSchemeStdBld"><br><br>');
}
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('</table>');
$this->appendLine('</form>');
$this->appendLine('</body>');
$this->appendLine('</html>');
}
// ******************************************************************************
/*
* customerInformation.
*
* Format customer information input form.
* @return null
*/
protected function customerInformation()
{
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableTitleBlock" colspan="2">');
$this->appendLine('Credit Card Owner Information');
$this->appendLine('<br>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Address');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('baddress', $this->data))
{
$value = $this->data['baddress'];
}
$this->appendLine(sprintf('<input type="text" name="baddress" value="%s" size="108" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine(' ');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('baddress1', $this->data))
{
$value = $this->data['baddress1'];
}
$this->appendLine(sprintf('<input type="text" name="baddress1" value="%s" size="108" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('City');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('bcity', $this->data))
{
$value = ucfirst(strtolower($this->data['bcity']));
}
$this->appendLine(sprintf('<input type="text" name="bcity" value="%s" size="71" class="clsFontSchemeStdBld">', $value));
// *****************************************************************************
//
// bstate
//
// *****************************************************************************
$this->appendLine(' State ');
$value = 'nj';
if (array_key_exists('bstate', $this->data) &&
($this->data['bstate']))
{
$value = strtolower($this->data['bstate']);
}
$this->appendLine('<select name="bstate" class="clsFontSchemeStdBld">');
foreach(StaticTables::$states as $fieldValue => $fieldLabel)
{
$this->addOption($fieldLabel, $fieldValue, $value);
}
$this->appendLine('</select>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
// *****************************************************************************
//
// Zipcode
//
// *****************************************************************************
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Zip Code');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('bzip', $this->data))
{
$value = ucfirst(strtolower($this->data['bzip']));
}
$this->appendLine(sprintf('<input type="text" name="bzip" value="%s" size="15" class="clsFontSchemeStdBld">', $value));
// *****************************************************************************
//
// bstate
//
// *****************************************************************************
$this->appendLine(' Country ');
$value = 'US';
if (array_key_exists('bcountry', $this->data) &&
($this->data['bcountry']))
{
$value = strtoupper($this->data['bcountry']);
}
$this->appendLine('<select name="bcountry" class="clsFontSchemeStdBld">');
foreach(StaticTables::$countries as $fieldValue => $fieldLabel)
{
$this->addOption($fieldLabel, $fieldValue, $value);
}
$this->appendLine('</select>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2">');
$this->appendLine(' ');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
// *****************************************************************************
//
// bphone
//
// *****************************************************************************
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Telephone Number');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('bphone', $this->data))
{
$value = $this->data['bphone'];
}
$this->appendLine(sprintf('<input type="text" name="bphone" value="%s" size="30" class="clsFontSchemeStdBld">', $value));
// *****************************************************************************
//
// email
//
// *****************************************************************************
$this->appendLine(' E-Mail ');
$value = '';
if (array_key_exists('email', $this->data))
{
$value = $this->data['email'];
}
$this->appendLine(sprintf('<input type="text" name="email" value="%s" size="62" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Suppress E-Mail Receipt');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue" style="vertical-align:middle;">');
// *****************************************************************************
//
// voiceauth
//
// *****************************************************************************
$this->appendLine('<input type="checkbox" name="ReceiptEMail" class="clsFontSchemeStdBld" style="vertical-align:middle;">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
}
// ******************************************************************************
/*
* IGSTransactionInfo.
*
* Format IGS Transaction Information (input).
* @return null
*/
protected function IGSTransactionInfo()
{
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2">');
$this->appendLine(' ');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2" style="text-align:center;">');
$this->appendLine('<span class="clsFontSchemeStdBld" style="font-weight:bold;">');
$this->appendLine('The folowing fields are ONLY required for</span> ');
$this->appendLine('<span class="clsFontSchemeStdBld" style="font-weight:bold;font-style:italic;">');
$this->appendLine('Pre-Auth, Credit, Void and Post-Auth Transactions.</span><br><br>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Reference');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
// *****************************************************************************
//
// reference
//
// *****************************************************************************
$value = '';
if (array_key_exists('reference', $this->data))
{
$value = $this->data['reference'];
}
$this->appendLine(sprintf('<input type="text" name="reference" value="%s" size="16" class="clsFontSchemeStdBld">', $value));
// *****************************************************************************
//
// transid
//
// *****************************************************************************
$this->appendLine(' <span style="font-weight:bold;" class="clsFontSchemeStdBld">Transaction Id</span> ');
$value = '';
if (array_key_exists('transid', $this->data))
{
$value = $this->data['transid'];
}
$this->appendLine(sprintf('<input type="text" name="transid" value="%s" size="16" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Authorized Amount');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
// *****************************************************************************
//
// authamount
//
// *****************************************************************************
$value = '';
if (array_key_exists('authamount', $this->data))
{
$value = $this->data['authamount'];
}
$this->appendLine(sprintf('<input type="text" name="authamount" value="%s" size="16" class="clsFontSchemeStdBld">', $value));
// *****************************************************************************
//
// voiceauth
//
// *****************************************************************************
$this->appendLine(' Voice Authorization <input type="checkbox" name="voiceauth" class="clsFontSchemeStdBld">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
}
// ******************************************************************************
/*
* merchantFields.
*
* Format IGS Merchant fields (input).
* @return null
*/
protected function merchantFields()
{
if ($this->data['merchantvisible'])
{
$type = 'text';
}
else
{
$type = 'hidden';
}
// **************************************************************************************
if ($type == 'text')
{
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2">');
$this->appendLine('<hr style="width:95%;text-align:center;">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableTitleBlock" colspan="2">');
$this->appendLine('Merchant Information');
$this->appendLine('<br>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Capture Fields');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
}
$value = ' ';
if (array_key_exists('field_capture', $this->data))
{
$value = $this->data['field_capture'];
}
$this->appendLine(sprintf('<input type="%s" name="field_capture" value="%s" size="40" class="clsFontSchemeStdBld">', $type, $value));
$value = ' ';
if (array_key_exists('xsubjectnotify', $this->data))
{
$value = $this->data['xsubjectnotify'];
}
if ($type == 'text')
{
$this->appendLine(' XSubjectNotify ');
}
$this->appendLine(sprintf('<input type="%s" name="xsubjectnotify" value="%s" size="32" class="clsFontSchemeStdBld">', $type, $value));
if ($type == 'text')
{
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('XHeader');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
}
$value = '';
if (array_key_exists('xheader', $this->data))
{
$value = $this->data['xheader'];
}
$this->appendLine(sprintf('<input type="%s" name="xheader" value="%s" size="40" class="clsFontSchemeStdBld">', $type, $value));
$value = '';
if (array_key_exists('xemailflds', $this->data))
{
$value = $this->data['xemailflds'];
}
if ($type == 'text')
{
$this->appendLine(' XEmailFields ');
}
$this->appendLine(sprintf('<input type="%s" name="xemailflds" value="%s" size="32" class="clsFontSchemeStdBld">', $type, $value));
if ($type == 'text')
{
$this->appendLine('</td>');
$this->appendLine('</tr>');
}
}
// ******************************************************************************
/*
* receivedResults.
*
* Format received results (output).
* @return null
*/
protected function receivedResults()
{
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableTitleBlock" colspan="2">');
$this->appendLine('Transaction Result');
$this->appendLine('<br>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Result');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$value = '';
if (array_key_exists('status', $this->data))
{
$value = $this->data['status'];
}
$this->appendBuffer(sprintf('<input type="text" name="status" value="%s" size="108" class="clsFontSchemeStdBld', $value));
if (array_key_exists('approval', $this->data) &&
(! array_key_exists('error', $this->data)))
{
$this->appendBuffer(' clsColorSchemeGreen');
}
else
{
$this->appendBuffer(' clsColorSchemeRedInverse');
}
$this->appendLine('">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
if (array_key_exists('error', $this->data))
{
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Additional Information');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$this->appendLine('<div style="width:90%;text-align:left;background-color:#FFFFFF;">');
$this->appendLine(sprintf('%s', $this->data['error']));
$this->appendLine('</div>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
}
else
if (array_key_exists('approval', $this->data))
{
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Approval');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
$this->appendBuffer(sprintf('<input type="text" name="approval" value="%s" size="64" class="clsFontSchemeStdBld">', $this->data['approval']));
$this->appendLine('</td>');
$this->appendLine('</tr>');
}
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Amount');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
// *****************************************************************************
//
// amount
//
// *****************************************************************************
$value = '';
if (array_key_exists('amount', $this->data))
{
$value = $this->data['amount'];
}
$this->appendLine(sprintf('<input type="text" name="amount" value="%s" size="16" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('AVS');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
// *****************************************************************************
//
// avs
//
// *****************************************************************************
$value = '';
if (array_key_exists('avs', $this->data))
{
$value = $this->data['avs'];
}
$this->appendBuffer(sprintf('<input type="text" name="avs" value="%s" size="64" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField" colspan="2">');
$this->appendLine('<hr style="width:95%;text-align:center;">');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableTitleBlock" colspan="2">');
$this->appendLine('Innovative Gateway Information');
$this->appendLine('<br>');
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('Order Number');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
// *****************************************************************************
//
// ordernumber
//
// *****************************************************************************
$value = '';
if (array_key_exists('ordernumber', $this->data))
{
$value = $this->data['ordernumber'];
}
$this->appendLine(sprintf('<input type="text" name="ordernumber" value="%s" size="16" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
// **************************************************************************************
$this->appendLine('<tr class="clsTR">');
$this->appendLine('<td class="clsTableDataField">');
$this->appendLine('ANA Transaction Id');
$this->appendLine('</td>');
$this->appendLine('<td class="clsTableDataValue">');
// *****************************************************************************
//
// anatransid
//
// *****************************************************************************
$value = '';
if (array_key_exists('anatransid', $this->data))
{
$value = $this->data['anatransid'];
}
$this->appendLine(sprintf('<input type="text" name="amount" value="%s" size="16" class="clsFontSchemeStdBld">', $value));
$this->appendLine('</td>');
$this->appendLine('</tr>');
}
// ******************************************************************************
/*
* cssSetup.
*
* Create css output for form formatting.
* @return null
*/
protected function cssSetup()
{
$this->appendLine('<Style type="text/css">');
$this->appendLine('.clsBody {text-align:left;vertical-align:top;} ');
$this->appendLine('.clsTable {text-align:center;vertical-align:top;width:80%;border-style:solid;border-width:1px;} ');
$this->appendLine('.clsTR {border-style:none;border-width:1px;} ');
$this->appendLine('.clsTableDataField {font-weight:bold;text-align:right;border-style:none;border-width:thin;width:20%;} ');
$this->appendLine('.clsTableDataValue {text-align:left;border-style:none;border-width:thin;width:80%;} ');
$this->appendLine('.clsInputData {text-align:right;} ');
$this->appendLine('.clsTableBlockTitle {font-size:12px;font-weight:bold;text-align:center;border-style:none;border-width:thin;} ');
$this->appendLine('.clsColorSchemeBlue {color:#000062;background-color:#BFBFFF;border-color:#000062;rev-color:#BFBFFF;rev-background:#000062;rev-border:#BFBFFF;} ');
$this->appendLine('.clsColorSchemeLtBlue {color:#BFBFFF;background-color:#F0F0FF;border-color:#000062;rev-color:#F0F0FF;rev-background:#000062;rev-border:#F0F0FF;} ');
$this->appendLine('.clsColorSchemeWtBlue {color:#000062;background-color:#FFFFFF;border-color:#000062;rev-color:#FFFFFF;rev-background:#000062;rev-border:#FFFFFF;} ');
$this->appendLine('.clsColorSchemeBlueRev {color:#BFBFFF;background:#000062;border:#BFBFFF;} ');
$this->appendLine('.clsColorSchemeLtBlueRev {color:#F0F0FF;background:#BFBFFF;border:#F0F0FF;} ');
$this->appendLine('.clsColorSchemeWtBlueRev {color:#FFFFFF;background:#000062;border:#FFFFFF;} ');
$this->appendLine('.clsColorSchemeGreen (color:#00FF00;background:#FFFFFF;) ');
$this->appendLine('.clsColorSchemeRed (color:#FF0000;background:#FFFFFF;) ');
$this->appendLine('.clsColorSchemeRedInverse (color:#FFFFFF;background:#FF0000;) ');
$this->appendLine('.clsFontSchemeStd {font-family:arial,verdana;font-size:11px;font-weight:normal;}');
$this->appendLine('.clsFontSchemeStdBld {font-family:arial,verdana;font-size:11px;font-weight:bold;}');
$this->appendLine('.clsFontSchemeSmlBld {font-family:arial,verdana;font-size:11px;font-weight:bold;}');
$this->appendLine('.clsFontSchemeAlt {font-family:verdana,arial;font-size:10px;font-weight:normal;}');
$this->appendLine('.clsFontSchemeAltBld {font-family:verdana,arial;font-size:10px;font-weight:bold;}');
$this->appendLine('</Style>');
}
// ******************************************************************************
/*
* addOption.
*
* Utility function to add an option field to the current <select>
* @param string $fieldLabel = label to assign to option
* @param string $fieldValue = value to assign to option
* @param string $fieldMatch = match value to set 'selected' option
* @return null
*/
private function addOption($fieldLabel, $fieldValue, $fieldMatch)
{
$this->appendLine(sprintf('<option value="%s"', $fieldValue));
if ($fieldValue == $fieldMatch)
{
$this->appendBuffer(' selected');
}
$this->appendLine(sprintf('>%s</option>', $fieldLabel));
}
// ******************************************************************************
/*
* getBuffer.
*
* Returns a copy of the current html output buffer contents
* @return string $htmlbuffer = current html output buffer contents
*/
public function getBuffer()
{
return $this->htmlBuffer;
}
// ******************************************************************************
/*
* appendLine.
*
* Append a string followed by a 'newline' sequence to the current html buffer
* @param string $buffer = string to append to htmlBuffer
* @return null
*/
protected function appendLine($buffer)
{
$this->appendBuffer($buffer . "\n");
}
// ******************************************************************************
/*
* appendBuffer.
*
* Append a string to the current html buffer
* @param string $buffer = string to append to htmlBuffer
* @return null
*/
protected function appendBuffer($buffer)
{
$this->htmlBuffer .= $buffer;
}
}