/** 
  * Concrete function which builds a html purifier config instance
  * 
  * @access	protected
  * @return	HTMLPurifier_Config Instance of HTMLPurifier_Config
  * 
  */
 protected function getPurifierConfigInstance()
 {
     include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
     $config = HTMLPurifier_Config::createDefault();
     $config->set('HTML.DefinitionID', 'ilias forum post');
     $config->set('HTML.DefinitionRev', 1);
     $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
     $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
     $tags = ilObjAdvancedEditing::_getUsedHTMLTags(self::$_type);
     $tags = $this->makeElementListTinyMceCompliant($tags);
     $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
     $config->set('HTML.ForbiddenAttributes', 'div@style');
     if ($def = $config->maybeGetRawHTMLDefinition()) {
         $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
     }
     return $config;
 }
 /** 
  * Concrete function which builds a html purifier config instance
  * 
  * @access	protected
  * @return	HTMLPurifier_Config Instance of HTMLPurifier_Config
  * 
  */
 protected function getPurifierConfigInstance()
 {
     include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
     $config = HTMLPurifier_Config::createDefault();
     $config->set('HTML.DefinitionID', 'ilias forum post');
     $config->set('HTML.DefinitionRev', 1);
     $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
     $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
     // Bugfix #5945: Necessary because TinyMCE does not use the "u"
     // html element but <span style="text-decoration: underline">E</span>
     $tags = ilObjAdvancedEditing::_getUsedHTMLTags(self::$_type);
     if (in_array('u', $tags) && !in_array('span', $tags)) {
         $tags[] = 'span';
     }
     $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
     $config->set('HTML.ForbiddenAttributes', 'div@style');
     if ($def = $config->maybeGetRawHTMLDefinition()) {
         $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
     }
     return $config;
 }
 /**
  * builds and returns a form property gui object with the given label and postvar
  * that is addable to property forms
  * depending on the given flag "asNonEditable" it returns a ...
  * - non editable gui
  * - textarea input gui
  * 
  * @final
  * @access protected
  * @param string $label
  * @param string $postVar
  * @param boolean $asNonEditable
  * @return ilTextAreaInputGUI|ilNonEditableValueGUI $formProperty
  */
 protected final function buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
 {
     if ($asNonEditable) {
         require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
         $property = new ilNonEditableValueGUI($label, $postVar, true);
     } else {
         require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
         require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
         $property = new ilTextAreaInputGUI($label, $postVar);
         $property->setRequired(false);
         $property->setRows(10);
         $property->setCols(80);
         if (!$this->questionOBJ->getPreventRteUsage()) {
             $property->setUseRte(true);
             $property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $property->addPlugin("latex");
             $property->addButton("latex");
             $property->addButton("pastelatex");
         }
         $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
     }
     return $property;
 }
 protected function initEditForm()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "save"));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     // $form->setId("essay");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey");
     $form->addItem($question);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     $this->addFieldsToEditForm($form);
     $this->addCommandButtons($form);
     // values
     $title->setValue($this->object->getTitle());
     $label->setValue($this->object->label);
     $author->setValue($this->object->getAuthor());
     $description->setValue($this->object->getDescription());
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $shuffle->setChecked($this->object->getObligatory());
     return $form;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("multiplechoice");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setValue($this->object->label);
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setValue($this->object->getAuthor());
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setValue($this->object->getDescription());
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
     $form->addItem($question);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getObligatory());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     // orientation
     $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation");
     $orientation->setRequired(false);
     $orientation->setValue($this->object->getOrientation());
     $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0));
     $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1));
     $form->addItem($orientation);
     // minimum answers
     $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers");
     $minanswers->setValue(1);
     $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option"));
     $minanswers->setChecked($this->object->use_min_answers);
     $minanswers->setRequired(FALSE);
     $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers");
     $nranswers->setSize(5);
     $nranswers->setDecimals(0);
     $nranswers->setRequired(false);
     $nranswers->setMinValue(1);
     $nranswers->setValue($this->object->nr_min_answers);
     $minanswers->addSubItem($nranswers);
     $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers");
     $nrmaxanswers->setSize(5);
     $nrmaxanswers->setDecimals(0);
     $nrmaxanswers->setRequired(false);
     $nrmaxanswers->setMinValue(1);
     $nrmaxanswers->setValue($this->object->nr_max_answers);
     $minanswers->addSubItem($nrmaxanswers);
     $form->addItem($minanswers);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers");
     $answers->setRequired(false);
     $answers->setAllowMove(true);
     $answers->setShowWizard(false);
     $answers->setShowSavePhrase(false);
     $answers->setUseOtherAnswer(true);
     $answers->setShowNeutralCategory(true);
     $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer'));
     if (!$this->object->getCategories()->getCategoryCount()) {
         $this->object->getCategories()->addCategory("");
     }
     $answers->setValues($this->object->getCategories());
     $answers->setDisabledScale(false);
     $form->addItem($answers);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand()) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($nranswers->getValue() > $answers->getCategoryCount()) {
             $nrmaxanswers->setAlert($this->lng->txt('err_minvalueganswers'));
             if (!$errors) {
                 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
             }
             $errors = true;
         }
         if ($nrmaxanswers->getValue() > 0 && ($nrmaxanswers->getValue() > $answers->getCategoryCount() || $nrmaxanswers->getValue() < $nranswers->getValue())) {
             $nrmaxanswers->setAlert($this->lng->txt('err_maxvaluegeminvalue'));
             if (!$errors) {
                 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
             }
             $errors = true;
         }
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
 * 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;
 }
示例#7
0
 function updateAssignmentTextObject($a_return = false)
 {
     global $ilCtrl, $ilUser;
     $times_up = $this->ass->getDeadline() && $this->ass->getDeadline() - time() < 0;
     if (!$this->ass || $this->ass->getType() != ilExAssignment::TYPE_TEXT || $times_up) {
         if ($times_up) {
             ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
         }
         $ilCtrl->redirect($this, "showOverview");
     }
     $this->checkPermission("read");
     $form = $this->initAssignmentTextForm($this->ass);
     // we are not using a purifier, so we have to set the valid RTE tags
     // :TODO:
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $rte = $form->getItemByPostVar("atxt");
     $rte->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("exc_ass"));
     if ($form->checkInput()) {
         $text = trim($form->getInput("atxt"));
         $existing = (bool) ilExAssignment::getDeliveredFiles($this->ass->getExerciseId(), $this->ass->getId(), $ilUser->getId());
         $returned_id = $this->object->updateTextSubmission($this->ass->getExerciseId(), $this->ass->getId(), $ilUser->getId(), ilRTE::_replaceMediaObjectImageSrc($text, 0));
         // no empty text
         if ($returned_id) {
             if (!$existing) {
                 // #14332 - new text
                 $this->sendNotifications($this->ass->getId());
                 $this->object->handleSubmission($this->ass->getId());
             }
             // mob usage
             include_once "Services/MediaObjects/classes/class.ilObjMediaObject.php";
             $mobs = ilRTE::_getMediaObjects($text, 0);
             foreach ($mobs as $mob) {
                 if (ilObjMediaObject::_exists($mob)) {
                     ilObjMediaObject::_removeUsage($mob, 'exca~:html', $ilUser->getId());
                     ilObjMediaObject::_saveUsage($mob, 'exca:html', $returned_id);
                 }
             }
         }
         ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
         if ($a_return) {
             $ilCtrl->redirect($this, "showOverview");
         } else {
             $ilCtrl->redirect($this, "editAssignmentText");
         }
     }
     $form->setValuesByPost();
     $this->editAssignmentTextObject($form);
 }
 /**
  * builds the questions hints form
  * 
  * @access	private
  * @global	ilCtrl				$ilCtrl
  * @global	ilLanguage			$lng
  * @return	ilPropertyFormGUI	$form
  */
 private function buildForm(ilAssQuestionHint $questionHint = null)
 {
     global $ilCtrl, $lng;
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
     require_once 'Services/Form/classes/class.ilNumberInputGUI.php';
     require_once 'Services/Form/classes/class.ilHiddenInputGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTableWidth('100%');
     if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
         // form input: hint text
         $areaInp = new ilTextAreaInputGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text');
         $areaInp->setRequired(true);
         $areaInp->setRows(10);
         $areaInp->setCols(80);
         if (!$this->questionOBJ->getPreventRteUsage()) {
             $areaInp->setUseRte(true);
         }
         include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
         $areaInp->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
         $areaInp->setRTESupport($this->questionOBJ->getId(), 'qpl', 'assessment');
         $areaInp->addPlugin("latex");
         $areaInp->addButton("latex");
         $areaInp->addButton("pastelatex");
         $form->addItem($areaInp);
     }
     // form input: hint points
     $numInp = new ilNumberInputGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
     $numInp->allowDecimals(true);
     $numInp->setRequired(true);
     $numInp->setSize(3);
     $form->addItem($numInp);
     if ($questionHint instanceof ilAssQuestionHint) {
         // build form title for an existing hint
         $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_edit'), $questionHint->getIndex(), $this->questionOBJ->getTitle()));
         // hidden input: hint id
         $hiddenInp = new ilHiddenInputGUI('hint_id');
         $form->addItem($hiddenInp);
         // init values
         require_once 'Services/Utilities/classes/class.ilUtil.php';
         if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
             $areaInp->setValue(ilUtil::prepareTextareaOutput($questionHint->getText(), true));
         }
         $numInp->setValue($questionHint->getPoints());
         $hiddenInp->setValue($questionHint->getId());
     } else {
         // build form title for a new hint
         $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_create'), $this->questionOBJ->getTitle()));
     }
     if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
         if ($questionHint instanceof ilAssQuestionHint) {
             $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points');
         } else {
             $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points_and_edit_page');
         }
     } else {
         $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save');
     }
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->addCommandButton(self::CMD_CANCEL_FORM, $lng->txt('cancel'));
     $form->addCommandButton(self::CMD_SAVE_FORM, $saveCmdLabel);
     return $form;
 }
示例#9
0
 /**
  * Init survey settings form
  * 
  * @return ilPropertyFormGUI
  */
 function initPropertiesForm()
 {
     $template_settings = $hide_rte_switch = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template);
         $template_settings = $template->getSettings();
         $hide_rte_switch = $template_settings["rte_switch"]["hide"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("survey_properties");
     // general properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("settings"));
     $form->addItem($header);
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->object->getId(), 0, "svy");
     $md_section = $md_obj->getGeneral();
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(true);
     $title->setValue($md_section->getTitle());
     $form->addItem($title);
     $ids = $md_section->getDescriptionIds();
     if ($ids) {
         $desc_obj = $md_section->getDescription(array_pop($ids));
         $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
         $desc->setCols(50);
         $desc->setRows(4);
         $desc->setValue($desc_obj->getDescription());
         $form->addItem($desc);
     }
     // pool usage
     $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
     $pool_usage->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
     $pool_usage->addOption($opt);
     $pool_usage->setValue($this->object->getPoolUsage());
     $form->addItem($pool_usage);
     // 360°: appraisees
     if ($this->object->get360Mode()) {
         $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
         $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info"));
         $self_eval->setChecked($this->object->get360SelfEvaluation());
         $form->addItem($self_eval);
         $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
         $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info"));
         $self_rate->setChecked($this->object->get360SelfRaters());
         $form->addItem($self_rate);
         $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
         $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info"));
         $self_appr->setChecked($this->object->get360SelfAppraisee());
         $form->addItem($self_appr);
     }
     // activation
     include_once "Services/Object/classes/class.ilObjectActivation.php";
     $this->lng->loadLanguageModule('rep');
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $form->addItem($section);
     // additional info only with multiple references
     $act_obj_info = $act_ref_info = "";
     if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
         $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
         $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
     }
     $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
     $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
     $online->setChecked($this->object->isOnline());
     $form->addItem($online);
     $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type');
     // $act_type->setInfo($this->lng->txt('svy_availability_until_info'));
     $act_type->setChecked($this->object->isActivationLimited());
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
     $dur->setShowTime(true);
     $date = $this->object->getActivationStartDate();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->object->getActivationEndDate();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $act_type->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
     $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info'));
     $visible->setChecked($this->object->getActivationVisibility());
     $act_type->addSubItem($visible);
     $form->addItem($act_type);
     // before start
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_before_start'));
     $form->addItem($section);
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction");
     $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->setInfo($this->lng->txt("survey_introduction_info"));
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->addButton("pastelatex");
     $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($intro);
     // access
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_access'));
     $form->addItem($section);
     // enable start date
     $start = $this->object->getStartDate();
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date");
     $enablestartingtime->setValue(1);
     // $enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     $enablestartingtime->setChecked($start);
     // start date
     $startingtime = new ilDateTimeInputGUI('', 'start_date');
     $startingtime->setShowTime(true);
     if ($start) {
         $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     // enable end date
     $end = $this->object->getEndDate();
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date");
     $enableendingtime->setValue(1);
     // $enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     $enableendingtime->setChecked($end);
     // end date
     $endingtime = new ilDateTimeInputGUI('', 'end_date');
     $endingtime->setShowTime(true);
     if ($end) {
         $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // anonymization
     if (!$this->object->get360Mode()) {
         $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes");
         $codes->setInfo($this->lng->txt("survey_access_codes_info"));
         $codes->setChecked(!$this->object->isAccessibleWithoutCode());
         $form->addItem($codes);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $codes->setDisabled(true);
         }
     }
     // question behaviour
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour'));
     $form->addItem($section);
     // show question titles
     $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles");
     $show_question_titles->setValue(1);
     $show_question_titles->setChecked($this->object->getShowQuestionTitles());
     $form->addItem($show_question_titles);
     // finishing
     $info = new ilFormSectionHeaderGUI();
     $info->setTitle($this->lng->txt("svy_settings_section_finishing"));
     $form->addItem($info);
     $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own");
     $view_own->setInfo($this->lng->txt("svy_results_view_own_info"));
     $view_own->setChecked($this->object->hasViewOwnResults());
     $form->addItem($view_own);
     $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own");
     $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info"));
     $mail_own->setChecked($this->object->hasMailOwnResults());
     $form->addItem($mail_own);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro");
     $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->addButton("pastelatex");
     $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($finalstatement);
     // mail notification
     $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification");
     // $mailnotification->setOptionTitle($this->lng->txt("activate"));
     $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info"));
     // #11762
     $mailnotification->setValue(1);
     $mailnotification->setChecked($this->object->getMailNotification());
     // addresses
     $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses");
     $mailaddresses->setValue($this->object->getMailAddresses());
     $mailaddresses->setSize(80);
     $mailaddresses->setInfo($this->lng->txt('mailaddresses_info'));
     $mailaddresses->setRequired(true);
     // participant data
     $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata");
     $participantdata->setValue($this->object->getMailParticipantData());
     $participantdata->setRows(6);
     $participantdata->setCols(80);
     $participantdata->setUseRte(false);
     $participantdata->setInfo($this->lng->txt("mailparticipantdata_info"));
     // #12755 - because of privacy concerns we restrict user data to a minimum
     $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login");
     $txt = array();
     foreach ($placeholders as $placeholder => $caption) {
         $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption);
     }
     $txt = implode("<br />", $txt);
     $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true);
     $participantdatainfo->setValue($txt);
     $mailnotification->addSubItem($mailaddresses);
     $mailnotification->addSubItem($participantdata);
     $mailnotification->addSubItem($participantdatainfo);
     $form->addItem($mailnotification);
     // tutor notification - currently not available for 360°
     if (!$this->object->get360Mode()) {
         // parent course?
         global $tree;
         $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp");
         if (!$has_parent) {
             $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs");
         }
         $num_inv = sizeof($this->object->getInvitedUsers());
         // notification
         $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut");
         $tut->setChecked($this->object->getTutorNotificationStatus());
         $form->addItem($tut);
         $tut_logins = array();
         $tuts = $this->object->getTutorNotificationRecipients();
         if ($tuts) {
             foreach ($tuts as $tut_id) {
                 $tmp = ilObjUser::_lookupName($tut_id);
                 if ($tmp["login"]) {
                     $tut_logins[] = $tmp["login"];
                 }
             }
         }
         $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids");
         $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
         $tut_ids->setRequired(true);
         $tut_ids->setMulti(true);
         $tut_ids->setMultiValues($tut_logins);
         $tut_ids->setValue(array_shift($tut_logins));
         $tut->addSubItem($tut_ids);
         $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp");
         $tut_grp->setRequired(true);
         $tut_grp->setValue($this->object->getTutorNotificationTarget());
         $tut->addSubItem($tut_grp);
         $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $tut_grp->addOption($tut_grp_crs);
         $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $tut_grp->addOption($tut_grp_inv);
     }
     // reminders
     // reminder - currently not available for 360°
     if (!$this->object->get360Mode()) {
         $info = new ilFormSectionHeaderGUI();
         $info->setTitle($this->lng->txt("svy_settings_section_reminders"));
         $form->addItem($info);
         $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd");
         $rmd->setChecked($this->object->getReminderStatus());
         $form->addItem($rmd);
         $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start");
         $rmd_start->setRequired(true);
         $start = $this->object->getReminderStart();
         if ($start) {
             $rmd_start->setDate($start);
         }
         $rmd->addSubItem($rmd_start);
         $end = $this->object->getReminderEnd();
         $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end");
         $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end);
         if ($end) {
             $rmd_end->setDate($end);
         }
         $rmd->addSubItem($rmd_end);
         $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq");
         $rmd_freq->setRequired(true);
         $rmd_freq->setSize(3);
         $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days"));
         $rmd_freq->setValue($this->object->getReminderFrequency());
         $rmd_freq->setMinValue(1);
         $rmd->addSubItem($rmd_freq);
         $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp");
         $rmd_grp->setRequired(true);
         $rmd_grp->setValue($this->object->getReminderTarget());
         $rmd->addSubItem($rmd_grp);
         $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $rmd_grp->addOption($rmd_grp_crs);
         $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $rmd_grp->addOption($rmd_grp_inv);
     }
     // results
     $results = new ilFormSectionHeaderGUI();
     $results->setTitle($this->lng->txt("results"));
     $form->addItem($results);
     // evaluation access
     if (!$this->object->get360Mode()) {
         $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access");
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_off_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_all_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info"));
         $evaluation_access->addOption($option);
         $evaluation_access->setValue($this->object->getEvaluationAccess());
         $form->addItem($evaluation_access);
         $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options");
         $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers");
         $option->setInfo($this->lng->txt("survey_results_personalized_info"));
         $anonymization_options->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon");
         $option->setInfo($this->lng->txt("survey_results_anonymized_info"));
         $anonymization_options->addOption($option);
         $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers");
         $form->addItem($anonymization_options);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $anonymization_options->setDisabled(true);
         }
     } else {
         $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res");
         $ts_results->setValue($this->object->get360Results());
         $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE);
         $option->setInfo($this->lng->txt("survey_360_results_none_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN);
         $option->setInfo($this->lng->txt("survey_360_results_own_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL);
         $option->setInfo($this->lng->txt("survey_360_results_all_info"));
         $ts_results->addOption($option);
         $form->addItem($ts_results);
     }
     // competence service activation for 360 mode
     include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php";
     $skmg_set = new ilSkillManagementSettings();
     if ($this->object->get360Mode() && $skmg_set->isActivated()) {
         $other = new ilFormSectionHeaderGUI();
         $other->setTitle($this->lng->txt("other"));
         $form->addItem($other);
         $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service");
         $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info"));
         $skill_service->setChecked($this->object->get360SkillService());
         $form->addItem($skill_service);
     }
     $form->addCommandButton("saveProperties", $this->lng->txt("save"));
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
 function addBasicQuestionFormProperties($form)
 {
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // author
         $author = new ilTextInputGUI($this->lng->txt("author"), "author");
         $author->setValue($this->object->getAuthor());
         $author->setRequired(TRUE);
         $form->addItem($author);
         // description
         $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
         $description->setValue($this->object->getComment());
         $description->setRequired(FALSE);
         $form->addItem($description);
     } else {
         // author as hidden field
         $hi = new ilHiddenInputGUI("author");
         $author = ilUtil::prepareFormOutput($this->object->getAuthor());
         if (trim($author) == "") {
             $author = "-";
         }
         $hi->setValue($author);
         $form->addItem($hi);
     }
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) {
             $question->setUseRte(TRUE);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $question->addPlugin("latex");
             $question->addButton("latex");
             $question->addButton("pastelatex");
             $question->setRTESupport($this->object->getId(), "qpl", "assessment");
         }
     } else {
         $question->setRteTags(self::getSelfAssessmentTags());
         $question->setUseTagsForRteOnly(false);
     }
     $form->addItem($question);
     $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
     $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps'));
     $tpl->parseCurrentBlock();
     $button = new ilCustomInputGUI('&nbsp;', '');
     $button->setHtml($tpl->get());
     $form->addItem($button);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // duration
         $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
         $duration->setShowHours(TRUE);
         $duration->setShowMinutes(TRUE);
         $duration->setShowSeconds(TRUE);
         $ewt = $this->object->getEstimatedWorkingTime();
         $duration->setHours($ewt["h"]);
         $duration->setMinutes($ewt["m"]);
         $duration->setSeconds($ewt["s"]);
         $duration->setRequired(FALSE);
         $form->addItem($duration);
     } else {
         // number of tries
         if (strlen($this->object->getNrOfTries())) {
             $nr_tries = $this->object->getNrOfTries();
         } else {
             $nr_tries = $this->object->getDefaultNrOfTries();
         }
         /*if ($nr_tries <= 0)
         		{
         			$nr_tries = 1;
         		}*/
         if ($nr_tries < 0) {
             $nr_tries = 0;
         }
         $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
         $ni->setValue($nr_tries);
         //$ni->setMinValue(1);
         $ni->setMinValue(0);
         $ni->setSize(5);
         $ni->setMaxLength(5);
         $ni->setRequired(true);
         $form->addItem($ni);
     }
 }
 /**
  * add the properties of a question part to the form
  *
  * @param object    form object to extend
  * @param object    question part object
  * @param integer    counter of the question part
  */
 private function initPartProperties($form, $part_obj = null, $counter = "1")
 {
     // Use a dummy part object for a new booking definition
     if (!isset($part_obj)) {
         $part_obj = new assAccountingQuestionPart($this->object);
     }
     // Part identifier (is 0 for a new part)
     $item = new ilHiddenInputGUI("parts[]");
     $item->setValue($part_obj->getPartId());
     $form->addItem($item);
     // Title
     $item = new ilFormSectionHeaderGUI();
     $item->setTitle($this->plugin->txt('accounting_table') . ' ' . $counter);
     $form->addItem($item);
     // Position
     $item = new ilNumberInputGUI($this->plugin->txt('position'), 'position_' . $part_obj->getPartId());
     $item->setSize(2);
     $item->setDecimals(1);
     $item->SetInfo($this->plugin->txt('position_info'));
     if ($part_obj->getPartId()) {
         $item->setValue(sprintf("%01.1f", $part_obj->getPosition()));
     }
     $form->addItem($item);
     // Text
     $item = new ilTextAreaInputGUI($this->plugin->txt("question_part"), 'text_' . $part_obj->getPartId());
     $item->setValue($this->object->prepareTextareaOutput($part_obj->getText()));
     $item->setRows(10);
     $item->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $item->setUseRte(TRUE);
         include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
         $item->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
         $item->addPlugin("latex");
         $item->addButton("latex");
         $item->addButton("pastelatex");
         $item->setRTESupport($this->object->getId(), "qpl", "assessment");
     } else {
         $item->setRteTags(self::getSelfAssessmentTags());
         $item->setUseTagsForRteOnly(false);
     }
     $form->addItem($item);
     // Booking XML definition
     $item = new ilCustomInputGUI($this->plugin->txt('booking_xml'));
     $item->setInfo($this->plugin->txt('booking_xml_info'));
     $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_edit_xml.html');
     $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($part_obj->getBookingXML()));
     $tpl->setVariable("NAME", 'booking_xml_' . $part_obj->getPartId());
     $item->setHTML($tpl->get());
     // Booking file
     $subitem = new ilFileInputGUI($this->plugin->txt('booking_file'), "booking_file_" . $part_obj->getPartId());
     $subitem->setSuffixes(array('xml'));
     $item->addSubItem($subitem);
     // Download button
     if (strlen($part_obj->getBookingXML())) {
         $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html');
         $this->ctrl->setParameter($this, 'xmltype', 'booking');
         $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId());
         $tpl->setCurrentBlock('button');
         $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'downloadXml'));
         $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('download_booking_xml'));
         $tpl->ParseCurrentBlock();
         $subitem = new ilcustomInputGUI('');
         $subitem->setHTML($tpl->get());
         $item->addSubItem($subitem);
     }
     $form->addItem($item);
     // Delete Button
     if ($part_obj->getPartId()) {
         $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html');
         $tpl->setCurrentBlock('button');
         $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId());
         $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'deletePart'));
         $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('delete_accounting_table'));
         $tpl->ParseCurrentBlock();
         $item = new ilcustomInputGUI();
         $item->setHTML($tpl->get());
         $form->addItem($item);
     }
 }
示例#12
0
 public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
 {
     // cloze text
     $cloze_text = new ilTextAreaInputGUI($this->lng->txt("cloze_text"), 'cloze_text');
     $cloze_text->setRequired(true);
     $cloze_text->setValue($this->applyIndizesToGapText($this->object->getClozeText()));
     $cloze_text->setInfo($this->lng->txt("close_text_hint"));
     $cloze_text->setRows(10);
     $cloze_text->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) {
             $cloze_text->setUseRte(TRUE);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $cloze_text->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $cloze_text->addPlugin("latex");
             $cloze_text->addButton("latex");
             $cloze_text->addButton("pastelatex");
         }
     } else {
         $cloze_text->setUseRte(TRUE);
         $cloze_text->setRteTags(self::getSelfAssessmentTags());
         $cloze_text->setUseTagsForRteOnly(false);
     }
     $cloze_text->setRTESupport($this->object->getId(), "qpl", "assessment");
     $form->addItem($cloze_text);
     $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
     $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps'));
     $tpl->parseCurrentBlock();
     $button = new ilCustomInputGUI('&nbsp;', '');
     $button->setHtml($tpl->get());
     $form->addItem($button);
     // text rating
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "textgap_rating");
         $text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive"), "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"), "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"), "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"), "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"), "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"));
         $textrating->setOptions($text_options);
         $textrating->setValue($this->object->getTextgapRating());
         $form->addItem($textrating);
         // text field length
         $fixedTextLength = new ilNumberInputGUI($this->lng->txt("cloze_fixed_textlength"), "fixedTextLength");
         $ftl = $this->object->getFixedTextLength();
         $fixedTextLength->setValue($ftl > 0 ? $ftl : '');
         $fixedTextLength->setMinValue(0);
         $fixedTextLength->setSize(3);
         $fixedTextLength->setMaxLength(6);
         $fixedTextLength->setInfo($this->lng->txt('cloze_fixed_textlength_description'));
         $fixedTextLength->setRequired(false);
         $form->addItem($fixedTextLength);
         // identical scoring
         $identical_scoring = new ilCheckboxInputGUI($this->lng->txt("identical_scoring"), "identical_scoring");
         $identical_scoring->setValue(1);
         $identical_scoring->setChecked($this->object->getIdenticalScoring());
         $identical_scoring->setInfo($this->lng->txt('identical_scoring_desc'));
         $identical_scoring->setRequired(FALSE);
         $form->addItem($identical_scoring);
     }
     return $form;
 }
示例#13
0
 /**
  * Creates the output of the feedback page for a single choice question
  *
  * @access public
  */
 function feedback($checkonly = false)
 {
     $save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('feedback_answers'));
     $form->setTableWidth("100%");
     $form->setId("feedback");
     $complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete");
     $complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
     $complete->setRequired(falsse);
     $complete->setRows(10);
     $complete->setCols(80);
     $complete->setUseRte(true);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $complete->addPlugin("latex");
     $complete->addButton("latex");
     $complete->addButton("pastelatex");
     $complete->setRTESupport($this->object->getId(), "qpl", "assessment");
     $form->addItem($complete);
     $incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete");
     $incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
     $incomplete->setRequired(false);
     $incomplete->setRows(10);
     $incomplete->setCols(80);
     $incomplete->setUseRte(true);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $incomplete->addPlugin("latex");
     $incomplete->addButton("latex");
     $incomplete->addButton("pastelatex");
     $incomplete->setRTESupport($this->object->getId(), "qpl", "assessment");
     $form->addItem($incomplete);
     if (!$this->getSelfAssessmentEditingMode()) {
         foreach ($this->object->answers as $index => $answer) {
             $answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($answer->getAnswertext(), true), "feedback_answer_{$index}");
             $answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSyntaxTree($index)));
             $answerobj->setRequired(false);
             $answerobj->setRows(10);
             $answerobj->setCols(80);
             $answerobj->setUseRte(true);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $answerobj->addPlugin("latex");
             $answerobj->addButton("latex");
             $answerobj->addButton("pastelatex");
             $answerobj->setRTESupport($this->object->getId(), "qpl", "assessment");
             $form->addItem($answerobj);
         }
     }
     $form->addCommandButton("saveFeedback", $this->lng->txt("save"));
     if ($save) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("multiplechoice");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setValue($this->object->label);
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setValue($this->object->getAuthor());
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setValue($this->object->getDescription());
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
     $form->addItem($question);
     // subtype
     $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
     $subtype->setRequired(true);
     $subtype->setValue($this->object->getSubtype());
     $form->addItem($subtype);
     // #10652
     $opt = new ilRadioOption($this->lng->txt('non_ratio'), 3, $this->lng->txt("metric_subtype_description_interval"));
     $subtype->addOption($opt);
     // minimum value
     $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3");
     if ($this->object->getSubtype() == 3) {
         $minimum->setValue($this->object->getMinimum());
     }
     $minimum->setRequired(false);
     $minimum->setSize(6);
     $opt->addSubItem($minimum);
     // maximum value
     $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3");
     if ($this->object->getSubtype() == 3) {
         $maximum->setValue($this->object->getMaximum());
     }
     $maximum->setRequired(false);
     $maximum->setSize(6);
     $opt->addSubItem($maximum);
     $opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), 4, $this->lng->txt("metric_subtype_description_rationonabsolute"));
     $subtype->addOption($opt);
     // minimum value
     $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4");
     if ($this->object->getSubtype() == 4) {
         $minimum->setValue($this->object->getMinimum());
     }
     $minimum->setRequired(false);
     $minimum->setSize(6);
     $minimum->setMinValue(0);
     $opt->addSubItem($minimum);
     // maximum value
     $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4");
     if ($this->object->getSubtype() == 4) {
         $maximum->setValue($this->object->getMaximum());
     }
     $maximum->setRequired(false);
     $maximum->setSize(6);
     $opt->addSubItem($maximum);
     $opt = new ilRadioOption($this->lng->txt('ratio_absolute'), 5, $this->lng->txt("metric_subtype_description_ratioabsolute"));
     $subtype->addOption($opt);
     // minimum value
     $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5");
     if ($this->object->getSubtype() == 5) {
         $minimum->setValue($this->object->getMinimum());
     }
     $minimum->setRequired(false);
     $minimum->setSize(6);
     $minimum->setMinValue(0);
     $minimum->setDecimals(0);
     $opt->addSubItem($minimum);
     // maximum value
     $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5");
     $maximum->setDecimals(0);
     if ($this->object->getSubtype() == 5) {
         $maximum->setValue($this->object->getMaximum());
     }
     $maximum->setRequired(false);
     $maximum->setSize(6);
     $opt->addSubItem($maximum);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getObligatory());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand()) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
 * Creates an output of the edit form for the question
 */
 public function editQuestion()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("essay");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setValue($this->object->label);
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setValue($this->object->getAuthor());
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setValue($this->object->getDescription());
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
     $form->addItem($question);
     // maximum number of characters
     $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
     $maxchars->setRequired(false);
     $maxchars->setSize(5);
     if ($this->object->getMaxChars() > 0) {
         $maxchars->setValue($this->object->getMaxChars());
     }
     $maxchars->setDecimals(0);
     $form->addItem($maxchars);
     // textwidth
     $textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth");
     $textwidth->setRequired(true);
     $textwidth->setSize(3);
     $textwidth->setValue($this->object->getTextWidth());
     $textwidth->setDecimals(0);
     $textwidth->setMinValue(10);
     $form->addItem($textwidth);
     // textheight
     $textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight");
     $textheight->setRequired(true);
     $textheight->setSize(3);
     $textheight->setValue($this->object->getTextHeight());
     $textheight->setDecimals(0);
     $textheight->setMinValue(1);
     $form->addItem($textheight);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getObligatory());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand()) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 private function getElementsUsedForAdvancedEditing()
 {
     include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
     return ilObjAdvancedEditing::_getUsedHTMLTags(self::TYPE);
 }
 /**
  * Creates the output of the feedback page for a single choice question
  *
  * @access public
  */
 function feedback($checkonly = false)
 {
     $save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('feedback_answers'));
     $form->setTableWidth("98%");
     $form->setId("feedback");
     $complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete");
     $complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
     $complete->setRequired(false);
     $complete->setRows(10);
     $complete->setCols(80);
     if (!$this->getPreventRteUsage()) {
         $complete->setUseRte(true);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $complete->addPlugin("latex");
     $complete->addButton("latex");
     $complete->addButton("pastelatex");
     $complete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
     $form->addItem($complete);
     $incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete");
     $incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
     $incomplete->setRequired(false);
     $incomplete->setRows(10);
     $incomplete->setCols(80);
     if (!$this->getPreventRteUsage()) {
         $incomplete->setUseRte(true);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $incomplete->addPlugin("latex");
     $incomplete->addButton("latex");
     $incomplete->addButton("pastelatex");
     $incomplete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
     $form->addItem($incomplete);
     if (!$this->getSelfAssessmentEditingMode()) {
         foreach ($this->object->getErrorData() as $index => $answer) {
             $caption = $ordinal = $index + 1;
             $caption .= '. <br />"' . $answer->text_wrong . '" =&gt; ';
             $caption .= '"' . $answer->text_correct . '"';
             $caption .= '</i>';
             $answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($caption, true), "feedback_answer_{$index}");
             $answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSingleAnswer($index)));
             $answerobj->setRequired(false);
             $answerobj->setRows(10);
             $answerobj->setCols(80);
             $answerobj->setUseRte(true);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $answerobj->addPlugin("latex");
             $answerobj->addButton("latex");
             $answerobj->addButton("pastelatex");
             $answerobj->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
             $form->addItem($answerobj);
         }
     }
     global $ilAccess;
     if ($ilAccess->checkAccess("write", "", $_GET['ref_id']) || $this->getSelfAssessmentEditingMode()) {
         $form->addCommandButton("saveFeedback", $this->lng->txt("save"));
     }
     if ($save) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("multiplechoice");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setValue($this->object->label);
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setValue($this->object->getAuthor());
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setValue($this->object->getDescription());
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
     $form->addItem($question);
     // subtype
     $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
     $subtype->setRequired(false);
     $subtype->setValue($this->object->getSubtype());
     $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
     foreach ($subtypes as $idx => $st) {
         $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
     }
     $form->addItem($subtype);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getObligatory());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_appearance"));
     $form->addItem($header);
     // column separators
     $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
     $column_separators->setValue(1);
     $column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
     $column_separators->setChecked($this->object->getColumnSeparators());
     $column_separators->setRequired(false);
     $form->addItem($column_separators);
     // row separators
     $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
     $row_separators->setValue(1);
     $row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
     $row_separators->setChecked($this->object->getRowSeparators());
     $row_separators->setRequired(false);
     $form->addItem($row_separators);
     // neutral column separators
     $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
     $neutral_column_separator->setValue(1);
     $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
     $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
     $neutral_column_separator->setRequired(false);
     $form->addItem($neutral_column_separator);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_columns"));
     $form->addItem($header);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $columns = new ilCategoryWizardInputGUI("", "columns");
     $columns->setRequired(false);
     $columns->setAllowMove(true);
     $columns->setShowWizard(true);
     $columns->setShowNeutralCategory(true);
     $columns->setDisabledScale(false);
     $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
     $columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
     $columns->setShowSavePhrase(true);
     if (!$this->object->getColumnCount()) {
         $this->object->columns->addCategory("");
     }
     $columns->setValues($this->object->getColumns());
     $form->addItem($columns);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_column_settings"));
     $form->addItem($header);
     // bipolar adjectives
     $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
     $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
     // left pole
     $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
     $bipolar1->setValue($this->object->getBipolarAdjective(0));
     $bipolar1->setRequired(false);
     $bipolar->addSubItem($bipolar1);
     // right pole
     $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
     $bipolar2->setValue($this->object->getBipolarAdjective(1));
     $bipolar2->setRequired(false);
     $bipolar->addSubItem($bipolar2);
     $form->addItem($bipolar);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_rows"));
     $form->addItem($header);
     // matrix rows
     include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
     $rows = new ilMatrixRowWizardInputGUI("", "rows");
     $rows->setRequired(false);
     $rows->setAllowMove(true);
     $rows->setLabelText($this->lng->txt('label'));
     $rows->setUseOtherAnswer(true);
     if ($this->object->getRowCount() == 0) {
         $this->object->getRows()->addCategory("");
     }
     $rows->setValues($this->object->getRows());
     $form->addItem($rows);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand(array("wizardcolumns", "savePhrasecolumns"))) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
示例#19
0
 /**
  * Add basic question form properties:
  * assessment: title, author, description, question, working time
  *
  * @return	int	Default Nr of Tries
  */
 function addBasicQuestionFormProperties($form)
 {
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // author
         $author = new ilTextInputGUI($this->lng->txt("author"), "author");
         $author->setValue($this->object->getAuthor());
         $author->setRequired(TRUE);
         $form->addItem($author);
         // description
         $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
         $description->setValue($this->object->getComment());
         $description->setRequired(FALSE);
         $form->addItem($description);
     } else {
         // author as hidden field
         $hi = new ilHiddenInputGUI("author");
         $author = ilUtil::prepareFormOutput($this->object->getAuthor());
         if (trim($author) == "") {
             $author = "-";
         }
         $hi->setValue($author);
         $form->addItem($hi);
     }
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         if ($this->object->getAdditionalContentEditingMode() != assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT) {
             $question->setUseRte(TRUE);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $question->addPlugin("latex");
             $question->addButton("latex");
             $question->addButton("pastelatex");
             $question->setRTESupport($this->object->getId(), "qpl", "assessment");
         }
     } else {
         $question->setRteTags(self::getSelfAssessmentTags());
         $question->setUseTagsForRteOnly(false);
     }
     $form->addItem($question);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // duration
         $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
         $duration->setShowHours(TRUE);
         $duration->setShowMinutes(TRUE);
         $duration->setShowSeconds(TRUE);
         $ewt = $this->object->getEstimatedWorkingTime();
         $duration->setHours($ewt["h"]);
         $duration->setMinutes($ewt["m"]);
         $duration->setSeconds($ewt["s"]);
         $duration->setRequired(FALSE);
         $form->addItem($duration);
     } else {
         // number of tries
         if (strlen($this->object->getNrOfTries())) {
             $nr_tries = $this->object->getNrOfTries();
         } else {
             $nr_tries = $this->object->getDefaultNrOfTries();
         }
         if ($nr_tries < 1) {
             $nr_tries = "";
         }
         $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
         $ni->setValue($nr_tries);
         $ni->setMinValue(0);
         $ni->setSize(5);
         $ni->setMaxLength(5);
         $form->addItem($ni);
     }
 }
示例#20
0
 /**
  * Adds support for an RTE in an ILIAS form
  *
  * Adds support for an RTE in an ILIAS form
  *
  * @param string $a_module Module or object which should use the HTML tags
  * @access public
  */
 function addRTESupport($obj_id, $obj_type, $a_module = "", $allowFormElements = FALSE, $cfg_template = null, $hide_switch = false)
 {
     global $ilBrowser;
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     /*
     if (array_key_exists("show_rte", $_POST))
     {
     	ilObjAdvancedEditing::_setRichTextEditorUserState($_POST["show_rte"]);
     }
     */
     if ($ilBrowser->isMobile()) {
         ilObjAdvancedEditing::_setRichTextEditorUserState(0);
     } else {
         ilObjAdvancedEditing::_setRichTextEditorUserState(1);
     }
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     if (ilObjAdvancedEditing::_getRichTextEditorUserState() != 0 && strcmp(ilObjAdvancedEditing::_getRichTextEditor(), "0") != 0) {
         $tpl = new ilTemplate($cfg_template === null ? "tpl.tinymce.html" : $cfg_template, true, true, "Services/RTE");
         $this->handleImgContextMenuItem($tpl);
         $tags =& ilObjAdvancedEditing::_getUsedHTMLTags($a_module);
         if ($allowFormElements) {
             $tpl->touchBlock("formelements");
         }
         $tpl->setCurrentBlock("tinymce");
         $tpl->setVariable("JAVASCRIPT_LOCATION", "./Services/RTE/tiny_mce" . $this->vd . "/tiny_mce.js");
         include_once "./Services/Object/classes/class.ilObject.php";
         $tpl->setVariable("OBJ_ID", $obj_id);
         $tpl->setVariable("OBJ_TYPE", $obj_type);
         $tpl->setVariable("CLIENT_ID", CLIENT_ID);
         $tpl->setVariable("SESSION_ID", $_COOKIE["PHPSESSID"]);
         $tpl->setVariable("BLOCKFORMATS", $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
         $tpl->setVariable("VALID_ELEMENTS", $this->_getValidElementsFromHTMLTags($tags));
         $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
         $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags) . ',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags) . ($this->getStyleSelect() ? ',styleselect' : '');
         $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
         $tpl->setVariable('BUTTONS_1', self::_removeRedundantSeparators($buttons_1));
         $tpl->setVariable('BUTTONS_2', self::_removeRedundantSeparators($buttons_2));
         $tpl->setVariable('BUTTONS_3', self::_removeRedundantSeparators($buttons_3));
         $tpl->setVariable("ADDITIONAL_PLUGINS", join(",", $this->plugins));
         include_once "./Services/Utilities/classes/class.ilUtil.php";
         //$tpl->setVariable("STYLESHEET_LOCATION", $this->getContentCSS());
         $tpl->setVariable("STYLESHEET_LOCATION", ilUtil::getNewContentStyleSheetLocation() . "," . ilUtil::getStyleSheetLocation("output", "delos.css"));
         $tpl->setVariable("LANG", $this->_getEditorLanguage());
         if ($this->getRTERootBlockElement() !== null) {
             $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
         }
         $tpl->parseCurrentBlock();
         $this->tpl->setVariable("CONTENT_BLOCK", $tpl->get());
     }
     /*
     if (!$hide_switch && strcmp(ilObjAdvancedEditing::_getRichTextEditor(), "0") != 0)
     {
     	$tpl = new ilTemplate("tpl.rte.switch.html", true, true, "Services/RTE");
     	$tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass($this->ctrl->getCmdClass()), $this->ctrl->getCmd());
     	$tpl->setVariable("TEXT_SET_MODE", $this->lng->txt("set_edit_mode"));
     	$tpl->setVariable("TEXT_ENABLED", $this->lng->txt("rte_editor_enabled"));
     	$tpl->setVariable("TEXT_DISABLED", $this->lng->txt("rte_editor_disabled"));
     	if (ilObjAdvancedEditing::_getRichTextEditorUserState() != 0)
     	{
     		$tpl->setVariable("SELECTED_ENABLED", " selected=\"selected\"");
     	}
     	$tpl->setVariable("BTN_COMMAND", $this->ctrl->getCmd());
     	
     	$this->tpl->setVariable("RTE_SWITCH", $tpl->get());
     }
     */
 }
 /**
  * render questions per page
  */
 protected function renderPage()
 {
     global $ilCtrl, $lng, $tpl, $rbacsystem;
     $pages = $this->object->getSurveyPages();
     $this->has_next_page = $this->current_page < sizeof($pages);
     $this->has_previous_page = $this->current_page > 1;
     $this->has_datasets = $this->object->_hasDatasets($this->object->getSurveyId());
     if ($this->has_datasets) {
         $link = $ilCtrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyparticipantsgui"), "maintenance");
         $link = "<a href=\"" . $link . "\">" . $lng->txt("survey_has_datasets_warning_page_view_link") . "</a>";
         ilUtil::sendInfo($lng->txt("survey_has_datasets_warning_page_view") . " " . $link);
     }
     $ilCtrl->setParameter($this, "pg", $this->current_page);
     $ilCtrl->setParameter($this, "pgov", "");
     $this->renderToolbar($pages);
     if ($pages) {
         $ttpl = new ilTemplate("tpl.il_svy_svy_page_view.html", true, true, "Modules/Survey");
         $ttpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
         $ttpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this));
         $lng->loadLanguageModule("form");
         $read_only = $this->has_datasets || !$rbacsystem->checkAccess("write", $this->ref_id);
         $commands = $multi_commands = array();
         if (!$read_only) {
             // clipboard is empty
             if (!$_SESSION["survey_page_view"][$this->ref_id]["clipboard"]) {
                 $multi_commands[] = array("cmd" => "multiDelete", "text" => $lng->txt("delete"));
                 $multi_commands[] = array("cmd" => "multiCut", "text" => $lng->txt("cut"));
                 $multi_commands[] = array("cmd" => "multiCopy", "text" => $lng->txt("copy"));
             } else {
                 if (!$this->suppress_clipboard_msg) {
                     ilUtil::sendInfo($lng->txt("survey_clipboard_notice"));
                 }
                 $multi_commands[] = array("cmd" => "clearClipboard", "text" => $lng->txt("survey_dnd_clear_clipboard"));
             }
             // help
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("streaked_area.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("form_hierarchy_add_elements"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("drop_streaked_area.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("form_hierarchy_drag_drop_help"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("survey_dnd_double_click_to_delete"));
             $ttpl->parseCurrentBlock();
             $ttpl->setVariable("DND_INIT_JS", "initDragElements();");
             // tiny mce
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $tags = ilObjAdvancedEditing::_getUsedHTMLTags("survey");
             include_once "./Services/RTE/classes/class.ilTinyMCE.php";
             $tiny = new ilTinyMCE("3.3.9.2");
             $ttpl->setVariable("WYSIWYG_BLOCKFORMATS", $tiny->_buildAdvancedBlockformatsFromHTMLTags($tags));
             $ttpl->setVariable("WYSIWYG_VALID_ELEMENTS", $tiny->_getValidElementsFromHTMLTags($tags));
             $buttons_1 = $tiny->_buildAdvancedButtonsFromHTMLTags(1, $tags);
             $buttons_2 = $tiny->_buildAdvancedButtonsFromHTMLTags(2, $tags) . ',' . $tiny->_buildAdvancedTableButtonsFromHTMLTags($tags) . ($tiny->getStyleSelect() ? ',styleselect' : '');
             $buttons_3 = $tiny->_buildAdvancedButtonsFromHTMLTags(3, $tags);
             $ttpl->setVariable('WYSIWYG_BUTTONS_1', $tiny->_removeRedundantSeparators($buttons_1));
             $ttpl->setVariable('WYSIWYG_BUTTONS_2', $tiny->_removeRedundantSeparators($buttons_2));
             $ttpl->setVariable('WYSIWYG_BUTTONS_3', $tiny->_removeRedundantSeparators($buttons_3));
         }
         // commands
         if (count($multi_commands) > 0 || count($commands) > 0) {
             $single = false;
             foreach ($commands as $cmd) {
                 $ttpl->setCurrentBlock("cmd");
                 $ttpl->setVariable("ORG_CMD", "renderPage");
                 $ttpl->setVariable("CMD", $cmd["cmd"]);
                 $ttpl->setVariable("CMD_TXT", $cmd["text"]);
                 $ttpl->parseCurrentBlock();
                 $single = true;
             }
             $multi = false;
             foreach ($multi_commands as $cmd) {
                 $ttpl->setCurrentBlock("multi_cmd");
                 $ttpl->setVariable("ORG_CMD_MULTI", "renderPage");
                 $ttpl->setVariable("MULTI_CMD", $cmd["cmd"]);
                 $ttpl->setVariable("MULTI_CMD_TXT", $cmd["text"]);
                 $ttpl->parseCurrentBlock();
                 $multi = true;
             }
             if ($multi) {
                 $ttpl->setCurrentBlock("multi_cmds");
                 $ttpl->setVariable("MCMD_ALT", $lng->txt("commands"));
                 $ttpl->setVariable("MCMD_IMG", ilUtil::getImagePath("arrow_downright.png"));
                 $ttpl->parseCurrentBlock();
             }
             if ($single || $multi) {
                 $ttpl->setCurrentBlock("commands");
                 $ttpl->parseCurrentBlock();
             }
         }
         // nodes
         $ttpl->setVariable("NODES", $this->getPageNodes($pages[$this->current_page - 1], $this->has_previous_page, $this->has_next_page, $read_only));
         $tpl->setContent($ttpl->get());
         // add js to template
         include_once "./Services/YUI/classes/class.ilYuiUtil.php";
         ilYuiUtil::initDragDrop();
         $tpl->addJavascript("./Modules/Survey/js/SurveyPageView.js");
         $tpl->addJavascript("./Services/RTE/tiny_mce_3_3_9_2/tiny_mce_src.js");
     }
 }
 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;
 }
 /**
  * Returns a string of all allowed HTML tags for text editing
  *
  * Returns a string of all allowed HTML tags for text editing
  *
  * @param string $a_module Name of the module or object which uses the tags
  * @return string Used HTML tags
  */
 function &_getUsedHTMLTagsAsString($a_module = "")
 {
     $result = "";
     $tags =& ilObjAdvancedEditing::_getUsedHTMLTags($a_module);
     foreach ($tags as $tag) {
         $result .= "<{$tag}>";
     }
     return $result;
 }
 private function getElementsUsedForAdvancedEditing()
 {
     include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
     return ilObjAdvancedEditing::_getUsedHTMLTags($this->getPurifierType());
 }