public function StatutoryRegulationsObject()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'saveStatutoryRegulations'));
     $form->setTitle($this->lng->txt('statutory_regulations'));
     $form->setTableWidth('100%');
     // message
     $post_gui = new ilTextAreaInputGUI($this->lng->txt('content'), 'statutory_regulations');
     $post_gui->setCols(50);
     $post_gui->setRows(15);
     $post_gui->setUseRte(true);
     $post_gui->addPlugin('latex');
     $post_gui->addButton('latex');
     $post_gui->addButton('pastelatex');
     $post_gui->addPlugin('ilimgupload');
     $post_gui->addButton('ilimgupload');
     $post_gui->removePlugin('advlink');
     $post_gui->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
     $post_gui->removePlugin('image');
     $post_gui->usePurifier(true);
     $post_gui->setRTERootBlockElement('');
     $post_gui->setRTESupport(ilObject::_lookupObjId($this->ref_id), 'pays~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7');
     $post_gui->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect', 'image'));
     // purifier
     require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
     require_once 'Services/RTE/classes/class.ilRTE.php';
     $post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
     $post_gui->setValue(ilRTE::_replaceMediaObjectImageSrc($this->genSetData->get('statutory_regulations'), 1));
     $form->addItem($post_gui);
     // show staturaltyio regulations in shoppingcart
     $cb_showShoppingCart = new ilCheckboxInputGUI($this->lng->txt('show_sr_shoppingcart'), 'show_sr_shoppingcart');
     $cb_showShoppingCart->setInfo($this->lng->txt('show_sr_shoppingcart_info'));
     $cb_showShoppingCart->setValue(1);
     $cb_showShoppingCart->setChecked($this->genSetData->get('show_sr_shoppingcart'));
     $form->addItem($cb_showShoppingCart);
     // attach staturaltyio regulations at invoice
     $cb_attachInvoice = new ilCheckboxInputGUI($this->lng->txt('attach_sr_invoice'), 'attach_sr_invoice');
     $cb_attachInvoice->setInfo($this->lng->txt('attach_sr_invoice_info'));
     $cb_attachInvoice->setValue(1);
     $cb_attachInvoice->setChecked($this->genSetData->get('attach_sr_invoice'));
     $form->addItem($cb_attachInvoice);
     $form->addCommandButton('saveStatutoryRegulations', $this->lng->txt('save'));
     $this->tpl->setVariable('FORM', $form->getHTML());
 }
예제 #2
0
 /**
  * Shows the certificate editor for ILIAS tests
  */
 public function certificateEditor()
 {
     global $ilAccess;
     $form_fields = array();
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $form_fields = $this->getFormFieldsFromPOST();
     } else {
         $form_fields = $this->getFormFieldsFromFO();
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setPreventDoubleSubmission(false);
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("certificate_edit"));
     $form->setMultipart(TRUE);
     $form->setTableWidth("100%");
     $form->setId("certificate");
     $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active");
     $active->setChecked($form_fields["active"]);
     $form->addItem($active);
     $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import");
     $import->setRequired(FALSE);
     $import->setSuffixes(array("zip"));
     // handle the certificate import
     if (strlen($_FILES["certificate_import"]["tmp_name"])) {
         if ($import->checkInput()) {
             $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]);
             if ($result == FALSE) {
                 $import->setAlert($this->lng->txt("certificate_error_import"));
             } else {
                 $this->ctrl->redirect($this, "certificateEditor");
             }
         }
     }
     $form->addItem($import);
     $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat");
     $pageformats = $this->object->getPageFormats();
     $pageformat->setValue($form_fields["pageformat"]);
     foreach ($pageformats as $format) {
         $option = new ilRadioOption($format["name"], $format["value"]);
         if (strcmp($format["value"], "custom") == 0) {
             $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight");
             $pageheight->setValue($form_fields["pageheight"]);
             $pageheight->setSize(6);
             $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pageheight->setInfo($this->lng->txt("certificate_unit_description"));
             $pageheight->setRequired(true);
             $option->addSubitem($pageheight);
             $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth");
             $pagewidth->setValue($form_fields["pagewidth"]);
             $pagewidth->setSize(6);
             $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pagewidth->setInfo($this->lng->txt("certificate_unit_description"));
             $pagewidth->setRequired(true);
             $option->addSubitem($pagewidth);
         }
         $pageformat->addOption($option);
     }
     $pageformat->setRequired(true);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $pageformat->checkInput();
     }
     $form->addItem($pageformat);
     $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background");
     $bgimage->setRequired(FALSE);
     $bgimage->setUseCache(false);
     if (count($_POST)) {
         // handle the background upload
         if (strlen($_FILES["background"]["tmp_name"])) {
             if ($bgimage->checkInput()) {
                 $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]);
                 if ($result == FALSE) {
                     $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage"));
                 }
             }
         }
     }
     if (!$this->object->hasBackgroundImage()) {
         include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
         if (ilObjCertificateSettingsAccess::hasBackgroundImage()) {
             $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb());
         }
     } else {
         $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
     }
     $form->addItem($bgimage);
     $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top");
     $padding_top->setRequired(TRUE);
     $padding_top->setValue($form_fields["padding_top"]);
     $padding_top->setSize(6);
     $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
     $padding_top->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $padding_top->checkInput();
     }
     $form->addItem($padding_top);
     $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body");
     $rect->setRequired(TRUE);
     $rect->setUseUnits(TRUE);
     $rect->setTop($form_fields["margin_body_top"]);
     $rect->setBottom($form_fields["margin_body_bottom"]);
     $rect->setLeft($form_fields["margin_body_left"]);
     $rect->setRight($form_fields["margin_body_right"]);
     $rect->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $rect->checkInput();
     }
     $form->addItem($rect);
     $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text");
     $certificate->removePlugin('ilimgupload');
     $certificate->setValue($form_fields["certificate_text"]);
     $certificate->setRequired(TRUE);
     $certificate->setRows(20);
     $certificate->setCols(80);
     // fraunhpatch start
     $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate");
     foreach (ilCertificate::getCustomCertificateFields() as $f) {
         $common_desc_tpl->setCurrentBlock("cert_field");
         $common_desc_tpl->setVariable("PH", $f["ph"]);
         $common_desc_tpl->setVariable("PH_TXT", $f["name"]);
         $common_desc_tpl->parseCurrentBlock();
     }
     $common_desc = $common_desc_tpl->get();
     // fraunhpatch start
     $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc);
     $certificate->setUseRte(TRUE, '3.4.7');
     $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul");
     $certificate->setRteTags($tags);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $certificate->checkInput();
     }
     $form->addItem($certificate);
     $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         if ($this->object->isComplete() || $this->object->hasBackgroundImage()) {
             $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview"));
             $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export"));
             $form->addCommandButton("certificateDelete", $this->lng->txt("delete"));
         }
         $form->addCommandButton("certificateSave", $this->lng->txt("save"));
     }
     $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         if ($_POST["background_delete"]) {
             $this->object->deleteBackgroundImage();
         }
         if ($form->checkInput()) {
             try {
                 $xslfo = $this->object->processXHTML2FO($form_fields);
                 $this->object->getAdapter()->saveFormFields($form_fields);
                 $this->object->saveCertificate($xslfo);
                 $this->object->writeActive($form_fields["active"]);
                 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE);
                 $this->ctrl->redirect($this, "certificateEditor");
             } catch (Exception $e) {
                 ilUtil::sendFailure($e->getMessage());
             }
         }
     }
 }
예제 #3
0
 private function initTopicCreateForm()
 {
     /**
      * @var $ilUser ilObjUser
      * @var $rbacsystem ilRbacSystem
      * @var $ilias ILIAS
      * @var $ilSetting ilSetting
      */
     global $ilUser, $rbacsystem, $ilias, $ilSetting;
     $this->create_topic_form_gui = new ilPropertyFormGUI();
     $this->create_topic_form_gui->setTitle($this->lng->txt('forums_new_thread'));
     $this->create_topic_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
     $this->create_topic_form_gui->setTableWidth('100%');
     // form action
     $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'addThread'));
     if ($this->objProperties->isAnonymized() == 1) {
         $alias_gui = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias');
         $alias_gui->setInfo($this->lng->txt('forums_use_alias'));
         $alias_gui->setMaxLength(255);
         $alias_gui->setSize(50);
         $this->create_topic_form_gui->addItem($alias_gui);
     } else {
         $alias_gui = new ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias');
         $alias_gui->setValue($ilUser->getLogin());
         $this->create_topic_form_gui->addItem($alias_gui);
     }
     // topic
     $subject_gui = new ilTextInputGUI($this->lng->txt('forums_thread'), 'subject');
     $subject_gui->setMaxLength(255);
     $subject_gui->setSize(50);
     $subject_gui->setRequired(true);
     $this->create_topic_form_gui->addItem($subject_gui);
     // message
     $post_gui = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message');
     $post_gui->setCols(50);
     $post_gui->setRows(15);
     $post_gui->setRequired(true);
     $post_gui->setUseRte(true);
     $post_gui->addPlugin('latex');
     $post_gui->addButton('latex');
     $post_gui->addButton('pastelatex');
     $post_gui->addPlugin('ilfrmquote');
     //$post_gui->addPlugin('code');
     $post_gui->removePlugin('advlink');
     $post_gui->usePurifier(true);
     $post_gui->setRTERootBlockElement('');
     $post_gui->setRTESupport($ilUser->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7');
     $post_gui->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect'));
     // purifier
     require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
     $post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
     $this->create_topic_form_gui->addItem($post_gui);
     // file
     $fi = new ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile');
     $fi->setFilenames(array(0 => ''));
     $this->create_topic_form_gui->addItem($fi);
     include_once 'Services/Mail/classes/class.ilMail.php';
     $umail = new ilMail($ilUser->getId());
     // catch hack attempts
     if ($rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId()) && !$this->objProperties->isAnonymized()) {
         // direct notification
         $dir_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify');
         $dir_notification_gui->setInfo($this->lng->txt('forum_notify_me_directly'));
         $dir_notification_gui->setValue(1);
         $this->create_topic_form_gui->addItem($dir_notification_gui);
         if ($ilias->getSetting('forum_notification') != 0) {
             // gen. notification
             $gen_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_general_notification'), 'notify_posts');
             $gen_notification_gui->setInfo($this->lng->txt('forum_notify_me_generally'));
             $gen_notification_gui->setValue(1);
             $this->create_topic_form_gui->addItem($gen_notification_gui);
         }
     }
     require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
     if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) {
         require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
         $captcha = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
         $captcha->setRequired(true);
         $this->create_topic_form_gui->addItem($captcha);
     }
     $this->create_topic_form_gui->addCommandButton('addThread', $this->lng->txt('create'));
     $this->create_topic_form_gui->addCommandButton('showThreads', $this->lng->txt('cancel'));
 }
 protected function initHeadingForm($a_question_id = null)
 {
     $survey_questions = $this->object->getSurveyQuestions();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, ""));
     // heading
     $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
     $heading->setRows(10);
     $heading->setCols(80);
     $heading->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
     $heading->setRTESupport($this->object->getId(), "svy", "survey");
     $heading->setRequired(true);
     $form->addItem($heading);
     $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
     $options = array();
     foreach ($survey_questions as $key => $value) {
         $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
     }
     $insertbefore->setOptions($options);
     $insertbefore->setRequired(true);
     $form->addItem($insertbefore);
     $form->addCommandButton("saveHeading", $this->lng->txt("save"));
     $form->addCommandButton("questions", $this->lng->txt("cancel"));
     if ($a_question_id) {
         $form->setTitle($this->lng->txt("edit_heading"));
         $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"]));
         $insertbefore->setValue($a_question_id);
         $insertbefore->setDisabled(true);
     } else {
         $form->setTitle($this->lng->txt("add_heading"));
     }
     return $form;
 }
 /**
 * Creates a form to add a heading to a survey
 *
 * @param integer $question_id The id of the question directly after the heading. If the id is given, an existing heading will be edited
 * @access public
 */
 function addHeadingObject($checkonly = false, $question_id = "")
 {
     $this->questionsSubtabs("questions");
     global $ilAccess;
     $save = strcmp($this->ctrl->getCmd(), "saveHeading") == 0 ? TRUE : FALSE;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("survey_heading");
     // general properties
     $header = new ilFormSectionHeaderGUI();
     if ($question_id) {
         $header->setTitle($this->lng->txt("edit_heading"));
     } else {
         $header->setTitle($this->lng->txt("add_heading"));
     }
     $form->addItem($header);
     $survey_questions =& $this->object->getSurveyQuestions();
     // heading
     $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
     $heading->setValue($this->object->prepareTextareaOutput(array_key_exists('heading', $_POST) ? $_POST['heading'] : $survey_questions[$question_id]["heading"]));
     $heading->setRows(10);
     $heading->setCols(80);
     $heading->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
     $heading->setRTESupport($this->object->getId(), "svy", "survey", null, false, "3.4.7");
     $heading->setRequired(true);
     $form->addItem($heading);
     $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
     $options = array();
     foreach ($survey_questions as $key => $value) {
         $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
     }
     $insertbefore->setOptions($options);
     $insertbefore->setValue(array_key_exists('insertbefore', $_REQUEST) ? $_REQUEST['insertbefore'] : $question_id);
     $insertbefore->setRequired(true);
     if ($question_id || array_key_exists('insertbefore', $_REQUEST)) {
         $insertbefore->setDisabled(true);
     }
     $form->addItem($insertbefore);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form->addCommandButton("saveHeading", $this->lng->txt("save"));
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form->addCommandButton("cancelHeading", $this->lng->txt("cancel"));
     }
     $errors = false;
     if ($save) {
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }