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
00023 unset( $this->_aViewData["sumtype"][2]);
00024
00025 $soxId = oxConfig::getParameter( "oxid");
00026
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
00033 $this->_aViewData["updatelist"] = "1";
00034 }
00035
00036 if ( $soxId != "-1" && isset( $soxId)) {
00037
00038 $oPayment = oxNew( "oxpayment" );
00039 $oPayment->loadInLang( $this->_iEditLang, $soxId );
00040
00041 $oOtherLang = $oPayment->getAvailableInLangs();
00042 if (!isset($oOtherLang[$this->_iEditLang])) {
00043
00044 $oPayment->loadInLang( key($oOtherLang), $soxId );
00045 }
00046 $this->_aViewData["edit"] = $oPayment;
00047
00048
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 if ( isset( $sOxId ) && $sOxId != "-1" && is_array( $aChosenCntr ) ) {
00082 foreach ( $aChosenCntr as $sChosenCntr ) {
00083 $oObject2Payment = oxNew( 'oxbase' );
00084 $oObject2Payment->init( 'oxobject2payment' );
00085 $oObject2Payment->oxobject2payment__oxpaymentid = new oxField( $sOxId );
00086 $oObject2Payment->oxobject2payment__oxobjectid = new oxField( $sChosenCntr );
00087 $oObject2Payment->oxobject2payment__oxtype = new oxField( "oxcountry" );
00088 $oObject2Payment->save();
00089 }
00090 }
00091 }
00092
00098 public function removecountry()
00099 {
00100 $sOxId = oxConfig::getParameter( "oxid" );
00101 $aChosenCntr = oxConfig::getParameter( "countries" );
00102 if ( isset( $sOxId ) && $sOxId != "-1" && is_array( $aChosenCntr ) ) {
00103 foreach ( $aChosenCntr as $sChosenCntr ) {
00104 $oObject2Payment = oxNew( 'oxbase' );
00105 $oObject2Payment->init( 'oxobject2payment' );
00106 $oObject2Payment->delete( $sChosenCntr );
00107 }
00108 }
00109 }
00110 }