} } else { echo '<h3>No file has been selected.</h3>'; } $action = 'show'; $what = 'raum'; include 'controller/show.php'; break; case 'raum': $raum = $_POST['raum']; $r = new Raum(); $r->setName($raum); $r->setAktiv(TRUE); $r->save(); $action = 'show'; $what = 'raum'; include 'controller/show.php'; break; case 'fach': $fach = $_POST['fach']; $f = new Fach(); $f->setName($fach); $f->setAktiv(TRUE); $f->save(); $action = 'show'; $what = 'fach'; include 'controller/show.php'; break; default: break; }
$k->setAktiv("FALSE"); $k->save(); } $action = 'show'; $what = 'registerklasse'; include 'controller/show.php'; break; case 'fach': if (key_exists('update', $_POST)) { // alle aktiven updaten foreach ($_POST as $key => $value) { if (substr($key, 0, 4) == 'fach') { $fach_id = substr($key, 4); $f = new Fach(); $f->load($fach_id); $f->setName($_POST[$key]); $f->save(); } } } else { // aus †bergabevariablen zu deaktivierende klasse_id bestimmen foreach ($_POST as $key => $value) { if (substr($key, 0, 7) === 'deaktiv') { $fach_id = substr($key, 7); } } $f = new Fach(); $f->load($fach_id); $f->setAktiv("FALSE"); $f->save(); }
public function getAllAsObject($restriction = '') { $sql = "SELECT *\n\t\t\t FROM fach \n\t\t\t WHERE 1=1 "; $sql .= $restriction . ";"; try { $result = mysql_query($sql); if (!$result) { throw new MysqlException(); } $fachs = array(); while ($row = mysql_fetch_assoc($result)) { $f = new Fach(); $f->setId($row['fach_id']); $f->setName($row['name']); $f->setAktiv($row['aktiv']); $fachs[$f->getId()] = $f; } } catch (MysqlException $e) { Html::showAll($e); } return $fachs; }