dyn_ipayment.php

Go to the documentation of this file.
00001 <?php
00005 require_once "shop_config.php";
00006 
00011 class dyn_ipayment extends Shop_Config
00012 {
00019     public function render()
00020     {
00021         parent::render();
00022 
00023         $this->_aViewData['oxid'] = $this->getConfig()->getShopId();
00024 
00025         return 'dyn_ipayment.tpl';
00026 
00029     }
00030 
00036     public function addPayment()
00037     {
00038         $myConfig = $this->getConfig();
00039         $aAddPayment = oxConfig::getParameter("allpayments");
00040 
00041         if ( isset( $aAddPayment) && is_array($aAddPayment)) {
00042             foreach ($aAddPayment as $sAdd) {
00043                 $oNewGroup = oxNew( "oxbase" );
00044                 $oNewGroup->init( "oxobject2ipayment" );
00045                 $oNewGroup->oxobject2ipayment__oxpaymentid = new oxField($sAdd);
00046                 $oNewGroup->oxobject2ipayment__oxshopid    = new oxField($myConfig->getShopId());
00047                 $oNewGroup->oxobject2ipayment__oxtype      = new oxField("cc");
00048                 $oNewGroup->save();
00049             }
00050         }
00051     }
00052 
00058     public function removePayment()
00059     {
00060         $myConfig = $this->getConfig();
00061         $aRemovePayment = oxConfig::getParameter( "addpayments");
00062 
00063         if ( isset( $aRemovePayment) && is_array($aRemovePayment) && count($aRemovePayment)) {
00064             $oDb = oxDb::getDb();
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 ) ? ", ":"" ) . " ".$oDb->quote( $sRem );
00070                 $blSep = true;
00071             }
00072             $sQ .= ")";
00073             $oDb->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 = ".oxDb::getDb()->quote( $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 }

Generated on Mon Oct 26 20:07:16 2009 for OXID eShop CE by  doxygen 1.5.5