Go to the documentation of this file.00001 <?php
00002
00008 class payment_rdfa extends oxAdminDetails
00009 {
00010
00016 protected $_sThisTemplate = "payment_rdfa.tpl";
00017
00024 protected $_aRDFaPayments = array("ByBankTransferInAdvance" => 0,
00025 "ByInvoice" => 0,
00026 "Cash" => 0,
00027 "CheckInAdvance" => 0,
00028 "COD" => 0,
00029 "DirectDebit" => 0,
00030 "GoogleCheckout" => 0,
00031 "PayPal" => 0,
00032 "PaySwarm" => 0,
00033 "AmericanExpress" => 1,
00034 "DinersClub" => 1,
00035 "Discover" => 1,
00036 "JCB" => 1,
00037 "MasterCard" => 1,
00038 "VISA" => 1);
00039
00043 public function save()
00044 {
00045 $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00046 $aRDFaPayments = (array) oxRegistry::getConfig()->getRequestParameter("ardfapayments");
00047
00048
00049 $oDb = oxDb::getDb();
00050 $oDb->execute("DELETE FROM oxobject2payment WHERE oxpaymentid = '" . oxRegistry::getConfig()->getRequestParameter("oxid") . "' AND OXTYPE = 'rdfapayment'");
00051
00052
00053 foreach ($aRDFaPayments as $sPayment) {
00054 $oMapping = oxNew("oxbase");
00055 $oMapping->init("oxobject2payment");
00056 $oMapping->assign($aParams);
00057 $oMapping->oxobject2payment__oxobjectid = new oxField($sPayment);
00058 $oMapping->save();
00059 }
00060 }
00061
00067 public function getAllRDFaPayments()
00068 {
00069 $aRDFaPayments = array();
00070 $aAssignedRDFaPayments = $this->getAssignedRDFaPayments();
00071 foreach ($this->_aRDFaPayments as $sName => $iType) {
00072 $oPayment = new stdClass();
00073 $oPayment->name = $sName;
00074 $oPayment->type = $iType;
00075 $oPayment->checked = in_array($sName, $aAssignedRDFaPayments);
00076 $aRDFaPayments[] = $oPayment;
00077 }
00078
00079 return $aRDFaPayments;
00080 }
00081
00087 public function getAssignedRDFaPayments()
00088 {
00089 $oDb = oxDb::getDb();
00090 $aRDFaPayments = array();
00091 $sSelect = 'select oxobjectid from oxobject2payment where oxpaymentid=' . $oDb->quote(oxRegistry::getConfig()->getRequestParameter("oxid")) . ' and oxtype = "rdfapayment" ';
00092 $rs = $oDb->execute($sSelect);
00093 if ($rs && $rs->recordCount()) {
00094 while (!$rs->EOF) {
00095 $aRDFaPayments[] = $rs->fields[0];
00096 $rs->moveNext();
00097 }
00098 }
00099
00100 return $aRDFaPayments;
00101 }
00102 }