00001 <?php
00002
00008 class Shop_List extends oxAdminList
00009 {
00010 protected $_blUpdateMain = false;
00011
00017 protected $_sDefSort = 'oxshops.oxname';
00018
00024 protected $_sListClass = 'oxshop';
00025
00031 protected $_blUpdateNav = null;
00032
00039 public function init()
00040 {
00041 $this->_blEmployMultilanguage = false;
00042 parent::Init();
00043
00044
00045 $this->_blEmployMultilanguage = true;
00046 }
00047
00054 public function render()
00055 {
00056 $myConfig = $this->getConfig();
00057
00058 parent::render();
00059
00060 $soxId = oxConfig::getParameter( 'oxid' );
00061 if ( !$soxId ) {
00062 $soxId = $myConfig->getShopId();
00063 }
00064
00065 $sSavedID = oxConfig::getParameter( 'saved_oxid' );
00066 if ( ( $soxId == '-1' || !isset( $soxId ) ) && isset( $sSavedID ) ) {
00067 $soxId = $sSavedID;
00068 oxSession::deleteVar( 'saved_oxid' );
00069
00070 $this->_aViewData['updatelist'] = '1';
00071 }
00072
00073 if ( $soxId != '-1' && isset( $soxId ) ) {
00074
00075 $oShop = oxNew( 'oxshop' );
00076 if ( !$oShop->load( $soxId ) ) {
00077 $soxId = $myConfig->getBaseShopId();
00078 $oShop->load( $soxId );
00079 }
00080 $this->_aViewData['editshop'] = $oShop;
00081 }
00082
00083
00084 $this->_aViewData['default_edit'] = 'shop_main';
00085 $this->_aViewData['updatemain'] = $this->_blUpdateMain;
00086
00087 $this->_aViewData['oxid'] = $soxId;
00088
00089 if ( $this->_aViewData['updatenav'] ) {
00090
00091 oxSession::setVar( "navReload", true );
00092 }
00093
00094
00095 if ( $soxId && $soxId != '-1' ) {
00096 $myConfig->setShopId( $soxId );
00097 oxSession::setVar( 'currentadminshop', $soxId );
00098 }
00099
00100 return 'shop_list.tpl';
00101 }
00102
00108 public function buildWhere()
00109 {
00110
00111 $this->_aWhere = parent::buildWhere();
00112
00113 $blisMallAdmin = oxSession::getVar( 'malladmin' );
00114 if ( !$blisMallAdmin) {
00115
00116 $sShopID = oxSession::getVar( "actshop" );
00117 $this->_aWhere['oxshops.oxid'] = "$sShopID";
00118 }
00119
00120 return $this->_aWhere;
00121 }
00122
00128 public function deleteEntry()
00129 {
00130 $myConfig = $this->getConfig();
00131 $soxId = oxConfig::getParameter( "delshopid");
00132
00133
00134
00135 $soxId = strtr($soxId, "\\/", "__");
00136 $sTarget = $myConfig->getConfigParam( 'sShopDir' ) . "/out/" . $soxId;
00137 oxUtilsFile::getInstance()->deleteDir( $sTarget);
00138
00139 $oDelete = oxNew( "oxShop" );
00140 $aTables = $myConfig->getConfigParam( 'aMultiShopTables' );
00141 $oDelete->setMultiShopTables($aTables);
00142
00143
00144 $oDelete->delete( $soxId );
00145
00146
00147
00148 if ( $soxId == $myConfig->getShopId()) {
00149 $sShopId = $myConfig->getBaseShopId();
00150 } else {
00151 $sShopId = $myConfig->getShopId();
00152 }
00153
00154 $myConfig->setShopId( $sShopId );
00155
00156 $this->init();
00157 }
00158 }