This commit is contained in:
Gerald Simane
2009-07-06 13:45:39 +00:00
parent 6b48054a28
commit ebbf25c17e
32 changed files with 3210 additions and 3777 deletions
+40 -13
View File
@@ -1,3 +1,31 @@
<?php
/* Copyright (C) 2008 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 < [email protected] >
* Andreas Oesterreicher < [email protected] >
* Rudolf Hangl < [email protected] >
* Gerald Simane-Sequens < [email protected] >
*/
require_once('../../config/vilesci.config.inc.php');
require_once('../../include/basis_db.class.php');
if (!$db = new basis_db())
die('Es konnte keine Verbindung zum Server aufgebaut werden.');
?>
<html>
<head>
<title>Abgleich der Lehrfaecher</title>
@@ -6,39 +34,38 @@
<body>
<?php
include('../vilesci/config.inc.php');
$conn=pg_connect(CONN_STRING);
$sql_query='SELECT tbl_stundenplan.*, tbl_lehrfach.lehrform_kurzbz, tbl_lehrfach.kurzbz AS lehrfach, tbl_lehrfach.bezeichnung, tbl_lehrfach.farbe
FROM tbl_stundenplan, tbl_lehrfach WHERE tbl_stundenplan.lehrfach_nr=tbl_lehrfach.lehrfach_nr
AND (tbl_stundenplan.studiengang_kz!=tbl_lehrfach.studiengang_kz
OR tbl_stundenplan.semester!=tbl_lehrfach.semester)'; //LIMIT 10000
//echo $sql_query."<br>";
$result=pg_query($conn, $sql_query);
$num_rows=pg_numrows($result);
$result=$db->db_query($sql_query);
$num_rows=@$db->db_num_rows($result);
for ($i=0;$i<$num_rows;$i++)
{
$row=pg_fetch_object($result,$i);
$row=$db->db_fetch_object($result,$i);
$sql_query="SELECT lehrfach_nr FROM tbl_lehrfach WHERE studiengang_kz=$row->studiengang_kz
AND semester=$row->semester AND kurzbz='$row->lehrfach' AND lehrform_kurzbz='$row->lehrform_kurzbz'";
//echo $sql_query."<br>";
if (!$res=pg_exec($conn, $sql_query))
echo pg_last_error($conn).'<br>';
if (!$res=$db->db_query($sql_query))
echo $db->db_last_error().'<br>';
else
if (pg_numrows($res)>=1)
if ($db->db_num_rows($res)>=1)
{
$lehrfach_nr=pg_fetch_object($res);
$lehrfach_nr=$db->db_fetch_object($res);
$lehrfach_nr=$lehrfach_nr->lehrfach_nr;
$sql_query="update tbl_stundenplan set lehrfach_nr=$lehrfach_nr WHERE stundenplan_id=$row->stundenplan_id";
//echo $sql_query."<br>";
if (!$ergebniss=pg_query($conn, $sql_query))
echo pg_last_error($conn).'<br>';
if (!$ergebniss=$db->db_query($sql_query))
echo $db->db_last_error().'<br>';
}
else
{
$sql_query="INSERT INTO tbl_lehrfach (studiengang_kz,semester,kurzbz,lehrform_kurzbz,bezeichnung,fachbereich_id,farbe) VALUES ($row->studiengang_kz,$row->semester,'$row->lehrfach','$row->lehrform_kurzbz','$row->bezeichnung',0,'$row->farbe');";
echo $sql_query.'<BR>';
if (!$ergebniss=pg_query($conn, $sql_query))
echo pg_last_error($conn).'<br>';
if (!$ergebniss=$db->db_query($sql_query))
echo $db->db_last_error().'<br>';
}
}
echo $num_rows.' Datensaetze abgeglichen! Fertig<br>';