category_text.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Category_Text extends oxAdminDetails
00009 {
00010 
00017     public function render()
00018     {
00019         parent::render();
00020 
00021         $this->_aViewData['edit'] = $oCategory = oxNew('oxcategory');
00022 
00023         $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00024         if ($soxId != "-1" && isset($soxId)) {
00025             // load object
00026             $iCatLang = oxRegistry::getConfig()->getRequestParameter("catlang");
00027 
00028             if (!isset($iCatLang)) {
00029                 $iCatLang = $this->_iEditLang;
00030             }
00031 
00032             $this->_aViewData["catlang"] = $iCatLang;
00033 
00034             $oCategory->loadInLang($iCatLang, $soxId);
00035 
00036 
00037             foreach (oxRegistry::getLang()->getLanguageNames() as $id => $language) {
00038                 $oLang = new stdClass();
00039                 $oLang->sLangDesc = $language;
00040                 $oLang->selected = ($id == $this->_iEditLang);
00041                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00042             }
00043         }
00044 
00045         $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oCategory, "oxcategories__oxlongdesc", "list.tpl.css");
00046 
00047         return "category_text.tpl";
00048     }
00049 
00055     public function save()
00056     {
00057         parent::save();
00058 
00059         $myConfig = $this->getConfig();
00060 
00061         $soxId = $this->getEditObjectId();
00062         $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00063 
00064         $oCategory = oxNew("oxcategory");
00065         $iCatLang = oxRegistry::getConfig()->getRequestParameter("catlang");
00066         $iCatLang = $iCatLang ? $iCatLang : 0;
00067 
00068         if ($soxId != "-1") {
00069             $oCategory->loadInLang($iCatLang, $soxId);
00070         } else {
00071             $aParams['oxcategories__oxid'] = null;
00072         }
00073 
00074 
00075         $oCategory->setLanguage(0);
00076         $oCategory->assign($aParams);
00077         $oCategory->setLanguage($iCatLang);
00078         $oCategory->save();
00079 
00080         // set oxid if inserted
00081         $this->setEditObjectId($oCategory->getId());
00082     }
00083 }