/** * 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 . '" => '; $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; }
/** * 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; }
/** * 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; }
/** * Shows the certificate editor for ILIAS tests */ public function certificateEditor() { global $ilAccess; $form_fields = array(); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $form_fields = $this->getFormFieldsFromPOST(); } else { $form_fields = $this->getFormFieldsFromFO(); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setPreventDoubleSubmission(false); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("certificate_edit")); $form->setMultipart(TRUE); $form->setTableWidth("100%"); $form->setId("certificate"); $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active"); $active->setChecked($form_fields["active"]); $form->addItem($active); $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import"); $import->setRequired(FALSE); $import->setSuffixes(array("zip")); // handle the certificate import if (strlen($_FILES["certificate_import"]["tmp_name"])) { if ($import->checkInput()) { $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]); if ($result == FALSE) { $import->setAlert($this->lng->txt("certificate_error_import")); } else { $this->ctrl->redirect($this, "certificateEditor"); } } } $form->addItem($import); $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat"); $pageformats = $this->object->getPageFormats(); $pageformat->setValue($form_fields["pageformat"]); foreach ($pageformats as $format) { $option = new ilRadioOption($format["name"], $format["value"]); if (strcmp($format["value"], "custom") == 0) { $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight"); $pageheight->setValue($form_fields["pageheight"]); $pageheight->setSize(6); $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pageheight->setInfo($this->lng->txt("certificate_unit_description")); $pageheight->setRequired(true); $option->addSubitem($pageheight); $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth"); $pagewidth->setValue($form_fields["pagewidth"]); $pagewidth->setSize(6); $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pagewidth->setInfo($this->lng->txt("certificate_unit_description")); $pagewidth->setRequired(true); $option->addSubitem($pagewidth); } $pageformat->addOption($option); } $pageformat->setRequired(true); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $pageformat->checkInput(); } $form->addItem($pageformat); $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background"); $bgimage->setRequired(FALSE); $bgimage->setUseCache(false); if (count($_POST)) { // handle the background upload if (strlen($_FILES["background"]["tmp_name"])) { if ($bgimage->checkInput()) { $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]); if ($result == FALSE) { $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage")); } } } } if (!$this->object->hasBackgroundImage()) { include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php"; if (ilObjCertificateSettingsAccess::hasBackgroundImage()) { $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb()); } } else { $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb()); } $form->addItem($bgimage); $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top"); $padding_top->setRequired(TRUE); $padding_top->setValue($form_fields["padding_top"]); $padding_top->setSize(6); $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $padding_top->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $padding_top->checkInput(); } $form->addItem($padding_top); $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body"); $rect->setRequired(TRUE); $rect->setUseUnits(TRUE); $rect->setTop($form_fields["margin_body_top"]); $rect->setBottom($form_fields["margin_body_bottom"]); $rect->setLeft($form_fields["margin_body_left"]); $rect->setRight($form_fields["margin_body_right"]); $rect->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $rect->checkInput(); } $form->addItem($rect); $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text"); $certificate->removePlugin('ilimgupload'); $certificate->setValue($form_fields["certificate_text"]); $certificate->setRequired(TRUE); $certificate->setRows(20); $certificate->setCols(80); // fraunhpatch start $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate"); foreach (ilCertificate::getCustomCertificateFields() as $f) { $common_desc_tpl->setCurrentBlock("cert_field"); $common_desc_tpl->setVariable("PH", $f["ph"]); $common_desc_tpl->setVariable("PH_TXT", $f["name"]); $common_desc_tpl->parseCurrentBlock(); } $common_desc = $common_desc_tpl->get(); // fraunhpatch start $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc); $certificate->setUseRte(TRUE, '3.4.7'); $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul"); $certificate->setRteTags($tags); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $certificate->checkInput(); } $form->addItem($certificate); $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { if ($this->object->isComplete() || $this->object->hasBackgroundImage()) { $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview")); $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export")); $form->addCommandButton("certificateDelete", $this->lng->txt("delete")); } $form->addCommandButton("certificateSave", $this->lng->txt("save")); } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { if ($_POST["background_delete"]) { $this->object->deleteBackgroundImage(); } if ($form->checkInput()) { try { $xslfo = $this->object->processXHTML2FO($form_fields); $this->object->getAdapter()->saveFormFields($form_fields); $this->object->saveCertificate($xslfo); $this->object->writeActive($form_fields["active"]); ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE); $this->ctrl->redirect($this, "certificateEditor"); } catch (Exception $e) { ilUtil::sendFailure($e->getMessage()); } } } }
/** * 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; }
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); // 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; }
/** * 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; }
/** * 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); } }
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(' ', ''); $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); } }
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(' ', ''); $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; }
/** * 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; }
/** * 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); } }
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; }
/** * 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; }
/** * 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; }