wrapping_main.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Wrapping_Main extends oxAdminDetails
00010 {
00018     public function render()
00019     {
00020         parent::render();
00021 
00022         $soxId = oxConfig::getParameter( "oxid");
00023         // check if we right now saved a new entry
00024         $sSavedID = oxConfig::getParameter( "saved_oxid");
00025         if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00026             $soxId = $sSavedID;
00027             oxSession::deleteVar( "saved_oxid");
00028             $this->_aViewData["oxid"] =  $soxId;
00029             // for reloading upper frame
00030             $this->_aViewData["updatelist"] =  "1";
00031         }
00032 
00033         if ( $soxId != "-1" && isset( $soxId)) {
00034             // load object
00035             $oWrapping = oxNew( "oxwrapping" );
00036             $oWrapping->loadInLang( $this->_iEditLang, $soxId );
00037 
00038             $oOtherLang = $oWrapping->getAvailableInLangs();
00039             if (!isset($oOtherLang[$this->_iEditLang])) {
00040                 // echo "language entry doesn't exist! using: ".key($oOtherLang);
00041                 $oWrapping->loadInLang( key($oOtherLang), $soxId );
00042             }
00043             $this->_aViewData["edit"] =  $oWrapping;
00044 
00045 
00046             // remove already created languages
00047             $aLang = array_diff ( oxLang::getInstance()->getLanguageNames(), $oOtherLang );
00048             if ( count( $aLang))
00049                 $this->_aViewData["posslang"] = $aLang;
00050 
00051             foreach ( $oOtherLang as $id => $language) {
00052                 $oLang= new oxStdClass();
00053                 $oLang->sLangDesc = $language;
00054                 $oLang->selected = ($id == $this->_iEditLang);
00055                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00056             }
00057         }
00058 
00059         return "wrapping_main.tpl";
00060     }
00061 
00067     public function save()
00068     {
00069         $myConfig  = $this->getConfig();
00070 
00071         $soxId      = oxConfig::getParameter( "oxid");
00072         $aParams    = oxConfig::getParameter( "editval");
00073         // checkbox handling
00074         if ( !isset( $aParams['oxwrapping__oxactive']))
00075             $aParams['oxwrapping__oxactive'] = 0;
00076 
00077             // shopid
00078             $sShopID = oxSession::getVar( "actshop");
00079             $aParams['oxwrapping__oxshopid'] = $sShopID;
00080 
00081         $oWrapping = oxNew( "oxwrapping" );
00082 
00083         if ( $soxId != "-1") {
00084             $oWrapping->loadInLang( $this->_iEditLang, $soxId );
00085                 // #1173M - not all pic are deleted, after article is removed
00086                 oxUtilsPic::getInstance()->overwritePic( $oWrapping, 'oxwrapping', 'oxpic', 'WP', '0', $aParams, $myConfig->getAbsDynImageDir() );
00087         } else
00088             $aParams['oxwrapping__oxid'] = null;
00089         //$aParams = $oWrapping->ConvertNameArray2Idx( $aParams);
00090 
00091 
00092         $oWrapping->setLanguage(0);
00093         $oWrapping->assign( $aParams);
00094         $oWrapping->setLanguage($this->_iEditLang);
00095 
00096         $oWrapping = oxUtilsFile::getInstance()->processFiles( $oWrapping );
00097         $oWrapping->save();
00098         $this->_aViewData["updatelist"] = "1";
00099         // set oxid if inserted
00100         if ( $soxId == "-1")
00101             oxSession::setVar( "saved_oxid", $oWrapping->oxwrapping__oxid->value);
00102 
00103         return $this->autosave();
00104     }
00105 
00111     public function saveinnlang()
00112     {
00113         $soxId      = oxConfig::getParameter( "oxid");
00114         $aParams    = oxConfig::getParameter( "editval");
00115         // checkbox handling
00116         if ( !isset( $aParams['oxwrapping__oxactive']))
00117             $aParams['oxwrapping__oxactive'] = 0;
00118 
00119             // shopid
00120             $sShopID = oxSession::getVar( "actshop");
00121             $aParams['oxwrapping__oxshopid'] = $sShopID;
00122         $oWrapping = oxNew( "oxwrapping" );
00123         if ( $soxId != "-1")
00124             $oWrapping->load( $soxId);
00125         else
00126             $aParams['oxwrapping__oxid'] = null;
00127         //$aParams = $oWrapping->ConvertNameArray2Idx( $aParams);
00128 
00129 
00130         $oWrapping->setLanguage(0);
00131         $oWrapping->assign( $aParams);
00132         $oWrapping->setLanguage($this->_iEditLang);
00133 
00134         $oWrapping = oxUtilsFile::getInstance()->processFiles( $oWrapping );
00135         $oWrapping->save();
00136         $this->_aViewData["updatelist"] = "1";
00137         // set oxid if inserted
00138         if ( $soxId == "-1")
00139             oxSession::setVar( "saved_oxid", $oWrapping->oxwrapping__oxid->value);
00140     }
00141 }

Generated on Thu Dec 4 12:04:56 2008 for OXID eShop CE by  doxygen 1.5.5