news_text.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class News_Text extends oxAdminDetails
00008 {
00015     public function render()
00016     {   $myConfig = $this->getConfig();
00017 
00018         parent::render();
00019 
00020         $soxId = oxConfig::getParameter( "oxid");
00021         // check if we right now saved a new entry
00022         $sSavedID = oxConfig::getParameter( "saved_oxid");
00023         if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00024             $soxId = $sSavedID;
00025             oxSession::deleteVar( "saved_oxid");
00026             $this->_aViewData["oxid"] =  $soxId;
00027             // for reloading upper frame
00028             $this->_aViewData["updatelist"] =  "1";
00029         }
00030 
00031         if ( $soxId != "-1" && isset( $soxId)) {
00032             // load object
00033             $oNews = oxNew( "oxnews" );
00034             $iNewsLang = oxConfig::getParameter("newslang");
00035 
00036             if (!isset($iNewsLang))
00037                 $iNewsLang = $this->_iEditLang;
00038 
00039             $this->_aViewData["newslang"] = $iNewsLang;
00040             $oNews->loadInLang( $iNewsLang, $soxId );
00041 
00042             foreach ( oxLang::getInstance()->getLanguageNames() as $id => $language) {
00043                 $oLang= new oxStdClass();
00044                 $oLang->sLangDesc = $language;
00045                 $oLang->selected = ($id == $this->_iEditLang);
00046                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00047             }
00048 
00049 
00050             $this->_aViewData["edit"] =  $oNews;
00051 
00052 
00053         }
00054         $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 255, $oNews, "oxnews__oxlongdesc", "news.tpl.css");
00055 
00056         return "news_text.tpl";
00057     }
00058 
00064     public function save()
00065     {
00066         $myConfig  = $this->getConfig();
00067 
00068 
00069         $soxId      = oxConfig::getParameter( "oxid");
00070         $aParams    = oxConfig::getParameter( "editval");
00071 
00072         $oNews = oxNew( "oxnews" );
00073 
00074         $iNewsLang = oxConfig::getParameter("newslang");
00075 
00076         if (!isset($iNewsLang))
00077             $iNewsLang = $this->_iEditLang;
00078 
00079         if ( $soxId != "-1")
00080             $oNews->loadInLang( $iNewsLang, $soxId );
00081         else
00082             $aParams['oxnews__oxid'] = null;
00083 
00084 
00085 
00086         //$aParams = $oNews->ConvertNameArray2Idx( $aParams);
00087 
00088         $oNews->setLanguage(0);
00089         $oNews->assign( $aParams);
00090         $oNews->setLanguage($iNewsLang);
00091 
00092         $oNews->save();
00093         // set oxid if inserted
00094         if ( $soxId == "-1")
00095             oxSession::setVar( "saved_oxid", $oNews->oxnews__oxid->value);
00096 
00097         return $this->autosave();
00098     }
00099 
00100 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5