This commit is contained in:
Gerald Raab
2007-08-10 08:30:00 +00:00
parent 437fd51dcb
commit b74d0a29a7
12 changed files with 1601 additions and 529 deletions
@@ -526,35 +526,69 @@ function addUser(student_uid)
{
if($uid!='')
{
foreach($beispiel_obj->beispiele as $bsp)
{
if(isset($_POST['update_'.$uid.'_'.$bsp->beispiel_id]))
$vorbereitet=true;
else
$vorbereitet=false;
$bsp_obj = new beispiel($conn);
if(!$bsp_obj->studentbeispiel_exists($uid,$bsp->beispiel_id))
if ($uebung_obj->beispiele)
{
foreach($beispiel_obj->beispiele as $bsp)
{
$new=true;
$bsp_obj->insertamum = date('Y-m-d H:i:s');
$bsp_obj->insertvon = $user;
}
else
{
$bsp_obj->load_studentbeispiel($uid, $bsp->beispiel_id);
$new=false;
}
if(isset($_POST['update_'.$uid.'_'.$bsp->beispiel_id]))
$vorbereitet=true;
else
$vorbereitet=false;
$bsp_obj = new beispiel($conn);
$bsp_obj->student_uid = $uid;
$bsp_obj->beispiel_id = $bsp->beispiel_id;
$bsp_obj->vorbereitet = $vorbereitet;
$bsp_obj->updateamum = date('Y-m-d H:i:s');
$bsp_obj->updatevon = $user;
if(!$bsp_obj->studentbeispiel_save($new))
$error=true;
if(!$bsp_obj->studentbeispiel_exists($uid,$bsp->beispiel_id))
{
$new=true;
$bsp_obj->insertamum = date('Y-m-d H:i:s');
$bsp_obj->insertvon = $user;
}
else
{
$bsp_obj->load_studentbeispiel($uid, $bsp->beispiel_id);
$new=false;
}
$bsp_obj->student_uid = $uid;
$bsp_obj->beispiel_id = $bsp->beispiel_id;
$bsp_obj->vorbereitet = $vorbereitet;
$bsp_obj->updateamum = date('Y-m-d H:i:s');
$bsp_obj->updatevon = $user;
if(!$bsp_obj->studentbeispiel_save($new))
$error=true;
}
}
else
{
if (!$uebung_obj->load_studentuebung($uid,$uebung_id))
{
$uebung_obj->student_uid = $uid;
$uebung_obj->mitarbeiter_uid = $user;
$uebung_obj->abgabe_id = null;
$uebung_obj->note = $_POST['update_'.$uid.'_note'];
$uebung_obj->mitarbeitspunkte = null;
$uebung_obj->punkte = null;
$uebung_obj->anmerkung = null;
$uebung_obj->benotungsdatum = date("Y-m-d H:i:s");
$uebung_obj->updateamum = null;
$uebung_obj->updatevon = null;
$uebung_obj->insertamum = date("Y-m-d H:i:s");
$uebung_obj->insertvon = $user;
$new = true;
}
else
{
$uebung_obj->load_studentuebung($uid,$uebung_id);
$uebung_obj->mitarbeiter_uid = $user;
$uebung_obj->note = $_POST['update_'.$uid.'_note'];
$uebung_obj->benotungsdatum = date("Y-m-d H:i:s");
$uebung_obj->updateamum = date("Y-m-d H:i:s");
$uebung_obj->updatevon = $user;
$new = false;
}
$uebung_obj->studentuebung_save($new);
}
}
}
@@ -573,7 +607,10 @@ function addUser(student_uid)
$stg_obj = new studiengang($conn, $lehrveranstaltung_obj->studiengang_kz);
$beispiel_obj->load_beispiel($uebung_id);
$anzahl = count($beispiel_obj->beispiele);
if ($uebung_obj->beispiele)
$anzahl = count($beispiel_obj->beispiele);
else
$anzahl = 1;
if(isset($_GET['gruppe']) && $_GET['gruppe']!='')
{
$gruppe = $_GET['gruppe'];
@@ -656,10 +693,15 @@ function addUser(student_uid)
</td>
</tr>";
echo "<tr><td align='center'><b>Name</b></td>";
foreach($beispiel_obj->beispiele as $row)
echo "<tr><td align='center'><b>Name</b></td>";
if (!$uebung_obj->beispiele)
echo "<td>Note</td>";
else
{
echo "<td>$row->bezeichnung</td>";
foreach($beispiel_obj->beispiele as $row)
{
echo "<td>$row->bezeichnung</td>";
}
}
echo "<td align='center' width='200'><b>Unterschrift</b></td></tr>\n";
@@ -669,11 +711,21 @@ function addUser(student_uid)
{
echo "<tr onMouseOver=\"this.style.backgroundColor='#c7dfe8'\" onMouseOut=\"this.style.backgroundColor='#ffffff'\">
<td nowrap><input type='checkbox' name='update_$row_stud->uid' disabled>&nbsp;<b>$row_stud->nachname</b>&nbsp;$row_stud->vorname $row_stud->uid</td>";
foreach($beispiel_obj->beispiele as $row_bsp)
{
$studentbeispiel_obj = new beispiel($conn);
$studentbeispiel_obj->load_studentbeispiel($row_stud->uid, $row_bsp->beispiel_id);
echo "<td align='center'><input type='checkbox' name='update_".$row_stud->uid."_".$row_bsp->beispiel_id."' onClick=\"addUser('$row_stud->uid');\" ".($studentbeispiel_obj->vorbereitet?'checked':'').">".($studentbeispiel_obj->probleme?'<i><small>P</small></i>':'')."</td>\n";
if (!$uebung_obj->beispiele)
{
$studentuebung_obj = new uebung($conn);
$studentuebung_obj->load_studentuebung($row_stud->uid,$uebung_id);
echo "<td align='center'><input type='text' name='update_".$row_stud->uid."_note' onchange=\"addUser('$row_stud->uid');\" value='".$studentuebung_obj->note."' size='3'></td>\n";
}
else
{
foreach($beispiel_obj->beispiele as $row_bsp)
{
$studentbeispiel_obj = new beispiel($conn);
$studentbeispiel_obj->load_studentbeispiel($row_stud->uid, $row_bsp->beispiel_id);
echo "<td align='center'><input type='checkbox' name='update_".$row_stud->uid."_".$row_bsp->beispiel_id."' onClick=\"addUser('$row_stud->uid');\" ".($studentbeispiel_obj->vorbereitet?'checked':'').">".($studentbeispiel_obj->probleme?'<i><small>P</small></i>':'')."</td>\n";
}
}
echo "<td>&nbsp;</td>\n</tr>\n";
}
+31
View File
@@ -0,0 +1,31 @@
<?php
//Filenamen für up-/downloads bauen
// which kann sein angabe, abgabe oder zip
function makeUploadName($conn, $which, $lehreinheit_id=null, $uebung_id=null, $ss=null, $uid=null, $date=null)
{
$query = "SELECT tbl_studiengang.kurzbzlang, tbl_lehrfach.semester, tbl_lehrfach.kurzbz from public.tbl_studiengang, lehre.tbl_lehrfach, lehre.tbl_lehrveranstaltung, lehre.tbl_lehreinheit where tbl_lehreinheit.lehrfach_id = tbl_lehrfach.lehrfach_id and tbl_lehreinheit.lehrveranstaltung_id = tbl_lehrveranstaltung.lehrveranstaltung_id and tbl_lehrveranstaltung.studiengang_kz = tbl_studiengang.studiengang_kz and tbl_lehreinheit.lehreinheit_id = '".$lehreinheit_id."'";
$result = pg_query($conn, $query);
$row = pg_fetch_object($result);
$name = $row->kurzbzlang."_".$row->semester."_".$row->kurzbz."_".$ss;
if ($which == "angabe")
{
$name .= "_".$uebung_id;
}
else if ($which == "abgabe")
{
$query = "SELECT nachname, vorname from tbl_person, tbl_benutzer where tbl_benutzer.person_id = tbl_person.person_id and tbl_benutzer.uid = '".$uid."'";
$result = pg_query($conn, $query);
$row = pg_fetch_object($result);
$name .= "_".$uebung_id."_".$row->nachname."_".$row->vorname."_".$uid."_".$date;
}
else if ($which == "zip")
{
$name .= "_".$uebung_id."_".$date;
}
return $name;
}
?>
@@ -327,7 +327,8 @@ if($result_grp = pg_query($conn, $qry))
while($row_stud = pg_fetch_object($result_stud))
{
$studentnote = new studentnote($conn,$lehreinheit_id,$stsem,$row_stud->uid);
$studentnote = new studentnote($conn);
$studentnote->calc_gesamtnote($lehreinheit_id,$stsem,$row_stud->uid);
//echo $studentnote->debug;
$legesamtnote = new legesamtnote($conn, $lehreinheit_id);
@@ -375,7 +376,7 @@ if($result_grp = pg_query($conn, $qry))
}
echo "<form name='$row_stud->uid' method='POST' action='legesamtnoteverwalten.php?lvid=$lvid&lehreinheit_id=$lehreinheit_id&stsem=$stsem'><td><input type='hidden' name='student_uid' value='$row_stud->uid'><input type='text' size='1' value='$note_final' name='note'><input type='submit' name='submit' value='->'></td></form>";
echo "<td>$note</td>";
echo "<td align='center'>$note</td>";
echo "</tr>";
$i++;
}
@@ -33,6 +33,7 @@ require_once('../../../../include/studentnote.class.php');
require_once('../../../../include/datum.class.php');
require_once('../../../../include/legesamtnote.class.php');
require_once('../../../../include/lvgesamtnote.class.php');
require_once('../../../../include/zeugnisnote.class.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -252,6 +253,56 @@ if (isset($_REQUEST["submit"]) && ($_POST["student_uid"] != '')){
}
if (!$lvgesamtnote->save($new))
echo "<span class='error'>".$lvgesamtnote->errormsg."</span>";
}
// eingetragene lv-gesamtnoten freigeben
if (isset($_GET["freigabe"]) and ($_GET["freigabe"] == 1))
{
$jetzt = date("Y-m-d H:i:s");
$qry = "SELECT * FROM lehre.tbl_lehreinheitgruppe WHERE lehreinheit_id='$lehreinheit_id' ORDER BY semester, verband, gruppe, gruppe_kurzbz";
if($result_grp = pg_query($conn, $qry))
{
while($row_grp = pg_fetch_object($result_grp))
{
if($row_grp->gruppe_kurzbz!='')
{
$qry_stud = "SELECT uid, vorname, nachname, matrikelnr FROM campus.vw_student JOIN public.tbl_benutzergruppe USING(uid) WHERE gruppe_kurzbz='".addslashes($row_grp->gruppe_kurzbz)."' ORDER BY nachname, vorname";
}
else
{
$qry_stud = "SELECT uid, vorname, nachname, matrikelnr FROM campus.vw_student
WHERE studiengang_kz='$row_grp->studiengang_kz' AND
semester='$row_grp->semester' ".
($row_grp->verband!=''?" AND trim(verband)=trim('$row_grp->verband')":'').
($row_grp->gruppe!=''?" AND trim(gruppe)=trim('$row_grp->gruppe')":'').
" ORDER BY nachname, vorname";
}
if($result_stud = pg_query($conn, $qry_stud))
{
$i=1;
while($row_stud = pg_fetch_object($result_stud))
{
$lvgesamtnote = new lvgesamtnote($conn);
if ($lvgesamtnote->load($lvid,$row_stud->uid,$stsem))
{
if ($lvgesamtnote->benotungsdatum > $lvgesamtnote->freigabedatum)
{
$lvgesamtnote->freigabedatum = $jetzt;
$lvgesamtnote->save($new=null);
}
}
}
}
}
}
}
echo "<h3>LV Gesamtnote verwalten</h3>";
@@ -269,28 +320,21 @@ if($result_grp = pg_query($conn, $qry))
while($row_grp = pg_fetch_object($result_grp))
{
echo "<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan='8'>&nbsp;</td>
</tr>
<tr>
<td class='ContentHeader2'>UID</td>
<td class='ContentHeader2'>Nachname</td>
<td class='ContentHeader2'>Vorname</td>
<td class='ContentHeader2'>LE-Noten (LE-ID)</td>
<td class='ContentHeader2'></td>
<td class='ContentHeader2'>LV-Gesamtnote</td>
<td class='ContentHeader2'></td>
<td class='ContentHeader2'>LV-Note</td>
<td class='ContentHeader2'><a href='lvgesamtnoteverwalten.php?lvid=$lvid&lehreinheit_id=$lehreinheit_id&stsem=$stsem&freigabe=1'><input type='button' name='frei' value='Freigabe'></a></td>
<td class='ContentHeader2'>Zeugnisnote</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan='8'>&nbsp;</td>
</tr>";
if($row_grp->gruppe_kurzbz!='')
{
@@ -387,13 +431,32 @@ if($result_grp = pg_query($conn, $qry))
$note_vorschlag = round($note_le/$le_anz);
else
$note_vorschlag = null;
if ($zeugnisnote = new zeugnisnote($conn, $lvid, $row_stud->uid, $stsem))
$znote = $zeugnisnote->note;
else
$znote = null;
echo "<td>$note_les_str</td>";
echo "<form name='$row_stud->uid' method='POST' action='lvgesamtnoteverwalten.php?lvid=$lvid&lehreinheit_id=$lehreinheit_id&stsem=$stsem'><td><input type='hidden' name='student_uid' value='$row_stud->uid'><input type='text' size='1' value='$note_vorschlag' name='note'><input type='submit' name='submit' value='->'></td></form>";
echo "<td>$note_lv</td>";
echo "<td align='center'>$note_lv</td>";
//status
echo "<td align='center'>";
if (!$lvgesamtnote->freigabedatum)
echo "<img src='../../../../skin/images/offen.png'>";
else if ($lvgesamtnote->benotungsdatum > $lvgesamtnote->freigabedatum)
echo "<img src='../../../../skin/images/changed.png'>";
else
echo "<img src='../../../../skin/images/ok.png'>";
echo "</td>";
if (($znote) and ($note_lv != $znote))
$stylestr = " style='color:red; border-color:red; border-style:solid; border-width:1px;'";
else
$stylestr ="";
echo "<td".$stylestr." align='center'>".$znote."</td>";
echo "</tr>";
$i++;
}
File diff suppressed because it is too large Load Diff
@@ -30,36 +30,9 @@ require_once('../../../../include/benutzerberechtigung.class.php');
require_once('../../../../include/uebung.class.php');
require_once('../../../../include/beispiel.class.php');
require_once('../../../../include/studentnote.class.php');
require_once('../../../../include/datum.class.php');
?>
<!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-1">
<link href="../../../../skin/cis.css" rel="stylesheet" type="text/css">
<title>Kreuzerltool</title>
<script language="JavaScript">
<!--
function MM_jumpMenu(targ, selObj, restore)
{
eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
if(restore)
{
selObj.selectedIndex = 0;
}
}
function confirmdelete()
{
return confirm('Wollen Sie die markierten Einträge wirklich löschen? Alle bereits eingetragenen Kreuzerl gehen dabei verloren!!');
}
//-->
</script>
</head>
<body>
<?php
require_once('../../../../include/datum.class.php');
require_once('functions.inc.php');
if(!$conn = pg_pconnect(CONN_STRING))
die('Fehler beim oeffnen der Datenbankverbindung');
@@ -98,7 +71,51 @@ else
$datum_obj = new datum();
$uebung_id = (isset($_GET['uebung_id'])?$_GET['uebung_id']:'');
$uid = (isset($_GET['uid'])?$_GET['uid']:'');
$uid = (isset($_GET['uid'])?$_GET['uid']:'');
//Abgabedatei ausliefern
if (isset($_GET["download_abgabe"])){
$file=$_GET["download_abgabe"];
$uebung_id = $_GET["uebung_id"];
$ueb = new uebung($conn);
$ueb->load_studentuebung($uid, $uebung_id);
$ueb->load_abgabe($ueb->abgabe_id);
$filename = BENOTUNGSTOOL_PATH."abgabe/".$ueb->abgabedatei;
header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="'.$file.'"');
readfile($filename);
exit;
}
?>
<!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-1">
<link href="../../../../skin/cis.css" rel="stylesheet" type="text/css">
<title>Kreuzerltool</title>
<script language="JavaScript">
<!--
function MM_jumpMenu(targ, selObj, restore)
{
eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
if(restore)
{
selObj.selectedIndex = 0;
}
}
function confirmdelete()
{
return confirm('Wollen Sie die markierten Einträge wirklich löschen? Alle bereits eingetragenen Kreuzerl gehen dabei verloren!!');
}
//-->
</script>
</head>
<body>
<?php
//Kopfzeile
echo '<table class="tabcontent" height="100%">';
@@ -445,8 +462,8 @@ if(isset($_GET['uid']) && $_GET['uid']!='')
if ($ueb_obj->beispiele && is_numeric($_GET['uebung_id']))
{
$studentnote = new studentnote($conn,$lehreinheit_id,$stsem,$uid,$uebung_id);
echo "<span class='studentnote'>Note: ".$studentnote->note." (Gewicht: ".$ueb_obj->gewicht.")</span><br><br>";
//$studentnote = new studentnote($conn,$lehreinheit_id,$stsem,$uid,$uebung_id);
//echo "<span class='studentnote'>Note: ".$studentnote->note." (Gewicht: ".$ueb_obj->gewicht.")</span><br><br>";
echo "
<form method='POST' action='studentenpunkteverwalten.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&uebung_id=$uebung_id&uid=$uid'>
<table width='100%'><tr><td valign='top'>
@@ -604,10 +621,20 @@ if(isset($_GET['uid']) && $_GET['uid']!='')
}
else if (is_numeric($_GET['uebung_id']))
{
$ueb_obj->load_studentuebung($uid, $uebung_id);
if ($ueb_obj->abgabe_id)
{
$ueb_obj->load_abgabe($ueb_obj->abgabe_id);
$filename = $ueb_obj->abgabedatei;
}
else
$filename='';
//Abgaben benoten
$studentnote = new studentnote($conn,$lehreinheit_id,$stsem,$uid,$uebung_id);
$studentnote = new studentnote($conn,$lehreinheit_id,$stsem,$uid,$uebung_id);
$studentnote->calc_note($uebung_id, $uid);
echo "<span class='studentnote'>Note: ".$studentnote->note." (Gewicht: ".$ueb_obj->gewicht.")</span><br><br>";
if ($filename != '')
echo "Abgabedatei: <a href='studentenpunkteverwalten.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&uebung_id=$uebung_id&uid=$uid&download_abgabe=$filename'>".$filename."</a><br><br>";
echo "
<form method='POST' action='studentenpunkteverwalten.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&uebung_id=$uebung_id&uid=$uid'>
<table width='100%'><tr><td valign='top'>
@@ -633,6 +660,89 @@ if(isset($_GET['uid']) && $_GET['uid']!='')
}
else
{
//Übungen benoten
$uebung_obj = new uebung($conn);
$uebung_obj->load_uebung($lehreinheit_id,1);
if(count($uebung_obj->uebungen)>0)
{
echo "<table width='100%'><tr><td valign='top'>";
echo "<br>Aufgabe (Kreuzerllisten, Abgaben): <SELECT name='uebung' onChange=\"MM_jumpMenu('self',this,0)\">\n";
echo "<option value='studentenpunkteverwalten.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&uebung_id=&uid=$uid' selected></option>";
foreach ($uebung_obj->uebungen as $row)
{
if($uebung_id == $row->uebung_id)
$selected = 'selected';
else
$selected = '';
if($uebung_id=='')
$uebung_id=$row->uebung_id;
$subuebung_obj = new uebung($conn);
$subuebung_obj->load_uebung($lehreinheit_id,2,$row->uebung_id);
if(count($subuebung_obj->uebungen)>0)
{
$disabled = 'disabled';
$selected = '';
}
else
$disabled = '';
echo "<OPTION style='background-color:#cccccc;' value='studentenpunkteverwalten.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&uebung_id=$row->uebung_id&uid=$uid' $selected $disabled>";
echo $row->bezeichnung;
echo '</OPTION>';
if(count($subuebung_obj->uebungen)>0)
{
foreach ($subuebung_obj->uebungen as $subrow)
{
if($uebung_id=='')
$uebung_id=$subrow->uebung_id;
if($uebung_id == $subrow->uebung_id)
$selected = 'selected';
else
$selected = '';
echo "<OPTION value='studentenpunkteverwalten.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&uebung_id=$subrow->uebung_id&uid=$uid' $selected>";
//Freigegeben = +
//Nicht Freigegeben = -
if($datum_obj->mktime_fromtimestamp($subrow->freigabevon)<time() && $datum_obj->mktime_fromtimestamp($subrow->freigabebis)>time())
echo ' + ';
else
echo ' - ';
echo $subrow->bezeichnung;
echo '</OPTION>';
}
}
}
echo '</SELECT>';
echo "<a href='anwesenheitsliste.php?output=html&uebung_id=$uebung_id&gruppe=$lehreinheit_id' target='_blank'> [benoten]</a>";
$abgabe_obj = new uebung($conn, $uebung_id);
if ($abgabe_obj->abgabe && glob(BENOTUNGSTOOL_PATH."abgabe/*_[WS]S[0-9][0-9][0-9][0-9]_".$uebung_id."_*"))
{
$date = date('Y-m-d_H:i:s');
$downloadname = makeUploadName($conn, $which="zip", $lehreinheit_id, $uebung_id, $stsem, $uid=null, $date);
$downloadname = str_replace($uebung_id, ereg_replace(" ","_",$abgabe_obj->bezeichnung), $downloadname);
echo "<a href='zipdownload_benotungstool.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&uebung_id=$uebung_id&downloadname=$downloadname'> [Abgaben downloaden]</a>";
}
echo '</td></tr></table>';
}
echo "<br><hr><br>";
//Studentenliste
echo "Bitte w&auml;hlen Sie den Studenten aus.<br><br>";
echo "
@@ -29,7 +29,8 @@ require_once('../../../../include/lehreinheit.class.php');
require_once('../../../../include/benutzerberechtigung.class.php');
require_once('../../../../include/uebung.class.php');
require_once('../../../../include/beispiel.class.php');
require_once('../../../../include/datum.class.php');
require_once('../../../../include/datum.class.php');
require_once('functions.inc.php');
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
@@ -144,6 +145,7 @@ else
$beispiel_id = (isset($_GET['beispiel_id'])?$_GET['beispiel_id']:'');
$uebung_id = (isset($_GET['uebung_id'])?$_GET['uebung_id']:'');
/*
//Filenamen für up-/downloads bauen
// which kann sein angabe, abgabe oder zip
function makeUploadName($conn, $which, $lehreinheit_id=null, $uebung_id=null, $ss=null)
@@ -160,7 +162,7 @@ if ($which == "angabe")
return $name;
}
*/
//Angabedatei löschen
@@ -186,12 +188,12 @@ if (isset($_POST["schluessel"]) && $_POST["schluessel"]=='Speichern')
{
if (is_numeric($punkte_arr[$i]))
{
$qry = "select * from campus.tbl_notenschluesseluebung where uebung_id = '".$uebung_id."' and note = '".$i."'";
$qry = "select * from campus.tbl_notenschluesseluebung where uebung_id = '".$liste_id."' and note = '".$i."'";
$result = pg_query($conn, $qry);
if(pg_num_rows($result)>0)
$str = "update campus.tbl_notenschluesseluebung set punkte = '".$punkte_arr[$i]."' where uebung_id = '".$uebung_id."' and note = '".$i."'";
$str = "update campus.tbl_notenschluesseluebung set punkte = '".$punkte_arr[$i]."' where uebung_id = '".$liste_id."' and note = '".$i."'";
else
$str = "insert into campus.tbl_notenschluesseluebung (uebung_id, note, punkte) values ('".$uebung_id."','".$i."','".$punkte_arr[$i]."')";
$str = "insert into campus.tbl_notenschluesseluebung (uebung_id, note, punkte) values ('".$liste_id."','".$i."','".$punkte_arr[$i]."')";
if (!pg_query($conn, $str))
echo "<span class='error'>Daten konnten nicht gespeichert werden</span>";
}
@@ -342,8 +344,6 @@ if(isset($_POST['uebung_neu']) || isset($_POST['abgabe_neu']))
{
//pruefen ob alle Daten eingegeben wurden
$error=false;
$maxbsp = null;
$maxstd = null;
if($thema=='')
{
$error_thema.= "<span class='error'>Thema muss eingegeben werden</span>";
@@ -826,9 +826,11 @@ if(isset($_GET["uebung_id"]) && $_GET["uebung_id"]!='')
if ($uebung_obj->beispiele)
echo "<tr><td>Max. Studenten/Beispiel</td><td align='right'><input type='text' name='maxstd' value='$uebung_obj->maxstd'></td><td>$error_maxstd</td></tr>
<tr><td>Max. Beispiele/Student</td><td align='right'><input type='text' name='maxbsp' value='$uebung_obj->maxbsp'></td><td>$error_maxbsp</td></tr>";
echo "<tr><td>Gewicht</td><td align='right'><input type='text' size='16' name='gewicht' value='$uebung_obj->gewicht'></td><td>$error_gewicht</td></tr>";
echo"<tr><td>Positiv </td><td><input type='checkbox' name='positiv' ".($uebung_obj->positiv?'checked':'')."></td></tr>";
echo"<tr><td>Statistik f&uuml;r Studenten anzeigen </td><td><input type='checkbox' name='statistik' ".($uebung_obj->statistik?'checked':'')."></td></tr>";
//echo "<tr><td>Gewicht</td><td align='right'><input type='text' size='16' name='gewicht' value='$uebung_obj->gewicht'></td><td>$error_gewicht</td></tr>";
echo "<input type='hidden' size='16' name='gewicht' value='0'>";
//echo"<tr><td>Positiv </td><td><input type='checkbox' name='positiv' ".($uebung_obj->positiv?'checked':'')."></td></tr>";
if ($uebung_obj->beispiele)
echo"<tr><td>Statistik f&uuml;r Studenten anzeigen </td><td><input type='checkbox' name='statistik' ".($uebung_obj->statistik?'checked':'')."></td></tr>";
echo "<tr>";
echo "<td>Angabedatei</td>";
if ($uebung_obj->angabedatei != '')
@@ -861,7 +863,8 @@ if(isset($_GET["uebung_id"]) && $_GET["uebung_id"]!='')
echo "</table>
</form>";
/*
// notenschlüssel
$qry = "select * from campus.tbl_notenschluesseluebung where uebung_id = '$uebung_id' order by note";
if($result = pg_query($conn, $qry))
@@ -894,7 +897,8 @@ echo "<tr><td><input type='text' name='schluessel_note_5' maxlength='2' size='2'
echo "<tr><td align='right' colspan='2'><input type='submit' name='schluessel' value='Speichern'></td></tr>";
echo "</table>
</form>";
</form>";
*/
}
echo "</td></tr><tr><td valign='top'>";
@@ -1143,14 +1147,49 @@ else
<tr><td>Max. Beispiele/Student</td><td align='right'><input type='text' name='maxbsp' value='$maxbsp'></td><td>$error_maxbsp</td></tr>
<tr><td>Freigabe</td><td align='right'>von <input type='text' size='16' name='freigabevon' value='$freigabevon'></td><td>$error_freigabevon</td></tr>
<tr><td>(Format: 31.12.2007 14:30)</td><td align='right'>bis <input type='text' size='16' name='freigabebis' value='$freigabebis'></td><td>$error_freigabebis</td></tr>
<tr><td>Gewicht</td><td align='right'><input type='text' size='16' name='gewicht' value='$gewicht'></td><td>$error_gewicht</td></tr>
<tr><td>Positiv </td><td><input type='checkbox' name='positiv'></td></tr>
<input type='hidden' size='16' name='gewicht' value='0'>
<!--<tr><td>Positiv </td><td><input type='checkbox' name='positiv'></td></tr>-->
<tr><td>Statistik f&uuml;r Studenten anzeigen </td><td><input type='checkbox' name='statistik'></td></tr>
<tr><td>Angabedatei</td><td><input type='file' name='angabedatei'></td></tr>
<tr><td colspan=2 align='right'><input type='submit' name='uebung_neu' value='Anlegen'></td></tr>
</table>
</form>
";
";
// notenschlüssel
$qry = "select * from campus.tbl_notenschluesseluebung where uebung_id = '$liste_id' order by note";
if($result = pg_query($conn, $qry))
{
$notenschluessel = array();
$notenschluessel[1] = '';
$notenschluessel[2] = '';
$notenschluessel[3] = '';
$notenschluessel[4] = '';
$notenschluessel[5] = '';
if(pg_num_rows($result)>=1)
{
while($schluesselrow = pg_fetch_object($result))
{
$notenschluessel[$schluesselrow->note] = $schluesselrow->punkte;
}
}
}
echo "<form action='verwaltung_listen.php?lvid=$lvid&stsem=$stsem&lehreinheit_id=$lehreinheit_id&liste_id=$liste_id' method=POST>\n";
echo "<table width='340'><tr><td colspan='3' class='ContentHeader3'>Notenschlüssel definieren</td></tr>\n";
echo "<tr><td>&nbsp;</td><td></td></tr>\n\n";
echo "<tr><td>Note</td><td>Mindestpunkte</td></tr>";
echo "<tr><td><input type='text' name='schluessel_note_1' maxlength='2' size='2' value='1'></td><td><input type='text' size='2' name='schluessel_punkte_1' value='$notenschluessel[1]'></td></tr>";
echo "<tr><td><input type='text' name='schluessel_note_2' maxlength='2' size='2' value='2'></td><td><input type='text' size='2' name='schluessel_punkte_2' value='$notenschluessel[2]'></td></tr>";
echo "<tr><td><input type='text' name='schluessel_note_3' maxlength='2' size='2' value='3'></td><td><input type='text' size='2' name='schluessel_punkte_3' value='$notenschluessel[3]'></td></tr>";
echo "<tr><td><input type='text' name='schluessel_note_4' maxlength='2' size='2' value='4'></td><td><input type='text' size='2' name='schluessel_punkte_4' value='$notenschluessel[4]'></td></tr>";
echo "<tr><td><input type='text' name='schluessel_note_5' maxlength='2' size='2' value='5'></td><td><input type='text' size='2' name='schluessel_punkte_5' value='$notenschluessel[5]'></td></tr>";
echo "<tr><td align='right' colspan='2'><input type='submit' name='schluessel' value='Speichern'></td></tr>";
echo "</table>
</form>";
}
if(!isset($_POST['uebung_neu']))
$thema = "Abgabe ".($anzahl<9?'0'.($anzahl+1):($anzahl+1));
@@ -1166,7 +1205,7 @@ else
<tr><td>(Format: 31.12.2007 14:30)</td><td align='right'>bis <input type='text' size='16' name='freigabebis' value='$freigabebis'></td><td>$error_freigabebis</td></tr>
<tr><td>Gewicht</td><td align='right'><input type='text' size='16' name='gewicht' value='$gewicht'></td><td>$error_gewicht</td></tr>
<tr><td>Positiv </td><td><input type='checkbox' name='positiv'></td></tr>
<tr><td>Statistik f&uuml;r Studenten anzeigen </td><td><input type='checkbox' name='statistik'></td></tr>
<!--<tr><td>Statistik f&uuml;r Studenten anzeigen </td><td><input type='checkbox' name='statistik'></td></tr>-->
<tr><td>Angabedatei</td><td><input type='file' name='angabedatei'></td></tr>
<tr><td colspan=2 align='right'><input type='submit' name='abgabe_neu' value='Anlegen'></td></tr>
</table>
@@ -0,0 +1,85 @@
<?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>.
*/
/**
* Erstellt ein Zip Archiv des Download-Bereichs und leitet dann zum Download weiter
* @create 20-03-2006
* Aufruf: zipdownload.php?stg=255&sem=1$short=eng
*/
require_once('../../../config.inc.php');
require_once('../../../../include/functions.inc.php');
//Connection zur DB herstellen
if(!$conn = pg_pconnect(CONN_STRING))
{
die('Fehler beim herstellen der DB Verbindung');
}
$user = get_uid();
//Gueltigkeit der Parameter pruefen
if(!isset($_GET['uebung_id']) || !is_numeric($_GET['uebung_id']))
{
die('Fehler bei der Parameteruebergabe');
}
if(!isset($_GET['lehreinheit_id']) || !is_numeric($_GET['lehreinheit_id']))
{
die('Fehler bei der Parameteruebergabe');
}
if(!isset($_GET['stsem']))
{
die('Fehler bei der Parameteruebergabe');
}
if(!isset($_GET['downloadname']))
{
die('Fehler bei der Parameteruebergabe');
}
$uebung_id = $_GET['uebung_id'];
$lehreinheit_id = $_GET['lehreinheit_id'];
$stsem = $_GET['stsem'];
$downloadname = $_GET['downloadname'];
//Pfade bauen
$pfad = BENOTUNGSTOOL_PATH.'abgabe/';
$filename = 'download_'.$user.'_'.$downloadname.'.zip';
//Pfad wechseln
chdir($pfad);
//File loeschen falls es existiert
//if(file_exists("download_".$user."*"))
exec("rm download_".$user."*");
//Zip File erstellen
exec("zip -r ".$filename." *_[WS]S[0-9][0-9][0-9][0-9]_".$uebung_id."_*");
//Auf Zip File Verweisen
//header("Location: $pfad$filename");
header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="'.$filename.'"');
readfile($filename);
unlink($filename);
+28
View File
@@ -362,7 +362,35 @@ class beispiel
return false;
}
}
function check_anzahl_studentbeispiel($beispiel_id)
{
if(!is_numeric($beispiel_id))
{
$this->errormsg = 'Beispiel_id muss eine gueltige Zahl sein';
return false;
}
$qry = "SELECT count(*) as anzahl FROM campus.tbl_studentbeispiel WHERE vorbereitet = true and beispiel_id='$beispiel_id'";
if($result = pg_query($this->conn, $qry))
{
if($row = pg_fetch_object($result))
{
$this->anzahl_studentbeispiel = $row->anzahl;
return true;
}
else
{
$this->errormsg = 'Fehler beim laden der Anzahl der Einträge in Student_Beispiel';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim laden der Anzahl der Einträge in Student_Beispiel';
return false;
}
}
// **
// * Prueft die studentbeispiel Daten auf gueltigkeit
// *
+3 -2
View File
@@ -200,7 +200,8 @@ class lvgesamtnote
$this->addslashes($this->student_uid).', '.
$this->addslashes($this->studiensemester_kurzbz).', '.
$this->addslashes($this->mitarbeiter_uid).', '.
$this->addslashes($this->note).', now(), '.
$this->addslashes($this->note).', '.
$this->addslashes($this->freigabedatum).', '.
$this->addslashes($this->benotungsdatum).', '.
$this->addslashes($this->bemerkung).', '.
$this->addslashes($this->updateamum).', '.
@@ -212,7 +213,7 @@ class lvgesamtnote
{
$qry='UPDATE campus.tbl_lvgesamtnote SET '.
'note='.$this->addslashes($this->note).', '.
'freigabedatum=now(), '.
'freigabedatum='.$this->addslashes($this->freigabedatum).', '.
'benotungsdatum='.$this->addslashes($this->benotungsdatum).', '.
'bemerkung='.$this->addslashes($this->bemerkung).', '.
'mitarbeiter_uid='.$this->addslashes($this->mitarbeiter_uid).', '.
+185 -77
View File
@@ -44,7 +44,7 @@ class studentnote
// * $unicode Gibt an ob die Daten mit UNICODE Codierung
// * oder LATIN9 Codierung verarbeitet werden sollen
// *************************************************************************
function studentnote($conn, $lehreinheit_id=null, $ss=null, $student_uid=null, $uebung_id=null, $unicode=false)
function studentnote($conn, $unicode=false)
{
$this->conn = $conn;
@@ -59,12 +59,54 @@ class studentnote
return false;
}
if($uebung_id)
}
function calc_gesamtnote($lehreinheit_id, $ss, $student_uid)
{
{
$this->calc_note($uebung_id, $student_uid);
$conn = $this->conn;
$studentgesamtnote = 0;
$counter = 0;
$gewichte = 0;
$negativ_all = false;
$note_x_gewicht = 0;
$note_x_gewicht_l1 = 0;
$gewichte_l1 = 0;
$fehlt_all = false;
$beispiele = false;
$ueb1_obj = new uebung($conn);
$ueb1_obj->load_uebung($lehreinheit_id,1);
foreach($ueb1_obj->uebungen as $ueb1)
{
$this->calc_l1_note($ueb1->uebung_id, $student_uid, $lehreinheit_id);
$note_x_gewicht_l1 += ($this->l1_note * $this->l1_gewicht);
$gewichte_l1 += $this->l1_gewicht;
if ($this->negativ)
$negativ_all = $this->negativ;
if ($this->fehlt)
$fehlt_all = $this->fehlt;
}
if ($gewichte_l1 > 0)
{
$this->studentgesamtnote = ($note_x_gewicht_l1 / $gewichte_l1);
$this->negativ = $negativ_all;
$this->fehlt = $fehlt_all;
}
else
{
$this->studentgesamtnote = "n";
$this->negativ = $negativ_all;
$this->fehlt = $fehlt_all;
}
}
else
}
function calc_l1_note($uebung_id, $student_uid, $lehreinheit_id)
{
{
$conn = $this->conn;
$studentgesamtnote = 0;
$counter = 0;
$gewichte = 0;
@@ -72,74 +114,129 @@ class studentnote
$note_x_gewicht = 0;
$note_x_gewicht_l1 = 0;
$gewichte_l1 = 0;
$fehlt = false;
$fehlt = false;
$beispiele = false;
$punkte_gesamt = 0;
$punkte_mitarbeit = 0;
$punkte_eingetragen = 0;
$l1_gewicht = 0;
$ueb1 = new uebung($conn, $uebung_id);
$ueb1_obj = new uebung($conn);
$ueb1_obj->load_uebung($lehreinheit_id,1);
foreach($ueb1_obj->uebungen as $ueb1)
{
$ueb_obj = new uebung($conn);
//if ($ueb_obj->load_uebung($lehreinheit_id, 2, $ueb1->uebung_id))
$ueb_obj->load_uebung($lehreinheit_id, 2, $ueb1->uebung_id);
if ($ueb_obj->uebungen)
$ueb_obj = new uebung($conn);
$ueb_obj->load_uebung($lehreinheit_id, 2, $uebung_id);
if ($ueb_obj->uebungen)
{
$note_x_gewicht = 0;
$gewichte = 0;
$punkte_gesamt = 0;
foreach ($ueb_obj->uebungen as $ueb)
{
$note_x_gewicht = 0;
$gewichte = 0;
foreach ($ueb_obj->uebungen as $ueb)
{
if ($this->calc_note($ueb->uebung_id,$student_uid))
if ($ueb->abgabe)
{
if ($this->calc_note($ueb->uebung_id, $student_uid))
{
if (is_numeric($this->note))
{
if ($ueb->positiv && $this->note == 5)
$negativ = true;
$negativ = true;
$note_x_gewicht += ($this->note * $this->gewicht);
$gewichte += $this->gewicht;
}
else
$fehlt = true;
}
}
if ($gewichte > 0)
{
$note_x_gewicht_l1 += ($note_x_gewicht / $gewichte);
$gewichte_l1 += $ueb1->gewicht;
}
}
// keine kreuzerllisten/abgaben
else
{
$s = new uebung($conn);
$s->load_studentuebung($student_uid, $ueb1->uebung_id);
if ($s->note && $ueb1->gewicht)
{
if ($s->note == 5 && $ueb1->positiv)
$negativ = true;
$note_x_gewicht_l1 += ($s->note * $ueb1->gewicht);
$gewichte_l1 += $ueb1->gewicht;
{
$fehlt = true;
if ($ueb->positiv)
$negativ = true;
}
}
}
else
$fehlt = true;
{
$this->calc_punkte($ueb->uebung_id, $student_uid);
$punkte_gesamt += $this->punkte_gesamt;
$punkte_mitarbeit += $this->punkte_mitarbeit;
$punkte_eingetragen += $this->punkte_eingetragen;
$beispiele = true;
}
}
if ($gewichte > 0)
{
$l1_note = ($note_x_gewicht / $gewichte);
$l1_gewicht = $ueb1->gewicht;
}
//if ($punkte_gesamt > 0)
if ($beispiele)
{
$qry = "SELECT min(note) as note from campus.tbl_notenschluesseluebung where punkte <= '".$punkte_gesamt."' and uebung_id = '".$ueb1->uebung_id."'";
if($result=pg_query($this->conn, $qry))
{
if($row = pg_fetch_object($result))
$note = $row->note;
else
$note = 5;
}
if ($ueb1->positiv && ($note == 5))
$negativ = true;
$l1_note = ($note * $ueb1->gewicht);
$l1_gewicht = $ueb1->gewicht;
}
if ($ueb1->positiv && $beispiele && ($punkte_gesamt == 0))
$negativ = true;
//else if ($beispiele && ($punkte_gesamt == 0))
// $felt = true;
}
// keine kreuzerllisten/abgaben
else
{
$s = new uebung($conn);
$s->load_studentuebung($student_uid, $ueb1->uebung_id);
if ($s->note && $ueb1->gewicht)
{
if ($s->note == 5 && $ueb1->positiv)
$negativ = true;
$l1_note= $s->note;
$l1_gewicht = $ueb1->gewicht;
}
else
{
$fehlt = true;
if ($ueb1->positiv)
$negativ = true;
}
}
if ($gewichte_l1 > 0)
{
$this->studentgesamtnote = ($note_x_gewicht_l1 / $gewichte_l1);
if ($l1_gewicht > 0)
{
$this->l1_note = $l1_note;
$this->l1_gewicht = $l1_gewicht;
$this->negativ = $negativ;
$this->fehlt = $fehlt;
$this->punkte_gesamt_l1 = $punkte_gesamt;
$this->punkte_eingetragen_l1 = $punkte_eingetragen;
$this->punkte_mitarbeit_l1 = $punkte_mitarbeit;
}
else
{
$this->studentgesamtnote = "n";
$this->l1_note = null;
$this->l1_gewicht = 0;
$this->negativ = $negativ;
$this->fehlt = $fehlt;
$this->punkte_gesamt_l1 = null;
$this->punkte_eingetragen_l1 = null;
$this->punkte_mitarbeit_l1 = null;
}
}
}
}
// *********************************************************
// * berechnet die gesamtnote der übung
// * @param uebung_id, student_uid
// * berechnet die note der übung
// * @param uebung_id, student_uid
// * setzt this->note, this->gewicht
// *********************************************************
function calc_note($uebung_id, $student_uid)
{
@@ -156,8 +253,42 @@ class studentnote
$mitarbeit = 0;
$ueb = new uebung($this->conn);
$ueb->load($uebung_id);
if ($ueb->beispiele)
{
if($ueb->load_studentuebung($student_uid, $uebung_id))
{
$this->note = $ueb->note;
$this->gewicht = $ueb->gewicht;
return true;
}
else
{
$this->note = null;
$this->gewicht = 0;
return true;
}
}
}
// *********************************************************
// * berechnet die punkte der übung (kreuzerlliste)
// * @param uebung_id, student_uid
// * setzt this->punkte_gesamt
// *********************************************************
function calc_punkte($uebung_id, $student_uid)
{
if(!is_numeric($uebung_id))
{
$this->errormsg='Uebung_id muss eine gueltige Zahl sein';
return false;
}
else
{
$note = null;
$punkte_eingetragen = 0;
$punkte_gesamt = 0;
$mitarbeit = 0;
$ueb = new uebung($this->conn);
//Eingetragen diese Kreuzerlliste
$qry = "SELECT sum(punkte) as punkteeingetragen FROM campus.tbl_beispiel JOIN campus.tbl_studentbeispiel USING(beispiel_id) WHERE uebung_id='$uebung_id' AND student_uid='$student_uid' AND vorbereitet=true";
$punkte_eingetragen=0;
@@ -171,35 +302,12 @@ class studentnote
$punkte_gesamt = $punkte_eingetragen + $mitarbeit;
$qry = "SELECT min(note) as note from campus.tbl_notenschluesseluebung where punkte <= '".$punkte_gesamt."' and uebung_id = '".$uebung_id."'";
if($result=pg_query($this->conn, $qry))
if($row = pg_fetch_object($result))
$note = $row->note;
else
$note = 5;
$this->note = $note;
$this->gewicht = $ueb->gewicht;
$this->punkte_gesamt = $punkte_gesamt;
$this->punkte_eingetragen = $punkte_eingetragen;
$this->punkte_mitarbeit = $mitarbeit;
return true;
}
else
{
if($ueb->load_studentuebung($student_uid, $uebung_id))
{
$this->note = $ueb->note;
$this->gewicht = $ueb->gewicht;
return true;
}
else
{
$this->note = null;
return true;
}
}
}
}
}
}
?>
+135 -3
View File
@@ -57,7 +57,13 @@ class uebung
var $note; // smalint
var $mitarbeitspunkte; // smalint
var $anmerkung; // text
var $benotungsdatum; // timestamp
var $benotungsdatum; // timestamp
//Abgabe
var $abgabe_abgabe_id; // integer
var $abgabedatei; // varchar(64)
var $abgabezeit; // timestamp
var $abgabe_anmerkung; // text
// *************************************************************************
// * Konstruktor - Uebergibt die Connection und laedt optional eine Uebung
@@ -173,6 +179,33 @@ class uebung
return false;
}
}
function load_abgabe($abgabe_id)
{
$qry = "SELECT * FROM campus.tbl_abgabe WHERE abgabe_id = '$abgabe_id'";
if($result = pg_query($this->conn, $qry))
{
if($row = pg_fetch_object($result))
{
$this->abgabe_id = $row->abgabe_id;
$this->abgabedatei = $row->abgabedatei;
$this->abgabezeit = $row->abgabezeit;
$this->anmerkung = $row->anmerkung;
return true;
}
else
{
$this->errormsg = 'Es gibt keinen passenden Eintrag';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden des Eintrages';
return false;
}
}
function check_studentuebung($uebung_id)
{
@@ -186,9 +219,9 @@ class uebung
return false;
}
else
return false;
return false;
}
function load_uebung($lehreinheit_id, $level=null, $uebung_id=null)
{
@@ -457,6 +490,67 @@ class uebung
return false;
}
}
function abgabe_save($new=null)
{
if(is_null($new))
$new = $this->new;
if($new)
{
$qry = 'INSERT INTO campus.tbl_abgabe(abgabedatei, abgabezeit, anmerkung) VALUES('.
$this->addslashes($this->abgabedatei).','.
$this->addslashes($this->abgabezeit).','.
$this->addslashes($this->abgabe_anmerkung).');';
}
else
{
$qry = 'UPDATE campus.tbl_abgabe SET'.
' abgabe_id='.$this->addslashes($this->abgabe_id).','.
' abgabedatei='.$this->addslashes($this->abgabedatei).','.
' abgabezeit='.$this->addslashes($this->abgabezeit).','.
' anmerkung='.$this->addslashes($this->abgabe_anmerkung).
" WHERE abgabe_id=".$this->addslashes($this->abgabe_id).";";
}
if(pg_query($this->conn,$qry))
{
if($new)
{
$qry = "SELECT currval('campus.tbl_abgabe_abgabe_id_seq') as id;";
if($result = pg_query($this->conn, $qry))
{
if($row=pg_fetch_object($result))
{
$this->abgabe_id = $row->id;
pg_query($this->conn, 'COMMIT');
return true;
}
else
{
$this->errormsg = 'Fehler beim Auslesen der Sequence';
pg_query($this->conn,'ROLLBACK');
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Auslesen der Sequence';
pg_query($this->conn,'ROLLBACK');
return false;
}
}
else
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern der StudentUebung';
return false;
}
}
// ************************************************************
// * Loescht eine Uebung plus die abhaengigen eintraege in den
@@ -521,5 +615,43 @@ class uebung
}
// ************************************************************
// * Loescht eine Uebung plus die abhaengigen eintraege in den
// * Tabellen studentuebung, studentbeispiel, und beispiel
// ************************************************************
function delete_abgabe($abgabe_id)
{
if(!is_numeric($abgabe_id))
{
$this->errormsg = 'abgabe_id ist ungueltig';
return false;
}
// subübungen wegräumen
$qry = "SELECT * FROM campus.tbl_abgabe WHERE abgabe_id = '".$abgabe_id."'";
if($result=pg_query($this->conn, $qry))
{
while($row = pg_fetch_object($result))
{
if(file_exists(BENOTUNGSTOOL_PATH."abgabe/".$row->abgabedatei))
unlink(BENOTUNGSTOOL_PATH."abgabe/".$row->abgabedatei);
$qry = "UPDATE campus.tbl_studentuebung set abgabe_id = null where abgabe_id = '$abgabe_id';
DELETE FROM campus.tbl_abgabe WHERE abgabe_id = '$abgabe_id'";
if(!pg_query($qry))
{
$this->errormsg = 'Fehler beim Loeschen der Daten';
return false;
}
else
return true;
}
}
}
}