Go to the documentation of this file.00001 <?php
00002
00008 class Wrapping_Main extends oxAdminDetails
00009 {
00017 public function render()
00018 {
00019 parent::render();
00020
00021 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00022 if ( $soxId != "-1" && isset( $soxId)) {
00023
00024 $oWrapping = oxNew( "oxwrapping" );
00025 $oWrapping->loadInLang( $this->_iEditLang, $soxId );
00026
00027 $oOtherLang = $oWrapping->getAvailableInLangs();
00028 if (!isset($oOtherLang[$this->_iEditLang])) {
00029
00030 $oWrapping->loadInLang( key($oOtherLang), $soxId );
00031 }
00032 $this->_aViewData["edit"] = $oWrapping;
00033
00034
00035
00036 $aLang = array_diff ( oxLang::getInstance()->getLanguageNames(), $oOtherLang );
00037 if ( count( $aLang))
00038 $this->_aViewData["posslang"] = $aLang;
00039
00040 foreach ( $oOtherLang as $id => $language) {
00041 $oLang= new oxStdClass();
00042 $oLang->sLangDesc = $language;
00043 $oLang->selected = ($id == $this->_iEditLang);
00044 $this->_aViewData["otherlang"][$id] = clone $oLang;
00045 }
00046 }
00047
00048 return "wrapping_main.tpl";
00049 }
00050
00056 public function save()
00057 {
00058 $myConfig = $this->getConfig();
00059
00060 $soxId = $this->getEditObjectId();
00061 $aParams = oxConfig::getParameter( "editval");
00062
00063
00064 if ( !isset( $aParams['oxwrapping__oxactive']))
00065 $aParams['oxwrapping__oxactive'] = 0;
00066
00067
00068 $aParams['oxwrapping__oxshopid'] = oxSession::getVar( "actshop" );
00069
00070 $oWrapping = oxNew( "oxwrapping" );
00071
00072 if ( $soxId != "-1") {
00073 $oWrapping->loadInLang( $this->_iEditLang, $soxId );
00074
00075 oxUtilsPic::getInstance()->overwritePic( $oWrapping, 'oxwrapping', 'oxpic', 'WP', '0', $aParams, $myConfig->getPictureDir(false) );
00076 } else
00077 $aParams['oxwrapping__oxid'] = null;
00078
00079
00080
00081 $oWrapping->setLanguage(0);
00082 $oWrapping->assign( $aParams);
00083 $oWrapping->setLanguage($this->_iEditLang);
00084
00085 $oWrapping = oxUtilsFile::getInstance()->processFiles( $oWrapping );
00086 $oWrapping->save();
00087
00088
00089 $this->setEditObjectId( $oWrapping->getId() );
00090 }
00091
00097 public function saveinnlang()
00098 {
00099 $soxId = $this->getEditObjectId();
00100 $aParams = oxConfig::getParameter( "editval");
00101
00102
00103 if ( !isset( $aParams['oxwrapping__oxactive']))
00104 $aParams['oxwrapping__oxactive'] = 0;
00105
00106
00107 $aParams['oxwrapping__oxshopid'] = oxSession::getVar( "actshop" );
00108
00109 $oWrapping = oxNew( "oxwrapping" );
00110 if ( $soxId != "-1")
00111 $oWrapping->load( $soxId);
00112 else
00113 $aParams['oxwrapping__oxid'] = null;
00114
00115
00116
00117 $oWrapping->setLanguage(0);
00118 $oWrapping->assign( $aParams);
00119 $oWrapping->setLanguage($this->_iEditLang);
00120
00121 $oWrapping = oxUtilsFile::getInstance()->processFiles( $oWrapping );
00122 $oWrapping->save();
00123
00124
00125 $this->setEditObjectId( $oWrapping->getId() );
00126 }
00127 }