00001 <?php 00002 00003 class EFire_Downloader extends oxAdminView 00004 { 00010 protected $_sThisTemplate = "efire_downloader.tpl"; 00011 00012 public function render() 00013 { 00014 $oStr = getStr(); 00015 $myConfig = $this->getConfig(); 00016 00017 $this->_aViewData['sEfiUsername'] = $oStr->htmlspecialchars( $myConfig->getConfigParam( 'sEfiUsername' ) ); 00018 $this->_aViewData['sEfiPassword'] = $oStr->htmlspecialchars( $myConfig->getConfigParam( 'sEfiPassword' ) ); 00019 00020 return parent::render(); 00021 } 00022 00028 public function getAdminList() 00029 { 00030 $oUserList = oxNew( "oxUserList" ); 00031 $oUser = $oUserList->getBaseObject(); 00032 00033 $sQ = "select ".$oUser->getSelectFields()." from oxuser "; 00034 $sQ .= "where oxuser.oxrights != 'user' "; 00035 00036 $oUserList->selectString( $sQ ); 00037 return $oUserList; 00038 } 00039 00045 public function getConnector() 00046 { 00047 $oConfig = $this->getConfig(); 00048 00049 $sEtUsername = $this->getConfig()->getParameter("etUsername"); 00050 $sEtPassword = $this->getConfig()->getParameter("etPassword"); 00051 00052 $oConnector = oxNew("oxefidownloader"); 00053 00054 $sShopVersion = $this->getConfig()->getEdition() . " " . $this->getConfig()->getVersion(); 00055 00056 $blSaveCredentials = $this->getConfig()->getParameter('blSaveCredentials'); 00057 00058 try { 00059 $oConnector->downloadConnector($sEtUsername, $sEtPassword, $sShopVersion, $blSaveCredentials); 00060 $this->_aViewData['message'] = oxLang::getInstance()->translateString('EFIRE_DOWNLOADER_SUCCESS'); 00061 } catch (Exception $e) { 00062 oxUtilsView::getInstance()->addErrorToDisplay(sprintf(oxLang::getInstance()->translateString('EFIRE_DOWNLOADER_ERROR'), $e->getMessage())); 00063 } 00064 } 00065 }