Example #1
0
 private function handleEditPost()
 {
     $request = Request::getInstance();
     $values = $request->getRequest(Request::POST);
     try {
         if (!$request->exists('id')) {
             throw new Exception('Reservation is missing.');
         }
         $id = intval($request->getValue('id'));
         $key = array('id' => $id);
         $this->update($key, $values);
         $key = array('grp_id' => $id);
         $user = $this->director->systemUser;
         $usr_used = $request->getValue('usr_used');
         if (!$usr_used) {
             $usr_used = array();
         }
         $userLink = new ReservationUserLink();
         // remove users from group
         $userLink->delete($key);
         foreach ($usr_used as $item) {
             $key['usr_id'] = $item;
             $userLink->insert($key);
         }
         viewManager::getInstance()->setType(Reservation::VIEW_USER_GROUP_OVERVIEW);
         $this->handleOverview();
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
         $this->handleEditGet(false);
     }
 }