Пример #1
0
             //Schueler
             $s = new Schueler();
             $s->setVorname($vname);
             $s->setNachname($nname);
             $s->setKlasse_id($klasse[0]);
             $s->setUser_id($u->getId());
             $s->setAktiv(TRUE);
             $s->save();
         } elseif ($typ == 2) {
             //Lehrer
             $l = new Lehrer();
             $l->setVorname($vname);
             $l->setNachname($nname);
             $l->setKlasse_ids($klasse);
             $l->setUser_id($u->getId());
             $l->setAktiv(TRUE);
             $l->save();
         }
         $user_infos[] = $vname . ' ' . $nname . ' erfolgreich registriert';
     }
     $action = 'show';
     $what = 'registeruser';
     include 'controller/show.php';
     break;
 case 'klasse':
     $klasse = $_POST['klasse'];
     $k = new Klasse();
     $k->setName($klasse);
     $k->setAktiv(TRUE);
     $k->save();
     $action = 'show';
 public function getAllAsObject($restriction = '')
 {
     $sql = "SELECT * \n\t\t\t      FROM lehrer \n\t\t\t     WHERE 1=1 ";
     $sql .= $restriction . ";";
     try {
         $result = mysql_query($sql);
         if (!$result) {
             throw new MysqlException();
         }
         $lehrers = array();
         while ($row = mysql_fetch_assoc($result)) {
             $l = new Lehrer();
             $l->setId($row['lehrer_id']);
             $l->setUser_id($row['user_id']);
             $l->setVorname($row['vorname']);
             $l->setNachname($row['nachname']);
             $l->setAktiv($row['aktiv']);
             $lehrers[$l->getId()] = $l;
         }
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     return $lehrers;
 }