protected function initForm()
 {
     $this->setTitle($this->pl->txt('form_title'));
     $te = new ilSelectInputGUI($this->txt(self::F_UDF_FIELD_ID), self::F_UDF_FIELD_ID);
     $te->setDisabled(!$this->is_new);
     $te->setRequired(true);
     $te->setOptions(ilUDFCheck::getDefinitionData());
     $this->addItem($te);
     if (!$this->is_new) {
         $te = new ilHiddenInputGUI($this->txt(self::F_UDF_FIELD_ID), self::F_UDF_FIELD_ID);
         $this->addItem($te);
         switch (ilUDFCheck::getDefinitionTypeForId($this->object->getUdfFieldId())) {
             case ilUDFCheck::TYPE_TEXT:
                 $se = new ilTextInputGUI($this->pl->txt(self::F_CHECK_VALUE), self::F_CHECK_VALUE);
                 $this->addItem($se);
                 break;
             case ilUDFCheck::TYPE_SELECT:
                 $se = new ilSelectInputGUI($this->pl->txt(self::F_CHECK_VALUE), self::F_CHECK_VALUE);
                 $se->setOptions(ilUDFCheck::getDefinitionValuesForId($this->object->getUdfFieldId()));
                 $this->addItem($se);
                 break;
         }
     }
     $this->addCommandButtons();
 }
 /**
  * get html
  *
  * @access public
  * @param
  * @return
  */
 public function initForm()
 {
     $rec = new ilSelectInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
     $rec->setRequired(true);
     $rec->setOptions(array(0 => $this->lng->txt('cal_no_recurrence'), ilCalendarRecurrence::FREQ_DAILY => $this->lng->txt('cal_rec_daily'), ilCalendarRecurrence::FREQ_WEEKLY => $this->lng->txt('cal_rec_weekly'), ilCalendarRecurrence::FREQ_MONTHLY => $this->lng->txt('cal_rec_monthly'), ilCalendarRecurrence::FREQ_YEARLY => $this->lng->txt('cal_rec_yearly')));
     $rec->setValue($this->recurrence->getFrequenceType());
     $this->form->addItem($rec);
     // DAILY part
     $interval = new ilTextInputGUI($this->lng->txt('interval'), 'interval');
     $interval->setSize(2);
     $interval->setMaxLength(3);
     $interval->setValue($this->recurrence->getInterval() ? $this->recurrence->getInterval() : 1);
     $interval->setInfo($this->lng->txt('interval_info'));
     $rec->addSubItem($interval);
     // Weekly
     $check = new ilCheckboxInputGUI($this->lng->txt('Su_short'), 'w_day[0]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Mo_short'), 'w_day[1]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Tu_short'), 'w_day[2]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('We_short'), 'w_day[3]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Th_short'), 'w_day[4]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Fr_short'), 'w_day[5]');
     $check->setChecked(true);
     $rec->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('Sa_short'), 'w_day[6]');
     $check->setChecked(true);
     $rec->addSubItem($check);
 }
 /**
  * Add all fields to the form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $title = $this->type->getId() ? $this->lng->txt('orgu_type_edit') : $this->lng->txt('orgu_type_add');
     $this->setTitle($title);
     $item = new ilSelectInputGUI($this->lng->txt('default_language'), 'default_lang');
     $item->setValue($this->type->getDefaultLang());
     $languages = $this->lng->getInstalledLanguages();
     $options = array();
     foreach ($languages as $lang_code) {
         $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}");
     }
     $item->setOptions($options);
     $item->setRequired(true);
     $this->addItem($item);
     foreach ($languages as $lang_code) {
         $this->addTranslationInputs($lang_code);
     }
     if ($this->type->getId()) {
         $this->addCommandButton('update', $this->lng->txt('save'));
     } else {
         $this->addCommandButton('create', $this->lng->txt('create'));
     }
 }
 /**
  * Init assignment form.
  *
  * @param        int        $a_mode        "create"/"edit"
  */
 public function initAssignmentForm($a_mode = "create")
 {
     global $lng, $ilCtrl, $ilSetting;
     // init form
     $lng->loadLanguageModule("form");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setTableWidth("600px");
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt("exc_edit_assignment"));
     } else {
         $this->form->setTitle($lng->txt("exc_new_assignment"));
     }
     $this->form->setFormAction($ilCtrl->getFormAction($this));
     // type
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     $types = array(ilExAssignment::TYPE_UPLOAD => $this->lng->txt("exc_type_upload"), ilExAssignment::TYPE_UPLOAD_TEAM => $this->lng->txt("exc_type_upload_team"), ilExAssignment::TYPE_TEXT => $this->lng->txt("exc_type_text"));
     if (!$ilSetting->get('disable_wsp_blogs')) {
         $types[ilExAssignment::TYPE_BLOG] = $this->lng->txt("exc_type_blog");
     }
     if ($ilSetting->get('user_portfolios')) {
         $types[ilExAssignment::TYPE_PORTFOLIO] = $this->lng->txt("exc_type_portfolio");
     }
     if (sizeof($types) > 1) {
         $ty = new ilSelectInputGUI($this->lng->txt("exc_assignment_type"), "type");
         $ty->setOptions($types);
         $ty->setRequired(true);
     } else {
         $ty = new ilHiddenInputGUI("type");
         $ty->setValue(ilExAssignment::TYPE_UPLOAD);
     }
     $this->form->addItem($ty);
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
     $ti->setMaxLength(200);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // start time y/n
     $cb = new ilCheckboxInputGUI($this->lng->txt("exc_start_time"), "start_time_cb");
     $this->form->addItem($cb);
     // start time
     $edit_date = new ilDateTimeInputGUI("", "start_time");
     $edit_date->setShowTime(true);
     $cb->addSubItem($edit_date);
     // deadline y/n
     $dcb = new ilCheckboxInputGUI($this->lng->txt("exc_deadline"), "deadline_cb");
     $dcb->setChecked(true);
     $this->form->addItem($dcb);
     // Deadline
     $edit_date = new ilDateTimeInputGUI($lng->txt(""), "deadline");
     $edit_date->setShowTime(true);
     $dcb->addSubItem($edit_date);
     // mandatory
     $cb = new ilCheckboxInputGUI($this->lng->txt("exc_mandatory"), "mandatory");
     $cb->setInfo($this->lng->txt("exc_mandatory_info"));
     $cb->setChecked(true);
     $this->form->addItem($cb);
     // Work Instructions
     $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
     $desc_input->setRows(20);
     $desc_input->setUseRte(true);
     $desc_input->setRteTagSet("mini");
     $this->form->addItem($desc_input);
     // files
     if ($a_mode == "create") {
         $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
         $files->setFilenames(array(0 => ''));
         $this->form->addItem($files);
     }
     // peer review
     $peer = new ilCheckboxInputGUI($lng->txt("exc_peer_review"), "peer");
     $peer->setInfo($this->lng->txt("exc_peer_review_ass_setting_info"));
     $this->form->addItem($peer);
     if ($a_mode == "create") {
         $peer->setInfo($lng->txt("exc_peer_review_info"));
     }
     $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min");
     $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info"));
     $peer_min->setRequired(true);
     $peer_min->setValue(5);
     $peer_min->setSize(3);
     $peer_min->setValue(2);
     $peer->addSubItem($peer_min);
     $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl");
     $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info"));
     $peer_dl->enableDateActivation("", "peer_dl_tgl");
     $peer_dl->setShowTime(true);
     $peer->addSubItem($peer_dl);
     $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file");
     $peer_file->setInfo($lng->txt("exc_peer_review_file_info"));
     $peer->addSubItem($peer_file);
     $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl");
     $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info"));
     $peer->addSubItem($peer_prsl);
     if ($a_mode != "create" && $this->ass && $this->ass->getDeadline() && $this->ass->getDeadline() < time()) {
         $peer_prsl->setDisabled(true);
     }
     // global feedback
     $fb = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file"), "fb");
     $this->form->addItem($fb);
     $fb_file = new ilFileInputGUI($lng->txt("file"), "fb_file");
     // $fb_file->setRequired(true);
     $fb_file->setALlowDeletion(true);
     $fb->addSubItem($fb_file);
     $fb_date = new ilRadioGroupInputGUI($lng->txt("exc_global_feedback_file_date"), "fb_date");
     $fb_date->setRequired(true);
     $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_deadline"), ilExAssignment::FEEDBACK_DATE_DEADLINE));
     $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_upload"), ilExAssignment::FEEDBACK_DATE_SUBMISSION));
     $fb->addSubItem($fb_date);
     $fb_cron = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file_cron"), "fb_cron");
     $fb_cron->setInfo($lng->txt("exc_global_feedback_file_cron_info"));
     $fb->addSubItem($fb_cron);
     // save and cancel commands
     if ($a_mode == "create") {
         $this->form->addCommandButton("saveAssignment", $lng->txt("save"));
         $this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
     } else {
         $this->form->addCommandButton("updateAssignment", $lng->txt("save"));
         $this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
     }
 }
 public function initForm($a_as_multi_assignment = FALSE)
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->lng->txt('crs_loc_tst_assignment'));
     $form->setFormAction($this->ctrl->getFormAction($this->getGUI()));
     if ($a_as_multi_assignment) {
         $form->addCommandButton('saveMultiTestAssignment', $this->lng->txt('save'));
     } else {
         $form->addCommandButton('saveTest', $this->lng->txt('save'));
     }
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $form->setTitle($this->lng->txt('crs_loc_settings_itest_tbl'));
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $form->setTitle($this->lng->txt('crs_loc_settings_qtest_tbl'));
             break;
     }
     $assignable = $this->getAssignableTests();
     $cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'), 'mode');
     $cr_mode->setRequired(true);
     $cr_mode->setValue(self::TEST_NEW);
     $new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'), self::TEST_NEW);
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info"));
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info"));
             break;
     }
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
     $ti->setMaxLength(128);
     $ti->setSize(40);
     $ti->setRequired(true);
     $new->addSubItem($ti);
     // description
     $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
     $ta->setCols(40);
     $ta->setRows(2);
     $new->addSubItem($ta);
     // Question assignment type
     include_once './Modules/Test/classes/class.ilObjTest.php';
     $this->lng->loadLanguageModule('assessment');
     $qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'), 'qtype');
     $qst->setRequired(true);
     $random = new ilRadioOption($this->lng->txt('tst_question_set_type_random'), ilObjTest::QUESTION_SET_TYPE_RANDOM);
     $qst->addOption($random);
     $fixed = new ilRadioOption($this->lng->txt('tst_question_set_type_fixed'), ilObjTest::QUESTION_SET_TYPE_FIXED);
     $qst->addOption($fixed);
     $new->addSubItem($qst);
     $cr_mode->addOption($new);
     // assign existing
     $existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'), self::TEST_ASSIGN);
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info"));
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info"));
             break;
     }
     if (!$assignable) {
         $existing->setDisabled(true);
     }
     $cr_mode->addOption($existing);
     $options = array();
     $options[''] = $this->lng->txt('select_one');
     foreach ((array) $assignable as $tst_ref_id) {
         $tst_obj_id = ilObject::_lookupObjId($tst_ref_id);
         $options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id);
     }
     $selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'), 'tst');
     $selectable->setRequired(true);
     $selectable->setOptions($options);
     $existing->addSubItem($selectable);
     $form->addItem($cr_mode);
     if ($a_as_multi_assignment) {
         include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
         $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
         include_once './Modules/Course/classes/class.ilCourseObjective.php';
         $objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainer()->getId(), FALSE);
         $options = array();
         $options[''] = $this->lng->txt('select_one');
         foreach ($objective_ids as $oid) {
             $already_assigned_tst = $assignments->getTestByObjective($oid, $this->getTestType());
             if (!$already_assigned_tst) {
                 $options[$oid] = ilCourseObjective::lookupObjectiveTitle($oid);
             }
         }
         $objective = new ilSelectInputGUI($this->lng->txt('crs_objectives'), 'objective');
         $objective->setRequired(TRUE);
         $objective->setOptions($options);
         $form->addItem($objective);
     }
     return $form;
 }
 /**
  * Init category mapping form 
  * @return
  */
 protected function initCategoryMappingForm($a_mode = 'add')
 {
     global $ilDB;
     if (is_object($this->form)) {
         return true;
     }
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
     $this->form = new ilPropertyFormGUI();
     if ($a_mode == 'add') {
         $this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
         $this->form->setFormAction($this->ctrl->getFormAction($this, 'categoryMapping'));
         $this->form->addCommandButton('addCategoryMapping', $this->lng->txt('save'));
         $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
     } else {
         $this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
         $this->form->setFormAction($this->ctrl->getFormAction($this, 'editCategoryMapping'));
         $this->form->addCommandButton('updateCategoryMapping', $this->lng->txt('save'));
         $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
     }
     $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'), 'import_id');
     $imp->setRequired(true);
     $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
     $tpl->setVariable('SIZE', 5);
     $tpl->setVariable('MAXLENGTH', 11);
     $tpl->setVariable('POST_VAR', 'import_id');
     $tpl->setVariable('PROPERTY_VALUE', $this->rule->getContainerId());
     if ($this->settings->getImportId()) {
         $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->rule->getContainerId()));
     }
     $imp->setHTML($tpl->get());
     $imp->setInfo($this->lng->txt('ecs_import_id_info'));
     $this->form->addItem($imp);
     include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
     $select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'), 'field');
     $select->setValue($this->rule->getFieldName());
     $select->setRequired(true);
     $select->setOptions(ilECSCategoryMapping::getPossibleFields());
     $this->form->addItem($select);
     //	Value
     $value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'), 'type');
     $value->setValue($this->rule->getMappingType());
     $value->setRequired(true);
     $fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'), ilECSCategoryMappingRule::TYPE_FIXED);
     $fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
     $fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'), 'mapping_value');
     $fixed_val->setValue($this->rule->getMappingValue());
     $fixed_val->setMaxLength(255);
     $fixed_val->setSize(40);
     $fixed_val->setRequired(true);
     $fixed->addSubItem($fixed_val);
     $value->addOption($fixed);
     $duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'), ilECSCategoryMappingRule::TYPE_DURATION);
     $duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
     $dur_start = new ilDateTimeInputGUI($this->lng->txt('from'), 'dur_begin');
     $dur_start->setDate($this->rule->getDateRangeStart());
     $duration->addSubItem($dur_start);
     $dur_end = new ilDateTimeInputGUI($this->lng->txt('to'), 'dur_end');
     $dur_end->setDate($this->rule->getDateRangeEnd());
     $duration->addSubItem($dur_end);
     $value->addOption($duration);
     $type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'), ilECSCategoryMappingRule::TYPE_BY_TYPE);
     $type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info'));
     $options = ilECSUtils::getPossibleRemoteTypes(true);
     $types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type');
     $types->setOptions($options);
     $types->setValue($this->rule->getByType());
     $types->setRequired(true);
     $type->addSubitem($types);
     $value->addOption($type);
     $this->form->addItem($value);
 }
 protected function initImportForm($a_new_type)
 {
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setTarget("_top");
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("import_svy"));
     include_once "./Services/Form/classes/class.ilFileInputGUI.php";
     $fi = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
     $fi->setSuffixes(array("zip"));
     $fi->setRequired(true);
     $form->addItem($fi);
     include_once "./Modules/Survey/classes/class.ilObjSurvey.php";
     $svy = new ilObjSurvey();
     $questionspools = $svy->getAvailableQuestionpools(true, true, true);
     $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool_short"), "spl");
     $pools->setOptions(array("" => $this->lng->txt("dont_use_questionpool")) + $questionspools);
     $pools->setRequired(false);
     $form->addItem($pools);
     $form->addCommandButton("importFile", $this->lng->txt("import"));
     $form->addCommandButton("cancel", $this->lng->txt("cancel"));
     return $form;
 }
 function initAddPageLayoutForm()
 {
     global $lng, $ilCtrl;
     $lng->loadLanguageModule("content");
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form_gui = new ilPropertyFormGUI();
     $form_gui->setFormAction($ilCtrl->getFormAction($this));
     $form_gui->setTitle($lng->txt("sty_create_pgl"));
     include_once "Services/Form/classes/class.ilRadioMatrixInputGUI.php";
     $title_input = new ilTextInputGUI($lng->txt("title"), "pgl_title");
     $title_input->setSize(50);
     $title_input->setMaxLength(128);
     $title_input->setValue($this->layout_object->title);
     $title_input->setTitle($lng->txt("title"));
     $title_input->setRequired(true);
     $desc_input = new ilTextAreaInputGUI($lng->txt("description"), "pgl_desc");
     $desc_input->setValue($this->layout_object->description);
     $desc_input->setRows(3);
     $desc_input->setCols(37);
     // special page?
     $options = array("0" => $lng->txt("cont_layout_template"), "1" => $lng->txt("cont_special_page"));
     $si = new ilSelectInputGUI($this->lng->txt("type"), "special_page");
     $si->setOptions($options);
     // modules
     $mods = new ilCheckboxGroupInputGUI($this->lng->txt("modules"), "module");
     // $mods->setRequired(true);
     foreach (ilPageLayout::getAvailableModules() as $mod_id => $mod_caption) {
         $mod = new ilCheckboxOption($mod_caption, $mod_id);
         $mods->addOption($mod);
     }
     $ttype_input = new ilSelectInputGUI($lng->txt("sty_based_on"), "pgl_template");
     $arr_templates = ilPageLayout::getLayouts();
     $arr_templates1 = ilPageLayout::getLayouts(false, true);
     foreach ($arr_templates1 as $v) {
         $arr_templates[] = $v;
     }
     $options = array();
     $options['-1'] = $lng->txt("none");
     foreach ($arr_templates as $templ) {
         $templ->readObject();
         $key = $templ->getId();
         $value = $templ->getTitle();
         $options[$key] = $value;
     }
     $ttype_input->setOptions($options);
     $ttype_input->setValue(-1);
     $ttype_input->setRequired(true);
     $desc_input->setTitle($lng->txt("description"));
     $desc_input->setRequired(false);
     $form_gui->addItem($title_input);
     $form_gui->addItem($desc_input);
     $form_gui->addItem($si);
     $form_gui->addItem($mods);
     $form_gui->addItem($ttype_input);
     $form_gui->addCommandButton("createPg", $lng->txt("save"));
     $form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
     return $form_gui;
 }
 protected function initJavaServerIniForm()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     $GLOBALS['lng']->loadLanguageModule('search');
     $this->form->setTitle($this->lng->txt('lucene_tbl_create_ini'));
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'createJavaServerIni'));
     $this->form->addCommandButton('downloadJavaServerIni', $this->lng->txt('lucene_download_ini'));
     $this->form->addCommandButton('showJavaServer', $this->lng->txt('cancel'));
     // Host
     $ip = new ilTextInputGUI($this->lng->txt('lucene_host'), 'ho');
     $ip->setInfo($this->lng->txt('lucene_host_info'));
     $ip->setMaxLength(128);
     $ip->setSize(32);
     $ip->setRequired(true);
     $this->form->addItem($ip);
     // Port
     $port = new ilNumberInputGUI($this->lng->txt('lucene_port'), 'po');
     $port->setSize(5);
     $port->setMinValue(1);
     $port->setMaxValue(65535);
     $port->setRequired(true);
     $this->form->addItem($port);
     // Index Path
     $path = new ilTextInputGUI($this->lng->txt('lucene_index_path'), 'in');
     $path->setSize(80);
     $path->setMaxLength(1024);
     $path->setInfo($this->lng->txt('lucene_index_path_info'));
     $path->setRequired(true);
     $this->form->addItem($path);
     // Logging
     $log = new ilTextInputGUI($this->lng->txt('lucene_log'), 'lo');
     $log->setSize(80);
     $log->setMaxLength(1024);
     $log->setInfo($this->lng->txt('lucene_log_info'));
     $log->setRequired(true);
     $this->form->addItem($log);
     // Level
     $lev = new ilSelectInputGUI($this->lng->txt('lucene_level'), 'le');
     $lev->setOptions(array('DEBUG' => 'DEBUG', 'INFO' => 'INFO', 'WARN' => 'WARN', 'ERROR' => 'ERROR', 'FATAL' => 'FATAL'));
     $lev->setValue('INFO');
     $lev->setRequired(true);
     $this->form->addItem($lev);
     // CPU
     $cpu = new ilNumberInputGUI($this->lng->txt('lucene_cpu'), 'cp');
     $cpu->setValue(1);
     $cpu->setSize(1);
     $cpu->setMaxLength(2);
     $cpu->setMinValue(1);
     $cpu->setRequired(true);
     $this->form->addItem($cpu);
     // Max file size
     $fs = new ilNumberInputGUI($this->lng->txt('lucene_max_fs'), 'fs');
     $fs->setInfo($this->lng->txt('lucene_max_fs_info'));
     $fs->setValue(500);
     $fs->setSize(4);
     $fs->setMaxLength(4);
     $fs->setMinValue(1);
     $fs->setRequired(true);
     $this->form->addItem($fs);
     return true;
 }
 /**
  * Initialize clone form
  */
 function cloneInitForm()
 {
     global $lng, $ilCtrl;
     $this->checkDisplayMode();
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setId("clone_form");
     $this->form->setFormAction("setup.php?cmd=gateway");
     if ($this->setup->getClient()->status["access"]["status"] === false and stripos($this->setup->getClient()->getName(), "master") === false and $this->setup->getClient()->getdbType() == "mysql" and $this->setup->getClient()->db_exists) {
         $this->form->setTitle($this->lng->txt("clone_source"));
         $clients = array();
         $clientlist = new ilClientList($this->setup->db_connections);
         $list = $clientlist->getClients();
         $clientlistarray = array();
         foreach ($list as $key => $client) {
             if (strcmp($key, $this->setup->getClient()->getId()) != '0' && $client->getDbType() == 'mysql') {
                 // You cannot clone yourself
                 $clientlistarray[$client->id] = $client->id;
             }
         }
         $si = new ilSelectInputGUI($lng->txt("clone_selectsource"), "source");
         $si->setOptions(array_merge(array("" => "-- " . $lng->txt("please_select") . " --"), $clientlistarray));
         $si->setRequired(true);
         $this->form->addItem($si);
         $cb = new ilCheckboxInputGUI($lng->txt("clone_areyousure"), "iamsure");
         $cb->setRequired(true);
         $this->form->addItem($cb);
         $this->form->addCommandButton("cloneSaveSource", $lng->txt("cloneit"));
     } else {
         $disabledmessage = "<h1>" . $this->lng->txt("clone_disabledmessage") . "</h1><br>";
         if (!$this->setup->getClient()->status["access"]["status"] === false) {
             $disabledmessage .= $this->lng->txt("clone_clientnotdisabled") . "<br>";
         }
         if (!stripos($this->setup->getClient()->getName(), "aster") === false) {
             $disabledmessage .= $this->lng->txt("clone_clientismaster") . "<br>";
         }
         if ($this->setup->getClient()->getdbType() != "mysql") {
             $disabledmessage .= $this->lng->txt("clone_clientisnotmysql") . "<br>";
         }
         if (!$this->setup->getClient()->db_exists) {
             $disabledmessage .= $this->lng->txt("clone_clientnodatabase") . "<br>";
         }
         $this->form->setTitle($disabledmessage);
     }
 }
 private function buildSettingsForm()
 {
     /**
      * @var $ilAccess ilAccessHandler
      */
     global $ilAccess;
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("settings");
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt('settings'));
     $form->addItem($header);
     // question process locking behaviour (e.g. on saving users working data)
     $chb = new ilCheckboxInputGUI($this->lng->txt('ass_process_lock'), 'ass_process_lock');
     $chb->setChecked($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
     $chb->setInfo($this->lng->txt('ass_process_lock_desc'));
     $form->addItem($chb);
     $rg = new ilRadioGroupInputGUI($this->lng->txt('ass_process_lock_mode'), 'ass_process_lock_mode');
     $rg->setRequired(true);
     $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_file'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_FILE);
     $opt->setInfo($this->lng->txt('ass_process_lock_mode_file_desc'));
     $rg->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_db'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_DB);
     $opt->setInfo($this->lng->txt('ass_process_lock_mode_db_desc'));
     $rg->addOption($opt);
     if ($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE) {
         $rg->setValue($this->object->getAssessmentProcessLockMode());
     }
     $chb->addSubItem($rg);
     $assessmentSetting = new ilSetting('assessment');
     $imap_line_color = array_key_exists('imap_line_color', $_GET) ? $_GET['imap_line_color'] : $assessmentSetting->get('imap_line_color');
     if (strlen($imap_line_color) == 0) {
         $imap_line_color = 'FF0000';
     }
     $linepicker = new ilColorPickerInputGUI($this->lng->txt('assessment_imap_line_color'), 'imap_line_color');
     $linepicker->setValue($imap_line_color);
     $form->addItem($linepicker);
     $user_criteria = array_key_exists('user_criteria', $_GET) ? $_GET['user_criteria'] : $assessmentSetting->get('user_criteria');
     $userCriteria = new ilSelectInputGUI($this->lng->txt('user_criteria'), 'user_criteria');
     $userCriteria->setInfo($this->lng->txt('user_criteria_desc'));
     $userCriteria->setRequired(true);
     $fields = array('usr_id', 'login', 'email', 'matriculation', 'ext_account');
     $usr_fields = array();
     foreach ($fields as $field) {
         $usr_fields[$field] = $field;
     }
     $userCriteria->setOptions($usr_fields);
     $userCriteria->setValue($user_criteria);
     $form->addItem($userCriteria);
     // question settings
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("assf_questiontypes"));
     $form->addItem($header);
     // available question types
     $allowed = new ilCheckboxGroupInputGUI($this->lng->txt('assf_allowed_questiontypes'), "chb_allowed_questiontypes");
     $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE);
     $forbidden_types = $this->object->_getForbiddenQuestionTypes();
     $allowedtypes = array();
     foreach ($questiontypes as $qt) {
         if (!in_array($qt['question_type_id'], $forbidden_types)) {
             array_push($allowedtypes, $qt['question_type_id']);
         }
     }
     $allowed->setValue($allowedtypes);
     foreach ($questiontypes as $type_name => $qtype) {
         $allowed->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
     }
     $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc'));
     $form->addItem($allowed);
     // manual scoring
     $manual = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_manual_scoring_activate'), "chb_manual_scoring");
     $manscoring = $this->object->_getManualScoring();
     $manual->setValue($manscoring);
     foreach ($questiontypes as $type_name => $qtype) {
         $manual->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
     }
     $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc'));
     $form->addItem($manual);
     // scoring adjustment active
     $scoring_activation = new ilCheckboxInputGUI($this->lng->txt('assessment_scoring_adjust'), 'chb_scoring_adjust');
     $scoring_activation->setChecked($this->object->getScoringAdjustmentEnabled());
     $scoring_activation->setInfo($this->lng->txt('assessment_scoring_adjust_desc'));
     $form->addItem($scoring_activation);
     // scoring adjustment
     $scoring = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_scoring_adjustment_activate'), "chb_scoring_adjustment");
     $scoring_active = $this->object->getScoringAdjustableQuestions();
     $scoring->setValue($scoring_active);
     foreach ($questiontypes as $type_name => $qtype) {
         $scoring->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
     }
     $scoring->setInfo($this->lng->txt('assessment_log_scoring_adjustment_desc'));
     $form->addItem($scoring);
     if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
         $form->addCommandButton("saveSettings", $this->lng->txt("save"));
     }
     return $form;
 }
 /**
  * init form
  *
  * @access protected
  * @param string mode ('edit' | 'create')
  * @return
  */
 protected function initForm($a_mode, $a_as_milestone = false, $a_edit_single_app = false)
 {
     global $ilUser, $tpl;
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
     $this->form = new ilPropertyFormGUI();
     include_once './Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initDomEvent();
     $resp_info = false;
     switch ($a_mode) {
         case 'create':
             $this->ctrl->saveParameter($this, array('seed', 'idate'));
             $this->form->setFormAction($this->ctrl->getFormAction($this));
             if ($a_as_milestone) {
                 $this->form->setTitle($this->lng->txt('cal_new_ms'));
                 $this->form->addCommandButton('saveMilestone', $this->lng->txt('cal_add_milestone'));
                 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             } else {
                 $this->form->setTitle($this->lng->txt('cal_new_app'));
                 $this->form->addCommandButton('save', $this->lng->txt('cal_add_appointment'));
                 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             }
             break;
         case 'edit':
             if ($a_as_milestone) {
                 $this->form->setTitle($this->lng->txt('cal_edit_milestone'));
             } else {
                 $this->form->setTitle($this->lng->txt('cal_edit_appointment'));
             }
             $this->ctrl->saveParameter($this, array('seed', 'app_id', 'idate'));
             $this->form->setFormAction($this->ctrl->getFormAction($this));
             $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
             $cat = $ass->getFirstAssignment();
             include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
             $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat);
             $type = ilObject::_lookupType($cat_info['obj_id']);
             if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ && ($type == "grp" || $type == "crs")) {
                 $resp_info = true;
                 $this->form->addCommandButton('editResponsibleUsers', $this->lng->txt('cal_change_responsible_users'));
             }
             $this->form->addCommandButton('update', $this->lng->txt('save'));
             // $this->form->addCommandButton('askDelete',$this->lng->txt('delete'));
             $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             break;
     }
     // title
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $title->setValue($this->app->getTitle());
     $title->setRequired(true);
     $title->setMaxLength(128);
     $title->setSize(32);
     $this->form->addItem($title);
     // calendar selection
     $calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'), 'calendar');
     if ($_POST['category']) {
         $calendar->setValue((int) $_POST['calendar']);
         $selected_calendar = (int) $_POST['calendar'];
     } else {
         if ($_GET['category_id']) {
             $calendar->setValue((int) $_GET['category_id']);
             $selected_calendar = (int) $_GET['category_id'];
         } elseif ($a_mode == 'edit') {
             $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
             $cat = $ass->getFirstAssignment();
             $calendar->setValue($cat);
             $selected_calendar = $cat;
         } elseif (isset($_GET['ref_id'])) {
             include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
             $obj_cal = ilObject::_lookupObjId($_GET['ref_id']);
             $calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal));
             $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal);
         }
     }
     $calendar->setRequired(true);
     $cats = ilCalendarCategories::_getInstance($ilUser->getId());
     $calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
     include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
     if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) {
         $notification_cals = $cats->getNotificationCalendars();
         $notification_cals = count($notification_cals) ? implode(',', $notification_cals) : '';
         $calendar->addCustomAttribute("onchange=\"ilToggleNotification(new Array(" . $notification_cals . "));\"");
     }
     $this->form->addItem($calendar);
     if (!$a_as_milestone) {
         include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
         $tpl->addJavaScript('./Services/Form/js/date_duration.js');
         $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
         $dur->setStartText($this->lng->txt('cal_start'));
         $dur->setEndText($this->lng->txt('cal_end'));
         $dur->enableToggleFullTime($this->lng->txt('cal_fullday_title'), $this->app->isFullday() ? true : false);
         $dur->setShowTime(true);
         $dur->setStart($this->app->getStart());
         $dur->setEnd($this->app->getEnd());
         $this->form->addItem($dur);
         // recurrence
         include_once './Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php';
         $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
         $rec->setRecurrence($this->rec);
         $this->form->addItem($rec);
         // location
         $where = new ilTextInputGUI($this->lng->txt('cal_where'), 'location');
         $where->setValue($this->app->getLocation());
         $where->setMaxLength(128);
         $where->setSize(32);
         $this->form->addItem($where);
     } else {
         $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'), 'event[start]');
         $deadline->setDate($this->app->getStart());
         $deadline->setShowTime(false);
         $deadline->setMinuteStepSize(5);
         $this->form->addItem($deadline);
         // completion
         $completion_vals = array();
         for ($i = 0; $i <= 100; $i += 5) {
             $completion_vals[$i] = $i . " %";
         }
         $compl = new ilSelectInputGUI($this->lng->txt('cal_task_completion'), 'completion');
         $compl->setOptions($completion_vals);
         $compl->setValue($this->app->getCompletion());
         $this->form->addItem($compl);
     }
     $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $desc->setValue($this->app->getDescription());
     $desc->setRows(5);
     $this->form->addItem($desc);
     if ($a_as_milestone && $a_mode == "edit" && $resp_info) {
         // users responsible
         $users = $this->app->readResponsibleUsers();
         $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'), $users);
         $delim = "";
         foreach ($users as $r) {
             $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
             $delim = "<br />";
         }
         if (count($users) > 0) {
             $resp->setValue($value);
         } else {
             $resp->setValue("-");
         }
         $this->form->addItem($resp);
     }
     if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
         $notu = new ilTextWizardInputGUI($this->lng->txt('cal_user_notification'), 'notu');
         $notu->setInfo($this->lng->txt('cal_user_notification_info'));
         $notu->setSize(20);
         $notu->setMaxLength(64);
         $values = array();
         foreach ($this->notification->getRecipients() as $rcp) {
             switch ($rcp['type']) {
                 case ilCalendarUserNotification::TYPE_USER:
                     $values[] = ilObjUser::_lookupLogin($rcp['usr_id']);
                     break;
                 case ilCalendarUserNotification::TYPE_EMAIL:
                     $values[] = $rcp['email'];
                     break;
             }
         }
         if (count($values)) {
             $notu->setValues($values);
         } else {
             $notu->setValues(array(''));
         }
         $this->form->addItem($notu);
     }
     // Notifications
     include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
     if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars())) {
         $selected_cal = new ilCalendarCategory($selected_calendar);
         $disabled = true;
         if ($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ) {
             if (ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp') {
                 $disabled = false;
             }
         }
         $tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js');
         $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'), 'not');
         $not->setInfo($this->lng->txt('cal_notification_info'));
         $not->setValue(1);
         $not->setChecked($this->app->isNotificationEnabled());
         $not->setDisabled($disabled);
         $this->form->addItem($not);
     }
 }
 /**
  * Init assignment form.
  *
  * @param        int        $a_mode        "create"/"edit"
  */
 public function initAssignmentForm($a_mode = "create")
 {
     global $lng, $ilCtrl, $ilSetting;
     // init form
     $lng->loadLanguageModule("form");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setTableWidth("600px");
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt("exc_edit_assignment"));
     } else {
         $this->form->setTitle($lng->txt("exc_new_assignment"));
     }
     $this->form->setFormAction($ilCtrl->getFormAction($this));
     // type
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     $types = array(ilExAssignment::TYPE_UPLOAD => $this->lng->txt("exc_type_upload"), ilExAssignment::TYPE_UPLOAD_TEAM => $this->lng->txt("exc_type_upload_team"));
     if (!$ilSetting->get('disable_wsp_blogs')) {
         $types[ilExAssignment::TYPE_BLOG] = $this->lng->txt("exc_type_blog");
     }
     if ($ilSetting->get('user_portfolios')) {
         $types[ilExAssignment::TYPE_PORTFOLIO] = $this->lng->txt("exc_type_portfolio");
     }
     if (sizeof($types) > 1) {
         $ty = new ilSelectInputGUI($this->lng->txt("type"), "type");
         $ty->setOptions($types);
         $ty->setRequired(true);
     } else {
         $ty = new ilHiddenInputGUI("type");
         $ty->setValue(ilExAssignment::TYPE_UPLOAD);
     }
     $this->form->addItem($ty);
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
     $ti->setMaxLength(200);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // start time y/n
     $cb = new ilCheckboxInputGUI($this->lng->txt("exc_start_time"), "start_time_cb");
     $this->form->addItem($cb);
     // start time
     $edit_date = new ilDateTimeInputGUI("", "start_time");
     $edit_date->setShowTime(true);
     $cb->addSubItem($edit_date);
     // deadline y/n
     $dcb = new ilCheckboxInputGUI($this->lng->txt("exc_deadline"), "deadline_cb");
     $dcb->setChecked(true);
     $this->form->addItem($dcb);
     // Deadline
     $edit_date = new ilDateTimeInputGUI($lng->txt(""), "deadline");
     $edit_date->setShowTime(true);
     $dcb->addSubItem($edit_date);
     // mandatory
     $cb = new ilCheckboxInputGUI($this->lng->txt("exc_mandatory"), "mandatory");
     $cb->setInfo($this->lng->txt("exc_mandatory_info"));
     $cb->setChecked(true);
     $this->form->addItem($cb);
     // Work Instructions
     $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
     $desc_input->setRows(5);
     $this->form->addItem($desc_input);
     // files
     if ($a_mode == "create") {
         $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
         $files->setFilenames(array(0 => ''));
         $this->form->addItem($files);
     }
     // save and cancel commands
     if ($a_mode == "create") {
         $this->form->addCommandButton("saveAssignment", $lng->txt("save"));
         $this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
     } else {
         $this->form->addCommandButton("updateAssignment", $lng->txt("save"));
         $this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
     }
 }
 protected function initHeadingForm($a_question_id = null)
 {
     $survey_questions = $this->object->getSurveyQuestions();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, ""));
     // heading
     $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
     $heading->setRows(10);
     $heading->setCols(80);
     $heading->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
     $heading->setRTESupport($this->object->getId(), "svy", "survey");
     $heading->setRequired(true);
     $form->addItem($heading);
     $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
     $options = array();
     foreach ($survey_questions as $key => $value) {
         $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
     }
     $insertbefore->setOptions($options);
     $insertbefore->setRequired(true);
     $form->addItem($insertbefore);
     $form->addCommandButton("saveHeading", $this->lng->txt("save"));
     $form->addCommandButton("questions", $this->lng->txt("cancel"));
     if ($a_question_id) {
         $form->setTitle($this->lng->txt("edit_heading"));
         $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"]));
         $insertbefore->setValue($a_question_id);
         $insertbefore->setDisabled(true);
     } else {
         $form->setTitle($this->lng->txt("add_heading"));
     }
     return $form;
 }
 /**
  * Show course defined fields
  *
  * @access protected
  */
 protected function showCustomFields()
 {
     global $ilUser;
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     include_once 'Modules/Course/classes/Export/class.ilCourseUserData.php';
     if (!count($cdf_fields = ilCourseDefinedFieldDefinition::_getFields($this->container->getId()))) {
         return true;
     }
     $cdf = new ilNonEditableValueGUI($this->lng->txt('ps_crs_user_fields'));
     $cdf->setValue($this->lng->txt($this->type . '_ps_cdf_info'));
     $cdf->setRequired(true);
     foreach ($cdf_fields as $field_obj) {
         $course_user_data = new ilCourseUserData($ilUser->getId(), $field_obj->getId());
         switch ($field_obj->getType()) {
             case IL_CDF_TYPE_SELECT:
                 $select = new ilSelectInputGUI($field_obj->getName(), 'cdf[' . $field_obj->getId() . ']');
                 $select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                 $select->setOptions($field_obj->prepareSelectBox());
                 if ($field_obj->isRequired()) {
                     $select->setRequired(true);
                 }
                 $cdf->addSubItem($select);
                 break;
             case IL_CDF_TYPE_TEXT:
                 $text = new ilTextInputGUI($field_obj->getName(), 'cdf[' . $field_obj->getId() . ']');
                 $text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                 $text->setSize(32);
                 $text->setMaxLength(255);
                 if ($field_obj->isRequired()) {
                     $text->setRequired(true);
                 }
                 $cdf->addSubItem($text);
                 break;
         }
     }
     $this->form->addItem($cdf);
     return true;
 }
 /**
  * Init blog form
  *
  * @param bool $a_insert
  * @return ilPropertyFormGUI
  */
 protected function initForm($a_insert = false)
 {
     global $ilCtrl, $ilUser, $lng;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     if ($a_insert) {
         $form->setTitle($this->lng->txt("cont_insert_blog"));
     } else {
         $form->setTitle($this->lng->txt("cont_update_blog"));
     }
     $options = array();
     include_once "Modules/Blog/classes/class.ilBlogPosting.php";
     $blogs_ids = ilBlogPosting::searchBlogsByAuthor($ilUser->getId());
     if ($blogs_ids) {
         foreach ($blogs_ids as $blog_id) {
             $options[$blog_id] = ilObject::_lookupTitle($blog_id);
         }
         asort($options);
     }
     $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_blog"), "blog");
     $obj->setRequired(true);
     $obj->setOptions($options);
     $form->addItem($obj);
     if ($a_insert) {
         $form->addCommandButton("create_blog", $this->lng->txt("select"));
         $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
     } else {
         $obj->setValue($this->content_obj->getBlogId());
         $form->addCommandButton("update", $this->lng->txt("select"));
         $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
     }
     return $form;
 }
 /**
  * create
  */
 function createObject()
 {
     global $rbacsystem, $lng, $tpl, $ilHelp;
     $forms = array();
     $ilHelp->setScreenIdComponent("sty");
     $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create");
     // --- create
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("sty_create_new_stylesheet"));
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
     $ti->setMaxLength(128);
     $ti->setSize(40);
     $ti->setRequired(true);
     $form->addItem($ti);
     // description
     $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
     $ta->setCols(40);
     $ta->setRows(2);
     $form->addItem($ta);
     $form->addCommandButton("save", $this->lng->txt("save"));
     $form->addCommandButton("cancel", $this->lng->txt("cancel"));
     $forms[] = $form;
     // --- import
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("sty_import_stylesheet"));
     // title
     $ti = new ilFileInputGUI($this->lng->txt("import_file"), "stylefile");
     $ti->setRequired(true);
     $form->addItem($ti);
     $form->addCommandButton("importStyle", $this->lng->txt("import"));
     $form->addCommandButton("cancel", $this->lng->txt("cancel"));
     $forms[] = $form;
     // --- clone
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("sty_copy_other_stylesheet"));
     // source
     $ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style");
     $ti->setRequired(true);
     $ti->setOptions(ilObjStyleSheet::_getClonableContentStyles());
     $form->addItem($ti);
     $form->addCommandButton("copyStyle", $this->lng->txt("copy"));
     $form->addCommandButton("cancel", $this->lng->txt("cancel"));
     $forms[] = $form;
     $this->tpl->setContent($this->getCreationFormsHTML($forms));
 }
 /**
  * Creates the attributes form.
  * It contains an radio group with radio names as actions.
  * Every radio has own gui elements.
  */
 private function createAttributesForm()
 {
     $this->attributesForm = new ilPropertyFormGUI();
     $this->attributesForm->setTitle($this->lng->txt('rep_robj_xrs_edit_attributes'));
     $this->attributesForm->setDescription($this->lng->txt('rep_robj_xrs_attributes_for_rooms_desc'));
     // Radio group
     $radioGroup = new ilRadioGroupInputGUI($this->lng->txt('rep_robj_xrs_choose_action'), ATTRC::ACTION_MODE);
     $radioGroup->setRequired(true);
     // Available attributes
     $roomSharingRoomAttributes = new ilRoomSharingRoomAttributes($this->pool_id, new ilRoomsharingDatabase($this->pool_id));
     $attributes = $roomSharingRoomAttributes->getAllAvailableAttributesWithIdAndName();
     // Create
     $create = new ilRadioOption($this->lng->txt('rep_robj_xrs_create_attribute'), ATTRC::CREATE_MODE, $this->lng->txt('rep_robj_xrs_create_attribute_info'));
     $new_name = new ilTextInputGUI($this->lng->txt('rep_robj_xrs_name_of_new_attribute'), ATTRC::NEW_NAME);
     $new_name->setRequired(true);
     $new_name->setMaxLength(ATTRC::MAX_NAME_LENGTH);
     $new_name->setInfo($this->lng->txt('rep_robj_xrs_must_be_unique'));
     $create->addSubItem($new_name);
     $radioGroup->addOption($create);
     //Rename
     $rename = new ilRadioOption($this->lng->txt('rep_robj_xrs_rename_attribute'), ATTRC::RENAME_MODE, $this->lng->txt('rep_robj_xrs_rename_attribute_info'));
     $toRename = new ilSelectInputGUI($this->lng->txt('rep_robj_xrs_choose_attribute'), ATTRC::RENAME_ATTR_ID);
     $toRename->setOptions($attributes);
     $toRename->setRequired(true);
     $rename->addSubItem($toRename);
     $changedName = new ilTextInputGUI($this->lng->txt('rep_robj_xrs_new_attribute_name'), ATTRC::CHANGED_NAME);
     $changedName->setRequired(true);
     $changedName->setMaxLength(ATTRC::MAX_NAME_LENGTH);
     $changedName->setInfo($this->lng->txt('rep_robj_xrs_must_be_unique'));
     $rename->addSubItem($changedName);
     $radioGroup->addOption($rename);
     //Delete
     $delete = new ilRadioOption($this->lng->txt('rep_robj_xrs_delete_attribute'), ATTRC::DELETE_MODE, $this->lng->txt('rep_robj_xrs_delete_room_attribute_info'));
     $toDelete = new ilSelectInputGUI($this->lng->txt('rep_robj_xrs_choose_attribute'), ATTRC::DEL_ATTR_ID);
     $toDelete->setOptions($attributes);
     $toDelete->setRequired(true);
     $delete->addSubItem($toDelete);
     $radioGroup->addOption($delete);
     $this->attributesForm->addItem($radioGroup);
     $this->attributesForm->addCommandButton(ATTRC::EXECUTE_ROOM_ATTR_ACTION, $this->lng->txt("save"));
     $this->attributesForm->setFormAction($this->ctrl->getFormAction($this));
 }
 /**
  * Init settings form
  */
 protected function initFormCSettings()
 {
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('settings'));
     // individual course allocation
     $check = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_enable'), 'enabled');
     $check->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isCourseAllocationEnabled());
     $form->addItem($check);
     // add default container
     $imp = new ilCustomInputGUI($this->lng->txt('ecs_cmap_def_cat'), 'default_cat');
     $imp->setRequired(true);
     $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
     $tpl->setVariable('SIZE', 5);
     $tpl->setVariable('MAXLENGTH', 11);
     $tpl->setVariable('POST_VAR', 'default_cat');
     $default = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getDefaultCourseCategory();
     $tpl->setVariable('PROPERTY_VALUE', $default);
     if ($default) {
         include_once './Services/Tree/classes/class.ilPathGUI.php';
         $path = new ilPathGUI();
         $path->enableTextOnly(false);
         $path->enableHideLeaf(false);
         $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default));
     }
     $imp->setHtml($tpl->get());
     $imp->setInfo($this->lng->txt('ecs_cmap_def_cat_info'));
     $form->addItem($imp);
     // all in one category
     $allinone = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_all_in_one'), 'allinone');
     $allinone->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAllInOneCategoryEnabled());
     $allinone->setInfo($this->lng->txt('ecs_cmap_all_in_one_info'));
     $allinone_cat = new ilCustomInputGUI($this->lng->txt('ecs_cmap_all_in_one_cat'), 'allinone_cat');
     $allinone_cat->setRequired(true);
     $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
     $tpl->setVariable('SIZE', 5);
     $tpl->setVariable('MAXLENGTH', 11);
     $tpl->setVariable('POST_VAR', 'allinone_cat');
     $cat = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getAllInOneCategory();
     $tpl->setVariable('PROPERTY_VALUE', $cat);
     if ($cat) {
         include_once './Services/Tree/classes/class.ilPathGUI.php';
         $path = new ilPathGUI();
         $path->enableTextOnly(false);
         $path->enableHideLeaf(false);
         $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default));
     }
     $allinone_cat->setHtml($tpl->get());
     $allinone->addSubItem($allinone_cat);
     $form->addItem($allinone);
     // multiple attributes
     $multiple = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_multiple_atts'), 'multiple');
     $multiple->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAttributeMappingEnabled());
     // attribute selection
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
     include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseAttributes.php';
     $attributes = new ilSelectInputGUI($this->lng->txt('ecs_cmap_attributes'), 'atts');
     $attributes->setMulti(true);
     $attributes->setValue(ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid())->getAttributeValues());
     $attributes->setRequired(true);
     $attributes->setOptions(ilECSMappingUtils::getCourseMappingFieldSelectOptions());
     $multiple->addSubItem($attributes);
     $form->addItem($multiple);
     // role mapping
     $rm = new ilFormSectionHeaderGUI();
     $rm->setTitle($this->lng->txt('ecs_role_mappings'));
     $form->addItem($rm);
     $mapping_defs = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getRoleMappings();
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
     foreach (ilECSMappingUtils::getRoleMappingInfo() as $name => $info) {
         $role_map = new ilTextInputGUI($this->lng->txt($info['lang']), $name);
         $role_map->setValue($mapping_defs[$name]);
         $role_map->setSize(32);
         $role_map->setMaxLength(64);
         $role_map->setRequired($info['required']);
         $form->addItem($role_map);
     }
     $form->addCommandButton('cUpdateSettings', $this->lng->txt('save'));
     $form->addCommandButton('cSettings', $this->lng->txt('cancel'));
     return $form;
 }
 /**
  * Edit term
  */
 function editTerm()
 {
     global $ilTabs;
     $this->getTemplate();
     $this->displayLocator();
     $this->setTabs();
     $ilTabs->activateTab("properties");
     $this->tpl->setTitle($this->lng->txt("cont_term") . ": " . $this->term->getTerm());
     $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_term_b.png"));
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "updateTerm"));
     $form->setTitle($this->lng->txt("cont_edit_term"));
     $term = new ilTextInputGUI($this->lng->txt("cont_term"), "term");
     $term->setRequired(true);
     $term->setValue($this->term->getTerm());
     $form->addItem($term);
     $lang = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
     $lang->setRequired(true);
     $lang->setOptions(ilMDLanguageItem::_getLanguages());
     $lang->setValue($this->term->getLanguage());
     $form->addItem($lang);
     // taxonomy
     if ($this->glossary->getTaxonomyId() > 0) {
         include_once "./Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php";
         $tax_node_assign = new ilTaxAssignInputGUI($this->glossary->getTaxonomyId());
         $tax_node_assign->setCurrentValues("glo", "term", $this->term->getId());
         $form->addItem($tax_node_assign);
     }
     $form->addCommandButton("updateTerm", $this->lng->txt("save"));
     $this->tpl->setContent($form->getHTML());
     $this->quickList();
 }
 public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // shuffle
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getShuffle());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     if ($this->object->getId()) {
         $hidden = new ilHiddenInputGUI("", "ID");
         $hidden->setValue($this->object->getId());
         $form->addItem($hidden);
     }
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline;
         // Answer types
         $types = new ilSelectInputGUI($this->lng->txt("answer_types"), "types");
         $types->setRequired(false);
         $types->setValue($isSingleline ? 0 : 1);
         $types->setOptions(array(0 => $this->lng->txt('answers_singleline'), 1 => $this->lng->txt('answers_multiline')));
         $form->addItem($types);
     }
     if ($isSingleline) {
         // thumb size
         $thumb_size = new ilNumberInputGUI($this->lng->txt("thumb_size"), "thumb_size");
         $thumb_size->setMinValue(20);
         $thumb_size->setDecimals(0);
         $thumb_size->setSize(6);
         $thumb_size->setInfo($this->lng->txt('thumb_size_info'));
         $thumb_size->setValue($this->object->getThumbSize());
         $thumb_size->setRequired(false);
         $form->addItem($thumb_size);
         return $isSingleline;
     }
     return $isSingleline;
 }
 /**
  * Build property form
  * @param	string	$a_mode
  * @param	int		$id
  * @return	object
  */
 function initForm($a_mode = "create", $id = NULL)
 {
     global $lng, $ilCtrl, $ilObjDataCache;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form_gui = new ilPropertyFormGUI();
     $title = new ilTextInputGUI($lng->txt("title"), "title");
     $title->setRequired(true);
     $title->setSize(40);
     $title->setMaxLength(120);
     $form_gui->addItem($title);
     $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
     $desc->setCols(70);
     $desc->setRows(15);
     $form_gui->addItem($desc);
     $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
     $file->setALlowDeletion(true);
     $form_gui->addItem($file);
     $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
     $nr->setRequired(true);
     $nr->setSize(3);
     $nr->setMaxLength(3);
     $form_gui->addItem($nr);
     if ($this->pool_has_schedule) {
         $options = array();
         include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
         foreach (ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule) {
             $options[$schedule["booking_schedule_id"]] = $schedule["title"];
         }
         $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
         $schedule->setRequired(true);
         $schedule->setOptions($options);
         $form_gui->addItem($schedule);
     }
     $post = new ilFormSectionHeaderGUI();
     $post->setTitle($lng->txt("book_post_booking_information"));
     $form_gui->addItem($post);
     $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
     $pdesc->setCols(70);
     $pdesc->setRows(15);
     $form_gui->addItem($pdesc);
     $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
     $pfile->setALlowDeletion(true);
     $form_gui->addItem($pfile);
     if ($a_mode == "edit") {
         $form_gui->setTitle($lng->txt("book_edit_object"));
         $item = new ilHiddenInputGUI('object_id');
         $item->setValue($id);
         $form_gui->addItem($item);
         include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
         $obj = new ilBookingObject($id);
         $title->setValue($obj->getTitle());
         $desc->setValue($obj->getDescription());
         $nr->setValue($obj->getNrOfItems());
         $pdesc->setValue($obj->getPostText());
         $file->setValue($obj->getFile());
         $pfile->setValue($obj->getPostFile());
         if (isset($schedule)) {
             $schedule->setValue($obj->getScheduleId());
         }
         $form_gui->addCommandButton("update", $lng->txt("save"));
     } else {
         $form_gui->setTitle($lng->txt("book_add_object"));
         $form_gui->addCommandButton("save", $lng->txt("save"));
         $form_gui->addCommandButton("render", $lng->txt("cancel"));
     }
     $form_gui->setFormAction($ilCtrl->getFormAction($this));
     return $form_gui;
 }
 /**
  * Add standard fields to form
  */
 function addStandardFieldsToForm($a_form, $a_user = NULL, array $custom_fields = NULL)
 {
     global $ilSetting, $lng, $rbacreview, $ilias;
     // custom registration settings
     if (self::$mode == self::MODE_REGISTRATION) {
         include_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
         $registration_settings = new ilRegistrationSettings();
         self::$user_field["username"]["group"] = "login_data";
         self::$user_field["password"]["group"] = "login_data";
         self::$user_field["language"]["default"] = $lng->lang_key;
         // different position for role
         $roles = self::$user_field["roles"];
         unset(self::$user_field["roles"]);
         self::$user_field["roles"] = $roles;
         self::$user_field["roles"]["group"] = "settings";
     }
     $fields = $this->getStandardFields();
     $current_group = "";
     $custom_fields_done = false;
     foreach ($fields as $f => $p) {
         // next group? -> diplay subheader
         if ($p["group"] != $current_group && ilUserProfile::userSettingVisible($f)) {
             if (is_array($custom_fields) && !$custom_fields_done) {
                 // should be appended to "other" or at least before "settings"
                 if ($current_group == "other" || $p["group"] == "settings") {
                     // add "other" subheader
                     if ($current_group != "other") {
                         $sh = new ilFormSectionHeaderGUI();
                         $sh->setTitle($lng->txt("other"));
                         $a_form->addItem($sh);
                     }
                     foreach ($custom_fields as $custom_field) {
                         $a_form->addItem($custom_field);
                     }
                     $custom_fields_done = true;
                 }
             }
             $sh = new ilFormSectionHeaderGUI();
             $sh->setTitle($lng->txt($p["group"]));
             $a_form->addItem($sh);
             $current_group = $p["group"];
         }
         $m = "";
         if (isset($p["method"])) {
             $m = $p["method"];
         }
         $lv = isset($p["lang_var"]) && $p["lang_var"] != "" ? $p["lang_var"] : $f;
         switch ($p["input"]) {
             case "login":
                 if ((int) $ilSetting->get('allow_change_loginname') || self::$mode == self::MODE_REGISTRATION) {
                     $val = new ilTextInputGUI($lng->txt('username'), 'username');
                     if ($a_user) {
                         $val->setValue($a_user->getLogin());
                     }
                     $val->setMaxLength(32);
                     $val->setSize(40);
                     $val->setRequired(true);
                 } else {
                     // user account name
                     $val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un');
                     if ($a_user) {
                         $val->setValue($a_user->getLogin());
                     }
                 }
                 $a_form->addItem($val);
                 break;
             case "text":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ti->setValue($a_user->{$m}());
                     }
                     $ti->setMaxLength($p["maxlength"]);
                     $ti->setSize($p["size"]);
                     $ti->setRequired($ilSetting->get("require_" . $f));
                     if (!$ti->getRequired() || $ti->getValue()) {
                         $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ti);
                 }
                 break;
             case "sel_country":
                 if (ilUserProfile::userSettingVisible($f)) {
                     include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php";
                     $ci = new ilCountrySelectInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ci->setValue($a_user->{$m}());
                     }
                     $ci->setRequired($ilSetting->get("require_" . $f));
                     if (!$ci->getRequired() || $ci->getValue()) {
                         $ci->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ci);
                 }
                 break;
             case "birthday":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $bi = new ilBirthdayInputGUI($lng->txt($lv), "usr_" . $f);
                     include_once "./Services/Calendar/classes/class.ilDateTime.php";
                     $date = null;
                     if ($a_user && strlen($a_user->{$m}())) {
                         $date = new ilDateTime($a_user->{$m}(), IL_CAL_DATE);
                         $bi->setDate($date);
                     }
                     $bi->setShowEmpty(true);
                     $bi->setStartYear(1900);
                     $bi->setRequired($ilSetting->get("require_" . $f));
                     if (!$bi->getRequired() || $date) {
                         $bi->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($bi);
                 }
                 break;
             case "radio":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $rg = new ilRadioGroupInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $rg->setValue($a_user->{$m}());
                     }
                     foreach ($p["values"] as $k => $v) {
                         $op = new ilRadioOption($lng->txt($v), $k);
                         $rg->addOption($op);
                     }
                     $rg->setRequired($ilSetting->get("require_" . $f));
                     if (!$rg->getRequired() || $rg->getValue()) {
                         $rg->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($rg);
                 }
                 break;
             case "picture":
                 if (ilUserProfile::userSettingVisible("upload") && $a_user) {
                     $ii = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
                     $ii->setDisabled($ilSetting->get("usr_settings_disable_upload"));
                     $upload = $a_form->getFileUpload("userfile");
                     if ($upload["name"]) {
                         $ii->setPending($upload["name"]);
                     } else {
                         $im = ilObjUser::_getPersonalPicturePath($a_user->getId(), "small", true, true);
                         if ($im != "") {
                             $ii->setImage($im);
                             $ii->setAlt($lng->txt("personal_picture"));
                         }
                     }
                     // ilinc link as info
                     if (ilUserProfile::userSettingVisible("upload") and $ilSetting->get("ilinc_active")) {
                         include_once './Modules/ILinc/classes/class.ilObjiLincUser.php';
                         $ilinc_user = new ilObjiLincUser($a_user);
                         if ($ilinc_user->id) {
                             include_once './Modules/ILinc/classes/class.ilnetucateXMLAPI.php';
                             $ilincAPI = new ilnetucateXMLAPI();
                             $ilincAPI->uploadPicture($ilinc_user);
                             $response = $ilincAPI->sendRequest("uploadPicture");
                             // return URL to user's personal page
                             $url = trim($response->data['url']['cdata']);
                             $desc = $lng->txt("ilinc_upload_pic_text") . " " . '<a href="' . $url . '">' . $lng->txt("ilinc_upload_pic_linktext") . '</a>';
                             $ii->setInfo($desc);
                         }
                     }
                     $a_form->addItem($ii);
                 }
                 break;
             case "roles":
                 if (self::$mode == self::MODE_DESKTOP) {
                     if (ilUserProfile::userSettingVisible("roles")) {
                         $global_roles = $rbacreview->getGlobalRoles();
                         foreach ($global_roles as $role_id) {
                             if (in_array($role_id, $rbacreview->assignedRoles($a_user->getId()))) {
                                 $roleObj = $ilias->obj_factory->getInstanceByObjId($role_id);
                                 $role_names .= $roleObj->getTitle() . ", ";
                                 unset($roleObj);
                             }
                         }
                         $dr = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr");
                         $dr->setValue(substr($role_names, 0, -2));
                         $a_form->addItem($dr);
                     }
                 } else {
                     if (self::$mode == self::MODE_REGISTRATION) {
                         if ($registration_settings->roleSelectionEnabled()) {
                             include_once "./Services/AccessControl/classes/class.ilObjRole.php";
                             $options = array();
                             foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
                                 $options[$role["id"]] = $role["title"];
                             }
                             // registration form validation will take care of missing field / value
                             if ($options) {
                                 if (sizeof($options) > 1) {
                                     $ta = new ilSelectInputGUI($lng->txt('default_role'), "usr_" . $f);
                                     $ta->setOptions($options);
                                     $ta->setRequired($ilSetting->get("require_" . $f));
                                     if (!$ta->getRequired()) {
                                         $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                                     }
                                 } else {
                                     $ta = new ilHiddenInputGUI("usr_" . $f);
                                     $ta->setValue(array_shift(array_keys($options)));
                                 }
                                 $a_form->addItem($ta);
                             }
                         }
                     }
                 }
                 break;
             case "email":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $em = new ilEMailInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $em->setValue($a_user->{$m}());
                     }
                     $em->setRequired($ilSetting->get("require_" . $f));
                     if (!$em->getRequired() || $em->getValue()) {
                         $em->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     if (self::MODE_REGISTRATION == self::$mode) {
                         $em->setRetype(true);
                     }
                     $a_form->addItem($em);
                 }
                 break;
             case "textarea":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ta = new ilTextAreaInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ta->setValue($a_user->{$m}());
                     }
                     $ta->setRows($p["rows"]);
                     $ta->setCols($p["cols"]);
                     $ta->setRequired($ilSetting->get("require_" . $f));
                     if (!$ta->getRequired() || $ta->getValue()) {
                         $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ta);
                 }
                 break;
             case "messenger":
                 if (ilUserProfile::userSettingVisible("instant_messengers")) {
                     $im_arr = $p["types"];
                     foreach ($im_arr as $im_name) {
                         $im = new ilTextInputGUI($lng->txt("im_" . $im_name), "usr_im_" . $im_name);
                         if ($a_user) {
                             $im->setValue($a_user->getInstantMessengerId($im_name));
                         }
                         $im->setMaxLength($p["maxlength"]);
                         $im->setSize($p["size"]);
                         $im->setRequired($ilSetting->get("require_" . "instant_messengers"));
                         if (!$im->getRequired() || $im->getValue()) {
                             $im->setDisabled($ilSetting->get("usr_settings_disable_" . "instant_messengers"));
                         }
                         $a_form->addItem($im);
                     }
                 }
                 break;
             case "password":
                 if (self::$mode == self::MODE_REGISTRATION) {
                     if (!$registration_settings->passwordGenerationEnabled()) {
                         $ta = new ilPasswordInputGUI($lng->txt($lv), "usr_" . $f);
                         $ta->setRequired(true);
                         // $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
                     } else {
                         $ta = new ilNonEditableValueGUI($lng->txt($lv));
                         $ta->setValue($lng->txt("reg_passwd_via_mail"));
                     }
                     $a_form->addItem($ta);
                 }
                 break;
             case "language":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ta = new ilSelectInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ta->setValue($a_user->{$m}());
                     }
                     $options = array();
                     $lng->loadLanguageModule("meta");
                     foreach ($lng->getInstalledLanguages() as $lang_key) {
                         $options[$lang_key] = $lng->txt("meta_l_" . $lang_key);
                     }
                     asort($options);
                     // #9728
                     $ta->setOptions($options);
                     $ta->setRequired($ilSetting->get("require_" . $f));
                     if (!$ta->getRequired() || $ta->getValue()) {
                         $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ta);
                 }
                 break;
             case "multitext":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f);
                     $ti->setMulti(true);
                     if ($a_user) {
                         $ti->setValue($a_user->{$m}());
                     }
                     $ti->setMaxLength($p["maxlength"]);
                     $ti->setSize($p["size"]);
                     $ti->setRequired($ilSetting->get("require_" . $f));
                     if (!$ti->getRequired() || $ti->getValue()) {
                         $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     if ($this->ajax_href) {
                         // add field to ajax call
                         $ti->setDataSource($this->ajax_href . "&f=" . $f);
                     }
                     $a_form->addItem($ti);
                 }
                 break;
         }
     }
     // append custom fields as "other"
     if (is_array($custom_fields) && !$custom_fields_done) {
         // add "other" subheader
         if ($current_group != "other") {
             $sh = new ilFormSectionHeaderGUI();
             $sh->setTitle($lng->txt("other"));
             $a_form->addItem($sh);
         }
         foreach ($custom_fields as $custom_field) {
             $a_form->addItem($custom_field);
         }
     }
 }
 /**
  * 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->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 ilSelectInputGUI($this->lng->txt("certificate_page_format"), "pageformat");
     $pageformats = $this->object->getPageFormats();
     $pageformat->setValue($form_fields["pageformat"]);
     $options = array();
     foreach ($pageformats as $format) {
         $options[$format["value"]] = $format["name"];
     }
     $pageformat->setRequired(TRUE);
     $pageformat->setOptions($options);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $pageformat->checkInput();
     }
     if (strcmp($form_fields["pageformat"], "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"));
         if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
             $pageheight->checkInput();
         }
         $pageformat->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"));
         if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
             $pagewidth->checkInput();
         }
         $pageformat->addSubitem($pagewidth);
     }
     $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());
             }
         }
     }
 }
 protected function initAddNewEntryForm($a_id = null)
 {
     global $ilCtrl;
     if (!$a_id) {
         $a_id = $_POST["id"];
     }
     if (!$a_id || !in_array($a_id, ilObjLanguageAccess::_getSavedTopics())) {
         $ilCtrl->redirect($this, "view");
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "saveNewEntry"));
     $form->setTitle($this->lng->txt("adm_missing_entry_add"));
     $mods = ilObjLanguageAccess::_getSavedModules();
     $options = array_combine($mods, $mods);
     $mod = new ilSelectInputGUI(ucfirst($this->lng->txt("module")), "mod");
     $mod->setOptions(array("" => $this->lng->txt("please_select")) + $options);
     $mod->setRequired(true);
     $form->addItem($mod);
     $id = new ilTextInputGUI(ucfirst($this->lng->txt("identifier")), "id");
     $id->setValue($a_id);
     $id->setDisabled(true);
     $form->addItem($id);
     foreach ($this->lng->getInstalledLanguages() as $lang_key) {
         $trans = new ilTextInputGUI($this->lng->txt("meta_l_" . $lang_key), "trans_" . $lang_key);
         if (in_array($lang_key, array("de", "en"))) {
             $trans->setRequired(true);
         }
         $form->addItem($trans);
     }
     $form->addCommandButton("saveNewEntry", $this->lng->txt("save"));
     $form->addCommandButton("view", $this->lng->txt("cancel"));
     return $form;
 }
 /**
  * Init settings form 
  * @return void
  */
 protected function initFormSettings()
 {
     global $lng, $ilDB;
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/Search/classes/class.ilSearchSettings.php';
     $settings = new ilSearchSettings();
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'updateSettings'));
     $this->form->addCommandButton('updateSettings', $this->lng->txt('save'));
     $this->form->setTitle($this->lng->txt('seas_settings'));
     // Max hits
     $hits = new ilSelectInputGUI($this->lng->txt('seas_max_hits'), 'max_hits');
     $hits->setValue($settings->getMaxHits());
     $hits->setRequired(true);
     for ($value = 5; $value <= 15; $value += 5) {
         $values[$value] = $value;
     }
     $hits->setOptions($values);
     $hits->setInfo($this->lng->txt('seas_max_hits_info'));
     $this->form->addItem($hits);
     // Search type
     $type = new ilRadioGroupInputGUI($this->lng->txt('search_type'), 'search_type');
     if ($settings->enabledLucene()) {
         $type->setValue(ilSearchSettings::LUCENE_SEARCH);
     } elseif ($settings->enabledIndex()) {
         $type->setValue(ilSearchSettings::INDEX_SEARCH);
     } else {
         $type->setValue(ilSearchSettings::LIKE_SEARCH);
     }
     $type->setRequired(true);
     $this->form->addItem($type);
     // Default operator
     $operator = new ilRadioGroupInputGUI($this->lng->txt('lucene_default_operator'), 'operator');
     $operator->setRequired(true);
     $operator->setInfo($this->lng->txt('lucene_default_operator_info'));
     $operator->setValue($settings->getDefaultOperator());
     $and = new ilRadioOption($this->lng->txt('lucene_and'), ilSearchSettings::OPERATOR_AND);
     $operator->addOption($and);
     $or = new ilRadioOption($this->lng->txt('lucene_or'), ilSearchSettings::OPERATOR_OR);
     $operator->addOption($or);
     $this->form->addItem($operator);
     // Item filter
     $if = new ilCheckboxInputGUI($this->lng->txt('search_item_filter_form'), 'if');
     $if->setValue(1);
     $if->setChecked($settings->isLuceneItemFilterEnabled());
     $if->setInfo($this->lng->txt('search_item_filter_form_info'));
     $this->form->addItem($if);
     $filter = $settings->getLuceneItemFilter();
     foreach (ilSearchSettings::getLuceneItemFilterDefinitions() as $obj => $def) {
         $ch = new ilCheckboxInputGUI($this->lng->txt($def['trans']), 'filter[' . $obj . ']');
         if (isset($filter[$obj]) and $filter[$obj]) {
             $ch->setChecked(true);
         }
         $ch->setValue(1);
         $if->addSubItem($ch);
     }
     // hide advanced search
     $cb = new ilCheckboxInputGUI($lng->txt("search_hide_adv_search"), "hide_adv_search");
     $cb->setChecked($settings->getHideAdvancedSearch());
     $this->form->addItem($cb);
     // number of auto complete entries
     $options = array(5 => 5, 10 => 10, 20 => 20, 30 => 30);
     $si = new ilSelectInputGUI($lng->txt("search_auto_complete_length"), "auto_complete_length");
     $si->setOptions($options);
     $val = $settings->getAutoCompleteLength() > 0 ? $settings->getAutoCompleteLength() : 10;
     $si->setValue($val);
     $this->form->addItem($si);
     $direct = new ilRadioOption($this->lng->txt('search_direct'), ilSearchSettings::LIKE_SEARCH, $this->lng->txt('search_like_info'));
     $type->addOption($direct);
     if ($ilDB->getDBType() == 'mysql') {
         $index = new ilRadioOption($this->lng->txt('search_index'), ilSearchSettings::INDEX_SEARCH, $this->lng->txt('search_full_info'));
         $type->addOption($index);
     }
     $lucene = new ilRadioOption($this->lng->txt('search_lucene'), ilSearchSettings::LUCENE_SEARCH, $this->lng->txt('java_server_info'));
     $type->addOption($lucene);
 }
 /**
  * Insert new question form
  */
 function insert($a_mode = "create")
 {
     global $ilUser, $lng, $ilCtrl;
     $this->setInsertTabs("new_question");
     $this->displayValidationError();
     // get all question types (@todo: we have to check, whether they are
     // suitable for self assessment or not)
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     $all_types = ilObjQuestionPool::_getSelfAssessmentQuestionTypes();
     $options = array();
     $all_types = ilUtil::sortArray($all_types, "order", "asc", true, true);
     foreach ($all_types as $k => $v) {
         $options[$v["type_tag"]] = $k;
     }
     // new table form (input of rows and columns)
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
     $this->form_gui->setTitle($lng->txt("cont_ed_insert_pcqst"));
     // Select Question Type
     $qtype_input = new ilSelectInputGUI($lng->txt("cont_question_type"), "q_type");
     $qtype_input->setOptions($options);
     $qtype_input->setRequired(true);
     $this->form_gui->addItem($qtype_input);
     // additional content editor
     // assessment
     include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
     if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled()) {
         $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
         $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_default'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT));
         $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_page_object'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT));
         $ri->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT);
         $this->form_gui->addItem($ri, true);
     } else {
         $hi = new ilHiddenInputGUI("question_content_editing_type");
         $hi->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT);
         $this->form_gui->addItem($hi, true);
     }
     // Select Question Pool
     /*
     		include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
     		$qpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, false, true, false, "write");
     
     		if (count($qpools) > 0)
     		{
     			$pool_options = array();
     			foreach ($qpools as $key => $value)
     			{
     				$pool_options[$key] = $value["title"];
     			}
     			$pool_input = new ilSelectInputGUI($lng->txt("cont_question_pool"), "qpool_ref_id");
     			$pool_input->setOptions($pool_options);
     			$pool_input->setRequired(true);
     			$this->form_gui->addItem($pool_input);
     		}
     		else
     		{
     			$pool_input = new ilTextInputGUI($lng->txt("cont_question_pool"), "qpool_title");
     			$pool_input->setRequired(true);
     			$this->form_gui->addItem($pool_input);
     		}
     */
     if ($a_mode == "edit_empty") {
         $this->form_gui->addCommandButton("edit", $lng->txt("save"));
     } else {
         $this->form_gui->addCommandButton("create_pcqst", $lng->txt("save"));
         $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
     }
     $this->tpl->setContent($this->form_gui->getHTML());
 }
Exemple #28
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;
 }
 /**
  * Init form
  * @param int $a_mode
  * @return 
  */
 protected function initFormSequence($a_mode)
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initDomEvent();
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     switch ($a_mode) {
         case self::MODE_CREATE:
             $this->form->setTitle($this->lng->txt('cal_ch_add_sequence'));
             $this->form->addCommandButton('saveSequence', $this->lng->txt('save'));
             $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
             break;
             /*
             			case self::MODE_UPDATE:
             				$this->form->setTitle($this->lng->txt('cal_ch_edit_sequence'));
             				$this->form->addCommandButton('updateSequence', $this->lng->txt('save'));
             				$this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
             				break;
             */
         /*
         			case self::MODE_UPDATE:
         				$this->form->setTitle($this->lng->txt('cal_ch_edit_sequence'));
         				$this->form->addCommandButton('updateSequence', $this->lng->txt('save'));
         				$this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
         				break;
         */
         case self::MODE_MULTI:
             $this->form->setTitle($this->lng->txt('cal_ch_multi_edit_sequence'));
             $this->form->addCommandButton('updateMulti', $this->lng->txt('save'));
             $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
             break;
     }
     // in case of existing groups show a selection
     include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
     if (count($options = ilConsultationHourGroups::getGroupSelectOptions($this->getUserId()))) {
         $group = new ilSelectInputGUI($this->lng->txt('cal_ch_grp_selection'), 'grp');
         $group->setOptions($options);
         $group->setRequired(false);
         $this->form->addItem($group);
     }
     // Title
     $ti = new ilTextInputGUI($this->lng->txt('title'), 'ti');
     $ti->setSize(32);
     $ti->setMaxLength(128);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     if ($a_mode != self::MODE_MULTI) {
         // Start
         include_once './Services/Form/classes/class.ilDateTimeInputGUI.php';
         $dur = new ilDateTimeInputGUI($this->lng->txt('cal_start'), 'st');
         $dur->setShowTime(true);
         $dur->setMinuteStepSize(5);
         $this->form->addItem($dur);
         // Duration
         $du = new ilDurationInputGUI($this->lng->txt('cal_ch_duration'), 'du');
         $du->setShowMinutes(true);
         $du->setShowHours(true);
         $this->form->addItem($du);
         // Number of appointments
         $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_appointments'), 'ap');
         $nu->setInfo($this->lng->txt('cal_ch_num_appointments_info'));
         $nu->setSize(2);
         $nu->setMaxLength(2);
         $nu->setRequired(true);
         $nu->setMinValue(1);
         $this->form->addItem($nu);
         // Recurrence
         include_once './Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php';
         $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
         $rec->setEnabledSubForms(array(IL_CAL_FREQ_DAILY, IL_CAL_FREQ_WEEKLY, IL_CAL_FREQ_MONTHLY));
         $this->form->addItem($rec);
     }
     // Number of bookings
     $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_bookings'), 'bo');
     $nu->setSize(2);
     $nu->setMaxLength(2);
     $nu->setMinValue(1);
     $nu->setRequired(true);
     $this->form->addItem($nu);
     // Deadline
     $dead = new ilDurationInputGUI($this->lng->txt('cal_ch_deadline'), 'dead');
     $dead->setInfo($this->lng->txt('cal_ch_deadline_info'));
     $dead->setShowMinutes(false);
     $dead->setShowHours(true);
     $dead->setShowDays(true);
     $this->form->addItem($dead);
     // Location
     $lo = new ilTextInputGUI($this->lng->txt('cal_where'), 'lo');
     $lo->setSize(32);
     $lo->setMaxLength(128);
     $this->form->addItem($lo);
     // Description
     $de = new ilTextAreaInputGUI($this->lng->txt('description'), 'de');
     $de->setRows(10);
     $de->setCols(60);
     $this->form->addItem($de);
     // Target Object
     $tgt = new ilTextInputGUI($this->lng->txt('cal_ch_target_object'), 'tgt');
     $tgt->setInfo($this->lng->txt('cal_ch_target_object_info'));
     $tgt->setSize(16);
     $tgt->setMaxLength(128);
     $this->form->addItem($tgt);
 }
 /**
  * Init verification form
  *
  * @param bool $a_insert
  * @return ilPropertyFormGUI
  */
 protected function initForm($a_insert = false)
 {
     global $ilCtrl, $ilUser, $lng;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     if ($a_insert) {
         $form->setTitle($this->lng->txt("cont_insert_verification"));
     } else {
         $form->setTitle($this->lng->txt("cont_update_verification"));
     }
     $lng->loadLanguageModule("wsp");
     $options = array();
     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
     $tree = new ilWorkspaceTree($ilUser->getId());
     $root = $tree->getRootId();
     if ($root) {
         $root = $tree->getNodeData($root);
         foreach ($tree->getSubTree($root) as $node) {
             if (in_array($node["type"], array("excv", "tstv"))) {
                 $options[$node["obj_id"]] = $node["title"] . " (" . $lng->txt("wsp_type_" . $node["type"]) . ")";
             }
         }
         asort($options);
     }
     $obj = new ilSelectInputGUI($this->lng->txt("cont_verification_object"), "object");
     $obj->setRequired(true);
     $obj->setOptions($options);
     $form->addItem($obj);
     if ($a_insert) {
         $form->addCommandButton("create_verification", $this->lng->txt("save"));
         $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
     } else {
         $data = $this->content_obj->getData();
         $obj->setValue($data["id"]);
         $form->addCommandButton("update", $this->lng->txt("save"));
         $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
     }
     return $form;
 }