Go to the documentation of this file.00001 <?php
00002
00009 class DeliverySet_Main extends oxAdminDetails
00010 {
00017 public function render()
00018 {
00019 $myConfig = $this->getConfig();
00020 parent::render();
00021
00022 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023 if ( $soxId != "-1" && isset( $soxId)) {
00024
00025 $odeliveryset = oxNew( "oxdeliveryset" );
00026 $odeliveryset->loadInLang( $this->_iEditLang, $soxId );
00027
00028 $oOtherLang = $odeliveryset->getAvailableInLangs();
00029
00030 if (!isset($oOtherLang[$this->_iEditLang])) {
00031
00032 $odeliveryset->loadInLang( key($oOtherLang), $soxId );
00033 }
00034
00035 $this->_aViewData["edit"] = $odeliveryset;
00036
00037
00038
00039 $aLang = array_diff ( oxLang::getInstance()->getLanguageNames(), $oOtherLang );
00040 if ( count( $aLang))
00041 $this->_aViewData["posslang"] = $aLang;
00042
00043 foreach ( $oOtherLang as $id => $language) {
00044 $oLang= new oxStdClass();
00045 $oLang->sLangDesc = $language;
00046 $oLang->selected = ($id == $this->_iEditLang);
00047 $this->_aViewData["otherlang"][$id] = clone $oLang;
00048 }
00049 }
00050
00051 if ( oxConfig::getParameter("aoc") ) {
00052
00053 $aColumns = array();
00054 include_once 'inc/'.strtolower(__CLASS__).'.inc.php';
00055 $this->_aViewData['oxajax'] = $aColumns;
00056
00057 return "popups/deliveryset_main.tpl";
00058 }
00059
00060 return "deliveryset_main.tpl";
00061 }
00062
00068 public function save()
00069 {
00070
00071 $soxId = $this->getEditObjectId();
00072 $aParams = oxConfig::getParameter( "editval");
00073
00074
00075 $sShopID = oxSession::getVar( "actshop");
00076 $aParams['oxdeliveryset__oxshopid'] = $sShopID;
00077 $oDelSet = oxNew( "oxdeliveryset" );
00078
00079 if ( $soxId != "-1")
00080 $oDelSet->loadInLang( $this->_iEditLang, $soxId );
00081 else
00082 $aParams['oxdeliveryset__oxid'] = null;
00083
00084 if ( !isset( $aParams['oxdeliveryset__oxactive']))
00085 $aParams['oxdeliveryset__oxactive'] = 0;
00086
00087
00088
00089 $oDelSet->setLanguage(0);
00090 $oDelSet->assign( $aParams);
00091 $oDelSet->setLanguage($this->_iEditLang);
00092 $oDelSet = oxUtilsFile::getInstance()->processFiles( $oDelSet );
00093 $oDelSet->save();
00094
00095
00096 $this->setEditObjectId( $oDelSet->getId() );
00097 }
00098
00104 public function saveinnlang()
00105 {
00106 $soxId = $this->getEditObjectId();
00107 $aParams = oxConfig::getParameter( "editval");
00108
00109 if( !isset( $aParams['oxdeliveryset__oxactive']))
00110 $aParams['oxdeliveryset__oxactive'] = 0;
00111
00112
00113 $sShopID = oxSession::getVar( "actshop");
00114 $aParams['oxdeliveryset__oxshopid'] = $sShopID;
00115 $oDelSet = oxNew( "oxdeliveryset" );
00116
00117 if ( $soxId != "-1")
00118 $oDelSet->loadInLang( $this->_iEditLang, $soxId );
00119 else
00120 $aParams['oxdeliveryset__oxid'] = null;
00121
00122
00123 $oDelSet->setLanguage(0);
00124 $oDelSet->assign( $aParams);
00125
00126
00127
00128 $oDelSet->setLanguage( oxConfig::getParameter( "new_lang" ) );
00129 $oDelSet->save();
00130
00131
00132 $this->setEditObjectId( $oDelSet->getId() );
00133 }
00134 }