Go to the documentation of this file.00001 <?php
00002
00008 class Adminlinks_Main extends oxAdminDetails
00009 {
00016 public function render()
00017 {
00018 $myConfig = $this->getConfig();
00019
00020 parent::render();
00021
00022 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023 if ( $soxId != "-1" && isset( $soxId)) {
00024
00025 $oLinks = oxNew( "oxlinks", getViewName( 'oxlinks'));
00026 $oLinks->loadInLang( $this->_iEditLang, $soxId );
00027
00028 $oOtherLang = $oLinks->getAvailableInLangs();
00029 if (!isset($oOtherLang[$this->_iEditLang])) {
00030
00031 $oLinks->loadInLang( key($oOtherLang), $soxId );
00032 }
00033 $this->_aViewData["edit"] = $oLinks;
00034
00035
00036 $this->_aViewData["posslang"] = array_diff (oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
00037
00038 foreach ( $oOtherLang as $id => $language) {
00039 $oLang= new stdClass();
00040 $oLang->sLangDesc = $language;
00041 $oLang->selected = ($id == $this->_iEditLang);
00042 $this->_aViewData["otherlang"][$id] = clone $oLang;
00043 }
00044 }
00045
00046
00047 $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 255, $oLinks, "oxlinks__oxurldesc", "links.tpl.css");
00048
00049 return "adminlinks_main.tpl";
00050 }
00051
00057 public function save()
00058 {
00059 $soxId = $this->getEditObjectId();
00060 $aParams = oxConfig::getParameter( "editval");
00061
00062 if ( !isset( $aParams['oxlinks__oxactive']))
00063 $aParams['oxlinks__oxactive'] = 0;
00064
00065
00066
00067 if (isset($aParams['oxlinks__oxurldesc']) && strlen($aParams['oxlinks__oxurldesc']) == 0)
00068 $aParams['oxlinks__oxurldesc'] .= " ";
00069
00070 if ( !$aParams['oxlinks__oxinsert']) {
00071
00072
00073 $sDate = date(oxRegistry::getLang()->translateString( "simpleDateFormat"));
00074 if ($sDate == "simpleDateFormat")
00075 $aParams['oxlinks__oxinsert'] = date( "Y-m-d");
00076 else
00077 $aParams['oxlinks__oxinsert'] = $sDate;
00078 }
00079
00080 $iEditLanguage = oxConfig::getParameter("editlanguage");
00081 $oLinks = oxNew( "oxlinks", getViewName( 'oxlinks'));
00082
00083 if ( $soxId != "-1") {
00084
00085 $oLinks->loadInLang( $iEditLanguage, $soxId );
00086
00087 } else {
00088 $aParams['oxlinks__oxid'] = null;
00089 }
00090
00091
00092
00093 $oLinks->setLanguage(0);
00094 $oLinks->assign( $aParams);
00095 $oLinks->setLanguage( $iEditLanguage );
00096 $oLinks->save();
00097
00098 parent::save();
00099
00100
00101 $this->setEditObjectId( $oLinks->getId() );
00102 }
00103
00109 public function saveinnlang()
00110 {
00111 $soxId = $this->getEditObjectId();
00112 $aParams = oxConfig::getParameter( "editval");
00113
00114 if ( !isset( $aParams['oxlinks__oxactive']))
00115 $aParams['oxlinks__oxactive'] = 0;
00116
00117
00118 $sShopID = oxSession::getVar( "actshop");
00119 $aParams['oxlinks__oxshopid'] = $sShopID;
00120 $oLinks = oxNew( "oxlinks", getViewName( 'oxlinks'));
00121 $iEditLanguage = oxConfig::getParameter("editlanguage");
00122
00123 if( $soxId != "-1")
00124 $oLinks->loadInLang( $iEditLanguage, $soxId );
00125 else
00126 $aParams['oxlinks__oxid'] = null;
00127
00128
00129
00130
00131 $oLinks->setLanguage(0);
00132 $oLinks->assign( $aParams);
00133
00134
00135 $oLinks->setLanguage( oxConfig::getParameter( "new_lang" ) );
00136 $oLinks->save();
00137
00138
00139 $this->setEditObjectId( $oLinks->getId() );
00140 }
00141
00153
00154
00155
00156
00157
00158
00159
00160
00161 }