news_text.php

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