86 $this->ctrl = $DIC->ctrl();
87 $this->tpl = $DIC[
"tpl"];
88 $this->lng = $DIC->language();
89 $this->access = $DIC->access();
90 $this->tabs = $DIC->tabs();
92 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
93 $this->
user = $DIC->user();
96 $this->sseed = $sseed;
101 $this->pool_gui = $a_parent_obj;
102 $this->pool_has_schedule =
104 $this->pool_uses_preferences =
106 $this->pool_overall_limit = $this->pool_has_schedule
108 : $a_parent_obj->object->getOverallLimit();
110 $this->object_id = (int) $_REQUEST[
'object_id'];
111 $this->ref_id = (int) $_REQUEST[
'ref_id'];
112 $this->ctrl->saveParameter($this,
"object_id");
114 $this->rsv_ids = array_map(
'intval', explode(
";",
$_GET[
"rsv_ids"]));
124 $this->management = $a_val;
145 return $this->pool_gui->ref_id;
155 return $this->pool_gui->object->getId();
177 : $this->pool_gui->object->getOverallLimit();
188 $next_class = $ilCtrl->getNextClass($this);
190 switch ($next_class) {
192 case "ilpropertyformgui":
195 $this->ctrl->forwardCommand($form);
198 case "ilbookingprocessgui":
199 if (!$this->pool_uses_preferences) {
200 $ilCtrl->setReturn($this,
"render");
202 $ilCtrl->setReturn($this,
"returnToPreferences");
205 $this->pool_gui->object,
210 $this->context_obj_id
212 $this->ctrl->forwardCommand($process_gui);
216 $cmd = $ilCtrl->getCmd(
"render");
228 $this->pool_gui->showNoScheduleMessage();
236 $this->ctrl->redirectByClass(
"ilBookingPreferencesGUI");
255 $bar->addButton(
$lng->txt(
'book_add_object'), $ilCtrl->getLinkTarget($this,
'create'));
262 $tpl->setContent(
$bar . $table->getHTML());
268 $table->resetOffset();
269 $table->writeFilterToSession();
276 $table->resetOffset();
277 $table->resetFilter();
286 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
295 $ilTabs->clearTargets();
296 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
303 $tpl->setContent($a_form->getHTML());
311 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
320 $ilTabs->clearTargets();
321 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
326 $a_form = $this->
initForm(
'edit', $this->object_id);
328 $tpl->setContent($a_form->getHTML());
333 $this->
help->setHelpId($a_id);
342 public function initForm($a_mode =
"create", $id = null)
351 $title->setRequired(
true);
353 $title->setMaxLength(120);
354 $form_gui->addItem($title);
359 $form_gui->addItem($desc);
363 $form_gui->addItem($file);
368 $nr->setMaxLength(3);
369 $form_gui->addItem($nr);
374 $options[$schedule[
"booking_schedule_id"]] = $schedule[
"title"];
377 $schedule->setRequired(
true);
378 $schedule->setOptions($options);
379 $form_gui->addItem($schedule);
383 $post->setTitle(
$lng->txt(
"book_post_booking_information"));
384 $form_gui->addItem($post);
389 $pdesc->setInfo(
$lng->txt(
"book_post_booking_text_info"));
390 $form_gui->addItem($pdesc);
394 $form_gui->addItem($pfile);
398 $this->record_gui->setPropertyForm($form_gui);
399 $this->record_gui->parse();
401 if ($a_mode ==
"edit") {
402 $form_gui->setTitle(
$lng->txt(
"book_edit_object"));
405 $item->setValue($id);
406 $form_gui->addItem($item);
409 $title->setValue($obj->getTitle());
410 $desc->setValue($obj->getDescription());
411 $nr->setValue($obj->getNrOfItems());
412 $pdesc->setValue($obj->getPostText());
413 $file->setValue($obj->getFile());
414 $pfile->setValue($obj->getPostFile());
416 if (isset($schedule)) {
417 $schedule->setValue($obj->getScheduleId());
420 $form_gui->addCommandButton(
"update",
$lng->txt(
"save"));
422 $form_gui->setTitle(
$lng->txt(
"book_add_object"));
423 $form_gui->addCommandButton(
"save",
$lng->txt(
"save"));
424 $form_gui->addCommandButton(
"render",
$lng->txt(
"cancel"));
426 $form_gui->setFormAction($ilCtrl->getFormAction($this));
436 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
444 if ($form->checkInput()) {
446 if ($this->record_gui &&
447 !$this->record_gui->importEditFormPostValues()) {
453 $obj->setTitle($form->getInput(
"title"));
454 $obj->setDescription($form->getInput(
"desc"));
455 $obj->setNrOfItems($form->getInput(
"items"));
456 $obj->setPostText($form->getInput(
"post_text"));
459 $obj->setScheduleId($form->getInput(
"schedule"));
464 $file = $form->getItemByPostVar(
"file");
465 if ($_FILES[
"file"][
"tmp_name"]) {
466 $obj->uploadFile($_FILES[
"file"]);
467 } elseif ($file->getDeletionFlag()) {
471 $pfile = $form->getItemByPostVar(
"post_file");
472 if ($_FILES[
"post_file"][
"tmp_name"]) {
473 $obj->uploadPostFile($_FILES[
"post_file"]);
474 } elseif ($pfile->getDeletionFlag()) {
475 $obj->deletePostFile();
480 if ($this->record_gui) {
481 $this->record_gui->writeEditForm(null, $obj->getId());
484 ilUtil::sendSuccess(
$lng->txt(
"book_object_added"),
true);
485 $ilCtrl->redirect($this,
"render");
489 $form->setValuesByPost();
498 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
505 $form = $this->
initForm(
'edit', $this->object_id);
506 if ($form->checkInput()) {
508 if ($this->record_gui &&
509 !$this->record_gui->importEditFormPostValues()) {
515 $obj->setTitle($form->getInput(
"title"));
516 $obj->setDescription($form->getInput(
"desc"));
517 $obj->setNrOfItems($form->getInput(
"items"));
518 $obj->setPostText($form->getInput(
"post_text"));
520 $file = $form->getItemByPostVar(
"file");
521 if ($_FILES[
"file"][
"tmp_name"]) {
522 $obj->uploadFile($_FILES[
"file"]);
523 } elseif ($file->getDeletionFlag()) {
527 $pfile = $form->getItemByPostVar(
"post_file");
528 if ($_FILES[
"post_file"][
"tmp_name"]) {
529 $obj->uploadPostFile($_FILES[
"post_file"]);
530 } elseif ($pfile->getDeletionFlag()) {
531 $obj->deletePostFile();
535 $obj->setScheduleId($form->getInput(
"schedule"));
540 if ($this->record_gui) {
541 $this->record_gui->writeEditForm();
544 ilUtil::sendSuccess(
$lng->txt(
"book_object_updated"),
true);
545 $ilCtrl->redirect($this,
"render");
549 $form->setValuesByPost();
558 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
567 $ilTabs->clearTargets();
568 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
571 $conf->setFormAction($ilCtrl->getFormAction($this));
572 $conf->setHeaderText(
$lng->txt(
'book_confirm_delete'));
575 $conf->addItem(
'object_id', $this->object_id,
$type->getTitle());
576 $conf->setConfirm(
$lng->txt(
'delete'),
'delete');
577 $conf->setCancel(
$lng->txt(
'cancel'),
'render');
579 $tpl->setContent($conf->getHTML());
585 public function delete()
587 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
597 ilUtil::sendSuccess(
$lng->txt(
'book_object_deleted'),
true);
598 $ilCtrl->setParameter($this,
'object_id',
"");
599 $ilCtrl->redirect($this,
'render');
611 $file = $obj->getFileFullPath();
hasPoolSchedule()
Has booking pool a schedule?
update()
Update object dataset.
Help adapter for booking manager.
getPoolOverallLimit()
Get booking pool overall limit.
edit(ilPropertyFormGUI $a_form=null)
Render edit form.
showNoScheduleMessage()
Show no schedule message.
isManagementActivated()
Is management activated?
confirmDelete()
Confirm delete.
activateManagement($a_val)
Activate management.
create(ilPropertyFormGUI $a_form=null)
Render creation form.
getPoolRefId()
Get ref id of booking pool.
initForm($a_mode="create", $id=null)
Build property form.
Class ilBookingObjectGUI.
returnToPreferences()
Return to preferences.
Booking process ui class.
setCols($a_cols)
Set Cols.
List booking objects (for booking type)
render()
Render list of booking objects.
getPoolObjId()
Get obj id of booking pool.
save()
Create new object dataset.
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
setPoolId($a_pool_id)
Set booking pool id.
const TYPE_NO_SCHEDULE_PREFERENCES
static getList($a_pool_id)
Get list of booking objects for given pool.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Confirmation screen class.