dbXapp
2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Toggle main menu visibility
Loading...
Searching...
No Matches
dbxUser_import.class.php
Go to the documentation of this file.
1
<?php
2
namespace
dbx\dbxUser_admin;
3
4
Class dbxUser_import extends \dbxObj {
5
6
Public $oTPL;
7
8
public
function
__construct
() {
9
$this->oTPL =
dbx
()->get_system_obj(
'dbxTPL'
);
10
}
11
12
public
function
import
() {
13
$content=
''
; $status=
'run'
; $timer=1; $percent=100;
14
$data[
'file'
]=
'user.csv'
;
15
16
17
$oForm=
dbx
()->get_system_obj(
'dbxForm'
);
18
$oForm->init(
'form-csv-reader'
);
19
$oForm->_action=
'?dbx_modul=dbxUser_admin&dbx_run1=import_user'
;
20
$oForm->_data=$data;
21
$oForm->_fld_change_state=
'all'
;
22
$oForm->_msg_info=
''
;
23
24
$oForm->_try_max=99999999;
25
26
$bdata[
'id'
] =
'button_{i}'
;
27
$bdata[
'label'
]=
'User einlesen'
;
28
$bdata[
'sec'
] = $timer;
29
30
$oImporter=
dbx
()->get_system_obj(
'dbxCSVreader'
);
31
$progress =$this->oTPL->get_tpl(
'dbx'
,
'progressbar-1'
);
32
$button =$this->oTPL->get_tpl(
'dbx'
,
'button-submit'
,$bdata);
33
$date_time=date(
'd-m-Y H:i:s'
);
34
35
36
$msg=
'CSV Datei einlesen.'
;
37
38
if
($oForm->submit()) {
39
if
(!$oForm->errors()) {
40
$file =
dbx_get_file_dir
().
'/myBefund/ldt-in/user.csv'
;
41
42
if
(file_exists($file)) {
43
44
$status=$oImporter->init(
'import_user_csv'
);
45
if
($status==
'init'
) {
46
$oImporter->set_property(
'filename'
,$file);
47
$oImporter->set_property(
'dd'
,
'dbx_user'
);
48
$oImporter->set_property(
'where'
,
'id = {id}'
);
49
$oImporter->set_property(
'pass'
, 1);
// convert
50
$oImporter->set_property(
'owner'
,-1);
// admin
51
$oImporter->set_property(
'utf8'
, 1);
// convert 2 utf8
52
$oImporter->set_property(
'run_bytes'
,9600);
// max Line length
53
$oImporter->set_property(
'seperator'
,
';'
);
54
}
55
$msg=
"Die CSV Datei ($file) wird eingelesen ($status)."
;
56
57
$status=$oImporter->run();
58
$filesize=$oImporter->get_property(
'filesize'
);
59
$percent =$oImporter->get_property(
'percent'
);
60
$querys =$oImporter->get_property(
'querys'
);
61
$errors =$oImporter->get_property(
'errors'
);
62
$lines =$oImporter->get_property(
'lines'
);
63
64
65
$msg=
"Querys=($querys) ($percent %) status=($status)"
;
66
if
($status ==
'end'
&& !$errors) $msg=
"Es wurden ($querys) Benutzer eingelesen ($date_time) status=($status)"
;
67
if
($status ==
'end'
&& $errors) $msg=
"Es wurden ($querys) Benutzer eingelesen ($date_time) Es sind ($errors) Fehler aufgetreten. status=($status)"
;
68
69
}
else
{
70
$status=
'end'
;
71
$msg=
"Die CSV Datei (user.csv) ist nicht vorhanden ($date_time)."
;
72
}
73
}
else
{
74
$msg=
'Ein Fehler ist aufgetreten'
;
75
}
76
}
// submit
77
$pdata[
'msg'
] =$msg;
78
$pdata[
'value'
]=$percent;
79
$pdata[
'width'
]=$percent;
80
$bdata[
'sec'
] =$timer;
81
//if ($timer)
82
$oForm->add_obj(
'progress'
,
'obj-value'
,$progress,$pdata);
83
$oForm->add_obj(
'button'
,
'obj-value'
,$button ,$bdata);
84
if
($status==
'run'
) $oForm->add_js_autosubmit(
'#dbx_form_{i}'
,$timer);
85
86
$content=$oForm->run();
87
return
$content;
88
89
}
// import()
90
91
92
93
94
public
function
run
() {
95
$content=$this->
import
();
96
return
$content;
97
}
98
99
100
}
101
102
?>
dbx_get_file_dir
dbx_get_file_dir()
Definition
index.php:265
dbx\dbxUser_admin\run
run()
Definition
dbxUser_import.class.php:94
dbx\dbxUser_admin\__construct
__construct()
Definition
dbxUser_import.class.php:8
dbx
DBX schema administration.
dbx
modules
dbxUser_admin
include
dbxUser_import.class.php
Generated by
1.17.0