category_text.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Category_Text extends oxAdminDetails
00009 {
00016     public function render()
00017     {
00018         parent::render();
00019 
00020         $this->_aViewData['edit'] = $oCategory = oxNew( 'oxcategory' );
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             $iCatLang = oxConfig::getParameter("catlang");
00036 
00037             if (!isset($iCatLang))
00038                 $iCatLang = $this->_iEditLang;
00039 
00040             $this->_aViewData["catlang"] = $iCatLang;
00041 
00042             $oCategory->loadInLang( $iCatLang, $soxId );
00043 
00044 
00045             foreach ( oxLang::getInstance()->getLanguageNames() as $id => $language) {
00046                 $oLang= new oxStdClass();
00047                 $oLang->sLangDesc = $language;
00048                 $oLang->selected = ($id == $this->_iEditLang);
00049                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00050             }
00051         }
00052 
00053         $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 300, $oCategory, "oxcategories__oxlongdesc", "list.tpl.css");
00054 
00055         return "category_text.tpl";
00056     }
00057 
00063     public function save()
00064     {
00065         $myConfig  = $this->getConfig();
00066 
00067 
00068         $soxId      = oxConfig::getParameter( "oxid");
00069         $aParams    = oxConfig::getParameter( "editval");
00070 
00071 
00072         $oCategory = oxNew( "oxcategory" );
00073         //P
00074         //$oCategory->setLanguage(oxConfig::getParameter("editlanguage"));
00075 
00076         $iCatLang = oxConfig::getParameter("catlang");
00077 
00078         if (!$iCatLang)
00079             $iCatLang = 0;
00080 
00081         if(  $soxId != "-1")
00082             $oCategory->loadInLang( $iCatLang, $soxId );
00083         else
00084             $aParams['oxcategories__oxid'] = null;
00085 
00086 
00087         $oCategory->setLanguage(0);
00088         $oCategory->assign( $aParams);
00089         $oCategory->setLanguage($iCatLang);
00090         $oCategory->save();
00091         // set oxid if inserted
00092         if ( $soxId == "-1")
00093             oxSession::setVar( "saved_oxid", $oCategory->oxcategories__oxid->value);
00094     }
00095 }

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