payment_country.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Payment_Country extends oxAdminDetails
00009 {
00017     public function render()
00018     {
00019         $myConfig = $this->getConfig();
00020         parent::render();
00021 
00022         // remove itm from list
00023         unset( $this->_aViewData["sumtype"][2]);
00024 
00025         $soxId = oxConfig::getParameter( "oxid");
00026         // check if we right now saved a new entry
00027         $sSavedID = oxConfig::getParameter( "saved_oxid");
00028         if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00029             $soxId = $sSavedID;
00030             oxSession::deleteVar( "saved_oxid");
00031             $this->_aViewData["oxid"] =  $soxId;
00032             // for reloading upper frame
00033             $this->_aViewData["updatelist"] =  "1";
00034         }
00035 
00036         if ( $soxId != "-1" && isset( $soxId)) {
00037             // load object
00038             $oPayment = oxNew( "oxpayment" );
00039             $oPayment->loadInLang( $this->_iEditLang, $soxId );
00040 
00041             $oOtherLang = $oPayment->getAvailableInLangs();
00042             if (!isset($oOtherLang[$this->_iEditLang])) {
00043                 // echo "language entry doesn't exist! using: ".key($oOtherLang);
00044                 $oPayment->loadInLang( key($oOtherLang), $soxId );
00045             }
00046             $this->_aViewData["edit"] =  $oPayment;
00047 
00048             // remove already created languages
00049             $aLang = array_diff ( oxLang::getInstance()->getLanguageNames(), $oOtherLang );
00050             if ( count( $aLang))
00051                 $this->_aViewData["posslang"] = $aLang;
00052 
00053             foreach ( $oOtherLang as $id => $language) {
00054                 $oLang= new oxStdClass();
00055                 $oLang->sLangDesc = $language;
00056                 $oLang->selected = ($id == $this->_iEditLang);
00057                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00058             }
00059         }
00060 
00061         if ( oxConfig::getParameter("aoc") ) {
00062 
00063             $aColumns = array();
00064             include_once 'inc/'.strtolower(__CLASS__).'.inc.php';
00065             $this->_aViewData['oxajax'] = $aColumns;
00066 
00067             return "popups/payment_country.tpl";
00068         }
00069         return "payment_country.tpl";
00070     }
00071 
00077     public function addcountry()
00078     {
00079         $soxId = oxConfig::getParameter( "oxid");
00080         $aChosenCntr = oxConfig::getParameter( "allcountries");
00081 
00082         if ( isset( $soxId) && $soxId != "-1" && isset( $aChosenCntr) && $aChosenCntr) {
00083             foreach ( $aChosenCntr as $sChosenCntr) {
00084                 $oObject2Payment = oxNew( 'oxbase' );
00085                 $oObject2Payment->init( 'oxobject2payment' );
00086                 $oObject2Payment->oxobject2payment__oxpaymentid = new oxField($soxId);
00087                 $oObject2Payment->oxobject2payment__oxobjectid  = new oxField($sChosenCntr);
00088                 $oObject2Payment->oxobject2payment__oxtype      = new oxField("oxcountry");
00089                 $oObject2Payment->save();
00090             }
00091         }
00092     }
00093 
00099     public function removecountry()
00100     {
00101         $soxId = oxConfig::getParameter( "oxid");
00102         $aChosenCntr = oxConfig::getParameter( "countries");
00103 
00104         if ( isset( $soxId) && $soxId != "-1" && isset( $aChosenCntr) && $aChosenCntr) {
00105             foreach ( $aChosenCntr as $sChosenCntr) {
00106                 $oObject2Payment = oxNew( 'oxbase' );
00107                 $oObject2Payment->init( 'oxobject2payment' );
00108                 $oObject2Payment->delete( $sChosenCntr );
00109             }
00110         }
00111     }
00112 }

Generated on Wed Apr 22 12:26:30 2009 for OXID eShop CE by  doxygen 1.5.5