- Bei Projektarbeiten koennen nun Personen angelegt werden (Firmenbetreuer)

- Anpassung von Vorlagen
This commit is contained in:
Andreas Österreicher
2007-09-03 10:00:04 +00:00
parent 34dacdf837
commit 943adbe824
12 changed files with 910 additions and 14 deletions
+18 -2
View File
@@ -111,6 +111,12 @@
</td>
</tr>
<!-- FuE -->
<tr>
<td class="tdwrap"><a href="#" class="MenuItem" onClick="alert('Dieser Bereich befindet sich im Aufbau')"><img src="../skin/images/menu_item.gif" width="7" height="9">&nbsp;F &amp; E</a>
</tr>
<!-- Weiterbildung -->
<tr>
<td class="tdwrap"><a href="private/info/weiterbildung/info.html" target="content" class="MenuItem" onClick="js_toggle_container('Weiterbildung');"><img src="../skin/images/menu_item.gif" width="7" height="9">&nbsp;Weiterbildung</a>
<table class="tabcontent" id="Weiterbildung" style="display: none">
@@ -328,8 +334,18 @@
<td class="tdwrap"><a class="Item" href="public/info/verordnungen/EDV_Richtlinien.doc" target="content"><img src="../skin/images/menu_item.gif" width="7" height="9">&nbsp;EDV Richtlinien</a></td>
</tr>
<tr>
<td class="tdwidth10" nowrap>&nbsp;</td>
<td class="tdwrap"><a class="Item" href="public/info/verordnungen/laborordnung.doc" target="content"><img src="../skin/images/menu_item.gif" width="7" height="9">&nbsp;Laborordnung</a></td>
<td class="tdwidth10" nowrap>&nbsp;</td>
<td class="tdwrap"><a href="?Verordnungen" class="MenuItem" onClick="return(js_toggle_container('Laborordnung'));"><img src="../skin/images/menu_item.gif" width="7" height="9">&nbsp;Laborordnung</a>
<table class="tabcontent" id="Laborordnung" style="display: none">
<tr>
<td class="tdwidth10" nowrap>&nbsp;</td>
<td class="tdwrap"><a class="Item" href="public/info/verordnungen/laborordnung.doc" target="content"><img src="../skin/images/menu_item.gif" width="7" height="9">&nbsp;Laborordnung Chemie</a></td>
</tr>
<tr>
<td class="tdwidth10" nowrap>&nbsp;</td>
<td class="tdwrap"><a class="Item" href="public/info/verordnungen/Roboter_Laborordnung.doc" target="content"><img src="../skin/images/menu_item.gif" width="7" height="9">&nbsp;Laborordnung Roboter</a></td>
</tr>
</table>
</tr>
</table>
</td>
+2 -1
View File
@@ -1,6 +1,7 @@
<?php
require_once('../../config.inc.php');
require_once('../../../include/functions.inc.php');
require_once('../../../include/globals.inc.php');
//if (!isset($REMOTE_USER))
// $REMOTE_USER='pam';
@@ -113,7 +114,7 @@
Technikum: <a class='Item' href='mailto:<?php echo $uid; ?>@technikum-wien.at'> <?php echo $uid; ?>@technikum-wien.at</a><br>
<?php
if($email_alias!='')
if($email_alias!='' && !in_array($stg,$noalias))
{
?>
Alias: <a class='Item' href='mailto:<?php echo $email_alias; ?>@technikum-wien.at'><?php echo $email_alias; ?>@technikum-wien.at</a>
@@ -936,4 +936,24 @@ function StudentProjektbetreuerLoadMitarbeiterDaten()
}
document.getElementById('student-projektbetreuer-textbox-stundensatz').value=stundensatz;
}
// ****
// * Neuen Projektbetreuer anlegen
// ****
function StudentProjektbetreuerNeuePerson()
{
window.open('<?php echo APP_ROOT; ?>vilesci/personen/personen_anlegen.php','Person anlegen');
}
// ****
// * Kontaktdaten eines Betreuers Bearbeiten
// ****
function StudentProjektbetreuerKontaktdaten()
{
person_id = MenulistGetSelectedValue('student-projektbetreuer-menulist-person');
if(person_id!='')
window.open('<?php echo APP_ROOT; ?>vilesci/personen/kontaktdaten_edit.php?person_id='+person_id,'Kontaktdaten');
else
alert('Bitte zuerst eine Person auswaehlen');
}
@@ -396,6 +396,8 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
<textbox id="student-projektbetreuer-textbox-person_id" />
<textbox id="student-projektbetreuer-textbox-betreuerart_kurzbz_old" />
<checkbox id="student-projektbetreuer-checkbox-neu" />
<label value="Name" control="student-projektbetreuer-textbox-name"/>
<textbox id="student-projektbetreuer-textbox-name" disabled="true" maxlength="32"/>
</vbox>
<grid style="margin:4px;" flex="1">
<columns >
@@ -421,8 +423,8 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
</menulist>
</row>
<row>
<label value="Name" control="student-projektbetreuer-textbox-name"/>
<textbox id="student-projektbetreuer-textbox-name" disabled="true" maxlength="32"/>
<button id="student-projektbetreuer-button-neueperson" label="Neue Person anlegen" oncommand="StudentProjektbetreuerNeuePerson()" />
<button id="student-projektbetreuer-button-kontaktdaten" label="Kontakttdaten bearbeiten" oncommand="StudentProjektbetreuerKontaktdaten()" />
</row>
<row>
<label value="Art" control="student-projektbetreuer-menulist-betreuerart"/>
+1
View File
@@ -171,6 +171,7 @@ class adresse
$adr_obj->plz = $row->plz;
$adr_obj->strasse = $row->strasse;
$adr_obj->typ = $row->typ;
$adr_obj->firma_id = $row->firma_id;
$adr_obj->updateamum = $row->updateamum;
$adr_obj->updatevon = $row->updatevon;
$adr_obj->insertamum = $row->insertamum;
+1
View File
@@ -105,6 +105,7 @@ class kontakt
$this->insertamum = $row->insertamum;
$this->insertvon = $row->insertvon;
$this->ext_id = $row->ext_id;
return true;
}
else
{
+2 -2
View File
@@ -153,9 +153,9 @@ class projektbetreuer
return false;
}
if(!is_numeric($this->note))
if($this->note!='' && !is_numeric($this->note))
{
$this->errormsg = 'Note muß ein numerischer Wert sein - person_id/projektarbeit: '.$this->person_id.'/'.$this->projektarbeit_id;
$this->errormsg = 'Note muss ein numerischer Wert sein - person_id/projektarbeit: '.$this->person_id.'/'.$this->projektarbeit_id;
return false;
}
if(!is_numeric($this->punkte))
@@ -87,12 +87,12 @@
</fo:table-row>
<fo:table-row line-height="14pt">
<fo:table-cell border-width="0.2mm" border-style="solid">
<fo:block font-family="sans-serif" font-size="10pt" content-width="45mm" text-align="left">
<fo:block font-family="sans-serif" font-size="10pt" content-width="80mm" text-align="left">
<xsl:text> </xsl:text><xsl:value-of select="betreuer" />\n <xsl:value-of select="betreuer_2" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-width="0.2mm" border-style="solid">
<fo:block font-family="sans-serif" font-size="10pt" content-width="45mm" text-align="left">
<fo:block font-family="sans-serif" font-size="10pt" content-width="181.2mm" text-align="left">
<xsl:text> </xsl:text><xsl:value-of select="themenbereich" />\n <xsl:value-of select="themenbereich_2" />
</fo:block>
</fo:table-cell>
@@ -98,12 +98,12 @@
</fo:table-row>
<fo:table-row line-height="14pt">
<fo:table-cell border-width="0.2mm" border-style="solid">
<fo:block font-family="sans-serif" font-size="10pt" content-width="45mm" text-align="left">
<fo:block font-family="sans-serif" font-size="10pt" content-width="80mm" text-align="left">
<xsl:text> </xsl:text><xsl:value-of select="betreuer" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-width="0.2mm" border-style="solid">
<fo:block font-family="sans-serif" font-size="10pt" content-width="45mm" text-align="left">
<fo:block font-family="sans-serif" font-size="10pt" content-width="120mm" text-align="left">
<xsl:text> </xsl:text><xsl:value-of select="themenbereich" />
</fo:block>
</fo:table-cell>
@@ -113,7 +113,7 @@
</fo:block>
</fo:table-cell>
<fo:table-cell border-width="0.2mm" border-style="solid">
<fo:block font-family="sans-serif" font-size="10pt" content-width="45mm" text-align="left">
<fo:block font-family="sans-serif" font-size="10pt" content-width="36.4mm" text-align="left">
<xsl:text> </xsl:text>
</fo:block>
</fo:table-cell>
@@ -125,7 +125,7 @@
<fo:table-body>
<fo:table-row line-height="14pt">
<fo:table-cell border-width="0.2mm" border-style="solid">
<fo:block font-family="sans-serif" font-size="10pt" content-width="45mm" text-align="left" font-weight="bold">
<fo:block font-family="sans-serif" font-size="10pt" content-width="261.6mm" text-align="left" font-weight="bold">
<xsl:text> Technisches Fachgebiet:</xsl:text>
</fo:block>
</fo:table-cell>
@@ -200,7 +200,7 @@
<fo:table-body>
<fo:table-row line-height="14pt">
<fo:table-cell border-width="0.2mm" border-style="solid">
<fo:block font-family="sans-serif" font-size="10pt" content-width="45mm" text-align="left" font-weight="bold">
<fo:block font-family="sans-serif" font-size="10pt" content-width="261.6mm" text-align="left" font-weight="bold">
<xsl:text> Nichttechnisches Fachgebiet:</xsl:text>
</fo:block>
</fo:table-cell>
+432
View File
@@ -0,0 +1,432 @@
<?php
/* Copyright (C) 2007 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>.
*/
require_once('../config.inc.php');
require_once('../../include/functions.inc.php');
require_once('../../include/benutzerberechtigung.class.php');
require_once('../../include/person.class.php');
require_once('../../include/datum.class.php');
require_once('../../include/adresse.class.php');
require_once('../../include/nation.class.php');
require_once('../../include/firma.class.php');
require_once('../../include/kontakt.class.php');
if(!$conn=pg_pconnect(CONN_STRING))
die('Fehler beim Herstellen der DB Connection');
$user=get_uid();
$datum_obj = new datum();
loadVariables($conn, $user);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<link href="../../skin/vilesci.css" rel="stylesheet" type="text/css">
<script language="Javascript">
function confdel()
{
return confirm('Wollen Sie diesen Datensatz wirklich loeschen?');
}
</script>
<style>
td
{
font-size: small;
}
</style>
</head>
<body>
<?php
//Berechtigung pruefen
$rechte = new benutzerberechtigung($conn);
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('mitarbeiter'))
die('Sie haben keine Berechtigung fuer diese Seite');
$person_id = (isset($_GET['person_id'])?$_GET['person_id']:'');
$adresse_id = (isset($_REQUEST['adresse_id'])?$_REQUEST['adresse_id']:'');
$kontakt_id = (isset($_REQUEST['kontakt_id'])?$_REQUEST['kontakt_id']:'');
$errormsg = '';
$error = false;
$adresstyp = (isset($_POST['adresstyp'])?$_POST['adresstyp']:'');
$strasse = (isset($_POST['strasse'])?$_POST['strasse']:'');
$plz = (isset($_POST['plz'])?$_POST['plz']:'');
$ort = (isset($_POST['ort'])?$_POST['ort']:'');
$gemeinde = (isset($_POST['gemeinde'])?$_POST['gemeinde']:'');
$nation = (isset($_POST['nation'])?$_POST['nation']:'');
$heimatadresse = (isset($_POST['heimatadresse'])?true:false);
$zustelladresse = (isset($_POST['zustelladresse'])?true:false);
$firma_id = (isset($_POST['firma'])?$_POST['firma']:'');
$zustellung = (isset($_POST['zustellung'])?true:false);
$anmerkung = (isset($_POST['anmerkung'])?$_POST['anmerkung']:false);
$kontakt = (isset($_POST['kontakt'])?$_POST['kontakt']:false);
if($person_id=='')
die('Person_id muss uebergeben werden');
//Loeschen einer Adresse
if(isset($_GET['deleteadresse']))
{
if(is_numeric($adresse_id))
{
$adresse_obj = new adresse($conn);
if(!$adresse_obj->delete($adresse_id))
{
$errormsg = 'Fehler beim Loeschen der Adresse:'.$adresse_obj->errormsg;
}
}
}
//Loeschen einen Kontakt
if(isset($_GET['deletekontakt']))
{
if(is_numeric($kontakt_id))
{
$kontakt_obj = new kontakt($conn);
if(!$kontakt_obj->delete($kontakt_id))
{
$errormsg = 'Fehler beim Loeschen des Kontakts:'.$kontakt_obj->errormsg;
}
}
}
//Speichern einer Adresse
if(isset($_POST['saveadresse']))
{
$adresse_obj = new adresse($conn);
if(is_numeric($adresse_id))
{
if($adresse_obj->load($adresse_id))
{
$adresse_obj->new = false;
}
else
{
$errormsg = 'Adresse wurde nicht gefunden:'.$adresse_id;
$error=true;
}
}
else
{
$adresse_obj->new = true;
$adresse_obj->insertamum = date('Y-m-d H:i:s');
$adresse_obj->insertvon = $user;
}
if(!$error)
{
$adresse_obj->person_id=$person_id;
$adresse_obj->strasse = $strasse;
$adresse_obj->plz = $plz;
$adresse_obj->ort = $ort;
$adresse_obj->gemeinde = $gemeinde;
$adresse_obj->nation = $nation;
$adresse_obj->typ = $adresstyp;
$adresse_obj->heimatadresse = $heimatadresse;
$adresse_obj->zustelladresse = $zustelladresse;
$adresse_obj->firma_id = $firma_id;
$adresse_obj->updateamum = date('Y-m-d H:i:s');
$adresse_obj->updatvon = $user;
//var_dump($adresse_obj);
if(!$adresse_obj->save())
{
$errormsg = 'Fehler beim Speichern der Adresse:'.$adresse_obj->errormsg;
}
else
{
$errormsg = 'Daten wurden gespeichert';
}
}
}
//Speichern eines Kontaktes
if(isset($_POST['savekontakt']))
{
$kontakt_obj = new kontakt($conn);
if(is_numeric($kontakt_id))
{
if($kontakt_obj->load($kontakt_id))
{
$kontakt_obj->new = false;
}
else
{
$errormsg = 'Kontakt wurde nicht gefunden:'.$kontakt_id;
$error=true;
}
}
else
{
$kontakt_obj->new = true;
$kontakt_obj->insertamum = date('Y-m-d H:i:s');
$kontakt_obj->insertvon = $user;
}
if(!$error)
{
$kontakt_obj->person_id=$person_id;
$kontakt_obj->firma_id = $firma_id;
$kontakt_obj->kontakttyp = $kontakttyp;
$kontakt_obj->kontakt = $kontakt;
$kontakt_obj->anmerkung = $anmerkung;
$kontakt_obj->zustellung = $zustellung;
$kontakt_obj->updateamum = date('Y-m-d H:i:s');
$kontakt_obj->updatvon = $user;
if(!$kontakt_obj->save())
{
$errormsg = 'Fehler beim Speichern des Kontaktes:'.$kontakt_obj->errormsg;
}
else
{
$errormsg = 'Daten wurden gespeichert';
}
}
}
//Person laden
$person = new person($conn);
if(!$person->load($person_id))
die('Person wurde nicht gefunden');
//Nationen laden
$nation_arr = array();
$nation = new nation($conn);
$nation->getAll();
foreach($nation->nation as $row)
$nation_arr[$row->code]=$row->kurztext;
//Firmen laden
$firma_arr = array();
$firma = new firma($conn);
$firma->getAll();
foreach($firma->result as $row)
$firma_arr[$row->firma_id]=$row->name;
$adresstyp_arr = array('h'=>'Hauptwohnsitz','n'=>'Nebenwohnsitz','f'=>'Firma');
//Kontakttypen laden
$kontakttyp_arr = array();
$kontakt_obj = new kontakt($conn);
$kontakt_obj->getKontakttyp();
foreach ($kontakt_obj->result as $row)
$kontakttyp_arr[]=$row->kontakttyp;
echo "<h2>Kontaktdaten von $person->vorname $person->nachname</h2>";
echo $errormsg.'<br>';
// *** ADRESSEN ***
echo "<h3>Adressen:</h3>";
echo "<form action='".$_SERVER['PHP_SELF']."?person_id=$person_id' method='POST' />";
echo "<table class='liste'><tr><th>STRASSE</th><th>PLZ</th><th>ORT</th><th>GEMEINDE</th><th>NATION</th><th>TYP</th><th>HEIMAT</th><th>ZUSTELLUNG</th><th>FIRMA</th></tr>";
$adresse_obj = new adresse($conn);
$adresse_obj->load_pers($person_id);
foreach ($adresse_obj->result as $row)
{
echo '<tr class="liste1">';
echo "<td>$row->strasse</td>";
echo "<td>$row->plz</td>";
echo "<td>$row->ort</td>";
echo "<td>$row->gemeinde</td>";
echo "<td>".$nation_arr[$row->nation]."</td>";
echo "<td>".$adresstyp_arr[$row->typ]."</td>";
echo "<td>".($row->heimatadresse?'Ja':'Nein')."</td>";
echo "<td>".($row->zustelladresse?'Ja':'Nein')."</td>";
echo "<td>".($row->firma_id!=''?$firma_arr[$row->firma_id]:'')."</td>";
echo "<td><a href='".$_SERVER['PHP_SELF']."?editadresse=true&adresse_id=$row->adresse_id&person_id=$person_id'>bearbeiten</a></td>";
echo "<td><a href='".$_SERVER['PHP_SELF']."?deleteadresse=true&adresse_id=$row->adresse_id&person_id=$person_id' onclick='return confdel()'>loeschen</a></td>";
}
$savebuttonvalue='Neu';
if(isset($_GET['editadresse']))
{
$adresse_obj = new adresse($conn);
if($adresse_obj->load($adresse_id))
{
$strasse = $adresse_obj->strasse;
$plz = $adresse_obj->plz;
$ort = $adresse_obj->ort;
$gemeinde = $adresse_obj->gemeinde;
$nation = $adresse_obj->nation;
$typ = $adresse_obj->typ;
$heimatadresse = $adresse_obj->heimatadresse;
$zustelladresse = $adresse_obj->zustelladresse;
$firma_id = $adresse_obj->firma_id;
$savebuttonvalue='Speichern';
}
}
else
{
$strasse='';
$plz='';
$ort='';
$gemeinde='';
$nation = 'A';
$typ='';
$heimatadresse='';
$zustelladresse='';
$firma_id='';
$adresse_id='';
}
echo "<input type='hidden' name='adresse_id' value='".$adresse_id."' />";
echo '<tr class="liste1">';
echo "<td><input type='text' name='strasse' value='".htmlentities($strasse)."' /></td>";
echo "<td><input type='text' name='plz' size='4' value='".htmlentities($plz)."' /></td>";
echo "<td><input type='text' name='ort' value='".htmlentities($ort)."' /></td>";
echo "<td><input type='text' name='gemeinde' value='".htmlentities($gemeinde)."' /></td>";
echo "<td><SELECT name='nation'>";
foreach ($nation_arr as $code=>$kurzbz)
{
if($code==$nation)
$selected='selected';
else
$selected='';
echo "<OPTION value='$code' $selected>$kurzbz</OPTION>";
}
echo "</SELECT></td>";
echo "<td><SELECT name='adresstyp'>";
foreach($adresstyp_arr as $code=>$kurzbz)
{
if($code==$typ)
$selected='selected';
else
$selected='';
echo "<OPTION value='$code' $selected>$kurzbz</OPTION>";
}
echo "</SELECT></td>";
echo "<td><input type='checkbox' name='heimatadresse' ".($heimatadresse?'checked':'')." /></td>";
echo "<td><input type='checkbox' name='zustelladresse' ".($zustelladresse?'checked':'')." /></td>";
echo "<td><SELECT name='firma'>";
echo "<OPTION value=''>-- keine Auswahl --</OPTION>";
foreach ($firma_arr as $id=>$kurzbz)
{
if($id==$firma_id)
$selected='selected';
else
$selected='';
echo "<OPTION value='$id' $selected>$kurzbz</OPTION>";
}
echo "</SELECT></td>";
echo "<td><input type='submit' name='saveadresse' value='$savebuttonvalue' /></td>";
echo "</table>";
echo "</form>";
// *** Kontakte ***
echo "<h3>Kontakte:</h3>";
echo "<form action='".$_SERVER['PHP_SELF']."?person_id=$person_id' method='POST' />";
echo "<table class='liste'><tr><th>TYP</th><th>KONTAKT</th><th>ZUSTELLUNG</th><th>ANMERKUNG</th><th>FIRMA</th></tr>";
$kontakt_obj = new kontakt($conn);
$kontakt_obj->load_pers($person_id);
foreach ($kontakt_obj->result as $row)
{
echo '<tr class="liste1">';
echo "<td>$row->kontakttyp</td>";
echo "<td>$row->kontakt</td>";
echo "<td>".($row->zustellung?'Ja':'Nein')."</td>";
echo "<td>$row->anmerkung</td>";
echo "<td>".($row->firma_id!=''?$firma_arr[$row->firma_id]:'')."</td>";
echo "<td><a href='".$_SERVER['PHP_SELF']."?editkontakt=true&kontakt_id=$row->kontakt_id&person_id=$person_id'>bearbeiten</a></td>";
echo "<td><a href='".$_SERVER['PHP_SELF']."?deletekontakt=true&kontakt_id=$row->kontakt_id&person_id=$person_id' onclick='return confdel()'>loeschen</a></td>";
}
$savebuttonvalue='Neu';
if(isset($_GET['editkontakt']))
{
$kontakt_obj = new kontakt($conn);
if($kontakt_obj->load($kontakt_id))
{
$kontakttyp = $kontakt_obj->kontakttyp;
$zustellung = $kontakt_obj->zustellung;
$anmerkung = $kontakt_obj->anmerkung;
$kontakt = $kontakt_obj->kontakt;
$firma_id = $kontakt_obj->firma_id;
$savebuttonvalue='Speichern';
}
else
echo 'Fehler beim Laden'.$kontakt_id;
}
else
{
$kontakt_id='';
$kontakttyp='';
$kontakt='';
$zustellung=true;
$anmerkung='';
$firma_id='';
}
echo "<input type='hidden' name='kontakt_id' value='".$kontakt_id."' />";
echo '<tr class="liste1">';
echo "<td><SELECT name='kontakttyp'>";
foreach ($kontakttyp_arr as $kurzbz)
{
if($kurzbz==$kontakttyp)
$selected='selected';
else
$selected='';
echo "<OPTION value='$kurzbz' $selected>$kurzbz</OPTION>";
}
echo "</SELECT></td>";
echo "<td><input type='text' name='kontakt' value='".htmlentities($kontakt)."' /></td>";
echo "<td><input type='checkbox' name='zustellung' ".($zustellung?'checked':'')." /></td>";
echo "<td><input type='text' name='anmerkung' value='".htmlentities($anmerkung)."' /></td>";
echo "<td><SELECT name='firma'>";
echo "<OPTION value=''>-- keine Auswahl --</OPTION>";
foreach ($firma_arr as $id=>$kurzbz)
{
if($id==$firma_id)
$selected='selected';
else
$selected='';
echo "<OPTION value='$id' $selected>$kurzbz</OPTION>";
}
echo "</SELECT></td>";
echo "<td><input type='submit' name='savekontakt' value='$savebuttonvalue' /></td>";
echo "</table>";
echo "</form>";
?>
</body>
</html>
+423
View File
@@ -0,0 +1,423 @@
<?php
/* Copyright (C) 2007 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>.
*/
require_once('../config.inc.php');
require_once('../../include/functions.inc.php');
require_once('../../include/benutzerberechtigung.class.php');
require_once('../../include/person.class.php');
require_once('../../include/datum.class.php');
if(!$conn=pg_pconnect(CONN_STRING))
die('Fehler beim Herstellen der DB Connection');
$user=get_uid();
$datum_obj = new datum();
loadVariables($conn, $user);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<link href="../../skin/cis.css" rel="stylesheet" type="text/css">
<script language="Javascript">
function disablefields(obj)
{
if(obj.value==0)
val=false;
else
val=true;
document.getElementById('titel').disabled=val;
document.getElementById('nachname').disabled=val;
document.getElementById('vorname').disabled=val;
document.getElementById('geschlecht').disabled=val;
document.getElementById('geburtsdatum').disabled=val;
document.getElementById('svnr').disabled=val;
document.getElementById('ersatzkennzeichen').disabled=val;
//document.getElementById('adresse').disabled=val;
//document.getElementById('plz').disabled=val;
//document.getElementById('ort').disabled=val;
if(val)
{
document.getElementById('ueb1').style.display = 'block';
document.getElementById('ueb2').style.display = 'block';
document.getElementById('ueb3').style.display = 'block';
}
else
{
document.getElementById('ueb1').style.display = 'none';
document.getElementById('ueb2').style.display = 'none';
document.getElementById('ueb3').style.display = 'none';
}
}
function GeburtsdatumEintragen()
{
svnr = document.getElementById('svnr').value;
gebdat = document.getElementById('geburtsdatum');
if(svnr.length==10 && gebdat.value=='')
{
var tag = svnr.substr(4,2);
var monat = svnr.substr(6,2);
var jahr = svnr.substr(8,2);
gebdat.value='19'+jahr+'-'+monat+'-'+tag;
}
}
function disablefields2(val)
{
document.getElementById('adresse').disabled=val;
document.getElementById('plz').disabled=val;
document.getElementById('ort').disabled=val;
}
</script>
</head>
<body>
<h1>Person Anlegen</h1>
<?php
//Berechtigung pruefen
$rechte = new benutzerberechtigung($conn);
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('mitarbeiter'))
die('Sie haben keine Berechtigung fuer diese Seite');
$where = '';
$error = false;
//Parameter
$titel = (isset($_POST['titel'])?$_POST['titel']:'');
$nachname = (isset($_POST['nachname'])?$_POST['nachname']:'');
$vorname = (isset($_POST['vorname'])?$_POST['vorname']:'');
$geschlecht = (isset($_POST['geschlecht'])?$_POST['geschlecht']:'');
$geburtsdatum = (isset($_POST['geburtsdatum'])?$_POST['geburtsdatum']:'');
$adresse = (isset($_POST['adresse'])?$_POST['adresse']:'');
$plz = (isset($_POST['plz'])?$_POST['plz']:'');
$ort = (isset($_POST['ort'])?$_POST['ort']:'');
$email = (isset($_POST['email'])?$_POST['email']:'');
$telefon = (isset($_POST['telefon'])?$_POST['telefon']:'');
$mobil = (isset($_POST['mobil'])?$_POST['mobil']:'');
$person_id = (isset($_POST['person_id'])?$_POST['person_id']:'');
$svnr = (isset($_POST['svnr'])?$_POST['svnr']:'');
$ersatzkennzeichen = (isset($_POST['ersatzkennzeichen'])?$_POST['ersatzkennzeichen']:'');
$ueberschreiben = (isset($_REQUEST['ueberschreiben'])?$_REQUEST['ueberschreiben']:'');
//end Parameter
$geburtsdatum_error=false;
// *** Speichern der Daten ***
if(isset($_POST['save']))
{
//echo "Saving Data: Geburtsdatum: $geburtsdatum | Titel: $titel | Nachname: $nachname | Vorname: $vorname |
// Geschlecht: $geschlecht | Adresse: $adresse | Plz: $plz | Ort: $ort |
// Email: $email | Telefon: $telefon | Mobil: $mobil | Letzteausbildung: $letzteausbildung | ausbildungsart: $ausbildungsart |
// anmerkungen: $anmerkungen | studiengang_kz: $studiengang_kz | person_id: $person_id<br><br>";
$person = new person($conn);
pg_query($conn, 'BEGIN');
//Wenn die person_id=0 dann wird eine neue Person angelegt
//Sonst nicht
if($person_id=='0')
{
$person->new = true;
$person->titelpre = $titel;
$person->nachname = $nachname;
$person->vorname = $vorname;
$person->geschlecht = $geschlecht;
$person->gebdatum = $geburtsdatum;
$person->svnr = $svnr;
$person->ersatzkennzeichen = $ersatzkennzeichen;
$person->aktiv = true;
if($person->save())
{
$error=false;
}
else
{
$error=true;
$errormsg = "Person konnte nicht gespeichert werden: $person->errormsg";
}
}
//Adresse anlegen
if($ueberschreiben!='' && !($plz=='' && $adresse=='' && $ort==''))
{
if($person_id=='0')
$ueberschreiben='Nein';
$adr = new adresse($conn);
//Adresse neu anlegen
if($ueberschreiben=='Nein')
{
$adr->new = true;
$adr->insertamum = date('Y-m-d H:i:s');
$adr->insertvon = $user;
}
else
{
//Bestehende Adresse Ueberschreiben
//Adressen der Peron laden
$adr->load_pers($person->person_id);
if(isset($adr->result[0]))
{
//Erste Adresse laden
if($adr->load($adr->result[0]->adresse_id))
{
$adr->new = false;
$adr->updateamum = date('Y-m-d H:i:s');
$adr->updatevon = $user;
}
else
{
$error = true;
$errormsg = 'Fehler beim Laden der Adresse';
}
}
else
{
//Wenn keine Adrese vorhanden ist dann eine neue Anlegen
$adr->new = true;
$adr->insertamum = date('Y-m-d H:i:s');
$adr->insertvon = $user;
}
}
if(!$error)
{
//Adressdaten zuweisen und speichern
$adr->person_id = $person->person_id;
$adr->strasse = $adresse;
$adr->plz = $plz;
$adr->ort = $ort;
$adr->typ = 'h';
$adr->heimatadresse = true;
$adr->zustelladresse = true;
if(!$adr->save())
{
$error = true;
$errormsg = $adr->errormsg;
}
}
}
//Kontaktdaten anlegen
if(!$error)
{
//EMail Adresse speichern
if($email!='')
{
$kontakt = new kontakt($conn);
$kontakt->person_id = $person->person_id;
$kontakt->kontakttyp = 'email';
$kontakt->kontakt = $email;
$kontakt->zustellung = true;
$kontakt->insertamum = date('Y-m-d H:i:s');
$kontakt->insertvon = $user;
$kontakt->new = true;
if(!$kontakt->save())
{
$error = true;
$errormsg = 'Fehler beim Speichern der Email Adresse';
}
}
//Telefonnummer speichern
if($telefon!='')
{
$kontakt = new kontakt($conn);
$kontakt->person_id = $person->person_id;
$kontakt->kontakttyp = 'telefon';
$kontakt->kontakt = $telefon;
$kontakt->zustellung = true;
$kontakt->insertamum = date('Y-m-d H:i:s');
$kontakt->insertvon = $user;
$kontakt->new = true;
if(!$kontakt->save())
{
$error = true;
$errormsg = 'Fehler beim Speichern der Telefonnummer';
}
}
//Mobiltelefonnummer speichern
if($mobil!='')
{
$kontakt = new kontakt($conn);
$kontakt->person_id = $person->person_id;
$kontakt->kontakttyp = 'mobil';
$kontakt->kontakt = $mobil;
$kontakt->zustellung = true;
$kontakt->insertamum = date('Y-m-d H:i:s');
$kontakt->insertvon = $user;
$kontakt->new = true;
if(!$kontakt->save())
{
$error = true;
$errormsg = 'Fehler beim Speichern der Mobiltelefonnummer';
}
}
}
if(!$error)
{
pg_query($conn, 'COMMIT');
die("<script language='Javascript'>
window.opener.StudentProjektbetreuerMenulistPersonLoad(window.opener.document.getElementById('student-projektbetreuer-menulist-person'), '$nachname');
window.opener.MenulistSelectItemOnValue('student-projektbetreuer-menulist-person', $person->person_id);
</script>
<b>Person $vorname $nachname wurde erfolgreich angelegt</b><br>");
}
else
{
pg_query($conn, 'ROLLBACK');
echo '<span class="error">'.$errormsg.'</span>';
}
}
// *** SAVE ENDE ***
if($geburtsdatum!='')
{
//Wenn das Datum im Format d.m.Y ist dann in Y-m-d umwandeln
if(strpos($geburtsdatum,'.'))
{
if($datum_obj->mktime_datum($geburtsdatum))
{
$geburtsdatum = date('Y-m-d',$datum_obj->mktime_datum($geburtsdatum));
}
else
{
$geburtsdatum_error=true;
}
}
else
{
if(!ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$geburtsdatum))
$geburtsdatum_error=true;
}
if($geburtsdatum_error)
echo "Format des Geburtsdatums ist ungueltig!";
}
?>
<form method='POST'>
<table width="100%">
<tr>
<td>
<!--Formularfelder-->
<table>
<?php
echo '<tr><td>Titel</td><td><input type="text" id="titel" name="titel" maxlength="64" value="'.$titel.'" /></td></tr>';
echo '<tr><td>Vorname</td><td><input type="text" id="vorname" maxlength="32" name="vorname" value="'.$vorname.'" /></td></tr>';
echo '<tr><td>Nachname</td><td><input type="text" maxlength="64" id="nachname" name="nachname" value="'.$nachname.'" /></td></tr>';
echo '<tr><td>Geschlecht</td><td><SELECT id="geschlecht" name="geschlecht">';
echo '<OPTION value="m" '.($geschlecht=='m'?'selected':'').'>m&auml;nnlich</OPTION>';
echo '<OPTION value="w" '.($geschlecht=='w'?'selected':'').'>weiblich</OPTION>';
echo '</SELECT>';
echo '</td></tr>';
echo '<tr><td>SVNR</td><td><input type="text" id="svnr" size="10" maxlength="10" name="svnr" value="'.$svnr.'" onblur="GeburtsdatumEintragen()" /></td></tr>';
echo '<tr><td>Ersatzkennzeichen</td><td><input type="text" id="ersatzkennzeichen" size="10" maxlength="10" name="ersatzkennzeichen" value="'.$ersatzkennzeichen.'" /></td></tr>';
echo '<tr><td>Geburtsdatum</td><td><input type="text" id="geburtsdatum" size="10" maxlength="10" name="geburtsdatum" value="'.$geburtsdatum.'" /></td></tr>';
echo '<tr><td colspan="2"><fieldset><legend>Adresse</legend><table>';
echo '<tr><td>Adresse</td><td><input type="text" id="adresse" maxlength="256" name="adresse" value="'.$adresse.'" /></td></tr>';
echo '<tr><td>Postleitzahl</td><td><input type="text" maxlength="16" id="plz" name="plz" value="'.$plz.'" /></td></tr>';
echo '<tr><td>Ort</td><td><input type="text" id="ort" maxlength="256" name="ort" value="'.$ort.'" /></td></tr>';
echo '</table>';
echo '<div style="display: none;" id="ueb1"><input type="radio" id="ueberschreiben1" name="ueberschreiben" value="Ja" onclick="disablefields2(false)">Bestehende Adresse überschreiben</div>';
echo '<div style="display: none;" id="ueb2"><input type="radio" id="ueberschreiben2" name="ueberschreiben" value="Nein" onclick="disablefields2(false)" checked>Adresse hinzufügen</div>';
echo '<div style="display: none;" id="ueb3"><input type="radio" id="ueberschreiben3" name="ueberschreiben" value="" onclick="disablefields2(true)">Adresse nicht anlegen</div>';
echo '</fieldset></td></tr>';
echo '<tr><td>EMail</td><td><input type="text" id="email" maxlength="128" name="email" value="'.$email.'" /></td></tr>';
echo '<tr><td>Telefon</td><td><input type="text" id="telefon" maxlength="128" name="telefon" value="'.$telefon.'" /></td></tr>';
echo '<tr><td>Mobil</td><td><input type="text" id="mobil" maxlength="128" name="mobil" value="'.$mobil.'" /></td></tr>';
echo '<tr><td></td><td>';
if(($geburtsdatum=='' && $vorname=='' && $nachname=='') || $geburtsdatum_error)
echo '<input type="submit" name="showagain" value="Vorschlag laden">';
else
echo '<input type="submit" name="save" value="Speichern">';
echo '</td></tr>';
echo '</table>';
echo '</td>';
echo '<td valign="top">';
//Vorschlaege
//Vorschlaege laden
if($geburtsdatum!='')
{
if(ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$geburtsdatum))
{
$where = " gebdatum='".$geburtsdatum."'";
}
}
if($vorname!='' && $nachname!='')
{
if($where!='')
$where.=' OR';
$where.=" (LOWER(vorname)=LOWER('".$vorname."') AND LOWER(nachname)=LOWER('".$nachname."'))";
}
if($where!='')
{
$qry = "SELECT * FROM public.tbl_person WHERE $where ORDER BY nachname, vorname, gebdatum";
if($result = pg_query($conn, $qry))
{
echo '<table><tr><th></th><th>Nachname</th><th>Vorname</th><th>GebDatum</th><th>SVNR</th><th>Geschlecht</th><th>Adresse</th><th>Status</th></tr>';
while($row = pg_fetch_object($result))
{
$status = '';
$qry_ma = "SELECT * FROM campus.vw_mitarbeiter WHERE person_id='$row->person_id'";
if($result_ma = pg_query($conn, $qry_ma))
if($row_ma=pg_fetch_object($result_ma))
$status.=' Mitarbeiter';
$qry_ma = "SELECT * FROM campus.vw_student WHERE person_id='$row->person_id'";
if($result_ma = pg_query($conn, $qry_ma))
if($row_ma=pg_fetch_object($result_ma))
$status.=' Student';
echo '<tr valign="top"><td><input type="radio" name="person_id" value="'.$row->person_id.'" onclick="disablefields(this)"></td><td>'."$row->nachname</td><td>$row->vorname</td><td>$row->gebdatum</td><td>$row->svnr</td><td>".($row->geschlecht=='m'?'männlich':'weiblich')."</td><td>";
$qry_adr = "SELECT * FROM public.tbl_adresse WHERE person_id='$row->person_id'";
if($result_adr = pg_query($conn, $qry_adr))
while($row_adr=pg_fetch_object($result_adr))
echo "$row_adr->plz $row_adr->ort, $row_adr->strasse<br>";
echo "<td>$status</td>";
echo "</td></tr>";
}
echo '<tr><td><input type="radio" name="person_id" value="0" checked onclick="disablefields(this)"></td><td>Neue Person anlegen</td></tr>';
echo '</table>';
}
}
//else
// echo 'Zum Erstellen des Vorschlags bitte Geburtsdatum oder Vorname und Nachname eingeben';
?>
</td>
</tr>
</table>
</form>
</body>
</html>