示例#1
0
 function termin($template)
 {
     $dbuser = new User();
     if (isREQUEST("logout")) {
         $dbuser->logout();
     }
     if (isREQUEST("user") && isREQUEST("password")) {
         $usr = $dbuser->logout()->login(REQUEST("user"), REQUEST("password"));
     }
     if (!($usr = $dbuser->logedin())) {
         $template->view("login");
         return;
     }
     $template->add("usr", $usr);
     // für die User Infos oben Rechts
     if (isREQUEST(array("name", "desc"))) {
         // Termin erstellen
         $t = new Termin();
         $id = $t->create(REQUEST("name"), REQUEST("desc"), $usr["id"]);
         //$template->add("termin",$t->byid($t));
         //$template->add("mitglieder",$t->mitglieder($t));
         //$template->view("termin");
         $template->redirect("?s=termin&id=" . $id);
         $template->view("termin_neu");
     } else {
         if (GET("id")) {
             // Termin aufrufen
             $t = new Termin();
             $tbid = $t->byid(GET("id"));
             if (!isset($tbid) || !isset($tbid["id"])) {
                 $template->redirect(".");
                 $template->view("termin_neu");
                 return;
             }
             $template->add("termin", $tbid);
             $template->add("zeiten", $t->zeiten($tbid["tid"]));
             $template->add("votes", $t->votes($tbid["tid"]));
             $template->add("mitglieder", $t->mitglieder($tbid["tid"]));
             $template->view("termin");
         } else {
             // Neuer Termin
             $template->view("termin_neu");
         }
     }
 }