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 = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023 if ( $soxId != "-1" && isset( $soxId)) {
00024
00025 $iCatLang = oxConfig::getParameter("catlang");
00026
00027 if (!isset($iCatLang))
00028 $iCatLang = $this->_iEditLang;
00029
00030 $this->_aViewData["catlang"] = $iCatLang;
00031
00032 $oCategory->loadInLang( $iCatLang, $soxId );
00033
00034
00035 foreach ( oxLang::getInstance()->getLanguageNames() as $id => $language) {
00036 $oLang= new oxStdClass();
00037 $oLang->sLangDesc = $language;
00038 $oLang->selected = ($id == $this->_iEditLang);
00039 $this->_aViewData["otherlang"][$id] = clone $oLang;
00040 }
00041 }
00042
00043 $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 300, $oCategory, "oxcategories__oxlongdesc", "list.tpl.css");
00044
00045 return "category_text.tpl";
00046 }
00047
00053 public function save()
00054 {
00055 parent::save();
00056
00057 $myConfig = $this->getConfig();
00058
00059 $soxId = $this->getEditObjectId();
00060 $aParams = oxConfig::getParameter( "editval");
00061
00062 $oCategory = oxNew( "oxcategory" );
00063 $iCatLang = oxConfig::getParameter("catlang");
00064 $iCatLang = $iCatLang ? $iCatLang : 0;
00065
00066 if ( $soxId != "-1" ) {
00067 $oCategory->loadInLang( $iCatLang, $soxId );
00068 } else {
00069 $aParams['oxcategories__oxid'] = null;
00070 }
00071
00072
00073 $oCategory->setLanguage(0);
00074 $oCategory->assign( $aParams );
00075 $oCategory->setLanguage( $iCatLang );
00076 $oCategory->save();
00077
00078
00079 $this->setEditObjectId( $oCategory->getId() );
00080 }
00081 }