Ejemplo n.º 1
0
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(false);
     $form->setTableWidth("100%");
     $form->setId("assfileupload");
     $this->addBasicQuestionFormProperties($form);
     $this->populateQuestionSpecificFormPart($form);
     $this->populateTaxonomyFormSection($form);
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
 public function initUploadForm()
 {
     global $ilCtrl, $lng;
     include_once "./Services/Form/classes/class.ilDragDropFileInputGUI.php";
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setId("upload");
     $this->form->setMultipart(true);
     $this->form->setHideLabels();
     $file = new ilDragDropFileInputGUI($lng->txt("cld_upload_flies"), "upload_files");
     $file->setRequired(true);
     $this->form->addItem($file);
     $this->form->addCommandButton("uploadFiles", $lng->txt("upload"));
     $this->form->addCommandButton("cancelAll", $lng->txt("cancel"));
     $this->form->setTableWidth("100%");
     $this->form->setTitle($lng->txt("upload_files_title"));
     $this->form->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $lng->txt('obj_file'));
     $this->form->setTitle($lng->txt("upload_files"));
     $this->form->setFormAction($ilCtrl->getFormAction($this, "uploadFiles"));
     $this->form->setTarget("cld_blank_target");
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @param bool $checkonly
  *
  * @return bool
  */
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline;
     if ($checkonly) {
         $isSingleline = $_POST['types'] == 0 ? true : false;
     }
     if ($isSingleline) {
         $form->setMultipart(TRUE);
     } else {
         $form->setMultipart(FALSE);
     }
     $form->setTableWidth("100%");
     $form->setId("assmultiplechoice");
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     $this->populateQuestionSpecificFormPart($form);
     $this->populateAnswerSpecificFormPart($form);
     $this->populateTaxonomyFormSection($form);
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
Ejemplo n.º 4
0
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("assclozetest");
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     // Modify "instructive" question textbox... get rid of this crap asap.
     $q_item = $form->getItemByPostVar("question");
     $q_item->setInfo($this->lng->txt("close_text_hint"));
     $q_item->setTitle($this->lng->txt("cloze_text"));
     $this->populateQuestionSpecificFormPart($form);
     $this->populateAnswerSpecificFormPart($form);
     $this->populateTaxonomyFormSection($form);
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
Ejemplo n.º 5
0
 protected function initSearchForm()
 {
     global $ilCtrl;
     if ($_GET["ref"] != "wsp") {
         $this->saveMailData();
         $title = $this->lng->txt('search_recipients');
     } else {
         $this->lng->loadLanguageModule("wsp");
         $title = $this->lng->txt("wsp_share_search_users");
     }
     // searchform
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTitle($title);
     $form->setId('search_rcp');
     $form->setFormAction($ilCtrl->getFormAction($this, 'search'));
     $inp = new ilTextInputGUI($this->lng->txt("search_for"), 'search');
     $inp->setSize(30);
     $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true, false);
     $inp->setDataSource($dsDataLink);
     if (strlen(trim($_SESSION["mail_search_search"])) > 0) {
         $inp->setValue(ilUtil::prepareFormOutput(trim($_SESSION["mail_search_search"]), true));
     }
     $form->addItem($inp);
     $form->addCommandButton('search', $this->lng->txt("search"));
     $form->addCommandButton('cancel', $this->lng->txt("cancel"));
     return $form;
 }
Ejemplo n.º 6
0
 /**
  * @return ilPropertyFormGUI
  */
 protected function buildBasicEditFormObject()
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setId($this->getType());
     $form->setTitle($this->outQuestionType());
     $form->setTableWidth('100%');
     $form->setMultipart(true);
     return $form;
 }
 /**
  * @param $question_id
  * @param $question_pool_id
  *
  * @return ilPropertyFormGUI
  */
 protected function buildAdjustQuestionForm($question_id, $question_pool_id)
 {
     require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("adjustment");
     /** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */
     $question = assQuestion::instantiateQuestionGUI($question_id);
     $form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>');
     $hidden_question_id = new ilHiddenInputGUI('q_id');
     $hidden_question_id->setValue($question_id);
     $form->addItem($hidden_question_id);
     $hidden_qpl_id = new ilHiddenInputGUI('qpl_id');
     $hidden_qpl_id->setValue($question_pool_id);
     $form->addItem($hidden_qpl_id);
     $this->populateScoringAdjustments($question, $form);
     $manscoring_section = new ilFormSectionHeaderGUI();
     $manscoring_section->setTitle($this->lng->txt('manscoring'));
     $form->addItem($manscoring_section);
     $manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring');
     $manscoring_preservation->setChecked(true);
     $manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info'));
     $form->addItem($manscoring_preservation);
     $form->addCommandButton("savescoringfortest", $this->lng->txt("save"));
     $participants = $this->object->getParticipants();
     $active_ids = array_keys($participants);
     $results = array();
     foreach ($active_ids as $active_id) {
         $passes[] = $this->object->_getPass($active_id);
         foreach ($passes as $key => $pass) {
             for ($i = 0; $i <= $pass; $i++) {
                 $results[] = $question->object->getSolutionValues($active_id, $i);
             }
         }
     }
     $relevant_answers = array();
     foreach ($results as $result) {
         foreach ($result as $answer) {
             if ($answer['question_fi'] == $question->object->getId()) {
                 $relevant_answers[] = $answer;
             }
         }
     }
     $answers_view = $question->getAggregatedAnswersView($relevant_answers);
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once 'Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initPanel();
     ilYuiUtil::initOverlay();
     $this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js');
     $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
     $container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test');
     $container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ');
     $container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close'))));
     $container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview'));
     $container->setVariable('TXT_CLOSE', $this->lng->txt('close'));
     $container->setVariable('ANSWER_OVERVIEW', $answers_view);
     $custom_input = new ilCustomInputGUI('', 'aggr_usr_answ');
     $custom_input->setHtml($container->get());
     $form->addItem($custom_input);
     return $form;
 }
 private function buildForm()
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save"));
     $form->setTableWidth("100%");
     $form->setId("test_properties");
     if (!$this->settingsTemplate || $this->formShowGeneralSection($this->settingsTemplate->getSettings())) {
         // general properties
         $header = new ilFormSectionHeaderGUI();
         $header->setTitle($this->lng->txt("tst_general_properties"));
         $form->addItem($header);
     }
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->testOBJ->getId(), 0, "tst");
     $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);
     }
     // anonymity
     $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity');
     if ($this->testOBJ->participantDataExist()) {
         $anonymity->setDisabled(true);
     }
     $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0);
     $anonymity->addOption($rb);
     $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1);
     $anonymity->addOption($rb);
     $anonymity->setValue((int) $this->testOBJ->getAnonymity());
     $form->addItem($anonymity);
     // test mode (question set type)
     $questSetType = new ilRadioGroupInputGUI($this->lng->txt("tst_question_set_type"), 'question_set_type');
     $questSetTypeFixed = new ilRadioOption($this->lng->txt("tst_question_set_type_fixed"), ilObjTest::QUESTION_SET_TYPE_FIXED, $this->lng->txt("tst_question_set_type_fixed_desc"));
     $questSetType->addOption($questSetTypeFixed);
     $questSetTypeRandom = new ilRadioOption($this->lng->txt("tst_question_set_type_random"), ilObjTest::QUESTION_SET_TYPE_RANDOM, $this->lng->txt("tst_question_set_type_random_desc"));
     $questSetType->addOption($questSetTypeRandom);
     $questSetTypeContinues = new ilRadioOption($this->lng->txt("tst_question_set_type_dynamic"), ilObjTest::QUESTION_SET_TYPE_DYNAMIC, $this->lng->txt("tst_question_set_type_dynamic_desc"));
     $questSetType->addOption($questSetTypeContinues);
     $questSetType->setValue($this->testOBJ->getQuestionSetType());
     if ($this->testOBJ->participantDataExist()) {
         $questSetType->setDisabled(true);
     }
     $form->addItem($questSetType);
     // pool usage
     $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool");
     $pool_usage->setValue(1);
     $pool_usage->setChecked($this->testOBJ->getPoolUsage());
     $form->addItem($pool_usage);
     // enable_archiving
     $enable_archiving = new ilCheckboxInputGUI($this->lng->txt('test_enable_archiving'), 'enable_archiving');
     $enable_archiving->setValue(1);
     $enable_archiving->setChecked($this->testOBJ->getEnableArchiving());
     $form->addItem($enable_archiving);
     // activation/availability  (no template support yet)
     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->testOBJ->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->setChecked($this->testOBJ->isOnline());
     $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info);
     $form->addItem($online);
     $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type');
     $act_type->setInfo($act_ref_info);
     $act_type->setValue($this->testOBJ->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED);
     $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED);
     $opt->setInfo($this->lng->txt('tst_availability_limitless_info'));
     $act_type->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION);
     $opt->setInfo($this->lng->txt('tst_availability_until_info'));
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI("", "access_period");
     $dur->setShowTime(true);
     $date = $this->testOBJ->getActivationStartingTime();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->testOBJ->getActivationEndingTime();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $opt->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility');
     $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info'));
     $visible->setChecked($this->testOBJ->getActivationVisibility());
     $opt->addSubItem($visible);
     $act_type->addOption($opt);
     $form->addItem($act_type);
     if (!$this->settingsTemplate || $this->formShowBeginningEndingInformation($this->settingsTemplate->getSettings())) {
         // general properties
         $header = new ilFormSectionHeaderGUI();
         $header->setTitle($this->lng->txt("tst_beginning_ending_information"));
         $form->addItem($header);
     }
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction");
     $intro->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->setRTESupport($this->testOBJ->getId(), "tst", "assessment");
     $intro->setRteTagSet('full');
     $intro->setInfo($this->lng->txt('intro_desc'));
     // showinfo
     $showinfo = new ilCheckboxInputGUI('', "showinfo");
     $showinfo->setValue(1);
     $showinfo->setChecked($this->testOBJ->getShowInfo());
     $showinfo->setOptionTitle($this->lng->txt("showinfo"));
     $showinfo->setInfo($this->lng->txt("showinfo_desc"));
     $intro->addSubItem($showinfo);
     $form->addItem($intro);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement");
     $finalstatement->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getFinalStatement()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->setRTESupport($this->testOBJ->getId(), "tst", "assessment");
     $finalstatement->setRteTagSet('full');
     // show final statement
     $showfinal = new ilCheckboxInputGUI('', "showfinalstatement");
     $showfinal->setValue(1);
     $showfinal->setChecked($this->testOBJ->getShowFinalStatement());
     $showfinal->setOptionTitle($this->lng->txt("final_statement_show"));
     $showfinal->setInfo($this->lng->txt("final_statement_show_desc"));
     $finalstatement->addSubItem($showfinal);
     $form->addItem($finalstatement);
     // examview
     $enable_examview = new ilCheckboxInputGUI($this->lng->txt("enable_examview"), 'enable_examview');
     $enable_examview->setValue(1);
     $enable_examview->setChecked($this->testOBJ->getEnableExamview());
     $enable_examview->setInfo($this->lng->txt("enable_examview_desc"));
     $show_examview_html = new ilCheckboxInputGUI('', 'show_examview_html');
     $show_examview_html->setValue(1);
     $show_examview_html->setChecked($this->testOBJ->getShowExamviewHtml());
     $show_examview_html->setOptionTitle($this->lng->txt("show_examview_html"));
     $show_examview_html->setInfo($this->lng->txt("show_examview_html_desc"));
     $enable_examview->addSubItem($show_examview_html);
     $show_examview_pdf = new ilCheckboxInputGUI('', 'show_examview_pdf');
     $show_examview_pdf->setValue(1);
     $show_examview_pdf->setChecked($this->testOBJ->getShowExamviewPdf());
     $show_examview_pdf->setOptionTitle($this->lng->txt("show_examview_pdf"));
     $show_examview_pdf->setInfo($this->lng->txt("show_examview_pdf_desc"));
     $enable_examview->addSubItem($show_examview_pdf);
     $form->addItem($enable_examview);
     if (!$this->settingsTemplate || $this->formShowSessionSection($this->settingsTemplate->getSettings())) {
         // session properties
         $sessionheader = new ilFormSectionHeaderGUI();
         $sessionheader->setTitle($this->lng->txt("tst_session_settings"));
         $form->addItem($sessionheader);
     }
     // max. number of passes
     $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries");
     $nr_of_tries->setSize(3);
     $nr_of_tries->setValue($this->testOBJ->getNrOfTries());
     $nr_of_tries->setRequired(true);
     $nr_of_tries->setSuffix($this->lng->txt("0_unlimited"));
     $total = $this->testOBJ->evalTotalPersons();
     if ($total) {
         $nr_of_tries->setDisabled(true);
     }
     $form->addItem($nr_of_tries);
     // enable max. processing time
     $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time");
     $processing->setValue(1);
     //$processing->setOptionTitle($this->lng->txt("enabled"));
     if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) {
         $processing->setChecked(true);
     } else {
         $processing->setChecked($this->testOBJ->getEnableProcessingTime());
     }
     // max. processing time
     $processingtime = new ilDurationInputGUI('', 'processing_time');
     $ptime = $this->testOBJ->getProcessingTimeAsArray();
     $processingtime->setHours($ptime['hh']);
     $processingtime->setMinutes($ptime['mm']);
     $processingtime->setSeconds($ptime['ss']);
     $processingtime->setShowMonths(false);
     $processingtime->setShowDays(false);
     $processingtime->setShowHours(true);
     $processingtime->setShowMinutes(true);
     $processingtime->setShowSeconds(true);
     $processingtime->setInfo($this->lng->txt("tst_processing_time_desc"));
     $processing->addSubItem($processingtime);
     // reset max. processing time
     $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time");
     $resetprocessing->setValue(1);
     $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time"));
     $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime());
     $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc"));
     $processing->addSubItem($resetprocessing);
     $form->addItem($processing);
     // enable starting time
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time");
     $enablestartingtime->setValue(1);
     //$enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_starting_time')) {
         $enablestartingtime->setChecked(true);
     } else {
         $enablestartingtime->setChecked(strlen($this->testOBJ->getStartingTime()));
     }
     // starting time
     $startingtime = new ilDateTimeInputGUI('', 'starting_time');
     $startingtime->setShowDate(true);
     $startingtime->setShowTime(true);
     if (strlen($this->testOBJ->getStartingTime())) {
         $startingtime->setDate(new ilDateTime($this->testOBJ->getStartingTime(), IL_CAL_TIMESTAMP));
     } else {
         $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     if ($this->testOBJ->participantDataExist()) {
         $enablestartingtime->setDisabled(true);
         $startingtime->setDisabled(true);
     }
     // enable ending time
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time");
     $enableendingtime->setValue(1);
     //$enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_ending_time')) {
         $enableendingtime->setChecked(true);
     } else {
         $enableendingtime->setChecked(strlen($this->testOBJ->getEndingTime()));
     }
     // ending time
     $endingtime = new ilDateTimeInputGUI('', 'ending_time');
     $endingtime->setShowDate(true);
     $endingtime->setShowTime(true);
     if (strlen($this->testOBJ->getEndingTime())) {
         $endingtime->setDate(new ilDateTime($this->testOBJ->getEndingTime(), IL_CAL_TIMESTAMP));
     } else {
         $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // test password
     $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password");
     $password->setSize(20);
     $password->setValue($this->testOBJ->getPassword());
     $password->setInfo($this->lng->txt("tst_password_details"));
     $form->addItem($password);
     if (!$this->settingsTemplate || $this->formShowPresentationSection($this->settingsTemplate->getSettings())) {
         // sequence properties
         $seqheader = new ilFormSectionHeaderGUI();
         $seqheader->setTitle($this->lng->txt("tst_presentation_properties"));
         $form->addItem($seqheader);
     }
     // use previous answers
     $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers");
     $prevanswers->setValue(1);
     $prevanswers->setChecked($this->testOBJ->getUsePreviousAnswers());
     $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description"));
     $form->addItem($prevanswers);
     // force js
     $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs");
     $forcejs->setValue(1);
     $forcejs->setChecked($this->testOBJ->getForceJS());
     $forcejs->setOptionTitle($this->lng->txt("forcejs"));
     $forcejs->setInfo($this->lng->txt("forcejs_desc"));
     $form->addItem($forcejs);
     // question title output
     $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output");
     $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, ''));
     $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, ''));
     $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, ''));
     $title_output->setValue($this->testOBJ->getTitleOutput());
     $title_output->setInfo($this->lng->txt("tst_title_output_description"));
     $form->addItem($title_output);
     // selector for unicode characters
     global $ilSetting;
     if ($ilSetting->get('char_selector_availability') > 0) {
         require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
         $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST);
         $char_selector->getConfig()->setAvailability($this->testOBJ->getCharSelectorAvailability());
         $char_selector->getConfig()->setDefinition($this->testOBJ->getCharSelectorDefinition());
         $char_selector->addFormProperties($form);
         $char_selector->setFormValues($form);
     }
     // Autosave
     $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave');
     $autosave_output->setValue(1);
     $autosave_output->setChecked($this->testOBJ->getAutosave());
     $autosave_output->setInfo($this->lng->txt('autosave_info'));
     $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival');
     $autosave_interval->setSize(10);
     $autosave_interval->setValue($this->testOBJ->getAutosaveIval() / 1000);
     $autosave_interval->setInfo($this->lng->txt('autosave_ival_info'));
     $autosave_output->addSubItem($autosave_interval);
     $form->addItem($autosave_output);
     if (!$this->settingsTemplate || $this->formShowSequenceSection($this->settingsTemplate->getSettings())) {
         // sequence properties
         $seqheader = new ilFormSectionHeaderGUI();
         $seqheader->setTitle($this->lng->txt("tst_sequence_properties"));
         $form->addItem($seqheader);
     }
     // postpone questions
     $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone");
     $postpone->setValue(1);
     $postpone->setChecked($this->testOBJ->getSequenceSettings());
     $postpone->setInfo($this->lng->txt("tst_postpone_description"));
     $form->addItem($postpone);
     // shuffle questions
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->testOBJ->getShuffleQuestions());
     $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description"));
     $form->addItem($shuffle);
     // show list of questions
     $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions");
     //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary"));
     $list_of_questions->setValue(1);
     $list_of_questions->setChecked($this->testOBJ->getListOfQuestions());
     $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description"));
     $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options");
     $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', ''));
     $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', ''));
     $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', ''));
     $values = array();
     if ($this->testOBJ->getListOfQuestionsStart()) {
         array_push($values, 'chb_list_of_questions_start');
     }
     if ($this->testOBJ->getListOfQuestionsEnd()) {
         array_push($values, 'chb_list_of_questions_end');
     }
     if ($this->testOBJ->getListOfQuestionsDescription()) {
         array_push($values, 'chb_list_of_questions_with_description');
     }
     $list_of_questions_options->setValue($values);
     $list_of_questions->addSubItem($list_of_questions_options);
     $form->addItem($list_of_questions);
     // show question marking
     $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker");
     $marking->setValue(1);
     $marking->setChecked($this->testOBJ->getShowMarker());
     $marking->setInfo($this->lng->txt("question_marking_description"));
     $form->addItem($marking);
     // show suspend test
     $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel");
     $cancel->setValue(1);
     $cancel->setChecked($this->testOBJ->getShowCancel());
     $cancel->setInfo($this->lng->txt("tst_show_cancel_description"));
     $form->addItem($cancel);
     if (!$this->settingsTemplate || $this->formShowNotificationSection($this->settingsTemplate->getSettings())) {
         // notifications
         $notifications = new ilFormSectionHeaderGUI();
         $notifications->setTitle($this->lng->txt("tst_mail_notification"));
         $form->addItem($notifications);
     }
     // mail notification
     $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification");
     $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, ''));
     $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, ''));
     $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, ''));
     $mailnotification->setValue($this->testOBJ->getMailNotification());
     $form->addItem($mailnotification);
     $mailnottype = new ilCheckboxInputGUI('', "mailnottype");
     $mailnottype->setValue(1);
     $mailnottype->setOptionTitle($this->lng->txt("mailnottype"));
     $mailnottype->setChecked($this->testOBJ->getMailNotificationType());
     $form->addItem($mailnottype);
     /* This options always active (?) */
     $highscore_head = new ilFormSectionHeaderGUI();
     $highscore_head->setTitle($this->lng->txt("tst_highscore_options"));
     $form->addItem($highscore_head);
     $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled");
     $highscore->setValue(1);
     $highscore->setChecked($this->testOBJ->getHighscoreEnabled());
     $highscore->setInfo($this->lng->txt("tst_highscore_description"));
     $form->addItem($highscore);
     $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon");
     $highscore_anon->setValue(1);
     $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon());
     $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description"));
     $highscore->addSubItem($highscore_anon);
     $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts");
     $highscore_achieved_ts->setValue(1);
     $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS());
     $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description"));
     $highscore->addSubItem($highscore_achieved_ts);
     $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score");
     $highscore_score->setValue(1);
     $highscore_score->setChecked($this->testOBJ->getHighscoreScore());
     $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description"));
     $highscore->addSubItem($highscore_score);
     $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage");
     $highscore_percentage->setValue(1);
     $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage());
     $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description"));
     $highscore->addSubItem($highscore_percentage);
     $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints");
     $highscore_hints->setValue(1);
     $highscore_hints->setChecked($this->testOBJ->getHighscoreHints());
     $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description"));
     $highscore->addSubItem($highscore_hints);
     $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime");
     $highscore_wtime->setValue(1);
     $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime());
     $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description"));
     $highscore->addSubItem($highscore_wtime);
     $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table");
     $highscore_own_table->setValue(1);
     $highscore_own_table->setChecked($this->testOBJ->getHighscoreOwnTable());
     $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description"));
     $highscore->addSubItem($highscore_own_table);
     $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table");
     $highscore_top_table->setValue(1);
     $highscore_top_table->setChecked($this->testOBJ->getHighscoreTopTable());
     $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description"));
     $highscore->addSubItem($highscore_top_table);
     $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num");
     $highscore_top_num->setSize(4);
     $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit"));
     $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum());
     $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description"));
     $highscore->addSubItem($highscore_top_num);
     if (!$this->settingsTemplate || $this->formShowTestExecutionSection($this->settingsTemplate->getSettings())) {
         $testExecution = new ilFormSectionHeaderGUI();
         $testExecution->setTitle($this->lng->txt("tst_test_execution"));
         $form->addItem($testExecution);
     }
     // kiosk mode
     $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk");
     $kiosk->setValue(1);
     $kiosk->setChecked($this->testOBJ->getKioskMode());
     $kiosk->setInfo($this->lng->txt("kiosk_description"));
     // kiosk mode options
     $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options");
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', ''));
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', ''));
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt('examid_in_kiosk'), 'examid_in_kiosk'));
     $values = array();
     if ($this->testOBJ->getShowKioskModeTitle()) {
         array_push($values, 'kiosk_title');
     }
     if ($this->testOBJ->getShowKioskModeParticipant()) {
         array_push($values, 'kiosk_participant');
     }
     if ($this->testOBJ->getExamidInKiosk()) {
         array_push($values, 'examid_in_kiosk');
     }
     $kiosktitle->setValue($values);
     $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc"));
     $kiosk->addSubItem($kiosktitle);
     $form->addItem($kiosk);
     $redirection_mode = $this->testOBJ->getRedirectionMode();
     $rm_enabled = new ilCheckboxInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_enabled');
     $rm_enabled->setChecked($redirection_mode == '0' ? false : true);
     $radio_rm = new ilRadioGroupInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_mode');
     $always = new ilRadioOption($this->lng->txt('tst_results_access_always'), REDIRECT_ALWAYS);
     $radio_rm->addOption($always);
     $kiosk = new ilRadioOption($this->lng->txt('redirect_in_kiosk_mode'), REDIRECT_KIOSK);
     $radio_rm->addOption($kiosk);
     $radio_rm->setValue(in_array($redirection_mode, array(REDIRECT_ALWAYS, REDIRECT_KIOSK)) ? $redirection_mode : REDIRECT_ALWAYS);
     $rm_enabled->addSubItem($radio_rm);
     $redirection_url = new ilTextInputGUI($this->lng->txt('redirection_url'), 'redirection_url');
     $redirection_url->setValue((string) $this->testOBJ->getRedirectionUrl());
     $redirection_url->setRequired(true);
     $rm_enabled->addSubItem($redirection_url);
     $form->addItem($rm_enabled);
     // Sign submission
     $sign_submission = $this->testOBJ->getSignSubmission();
     $sign_submission_enabled = new ilCheckboxInputGUI($this->lng->txt('sign_submission'), 'sign_submission');
     $sign_submission_enabled->setChecked($sign_submission);
     $sign_submission_enabled->setInfo($this->lng->txt('sign_submission_info'));
     $form->addItem($sign_submission_enabled);
     if (!$this->settingsTemplate || $this->formShowParticipantSection($this->settingsTemplate->getSettings())) {
         // participants properties
         $restrictions = new ilFormSectionHeaderGUI();
         $restrictions->setTitle($this->lng->txt("tst_max_allowed_users"));
         $form->addItem($restrictions);
     }
     $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants");
     $fixedparticipants->setValue(1);
     $fixedparticipants->setChecked($this->testOBJ->getFixedParticipants());
     $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants"));
     $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description"));
     $invited_users = $this->testOBJ->getInvitedUsers();
     if ($total && count($invited_users) == 0) {
         $fixedparticipants->setDisabled(true);
     }
     $form->addItem($fixedparticipants);
     // simultaneous users
     $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers");
     $simul->setSize(3);
     $simul->setValue($this->testOBJ->getAllowedUsers() ? $this->testOBJ->getAllowedUsers() : '');
     $form->addItem($simul);
     // idle time
     $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap");
     $idle->setSize(4);
     $idle->setSuffix($this->lng->txt("seconds"));
     $idle->setValue($this->testOBJ->getAllowedUsersTimeGap() ? $this->testOBJ->getAllowedUsersTimeGap() : '');
     $form->addItem($idle);
     // Edit ecs export settings
     include_once 'Modules/Test/classes/class.ilECSTestSettings.php';
     $ecs = new ilECSTestSettings($this->testOBJ);
     $ecs->addSettingsToForm($form, 'tst');
     // remove items when using template
     if ($this->settingsTemplate) {
         foreach ($this->settingsTemplate->getSettings() as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
 /**
  * init Form
  */
 public function initForm()
 {
     $this->form = new ilPropertyFormGUI();
     $prefix = $this->ctrl->isAsynch() ? 'dclajax' : 'dcl';
     // Used by datacolleciton.js to select input elements
     $this->form->setId($prefix . $this->table_id . $this->record_id);
     $hidden_prop = new ilHiddenInputGUI("table_id");
     $hidden_prop->setValue($this->table_id);
     $this->form->addItem($hidden_prop);
     if ($this->record_id) {
         $hidden_prop = new ilHiddenInputGUI("record_id");
         $hidden_prop->setValue($this->record_id);
         $this->form->addItem($hidden_prop);
     }
     $this->ctrl->setParameter($this, "record_id", $this->record_id);
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     $allFields = $this->table->getRecordFields();
     $inline_css = '';
     foreach ($allFields as $field) {
         $item = ilDataCollectionDatatype::getInputField($field);
         if ($item === NULL) {
             continue;
             // Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input
         }
         if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
             $fieldref = $field->getFieldRef();
             $reffield = ilDataCollectionCache::getFieldCache($fieldref);
             $options = array();
             if (!$field->isNRef()) {
                 $options[""] = $this->lng->txt('dcl_please_select');
             }
             $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId());
             foreach ($reftable->getRecords() as $record) {
                 // If the referenced field is MOB or FILE, we display the filename in the dropdown
                 switch ($reffield->getDatatypeId()) {
                     case ilDataCollectionDatatype::INPUTFORMAT_FILE:
                         $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false);
                         $options[$record->getId()] = $file_obj->getFileName();
                         break;
                     case ilDataCollectionDatatype::INPUTFORMAT_MOB:
                         $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false);
                         $options[$record->getId()] = $media_obj->getTitle();
                         break;
                     case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
                         $options[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
                         break;
                     default:
                         $options[$record->getId()] = $record->getRecordFieldValue($fieldref);
                         break;
                 }
             }
             asort($options);
             $item->setOptions($options);
             if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
                 // FSX use this to apply to MultiSelectInputGUI
                 //					if (!$field->isNRef()) { // addCustomAttribute only defined for single selects
                 if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) {
                     $item->addCustomAttribute('data-ref="1"');
                     $item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"');
                     $item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
                 }
                 //					}
             }
             if ($item instanceof ilMultiSelectInputGUI) {
                 $item->setWidth(400);
                 $item->setHeight(100);
                 $inline_css .= 'div#' . $item->getFieldId() . '{resize:both;} ';
             }
         }
         if ($this->record_id) {
             $record = ilDataCollectionCache::getRecordCache($this->record_id);
         }
         $item->setRequired($field->getRequired());
         //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it.
         if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) {
             if ($this->record_id and $record->getId()) {
                 $field_value = $record->getRecordFieldValue($field->getId());
                 if ($field_value) {
                     $item->setRequired(false);
                 }
             }
             // If this is an ajax request to return the form, input files are currently not supported
             if ($this->ctrl->isAsynch()) {
                 $item->setDisabled(true);
             }
         }
         if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
             $item->setDisabled(true);
         }
         $this->form->addItem($item);
     }
     $this->tpl->addInlineCss($inline_css);
     // Add possibility to change the owner in edit mode
     if ($this->record_id) {
         $ownerField = $this->table->getField('owner');
         $inputfield = ilDataCollectionDatatype::getInputField($ownerField);
         $this->form->addItem($inputfield);
     }
     // save and cancel commands
     if ($this->record_id) {
         $this->form->setTitle($this->lng->txt("dcl_update_record"));
         $this->form->addCommandButton("save", $this->lng->txt("dcl_update_record"));
         if (!$this->ctrl->isAsynch()) {
             $this->form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
         }
     } else {
         $this->form->setTitle($this->lng->txt("dcl_add_new_record"));
         $this->form->addCommandButton("save", $this->lng->txt("save"));
         if (!$this->ctrl->isAsynch()) {
             $this->form->addCommandButton("cancelSave", $this->lng->txt("cancel"));
         }
     }
     $this->ctrl->setParameter($this, "table_id", $this->table_id);
     $this->ctrl->setParameter($this, "record_id", $this->record_id);
 }
 /**
  * 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 an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(false);
     $form->setTableWidth("100%");
     $form->setId("assfileupload");
     $this->addBasicQuestionFormProperties($form);
     // maxsize
     $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize");
     $maxsize->setValue($this->object->getMaxSize());
     $maxsize->setInfo($this->lng->txt("maxsize_info"));
     $maxsize->setSize(10);
     $maxsize->setMinValue(0);
     //mbecker: Quick fix for mantis bug 8595: Change size file
     $umf = get_cfg_var("upload_max_filesize");
     // get the value for the maximal post data from the php.ini (if available)
     $pms = get_cfg_var("post_max_size");
     //convert from short-string representation to "real" bytes
     $multiplier_a = array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024);
     $umf_parts = preg_split("/(\\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     $pms_parts = preg_split("/(\\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     if (count($umf_parts) == 2) {
         $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
     }
     if (count($pms_parts) == 2) {
         $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
     }
     // use the smaller one as limit
     $max_filesize = min($umf, $pms);
     if (!$max_filesize) {
         $max_filesize = max($umf, $pms);
     }
     $maxsize->setMaxValue($max_filesize);
     // end quick fix
     $maxsize->setRequired(FALSE);
     $form->addItem($maxsize);
     // allowedextensions
     $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions");
     $allowedextensions->setInfo($this->lng->txt("allowedextensions_info"));
     $allowedextensions->setValue($this->object->getAllowedExtensions());
     $allowedextensions->setRequired(FALSE);
     $form->addItem($allowedextensions);
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : '');
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(false);
     $form->addItem($points);
     $subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission');
     $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
     $subcompl->setValue(1);
     $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
     $form->addItem($subcompl);
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
Ejemplo n.º 12
0
 public function searchUsers($save = true)
 {
     global $ilUser, $ilCtrl;
     $this->tpl->setTitle($this->lng->txt("mail"));
     if ($save) {
         // decode post values
         $files = array();
         if (is_array($_POST['attachments'])) {
             foreach ($_POST['attachments'] as $value) {
                 $files[] = urldecode($value);
             }
         }
         // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
         $this->umail->savePostData($ilUser->getId(), $files, ilUtil::securePlainString($_POST["rcp_to"]), ilUtil::securePlainString($_POST["rcp_cc"]), ilUtil::securePlainString($_POST["rcp_bcc"]), $_POST["m_type"], ilUtil::securePlainString($_POST["m_email"]), ilUtil::securePlainString($_POST["m_subject"]), ilUtil::securePlainString($_POST["m_message"]), ilUtil::securePlainString($_POST['use_placeholders']));
     }
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setId('search_rcp');
     $form->setTitle($this->lng->txt('search_recipients'));
     $form->setFormAction($ilCtrl->getFormAction($this, 'search'));
     $inp = new ilTextInputGUI($this->lng->txt("search_for"), 'search');
     $inp->setSize(30);
     $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true, false);
     $inp->setDataSource($dsDataLink);
     if (strlen(trim($_SESSION["mail_search_search"])) > 0) {
         $inp->setValue(ilUtil::prepareFormOutput(trim($_SESSION["mail_search_search"]), true));
     }
     $form->addItem($inp);
     $form->addCommandButton('search', $this->lng->txt("search"));
     $form->addCommandButton('cancelSearch', $this->lng->txt("cancel"));
     $this->tpl->setContent($form->getHtml());
     $this->tpl->show();
 }
 /**
  * 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;
 }
 function importExternalMailRecipientsFromTextFormObject()
 {
     global $ilAccess;
     $this->parent_gui->handleWriteAccess();
     $this->setCodesSubtabs();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form_import_text = new ilPropertyFormGUI();
     $form_import_text->setFormAction($this->ctrl->getFormAction($this));
     $form_import_text->setTableWidth("100%");
     $form_import_text->setId("codes_import_text");
     $headertext = new ilFormSectionHeaderGUI();
     $headertext->setTitle($this->lng->txt("import_from_text"));
     $form_import_text->addItem($headertext);
     $inp = new ilTextAreaInputGUI($this->lng->txt('externaltext'), 'externaltext');
     if (array_key_exists('externaltext', $_SESSION) && strlen($_SESSION['externaltext'])) {
         $inp->setValue($_SESSION['externaltext']);
     } else {
         // $this->lng->txt('mail_import_example1') #14897
         $inp->setValue("email;firstname;lastname\n" . $this->lng->txt('mail_import_example2') . "\n" . $this->lng->txt('mail_import_example3') . "\n");
     }
     $inp->setRequired(true);
     $inp->setCols(80);
     $inp->setRows(10);
     $inp->setInfo($this->lng->txt('externaltext_info'));
     $form_import_text->addItem($inp);
     unset($_SESSION['externaltext']);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_text->addCommandButton("importExternalRecipientsFromText", $this->lng->txt("import"));
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form_import_text->addCommandButton("codes", $this->lng->txt("cancel"));
     }
     $this->tpl->setContent($form_import_text->getHTML());
 }
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(true);
     $form->setTableWidth("100%");
     $form->setId("matching");
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     $this->populateQuestionSpecificFormPart($form);
     $this->populateAnswerSpecificFormPart($form);
     $this->populateTaxonomyFormSection($form);
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 (!$errors && count($this->object->getTerms()) < count($this->object->getDefinitions()) && !$this->object->getSelfAssessmentEditingMode()) {
             $errors = true;
             $terms = $form->getItemByPostVar('terms');
             $terms->setAlert($this->lng->txt("msg_number_of_terms_too_low"));
             ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
         }
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
Ejemplo n.º 16
0
 /**
  * Material tab of the survey questions
  */
 public function material($checkonly = FALSE)
 {
     global $rbacsystem, $ilTabs;
     $ilTabs->activateTab("material");
     $add_html = '';
     if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
         include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
         $form = new ilPropertyFormGUI();
         $form->setFormAction($this->ctrl->getFormAction($this));
         $form->setTitle($this->lng->txt('add_material'));
         $form->setMultipart(FALSE);
         $form->setTableWidth("100%");
         $form->setId("material");
         // material
         $material = new ilRadioGroupInputGUI($this->lng->txt("material"), "internalLinkType");
         $material->setRequired(true);
         $material->addOption(new ilRadioOption($this->lng->txt('obj_lm'), "lm"));
         $material->addOption(new ilRadioOption($this->lng->txt('obj_st'), "st"));
         $material->addOption(new ilRadioOption($this->lng->txt('obj_pg'), "pg"));
         $material->addOption(new ilRadioOption($this->lng->txt('glossary_term'), "glo"));
         $form->addItem($material);
         $form->addCommandButton("addMaterial", $this->lng->txt("add"));
         $errors = false;
         if ($checkonly) {
             $form->setValuesByPost();
             $errors = !$form->checkInput();
             if ($errors) {
                 $checkonly = false;
             }
         }
         $add_html = $form->getHTML();
     }
     $mat_html = "";
     if (count($this->object->getMaterial())) {
         include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyMaterialsTableGUI.php";
         $table_gui = new ilSurveyMaterialsTableGUI($this, 'material', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false);
         $data = array();
         foreach ($this->object->getMaterial() as $material) {
             switch ($material->type) {
                 case 0:
                     $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
                     $type = $this->lng->txt('internal_link');
                     break;
             }
             $title = strlen($material->title) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material');
             array_push($data, array('href' => $href, 'title' => $title, 'type' => $type));
         }
         $table_gui->setData($data);
         $mat_html = $table_gui->getHTML();
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html);
     }
     return $errors;
 }
Ejemplo n.º 17
0
 private function formTimingObject()
 {
     global $ilAccess;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("tst_change_workingtime");
     $form->setTitle($this->lng->txt("tst_change_workingtime"));
     // test users
     $participantslist = new ilSelectInputGUI($this->lng->txt('participants'), "participant");
     $participants =& $this->object->getTestParticipants();
     $times = $this->object->getStartingTimeOfParticipants();
     $addons = $this->object->getTimeExtensionsOfParticipants();
     $options = array('' => $this->lng->txt('please_select'), '0' => $this->lng->txt('all_participants'));
     foreach ($participants as $participant) {
         $started = "";
         if ($this->object->getAnonymity()) {
             $name = $this->lng->txt("anonymous");
         } else {
             $name = $participant['lastname'] . ', ' . $participant['firstname'];
         }
         if ($times[$participant['active_id']]) {
             $started = ", " . $this->lng->txt('tst_started') . ': ' . ilDatePresentation::formatDate(new ilDateTime($times[$participant['active_id']], IL_CAL_DATETIME));
         }
         if ($addons[$participant['active_id']] > 0) {
             $started .= ", " . $this->lng->txt('extratime') . ': ' . $addons[$participant['active_id']] . ' ' . $this->lng->txt('minutes');
         }
         $options[$participant['active_id']] = $participant['login'] . ' (' . $name . ')' . $started;
     }
     $participantslist->setRequired(true);
     $participantslist->setOptions($options);
     $form->addItem($participantslist);
     // extra time
     $extratime = new ilNumberInputGUI($this->lng->txt("extratime"), "extratime");
     $extratime->setInfo($this->lng->txt('tst_extratime_info'));
     $extratime->setRequired(true);
     $extratime->setMinValue(0);
     $extratime->setMinvalueShouldBeGreater(false);
     $extratime->setSuffix($this->lng->txt('minutes'));
     $extratime->setSize(5);
     $form->addItem($extratime);
     if (is_array($_POST) && strlen($_POST['cmd']['timing'])) {
         $form->setValuesByArray($_POST);
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form->addCommandButton("timing", $this->lng->txt("save"));
     }
     $form->addCommandButton('timingOverview', $this->lng->txt("cancel"));
     return $form;
 }
 private function buildForm()
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt('save'));
     $form->setTitle($this->lng->txt('qpl_form_general_settings'));
     $form->setId('properties');
     // online
     $online = new ilCheckboxInputGUI($this->lng->txt('qpl_settings_general_form_property_online'), 'online');
     $online->setInfo($this->lng->txt('qpl_settings_general_form_property_online_description'));
     $online->setChecked($this->poolOBJ->getOnline());
     $form->addItem($online);
     // show taxonomies
     $showTax = new ilCheckboxInputGUI($this->lng->txt('qpl_settings_general_form_property_show_taxonomies'), 'show_taxonomies');
     $showTax->setInfo($this->lng->txt('qpl_settings_general_form_prop_show_tax_desc'));
     $showTax->setChecked($this->poolOBJ->getShowTaxonomies());
     $form->addItem($showTax);
     $taxSelectOptions = $this->getTaxonomySelectInputOptions();
     // pool navigation taxonomy
     $navTax = new ilSelectInputGUI($this->lng->txt('qpl_settings_general_form_property_nav_taxonomy'), 'nav_taxonomy');
     $navTax->setInfo($this->lng->txt('qpl_settings_general_form_property_nav_taxonomy_description'));
     $navTax->setValue($this->poolOBJ->getNavTaxonomyId());
     $navTax->setOptions($taxSelectOptions);
     $showTax->addSubItem($navTax);
     // skill service activation
     if (ilObjQuestionPool::isSkillManagementGloballyActivated()) {
         $skillService = new ilCheckboxInputGUI($this->lng->txt('tst_activate_skill_service'), 'skill_service');
         $skillService->setChecked($this->poolOBJ->isSkillServiceEnabled());
         $form->addItem($skillService);
     }
     return $form;
 }
Ejemplo n.º 19
0
 /**
  * Shows the certificate editor for ILIAS tests
  */
 public function certificateEditor()
 {
     global $ilAccess;
     $form_fields = array();
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $form_fields = $this->getFormFieldsFromPOST();
     } else {
         $form_fields = $this->getFormFieldsFromFO();
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setPreventDoubleSubmission(false);
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("certificate_edit"));
     $form->setMultipart(TRUE);
     $form->setTableWidth("100%");
     $form->setId("certificate");
     $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active");
     $active->setChecked($form_fields["active"]);
     $form->addItem($active);
     $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import");
     $import->setRequired(FALSE);
     $import->setSuffixes(array("zip"));
     // handle the certificate import
     if (strlen($_FILES["certificate_import"]["tmp_name"])) {
         if ($import->checkInput()) {
             $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]);
             if ($result == FALSE) {
                 $import->setAlert($this->lng->txt("certificate_error_import"));
             } else {
                 $this->ctrl->redirect($this, "certificateEditor");
             }
         }
     }
     $form->addItem($import);
     $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat");
     $pageformats = $this->object->getPageFormats();
     $pageformat->setValue($form_fields["pageformat"]);
     foreach ($pageformats as $format) {
         $option = new ilRadioOption($format["name"], $format["value"]);
         if (strcmp($format["value"], "custom") == 0) {
             $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight");
             $pageheight->setValue($form_fields["pageheight"]);
             $pageheight->setSize(6);
             $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pageheight->setInfo($this->lng->txt("certificate_unit_description"));
             $pageheight->setRequired(true);
             $option->addSubitem($pageheight);
             $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth");
             $pagewidth->setValue($form_fields["pagewidth"]);
             $pagewidth->setSize(6);
             $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pagewidth->setInfo($this->lng->txt("certificate_unit_description"));
             $pagewidth->setRequired(true);
             $option->addSubitem($pagewidth);
         }
         $pageformat->addOption($option);
     }
     $pageformat->setRequired(true);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $pageformat->checkInput();
     }
     $form->addItem($pageformat);
     $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background");
     $bgimage->setRequired(FALSE);
     $bgimage->setUseCache(false);
     if (count($_POST)) {
         // handle the background upload
         if (strlen($_FILES["background"]["tmp_name"])) {
             if ($bgimage->checkInput()) {
                 $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]);
                 if ($result == FALSE) {
                     $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage"));
                 }
             }
         }
     }
     if (!$this->object->hasBackgroundImage()) {
         include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
         if (ilObjCertificateSettingsAccess::hasBackgroundImage()) {
             $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb());
         }
     } else {
         $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
     }
     $form->addItem($bgimage);
     $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top");
     $padding_top->setRequired(TRUE);
     $padding_top->setValue($form_fields["padding_top"]);
     $padding_top->setSize(6);
     $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
     $padding_top->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $padding_top->checkInput();
     }
     $form->addItem($padding_top);
     $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body");
     $rect->setRequired(TRUE);
     $rect->setUseUnits(TRUE);
     $rect->setTop($form_fields["margin_body_top"]);
     $rect->setBottom($form_fields["margin_body_bottom"]);
     $rect->setLeft($form_fields["margin_body_left"]);
     $rect->setRight($form_fields["margin_body_right"]);
     $rect->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $rect->checkInput();
     }
     $form->addItem($rect);
     $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text");
     $certificate->removePlugin('ilimgupload');
     $certificate->setValue($form_fields["certificate_text"]);
     $certificate->setRequired(TRUE);
     $certificate->setRows(20);
     $certificate->setCols(80);
     // fraunhpatch start
     $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate");
     foreach (ilCertificate::getCustomCertificateFields() as $f) {
         $common_desc_tpl->setCurrentBlock("cert_field");
         $common_desc_tpl->setVariable("PH", $f["ph"]);
         $common_desc_tpl->setVariable("PH_TXT", $f["name"]);
         $common_desc_tpl->parseCurrentBlock();
     }
     $common_desc = $common_desc_tpl->get();
     // fraunhpatch start
     $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc);
     $certificate->setUseRte(TRUE, '3.4.7');
     $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul");
     $certificate->setRteTags($tags);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $certificate->checkInput();
     }
     $form->addItem($certificate);
     $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         if ($this->object->isComplete() || $this->object->hasBackgroundImage()) {
             $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview"));
             $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export"));
             $form->addCommandButton("certificateDelete", $this->lng->txt("delete"));
         }
         $form->addCommandButton("certificateSave", $this->lng->txt("save"));
     }
     $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         if ($_POST["background_delete"]) {
             $this->object->deleteBackgroundImage();
         }
         if ($form->checkInput()) {
             try {
                 $xslfo = $this->object->processXHTML2FO($form_fields);
                 $this->object->getAdapter()->saveFormFields($form_fields);
                 $this->object->saveCertificate($xslfo);
                 $this->object->writeActive($form_fields["active"]);
                 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE);
                 $this->ctrl->redirect($this, "certificateEditor");
             } catch (Exception $e) {
                 ilUtil::sendFailure($e->getMessage());
             }
         }
     }
 }
 /**
  * builds the feedback editing form object
  * 
  * @access private
  * @return \ilPropertyFormGUI
  */
 private function buildForm()
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('feedback_generic'));
     $form->setTableWidth("100%");
     $form->setId("feedback");
     $this->feedbackOBJ->completeGenericFormProperties($form);
     $this->feedbackOBJ->completeSpecificFormProperties($form);
     if ($this->isFormSaveable()) {
         $form->addCommandButton(self::CMD_SAVE, $this->lng->txt("save"));
     }
     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("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
  */
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     require_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $orderingtype = $this->getOrderingTypeFromPost();
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart($orderingtype == OQ_PICTURES ? TRUE : FALSE);
     $form->setTableWidth("100%");
     $form->setId("ordering");
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     $this->populateQuestionSpecificFormPart($form);
     $this->populateAnswerSpecificFormPart($form);
     if (true || !$this->object->getSelfAssessmentEditingMode()) {
         if ($orderingtype == OQ_PICTURES) {
             $form->addCommandButton("changeToText", $this->lng->txt("order_terms"));
             $form->addCommandButton("orderNestedPictures", $this->lng->txt("order_nested_pictures"));
         } else {
             if ($orderingtype == OQ_NESTED_TERMS) {
                 $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures"));
                 $form->addCommandButton("changeToText", $this->lng->txt("order_terms"));
             } else {
                 if ($orderingtype == OQ_NESTED_PICTURES) {
                     $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures"));
                     $form->addCommandButton("changeToText", $this->lng->txt("order_terms"));
                 } else {
                     $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures"));
                     $form->addCommandButton("orderNestedTerms", $this->lng->txt("order_nested_terms"));
                 }
             }
         }
     }
     $this->populateTaxonomyFormSection($form);
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
Ejemplo n.º 23
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;
 }
 /**
  * Questionpool properties
  */
 public function propertiesObject()
 {
     $save = strcmp($this->ctrl->getCmd(), "save") == 0 ? true : false;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'properties'));
     $form->setTitle($this->lng->txt("properties"));
     $form->setMultipart(false);
     $form->setId("properties");
     // online
     $online = new ilCheckboxInputGUI($this->lng->txt("spl_online_property"), "online");
     $online->setInfo($this->lng->txt("spl_online_property_description"));
     $online->setChecked($this->object->getOnline());
     $form->addItem($online);
     $form->addCommandButton("saveProperties", $this->lng->txt("save"));
     if ($save) {
         $form->checkInput();
     }
     $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
 }
 /**
  * display assessment folder logs form
  */
 public function logsObject($p_from = null, $p_until = null, $p_test = null)
 {
     global $ilTabs;
     $ilTabs->activateTab('logs');
     $template = new ilTemplate("tpl.assessment_logs.html", TRUE, TRUE, "Modules/Test");
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     $available_tests =& ilObjTest::_getAvailableTests(1);
     if (count($available_tests) == 0) {
         ilUtil::sendInfo($this->lng->txt('assessment_log_no_data'));
         return;
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("logs");
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("assessment_log"));
     $form->addItem($header);
     // from
     $from = new ilDateTimeInputGUI($this->lng->txt('cal_from'), "log_from");
     $from->setShowTime(true);
     $now = getdate();
     $fromdate = $p_from ? $p_from : ($_GET['log_from'] ? $_GET['log_from'] : mktime(0, 0, 0, 1, 1, $now['year']));
     $from->setDate(new ilDateTime($fromdate, IL_CAL_UNIX));
     $form->addItem($from);
     // until
     $until = new ilDateTimeInputGUI($this->lng->txt('cal_until'), "log_until");
     $until->setShowTime(true);
     $untildate = $p_until ? $p_until : ($_GET['log_until'] ? $_GET['log_until'] : time());
     $until->setDate(new ilDateTime($untildate, IL_CAL_UNIX));
     $form->addItem($until);
     // tests
     $fortest = new ilSelectInputGUI($this->lng->txt('assessment_log_for_test'), "sel_test");
     $sorted_options = array();
     foreach ($available_tests as $key => $value) {
         $sorted_options[] = array('title' => ilUtil::prepareFormOutput($value) . " [" . $this->object->getNrOfLogEntries($key) . " " . $this->lng->txt("assessment_log_log_entries") . "]", 'key' => $key);
     }
     $sorted_options = ilUtil::sortArray($sorted_options, 'title', 'asc');
     $options = array();
     foreach ($sorted_options as $option) {
         $options[$option['key']] = $option['title'];
     }
     $fortest->setOptions($options);
     $p_test = $p_test ? $p_test : $_GET['sel_test'];
     if ($p_test) {
         $fortest->setValue($p_test);
     }
     $form->addItem($fortest);
     $this->ctrl->setParameter($this, 'sel_test', $p_test);
     $this->ctrl->setParameter($this, 'log_until', $untildate);
     $this->ctrl->setParameter($this, 'log_from', $fromdate);
     $form->addCommandButton("showLog", $this->lng->txt("show"));
     $form->addCommandButton("exportLog", $this->lng->txt("export"));
     $template->setVariable("FORM", $form->getHTML());
     if ($p_test) {
         include_once "./Modules/Test/classes/tables/class.ilAssessmentFolderLogTableGUI.php";
         $table_gui = new ilAssessmentFolderLogTableGUI($this, 'logs');
         $log_output =& $this->object->getLog($fromdate, $untildate, $p_test);
         $table_gui->setData($log_output);
         $template->setVariable('LOG', $table_gui->getHTML());
     }
     $this->tpl->setVariable("ADM_CONTENT", $template->get());
 }
Ejemplo n.º 26
0
 /**
  * Init the form to change the settings value type
  *
  * @return   object  property form to change settings type
  */
 function initSettingsTypeForm()
 {
     include_once "./Services/Administration/classes/class.ilSetting.php";
     $type = ilSetting::_getValueType();
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setId("settings_type");
     $form->setTitle($this->lng->txt("settings_type"));
     $form->setFormAction("setup.php?cmd=gateway");
     $item = new ilNonEditableValueGUI($this->lng->txt('settings_type_current'));
     $item->setValue(strtoupper($type));
     if ($type == "clob") {
         $item->setInfo($this->lng->txt('settings_info_clob'));
         $form->addCommandButton("showLongerSettings", $this->lng->txt("settings_show_longer"));
         $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_text"));
     } else {
         $item->setInfo($this->lng->txt('settings_info_text'));
         $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_clob"));
     }
     $form->addItem($item);
     if (is_array($this->longer_settings)) {
         $item = new ilCustomInputGUI($this->lng->txt('settings_longer_values'));
         if (count($this->longer_settings)) {
             foreach ($this->longer_settings as $row) {
                 $subitem = new ilCustomInputGUI(sprintf($this->lng->txt('settings_key_info'), $row['module'], $row['keyword']));
                 $subitem->setInfo($row['value']);
                 $item->addSubItem($subitem);
             }
         } else {
             $item->setHTML($this->lng->txt('settings_no_longer_values'));
         }
         $form->addItem($item);
     }
     return $form;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $orderingtype = array_key_exists('ordering_type', $_POST) ? $_POST['ordering_type'] : $this->object->getOrderingType();
     if (strcmp($this->ctrl->getCmd(), 'changeToText') == 0) {
         $orderingtype = OQ_TERMS;
     }
     if (strcmp($this->ctrl->getCmd(), 'changeToPictures') == 0) {
         $orderingtype = OQ_PICTURES;
     }
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart($orderingtype == OQ_PICTURES ? TRUE : FALSE);
     $form->setTableWidth("100%");
     $form->setId("ordering");
     // Edit mode
     $hidden = new ilHiddenInputGUI("ordering_type");
     $hidden->setValue($orderingtype);
     $form->addItem($hidden);
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     if (!$this->getSelfAssessmentEditingMode()) {
         $element_height = new ilNumberInputGUI($this->lng->txt("element_height"), "element_height");
         $element_height->setValue($this->object->getElementHeight());
         $element_height->setRequired(false);
         $element_height->setMaxLength(6);
         $element_height->setMinValue(20);
         $element_height->setSize(6);
         $element_height->setInfo($this->lng->txt("element_height_info"));
         $form->addItem($element_height);
     }
     if ($orderingtype == OQ_PICTURES) {
         $geometry = new ilNumberInputGUI($this->lng->txt("thumb_geometry"), "thumb_geometry");
         $geometry->setValue($this->object->getThumbGeometry());
         $geometry->setRequired(true);
         $geometry->setMaxLength(6);
         $geometry->setMinValue(20);
         $geometry->setSize(6);
         $geometry->setInfo($this->lng->txt("thumb_geometry_info"));
         $form->addItem($geometry);
     }
     if (count($this->object->getAnswers()) == 0) {
         $this->object->addAnswer();
     }
     // Answers
     if ($orderingtype == OQ_PICTURES) {
         include_once "./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php";
         $answers = new ilImageWizardInputGUI($this->lng->txt("answers"), "answers");
         $answers->setRequired(TRUE);
         $answers->setQuestionObject($this->object);
         $answers->setInfo($this->lng->txt('ordering_answer_sequence_info'));
         $answers->setAllowMove(TRUE);
         $answervalues = array();
         foreach ($this->object->getAnswers() as $index => $answervalue) {
             $answervalues[$index] = $answervalue->getAnswertext();
         }
         $answers->setValues($answervalues);
         $form->addItem($answers);
     } else {
         $answers = new ilTextWizardInputGUI($this->lng->txt("answers"), "answers");
         $answers->setRequired(TRUE);
         $answers->setInfo($this->lng->txt('ordering_answer_sequence_info'));
         $answers->setAllowMove(TRUE);
         $answervalues = array();
         foreach ($this->object->getAnswers() as $index => $answervalue) {
             $answervalues[$index] = $answervalue->getAnswertext();
         }
         ksort($answervalues);
         $answers->setValues($answervalues);
         $form->addItem($answers);
     }
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->setValue($this->object->getPoints());
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
     if (true || !$this->getSelfAssessmentEditingMode()) {
         if ($orderingtype == OQ_PICTURES) {
             $form->addCommandButton("changeToText", $this->lng->txt("order_terms"));
         } else {
             $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures"));
         }
     }
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("orderinghorizontal");
     $this->addBasicQuestionFormProperties($form);
     // ordertext
     $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
     $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText()));
     $ordertext->setRequired(TRUE);
     $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator));
     $ordertext->setRows(10);
     $ordertext->setCols(80);
     $form->addItem($ordertext);
     // textsize
     $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
     $textsize->setValue($this->object->getTextSize());
     $textsize->setInfo($this->lng->txt("textsize_info"));
     $textsize->setSize(6);
     $textsize->setMinValue(10);
     $textsize->setRequired(FALSE);
     $form->addItem($textsize);
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     // mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
     // This implements a default value of "1" for this question type.
     if ($this->object->getPoints() == null) {
         $points->setValue("1");
     } else {
         $points->setValue($this->object->getPoints());
     }
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     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 ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
 public function searchUserSPObject()
 {
     global $ilToolbar;
     if (!isset($_GET['sell_id'])) {
         ilUtil::sendFailiure($this->lng->txt('paya_no_booking_id_given'));
         $this->showObjectSelectorObject();
         return false;
     }
     $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->lng->loadLanguageModule('search');
     $this->ctrl->setParameter($this, 'sell_id', $_GET['sell_id']);
     $form_gui = new ilPropertyFormGUI();
     $form_gui->setFormAction($this->ctrl->getFormAction($this));
     $form_gui->setTitle($this->lng->txt('search_user'));
     $form_gui->setId('search_form');
     $oTitle = new ilTextInputGUI($this->lng->txt('search_search_term'), 'search_str');
     $oTitle->setMaxLength(255);
     $oTitle->setSize(40);
     $oTitle->setValue($_POST['search_str']);
     $form_gui->addItem($oTitle);
     // buttons
     $form_gui->addCommandButton('performSearchSP', $this->lng->txt('search'));
     $form_gui->addCommandButton('bookings', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form_gui->getHTML());
     return true;
 }
 public function constraintForm($step, $postvalues, &$survey_questions, $questions = FALSE)
 {
     if (strlen($_GET["start"])) {
         $this->ctrl->setParameter($this, "start", $_GET["start"]);
     }
     $this->ctrl->saveParameter($this, "precondition");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("constraintsForm");
     // #9366
     $title = array();
     $title_ids = $_SESSION["includeElements"];
     if (!$title_ids) {
         $title_ids = array($_GET["start"]);
     }
     foreach ($title_ids as $title_id) {
         // question block
         if ($survey_questions[$_SESSION["constraintstructure"][$title_id][0]]["questionblock_id"] > 0) {
             $title[] = $this->lng->txt("questionblock") . ": " . $survey_questions[$_SESSION["constraintstructure"][$title_id][0]]["questionblock_title"];
         } else {
             $title[] = $this->lng->txt($survey_questions[$_SESSION["constraintstructure"][$title_id][0]]["type_tag"]) . ": " . $survey_questions[$_SESSION["constraintstructure"][$title_id][0]]["title"];
         }
     }
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle(implode("<br/>", $title));
     $form->addItem($header);
     $fulfilled = new ilRadioGroupInputGUI($this->lng->txt("constraint_fulfilled"), "c");
     $fulfilled->addOption(new ilRadioOption($this->lng->txt("conjunction_and"), '0', ''));
     $fulfilled->addOption(new ilRadioOption($this->lng->txt("conjunction_or"), '1', ''));
     $fulfilled->setValue(strlen($postvalues['c']) ? $postvalues['c'] : 0);
     $form->addItem($fulfilled);
     $step1 = new ilSelectInputGUI($this->lng->txt("step") . " 1: " . $this->lng->txt("select_prior_question"), "q");
     $options = array();
     if (is_array($questions)) {
         foreach ($questions as $question) {
             $options[$question["question_id"]] = $question["title"] . " (" . SurveyQuestion::_getQuestionTypeName($question["type_tag"]) . ")";
         }
     }
     $step1->setOptions($options);
     $step1->setValue($postvalues["q"]);
     $form->addItem($step1);
     if ($step > 1) {
         $relations = $this->object->getAllRelations();
         $step2 = new ilSelectInputGUI($this->lng->txt("step") . " 2: " . $this->lng->txt("select_relation"), "r");
         $options = array();
         foreach ($relations as $rel_id => $relation) {
             if (in_array($relation["short"], $survey_questions[$postvalues["q"]]["availableRelations"])) {
                 $options[$rel_id] = $relation['short'];
             }
         }
         $step2->setOptions($options);
         $step2->setValue($postvalues["r"]);
         $form->addItem($step2);
     }
     if ($step > 2) {
         $variables =& $this->object->getVariables($postvalues["q"]);
         $question_type = $survey_questions[$postvalues["q"]]["type_tag"];
         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
         SurveyQuestion::_includeClass($question_type);
         $question = new $question_type();
         $question->loadFromDb($postvalues["q"]);
         $step3 = $question->getPreconditionSelectValue($postvalues["v"], $this->lng->txt("step") . " 3: " . $this->lng->txt("select_value"), "v");
         $form->addItem($step3);
     }
     switch ($step) {
         case 1:
             $cmd_continue = "constraintStep2";
             $cmd_back = "constraints";
             break;
         case 2:
             $cmd_continue = "constraintStep3";
             $cmd_back = "constraintStep1";
             break;
         case 3:
             $cmd_continue = "constraintsAdd";
             $cmd_back = "constraintStep2";
             break;
     }
     $form->addCommandButton($cmd_back, $this->lng->txt("back"));
     $form->addCommandButton($cmd_continue, $this->lng->txt("continue"));
     $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
 }