if (count($user_infos) == 0) {
     $u = new User();
     $u->setLogin($nick);
     $u->setPasswd($pw1);
     $u->setAktiv(TRUE);
     $u->setEmail($mail);
     $u->setGeburtstag($bday);
     $u->save();
     if ($typ == 1) {
         //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';
Example #2
0
 public function getAllAsObject($restriction = '')
 {
     $sql = "SELECT * \n\t\t\t      FROM schueler \n\t\t\t     WHERE 1=1 ";
     $sql .= $restriction . " ";
     $sql .= " ORDER BY nachname;";
     try {
         $result = mysql_query($sql);
         if (!$result) {
             throw new MysqlException();
         }
         $schuelers = array();
         while ($row = mysql_fetch_assoc($result)) {
             $s = new Schueler();
             $s->setId($row['schueler_id']);
             $s->setVorname($row['vorname']);
             $s->setNachname($row['nachname']);
             $s->setUser_id($row['user_id']);
             $s->setAktiv($row['aktiv']);
             $s->setKlasse_id($row['klasse_id']);
             $s->setBeschreibung($row['beschreibung']);
             $schuelers[$s->getId()] = $s;
         }
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     return $schuelers;
 }