/**
  * Init filter
  */
 function initFilter()
 {
     global $lng, $rbacreview, $ilUser;
     // title
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($lng->txt("title"), "title");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["title"] = $ti->getValue();
 }
 /**
  * initEditCustomForm
  *
  * @param string $a_mode values: create | edit
  */
 public function initForm($a_mode = "create")
 {
     global $ilCtrl, $lng;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt('dcl_edit_field'));
         $hidden_prop = new ilHiddenInputGUI("field_id");
         $this->form->addItem($hidden_prop);
         $this->form->setFormAction($ilCtrl->getFormAction($this), "update");
         $this->form->addCommandButton('update', $lng->txt('dcl_update_field'));
     } else {
         $this->form->setTitle($lng->txt('dcl_new_field'));
         $hidden_prop = new ilHiddenInputGUI("table_id");
         $hidden_prop->setValue($this->field_obj->getTableId());
         $this->form->addItem($hidden_prop);
         $this->form->setFormAction($ilCtrl->getFormAction($this), "save");
         $this->form->addCommandButton('save', $lng->txt('dcl_create_field'));
     }
     $this->form->addCommandButton('cancel', $lng->txt('cancel'));
     $text_prop = new ilTextInputGUI($lng->txt("title"), "title");
     $text_prop->setRequired(true);
     $text_prop->setValidationRegexp("/^[a-zA-Z\\d -.,äöüÄÖÜàéèÀÉÈç¢]*\$/i");
     $this->form->addItem($text_prop);
     $edit_datatype = new ilRadioGroupInputGUI($lng->txt('dcl_datatype'), 'datatype');
     foreach (ilDataCollectionDatatype::getAllDatatypes() as $datatype) {
         $opt = new ilRadioOption($lng->txt('dcl_' . $datatype['title']), $datatype['id']);
         foreach (ilDataCollectionDatatype::getProperties($datatype['id']) as $property) {
             //Type Reference: List Tabels
             if ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE and $property['id'] == ilDataCollectionField::PROPERTYID_REFERENCE) {
                 // Get Tables
                 require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
                 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
                 foreach ($tables as $table) {
                     foreach ($table->getRecordFields() as $field) {
                         //referencing references may lead to endless loops.
                         if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
                             $options[$field->getId()] = $table->getTitle() . "->" . $field->getTitle();
                         }
                     }
                 }
                 $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']);
                 $table_selection->setOptions($options);
                 //$table_selection->setValue($this->table_id);
                 $opt->addSubItem($table_selection);
             } elseif ($property['datatype_id'] == $datatype['id']) {
                 if ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN) {
                     $subitem = new ilCheckboxInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     $opt->addSubItem($subitem);
                 } else {
                     $subitem = new ilTextInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     $opt->addSubItem($subitem);
                 }
             }
         }
         $edit_datatype->addOption($opt);
     }
     $edit_datatype->setRequired(true);
     //you can't change type but we still need it in POST
     if ($a_mode == "edit") {
         $edit_datatype->setDisabled(true);
     }
     $this->form->addItem($edit_datatype);
     // Description
     $text_prop = new ilTextAreaInputGUI($lng->txt("dcl_field_description"), "description");
     $this->form->addItem($text_prop);
     // Required
     $cb = new ilCheckboxInputGUI($lng->txt("dcl_field_required"), "required");
     $this->form->addItem($cb);
     //Unique
     $cb = new ilCheckboxInputGUI($lng->txt("dcl_unique"), "unique");
     $this->form->addItem($cb);
 }
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng, $rbacreview, $ilUser;
     // title
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($lng->txt("survey_question_title"), "title");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["title"] = $ti->getValue();
     // description
     $ti = new ilTextInputGUI($lng->txt("description"), "description");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["description"] = $ti->getValue();
     // author
     $ti = new ilTextInputGUI($lng->txt("author"), "author");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["author"] = $ti->getValue();
     // questiontype
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
     $types = ilObjSurveyQuestionPool::_getQuestionTypes();
     $options = array();
     $options[""] = $lng->txt('filter_all_question_types');
     foreach ($types as $translation => $row) {
         $options[$row['type_tag']] = $translation;
     }
     $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["type"] = $si->getValue();
     // questionpool text
     $ti = new ilTextInputGUI($lng->txt("survey_question_pool_title"), "spl_txt");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["spl_txt"] = $ti->getValue();
     // questionpool select
     $options = array();
     $options[""] = $lng->txt('filter_all_questionpools');
     natcasesort($this->questionpools);
     foreach ($this->questionpools as $obj_id => $title) {
         $options[$obj_id] = $title;
     }
     $si = new ilSelectInputGUI($this->lng->txt("survey_available_question_pools"), "spl");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["type"] = $si->getValue();
 }
 /**
  * Shows the certificate editor for ILIAS tests
  */
 public function certificateEditor()
 {
     global $ilAccess;
     $form_fields = array();
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $form_fields = $this->getFormFieldsFromPOST();
     } else {
         $form_fields = $this->getFormFieldsFromFO();
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setPreventDoubleSubmission(false);
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("certificate_edit"));
     $form->setMultipart(TRUE);
     $form->setTableWidth("100%");
     $form->setId("certificate");
     $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active");
     $active->setChecked($form_fields["active"]);
     $form->addItem($active);
     $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import");
     $import->setRequired(FALSE);
     $import->setSuffixes(array("zip"));
     // handle the certificate import
     if (strlen($_FILES["certificate_import"]["tmp_name"])) {
         if ($import->checkInput()) {
             $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]);
             if ($result == FALSE) {
                 $import->setAlert($this->lng->txt("certificate_error_import"));
             } else {
                 $this->ctrl->redirect($this, "certificateEditor");
             }
         }
     }
     $form->addItem($import);
     $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat");
     $pageformats = $this->object->getPageFormats();
     $pageformat->setValue($form_fields["pageformat"]);
     foreach ($pageformats as $format) {
         $option = new ilRadioOption($format["name"], $format["value"]);
         if (strcmp($format["value"], "custom") == 0) {
             $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight");
             $pageheight->setValue($form_fields["pageheight"]);
             $pageheight->setSize(6);
             $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pageheight->setInfo($this->lng->txt("certificate_unit_description"));
             $pageheight->setRequired(true);
             $option->addSubitem($pageheight);
             $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth");
             $pagewidth->setValue($form_fields["pagewidth"]);
             $pagewidth->setSize(6);
             $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pagewidth->setInfo($this->lng->txt("certificate_unit_description"));
             $pagewidth->setRequired(true);
             $option->addSubitem($pagewidth);
         }
         $pageformat->addOption($option);
     }
     $pageformat->setRequired(true);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $pageformat->checkInput();
     }
     $form->addItem($pageformat);
     $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background");
     $bgimage->setRequired(FALSE);
     $bgimage->setUseCache(false);
     if (count($_POST)) {
         // handle the background upload
         if (strlen($_FILES["background"]["tmp_name"])) {
             if ($bgimage->checkInput()) {
                 $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]);
                 if ($result == FALSE) {
                     $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage"));
                 }
             }
         }
     }
     if (!$this->object->hasBackgroundImage()) {
         include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
         if (ilObjCertificateSettingsAccess::hasBackgroundImage()) {
             $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb());
         }
     } else {
         $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
     }
     $form->addItem($bgimage);
     $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top");
     $padding_top->setRequired(TRUE);
     $padding_top->setValue($form_fields["padding_top"]);
     $padding_top->setSize(6);
     $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
     $padding_top->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $padding_top->checkInput();
     }
     $form->addItem($padding_top);
     $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body");
     $rect->setRequired(TRUE);
     $rect->setUseUnits(TRUE);
     $rect->setTop($form_fields["margin_body_top"]);
     $rect->setBottom($form_fields["margin_body_bottom"]);
     $rect->setLeft($form_fields["margin_body_left"]);
     $rect->setRight($form_fields["margin_body_right"]);
     $rect->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $rect->checkInput();
     }
     $form->addItem($rect);
     $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text");
     $certificate->removePlugin('ilimgupload');
     $certificate->setValue($form_fields["certificate_text"]);
     $certificate->setRequired(TRUE);
     $certificate->setRows(20);
     $certificate->setCols(80);
     // fraunhpatch start
     $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate");
     foreach (ilCertificate::getCustomCertificateFields() as $f) {
         $common_desc_tpl->setCurrentBlock("cert_field");
         $common_desc_tpl->setVariable("PH", $f["ph"]);
         $common_desc_tpl->setVariable("PH_TXT", $f["name"]);
         $common_desc_tpl->parseCurrentBlock();
     }
     $common_desc = $common_desc_tpl->get();
     // fraunhpatch start
     $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc);
     $certificate->setUseRte(TRUE, '3.4.7');
     $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul");
     $certificate->setRteTags($tags);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $certificate->checkInput();
     }
     $form->addItem($certificate);
     $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         if ($this->object->isComplete() || $this->object->hasBackgroundImage()) {
             $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview"));
             $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export"));
             $form->addCommandButton("certificateDelete", $this->lng->txt("delete"));
         }
         $form->addCommandButton("certificateSave", $this->lng->txt("save"));
     }
     $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         if ($_POST["background_delete"]) {
             $this->object->deleteBackgroundImage();
         }
         if ($form->checkInput()) {
             try {
                 $xslfo = $this->object->processXHTML2FO($form_fields);
                 $this->object->getAdapter()->saveFormFields($form_fields);
                 $this->object->saveCertificate($xslfo);
                 $this->object->writeActive($form_fields["active"]);
                 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE);
                 $this->ctrl->redirect($this, "certificateEditor");
             } catch (Exception $e) {
                 ilUtil::sendFailure($e->getMessage());
             }
         }
     }
 }
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng;
     // title
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($lng->txt("tst_qbt_filter_question_title"), "title");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["title"] = $ti->getValue();
     // description
     $ti = new ilTextInputGUI($lng->txt("description"), "description");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["description"] = $ti->getValue();
     // questiontype
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     $types = ilObjQuestionPool::_getQuestionTypes();
     $options = array();
     $options[""] = $lng->txt('filter_all_question_types');
     foreach ($types as $translation => $row) {
         $options[$row['type_tag']] = $translation;
     }
     $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["type"] = $si->getValue();
     // author
     $ti = new ilTextInputGUI($lng->txt("author"), "author");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $ti->readFromSession();
     $this->filter["author"] = $ti->getValue();
     // question pool
     $ti = new ilTextInputGUI($lng->txt("qpl"), "qpl");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["qpl"] = $ti->getValue();
 }
 /**
  * initEditCustomForm
  *
  * @param string $a_mode values: create | edit
  */
 public function initForm($a_mode = "create")
 {
     global $ilCtrl, $lng;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt('dcl_edit_field'));
         $hidden_prop = new ilHiddenInputGUI("field_id");
         $this->form->addItem($hidden_prop);
         $this->form->setFormAction($ilCtrl->getFormAction($this), "update");
         $this->form->addCommandButton('update', $lng->txt('dcl_update_field'));
     } else {
         $this->form->setTitle($lng->txt('dcl_new_field'));
         $hidden_prop = new ilHiddenInputGUI("table_id");
         $hidden_prop->setValue($this->field_obj->getTableId());
         $this->form->addItem($hidden_prop);
         $this->form->setFormAction($ilCtrl->getFormAction($this), "save");
         $this->form->addCommandButton('save', $lng->txt('dcl_create_field'));
     }
     $this->form->addCommandButton('cancel', $lng->txt('cancel'));
     $text_prop = new ilTextInputGUI($lng->txt("title"), "title");
     $text_prop->setRequired(true);
     $text_prop->setInfo(sprintf($lng->txt('fieldtitle_allow_chars'), ilDataCollectionField::_getTitleValidChars(false)));
     $text_prop->setValidationRegexp(ilDataCollectionField::_getTitleValidChars(true));
     $this->form->addItem($text_prop);
     $edit_datatype = new ilRadioGroupInputGUI($lng->txt('dcl_datatype'), 'datatype');
     foreach (ilDataCollectionDatatype::getAllDatatypes() as $datatype) {
         $opt = new ilRadioOption($lng->txt('dcl_' . $datatype['title']), $datatype['id']);
         foreach (ilDataCollectionDatatype::getProperties($datatype['id']) as $property) {
             //Type Reference: List Tabels
             if ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE and $property['id'] == ilDataCollectionField::PROPERTYID_REFERENCE) {
                 $options = array();
                 // Get Tables
                 require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
                 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
                 foreach ($tables as $table) {
                     foreach ($table->getRecordFields() as $field) {
                         //referencing references may lead to endless loops.
                         if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
                             $options[$field->getId()] = $table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle();
                         }
                     }
                 }
                 $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']);
                 $table_selection->setOptions($options);
                 //$table_selection->setValue($this->table_id);
                 $opt->addSubItem($table_selection);
             } elseif ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCELIST and $property['id'] == ilDataCollectionField::PROPERTYID_N_REFERENCE) {
                 // Get Tables
                 require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
                 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
                 foreach ($tables as $table) {
                     foreach ($table->getRecordFields() as $field) {
                         //referencing references may lead to endless loops.
                         if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCELIST) {
                             $options[$field->getId()] = $table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle();
                         }
                     }
                 }
                 $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']);
                 $table_selection->setOptions($options);
                 $opt->addSubItem($table_selection);
             } elseif ($property['id'] == ilDataCollectionField::PROPERTYID_FORMULA_EXPRESSION) {
                 $table = ilDataCollectionCache::getTableCache((int) $_GET['table_id']);
                 $fields = array();
                 foreach ($table->getFieldsForFormula() as $f) {
                     $placeholder = $f->isStandardField() ? $f->getId() : $f->getTitle();
                     $fields[] = '<a class="dclPropExpressionField" data-placeholder="' . $placeholder . '">' . $f->getTitle() . '</a>';
                 }
                 $subitem = new ilTextAreaInputGUI($lng->txt('dcl_prop_expression'), 'prop_' . $property['id']);
                 $operators = implode(', ', array_keys(ilDclExpressionParser::getOperators()));
                 $functions = implode(', ', ilDclExpressionParser::getFunctions());
                 $subitem->setInfo(sprintf($lng->txt('dcl_prop_expression_info'), $operators, $functions, implode('<br>', $fields)));
                 $opt->addSubItem($subitem);
             } elseif ($property['datatype_id'] == $datatype['id']) {
                 //All other Types: List properties saved in propertie definition table
                 if ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN) {
                     $subitem = new ilCheckboxInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     $opt->addSubItem($subitem);
                 } elseif ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_NUMBER) {
                     $subitem = new ilNumberInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     // TODO: Nicer way to add additional info to fields (need changes in language-logic)
                     /*if($lng->txt('dcl_'.$property['title'].'_info') != '-dcl_'.$property['title'].'_info-') {
                     			$subitem->setInfo($lng->txt('dcl_'.$property['title'].'_info'));
                     		}*/
                     $subitem->setSize(5);
                     if ($property['title'] == 'length') {
                         $subitem->setMaxValue(4000);
                         $subitem->setInfo($lng->txt('dcl_' . $property['title'] . '_info'));
                     }
                     $opt->addSubItem($subitem);
                 } elseif ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_NON_EDITABLE_VALUE) {
                     $subitem = new ilNonEditableValueGUI($lng->txt('dcl_' . $property['title']));
                     $subitem->setValue(implode(', ', ilDataCollectionDatatype::$mob_suffixes));
                     $opt->addSubItem($subitem);
                 } else {
                     $subitem = new ilTextInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     // TODO: Nicer way to add additional info to fields (need changes in language-logic)
                     /*if($lng->txt('dcl_'.$property['title'].'_info') != '-dcl_'.$property['title'].'_info-') {
                     			$subitem->setInfo($lng->txt('dcl_'.$property['title'].'_info'));
                     		}*/
                     if ($property['title'] == 'regex') {
                         $subitem->setInfo($lng->txt('dcl_' . $property['title'] . '_info'));
                     }
                     $opt->addSubItem($subitem);
                 }
             }
         }
         $edit_datatype->addOption($opt);
     }
     $edit_datatype->setRequired(true);
     //you can't change type but we still need it in POST
     if ($a_mode == "edit") {
         $edit_datatype->setDisabled(true);
     }
     $this->form->addItem($edit_datatype);
     // Description
     $text_prop = new ilTextAreaInputGUI($lng->txt("dcl_field_description"), "description");
     $this->form->addItem($text_prop);
     // Required
     $cb = new ilCheckboxInputGUI($lng->txt("dcl_field_required"), "required");
     $this->form->addItem($cb);
     //Unique
     $cb = new ilCheckboxInputGUI($lng->txt("dcl_unique"), "unique");
     $this->form->addItem($cb);
 }
 public function initFilter()
 {
     // title
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($this->lng->txt("tst_qbt_filter_question_title"), "title");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["title"] = $ti->getValue();
     // description
     $ti = new ilTextInputGUI($this->lng->txt("description"), "description");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["description"] = $ti->getValue();
     // questiontype
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     $types = ilObjQuestionPool::_getQuestionTypes();
     $options = array();
     $options[""] = $this->lng->txt('filter_all_question_types');
     foreach ($types as $translation => $row) {
         $options[$row['type_tag']] = $translation;
     }
     $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["type"] = $si->getValue();
     // author
     $ti = new ilTextInputGUI($this->lng->txt("author"), "author");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $ti->readFromSession();
     $this->filter["author"] = $ti->getValue();
     // question pool
     $ti = new ilTextInputGUI($this->getParentObjectLabel(), 'parent_title');
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter['parent_title'] = $ti->getValue();
     // repo root node
     require_once 'Services/Form/classes/class.ilRepositorySelectorInputGUI.php';
     $ri = new ilRepositorySelectorInputGUI($this->lng->txt('repository'), 'repository_root_node');
     $ri->setHeaderMessage($this->lng->txt('question_browse_area_info'));
     $this->addFilterItem($ri);
     $ri->readFromSession();
     $this->filter['repository_root_node'] = $ri->getValue();
 }
 /**
  * Create role prperty form
  * @return 
  * @param int $a_mode
  */
 protected function initFormRoleProperties($a_mode)
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     if ($this->creation_mode) {
         $this->ctrl->setParameter($this, "new_type", 'role');
     }
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     switch ($a_mode) {
         case self::MODE_GLOBAL_CREATE:
             $this->form->setTitle($this->lng->txt('role_new'));
             $this->form->addCommandButton('save', $this->lng->txt('role_new'));
             break;
         case self::MODE_GLOBAL_UPDATE:
             $this->form->setTitle($this->lng->txt('role_edit'));
             $this->form->addCommandButton('update', $this->lng->txt('save'));
             break;
         case self::MODE_LOCAL_CREATE:
         case self::MODE_LOCAL_UPDATE:
     }
     // Fix cancel
     $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     if (ilObjRole::isAutoGenerated($this->object->getId())) {
         $title->setDisabled(true);
     }
     $title->setValidationRegexp('/^(?!il_).*$/');
     $title->setValidationFailureMessage($this->lng->txt('msg_role_reserved_prefix'));
     $title->setSize(40);
     $title->setMaxLength(70);
     $title->setRequired(true);
     $this->form->addItem($title);
     $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
     if (ilObjRole::isAutoGenerated($this->object->getId())) {
         $desc->setDisabled(true);
     }
     $desc->setCols(40);
     $desc->setRows(3);
     $this->form->addItem($desc);
     if ($this->rolf_ref_id == ROLE_FOLDER_ID) {
         $reg = new ilCheckboxInputGUI($this->lng->txt('allow_register'), 'reg');
         $reg->setValue(1);
         #$reg->setInfo($this->lng->txt('rbac_new_acc_reg_info'));
         $this->form->addItem($reg);
         $la = new ilCheckboxInputGUI($this->lng->txt('allow_assign_users'), 'la');
         $la->setValue(1);
         #$la->setInfo($this->lng->txt('rbac_local_admin_info'));
         $this->form->addItem($la);
     }
     $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'pro');
     $pro->setValue(1);
     #$pro->setInfo($this->lng->txt('role_protext_permission_info'));
     $this->form->addItem($pro);
     include_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if (ilDiskQuotaActivationChecker::_isActive()) {
         $quo = new ilNumberInputGUI($this->lng->txt('disk_quota'), 'disk_quota');
         $quo->setMinValue(0);
         $quo->setSize(4);
         $quo->setInfo($this->lng->txt('enter_in_mb_desc') . '<br />' . $this->lng->txt('disk_quota_on_role_desc'));
         $this->form->addItem($quo);
     }
     if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         $this->lng->loadLanguageModule("file");
         $wquo = new ilNumberInputGUI($this->lng->txt('personal_workspace_disk_quota'), 'wsp_disk_quota');
         $wquo->setMinValue(0);
         $wquo->setSize(4);
         $wquo->setInfo($this->lng->txt('enter_in_mb_desc') . '<br />' . $this->lng->txt('disk_quota_on_role_desc'));
         $this->form->addItem($wquo);
     }
     return true;
 }
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng, $rbacreview, $ilUser;
     // title
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($lng->txt("title"), "title");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["title"] = $ti->getValue();
     // description
     $ti = new ilTextInputGUI($lng->txt("description"), "description");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["description"] = $ti->getValue();
     if (!$this->confirmdelete) {
         // author
         $ti = new ilTextInputGUI($lng->txt("author"), "author");
         $ti->setMaxLength(64);
         $ti->setSize(20);
         $ti->setValidationRegexp('/^[^%]+$/is');
         $this->addFilterItem($ti);
         $ti->readFromSession();
         $this->filter["author"] = $ti->getValue();
     }
     // questiontype
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     $types = ilObjQuestionPool::_getQuestionTypes();
     $options = array();
     $options[""] = $lng->txt('filter_all_question_types');
     foreach ($types as $translation => $row) {
         $options[$row['type_tag']] = $translation;
     }
     $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["type"] = $si->getValue();
     if ($this->parent_obj->object->getShowTaxonomies()) {
         require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
         foreach ($this->taxIds as $taxId) {
             if ($taxId == $this->parent_obj->object->getNavTaxonomyId()) {
                 continue;
             }
             $postvar = "tax_{$taxId}";
             $inp = new ilTaxSelectInputGUI($taxId, $postvar, true);
             $this->addFilterItem($inp);
             $inp->readFromSession();
             $this->filter[$postvar] = $inp->getValue();
         }
     }
 }
 /**
  * Shoew add role
  * @global type $rbacreview
  * @global type $objDefinition
  * @return ilPropertyFormGUI 
  */
 protected function initRoleForm()
 {
     global $rbacreview, $objDefinition;
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('role_new'));
     $form->addCommandButton('addrole', $this->lng->txt('role_new'));
     $form->addCommandButton('perm', $this->lng->txt('cancel'));
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $title->setValidationRegexp('/^(?!il_).*$/');
     $title->setValidationFailureMessage($this->lng->txt('msg_role_reserved_prefix'));
     $title->setSize(40);
     $title->setMaxLength(70);
     $title->setRequired(true);
     $form->addItem($title);
     $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
     $desc->setCols(40);
     $desc->setRows(3);
     $form->addItem($desc);
     $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'pro');
     $pro->setInfo($this->lng->txt('role_protect_permissions_desc'));
     $pro->setValue(1);
     $form->addItem($pro);
     $pd = new ilCheckboxInputGUI($this->lng->txt('rbac_role_add_to_desktop'), 'desktop');
     $pd->setInfo($this->lng->txt('rbac_role_add_to_desktop_info'));
     $pd->setValue(1);
     $form->addItem($pd);
     if (!$this->isInAdministration()) {
         $rights = new ilRadioGroupInputGUI($this->lng->txt("rbac_role_rights_copy"), 'rights');
         $option = new ilRadioOption($this->lng->txt("rbac_role_rights_copy_empty"), 0);
         $rights->addOption($option);
         $parent_role_ids = $rbacreview->getParentRoleIds($this->gui_obj->object->getRefId(), true);
         $ids = array();
         foreach ($parent_role_ids as $id => $tmp) {
             $ids[] = $id;
         }
         // Sort ids
         $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type DESC,title', 'obj_id');
         // Sort roles by title
         $sorted_roles = ilUtil::sortArray(array_values($parent_role_ids), 'title', ASC);
         $key = 0;
         foreach ($sorted_ids as $id) {
             $par = $parent_role_ids[$id];
             if ($par["obj_id"] != SYSTEM_ROLE_ID) {
                 include_once './Services/AccessControl/classes/class.ilObjRole.php';
                 $option = new ilRadioOption(($par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt')) . ": " . ilObjRole::_getTranslation($par["title"]), $par["obj_id"]);
                 $option->setInfo($par["desc"]);
                 $rights->addOption($option);
             }
             $key++;
         }
         $form->addItem($rights);
     }
     // Local policy only for containers
     if ($objDefinition->isContainer($this->getCurrentObject()->getType())) {
         $check = new ilCheckboxInputGui($this->lng->txt("rbac_role_rights_copy_change_existing"), 'existing');
         $check->setInfo($this->lng->txt('rbac_change_existing_objects_desc_new_role'));
         $form->addItem($check);
     }
     return $form;
 }
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng, $rbacreview, $ilUser;
     // name
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($lng->txt("name"), "name");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["name"] = $ti->getValue();
     // group
     $ti = new ilTextInputGUI($lng->txt("grp"), "group");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["group"] = $ti->getValue();
     // course
     $ti = new ilTextInputGUI($lng->txt("course"), "course");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["course"] = $ti->getValue();
     // passed tests
     include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
     $si = new ilCheckboxInputGUI($this->lng->txt("passed_only"), "passed_only");
     //		$si->setOptionTitle();
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["passedonly"] = $si->getValue();
 }
 /**
  * @return ilPropertyFormGUI
  */
 public function getClientSettingsForm()
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     $form = new ilPropertyFormGUI();
     $cb = new ilCheckboxInputGUI($lng->txt('chat_enabled'), 'chat_enabled');
     $form->addItem($cb);
     $cb = new ilCheckboxInputGUI($lng->txt('enable_osd'), 'enable_osd');
     $cb->setInfo($lng->txt('hint_osd'));
     $form->addItem($cb);
     $txt = new ilNumberInputGUI($lng->txt('osd_intervall'), 'osd_intervall');
     $txt->setMinValue(1);
     $txt->setRequired(true);
     $txt->setInfo($lng->txt('hint_osd_interval'));
     $cb->addSubItem($txt);
     $cb1 = new ilCheckboxInputGUI($lng->txt('play_invitation_sound'), 'play_invitation_sound');
     $cb1->setInfo($lng->txt('play_invitation_sound'));
     $cb->addSubItem($cb1);
     $cb = new ilCheckboxInputGUI($lng->txt('enable_smilies'), 'enable_smilies');
     $cb->setInfo($lng->txt('hint_enable_smilies'));
     $form->addItem($cb);
     $name = new ilTextInputGUI($lng->txt('instance_name'), 'name');
     $name->setRequired(true);
     $name->setValidationRegexp('/^[a-z0-9_-]+$/i');
     $name->setInfo($lng->txt('hint_unique_name'));
     $form->addItem($name);
     $url = new ilTextInputGUI($lng->txt('ilias_url'), 'url');
     $url->setRequired(true);
     $form->addItem($url);
     $user = new ilTextInputGUI($lng->txt('soap_user'), 'user');
     $user->setInfo($lng->txt('soap_user_hint'));
     $user->setRequired(true);
     $form->addItem($user);
     $password = new ilPasswordInputGUI($lng->txt('soap_user_password'), 'password');
     $password->setRequired(true);
     $form->addItem($password);
     return $form;
 }
 /**
  * Show provider form
  * @param string $a_mode [optional] add | edit
  * @return 
  */
 protected function initFormProvider($a_mode = 'edit')
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'provider'));
     $this->form->setTableWidth('75%');
     switch ($a_mode) {
         case 'edit':
             $this->form->setTitle($this->lng->txt('auth_openid_provider_edit'));
             $this->form->addCommandButton('updateProvider', $this->lng->txt('save'));
             $this->form->addCommandButton('provider', $this->lng->txt('cancel'));
             break;
         case 'add':
             $this->form->setTitle($this->lng->txt('auth_openid_provider_add'));
             $this->form->addCommandButton('createProvider', $this->lng->txt('btn_add'));
             $this->form->addCommandButton('provider', $this->lng->txt('cancel'));
             break;
     }
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $title->setRequired(true);
     $title->setMaxLength(128);
     $title->setSize(32);
     $title->setValue($this->provider->getName());
     $this->form->addItem($title);
     $url = new ilTextInputGUI($this->lng->txt('url'), 'url');
     $url->setValidationRegexp('/http.*%s.*/');
     $url->setRequired(true);
     $url->setMaxLength(255);
     $url->setSize(32);
     $url->setInfo($this->lng->txt('auth_openid_url_info'));
     $url->setValue($this->provider->getURL());
     $this->form->addItem($url);
 }