category_text.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Category_Text extends oxAdminDetails
00010 {
00017     public function render()
00018     {
00019         parent::render();
00020 
00021         $this->_aViewData['edit'] = $oCategory = oxNew( 'oxcategory' );
00022 
00023         $soxId = oxConfig::getParameter( "oxid");
00024         // check if we right now saved a new entry
00025         $sSavedID = oxConfig::getParameter( "saved_oxid");
00026         if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00027             $soxId = $sSavedID;
00028             oxSession::deleteVar( "saved_oxid");
00029             $this->_aViewData["oxid"] =  $soxId;
00030             // for reloading upper frame
00031             $this->_aViewData["updatelist"] =  "1";
00032         }
00033 
00034         if ( $soxId != "-1" && isset( $soxId)) {
00035             // load object
00036             $iCatLang = oxConfig::getParameter("catlang");
00037 
00038             if (!isset($iCatLang))
00039                 $iCatLang = $this->_iEditLang;
00040 
00041             $this->_aViewData["catlang"] = $iCatLang;
00042 
00043             $oCategory->loadInLang( $iCatLang, $soxId );
00044 
00045 
00046             foreach ( oxLang::getInstance()->getLanguageNames() as $id => $language) {
00047                 $oLang= new oxStdClass();
00048                 $oLang->sLangDesc = $language;
00049                 $oLang->selected = ($id == $this->_iEditLang);
00050                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00051             }
00052         }
00053 
00054         $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 300, $oCategory, "oxcategories__oxlongdesc", "list.tpl.css");
00055 
00056         return "category_text.tpl";
00057     }
00058 
00064     public function save()
00065     {
00066         $myConfig  = $this->getConfig();
00067 
00068 
00069         $soxId      = oxConfig::getParameter( "oxid");
00070         $aParams    = oxConfig::getParameter( "editval");
00071 
00072 
00073         $oCategory = oxNew( "oxcategory" );
00074         //P
00075         //$oCategory->setLanguage(oxConfig::getParameter("editlanguage"));
00076 
00077         $iCatLang = oxConfig::getParameter("catlang");
00078 
00079         if (!$iCatLang)
00080             $iCatLang = 0;
00081 
00082         if(  $soxId != "-1")
00083             $oCategory->loadInLang( $iCatLang, $soxId );
00084         else
00085             $aParams['oxcategories__oxid'] = null;
00086 
00087 
00088         $oCategory->setLanguage(0);
00089         $oCategory->assign( $aParams);
00090         $oCategory->setLanguage($iCatLang);
00091         $oCategory->save();
00092         // set oxid if inserted
00093         if ( $soxId == "-1")
00094             oxSession::setVar( "saved_oxid", $oCategory->oxcategories__oxid->value);
00095 
00096         return $this->autosave();
00097     }
00098 }

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