shop_list.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Shop_List extends oxAdminList
00010 {
00011     protected $_blUpdateMain = false;
00012 
00018     protected $_sDefSort = 'oxshops.oxname';
00019 
00025     protected $_sListClass = 'oxshop';
00026 
00032     protected $_blUpdateNav = null;
00033 
00040     public function init()
00041     {
00042         $this->_blEmployMultilanguage = false;
00043         parent::Init();
00044 
00045 
00046         $this->_blEmployMultilanguage = true;
00047     }
00048 
00055     public function render()
00056     {
00057         $myConfig = $this->getConfig();
00058 
00059         parent::render();
00060 
00061         $soxId = oxConfig::getParameter( 'oxid' );
00062         if ( !$soxId ) {
00063             $soxId = $myConfig->getShopId();
00064         }
00065 
00066         $sSavedID = oxConfig::getParameter( 'saved_oxid' );
00067         if ( ( $soxId == '-1' || !isset( $soxId ) ) && isset( $sSavedID ) ) {
00068             $soxId = $sSavedID;
00069             oxSession::deleteVar( 'saved_oxid' );
00070             // for reloading upper frame
00071             $this->_aViewData['updatelist'] = '1';
00072         }
00073 
00074         if ( $soxId != '-1' && isset( $soxId ) ) {
00075             // load object
00076             $oShop = oxNew( 'oxshop' );
00077             if ( !$oShop->load( $soxId ) ) {
00078                 $soxId = $myConfig->getBaseShopId();
00079                 $oShop->load( $soxId );
00080             }
00081             $this->_aViewData['editshop'] = $oShop;
00082         }
00083 
00084         // default page number 1
00085         $this->_aViewData['default_edit'] = 'shop_main';
00086         $this->_aViewData['updatemain']   = $this->_blUpdateMain;
00087 
00088         $this->_aViewData['oxid'] =  $soxId;
00089 
00090         //making sure we really change shops on low level
00091         if ( $soxId && $soxId != '-1' ) {
00092             $myConfig->setShopId( $soxId );
00093             oxSession::setVar( 'currentadminshop', $soxId );
00094         }
00095 
00096         return 'shop_list.tpl';
00097     }
00098 
00104     public function buildWhere()
00105     {
00106         // we override this to add our shop if we are not malladmin
00107         $this->_aWhere = parent::buildWhere();
00108 
00109         $blisMallAdmin = oxSession::getVar( 'malladmin' );
00110         if ( !$blisMallAdmin) {
00111             // we only allow to see our shop
00112             $sShopID = oxSession::getVar( "actshop" );
00113             $this->_aWhere['oxshops.oxid'] = "$sShopID";
00114         }
00115 
00116         return $this->_aWhere;
00117     }
00118 
00124     public function deleteEntry()
00125     {
00126         $myConfig  = $this->getConfig();
00127 
00128         $soxId   = oxConfig::getParameter( "oxid");
00129 
00130 
00131         // try to remove directories
00132         $soxId   = strtr($soxId, "\\/", "__");
00133         $sTarget = $myConfig->getConfigParam( 'sShopDir' ) . "/out/" . $soxId;
00134         oxUtilsFile::getInstance()->deleteDir( $sTarget);
00135 
00136         $oDelete = oxNew( "oxShop" );
00137         $aTables = $myConfig->getConfigParam( 'aMultiShopTables' );
00138         $oDelete->setMultiShopTables($aTables);
00139 
00140 
00141         $oDelete->delete( $soxId );
00142 
00143 
00144         // if removing acutally selected shop then switch to shop 1
00145         if ( $soxId == $myConfig->getShopId()) {
00146             $sShopId = $myConfig->getBaseShopId();
00147         } else {
00148             $sShopId = $myConfig->getShopId();
00149         }
00150 
00151         $myConfig->setShopId( $sShopId );
00152 
00153         $this->init();
00154     }
00155 }

Generated on Thu Dec 4 12:04:56 2008 for OXID eShop CE by  doxygen 1.5.5