diff --git a/cis/private/lehre/benotungstool/legesamtnoteeintragen.php b/cis/private/lehre/benotungstool/legesamtnoteeintragen.php index 7dbfdef52..5a7bc8beb 100755 --- a/cis/private/lehre/benotungstool/legesamtnoteeintragen.php +++ b/cis/private/lehre/benotungstool/legesamtnoteeintragen.php @@ -16,8 +16,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Authors: Christian Paminger , - * Andreas Oesterreicher and - * Rudolf Hangl . + * Andreas Oesterreicher , + * Rudolf Hangl and + * Andreas Moik . */ 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; diff --git a/cis/private/lehre/benotungstool/legesamtnoteverwalten.php b/cis/private/lehre/benotungstool/legesamtnoteverwalten.php index 0e6a0951f..59b4d4f55 100644 --- a/cis/private/lehre/benotungstool/legesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/legesamtnoteverwalten.php @@ -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 "X"; else echo "ok"; - echo ""; + echo ""; 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 "$note"; + $negmarkier = ""; + echo "$note"; echo ""; $i++; } diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index 5d7ffe558..425d5331b 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -16,9 +16,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Authors: Christian Paminger , - * Andreas Oesterreicher and - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > + * Andreas Oesterreicher , + * Rudolf Hangl < rudolf.hangl@technikum-wien.at >, + * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > and + * Andreas Moik . */ 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.")"; } diff --git a/cis/private/lehre/benotungstool/studentenansicht.php b/cis/private/lehre/benotungstool/studentenansicht.php index f2735c58d..5c7910e88 100644 --- a/cis/private/lehre/benotungstool/studentenansicht.php +++ b/cis/private/lehre/benotungstool/studentenansicht.php @@ -1157,9 +1157,11 @@ else echo ""; $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; } diff --git a/include/legesamtnote.class.php b/include/legesamtnote.class.php index e01136f83..a3de0dbc5 100755 --- a/include/legesamtnote.class.php +++ b/include/legesamtnote.class.php @@ -1,203 +1,209 @@ -, - * Andreas Oesterreicher and - * Rudolf Hangl . - */ -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; - } - } - -} -?> \ No newline at end of file +, + * Andreas Oesterreicher , + * Rudolf Hangl and + * Andreas Moik . + */ +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; + } + } + +} +?>