Diverse Sync Scripte Vilesci->Portal

This commit is contained in:
Andreas Österreicher
2006-11-30 16:24:41 +00:00
parent 0ea5f15c62
commit 75946e95e5
22 changed files with 1768 additions and 305 deletions
@@ -0,0 +1,96 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Synchronisiert Benutzerberechtigung von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/benutzerberechtigung.class.php');
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
//Mitarbeiter
$qry = 'Select * FROM tbl_userberechtigung';
if($result = pg_query($conn_vilesci, $qry))
{
$text.="\n Sync Benutzerberechtigung\n\n";
while($row = pg_fetch_object($result))
{
$error=false;
$benutzerberechtigung = new benutzerberechtigung($conn);
$benutzerberechtigung->art = $row->art;
$benutzerberechtigung->fachbereich_id = $row->fachbereich_id;
$benutzerberechtigung->studiengang_kz = $row->studiengang_kz;
$benutzerberechtigung->berechtigung_kurzbz = $row->berechtigung_kurzbz;
$benutzerberechtigung->uid = $row->uid;
$benutzerberechtigung->studiensemester_kurzbz = $row->studiensemester_kurzbz;
$benutzerberechtigung->start = $row->start;
$benutzerberechtigung->ende = $row->ende;
//$qry = "SELECT count(*) as anz FROM tbl_feedback WHERE feedback_id='$row->feedback_id'";
//if($row1 = pg_fetch_object(pg_query($conn, $qry)))
//{
$benutzerberechtigung->new=true;
if(!$benutzerberechtigung->save())
{
$error_log.=$benutzerberechtigung->errormsg."\n";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
//}
//else
// $error_log .= "Fehler beim ermitteln der UID\n";
}
}
else
$error_log .= "Berechtigungen konnten nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Benutzerberechtigung</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo nl2br($text);
echo nl2br($error_log);
?>
</body>
</html>
@@ -0,0 +1,93 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Synchronisiert Berechtigung von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/berechtigung.class.php');
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
//Mitarbeiter
$qry = 'Select * FROM tbl_berechtigung';
if($result = pg_query($conn_vilesci, $qry))
{
$text.="\n Sync Berechtigung\n\n";
while($row = pg_fetch_object($result))
{
$berechtigung = new berechtigung($conn);
$berechtigung->berechtigung_kurzbz = $row->berechtigung_kurzbz;
$berechtigung->beschreibung = $row->beschreibung;
$qry = "SELECT count(*) as anz FROM tbl_berechtigung where berechtigung_kurzbz='".addslashes($row->berechtigung_kurzbz)."'";
if($row1 =pg_fetch_object(pg_query($conn,$qry)))
{
$berechtigung->new = ($row1->anz>0?false:true);
if(!$berechtigung->save())
{
$anzahl_fehler++;
$error_log .= $berechtigung->errormsg."\n";
}
else
$anzahl_eingefuegt++;
}
else
{
$error_log.='Fehler beim auslesen';
$anzahl_fehler++;
}
}
}
else
$error_log .= "Berechtigungen konnten nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Benutzerberechtigung</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo nl2br($text);
echo nl2br($error_log);
?>
</body>
</html>
@@ -0,0 +1,93 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Synchronisiert Feedback von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/feedback.class.php');
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
//Mitarbeiter
$qry = 'Select * FROM tbl_feedback';
if($result = pg_query($conn_vilesci, $qry))
{
$text.="\n Sync Feedback\n\n";
while($row = pg_fetch_object($result))
{
$error=false;
$feedback = new feedback($conn);
$feedback->feedback_id = $row->feedback_id;
$feedback->betreff = $row->betreff;
$feedback->text = $row->text;
$feedback->datum = $row->datum;
$feedback->uid = $row->uid;
$qry = "SELECT count(*) as anz FROM tbl_feedback WHERE feedback_id='$row->feedback_id'";
if($row1 = pg_fetch_object(pg_query($conn, $qry)))
{
$feedback->new = ($row1->anz>0?false:true);
if(!$feedback->save())
{
$error_log.=$feedback->errormsg."\n";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
}
else
$error_log .= "Fehler beim ermitteln der UID\n";
}
}
else
$error_log .= "Feedback konnte nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Feedback</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo nl2br($text);
echo nl2br($error_log);
?>
</body>
</html>
+4 -4
View File
@@ -26,8 +26,8 @@
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/lehrfach.class.php');
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die("Connection zur Vilesci Datenbank fehlgeschlagen");
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
@@ -39,7 +39,7 @@ $anzahl_fehler=0;
// ***********************************
//Mitarbeiter
$qry = "Select * FROM tbl_lehrfach";
$qry = 'Select * FROM tbl_lehrfach';
if($result = pg_query($conn_vilesci, $qry))
{
@@ -80,7 +80,7 @@ if($result = pg_query($conn_vilesci, $qry))
}
}
else
$error_log .= 'Lehrfaecher konnten nicht geladen werden\n';
$error_log .= "Lehrfaecher konnten nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
@@ -0,0 +1,97 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Synchronisiert die Lehrform von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/lehrform.class.php');
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
//Mitarbeiter
$qry = 'SELECT * FROM tbl_lehrform';
if($result = pg_query($conn_vilesci, $qry))
{
$text.="\n Sync Lehrform\n\n";
while($row = pg_fetch_object($result))
{
$error=false;
$lehrform = new lehrform($conn);
$lehrform->lehrform_kurzbz = $row->lehrform_kurzbz;
$lehrform->bezeichnung = $row->bezeichnung;
$lehrform->verplanen = ($row->verplanen=='t'?true:false);
$qry = "SELECT count(*) as anz FROM tbl_lehrform WHERE lehrform_kurzbz='$row->lehrform_kurzbz'";
if($row = pg_fetch_object(pg_query($conn, $qry)))
{
if($row->anz>0) //wenn dieser eintrag schon vorhanden ist
$lehrform->new=false;
else
$lehrform->new=true;
if(!$lehrform->save())
{
$error_log.=$lehrform->errormsg."\n";
$anzahl_fehler++;
}
else
$anzahl_fehler++;
}
else
$error_log .= "damm\n";
}
}
else
$error_log .= "Lehrformen konnten nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Lehrform</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo nl2br($text);
echo nl2br($error_log);
?>
</body>
</html>
@@ -51,8 +51,8 @@ if($result = pg_query($conn_vilesci, $qry))
$error=false;
$mitarbeiter = new mitarbeiter($conn);
if($row->personalnummer!='')
{
//if($row->personalnummer!='')
//{
$mitarbeiter->sprache='German';
$mitarbeiter->anrede='';
$mitarbeiter->titelpost='';
@@ -90,7 +90,10 @@ if($result = pg_query($conn_vilesci, $qry))
$mitarbeiter->alias=$row->alias;
$mitarbeiter->ausbildungcode='';
$mitarbeiter->personalnummer=$row->personalnummer;
if($row->personalnummer=='OFF')
$mitarbeiter->personalnummer='';
else
$mitarbeiter->personalnummer=$row->personalnummer;
$mitarbeiter->kurzbz=$row->kurzbz;
$mitarbeiter->lektor=($row->lektor=='t'?true:false);
$mitarbeiter->fixangestellt=($row->fixangestellt=='t'?true:false);
@@ -132,9 +135,9 @@ if($result = pg_query($conn_vilesci, $qry))
}
else
$error_log .= "Fehler beim ermitteln der UID\n";
}
else
$error_log .= "$row->nachname ($row->uid) hat keine Personalnummer\n";
//}
//else
// $error_log .= "$row->nachname ($row->uid) hat keine Personalnummer\n";
}
}
else
+3 -3
View File
@@ -25,8 +25,8 @@
*/
require_once('../../vilesci/config.inc.php');
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die("Connection zur Vilesci Datenbank fehlgeschlagen");
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
@@ -37,7 +37,7 @@ $anzahl_fehler=0;
// * VILESCI->PORTAL - Synchronisation
// ***********************************
$qry = "SELECT sprache FROM tbl_sprache";
$qry = 'SELECT sprache FROM tbl_sprache';
if($result = pg_query($conn_vilesci, $qry))
{
+3 -3
View File
@@ -28,8 +28,8 @@ require_once('../../include/fas/person.class.php');
require_once('../../include/fas/benutzer.class.php');
require_once('../../include/fas/student.class.php');
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die("Connection zur Vilesci Datenbank fehlgeschlagen");
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
@@ -135,7 +135,7 @@ if($result = pg_query($conn_vilesci, $qry))
}
}
else
$error_log .= 'Studentendatensaetze konnten nicht geladen werden\n';
$error_log .= "Studentendatensaetze konnten nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
@@ -0,0 +1,95 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Synchronisiert die Studiensemester von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/studiensemester.class.php');
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
$qry = 'SELECT * FROM tbl_studiensemester';
if($result = pg_query($conn_vilesci, $qry))
{
$text.="\n Sync Studiensemester\n\n";
while($row = pg_fetch_object($result))
{
$error=false;
$stsem = new studiensemester($conn);
$stsem->studiensemester_kurzbz = $row->studiensemester_kurzbz;
$stsem->start = $row->start;
$stsem->ende = $row->ende;
$qry = "SELECT count(*) as anz FROM tbl_studiensemester WHERE studiensemester_kurzbz='".addslashes($row->studiensemester_kurzbz)."'";
if($row = pg_fetch_object(pg_query($conn, $qry)))
{
if($row->anz>0) //wenn dieser eintrag schon vorhanden ist
$stsem->new=false;
else
$stsem->new=true;
if(!$stsem->save())
{
$error_log.=$stsem->errormsg."\n";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
}
else
$error_log .= "Fehler beim lesen aus der Datenbank\n";
}
}
else
$error_log .= "Studiensemester konnten nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Studiensemester</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo nl2br($text);
echo nl2br($error_log);
?>
</body>
</html>
+92
View File
@@ -0,0 +1,92 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Synchronisiert Stunde von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/stunde.class.php');
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
//Mitarbeiter
$qry = 'Select * FROM tbl_stunde';
if($result = pg_query($conn_vilesci, $qry))
{
$text.="\n Sync Stunde\n\n";
while($row = pg_fetch_object($result))
{
$error=false;
$stunde = new stunde($conn);
$stunde->stunde = $row->stunde;
$stunde->beginn = $row->beginn;
$stunde->ende = $row->ende;
$qry = "SELECT count(*) as anz FROM tbl_stunde WHERE stunde='$row->stunde'";
if($row1 = pg_fetch_object(pg_query($conn, $qry)))
{
$stunde->new = ($row1->anz>0?false:true);
if(!$stunde->save())
{
$error_log.=$stunde->errormsg."\n";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
}
else
$error_log .= "Fehler beim ermitteln der UID\n";
}
}
else
$error_log .= "Stunden konnten nicht geladen werden\n";
$text.="Anzahl aktualisierte Datensaetze: $anzahl_eingefuegt\n";
$text.="Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Stunde</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo nl2br($text);
echo nl2br($error_log);
?>
</body>
</html>
@@ -0,0 +1,90 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Synchronisiert die Zeiwuensche von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/zeitwunsch.class.php');
$conn=pg_connect(CONN_STRING) or die('Connection zur Portal Datenbank fehlgeschlagen');
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) or die('Connection zur Vilesci Datenbank fehlgeschlagen');
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
$qry = 'SELECT * FROM tbl_zeitwunsch';
if($result = pg_query($conn_vilesci, $qry))
{
$text.="Sync der Zeitwuensche\n\n";
while($row=pg_fetch_object($result))
{
$zw = new zeitwunsch($conn);
$zw->uid = $row->uid;
$zw->stunde = $row->stunde;
$zw->tag = $row->tag;
$zw->gewicht = $row->gewicht;
$qry ="SELECT count(*) as anz FROM tbl_zeitwunsch where uid='".addslashes($row->uid)."' AND stunde='".addslashes($row->stunde)."' AND tag='".addslashes($row->tag)."';";
if($row = pg_fetch_object(pg_query($conn, $qry)))
{
$zw->new = ($row->anz>0?false:true);
if(!$zw->save())
{
$error_log.= "Fehler beim einfuegen des Datensatzes: $qry";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
}
else
{
$this->error_log .= "Fehler beim ermitteln des Zeitwunsches: $qry";
$anzahl_fehler++;
}
}
}
$text .= "Anzahl eingefuegter Datensaetze: $anzahl_eingefuegt\n";
$text .= "Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Zeitwunsch</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo nl2br($text);
echo nl2br($error_log);
?>
</body>
</html>