19 dbx()->debug(
"run export dd_export section=($section)");
24 $seperator=$this->
get_property(
'seperator',
';' ,$section);
27 $run_lines=$this->
get_property(
'run_lines',1000,$section);
38 dbx()->debug(
"### Export CSV dd=($dd) file=($path_file)");
40 $oForm =
dbx()->get_system_obj(
'dbxForm');
41 $oForm->init($section,
'form-csv-writer');
42 $oForm->_action =
"?dbx_modul=dbxAdmin&dbx_run1=datadic&dbx_run2=export_csv&dd=$dd";
43 $oForm->_data = $data;
44 $oForm->_msg_info =
'';
45 $oForm->_try_max = 99999999;
46 $oForm->_fld_change_state =
'all';
48 $bdata[
'id'] =
'button_{i}';
49 $bdata[
'label'] =
"CSV einlesen ($file)";
50 $bdata[
'sec'] = $timer;
52 $oImporter =
dbx()->get_system_obj(
'dbxCSVreader');
53 $oImporter->_section=$section;
57 $date_time = date(
'd-m-Y H:i:s');
59 $msg =
"CSV Datei ($path_file) einlesen.";
62 if ($oForm->submit()) $submit=1;
64 dbx()->debug(
"### IMPORT CSV submit=($submit) dd=($dd) file=($path_file)");
69 $status = $oImporter->init($dd.
'_export_csv');
70 dbx()->debug(
"############# A-Status=($status)");
72 if ($status ==
'init') {
74 $msg =
"CSV Datei ($path_file) einlesen.";
75 $oImporter->set_property(
'path_file' ,
$path_file);
76 $oImporter->set_property(
'dd' , $dd);
77 $oImporter->set_property(
'where' , $where);
78 $oImporter->set_property(
'pass' , 0);
79 $oImporter->set_property(
'owner' , -1);
80 $oImporter->set_property(
'utf8' , 1);
81 $oImporter->set_property(
'run_bytes' , 9600);
82 $oImporter->set_property(
'run_lines' , $run_lines);
83 $oImporter->set_property(
'seperator' , $seperator);
84 $oImporter->set_property(
'remap' , $remap);
85 $oImporter->set_property(
'where' , $where);
86 dbx()->debug(
"##init remap Importer ($path_file) sep=($seperator)");
89 if ($status ==
'run') {
90 $status = $oImporter->run();
91 $path_file= $oImporter->get_property(
'path_file');
92 $filesize = $oImporter->get_property(
'filesize');
93 $filepos = $oImporter->get_property(
'filepos');
94 $percent = $oImporter->get_property(
'percent');
95 $querys = $oImporter->get_property(
'querys');
96 $errors = $oImporter->get_property(
'errors');
97 $lines = $oImporter->get_property(
'lines');
98 $msg =
"Datensätze=($querys) ($percent %) status=($status)";
99 dbx()->debug(
"File=($path_file) filesize=($filesize) FilePos=($filepos) Querys=($querys) errors=($errors) lines=($lines)");
102 if ($status ==
'end') {
103 dbx()->debug(
"END CSV ($dd)");
104 $msg =
"Es wurden ($querys) Datensätze eingelesen ($date_time)";
105 if ($errors) $msg .=
" Es sind ($errors) Fehler aufgetreten.";
108 $pdata[
'msg'] = $msg;
109 $pdata[
'value'] = $percent;
110 $pdata[
'width'] = $percent;
111 $progress = $this->oTPL->get_tpl(
'dbx',
'progressbar-1', $pdata);
112 $oForm->add_obj(
'progress',
'obj-value', $progress);
116 $bdata[
'sec'] = $timer;
117 $bdata[
'class'] =
'hidden';
118 $button = $this->oTPL->get_tpl(
'dbx',
'button-submit', $bdata);
120 $oForm->add_obj(
'button' ,
'obj-value', $button);
122 if ($status !=
'end') $oForm->add_js_autosubmit(
'#dbx_form_{i}', $timer);
124 return $oForm->run();