<?php

switch ($what) {
    case 'klasse':
        if (key_exists('update', $_POST)) {
            // alle aktiven updaten
            foreach ($_POST as $key => $value) {
                if (substr($key, 0, 6) == 'klasse') {
                    $klasse_id = substr($key, 6);
                    $k = new Klasse();
                    $k->load($klasse_id);
                    $k->setName($_POST[$key]);
                    $k->save();
                }
            }
        } else {
            // aus †bergabevariablen zu deaktivierende klasse_id bestimmen
            foreach ($_POST as $key => $value) {
                if (substr($key, 0, 7) === 'deaktiv') {
                    $klasse_id = substr($key, 7);
                }
            }
            $k = new Klasse();
            $k->load($klasse_id);
            $k->setAktiv("FALSE");
            $k->save();
        }
        $action = 'show';
        $what = 'registerklasse';
        include 'controller/show.php';
        break;
Esempio n. 2
0
             $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';
     $what = 'registerklasse';
     include 'controller/show.php';
     break;
 case 'news':
     $title = $_POST['new_news_title'];
     $text = $_POST['new_news_create'];
     $n = new News();
     $n->setTitle($title);
     $n->setTextfield($text);
     $n->save();
     $action = 'show';
     $what = 'news';