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             $sQ  = "delete from oxobject2ipayment where oxobject2ipayment.oxshopid='".$myConfig->getShopId()."' ";
00065             $sQ .= "and oxobject2ipayment.oxid in (";
00066             $blSep = false;
00067             foreach ($aRemovePayment as $sRem) {
00068                 $sQ .= ( ( $blSep ) ? ", ":"" ) . " '$sRem'";
00069                 $blSep = true;
00070             }
00071             $sQ .= ")";
00072             oxDb::getDb()->Execute( $sQ);
00073         }
00074     }
00075 
00081     public function savePayment()
00082     {
00083         $myConfig = $this->getConfig();
00084         $sActPayment = oxConfig::getParameter("oxpaymentid");
00085         $aParams     = oxConfig::getParameter("editval");
00086 
00087         $oActPayment = oxNew( "oxbase" );
00088         $oActPayment->init( "oxobject2ipayment" );
00089 
00090         $sQ  = "select * from oxobject2ipayment where oxobject2ipayment.oxshopid='".$myConfig->getShopId()."'
00091                 and oxobject2ipayment.oxid = '$sActPayment' ";
00092 
00093         if ( $oActPayment->assignRecord( $sQ ) && is_array( $aParams ) ) {
00094             foreach ( $aParams as $sField => $sValue ) {
00095                 if ( isset( $oActPayment->$sField ) ) {
00096                     $oActPayment->$sField = new oxField($sValue);
00097                 }
00098             }
00099             $oActPayment->save();
00100         }
00101     }
00102 
00108     public function setFilter()
00109     {
00110         $this->blfiltering = true;
00111     }
00112 
00116     public function getViewId()
00117     {
00118         return 'dyn_interface';
00119     }
00120 }

Generated on Tue Apr 21 15:45:43 2009 for OXID eShop CE by  doxygen 1.5.5