news_text.php
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 = oxConfig::getParameter( "oxid");
00020
00021 $sSavedID = oxConfig::getParameter( "saved_oxid");
00022 if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00023 $soxId = $sSavedID;
00024 oxSession::deleteVar( "saved_oxid");
00025 $this->_aViewData["oxid"] = $soxId;
00026
00027 $this->_aViewData["updatelist"] = "1";
00028 }
00029
00030 if ( $soxId != "-1" && isset( $soxId)) {
00031
00032 $oNews = oxNew( "oxnews" );
00033 $iNewsLang = oxConfig::getParameter("newslang");
00034
00035 if (!isset($iNewsLang))
00036 $iNewsLang = $this->_iEditLang;
00037
00038 $this->_aViewData["newslang"] = $iNewsLang;
00039 $oNews->loadInLang( $iNewsLang, $soxId );
00040
00041 foreach ( oxLang::getInstance()->getLanguageNames() as $id => $language) {
00042 $oLang= new oxStdClass();
00043 $oLang->sLangDesc = $language;
00044 $oLang->selected = ($id == $this->_iEditLang);
00045 $this->_aViewData["otherlang"][$id] = clone $oLang;
00046 }
00047
00048
00049 $this->_aViewData["edit"] = $oNews;
00050
00051
00052 }
00053 $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 255, $oNews, "oxnews__oxlongdesc", "news.tpl.css");
00054
00055 return "news_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 $oNews = oxNew( "oxnews" );
00072
00073 $iNewsLang = oxConfig::getParameter("newslang");
00074
00075 if (!isset($iNewsLang))
00076 $iNewsLang = $this->_iEditLang;
00077
00078 if ( $soxId != "-1")
00079 $oNews->loadInLang( $iNewsLang, $soxId );
00080 else
00081 $aParams['oxnews__oxid'] = null;
00082
00083
00084
00085
00086
00087 $oNews->setLanguage(0);
00088 $oNews->assign( $aParams);
00089 $oNews->setLanguage($iNewsLang);
00090
00091 $oNews->save();
00092
00093 if ( $soxId == "-1")
00094 oxSession::setVar( "saved_oxid", $oNews->oxnews__oxid->value);
00095 }
00096
00097 }