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         if ( $this->_aViewData['updatenav'] ) {
00090             //skipping requirements checking when reloading nav frame
00091             oxSession::setVar( "navReload", true );
00092         }
00093 
00094         //making sure we really change shops on low level
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         // we override this to add our shop if we are not malladmin
00111         $this->_aWhere = parent::buildWhere();
00112 
00113         $blisMallAdmin = oxSession::getVar( 'malladmin' );
00114         if ( !$blisMallAdmin) {
00115             // we only allow to see our shop
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 
00132         $soxId   = oxConfig::getParameter( "delshopid");
00133 
00134 
00135         // try to remove directories
00136         $soxId   = strtr($soxId, "\\/", "__");
00137         $sTarget = $myConfig->getConfigParam( 'sShopDir' ) . "/out/" . $soxId;
00138         oxUtilsFile::getInstance()->deleteDir( $sTarget);
00139 
00140         $oDelete = oxNew( "oxShop" );
00141         $aTables = $myConfig->getConfigParam( 'aMultiShopTables' );
00142         $oDelete->setMultiShopTables($aTables);
00143 
00144 
00145         $oDelete->delete( $soxId );
00146 
00147 
00148         // if removing acutally selected shop then switch to shop 1
00149         if ( $soxId == $myConfig->getShopId()) {
00150             $sShopId = $myConfig->getBaseShopId();
00151         } else {
00152             $sShopId = $myConfig->getShopId();
00153         }
00154 
00155         $myConfig->setShopId( $sShopId );
00156 
00157         $this->init();
00158     }
00159 }

Generated on Tue Aug 18 09:21:05 2009 for OXID eShop CE by  doxygen 1.5.5