Пример #1
0
 public function getFachNoten($schueler_id, $fach_id)
 {
     $sql = "SELECT n.note_id AS note_id, \n\t\t\t\tn.schueler_id AS schueler_id, \n\t\t\t\tn.typ AS typ, \n\t\t\t\tn.punkte AS punkte,\n\t\t\t\tu.unterrichtsstunde_id AS unterrichtsstunde_id\n\t\t\t\tFROM note n, unterrichtsstunde u\n\t\t\t\tWHERE u.unterrichtsstunde_id=n.unterrichtsstunde_id\n\t\t\t\tAND n.schueler_id=" . $schueler_id . " \n\t\t\t\tAND u.fach_id=" . $fach_id . ";";
     try {
         $result = mysql_query($sql);
         if (!$result) {
             throw new MysqlException();
         }
         $noten = array();
         while ($row = mysql_fetch_assoc($result)) {
             $n = new Note();
             $n->setId($row['note_id']);
             $n->setSchueler_id($row['schueler_id']);
             $n->setTyp($row['typ']);
             $n->setPunkte($row['punkte']);
             $n->setUnterrichtsstunde_id($row['unterrichtsstunde_id']);
             $noten[$n->getId()] = $n;
         }
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     return $noten;
 }
 function lookup($id, $tid = 0, $type = 'N')
 {
     return $id && is_numeric($id) && ($n = new Note($id, $tid)) && $n->getId() == $id ? $n : null;
 }