changed campus.tbl_legesamtnote for eine_uid

This commit is contained in:
Andreas Moik
2016-03-30 16:35:20 +02:00
parent 6006cfd424
commit 683a881fe7
5 changed files with 245 additions and 227 deletions
@@ -16,8 +16,9 @@
* 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>.
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
* Rudolf Hangl <rudolf.hangl@technikum-wien.at> and
* Andreas Moik <moik@technikum-wien.at>.
*/
require_once('../../../../config/cis.config.inc.php');
@@ -93,11 +94,15 @@ $note = $_REQUEST["note"];
if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') && ((($note>0) && ($note < 6)) || ($note == 7) || ($note==8) || ($note==16)) ){
$jetzt = date("Y-m-d H:i:s");
$student_uid = $_REQUEST["student_uid"];
$student_uid = $_REQUEST["student_uid"];
if(!$student = new student($user))
die("Der Student wurde nicht gefunden!");
$legesamtnote = new legesamtnote($lehreinheit_id);
if (!$legesamtnote->load($student_uid,$lehreinheit_id))
{
$legesamtnote->student_uid = $student_uid;
if (!$legesamtnote->load($student->prestudent_id,$lehreinheit_id))
{
$legesamtnote->prestudent_id = $prestudent_id;
$legesamtnote->lehreinheit_id = $lehreinheit_id;
$legesamtnote->note = $_REQUEST["note"];
$legesamtnote->benotungsdatum = $jetzt;
@@ -329,9 +329,13 @@ if (isset($_REQUEST["submit"]) && ($_POST["student_uid"] != '')){
$jetzt = date("Y-m-d H:i:s");
$student_uid = $_POST["student_uid"];
$legesamtnote = new legesamtnote($lehreinheit_id);
if (!$legesamtnote->load($student_uid,$lehreinheit_id))
{
$legesamtnote->student_uid = $student_uid;
if(!$student = new student($student_uid))
die($p->t('benotungstool/studentWurdeNichtGefunden'));
if (!$legesamtnote->load($student->prestudent_id,$lehreinheit_id))
{
$legesamtnote->prestudent_id = $prestudent_id;
$legesamtnote->lehreinheit_id = $lehreinheit_id;
$legesamtnote->note = $_POST["note"];
$legesamtnote->benotungsdatum = $jetzt;
@@ -340,9 +344,9 @@ if (isset($_REQUEST["submit"]) && ($_POST["student_uid"] != '')){
$legesamtnote->insertamum = $jetzt;
$legesamtnote->insertvon = $user;
$legesamtnote->new = true;
}
else
{
}
else
{
$legesamtnote->note = $_POST["note"];
$legesamtnote->benotungsdatum = $jetzt;
$legesamtnote->updateamum = $jetzt;
@@ -427,8 +431,8 @@ if($result_stud = $db->db_query($qry_stud))
$studentnote->calc_gesamtnote($lehreinheit_id,$stsem,$row_stud->prestudent_id);
//echo $studentnote->debug;
$legesamtnote = new legesamtnote($lehreinheit_id);
if (!$legesamtnote->load($row_stud->uid,$lehreinheit_id))
{
if (!$legesamtnote->load($row_stud->prestudent_id,$lehreinheit_id))
{
$note = null;
}
else
@@ -455,11 +459,11 @@ if($result_stud = $db->db_query($qry_stud))
echo "<span class='negativ'>X</span>";
else
echo "ok";
echo "</td>";
echo "</td>";
if ($note)
$note_final = $note;
else
{
{
if ($studentnote->negativ)
$note_final = 5;
else
@@ -473,8 +477,8 @@ if($result_stud = $db->db_query($qry_stud))
if ($note == 5)
$negmarkier = " style='color:red; font-weight:bold;'";
else
$negmarkier = "";
echo "<td align='center' id='note_$row_stud->uid'><span".$negmarkier.">$note</span></td>";
$negmarkier = "";
echo "<td align='center' id='note_$row_stud->uid'><span".$negmarkier.">$note</span></td>";
echo "</tr>";
$i++;
}
@@ -16,9 +16,10 @@
* 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 >
* Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at >
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
* Rudolf Hangl < rudolf.hangl@technikum-wien.at >,
* Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > and
* Andreas Moik <moik@technikum-wien.at >.
*/
require_once('../../../../config/cis.config.inc.php');
require_once('../../../../config/global.config.inc.php');
@@ -1026,7 +1027,7 @@ echo "
{
$legesamtnote = new legesamtnote($l->lehreinheit_id);
if (!$legesamtnote->load($row_stud->uid,$l->lehreinheit_id))
if (!$legesamtnote->load($row_stud->prestudent_id,$l->lehreinheit_id))
{
//$note_les_str .= "- (".$l->lehreinheit_id.")";
}
@@ -1157,9 +1157,11 @@ else
echo "</td><td valign='top'>";
$legesamtnote = new legesamtnote($lehreinheit_id);
$student = new student();
if (!$legesamtnote->load($user, $lehreinheit_id))
if(!$student = new student($user))
die($p->t('benotungstool/studentWurdeNichtGefunden'));
if (!$legesamtnote->load($student->prestudent_id, $lehreinheit_id))
{
$lenote = null;
}
+209 -203
View File
@@ -1,203 +1,209 @@
<?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>.
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
class legesamtnote extends basis_db
{
public $new;
public $legesamtnoten = array();
//Tabellenspalten
public $student_uid; // varchar(16)
public $lehreinheit_id; // int
public $note; // smallint
public $benotungsdatum; //date
public $updateamum; // timestamp
public $updatevon; // varchar(16)
public $insertamum; // timestamp
public $insertvon; // varchar(16)
/**
* Konstruktor - Laedt optional eine LEGesamtNote
* @param $uebung_id
*/
public function __construct($student_uid=null, $lehreinheit_id=null)
{
parent::__construct();
if(!is_null($student_uid))
$this->load($student_uid, $lehreinheit_id);
}
/**
* Laedt die legesamtnote
* @param student_uid, lehreinheit_id
*/
public function load($student_uid, $lehreinheit_id)
{
if(!is_numeric($lehreinheit_id))
{
$this->errormsg='lehreinheit_id muss eine gueltige Zahl sein';
return false;
}
$qry = "SELECT * FROM campus.tbl_legesamtnote
WHERE student_uid = ".$this->db_add_param($student_uid)." AND lehreinheit_id = ".$this->db_add_param($lehreinheit_id, FHC_INTEGER).';';
if($this->db_query($qry))
{
if($row = $this->db_fetch_object())
{
$this->lehreinheit_id = $row->lehreinheit_id;
$this->student_uid = $row->student_uid;
$this->note = $row->note;
$this->benotungsdatum = $row->benotungsdatum;
$this->updateamum = $row->updateamum;
$this->updatevon = $row->updatevon;
$this->insertamum = $row->insertamum;
$this->insertvon = $row->insertvon;
return true;
}
else
{
$this->errormsg = "Es ist keine legesamtnote mit der fuer diesen studenten vorhanden";
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der LEGesamtNote';
return false;
}
}
/**
* Ledt die LEGesamtnoten einer Lehreinheit
*
* @param $lehreinheit_id
* @return boolean
*/
public function load_legesamtnote($lehreinheit_id)
{
if(!is_numeric($lehreinheit_id))
{
$this->errormsg = 'Lehreinheit_id muss eine gueltige Zahl sein';
return false;
}
$qry = "SELECT * FROM campus.tbl_legesamtnote WHERE lehreinheit_id=".$this->db_add_param($lehreinheit_id, FHC_INTEGER)." ORDER BY student_uid;";
if($this->db_query($qry))
{
while($row = $this->db_fetch_object())
{
$legesamtnote_obj = new legesamtnote();
$legesamtnote_obj->student_uid = $row->student_uid;
$legesamtnote_obj->note = $row->note;
$legesamtnote_obj->lehreinheit_id = $row->lehreinheit_id;
$legesamtnote_obj->benotungsdatum = $row->benotungsdatum;
$legesamtnote_obj->updateamum = $row->updateamum;
$legesamtnote_obj->updatevon = $row->updatevon;
$legesamtnote_obj->insertamum = $row->insertamum;
$legesamtnote_obj->insertvon = $row->insertvon;
$this->legesamtnoten[] = $legesamtnote_obj;
}
return true;
}
else
{
$this->errormsg = 'Fehler beim Laden der legesamtnoten';
return false;
}
}
/**
* Prueft die Variablen vor dem Speichern
* auf Gueltigkeit.
* @return true wenn ok, false im Fehlerfall
*/
protected function validate()
{
if(!is_numeric($this->lehreinheit_id))
{
$this->errormsg = 'Lehreinheit_id muss eine gueltige Zahl sein';
return false;
}
if(!is_numeric($this->note))
{
$this->errormsg = 'Note muss eine gueltige Zahl sein';
return false;
}
return true;
}
/**
* Speichert Uebung in die Datenbank
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall
*/
public function save()
{
//Variablen auf Gueltigkeit pruefen
if(!$this->validate())
return false;
if($this->new)
{
$qry = 'INSERT INTO campus.tbl_legesamtnote(student_uid, lehreinheit_id, note, benotungsdatum, updateamum, updatevon, insertamum, insertvon) VALUES('.
$this->db_add_param($this->student_uid).','.
$this->db_add_param($this->lehreinheit_id, FHC_INTEGER).','.
$this->db_add_param($this->note, FHC_INTEGER).','.
$this->db_add_param($this->benotungsdatum).','.
'null,'.
'null,'.
$this->db_add_param($this->insertamum).','.
$this->db_add_param($this->insertvon).');';
}
else
{
$qry = 'UPDATE campus.tbl_legesamtnote SET'.
' student_uid='.$this->db_add_param($this->student_uid).','.
' lehreinheit_id ='.$this->db_add_param($this->lehreinheit_id, FHC_INTEGER).','.
' note='.$this->db_add_param($this->note, FHC_INTEGER).','.
' benotungsdatum='.$this->db_add_param($this->benotungsdatum).','.
' updateamum='.$this->db_add_param($this->updateamum).','.
' updatevon='.$this->db_add_param($this->updatevon).
" WHERE lehreinheit_id=".$this->db_add_param($this->lehreinheit_id, FHC_INTEGER)." AND student_uid = ".$this->db_add_param($this->student_uid).";";
}
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern der legesamtnote:'.$qry;
return false;
}
}
}
?>
<?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>,
* Rudolf Hangl <rudolf.hangl@technikum-wien.at> and
* Andreas Moik <moik@technikum-wien.at>.
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
class legesamtnote extends basis_db
{
public $new;
public $legesamtnoten = array();
//Tabellenspalten
public $prestudent_id; // integer
public $lehreinheit_id; // int
public $note; // smallint
public $benotungsdatum; //date
public $updateamum; // timestamp
public $updatevon; // varchar(16)
public $insertamum; // timestamp
public $insertvon; // varchar(16)
/**
* Konstruktor - Laedt optional eine LEGesamtNote
* @param $uebung_id
*/
public function __construct($prestudent_id=null, $lehreinheit_id=null)
{
parent::__construct();
if(is_numeric($prestudent_id))
$this->load($prestudent_id, $lehreinheit_id);
}
/**
* Laedt die legesamtnote
* @param prestudent_id, lehreinheit_id
*/
public function load($prestudent_id, $lehreinheit_id)
{
if(!is_numeric($lehreinheit_id))
{
$this->errormsg='lehreinheit_id muss eine gueltige Zahl sein';
return false;
}
if(!is_numeric($prestudent_id))
{
$this->errormsg='Prestudent_id muss eine gueltige Zahl sein';
return false;
}
$qry = "SELECT * FROM campus.tbl_legesamtnote
WHERE prestudent_id = ".$this->db_add_param($prestudent_id, FHC_INTEGER)." AND lehreinheit_id = ".$this->db_add_param($lehreinheit_id, FHC_INTEGER).';';
if($this->db_query($qry))
{
if($row = $this->db_fetch_object())
{
$this->lehreinheit_id = $row->lehreinheit_id;
$this->prestudent_id = $row->prestudent_id;
$this->note = $row->note;
$this->benotungsdatum = $row->benotungsdatum;
$this->updateamum = $row->updateamum;
$this->updatevon = $row->updatevon;
$this->insertamum = $row->insertamum;
$this->insertvon = $row->insertvon;
return true;
}
else
{
$this->errormsg = "Es ist keine legesamtnote mit der fuer diesen studenten vorhanden";
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der LEGesamtNote';
return false;
}
}
/**
* Ledt die LEGesamtnoten einer Lehreinheit
*
* @param $lehreinheit_id
* @return boolean
*/
public function load_legesamtnote($lehreinheit_id)
{
if(!is_numeric($lehreinheit_id))
{
$this->errormsg = 'Lehreinheit_id muss eine gueltige Zahl sein';
return false;
}
$qry = "SELECT * FROM campus.tbl_legesamtnote WHERE lehreinheit_id=".$this->db_add_param($lehreinheit_id, FHC_INTEGER)." ORDER BY prestudent_id;";
if($this->db_query($qry))
{
while($row = $this->db_fetch_object())
{
$legesamtnote_obj = new legesamtnote();
$legesamtnote_obj->prestudent_id = $row->prestudent_id;
$legesamtnote_obj->note = $row->note;
$legesamtnote_obj->lehreinheit_id = $row->lehreinheit_id;
$legesamtnote_obj->benotungsdatum = $row->benotungsdatum;
$legesamtnote_obj->updateamum = $row->updateamum;
$legesamtnote_obj->updatevon = $row->updatevon;
$legesamtnote_obj->insertamum = $row->insertamum;
$legesamtnote_obj->insertvon = $row->insertvon;
$this->legesamtnoten[] = $legesamtnote_obj;
}
return true;
}
else
{
$this->errormsg = 'Fehler beim Laden der legesamtnoten';
return false;
}
}
/**
* Prueft die Variablen vor dem Speichern
* auf Gueltigkeit.
* @return true wenn ok, false im Fehlerfall
*/
protected function validate()
{
if(!is_numeric($this->lehreinheit_id))
{
$this->errormsg = 'Lehreinheit_id muss eine gueltige Zahl sein';
return false;
}
if(!is_numeric($this->note))
{
$this->errormsg = 'Note muss eine gueltige Zahl sein';
return false;
}
return true;
}
/**
* Speichert Uebung in die Datenbank
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall
*/
public function save()
{
//Variablen auf Gueltigkeit pruefen
if(!$this->validate())
return false;
if($this->new)
{
$qry = 'INSERT INTO campus.tbl_legesamtnote(prestudent_id, lehreinheit_id, note, benotungsdatum, updateamum, updatevon, insertamum, insertvon) VALUES('.
$this->db_add_param($this->prestudent_id).','.
$this->db_add_param($this->lehreinheit_id, FHC_INTEGER).','.
$this->db_add_param($this->note, FHC_INTEGER).','.
$this->db_add_param($this->benotungsdatum).','.
'null,'.
'null,'.
$this->db_add_param($this->insertamum).','.
$this->db_add_param($this->insertvon).');';
}
else
{
$qry = 'UPDATE campus.tbl_legesamtnote SET'.
' prestudent_id='.$this->db_add_param($this->prestudent_id).','.
' lehreinheit_id ='.$this->db_add_param($this->lehreinheit_id, FHC_INTEGER).','.
' note='.$this->db_add_param($this->note, FHC_INTEGER).','.
' benotungsdatum='.$this->db_add_param($this->benotungsdatum).','.
' updateamum='.$this->db_add_param($this->updateamum).','.
' updatevon='.$this->db_add_param($this->updatevon).
" WHERE lehreinheit_id=".$this->db_add_param($this->lehreinheit_id, FHC_INTEGER)." AND prestudent_id = ".$this->db_add_param($this->prestudent_id).";";
}
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern der legesamtnote:'.$qry;
return false;
}
}
}
?>