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 
00073         // checkbox handling
00074         if ( !isset( $aParams['oxwrapping__oxactive']))
00075             $aParams['oxwrapping__oxactive'] = 0;
00076 
00077             // shopid
00078             $aParams['oxwrapping__oxshopid'] = oxSession::getVar( "actshop" );
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 
00113         // checkbox handling
00114         if ( !isset( $aParams['oxwrapping__oxactive']))
00115             $aParams['oxwrapping__oxactive'] = 0;
00116 
00117             // shopid
00118             $aParams['oxwrapping__oxshopid'] = oxSession::getVar( "actshop" );
00119 
00120         $oWrapping = oxNew( "oxwrapping" );
00121         if ( $soxId != "-1")
00122             $oWrapping->load( $soxId);
00123         else
00124             $aParams['oxwrapping__oxid'] = null;
00125         //$aParams = $oWrapping->ConvertNameArray2Idx( $aParams);
00126 
00127 
00128         $oWrapping->setLanguage(0);
00129         $oWrapping->assign( $aParams);
00130         $oWrapping->setLanguage($this->_iEditLang);
00131 
00132         $oWrapping = oxUtilsFile::getInstance()->processFiles( $oWrapping );
00133         $oWrapping->save();
00134         $this->_aViewData["updatelist"] = "1";
00135         // set oxid if inserted
00136         if ( $soxId == "-1")
00137             oxSession::setVar( "saved_oxid", $oWrapping->oxwrapping__oxid->value);
00138     }
00139 }

Generated by  doxygen 1.6.2