Beispiel #1
0
 function sendRegistration()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.userselector.php';
     $id_course = importVar('id_course', true, 0);
     $id_event = importVar('id_event', true, 0);
     $lang =& DoceboLanguage::CreateInstance('reservation');
     $out =& $GLOBALS['page'];
     $man_res = new Man_Reservation();
     $id_category = $man_res->getEventCategory($id_event);
     $user_select = new UserSelector();
     $user_subscribed = array();
     $user_subscribed = $man_res->getSubscribedUserIdst($id_event);
     $user_selected = array();
     $user_selected = $user_select->getSelection($_POST);
     $wrong_result = false;
     $user_deleted = array_diff($user_subscribed, $user_selected);
     foreach ($user_deleted as $del) {
         $result = $man_res->delSubscription($del, $id_event);
         if (!$result) {
             $wrong_result = true;
         }
     }
     foreach ($user_selected as $user) {
         if ($man_res->controlMaxSubscriptionForCategory($id_category, $user)) {
             $result = $man_res->addSubscription($user, $id_event);
             if (!$result) {
                 $wrong_result = true;
             }
         } else {
             $wrong_result = true;
         }
     }
     if ($wrong_result) {
         Util::jump_to('index.php?modname=reservation&op=reservation&active_tab=subscribed_user&error=insert');
     }
     Util::jump_to('index.php?modname=reservation&op=reservation&active_tab=subscribed_user');
 }