00001 <?php
00002
00003
00004
00008 DEFINE("ERR_GENERAL", -1);
00009 DEFINE("ERR_NOT_SELECTED_FILE", 1);
00010 DEFINE("ERR_MISSING_FILE", 2);
00011 DEFINE("ERR_WRONG_FORMAT", 3);
00012 DEFINE("ERR_IO_FAILURE", 4);
00013
00018 class oxChangeView extends oxAdminView
00019 {
00020
00021 protected $_sThisTemplate = "oxchange.tpl";
00022
00023 public $sPopupTemplate = "oxchange_popup.tpl";
00024
00025 protected $_sImplClass = "oxchange";
00026 protected $_sImplClass_do = "oxchange_do";
00027 protected $_sImplClass_import = "oxchange_import";
00028 protected $_sImplClass_export = "oxchange_export";
00029 protected $_sImplClass_orders = "oxchange_orders";
00030 protected $_sImplClass_articles = null;
00031
00032
00033 protected $_sFirstStartClass = "oxchange_import";
00034
00035
00036
00037 protected $_sImportPath = null;
00038 protected $_sExportPath = null;
00039
00040 protected $_sDefaultExportPath = "/export/";
00041 protected $_sDefaultImportPath = "/export/";
00042
00043 protected $_sImportFileType = "txt";
00044 protected $_sExportFileType = "txt";
00045
00046
00052 protected function _getImplClassNames()
00053 {
00054 $sImplClass = oxConfig::getParameter("impl");
00055
00056 if ($sImplClass)
00057 oxSession::setVar("impl", $sImplClass);
00058
00059 if (!$sImplClass)
00060 $sImplClass = oxSession::getVar("impl");
00061
00062
00063 if ($sImplClass) {
00064 if (file_exists($sImplClass.".php")) {
00065 $this->_sImplClass = $sImplClass;
00066 $this->_sExportPath = $this->_sDefaultExportPath.$sImplClass."/";
00067 $this->_sImportPath = $this->_sDefaultImportPath.$sImplClass."/";
00068 } else {
00069 $this->_sExportPath = $this->_sDefaultExportPath;
00070 $this->_sImportPath = $this->_sDefaultImportPath;
00071 }
00072
00073
00074 if (file_exists($sImplClass."_do.php")) {
00075 $this->_sImplClass_do = $sImplClass."_do";
00076 }
00077
00078 if (file_exists($sImplClass."_import.php"))
00079 $this->_sImplClass_import = $sImplClass."_import";
00080
00081 if (file_exists($sImplClass."_orders.php"))
00082 $this->_sImplClass_orders = $sImplClass."_orders";
00083
00084 if (file_exists($sImplClass."_articles.php"))
00085 $this->_sImplClass_articles = $sImplClass."_articles";
00086 }
00087 }
00088
00096 public function render()
00097 {
00098 parent::render();
00099 $this->_getImplClassNames();
00100 $this->_aViewData["implclass"] = $this->_sImplClass;
00101 $this->_aViewData["implclass_do"] = $this->_sImplClass_do;
00102 $this->_aViewData["implclass_import"] = $this->_sImplClass_import;
00103 $this->_aViewData["implclass_export"] = $this->_sImplClass_export;
00104 $this->_aViewData["implclass_orders"] = $this->_sImplClass_orders;
00105 $this->_aViewData["implclass_articles"] = $this->_sImplClass_articles;
00106
00107 $this->_aViewData["firststartclass"] = $this->_sFirstStartClass;
00108 return $this->_sThisTemplate;
00109 }
00110
00111
00117 public function getExportFile()
00118 {
00119 $this->_getImplClassNames();
00120
00121 $sOrderExportFile = $this->getConfig()->getConfigParam( 'sShopDir' );
00122 $sOrderExportFile .= $this->_sExportPath;
00123 $sOrderExportFile .= $this->_sImplClass;
00124 $sOrderExportFile .= ".".$this->_sExportFileType;
00125
00126 return $sOrderExportFile;
00127 }
00128
00134 public function getImportFile()
00135 {
00136 $this->_getImplClassNames();
00137 $sImportFile = $this->getConfig()->getConfigParam( 'sShopDir' );
00138 $sImportFile .= $this->_sImportPath;
00139 $sImportFile .= $this->_sImplClass;
00140 $sImportFile .= ".".$this->_sImportFileType;
00141
00142 return $sImportFile;
00143 }
00144
00145 }