Sync Lehrfach, Sprache, Diverse Aenderungen bei Sync Lehrverbaende, mitrabeiter, Studenten

This commit is contained in:
Andreas Österreicher
2006-11-29 15:18:25 +00:00
parent 6af0939000
commit d0c5e7e40d
10 changed files with 624 additions and 74 deletions
+101
View File
@@ -0,0 +1,101 @@
<?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 Lehrfaecher von Vilesci DB in PORTAL DB
*
*/
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");
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
//Mitarbeiter
$qry = "Select * FROM tbl_lehrfach";
if($result = pg_query($conn_vilesci, $qry))
{
$text.="\n Sync Lehrfaecher\n\n";
while($row = pg_fetch_object($result))
{
$error=false;
$lf = new lehrfach($conn);
$lf->lehrfach_nr = $row->lehrfach_nr;
$lf->studiengang_kz = $row->studiengang_kz;
$lf->fachbereich_id = $row->fachbereich_id;
$lf->kurzbz = $row->kurzbz;
$lf->bezeichnung = $row->bezeichnung;
$lf->farbe = $row->farbe;
$lf->aktiv = ($row->aktiv=='t'?true:false);
$lf->semester = $row->semester;
$lf->sprache = ($row->sprache!=''?$row->sprache:'German');
$qry = "SELECT count(*) as anz FROM tbl_lehrfach WHERE lehrfach_nr='$row->lehrfach_nr'";
if($row1 = pg_fetch_object(pg_query($conn, $qry)))
{
if($row1->anz>0) //wenn dieser eintrag schon vorhanden ist
$lf->new=false;
else
$lf->new=true;
if(!$lf->save())
{
$error_log.=$lf->errormsg."\n";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
}
else
$error_log .= "Fehler beim ermitteln der UID\n";
}
}
else
$error_log .= 'Lehrfaecher 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 - Lehrfach</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,9 +4,6 @@
*
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/fas/person.class.php');
require_once('../../include/fas/benutzer.class.php');
require_once('../../include/fas/mitarbeiter.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");
@@ -43,7 +40,7 @@ $text .= "Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Personen</title>
<title>Synchro - Vilesci -> Portal - Lehrverbaende</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
+27 -5
View File
@@ -1,6 +1,26 @@
<?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 Personendatensaetze von Vilesci DB in PORTAL DB
* Synchronisiert Mitarbeiterdatensaetze von Vilesci DB in PORTAL DB
*
*/
require_once('../../vilesci/config.inc.php');
@@ -21,7 +41,7 @@ $anzahl_fehler=0;
// ***********************************
//Mitarbeiter
$qry = "SELECT * FROM tbl_person JOIN tbl_mitarbeiter USING(uid) WHERE personalnummer<>'OFF'";
$qry = "SELECT * FROM tbl_person JOIN tbl_mitarbeiter USING(uid) WHERE personalnummer<>'OFF' AND uid NOT LIKE '\_dummy%' AND uid NOT LIKE '\_Dummy%'";
if($result = pg_query($conn_vilesci, $qry))
{
@@ -40,7 +60,7 @@ if($result = pg_query($conn_vilesci, $qry))
$mitarbeiter->nachname=$row->nachname;
if(!$len=strpos($row->vornamen,' '))
{
$student->vorname=$row->vornamen;
$mitarbeiter->vorname=$row->vornamen;
$mitarbeiter->vornamen='';
}
else
@@ -111,8 +131,10 @@ if($result = pg_query($conn_vilesci, $qry))
$anzahl_fehler++;
}
else
$error_log .= "$row->nachname ($row->uid) hat keine Personalnummer\n";
$error_log .= "Fehler beim ermitteln der UID\n";
}
else
$error_log .= "$row->nachname ($row->uid) hat keine Personalnummer\n";
}
}
else
@@ -123,7 +145,7 @@ $text.="Anzahl der Fehler: $anzahl_fehler\n";
<html>
<head>
<title>Synchro - Vilesci -> Portal - Personen</title>
<title>Synchro - Vilesci -> Portal - Mitarbeiter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
@@ -0,0 +1,73 @@
<?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 Sprache von Vilesci DB in PORTAL DB
*
*/
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");
$error_log='';
$text = '';
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
// ***********************************
// * VILESCI->PORTAL - Synchronisation
// ***********************************
$qry = "SELECT sprache FROM tbl_sprache";
if($result = pg_query($conn_vilesci, $qry))
{
$text.="Sync der Sprache\n\n";
while($row=pg_fetch_object($result))
{
$qry = "INSERT INTO tbl_sprache(sprache) VALUES('$row->sprache');";
if(!pg_query($conn, $qry))
{
$error_log.= "Fehler beim einfuegen des Datensatzes: $qry";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
}
}
$text .= "Anzahl eingefuegter Datensaetze: $anzahl_eingefuegt\n";
$text .= "Anzahl der Fehler: $anzahl_fehler\n";
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Sprache</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>
@@ -1,4 +1,24 @@
<?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 Studentendatensaetze von Vilesci DB in PORTAL DB
*