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