-
Notifications
You must be signed in to change notification settings - Fork 0
/
s4.php
83 lines (63 loc) · 1.9 KB
/
s4.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
* DCE TOOLS - Copy dce
* - STEP 4 - copy dce and show result
*/
require_once('settings.php');
require_once('db.php');
require_once('dce.php');
require_once('htmlheader.php');
$sourcedce = $_POST['sourcedce'];
$sourcedb = $_POST['sourcedb'];
$targetdb = $_POST['targetdb'];
echo "<h2>Kopieren des DCE in Ziel DB:" . $targetdb . "</h2>\n";
echo "<h4>Ausgewählte Quelle:" . $sourcedb . "</h4>\n";
echo "<h4>Augewähltes DCE: ". $sourcedce ."</h4>\n";
//GetSourcedce Title
//Get Connection
$sourceconn=getconn($username, $password,$sourcedb);
$targetconn=getconn($username, $password,$targetdb);
$sourcedcetitle=getDCETitle($sourceconn,$sourcedce);
echo "<h4>Augewähltes DCE Title: ". $sourcedcetitle ."</h4>\n";
$dcerow=getDCERow($sourceconn,$sourcedce);
$alldcerows=getDCEFields($sourceconn,$sourcedce,FALSE);
$lastdceid=insertdcerow($targetconn,$dcerow);
echo "<h3>UID des eingefügten DCEs : ". $lastdceid ."</h3>\n";
$oldsectionuid=-1;
$currentsectionuid=-1;
foreach ($alldcerows as $arow)
{
if($arow["type"]=="0")
{
if($arow["parent_field"]==$oldsectionuid)
{
$arow["parent_field"]=$currentsectionuid;
}
else //Kein Sectionfield
{
$arow["parent_dce"]=$lastdceid;
}
insertdceelement($targetconn,$arow);
}
if($arow["type"]=="1")
{
$arow["parent_dce"]=$lastdceid;
if($arow["parent_field"]==$oldsectionuid)
{
$arow["parent_field"]=$currentsectionuid;
}
insertdceelement($targetconn,$arow);
}
if($arow["type"]=="2")
{
$arow["parent_dce"]=$lastdceid;
$oldsectionuid=$arow["uid"];
$currentsectionuid=insertdceelement($targetconn,$arow);
}
}
echo "<h2> DCE: '". $sourcedcetitle . "' erfolgreich in DB '" . $targetdb . "' eingefügt.</h2>\n";
//Close Connection
closeconn($sourceconn);
closeconn($sourceconn);
require_once('htmlfooter.php');
?>