Go to the documentation of this file.00001 <?php
00002
00003
00009 class Shop_Main extends oxAdminDetails
00010 {
00018 public function render()
00019 {
00020 $myConfig = $this->getConfig();
00021
00022 parent::render();
00023
00024 $soxId = oxConfig::getParameter( "oxid");
00025
00026
00027 if ( $soxId != "-1" && isset( $soxId)) {
00028
00029 $oShop = oxNew( "oxshop" );
00030 $isubjlang = oxConfig::getParameter("subjlang");
00031 if ( !isset($isubjlang))
00032 $isubjlang = $this->_iEditLang;
00033
00034 if ($isubjlang && $isubjlang > 0) {
00035 $this->_aViewData["subjlang"] = $isubjlang;
00036 }
00037
00038 $oShop->loadInLang( $isubjlang, $soxId );
00039
00040 $this->_aViewData["edit"] = $oShop;
00041
00042 oxSession::setVar( "shp", $soxId);
00043 }
00044
00045
00046 $this->_aViewData['IsOXDemoShop'] = $myConfig->isDemoShop();
00047 if ( !isset( $this->_aViewData['updatenav'] ) ) {
00048 $this->_aViewData['updatenav'] = oxConfig::getParameter( 'updatenav' );
00049 }
00050
00051 return "shop_main.tpl";
00052 }
00053
00059 public function save()
00060 {
00061 $myConfig = $this->getConfig();
00062
00063
00064 $soxId = oxConfig::getParameter( "oxid");
00065 $aParams = oxConfig::getParameter( "editval");
00066
00067
00068
00069
00070 if ( isset( $aParams['oxshops__oxactive']) && $aParams['oxshops__oxactive'] == true)
00071 $aParams['oxshops__oxactive'] = 1;
00072 else
00073 $aParams['oxshops__oxactive'] = 0;
00074
00075 if ( isset( $aParams['oxshops__oxproductive']) && $aParams['oxshops__oxproductive'] == true)
00076 $aParams['oxshops__oxproductive'] = 1;
00077 else
00078 $aParams['oxshops__oxproductive'] = 0;
00079
00080 $oShop = oxNew( "oxshop" );
00081
00082
00083 $isubjlang = oxConfig::getParameter("subjlang");
00084 if ( $isubjlang && $isubjlang > 0 ) {
00085 $iLang = $isubjlang;
00086 } else {
00087 $iLang = 0;
00088 }
00089
00090 if ( $soxId != "-1") {
00091 $oShop->loadInLang( $iLang, $soxId );
00092 } else {
00093 $aParams['oxshops__oxid'] = null;
00094 }
00095
00096 if ($aParams['oxshops__oxsmtp']) {
00097 $aParams['oxshops__oxsmtp'] = trim($aParams['oxshops__oxsmtp']);
00098 }
00099
00100 $oShop->setLanguage(0);
00101
00102 $oShop->assign( $aParams);
00103 $oShop->setLanguage($iLang);
00104
00105 $sNewSMPTPass = oxConfig::getParameter( "oxsmtppwd");
00106
00107 if ($sNewSMPTPass) {
00108 $oShop->oxshops__oxsmtppwd->setValue($sNewSMPTPass);
00109 }
00110
00111 if ($sNewSMPTPass == '-') {
00112 $oShop->oxshops__oxsmtppwd->setValue("");
00113 }
00114
00115
00116 $oShop->save();
00117
00118
00119 $this->_aViewData["updatelist"] = "1";
00120
00121 oxSession::setVar( "actshop", $soxId);
00122 }
00123
00124
00130 protected function _getShopIds()
00131 {
00132
00133 $aShopIds = array();
00134 $sRs = oxDb::getDb()->execute( "select oxid, oxname from oxshops" );
00135 if ($sRs != false && $sRs->recordCount() > 0) {
00136 while ( !$sRs->EOF ) {
00137 $aShopIds[$sRs->fields[0]] = new oxStdClass();
00138 $aShopIds[$sRs->fields[0]]->oxid = $sRs->fields[0];
00139 $aShopIds[$sRs->fields[0]]->oxname = $sRs->fields[1];
00140 $sRs->moveNext();
00141 }
00142 }
00143
00144 return $aShopIds;
00145 }
00146
00147 }