/**
  * Book object - either of type or specific - for given dates
  */
 function confirmedBookingObject()
 {
     global $tpl;
     $success = false;
     if ($this->object->getScheduleType() == ilObjBookingPool::TYPE_NO_SCHEDULE) {
         if ($_POST['object_id']) {
             $this->processBooking($_POST['object_id']);
             $success = $_POST['object_id'];
         }
     } else {
         if (!isset($_POST['date'])) {
             ilUtil::sendFailure($this->lng->txt('select_one'));
             return $this->bookObject();
         }
         // single object reservation(s)
         if (isset($_GET['object_id'])) {
             foreach ($_POST['date'] as $date) {
                 $fromto = explode('_', $date);
                 $fromto[1]--;
                 $object_id = (int) $_GET['object_id'];
                 if ($object_id) {
                     $this->processBooking($object_id, $fromto[0], $fromto[1]);
                     $success = $object_id;
                 }
             }
         }
         /*
         // group object reservation(s)
         else
         {				
         	include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
         	include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';											
         	$all_object_ids = array();
         	foreach(ilBookingObject::getList((int)$_GET['type_id']) as $item)
         	{
         		$all_object_ids[] = $item['booking_object_id'];
         	}
         
         	$possible_objects = $counter = array();	
         	sort($_POST['date']);			
         	foreach($_POST['date'] as $date)
         	{
         		$fromto = explode('_', $date);
         		$fromto[1]--;
         		$possible_objects[$date] = ilBookingReservation::getAvailableObject($all_object_ids, $fromto[0], $fromto[1], false);		
         		foreach($possible_objects[$date] as $obj_id)
         		{
         			$counter[$obj_id]++;
         		}
         	}
         
         	if(max($counter))
         	{			
         		// we prefer the objects which are available for most slots
         		arsort($counter);
         		$counter = array_keys($counter);
         
         		// book each slot
         		foreach($possible_objects as $date => $available_ids)
         		{
         			$fromto = explode('_', $date);
         			$fromto[1]--;
         
         			// find "best" object for slot
         			foreach($counter as $best_object_id)
         			{
         				if(in_array($best_object_id, $available_ids))
         				{
         					$object_id = $best_object_id;
         					break;
         				}
         			}				
         			$this->processBooking($object_id, $fromto[0], $fromto[1]);
         			$success = true;	
         		}
         	}
         }			 
         */
     }
     if ($success) {
         ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
         // show post booking information?
         include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
         $obj = new ilBookingObject($success);
         $pfile = $obj->getPostFile();
         $ptext = $obj->getPostText();
         if (trim($ptext) || $pfile) {
             $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $obj->getId());
             $this->ctrl->redirectByClass('ilbookingobjectgui', 'displayPostInfo');
         } else {
             $this->ctrl->redirect($this, 'render');
         }
     } else {
         ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
         $this->ctrl->redirect($this, 'book');
     }
 }
 public function deliverPostFile()
 {
     global $ilUser;
     $id = (int) $_GET["object_id"];
     if (!$id) {
         return;
     }
     include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
     $book_id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
     $obj = new ilBookingReservation($book_id);
     if ($obj->getUserId() != $ilUser->getId()) {
         return;
     }
     include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
     $obj = new ilBookingObject($id);
     $file = $obj->getPostFileFullPath();
     if ($file) {
         ilUtil::deliverFile($file, $obj->getPostFile());
     }
 }
 protected function handleBookingSuccess($a_obj_id)
 {
     ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
     // show post booking information?
     include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
     $obj = new ilBookingObject($a_obj_id);
     $pfile = $obj->getPostFile();
     $ptext = $obj->getPostText();
     if (trim($ptext) || $pfile) {
         $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $obj->getId());
         $this->ctrl->redirectByClass('ilbookingobjectgui', 'displayPostInfo');
     } else {
         $this->ctrl->redirect($this, 'render');
     }
 }