shop_list.php

Go to the documentation of this file.
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             // for reloading upper frame
00070             $this->_aViewData['updatelist'] = '1';
00071         }
00072 
00073         if ( $soxId != '-1' && isset( $soxId ) ) {
00074             // load object
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         // default page number 1
00084         $this->_aViewData['default_edit'] = 'shop_main';
00085         $this->_aViewData['updatemain']   = $this->_blUpdateMain;
00086 
00087         $this->_aViewData['oxid'] =  $soxId;
00088 
00089         //making sure we really change shops on low level
00090         if ( $soxId && $soxId != '-1' ) {
00091             $myConfig->setShopId( $soxId );
00092             oxSession::setVar( 'currentadminshop', $soxId );
00093         }
00094 
00095         return 'shop_list.tpl';
00096     }
00097 
00103     public function buildWhere()
00104     {
00105         // we override this to add our shop if we are not malladmin
00106         $this->_aWhere = parent::buildWhere();
00107 
00108         $blisMallAdmin = oxSession::getVar( 'malladmin' );
00109         if ( !$blisMallAdmin) {
00110             // we only allow to see our shop
00111             $sShopID = oxSession::getVar( "actshop" );
00112             $this->_aWhere['oxshops.oxid'] = "$sShopID";
00113         }
00114 
00115         return $this->_aWhere;
00116     }
00117 
00123     public function deleteEntry()
00124     {
00125         $myConfig  = $this->getConfig();
00126 
00127         $soxId   = oxConfig::getParameter( "oxid");
00128 
00129 
00130         // try to remove directories
00131         $soxId   = strtr($soxId, "\\/", "__");
00132         $sTarget = $myConfig->getConfigParam( 'sShopDir' ) . "/out/" . $soxId;
00133         oxUtilsFile::getInstance()->deleteDir( $sTarget);
00134 
00135         $oDelete = oxNew( "oxShop" );
00136         $aTables = $myConfig->getConfigParam( 'aMultiShopTables' );
00137         $oDelete->setMultiShopTables($aTables);
00138 
00139 
00140         $oDelete->delete( $soxId );
00141 
00142 
00143         // if removing acutally selected shop then switch to shop 1
00144         if ( $soxId == $myConfig->getShopId()) {
00145             $sShopId = $myConfig->getBaseShopId();
00146         } else {
00147             $sShopId = $myConfig->getShopId();
00148         }
00149 
00150         $myConfig->setShopId( $sShopId );
00151 
00152         $this->init();
00153     }
00154 }

Generated on Wed May 13 13:25:50 2009 for OXID eShop CE by  doxygen 1.5.5