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 = $this->_aViewData["oxid"] = $this->getEditObjectId();
00020         if ( $soxId != "-1" && isset( $soxId)) {
00021             // load object
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 ( oxRegistry::getLang()->getLanguageNames() as $id => $language) {
00032                 $oLang= new stdClass();
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         parent::save();
00056 
00057         $myConfig  = $this->getConfig();
00058 
00059         $soxId = $this->getEditObjectId();
00060         $aParams = oxConfig::getParameter( "editval");
00061 
00062         $oNews = oxNew( "oxnews" );
00063 
00064         $iNewsLang = oxConfig::getParameter("newslang");
00065 
00066         if (!isset($iNewsLang))
00067             $iNewsLang = $this->_iEditLang;
00068 
00069         if ( $soxId != "-1")
00070             $oNews->loadInLang( $iNewsLang, $soxId );
00071         else
00072             $aParams['oxnews__oxid'] = null;
00073 
00074 
00075 
00076         //$aParams = $oNews->ConvertNameArray2Idx( $aParams);
00077 
00078         $oNews->setLanguage(0);
00079         $oNews->assign( $aParams);
00080         $oNews->setLanguage($iNewsLang);
00081 
00082         $oNews->save();
00083         // set oxid if inserted
00084         $this->setEditObjectId( $oNews->getId() );
00085     }
00086 
00087 }