62 $this->tpl = $DIC[
"tpl"];
63 $this->tabs = $DIC->tabs();
64 $this->ctrl = $DIC->ctrl();
65 $this->lng = $DIC->language();
66 $this->access = $DIC->access();
67 $this->
help = $DIC[
"ilHelp"];
68 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
69 $this->ref_id = $a_parent_obj->ref_id;
70 $this->schedule_id = (int) $_REQUEST[
'schedule_id'];
82 $next_class =
$ilCtrl->getNextClass($this);
84 switch ($next_class) {
86 $cmd =
$ilCtrl->getCmd(
"render");
107 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
109 if (
sizeof($table->getData())) {
117 $bar = $bar->getHTML();
120 $tpl->setContent(
$bar . $table->getHTML());
134 $ilTabs->clearTargets();
135 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
136 $ilHelp->setScreenIdComponent(
"book");
137 $ilHelp->setScreenId(
"schedules");
138 $ilHelp->setSubScreenId(
"create");
141 $tpl->setContent($form->getHTML());
155 $ilTabs->clearTargets();
156 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
157 $ilHelp->setScreenIdComponent(
"book");
158 $ilHelp->setScreenId(
"schedules");
159 $ilHelp->setSubScreenId(
"edit");
161 $form = $this->
initForm(
'edit', $this->schedule_id);
162 $tpl->setContent($form->getHTML());
171 public function initForm($a_mode =
"create", $id = null)
176 $lng->loadLanguageModule(
"dateplaner");
181 $title->setRequired(
true);
183 $title->setMaxLength(120);
184 $form_gui->addItem($title);
187 $definition->
setInfo(
$lng->txt(
"book_schedule_days_info"));
188 $definition->setRequired(
true);
189 $form_gui->addItem($definition);
193 $form_gui->addItem($deadline_opts);
196 $deadline_opts->addOption($deadline_time);
199 $deadline->
setInfo(
$lng->txt(
"book_deadline_info"));
200 $deadline->setSuffix(
$lng->txt(
"book_hours"));
201 $deadline->setMinValue(1);
202 $deadline->setSize(3);
203 $deadline->setMaxLength(3);
204 $deadline_time->addSubItem($deadline);
206 $deadline_start =
new ilRadioOption(
$lng->txt(
"book_deadline_slot_start"),
"slot_start");
207 $deadline_opts->addOption($deadline_start);
209 $deadline_slot =
new ilRadioOption(
$lng->txt(
"book_deadline_slot_end"),
"slot_end");
210 $deadline_opts->addOption($deadline_slot);
212 if ($a_mode ==
"edit") {
217 $av->setTitle(
$lng->txt(
"obj_activation_list_gui"));
218 $form_gui->addItem($av);
221 $lng->loadLanguageModule(
'rep');
225 $form_gui->addItem($from);
229 $form_gui->addItem($to);
231 if ($a_mode ==
"edit") {
232 $form_gui->setTitle(
$lng->txt(
"book_edit_schedule"));
235 $item->setValue($id);
236 $form_gui->addItem($item);
239 $title->setValue($schedule->getTitle());
240 $from->setDate($schedule->getAvailabilityFrom());
241 $to->setDate($schedule->getAvailabilityTo());
243 if ($schedule->getDeadline() == 0) {
244 $deadline_opts->setValue(
"slot_start");
245 } elseif ($schedule->getDeadline() > 0) {
246 $deadline->setValue($schedule->getDeadline());
247 $deadline_opts->setValue(
"hours");
249 $deadline->setValue(0);
250 $deadline_opts->setValue(
"slot_end");
268 $definition->setValue($schedule->getDefinitionBySlots());
270 $form_gui->addCommandButton(
"update",
$lng->txt(
"save"));
272 $form_gui->setTitle(
$lng->txt(
"book_add_schedule"));
273 $form_gui->addCommandButton(
"save",
$lng->txt(
"save"));
274 $form_gui->addCommandButton(
"render",
$lng->txt(
"cancel"));
276 $form_gui->setFormAction(
$ilCtrl->getFormAction($this));
290 if ($form->checkInput()) {
295 ilUtil::sendSuccess(
$lng->txt(
"book_schedule_added"));
298 $form->setValuesByPost();
300 $tpl->setContent($form->getHTML());
312 $form = $this->
initForm(
'edit', $this->schedule_id);
313 if ($form->checkInput()) {
318 ilUtil::sendSuccess(
$lng->txt(
"book_schedule_updated"));
321 $form->setValuesByPost();
323 $tpl->setContent($form->getHTML());
337 foreach ($days_group->getOptions() as $option) {
338 $days_fields[$option->getValue()] = $option;
341 foreach ($days as $day) {
342 $slot = $form->
getInput($day .
"_slot");
343 $subs = $days_fields[$day]->getSubItems();
345 $subs[0]->setValue($slot[0]);
348 $subs[1]->setValue($slot[1]);
363 $schedule->setTitle($form->getInput(
"title"));
364 $schedule->setPoolId($ilObjDataCache->lookupObjId($this->ref_id));
366 $from = $form->getItemByPostVar(
"from");
367 $schedule->setAvailabilityFrom($from->getDate());
369 $to = $form->getItemByPostVar(
"to");
370 $schedule->setAvailabilityTo($to->getDate());
372 switch ($form->getInput(
"deadline_opts")) {
374 $schedule->setDeadline(0);
378 $schedule->setDeadline($form->getInput(
"deadline"));
382 $schedule->setDeadline(-1);
417 $ilHelp->setSubScreenId(
"delete");
421 $conf->setFormAction(
$ilCtrl->getFormAction($this));
422 $conf->setHeaderText(
$lng->txt(
'book_confirm_delete'));
425 $conf->addItem(
'schedule_id', $this->schedule_id,
$type->getTitle());
426 $conf->setConfirm(
$lng->txt(
'delete'),
'delete');
427 $conf->setCancel(
$lng->txt(
'cancel'),
'render');
429 $tpl->setContent($conf->getHTML());
435 public function delete()
443 ilUtil::sendSuccess(
$lng->txt(
'book_schedule_deleted'),
true);
444 $ilCtrl->redirect($this,
'render');
This class represents an option in a radio group.
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
__construct($a_parent_obj)
Constructor.
schedule for booking ressource
List booking schedules (for booking pool)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupObjId($a_id)
initForm($a_mode="create", $id=null)
Build property form.
create()
Render creation form.
save()
Create new dataset.
executeCommand()
main switch
formToObject($form, $schedule)
Convert incoming form data to schedule object.
Class ilBookingScheduleGUI.
render()
Render list of booking schedules.
setDefinitionFromPost(ilPropertyFormGUI $form)
Reload definition values from post data.
confirmDelete()
Confirm delete.
Confirmation screen class.