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
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
00030 $this->_aViewData["updatelist"] = "1";
00031 }
00032
00033 if ( $soxId != "-1" && isset( $soxId)) {
00034
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 $oCategory = oxNew( "oxcategory" );
00072 $iCatLang = oxConfig::getParameter("catlang");
00073 $iCatLang = $iCatLang ? $iCatLang : 0;
00074
00075 if ( $soxId != "-1" ) {
00076 $oCategory->loadInLang( $iCatLang, $soxId );
00077 } else {
00078 $aParams['oxcategories__oxid'] = null;
00079 }
00080
00081
00082 $oCategory->setLanguage(0);
00083 $oCategory->assign( $aParams );
00084 $oCategory->setLanguage( $iCatLang );
00085 $oCategory->save();
00086
00087
00088 if ( $soxId == "-1") {
00089 oxSession::setVar( "saved_oxid", $oCategory->oxcategories__oxid->value);
00090 }
00091 }
00092 }