/**
  * Init settings form.
  * This command uses the form class to display an input form.
  */
 protected function initSettingsForm()
 {
     $this->settingsForm = new ilPropertyFormGUI();
     // Title and description (Standard)
     $titleField = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $titleField->setMaxLength(128);
     $titleField->setRequired(true);
     $this->settingsForm->addItem($titleField);
     $descField = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
     $descField->setCols(50);
     $descField->setRows(5);
     $this->settingsForm->addItem($descField);
     // Online flag
     $onlineField = new ilCheckboxInputGUI($this->lng->txt('online'), 'online');
     $this->settingsForm->addItem($onlineField);
     // Max booking time
     //		$maxtimeField = new ilRoomSharingTimeInputGUI($this->lng->txt('rep_robj_xrs_max_book_time'), 'max_book_time');
     //		$maxtimeField->setShowTime(true);
     //		$maxtimeField->setMinuteStepSize(5);
     //		$maxtimeField->setShowDate(false);
     //		$this->settingsForm->addItem($maxtimeField);
     require_once './Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/classes/utils/class.xrsTimeInputGUI.php';
     $xrsTimeInputGUI = new xrsTimeInputGUI($this->lng->txt('rep_robj_xrs_max_book_time'), 'max_book_time');
     $this->settingsForm->addItem($xrsTimeInputGUI);
     // Rooms agreement
     $roomsAgrField = new ilFileInputGUI($this->lng->txt('rep_robj_xrs_rooms_user_agreement'), "rooms_agreement");
     $roomsAgrField->setSize(50);
     $roomsAgrField->setRequired(false);
     $roomsAgrField->setInfo($this->lng->txt("rep_robj_xrs_room_agreement_filetypes") . " .bmp, .jpg, .jpeg, .png, .gif, .txt, .pdf");
     $this->settingsForm->addItem($roomsAgrField);
     $this->settingsForm->addCommandButton('updateSettings', $this->lng->txt('save'));
     $this->settingsForm->setTitle($this->lng->txt('edit_properties'));
     $this->settingsForm->setFormAction($this->ctrl->getFormAction($this));
 }
 function importExternalMailRecipientsFromFileFormObject()
 {
     global $ilAccess;
     $this->parent_gui->handleWriteAccess();
     $this->setCodesSubtabs();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form_import_file = new ilPropertyFormGUI();
     $form_import_file->setFormAction($this->ctrl->getFormAction($this));
     $form_import_file->setTableWidth("100%");
     $form_import_file->setId("codes_import_file");
     $headerfile = new ilFormSectionHeaderGUI();
     $headerfile->setTitle($this->lng->txt("import_from_file"));
     $form_import_file->addItem($headerfile);
     $externalmails = new ilFileInputGUI($this->lng->txt("externalmails"), "externalmails");
     $externalmails->setInfo($this->lng->txt('externalmails_info'));
     $externalmails->setRequired(true);
     $form_import_file->addItem($externalmails);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_file->addCommandButton("importExternalRecipientsFromFile", $this->lng->txt("import"));
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_file->addCommandButton("codes", $this->lng->txt("cancel"));
     }
     $this->tpl->setContent($form_import_file->getHTML());
 }
 /**
  * Create import form
  */
 protected function initImportForm()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->lng->txt('cal_import_tbl'));
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->addCommandButton('uploadAppointments', $this->lng->txt('import'));
     $ics = new ilFileInputGUI($this->lng->txt('cal_import_file'), 'file');
     $ics->setALlowDeletion(false);
     $ics->setSuffixes(array('ics'));
     $ics->setInfo($this->lng->txt('cal_import_file_info'));
     $form->addItem($ics);
     return $form;
 }
 /**
  * Creates an input field for floor plans that should be uploaded.
  *
  * @return ilFileInputGUI file input form item
  */
 protected function createFileInputFormItem()
 {
     $file = new ilFileInputGUI($this->lng->txt("rep_robj_xrs_room_floor_plans"), "upload_file");
     $file->setSize(50);
     $file->setRequired(true);
     $file->setALlowDeletion(true);
     $file->setInfo($this->lng->txt("rep_robj_xrs_floor_plans_filetypes") . " .bmp, .jpg, .jpeg, .png, .gif");
     return $file;
 }
 /**
  * Init creation form
  */
 function initForm($a_mode = "create")
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     if ($a_mode == "edit") {
         $std_item = $this->object->getMediaItem("Standard");
     }
     $this->form_gui = new ilPropertyFormGUI();
     // standard view resource
     $title = new ilTextInputGUI($lng->txt("title"), "standard_title");
     $title->setSize(40);
     $title->setMaxLength(120);
     $this->form_gui->addItem($title);
     $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "standard_type");
     $op1 = new ilRadioOption($lng->txt("cont_file"), "File");
     $up = new ilFileInputGUI("", "standard_file");
     $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
     $up->setInfo("");
     $op1->addSubItem($up);
     $radio_prop->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("url"), "Reference");
     $ref = new ilTextInputGUI("", "standard_reference");
     $ref->setInfo($lng->txt("cont_ref_helptext"));
     $op2->addSubItem($ref);
     $radio_prop->addOption($op2);
     $radio_prop->setValue("File");
     $this->form_gui->addItem($radio_prop);
     // standard format
     if ($a_mode == "edit") {
         $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "standard_format");
         $format->setValue($std_item->getFormat());
         $this->form_gui->addItem($format);
     }
     // standard size
     $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "standard_size");
     if ($a_mode == "edit") {
         if ($orig_size = $std_item->getOriginalSize()) {
             $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")";
         }
         $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
         $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
     } else {
         $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
         $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
     }
     $radio_size->addOption($op1);
     // width height
     include_once "./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php";
     $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") . " / " . $lng->txt("cont_height"), "standard_width_height");
     $width_height->setConstrainProportions(true);
     $op2->addSubItem($width_height);
     // resize image
     if ($a_mode == "edit") {
         $std_item = $this->object->getMediaItem("Standard");
         if (is_int(strpos($std_item->getFormat(), "image")) && $std_item->getLocationType() == "LocalFile") {
             $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"), "standard_resize");
             $op2->addSubItem($resize);
         }
     }
     $radio_size->setValue("original");
     if ($a_mode == "create" && ($this->getHeightPreset() > 0 || $this->getWidthPreset() > 0)) {
         $radio_size->setValue("selected");
         $width_height->setWidth($this->getWidthPreset());
         $width_height->setHeight($this->getHeightPreset());
     }
     $radio_size->addOption($op2);
     $this->form_gui->addItem($radio_size);
     // standard caption
     $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "standard_caption");
     $caption->setCols(30);
     $caption->setRows(2);
     $this->form_gui->addItem($caption);
     /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "standard_caption");
     		$caption->setSize(40);
     		$caption->setMaxLength(200);
     		$this->form_gui->addItem($caption);*/
     // text representation (alt text)
     if ($a_mode == "edit" && is_int(strpos($std_item->getFormat(), "image"))) {
         $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "text_representation");
         $ta->setCols(30);
         $ta->setRows(2);
         $ta->setInfo($lng->txt("text_repr_info"));
         $this->form_gui->addItem($ta);
     }
     // standard parameters
     if ($a_mode == "edit" && !in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
         if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(), $std_item->getFormat())) {
             $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "standard_autostart");
             $this->form_gui->addItem($auto);
         } else {
             $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "standard_parameters");
             $par->setRows(5);
             $par->setCols(50);
             $this->form_gui->addItem($par);
         }
     }
     if ($a_mode == "edit") {
         $full_item = $this->object->getMediaItem("Fullscreen");
     }
     // fullscreen view resource
     $fs_sec = new ilFormSectionHeaderGUI();
     $fs_sec->setTitle($lng->txt("cont_fullscreen"));
     $this->form_gui->addItem($fs_sec);
     $radio_prop2 = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "full_type");
     $op1 = new ilRadioOption($lng->txt("cont_none"), "None");
     $radio_prop2->addOption($op1);
     $op4 = new ilRadioOption($lng->txt("cont_use_same_resource_as_above"), "Standard");
     $radio_prop2->addOption($op4);
     $op2 = new ilRadioOption($lng->txt("cont_file"), "File");
     $up = new ilFileInputGUI("", "full_file");
     $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
     $up->setInfo("");
     $op2->addSubItem($up);
     $radio_prop2->addOption($op2);
     $op3 = new ilRadioOption($lng->txt("url"), "Reference");
     $ref = new ilTextInputGUI("", "full_reference");
     $ref->setInfo($lng->txt("cont_ref_helptext"));
     $op3->addSubItem($ref);
     $radio_prop2->addOption($op3);
     $radio_prop2->setValue("None");
     $this->form_gui->addItem($radio_prop2);
     // fullscreen format
     if ($a_mode == "edit") {
         if ($this->object->hasFullscreenItem()) {
             $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "full_format");
             $format->setValue($full_item->getFormat());
             $this->form_gui->addItem($format);
         }
     }
     // fullscreen size
     $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_size");
     if ($a_mode == "edit") {
         $add_str = "";
         if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
             $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")";
         }
         $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
         $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
     } else {
         $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
         $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
     }
     $radio_size->addOption($op1);
     // width/height
     $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") . " / " . $lng->txt("cont_height"), "full_width_height");
     $width_height->setConstrainProportions(true);
     $op2->addSubItem($width_height);
     // resize image
     if ($a_mode == "edit") {
         $full_item = $this->object->getMediaItem("Fullscreen");
         if ($this->object->hasFullscreenItem() && is_int(strpos($full_item->getFormat(), "image")) && $full_item->getLocationType() == "LocalFile") {
             $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"), "full_resize");
             $op2->addSubItem($resize);
         }
     }
     $radio_size->setValue("original");
     $radio_size->addOption($op2);
     $this->form_gui->addItem($radio_size);
     // fullscreen caption
     $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "full_caption");
     $caption->setCols(30);
     $caption->setRows(2);
     $this->form_gui->addItem($caption);
     /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "full_caption");
     		$caption->setSize(40);
     		$caption->setMaxLength(200);
     		$this->form_gui->addItem($caption);*/
     // text representation (alt text)
     if ($a_mode == "edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(), "image"))) {
         $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "full_text_representation");
         $ta->setCols(30);
         $ta->setRows(2);
         $ta->setInfo($lng->txt("text_repr_info"));
         $this->form_gui->addItem($ta);
     }
     // fullscreen parameters
     if ($a_mode == "edit" && $this->object->hasFullscreenItem() && !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
         if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(), $full_item->getFormat())) {
             $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "full_autostart");
             $this->form_gui->addItem($auto);
         } else {
             $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "full_parameters");
             $par->setRows(5);
             $par->setCols(50);
             $this->form_gui->addItem($par);
         }
     }
     $this->form_gui->setTitle($lng->txt("cont_insert_mob"));
     if ($a_mode == "edit") {
         $this->form_gui->addCommandButton("saveProperties", $lng->txt("save"));
     } else {
         $this->form_gui->addCommandButton("save", $lng->txt("save"));
         $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
     }
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
 }
 /**
  * Init form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $this->setTitle($this->pl->txt('edit_type_template'));
     $types_available = array();
     $types = array(srCertificateTemplateTypeFactory::getById(srCertificateTemplateType::TEMPLATE_TYPE_HTML), srCertificateTemplateTypeFactory::getById(srCertificateTemplateType::TEMPLATE_TYPE_JASPER));
     /** @var $type srCertificateTemplateType */
     foreach ($types as $type) {
         if ($type->isAvailable()) {
             $types_available[$type->getId()] = $type->getTitle();
         }
     }
     if (!count($types_available)) {
         ilUtil::sendInfo($this->pl->txt('msg_no_template_types'));
     }
     $item = new ilSelectInputGUI($this->pl->txt('template_type_id'), 'template_type_id');
     $item->setOptions($types_available);
     $item->setRequired(true);
     $item->setValue($this->type->getTemplateTypeId());
     $this->addItem($item);
     $item = new ilFileInputGUI($this->pl->txt('template_file'), 'template_file');
     $template_file = $this->type->getCertificateTemplatesPath(true);
     if (is_file($template_file)) {
         $item->setValue($template_file);
     }
     $item->setFilename($template_file);
     $item->setInfo($this->pl->txt('template_file_info'));
     $item->setRequired(!is_file($template_file));
     $this->addItem($item);
     $assets = $this->type->getAssets();
     if (count($assets)) {
         $item = new ilMultiSelectInputGUI($this->pl->txt('assets'), 'remove_assets');
         $options = array();
         foreach ($assets as $asset) {
             $options[$asset] = $asset;
         }
         $item->setOptions($options);
         $item->setInfo($this->pl->txt('assets_info'));
         $this->addItem($item);
     }
     $item = new ilFileWizardInputGUI($this->pl->txt('add_assets'), 'add_assets');
     $item->setFilenames(array(0 => ''));
     $this->addItem($item);
     $this->addCommandButton('downloadDefaultTemplate', $this->pl->txt('download_default_template'));
     if (is_file($this->type->getCertificateTemplatesPath(true))) {
         $this->addCommandButton('downloadTemplate', $this->pl->txt('download_template'));
     }
     $this->addCommandButton('updateTemplate', $this->lng->txt('save'));
 }
 public function showCodeImport()
 {
     $this->ctrl->setParameter($this, 'coupon_id', $_GET['coupon_id']);
     $this->__showButtons();
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->coupon_obj->getCouponById(ilUtil::stripSlashes($_GET['coupon_id']));
     $oForm = new ilPropertyFormGUI();
     $oForm->setId('coup_form');
     $oForm->setFormAction($this->ctrl->getFormAction($this), 'importCodes');
     $oForm->setTitle($this->lng->txt("paya_coupons_coupon") . " " . $this->coupon_obj->getTitle() . ": " . $this->lng->txt('paya_coupons_codes_import'));
     $oFile = new ilFileInputGUI($this->lng->txt('file'), 'codesfile');
     $oFile->setSuffixes(array("txt"));
     $oFile->setRequired(true);
     $oFile->setInfo($this->lng->txt('import_use_only_textfile'));
     $oForm->addItem($oFile);
     $oForm->addCommandButton('importCodes', $this->lng->txt('upload'));
     $this->tpl->setVariable('FORM', $oForm->getHTML());
     return true;
 }
 function importExternalMailRecipientsObject($checkonly = false, $formindex = -1)
 {
     global $ilAccess;
     $this->handleWriteAccess();
     $this->setCodesSubtabs();
     $savefields = strcmp($this->ctrl->getCmd(), "importExternalRecipientsFromFile") == 0 || strcmp($this->ctrl->getCmd(), "importExternalRecipientsFromText") == 0 || strcmp($this->ctrl->getCmd(), "importExternalRecipientsFromDataset") == 0 ? TRUE : FALSE;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form_import_file = new ilPropertyFormGUI();
     $form_import_file->setFormAction($this->ctrl->getFormAction($this));
     $form_import_file->setTableWidth("100%");
     $form_import_file->setId("codes_import_file");
     $headerfile = new ilFormSectionHeaderGUI();
     $headerfile->setTitle($this->lng->txt("import_from_file"));
     $form_import_file->addItem($headerfile);
     $externalmails = new ilFileInputGUI($this->lng->txt("externalmails"), "externalmails");
     $externalmails->setInfo($this->lng->txt('externalmails_info'));
     $externalmails->setRequired(true);
     $form_import_file->addItem($externalmails);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_file->addCommandButton("importExternalRecipientsFromFile", $this->lng->txt("import"));
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_file->addCommandButton("codesMail", $this->lng->txt("cancel"));
     }
     // import text
     $form_import_text = new ilPropertyFormGUI();
     $form_import_text->setFormAction($this->ctrl->getFormAction($this));
     $form_import_text->setTableWidth("100%");
     $form_import_text->setId("codes_import_text");
     $headertext = new ilFormSectionHeaderGUI();
     $headertext->setTitle($this->lng->txt("import_from_text"));
     $form_import_text->addItem($headertext);
     $inp = new ilTextAreaInputGUI($this->lng->txt('externaltext'), 'externaltext');
     if (array_key_exists('externaltext', $_SESSION) && strlen($_SESSION['externaltext'])) {
         $inp->setValue($_SESSION['externaltext']);
     } else {
         $inp->setValue($this->lng->txt('mail_import_example1') . "\n" . $this->lng->txt('mail_import_example2') . "\n" . $this->lng->txt('mail_import_example3') . "\n");
     }
     $inp->setRequired(true);
     $inp->setCols(80);
     $inp->setRows(10);
     $inp->setInfo($this->lng->txt('externaltext_info'));
     $form_import_text->addItem($inp);
     unset($_SESSION['externaltext']);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_text->addCommandButton("importExternalRecipientsFromText", $this->lng->txt("import"));
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_text->addCommandButton("codesMail", $this->lng->txt("cancel"));
     }
     // import dataset
     $form_import_dataset = new ilPropertyFormGUI();
     $form_import_dataset->setFormAction($this->ctrl->getFormAction($this));
     $form_import_dataset->setTableWidth("100%");
     $form_import_dataset->setId("codes_import_dataset");
     $headerfile = new ilFormSectionHeaderGUI();
     $headerfile->setTitle($this->lng->txt("import_from_dataset"));
     $form_import_dataset->addItem($headerfile);
     $existingdata = $this->object->getExternalCodeRecipients();
     $existingcolumns = array('email');
     if (count($existingdata)) {
         $first = array_shift($existingdata);
         foreach ($first as $key => $value) {
             if (strcmp($key, 'email') != 0 && strcmp($key, 'code') != 0 && strcmp($key, 'sent') != 0) {
                 array_push($existingcolumns, $key);
             }
         }
     }
     foreach ($existingcolumns as $column) {
         $inp = new ilTextInputGUI($column, $column);
         $inp->setSize(50);
         if (strcmp($column, 'email') == 0) {
             $inp->setRequired(true);
         } else {
             $inp->setRequired(false);
         }
         $form_import_dataset->addItem($inp);
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_dataset->addCommandButton("importExternalRecipientsFromDataset", $this->lng->txt("import"));
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_dataset->addCommandButton("codesMail", $this->lng->txt("cancel"));
     }
     $errors = false;
     if ($savefields) {
         switch ($formindex) {
             case 0:
                 $errors = !$form_import_file->checkInput();
                 $form_import_file->setValuesByPost();
                 if ($errors) {
                     $checkonly = false;
                 }
                 break;
             case 1:
                 $errors = !$form_import_text->checkInput();
                 $form_import_text->setValuesByPost();
                 if ($errors) {
                     $checkonly = false;
                 }
                 break;
             case 2:
                 $errors = !$form_import_dataset->checkInput();
                 $form_import_dataset->setValuesByPost();
                 if ($errors) {
                     $checkonly = false;
                 }
                 break;
         }
     }
     if (!$checkonly) {
         $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_external_mail.html", "Modules/Survey");
         $this->tpl->setVariable("HEADLINE", $this->lng->txt("external_mails_import"));
         $this->tpl->setVariable("FORM1", $form_import_file->getHTML());
         $this->tpl->setVariable("FORM2", $form_import_text->getHTML());
         $this->tpl->setVariable("FORM3", $form_import_dataset->getHTML());
     }
     return $errors;
 }