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