wrapping_main.php

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

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