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 if ( $soxId != "-1") {
00083 $oShop->loadInLang( 0, $soxId );
00084 } else {
00085 $aParams['oxshops__oxid'] = null;
00086 }
00087
00088 if ($aParams['oxshops__oxsmtp']) {
00089 $aParams['oxshops__oxsmtp'] = trim($aParams['oxshops__oxsmtp']);
00090 }
00091
00092
00093 $oShop->assign( $aParams);
00094
00095 $sNewSMPTPass = oxConfig::getParameter( "oxsmtppwd");
00096
00097 if ($sNewSMPTPass)
00098 $oShop->oxshops__oxsmtppwd->setValue($sNewSMPTPass);
00099
00100 if ($sNewSMPTPass == '-')
00101 $oShop->oxshops__oxsmtppwd->setValue("");
00102
00103 $isubjlang = oxConfig::getParameter("subjlang");
00104 if ($isubjlang && $isubjlang > 0) {
00105 $oShop->setLanguage($isubjlang);
00106 }
00107
00108
00109 $oShop->save();
00110
00111
00112 $this->_aViewData["updatelist"] = "1";
00113
00114 oxSession::setVar( "actshop", $soxId);
00115 }
00116
00117
00123 protected function _getShopIds()
00124 {
00125
00126 $sQ = "select oxid, oxname from oxshops";
00127 $aShopIds = array();
00128 $rs = oxDb::getDb()->execute($sQ);
00129 if ($rs != false && $rs->recordCount() > 0) {
00130 while (!$rs->EOF) {
00131 $oShop = new stdClass();
00132 $oShop->oxid = $rs->fields[0];
00133 $oShop->oxname = $rs->fields[1];
00134 $aShopIds[$rs->fields[0]] = $oShop;
00135 $rs->moveNext();
00136 }
00137 }
00138
00139 return $aShopIds;
00140 }
00141
00142 }