shop_list.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Shop_List extends oxAdminList
00009 {
00015     protected $_blUpdateMain = false;
00016 
00022     protected $_sDefSort = 'oxshops.oxname';
00023 
00029     protected $_sListClass = 'oxshop';
00030 
00036     protected $_blUpdateNav = null;
00037 
00044     public function init()
00045     {
00046         $this->_blEmployMultilanguage = false;
00047         parent::Init();
00048 
00049 
00050         $this->_blEmployMultilanguage = true;
00051     }
00052 
00059     public function render()
00060     {
00061         $myConfig = $this->getConfig();
00062 
00063         parent::render();
00064 
00065         $soxId = oxConfig::getParameter( 'oxid' );
00066         if ( !$soxId ) {
00067             $soxId = $myConfig->getShopId();
00068         }
00069 
00070         $sSavedID = oxConfig::getParameter( 'saved_oxid' );
00071         if ( ( $soxId == '-1' || !isset( $soxId ) ) && isset( $sSavedID ) ) {
00072             $soxId = $sSavedID;
00073             oxSession::deleteVar( 'saved_oxid' );
00074             // for reloading upper frame
00075             $this->_aViewData['updatelist'] = '1';
00076         }
00077 
00078         if ( $soxId != '-1' && isset( $soxId ) ) {
00079             // load object
00080             $oShop = oxNew( 'oxshop' );
00081             if ( !$oShop->load( $soxId ) ) {
00082                 $soxId = $myConfig->getBaseShopId();
00083                 $oShop->load( $soxId );
00084             }
00085             $this->_aViewData['editshop'] = $oShop;
00086         }
00087 
00088         // default page number 1
00089         $this->_aViewData['default_edit'] = 'shop_main';
00090         $this->_aViewData['updatemain']   = $this->_blUpdateMain;
00091 
00092         $this->_aViewData['oxid'] =  $soxId;
00093 
00094         if ( $this->_aViewData['updatenav'] ) {
00095             //skipping requirements checking when reloading nav frame
00096             oxSession::setVar( "navReload", true );
00097         }
00098 
00099         //making sure we really change shops on low level
00100         if ( $soxId && $soxId != '-1' ) {
00101             $myConfig->setShopId( $soxId );
00102             oxSession::setVar( 'currentadminshop', $soxId );
00103         }
00104 
00105         return 'shop_list.tpl';
00106     }
00107 
00113     public function buildWhere()
00114     {
00115         // we override this to add our shop if we are not malladmin
00116         $this->_aWhere = parent::buildWhere();
00117         if ( !oxSession::getVar( 'malladmin' ) ) {
00118             // we only allow to see our shop
00119             $this->_aWhere['oxshops.oxid'] = oxSession::getVar( "actshop" );
00120         }
00121 
00122         return $this->_aWhere;
00123     }
00124 
00130     public function deleteEntry()
00131     {
00132         $myConfig = $this->getConfig();
00133         $soxId    = oxConfig::getParameter( "delshopid");
00134 
00135 
00136         // try to remove directories
00137         $soxId   = strtr($soxId, "\\/", "__");
00138         $sTarget = $myConfig->getConfigParam( 'sShopDir' ) . "/out/" . $soxId;
00139         oxUtilsFile::getInstance()->deleteDir( $sTarget);
00140 
00141         $oDelete = oxNew( "oxShop" );
00142         $aTables = $myConfig->getConfigParam( 'aMultiShopTables' );
00143         $oDelete->setMultiShopTables($aTables);
00144 
00145 
00146         $oDelete->delete( $soxId );
00147 
00148 
00149         // if removing acutally selected shop then switch to shop 1
00150         if ( $soxId == $myConfig->getShopId()) {
00151             $sShopId = $myConfig->getBaseShopId();
00152         } else {
00153             $sShopId = $myConfig->getShopId();
00154         }
00155 
00156         $myConfig->setShopId( $sShopId );
00157 
00158         $this->init();
00159     }
00160 }

Generated by  doxygen 1.6.2