00001 <?php 00005 require_once "shop_config.php"; 00006 00012 class dyn_ipayment extends Shop_Config 00013 { 00020 public function render() 00021 { 00022 parent::render(); 00023 00024 $this->_aViewData['oxid'] = oxConfig::getInstance()->getShopId(); 00025 00026 return 'dyn_ipayment.tpl'; 00027 00030 } 00031 00037 public function addPayment() 00038 { 00039 $myConfig = $this->getConfig(); 00040 $aAddPayment = oxConfig::getParameter("allpayments"); 00041 00042 if ( isset( $aAddPayment) && is_array($aAddPayment)) { 00043 foreach ($aAddPayment as $sAdd) { 00044 $oNewGroup = oxNew( "oxbase" ); 00045 $oNewGroup->init( "oxobject2ipayment" ); 00046 $oNewGroup->oxobject2ipayment__oxpaymentid = new oxField($sAdd); 00047 $oNewGroup->oxobject2ipayment__oxshopid = new oxField($myConfig->getShopId()); 00048 $oNewGroup->oxobject2ipayment__oxtype = new oxField("cc"); 00049 $oNewGroup->save(); 00050 } 00051 } 00052 } 00053 00059 public function removePayment() 00060 { 00061 $myConfig = $this->getConfig(); 00062 $aRemovePayment = oxConfig::getParameter( "addpayments"); 00063 00064 if ( isset( $aRemovePayment) && is_array($aRemovePayment) && count($aRemovePayment)) { 00065 $sQ = "delete from oxobject2ipayment where oxobject2ipayment.oxshopid='".$myConfig->getShopId()."' "; 00066 $sQ .= "and oxobject2ipayment.oxid in ("; 00067 $blSep = false; 00068 foreach ($aRemovePayment as $sRem) { 00069 $sQ .= ( ( $blSep ) ? ", ":"" ) . " '$sRem'"; 00070 $blSep = true; 00071 } 00072 $sQ .= ")"; 00073 oxDb::getDb()->Execute( $sQ); 00074 } 00075 } 00076 00082 public function savePayment() 00083 { 00084 $myConfig = $this->getConfig(); 00085 $sActPayment = oxConfig::getParameter("oxpaymentid"); 00086 $aParams = oxConfig::getParameter("editval"); 00087 00088 $oActPayment = oxNew( "oxbase" ); 00089 $oActPayment->init( "oxobject2ipayment" ); 00090 00091 $sQ = "select * from oxobject2ipayment where oxobject2ipayment.oxshopid='".$myConfig->getShopId()."' 00092 and oxobject2ipayment.oxid = '$sActPayment' "; 00093 00094 if ( $oActPayment->assignRecord( $sQ ) && is_array( $aParams ) ) { 00095 foreach ( $aParams as $sField => $sValue ) { 00096 if ( isset( $oActPayment->$sField ) ) { 00097 $oActPayment->$sField = new oxField($sValue); 00098 } 00099 } 00100 $oActPayment->save(); 00101 } 00102 } 00103 00109 public function setFilter() 00110 { 00111 $this->blfiltering = true; 00112 } 00113 00117 public function getViewId() 00118 { 00119 return 'dyn_interface'; 00120 } 00121 }