4require_once 
"./Services/Object/classes/class.ilObjectGUI.php";
 
   23        function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = 
true)
 
   26                $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
 
   27                $this->lng->loadLanguageModule(
"book");
 
   35                global 
$tpl, $ilTabs, $ilNavigationHistory, 
$ilUser;
 
   37                $next_class = $this->ctrl->getNextClass($this);
 
   38                $cmd = $this->ctrl->getCmd();
 
   40                if(!$next_class && 
$cmd == 
'render')
 
   42                        if(
$ilUser->getId() != ANONYMOUS_USER_ID)
 
   44                                $this->ctrl->setCmdClass(
'ilBookingObjectGUI');
 
   45                                $next_class = $this->ctrl->getNextClass($this);
 
   49                                $this->ctrl->redirect($this, 
"infoscreen");
 
   53                if(substr(
$cmd, 0, 4) == 
'book')
 
   58                $ilNavigationHistory->addItem($this->ref_id,
 
   59                                "./goto.php?target=book_".$this->ref_id, 
"book");
 
   65                        case 'ilpermissiongui':
 
   66                                $this->tabs_gui->setTabActive(
'perm_settings');
 
   67                                include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
 
   69                                $ret =& $this->ctrl->forwardCommand($perm_gui);
 
   72                        case 'ilbookingobjectgui':
 
   73                                $this->tabs_gui->setTabActive(
'render');
 
   74                                include_once(
"Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
 
   76                                $ret =& $this->ctrl->forwardCommand($object_gui);
 
   79                        case 'ilbookingschedulegui':
 
   80                                $this->tabs_gui->setTabActive(
'schedules');
 
   81                                include_once(
"Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
 
   83                                $ret =& $this->ctrl->forwardCommand($schedule_gui);
 
   86                        case 'ilpublicuserprofilegui':
 
   87                                $ilTabs->clearTargets();
 
   88                                include_once(
"Services/User/classes/class.ilPublicUserProfileGUI.php");
 
   90                                $profile->setBackUrl($this->ctrl->getLinkTarget($this, 
'log'));
 
   91                                $ret = $this->ctrl->forwardCommand($profile);
 
   95                        case 'ilinfoscreengui':
 
   99                        case "ilcommonactiondispatchergui":
 
  100                                include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
 
  102                                $this->ctrl->forwardCommand($gui);
 
  105                        case "ilobjectcopygui":
 
  106                                include_once 
"./Services/Object/classes/class.ilObjectCopyGUI.php";
 
  108                                $cp->setType(
"book");
 
  109                                $this->ctrl->forwardCommand($cp);
 
  112                        case 'ilobjectmetadatagui';
 
  114                                $this->tabs_gui->setTabActive(
'meta_data');
 
  115                                include_once 
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
 
  117                                $this->ctrl->forwardCommand($md_gui);
 
  121                                $cmd = $this->ctrl->getCmd();
 
  133                $forms = parent::initCreationForms($a_new_type);
 
  134                unset($forms[self::CFORM_IMPORT]);              
 
  141                $a_new_object->setOffline(
true);
 
  146                $this->ctrl->setParameter($this, 
"ref_id", $a_new_object->
getRefId());
 
  147                $this->ctrl->redirect($this, 
"edit");
 
  153                include_once 
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
 
  160                return parent::editObject();
 
  169                $type->setRequired(
true);
 
  173                include_once 
"Modules/BookingManager/classes/class.ilBookingObject.php";
 
  176                        $type->setDisabled(
true);
 
  180                $fixed->setInfo($this->lng->txt(
"book_schedule_type_fixed_info"));
 
  181                $type->addOption($fixed);
 
  184                $none->setInfo($this->lng->txt(
"book_schedule_type_none_info"));
 
  185                $type->addOption($none);
 
  187                $limit = 
new ilNumberInputGUI($this->lng->txt(
"book_overall_limit"), 
"limit");
 
  189                $limit->setMinValue(1);
 
  190                $limit->setInfo($this->lng->txt(
"book_overall_limit_info"));
 
  191                $none->addSubItem($limit);
 
  194                $public->setInfo($this->lng->txt(
"book_public_log_info"));
 
  199                $feat->setTitle($this->lng->txt(
'obj_features'));
 
  206                $a_values[
"online"] = !$this->
object->isOffline();
 
  207                $a_values[
"public"] = $this->
object->hasPublicLog();
 
  208                $a_values[
"stype"] = $this->
object->getScheduleType();
 
  209                $a_values[
"limit"] = $this->
object->getOverallLimit();          
 
  214                $this->
object->setOffline(!$a_form->
getInput(
'online'));
 
  215                $this->
object->setPublicLog($a_form->
getInput(
'public'));
 
  216                $this->
object->setScheduleType($a_form->
getInput(
'stype'));
 
  217                $this->
object->setOverallLimit($a_form->
getInput(
'limit') ? $a_form->
getInput(
'limit') : 
null);
 
  219                include_once 
'./Services/Container/classes/class.ilContainer.php';
 
  220                include_once 
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
 
  222                        $this->object->getId(),
 
  230                include_once 
'./Services/Container/classes/class.ilContainer.php';
 
  231                include_once 
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
 
  233                                $this->object->getId(),
 
  244                global $ilAccess, $ilHelp, 
$ilUser;
 
  246                if (in_array($this->ctrl->getCmd(), array(
"create", 
"save")) && !$this->ctrl->getNextClass())
 
  251                $ilHelp->setScreenIdComponent(
"book");
 
  253                if ($ilAccess->checkAccess(
'read', 
'', $this->object->getRefId()))
 
  255                        if(
$ilUser->getId() != ANONYMOUS_USER_ID)
 
  257                                $this->tabs_gui->addTab(
"render",
 
  258                                                $this->lng->txt(
"book_booking_types"),
 
  259                                                $this->ctrl->getLinkTarget($this, 
"render"));
 
  262                        $this->tabs_gui->addTab(
"info",
 
  263                                        $this->lng->txt(
"info_short"),
 
  264                                        $this->ctrl->getLinkTarget($this, 
"infoscreen"));
 
  266                        if(
$ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog())
 
  268                                $this->tabs_gui->addTab(
"log",
 
  269                                        $this->lng->txt(
"book_log"),
 
  270                                        $this->ctrl->getLinkTarget($this, 
"log"));              
 
  274                if ($ilAccess->checkAccess(
'write', 
'', $this->object->getRefId()))
 
  278                                $this->tabs_gui->addTab(
"schedules",
 
  279                                        $this->lng->txt(
"book_schedules"),
 
  280                                        $this->ctrl->getLinkTargetByClass(
"ilbookingschedulegui", 
"render"));
 
  283                        $this->tabs_gui->addTab(
"settings",
 
  284                                $this->lng->txt(
"settings"),
 
  285                                $this->ctrl->getLinkTarget($this, 
"edit"));
 
  288                        include_once 
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
 
  290                        $mdtab = $mdgui->getTab();
 
  293                                $this->tabs_gui->addTarget(
"meta_data",
 
  296                                                                         "ilobjectmetadatagui");
 
  300                if($ilAccess->checkAccess(
'edit_permission', 
'', $this->object->getRefId()))
 
  302                        $this->tabs_gui->addTab(
"perm_settings",
 
  303                                $this->lng->txt(
"perm_settings"),
 
  304                                $this->ctrl->getLinkTargetByClass(
"ilpermissiongui", 
"perm"));
 
  316                $ilHelp->setScreenIdComponent(
'book');
 
  317                $ilHelp->setScreenId(
'object'.$object_subtype);
 
  318                $ilHelp->setSubScreenId($a_id);
 
  328                $this->tabs_gui->clearTargets();
 
  329                $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this, 
'render'));
 
  333                include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
  336                $this->lng->loadLanguageModule(
"dateplaner");
 
  337                $this->ctrl->setParameter($this, 
'object_id', $obj->getId());
 
  341                        include_once 
'Modules/BookingManager/classes/class.ilBookingSchedule.php';              
 
  344                        $tpl->setContent($this->
renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
 
  348                        include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  350                        $cgui->setHeaderText($this->lng->txt(
"book_confirm_booking_no_schedule"));
 
  352                        $cgui->setFormAction($this->ctrl->getFormAction($this));
 
  353                        $cgui->setCancel($this->lng->txt(
"cancel"), 
"render");
 
  354                        $cgui->setConfirm($this->lng->txt(
"confirm"), 
"confirmedBooking");
 
  356                        $cgui->addItem(
"object_id", $obj->getId(), $obj->getTitle());           
 
  358                        $tpl->setContent($cgui->getHTML());
 
  369                        $mytpl = 
new ilTemplate(
'tpl.booking_reservation_fix.html', 
true, 
true, 
'Modules/BookingManager');
 
  371                        $mytpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this));
 
  372                        $mytpl->setVariable(
'TXT_TITLE', $this->lng->txt(
'book_reservation_title'));
 
  373                        $mytpl->setVariable(
'TXT_INFO', $this->lng->txt(
'book_reservation_fix_info'));
 
  374                        $mytpl->setVariable(
'TXT_OBJECT', $title);
 
  375                        $mytpl->setVariable(
'TXT_CMD_BOOK', $this->lng->txt(
'book_confirm_booking'));
 
  376                        $mytpl->setVariable(
'TXT_CMD_CANCEL', $this->lng->txt(
'cancel'));
 
  378                        include_once 
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
 
  382                        $morning_aggr = $user_settings->getDayStart();
 
  383                        $evening_aggr = $user_settings->getDayEnd();
 
  385                        for($i = $morning_aggr;$i <= $evening_aggr;$i++)
 
  387                                switch($user_settings->getTimeFormat())
 
  390                                                if ($morning_aggr > 0 && $i == $morning_aggr)
 
  392                                                        $hours[$i] = sprintf(
'%02d:00',0).
"-";
 
  394                                                $hours[$i].= sprintf(
'%02d:00',$i);
 
  395                                                if ($evening_aggr < 23 && $i == $evening_aggr)
 
  397                                                        $hours[$i].= 
"-".sprintf(
'%02d:00',23);
 
  402                                                if ($morning_aggr > 0 && $i == $morning_aggr)
 
  404                                                        $hours[$i] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
 
  406                                                $hours[$i].= date(
'h a',mktime($i,0,0,1,1,2000));
 
  407                                                if ($evening_aggr < 23 && $i == $evening_aggr)
 
  409                                                        $hours[$i].= 
"-".date(
'h a',mktime(23,0,0,1,1,2000));
 
  415                        if(isset(
$_GET[
'seed']))
 
  417                                $find_first_open = 
false;
 
  422                                $find_first_open = 
true;
 
  423                                $seed = isset(
$_GET[
'sseed']) 
 
  428                        include_once 
'Services/Calendar/classes/class.ilCalendarUtil.php';
 
  429                        include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';                   
 
  430                        $week_start = $user_settings->getWeekStart();
 
  432                        if(!$find_first_open)
 
  440                                $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
 
  446                                        $limit = clone($seed);
 
  450                                        while(!$has_open_slot && $seed->get(
IL_CAL_UNIX) < $limit)
 
  455                                                $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
 
  460                        include_once 
'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
 
  462                        $mytpl->setVariable(
'NAVIGATION', $navigation->getHTML());
 
  468                                $mytpl->setCurrentBlock(
'weekdays');
 
  471                                $mytpl->parseCurrentBlock();
 
  474                        include_once 
'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
 
  475                        include_once 
'Services/Calendar/classes/class.ilCalendarUtil.php';
 
  478                        for($loop = 0; $loop < 7; $loop++)
 
  482                                $color[$loop+1] = 
'border-bottom: 1px solid '.$col.
'; background-color: '.$col.
'; color: '.$fnt;
 
  486                        foreach($dates as $hour => $days)
 
  489                                $caption = array_shift($caption);
 
  491                                for($loop = 1; $loop < 8; $loop++)
 
  493                                        if(!isset($days[$loop]))
 
  495                                                $mytpl->setCurrentBlock(
'dates');
 
  496                                                $mytpl->setVariable(
'DUMMY', 
' ');
 
  497                                                $mytpl->parseCurrentBlock();
 
  501                                                if(isset($days[$loop][
'captions']))
 
  503                                                        foreach($days[$loop][
'captions'] as $slot_id => $slot_caption)
 
  505                                                                $mytpl->setCurrentBlock(
'choice');
 
  506                                                                $mytpl->setVariable(
'TXT_DATE', $slot_caption);
 
  507                                                                $mytpl->setVariable(
'VALUE_DATE', $slot_id);
 
  508                                                                $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
 
  509                                                                $mytpl->setVariable(
'TXT_AVAILABLE', 
 
  510                                                                        sprintf($this->lng->txt(
'book_reservation_available'), 
 
  511                                                                        $days[$loop][
'available'][$slot_id]));
 
  512                                                                $mytpl->parseCurrentBlock();
 
  515                                                        $mytpl->setCurrentBlock(
'dates');
 
  516                                                        $mytpl->setVariable(
'DUMMY', 
'');
 
  517                                                        $mytpl->parseCurrentBlock();
 
  519                                                else if(isset($days[$loop][
'in_slot']))
 
  521                                                        $mytpl->setCurrentBlock(
'dates');
 
  522                                                        $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
 
  523                                                        $mytpl->parseCurrentBlock();
 
  527                                                        $mytpl->setCurrentBlock(
'dates');
 
  528                                                        $mytpl->setVariable(
'DUMMY', 
' ');
 
  529                                                        $mytpl->parseCurrentBlock();
 
  534                                $mytpl->setCurrentBlock(
'slots');
 
  535                                $mytpl->setVariable(
'TXT_HOUR', $caption);
 
  538                                        $mytpl->setVariable(
'CSS_ROW', 
'tblrow1');
 
  542                                        $mytpl->setVariable(
'CSS_ROW', 
'tblrow2');
 
  544                                $mytpl->parseCurrentBlock();
 
  555                return $mytpl->get();
 
  558        protected function buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
 
  562                include_once 
'Services/Calendar/classes/class.ilCalendarUserSettings.php';                      
 
  565                $map = array(
'mo', 
'tu', 
'we', 
'th', 
'fr', 
'sa', 
'su');
 
  566                $definition = $schedule->getDefinition();
 
  568                $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
 
  569                        ? $schedule->getAvailabilityFrom()->get(
IL_CAL_DATE)
 
  571                $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
 
  575                $has_open_slot = 
false;
 
  584                                if($av_from > $today ||
 
  592                        if(isset($definition[$map[$date_info[
'isoday']-1]]))
 
  595                                foreach($definition[$map[$date_info[
'isoday']-1]] as $slot)
 
  597                                        $slot = explode(
'-', $slot);
 
  598                                        $slots[] = array(
'from'=>str_replace(
':', 
'', $slot[0]),
 
  599                                                'to'=>str_replace(
':', 
'', $slot[1]));
 
  603                        $last = array_pop(array_keys($hours));
 
  604                        $slot_captions = array();
 
  605                        foreach($hours as $hour => $period)
 
  607                                $dates[$hour][0] = $period;
 
  609                                $period = explode(
"-", $period);
 
  614                                        if(stristr($period[0], 
"pm"))
 
  616                                                $period[0] = (int)$period[0]+12;
 
  620                                                $period[0] = (int)$period[0];
 
  626                                        if(
sizeof($period) == 2)
 
  628                                                if(stristr($period[1], 
"pm"))
 
  630                                                        $period[1] = (int)$period[1]+12;
 
  634                                                        $period[1] = (int)$period[1];
 
  643                                if(
sizeof($period) == 1)
 
  645                                        $period_from = (int)substr($period[0], 0, 2).
"00";
 
  646                                        $period_to = (int)substr($period[0], 0, 2).
"59";
 
  650                                        $period_from = (int)substr($period[0], 0, 2).
"00";
 
  651                                        $period_to = (int)substr($period[1], 0, 2).
"59";
 
  654                                $column = $date_info[
'isoday'];
 
  670                                        foreach($slots as $slot)
 
  672                                                $slot_from = mktime(substr($slot[
'from'], 0, 2), substr($slot[
'from'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
 
  673                                                $slot_to = mktime(substr($slot[
'to'], 0, 2), substr($slot[
'to'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
 
  679                                                if($slot_from < (time()+$schedule->getDeadline()*60*60) || !array_sum($nr_available))
 
  685                                                if((
int)$slot[
'from'] < $period_to && (int)$slot[
'to'] > $period_from)
 
  688                                                        $from = array_pop(explode(
' ', $from));
 
  690                                                        $to = array_pop(explode(
' ', $to));
 
  693                                                        $id = $slot_from.
'_'.$slot_to;
 
  694                                                        if(!in_array($id, $slot_captions))
 
  696                                                                $dates[$hour][$column][
'captions'][$id] = $from.
'-'.$to;
 
  697                                                                $dates[$hour][$column][
'available'][$id] = array_sum($nr_available);
 
  698                                                                $slot_captions[] = $id;
 
  707                                                $has_open_slot = 
true;
 
  708                                                $dates[$hour][$column][
'in_slot'] = 
$in;
 
  714                return $has_open_slot;
 
  724                include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
  725                include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';           
 
  734                                $object_id = 
$_POST[
'object_id'];
 
  747                                                $this->ctrl->redirect($this, 
'render');                                         
 
  754                        if(!isset(
$_POST[
'date']))
 
  761                        if(isset(
$_GET[
'object_id']))
 
  765                                $object_id = (int)
$_GET[
'object_id'];
 
  775                                        foreach(
$_POST[
'date'] as $date)
 
  777                                                $fromto = explode(
'_', $date);
 
  781                                                $counter = $counter[$object_id];
 
  787                                                                $confirm[$object_id.
"_".$fromto[0].
"_".($fromto[1]+1)] = $counter;
 
  791                                                                $rsv_ids[] = $this->
processBooking($object_id, $fromto[0], $fromto[1], $group_id);
 
  862                        $this->ctrl->redirect($this, 
'book');
 
  871                include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
  873                $pfile = $obj->getPostFile();
 
  874                $ptext = $obj->getPostText();
 
  875                if(trim($ptext) || $pfile)
 
  877                        if(
sizeof($a_rsv_ids))
 
  879                                $this->ctrl->setParameterByClass(
'ilbookingobjectgui', 
'rsv_ids', implode(
";", $a_rsv_ids));            
 
  881                        $this->ctrl->setParameterByClass(
'ilbookingobjectgui', 
'object_id', $obj->getId());                             
 
  882                        $this->ctrl->redirectByClass(
'ilbookingobjectgui', 
'displayPostInfo');
 
  886                        $this->ctrl->redirect($this, 
'render');
 
  892                include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  894                $form->setFormAction($this->ctrl->getFormAction($this, 
"confirmedBooking"));
 
  895                $form->setTitle($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects"));
 
  896                $form->setDescription($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects_info"));
 
  898                include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
  901                foreach($a_objects_counter as $id => $counter)
 
  903                        $id = explode(
"_", $id);
 
  904                        $book_id = $id[0].
"_".$id[1].
"_".$id[2].
"_".$counter;
 
  911                                $section->setTitle($obj->getTitle());
 
  923                        $nr_field->setValue(1);
 
  924                        $nr_field->setSize(3);
 
  925                        $nr_field->setMaxValue($counter);
 
  926                        $nr_field->setMinValue($counter ? 1 : 0);
 
  927                        $nr_field->setRequired(
true);
 
  928                        $form->addItem($nr_field);      
 
  930                        if(!$min_date || $id[1] < $min_date)
 
  937                $this->lng->loadLanguageModule(
"dateplaner");
 
  938                $rec_mode = 
new ilSelectInputGUI($this->lng->txt(
"cal_recurrences"), 
"recm");
 
  939                $rec_mode->setRequired(
true);
 
  940                $rec_mode->setOptions(array(                    
 
  941                        "-1" => $this->lng->txt(
"cal_no_recurrence"),
 
  942                        1 => $this->lng->txt(
"cal_weekly"),
 
  943                        2 => $this->lng->txt(
"r_14"),
 
  944                        4 => $this->lng->txt(
"r_4_weeks")
 
  946                $form->addItem($rec_mode);
 
  949                $rec_mode->addSubItem($rec_end);        
 
  954                        $rec_mode->setHideSubForm(
true, 
'>= 1');
 
  964                        $rec_mode->setDisabled(
true);
 
  965                        $rec_end->setDisabled(
true);                    
 
  971                        $grp->setValue($a_group_id);
 
  972                        $form->addItem($grp);           
 
  975                $form->addCommandButton(
"confirmedBookingNumbers", $this->lng->txt(
"confirm"));
 
  976                $form->addCommandButton(
"render", $this->lng->txt(
"cancel"));
 
  985                $this->tabs_gui->clearTargets();
 
  986                $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this, 
'render'));
 
  993                $tpl->setContent($a_form->getHTML());
 
  998                $date = date_parse($a_date);            
 
  999                $stamp = mktime(0, 0, 1, $date[
"month"], $date[
"day"]+$a_days, $date[
"year"]);
 
 1000                return date(
"Y-m-d", $stamp);
 
 1005                $date = getDate($a_stamp);              
 
 1006                return mktime($date[
"hours"], $date[
"minutes"], $date[
"seconds"], 
 
 1007                        $date[
"mon"], $date[
"mday"]+$a_days, $date[
"year"]);
 
 1012                include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';                                                           
 
 1013                include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
 1017                $current_first = 
$obj_id = 
null;
 
 1018                foreach(array_keys(
$_POST) as $id)
 
 1020                        if(substr($id, 0, 9) == 
"conf_nr__")
 
 1022                                $id = explode(
"_", substr($id, 9));
 
 1023                                $counter[$id[0].
"_".$id[1].
"_".$id[2]] = (int)$id[3];           
 
 1026                                        $current_first = date(
"Y-m-d", $id[1]);
 
 1032                if((
int)
$_POST[
"recm"] > 0 && $current_first)
 
 1035                        $end = 
$_POST[
"rece"][
"date"];
 
 1036                        $end = date(
"Y-m-d", mktime(23, 59, 59, $end[
"m"], $end[
"d"], $end[
"y"]));                                      
 
 1037                        $cycle = (int)
$_POST[
"recm"]*7;                 
 
 1040                        while($cut < 1000 && $this->
addDaysDate($current_first, $cycle) <= $end)
 
 1043                                $current_first = 
null;
 
 1044                                foreach($org as $item_id => $max)
 
 1046                                        $parts = explode(
"_", $item_id);
 
 1052                                        $new_item_id = 
$obj_id.
"_".$from.
"_".$to;
 
 1055                                        if(!isset($counter[$new_item_id]) && date(
"Y-m-d", $to) <= $end)
 
 1059                                                $new_max = (int)$new_max[
$obj_id];
 
 1061                                                $counter[$new_item_id] = $new_max;
 
 1065                                                        $current_first = date(
"Y-m-d", $from);
 
 1069                                                $_POST[
"conf_nr__".$new_item_id.
"_".$new_max] = 
$_POST[
"conf_nr__".$item_id.
"_".$max];          
 
 1075                $group_id = 
$_POST[
"grp_id"];
 
 1078                if($form->checkInput())
 
 1082                        foreach($counter as $id => $all_nr)
 
 1084                                $book_nr = $form->getInput(
"conf_nr__".$id.
"_".$all_nr);
 
 1085                                $parts = explode(
"_", $id);
 
 1096                                        $book_nr = min($book_nr, $counter);                                                     
 
 1097                                        for($loop = 0; $loop < $book_nr; $loop++)
 
 1111                                $this->ctrl->redirect($this, 
'render');
 
 1118                        $rece_year = 
$_POST[
"rece"][
"date"][
"y"];
 
 1119                        $rece_month = str_pad(
$_POST[
"rece"][
"date"][
"m"], 2, 
"0", STR_PAD_LEFT);
 
 1120                        $rece_day = str_pad(
$_POST[
"rece"][
"date"][
"d"], 2, 
"0", STR_PAD_LEFT);
 
 1125                        $form->setValuesByPost();
 
 1127                        $form->getItemByPostVar(
"rece")->setDate(
new ilDate($rece_year.
"-".$rece_month.
"-".$rece_day, 
IL_CAL_DATE));
 
 1128                        $form->getItemByPostVar(
"recm")->setHideSubForm(
$_POST[
"recm"] < 1);
 
 1131                        $hidden_date->setValue($rece_year);                     
 
 1132                        $form->addItem($hidden_date);
 
 1134                        $hidden_date->setValue($rece_month);                    
 
 1135                        $form->addItem($hidden_date);
 
 1137                        $hidden_date->setValue($rece_day);                      
 
 1138                        $form->addItem($hidden_date);
 
 1153        function processBooking($a_object_id, $a_from = 
null, $a_to = 
null, $a_group_id = 
null)
 
 1158                if(!$ilAccess->checkAccess(
'read', 
'', $this->object->getRefId()))
 
 1160                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
 
 1163                include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';
 
 1165                $reservation->setObjectId($a_object_id);
 
 1166                $reservation->setUserId(
$ilUser->getID());
 
 1167                $reservation->setFrom($a_from);
 
 1168                $reservation->setTo($a_to);
 
 1169                $reservation->setGroupId($a_group_id);
 
 1170                $reservation->save();
 
 1174                        $this->lng->loadLanguageModule(
'dateplaner');
 
 1175                        include_once 
'Services/Calendar/classes/class.ilCalendarUtil.php';
 
 1176                        include_once 
'Services/Calendar/classes/class.ilCalendarCategory.php';
 
 1179                        include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
 1182                        include_once 
'Services/Calendar/classes/class.ilCalendarEntry.php';
 
 1186                        $entry->setTitle($this->lng->txt(
'book_cal_entry').
' '.
$object->getTitle());
 
 1187                        $entry->setContextId($reservation->getId());
 
 1190                        include_once 
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
 
 1192                        $assignment->addAssignment($def_cat->getCategoryId());
 
 1195                return $reservation->getId();
 
 1203                global 
$tpl, $ilAccess;
 
 1205                $this->tabs_gui->setTabActive(
'log');
 
 1207                $show_all = ($ilAccess->checkAccess(
'write', 
'', $this->object->getRefId()) ||
 
 1208                        $this->
object->hasPublicLog());
 
 1211                if(
$_GET[
"object_id"])
 
 1213                        $filter[
"object"] = (int)
$_GET[
"object_id"];
 
 1216                include_once 
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
 
 1218                        $this->object->getId(), $show_all, 
 
 1221                $tpl->setContent($table->getHTML());
 
 1226                global 
$tpl, $ilAccess;
 
 1228                $this->tabs_gui->clearTargets();
 
 1229                $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
 
 1230                        $this->ctrl->getLinkTarget($this, 
"log"));
 
 1232                $show_all = ($ilAccess->checkAccess(
'write', 
'', $this->object->getRefId()) ||
 
 1233                        $this->
object->hasPublicLog());
 
 1236                if(
$_GET[
"object_id"])
 
 1238                        $filter[
"object"] = (int)
$_GET[
"object_id"];
 
 1241                include_once 
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
 
 1243                        $this->object->getId(), $show_all, 
 
 1245                        $filter, 
$_GET[
"reservation_id"]);
 
 1246                $tpl->setContent($table->getHTML());
 
 1256                $this->tabs_gui->setTabActive(
'log');
 
 1258                if(!
$_POST[
'reservation_id'])
 
 1264                if ($ilAccess->checkAccess(
'write', 
'', $this->object->getRefId()))
 
 1266                        include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';
 
 1271                return $this->ctrl->redirect($this, 
'log');
 
 1281                $show_all = ($ilAccess->checkAccess(
'write', 
'', $this->object->getRefId()) ||
 
 1282                        $this->
object->hasPublicLog());
 
 1284                include_once 
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
 
 1286                        $this->object->getId(), $show_all,
 
 1288                $table->resetOffset();
 
 1289                $table->writeFilterToSession();
 
 1300                $show_all = ($ilAccess->checkAccess(
'write', 
'', $this->object->getRefId()) ||
 
 1301                        $this->
object->hasPublicLog());
 
 1303                include_once 
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
 
 1305                        $this->object->getId(), $show_all,
 
 1307                $table->resetOffset();
 
 1308                $table->resetFilter();
 
 1316                if ($ilAccess->checkAccess(
"read", 
"", $a_target))
 
 1320                else if ($ilAccess->checkAccess(
"read", 
"", ROOT_FOLDER_ID))
 
 1337                $this->ctrl->setCmd(
"showSummary");
 
 1338                $this->ctrl->setCmdClass(
"ilinfoscreengui");
 
 1346                $this->tabs_gui->setTabActive(
'info');
 
 1348                if (!$ilAccess->checkAccess(
"visible", 
"", $this->ref_id))
 
 1350                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
 
 1353                include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
 
 1356                $info->enablePrivateNotes();
 
 1358                if ($ilAccess->checkAccess(
"read", 
"", 
$_GET[
"ref_id"]))
 
 1360                        $info->enableNews();
 
 1364                $info->enableNewsEditing(
false);
 
 1365                if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"]))
 
 1368                        $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
 
 1370                        if ($enable_internal_rss)
 
 1372                                $info->setBlockProperty(
"news", 
"settings", 
true);
 
 1373                                $info->setBlockProperty(
"news", 
"public_notifications_option", 
true);
 
 1378                if (
$ilCtrl->getNextClass() == 
"ilinfoscreengui")
 
 1394                else if(
$_GET[
"reservation_id"])
 
 1396                        return array(
$_GET[
"reservation_id"]);
 
 1407                        $this->ctrl->redirect($this, 
'log');
 
 1410                include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
 1411                include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';
 
 1414                foreach($ids as $idx => $id)
 
 1416                        if(!is_numeric($id))
 
 1418                                list(
$obj_id, $user_id, $from, $to) = explode(
"_", $id);
 
 1420                                $valid_ids = array();                           
 
 1423                                        $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
 
 1426                                if(($ilAccess->checkAccess(
"write", 
"", $this->ref_id) || $user_id == 
$ilUser->getId()) &&
 
 1428                                        in_array(
$obj_id, array_keys($valid_ids)))
 
 1431                                        if(!
sizeof($rsv_ids))
 
 1435                                        if(
sizeof($rsv_ids) > 1)
 
 1437                                                $max[$id] = 
sizeof($rsv_ids);
 
 1438                                                $ids[$idx] = $rsv_ids;
 
 1443                                                $ids[$idx] = array_shift($rsv_ids);
 
 1455                        $this->ctrl->redirect($this, 
'log');
 
 1459                if(
sizeof($max) && max($max) > 1)
 
 1464                $this->tabs_gui->clearTargets();
 
 1465                $this->tabs_gui->setBackTarget(
$lng->txt(
"back"),
 
 1466                        $ilCtrl->getLinkTarget($this, 
"log"));
 
 1470                include_once 
'Services/Utilities/classes/class.ilConfirmationGUI.php';
 
 1472                $conf->setFormAction(
$ilCtrl->getFormAction($this, 
'rsvCancel'));
 
 1473                $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
 
 1474                $conf->setConfirm(
$lng->txt(
'book_set_cancel'), 
'rsvCancel');
 
 1475                $conf->setCancel(
$lng->txt(
'cancel'), 
'log');
 
 1477                foreach($ids as $id)
 
 1482                        $details = $obj->getTitle();
 
 1485                                $details .= 
", ".ilDatePresentation::formatPeriod(
 
 1490                        $conf->addItem(
'rsv_id[]', $id, $details);              
 
 1493                $tpl->setContent($conf->getHTML());             
 
 1498                include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
 1500                $form->setFormAction($this->ctrl->getFormAction($this, 
"rsvCancel"));
 
 1501                $form->setTitle($this->lng->txt(
"book_confirm_cancel_aggregation"));
 
 1503                include_once 
'Modules/BookingManager/classes/class.ilBookingObject.php';
 
 1504                include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';   
 
 1508                foreach($a_ids as $idx => $ids)
 
 1513                                $first = array_shift($first);
 
 1530                                $caption .= 
" (".sizeof($ids).
")";
 
 1534                        $item->setRequired(
true);
 
 1535                        $item->setMinValue(0);
 
 1537                        $form->addItem($item);
 
 1541                                $item->setMaxValue(
sizeof($ids));
 
 1543                                foreach($ids as $id)
 
 1546                                        $hidden->setValue($id);
 
 1547                                        $form->addItem($hidden);
 
 1552                                $item->setMaxValue(1);
 
 1555                                $hidden->setValue($ids);
 
 1556                                $form->addItem($hidden);
 
 1559                        if(
$_POST[
"rsv_id_".$idx])
 
 1561                                $item->setValue((
int)
$_POST[
"rsv_id_".$idx]);
 
 1565                $form->addCommandButton(
"rsvCancel", $this->lng->txt(
"confirm"));
 
 1566                $form->addCommandButton(
"log", $this->lng->txt(
"cancel"));      
 
 1575                $this->tabs_gui->clearTargets();
 
 1576                $this->tabs_gui->setBackTarget(
$lng->txt(
"back"),
 
 1577                        $ilCtrl->getLinkTarget($this, 
"log"));
 
 1584                $tpl->setContent($form->getHTML());             
 
 1597                        if(!$form->checkInput())
 
 1599                                $this->tabs_gui->clearTargets();
 
 1600                                $this->tabs_gui->setBackTarget(
$lng->txt(
"back"),
 
 1601                                        $ilCtrl->getLinkTarget($this, 
"log"));
 
 1603                                return $tpl->setContent($form->getHTML());              
 
 1607                        foreach(
$_POST[
"rsv_aggr"] as $idx => $aggr_ids)
 
 1609                                $max = (int)
$_POST[
"rsv_id_".$idx];
 
 1612                                        if(!is_array($aggr_ids))
 
 1618                                                $aggr_ids = array_slice($aggr_ids, 0, $max);
 
 1619                                                $ids = array_merge($ids, $aggr_ids);
 
 1627                        include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';
 
 1628                        foreach($ids as $id)
 
 1632                                if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id) && $obj->getUserId() != 
$ilUser->getId())
 
 1635                                        $this->ctrl->redirect($this, 
'log');
 
 1644                                        $cal_entry_id = $obj->getCalendarEntry();               
 
 1647                                                include_once 
'Services/Calendar/classes/class.ilCalendarEntry.php';
 
 1691                if(!$ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 1694                        $this->ctrl->redirect($this, 
'log');
 
 1700                        include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';           
 
 1701                        foreach($ids as $id)
 
 1717                if(!$ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 1720                        $this->ctrl->redirect($this, 
'log');
 
 1726                        include_once 
'Modules/BookingManager/classes/class.ilBookingReservation.php';           
 
 1727                        foreach($ids as $id)
 
 1730                                $obj->setStatus(NULL);
 
 1743                $this->tabs_gui->clearTargets();
 
 1745                $user_id = (int)
$_GET[
'user_id'];
 
 1747                include_once 
'Services/User/classes/class.ilPublicUserProfileGUI.php';
 
 1749                $profile->setBackUrl($this->ctrl->getLinkTarget($this, 
'log'));
 
 1757                if (is_object($this->
object))
 
 1759                        $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
"render"), 
"", 
$_GET[
"ref_id"]);
 
Class ilBookingObjectGUI.
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static changeStatus(array $a_ids, $a_status)
List all reservations.
static getAvailableObject(array $a_ids, $a_from, $a_to, $a_return_single=true, $a_return_counter=false)
Check if any of given objects are bookable.
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
static getNewGroupId()
Get next group id
static isObjectAvailableNoSchedule($a_obj_id)
Class ilBookingScheduleGUI.
schedule for booking ressource
getRaster()
Get booking raster.
static getList($a_pool_id)
Get list of booking objects for given pool.
static _getColorsByType($a_type)
get selectable colors
Model for a calendar entry.
setStart(ilDateTime $a_start)
@access public
static _getInstanceByUserId($a_user_id)
get singleton instance
static _numericDayToString($a_day, $a_long=true)
get
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Class ilObjBookingPoolGUI.
confirmBookingNumbers(array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form=null)
buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
applyLogFilterObject()
Apply filter from reservations table gui.
addExternalEditFormCustom(ilPropertyFormGUI $a_form)
bookObject()
First step in booking process.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
executeCommand()
main switch
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
changeStatusObject()
Change status of given reservations.
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
rsvConfirmCancelAggregationForm($a_ids)
processBooking($a_object_id, $a_from=null, $a_to=null, $a_group_id=null)
Book object for date.
initCreationForms($a_new_type)
Init creation froms.
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
confirmedBookingNumbersObject()
rsvConfirmCancelAggregationObject(array $a_ids=null)
addDaysDate($a_date, $a_days)
renderSlots(ilBookingSchedule $schedule, array $object_ids, $title)
addDaysStamp($a_stamp, $a_days)
handleBookingSuccess($a_obj_id, array $a_rsv_ids=null)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
confirmedBookingObject()
Book object - either of type or specific - for given dates.
initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload=false)
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
resetLogFilterObject()
Reset filter in reservations table gui.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
logObject()
List reservations.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
prepareOutput()
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
addHeaderAction()
Add header action menu.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
update()
update object in db
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
GUI class for public user profile presentation.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
redirection script todo: (a better solution should control the processing via a xml file)