/**
  * Creates an output of the edit form for the question	
  * @access public
  */
 function editQuestion()
 {
     global $ilDB, $tpl;
     $plugin = $this->object->getPlugin();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("assJSMEQuestion");
     // Basiseingabefelder: title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     // points
     $points = new ilNumberInputGUI($plugin->txt("points"), "points");
     $points->setValue($this->object->getPoints());
     $points->setRequired(TRUE);
     $points->setSize(10);
     $points->setMinValue(0.0);
     $form->addItem($points);
     // optionString for the JSME-Applet
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $optionString = new ilTextInputGUI($plugin->txt("optionString"), "optionString");
     $optionString->setValue($this->object->getOptionString());
     $form->addItem($optionString);
     // JSME-Applet for sampleSolution
     include_once "./Services/Form/classes/class.ilCustomInputGUI.php";
     $sampleSolution = new ilCustomInputGUI($plugin->txt("sampleSolution"), "sampleSolution");
     $template = $this->getJsmeOutputTemplate("", $this->object->getOptionString(), $this->object->getSampleSolution());
     $sampleSolution->setHtml($template->get());
     $form->addItem($sampleSolution);
     $form->addCommandButton('save', $plugin->txt("save"));
     $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
 }
 /**
  * @param ilObjBibliographic $bibl_obj
  * @return void
  *
  */
 public function showDetails(ilObjBibliographic $bibl_obj)
 {
     global $tpl, $ilTabs, $ilCtrl, $lng;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget("back", $ilCtrl->getLinkTarget($this, 'showContent'));
     $form->setTitle($lng->txt('detail_view'));
     $entry = new ilBibliographicEntry($bibl_obj->getFiletype(), $_GET['entryId']);
     $attributes = $entry->getAttributes();
     //translate array key in order to sort by those keys
     foreach ($attributes as $key => $attribute) {
         //Check if there is a specific language entry
         if ($lng->exists($key)) {
             $strDescTranslated = $lng->txt($key);
         } else {
             $arrKey = explode("_", $key);
             $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]);
         }
         unset($attributes[$key]);
         $attributes[$strDescTranslated] = $attribute;
     }
     // sort attributes alphabetically by their array-key
     ksort($attributes, SORT_STRING);
     // render attributes to html
     foreach ($attributes as $key => $attribute) {
         $ci = new ilCustomInputGUI($key);
         $ci->setHtml($attribute);
         $form->addItem($ci);
     }
     // set content and title
     $tpl->setContent($form->getHTML());
     //Permanent Link
     $tpl->setPermanentLink("bibl", $bibl_obj->getRefId(), "_" . $_GET['entryId']);
 }
 public function addToForm()
 {
     global $lng;
     if ($this->getForm() instanceof ilPropertyFormGUI) {
         // :TODO: use DateDurationInputGUI ?!
         if (!(bool) $this->text_input) {
             $check = new ilCheckboxInputGUI($this->getTitle(), $this->addToElementId("tgl"));
             $check->setValue(1);
             $checked = false;
         } else {
             $check = new ilCustomInputGUI($this->getTitle());
         }
         $date_from = new ilDateTimeInputGUI($lng->txt('from'), $this->addToElementId("lower"));
         $date_from->setShowTime(true);
         $check->addSubItem($date_from);
         if ($this->getLowerADT()->getDate() && !$this->getLowerADT()->isNull()) {
             $date_from->setDate($this->getLowerADT()->getDate());
             $checked = true;
         }
         $date_until = new ilDateTimeInputGUI($lng->txt('until'), $this->addToElementId("upper"));
         $date_until->setShowTime(true);
         $check->addSubItem($date_until);
         if ($this->getUpperADT()->getDate() && !$this->getUpperADT()->isNull()) {
             $date_until->setDate($this->getUpperADT()->getDate());
             $checked = true;
         }
         if (!(bool) $this->text_input) {
             $check->setChecked($checked);
         } else {
             $date_from->setMode(ilDateTimeInputGUI::MODE_INPUT);
             $date_until->setMode(ilDateTimeInputGUI::MODE_INPUT);
         }
         $this->addToParentElement($check);
     } else {
         // see ilTable2GUI::addFilterItemByMetaType()
         include_once "./Services/Form/classes/class.ilCombinationInputGUI.php";
         include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php";
         $item = new ilCombinationInputGUI($this->getTitle(), $this->getElementId());
         $lower = new ilDateTimeInputGUI("", $this->addToElementId("lower"));
         $lower->setShowTime(true);
         $item->addCombinationItem("lower", $lower, $lng->txt("from"));
         if ($this->getLowerADT()->getDate() && !$this->getLowerADT()->isNull()) {
             $lower->setDate($this->getLowerADT()->getDate());
         }
         $upper = new ilDateTimeInputGUI("", $this->addToElementId("upper"));
         $upper->setShowTime(true);
         $item->addCombinationItem("upper", $upper, $lng->txt("to"));
         if ($this->getUpperADT()->getDate() && !$this->getUpperADT()->isNull()) {
             $upper->setDate($this->getUpperADT()->getDate());
         }
         $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING);
         $item->setMode(ilDateTimeInputGUI::MODE_INPUT);
         $this->addToParentElement($item);
     }
 }
 public function __construct($a_title, $a_postvar)
 {
     global $lng, $tpl, $ilUser;
     $this->lng = $lng;
     $this->lng->loadLanguageModule('dateplaner');
     $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
     $tpl->addJavascript("./Services/Calendar/js/recurrence_input.js");
     parent::__construct($a_title, $a_postvar);
 }
 /**
  * @param $value
  */
 public function setValueByArray($value)
 {
     parent::setValueByArray($value);
     include_once './Services/Tree/classes/class.ilPathGUI.php';
     $path = new ilPathGUI();
     $reference = $value[$this->getPostVar()];
     if ($reference) {
         $pathString = $path->getPath(ROOT_FOLDER_ID, $reference);
         $id = ilObject::_lookupObjId($reference);
         $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id));
         $this->hidden_input->setValue($reference);
     }
 }
 /**
  * Init form
  *
  * @return ilPropertyFormGUI
  */
 public function initForm()
 {
     global $lng, $ilCtrl;
     /** @var $ilCtrl ilCtrl */
     $ilCtrl = $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $item = new ilCustomInputGUI();
     $item->setHtml($lng->txt('dcl_file_format_description'));
     $item->setTitle("Info");
     $form->addItem($item);
     $file = new ilFileInputGUI($lng->txt("import_file"), "import_file");
     $file->setRequired(true);
     $form->addItem($file);
     $cb = new ilCheckboxInputGUI($lng->txt("dcl_simulate_import"), "simulate");
     $cb->setInfo($lng->txt("dcl_simulate_info"));
     $form->addItem($cb);
     $form->addCommandButton("importExcel", $lng->txt("save"));
     return $form;
 }
 /**
  * @param $question_id
  * @param $question_pool_id
  *
  * @return ilPropertyFormGUI
  */
 protected function buildAdjustQuestionForm($question_id, $question_pool_id)
 {
     require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("adjustment");
     /** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */
     $question = assQuestion::instantiateQuestionGUI($question_id);
     $form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>');
     $hidden_question_id = new ilHiddenInputGUI('q_id');
     $hidden_question_id->setValue($question_id);
     $form->addItem($hidden_question_id);
     $hidden_qpl_id = new ilHiddenInputGUI('qpl_id');
     $hidden_qpl_id->setValue($question_pool_id);
     $form->addItem($hidden_qpl_id);
     $this->populateScoringAdjustments($question, $form);
     $manscoring_section = new ilFormSectionHeaderGUI();
     $manscoring_section->setTitle($this->lng->txt('manscoring'));
     $form->addItem($manscoring_section);
     $manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring');
     $manscoring_preservation->setChecked(true);
     $manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info'));
     $form->addItem($manscoring_preservation);
     $form->addCommandButton("savescoringfortest", $this->lng->txt("save"));
     $participants = $this->object->getParticipants();
     $active_ids = array_keys($participants);
     $results = array();
     foreach ($active_ids as $active_id) {
         $passes[] = $this->object->_getPass($active_id);
         foreach ($passes as $key => $pass) {
             for ($i = 0; $i <= $pass; $i++) {
                 $results[] = $question->object->getSolutionValues($active_id, $i);
             }
         }
     }
     $relevant_answers = array();
     foreach ($results as $result) {
         foreach ($result as $answer) {
             if ($answer['question_fi'] == $question->object->getId()) {
                 $relevant_answers[] = $answer;
             }
         }
     }
     $answers_view = $question->getAggregatedAnswersView($relevant_answers);
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once 'Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initPanel();
     ilYuiUtil::initOverlay();
     $this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js');
     $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
     $container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test');
     $container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ');
     $container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close'))));
     $container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview'));
     $container->setVariable('TXT_CLOSE', $this->lng->txt('close'));
     $container->setVariable('ANSWER_OVERVIEW', $answers_view);
     $custom_input = new ilCustomInputGUI('', 'aggr_usr_answ');
     $custom_input->setHtml($container->get());
     $form->addItem($custom_input);
     return $form;
 }
 /**
  * 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;
 }
 protected static function parseFieldDefinition($a_type, ilPropertyFormGUI $a_form, ilObjectGUI $a_gui, $a_data)
 {
     global $lng, $rbacsystem, $ilCtrl;
     if (!is_array($a_data)) {
         return;
     }
     foreach ($a_data as $area_caption => $fields) {
         if (is_numeric($area_caption) || !trim($area_caption)) {
             $area_caption = "obj_" . $a_type;
         }
         if (is_array($fields) && sizeof($fields) == 2) {
             $cmd = $fields[0];
             $fields = $fields[1];
             if (is_array($fields)) {
                 $ftpl = new ilTemplate("tpl.external_settings.html", true, true, "Services/Administration");
                 $stack = array();
                 foreach ($fields as $field_caption_id => $field_value) {
                     $field_type = $subitems = null;
                     if (is_array($field_value)) {
                         $field_type = $field_value[1];
                         $subitems = $field_value[2];
                         $field_value = $field_value[0];
                     }
                     if (self::parseFieldValue($field_type, $field_value)) {
                         $ftpl->setCurrentBlock("value_bl");
                         $ftpl->setVariable("VALUE", $field_value);
                         $ftpl->parseCurrentBlock();
                     }
                     if (is_array($subitems)) {
                         $ftpl->setCurrentBlock("subitem_bl");
                         foreach ($subitems as $sub_caption_id => $sub_value) {
                             $sub_type = null;
                             if (is_array($sub_value)) {
                                 $sub_type = $sub_value[1];
                                 $sub_value = $sub_value[0];
                             }
                             self::parseFieldValue($sub_type, $sub_value);
                             $ftpl->setVariable("SUBKEY", $lng->txt($sub_caption_id));
                             $ftpl->setVariable("SUBVALUE", $sub_value);
                             $ftpl->parseCurrentBlock();
                         }
                     }
                     $ftpl->setCurrentBlock("row_bl");
                     $ftpl->setVariable("KEY", $lng->txt($field_caption_id));
                     $ftpl->parseCurrentBlock();
                 }
                 if ($rbacsystem->checkAccess("visible,read", $a_gui->object->getRefId())) {
                     if (!$cmd) {
                         $cmd = "view";
                     }
                     $ilCtrl->setParameter($a_gui, "ref_id", $a_gui->object->getRefId());
                     $ftpl->setCurrentBlock("edit_bl");
                     $ftpl->setVariable("URL_EDIT", $ilCtrl->getLinkTargetByClass(array("ilAdministrationGUI", get_class($a_gui)), $cmd));
                     $ftpl->setVariable("TXT_EDIT", $lng->txt("adm_external_setting_edit"));
                     $ftpl->parseCurrentBlock();
                 }
                 $ext = new ilCustomInputGUI($lng->txt($area_caption));
                 $ext->setHtml($ftpl->get());
                 $a_form->addItem($ext);
             }
         }
     }
 }
 /**
  * Detail view of a mail
  */
 public function showMail()
 {
     /**
      * @var $ilUser ilObjUser
      * @var $ilToolbar ilToolbarGUI
      * @var $ilTabs ilTabsGUI
      */
     global $ilUser, $ilToolbar, $ilTabs;
     if ($_SESSION['mail_id']) {
         $_GET['mail_id'] = $_SESSION['mail_id'];
         $_SESSION['mail_id'] = '';
     }
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($this->lng->txt('back_to_folder'), $this->ctrl->getFormAction($this, 'showFolder'));
     $this->umail->markRead(array((int) $_GET['mail_id']));
     $mailData = $this->umail->getMail((int) $_GET['mail_id']);
     $this->tpl->setTitle($this->lng->txt('mail_mails_of'));
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setPreventDoubleSubmission(false);
     $form->setTableWidth('100%');
     $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
     $form->setFormAction($this->ctrl->getFormAction($this, 'showMail'));
     $this->ctrl->clearParameters($this);
     $form->setTitle($this->lng->txt('mail_mails_of'));
     if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) {
         $this->tpl->setVariable('FORM_TARGET', ilFrameTargetInfo::_getFrame('MainContent'));
     }
     include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
     /**
      * @var $sender ilObjUser
      */
     $sender = ilObjectFactory::getInstanceByObjId($mailData['sender_id'], false);
     if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) {
         $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']);
         $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'reply');
         $this->ctrl->clearParametersByClass('iliasmailformgui');
         $ilToolbar->addButton($this->lng->txt('reply'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::REPLY);
         $this->ctrl->clearParameters($this);
     }
     $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']);
     $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'forward');
     $this->ctrl->clearParametersByClass('iliasmailformgui');
     $ilToolbar->addButton($this->lng->txt('forward'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::FORWARD_MAIL);
     $this->ctrl->clearParameters($this);
     $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
     $ilToolbar->addButton($this->lng->txt('print'), $this->ctrl->getLinkTarget($this, 'printMail'), '_blank');
     $this->ctrl->clearParameters($this);
     $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
     $this->ctrl->setParameter($this, 'selected_cmd', 'deleteMails');
     $ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this), '', ilAccessKey::DELETE);
     $this->ctrl->clearParameters($this);
     if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) {
         $linked_fullname = $sender->getPublicName();
         $picture = ilUtil::img($sender->getPersonalPicturePath('xsmall'), $sender->getPublicName());
         $add_to_addb_button = '';
         if (in_array(ilObjUser::_lookupPref($sender->getId(), 'public_profile'), array('y', 'g'))) {
             $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
             $this->ctrl->setParameter($this, 'user', $sender->getId());
             $linked_fullname = '<br /><a href="' . $this->ctrl->getLinkTarget($this, 'showUser') . '" title="' . $linked_fullname . '">' . $linked_fullname . '</a>';
             $this->ctrl->clearParameters($this);
         }
         if ($sender->getId() != $ilUser->getId()) {
             require_once 'Services/Contact/classes/class.ilAddressbook.php';
             $abook = new ilAddressbook($ilUser->getId());
             if ($abook->checkEntryByLogin($sender->getLogin()) == 0) {
                 $tplbtn = new ilTemplate('tpl.buttons.html', true, true);
                 $tplbtn->setCurrentBlock('btn_cell');
                 $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
                 $tplbtn->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'add'));
                 $this->ctrl->clearParameters($this);
                 $tplbtn->setVariable('BTN_TXT', $this->lng->txt('mail_add_to_addressbook'));
                 $tplbtn->parseCurrentBlock();
                 $add_to_addb_button = '<br />' . $tplbtn->get();
             }
         }
         $from = new ilCustomInputGUI($this->lng->txt('from'));
         $from->setHtml($picture . ' ' . $linked_fullname . $add_to_addb_button);
         $form->addItem($from);
     } else {
         if (!$sender || !$sender->getId()) {
             $from = new ilCustomInputGUI($this->lng->txt('from'));
             $from->setHtml($mailData['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
             $form->addItem($from);
         } else {
             $from = new ilCustomInputGUI($this->lng->txt('from'));
             $from->setHtml(ilUtil::img(ilUtil::getImagePath('HeaderIconAvatar.svg'), ilMail::_getIliasMailerName()) . '<br />' . ilMail::_getIliasMailerName());
             $form->addItem($from);
         }
     }
     $to = new ilCustomInputGUI($this->lng->txt('mail_to'));
     $to->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_to']), false));
     $form->addItem($to);
     if ($mailData['rcp_cc']) {
         $cc = new ilCustomInputGUI($this->lng->txt('cc'));
         $cc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_cc']), false));
         $form->addItem($cc);
     }
     if ($mailData['rcp_bcc']) {
         $bcc = new ilCustomInputGUI($this->lng->txt('bc'));
         $bcc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_bcc']), false));
         $form->addItem($bcc);
     }
     $subject = new ilCustomInputGUI($this->lng->txt('subject'));
     $subject->setHtml(ilUtil::htmlencodePlainString($mailData['m_subject'], true));
     $form->addItem($subject);
     $date = new ilCustomInputGUI($this->lng->txt('date'));
     $date->setHtml(ilDatePresentation::formatDate(new ilDateTime($mailData['send_time'], IL_CAL_DATETIME)));
     $form->addItem($date);
     $message = new ilCustomInputGUI($this->lng->txt('message'));
     $message->setHtml(ilUtil::htmlencodePlainString($mailData['m_message'], true));
     $form->addItem($message);
     if ($mailData['attachments']) {
         $att = new ilCustomInputGUI($this->lng->txt('attachments'));
         $radiog = new ilRadioGroupInputGUI('', 'filename');
         foreach ($mailData['attachments'] as $file) {
             $radiog->addOption(new ilRadioOption($file, md5($file)));
         }
         $att->setHtml($radiog->render());
         $form->addCommandButton('deliverFile', $this->lng->txt('download'));
         $form->addItem($att);
     }
     $isTrashFolder = false;
     if ($this->mbox->getTrashFolder() == $_GET['mobj_id']) {
         $isTrashFolder = true;
     }
     $current_folder_data = $this->mbox->getFolderData((int) $_GET['mobj_id']);
     $selectOptions = array();
     $actions = $this->mbox->getActions((int) $_GET["mobj_id"]);
     foreach ($actions as $key => $action) {
         if ($key == 'moveMails') {
             $folders = $this->mbox->getSubFolders();
             foreach ($folders as $folder) {
                 if (($folder["type"] != 'trash' || !$isTrashFolder) && $folder['obj_id'] != $current_folder_data['obj_id']) {
                     $optionText = '';
                     if ($folder['type'] != 'user_folder') {
                         $optionText = $action . ' ' . $this->lng->txt('mail_' . $folder['title']) . ($folder['type'] == 'trash' ? ' (' . $this->lng->txt('delete') . ')' : '');
                     } else {
                         $optionText = $action . ' ' . $folder['title'];
                     }
                     $selectOptions[$folder['obj_id']] = $optionText;
                 }
             }
         }
     }
     if ($current_folder_data['type'] == 'user_folder') {
         $txt_folder = $current_folder_data['title'];
     } else {
         $txt_folder = $this->lng->txt('mail_' . $current_folder_data['title']);
     }
     $ilToolbar->addSeparator();
     $ilToolbar->addText(sprintf($this->lng->txt('current_folder'), $txt_folder));
     if (is_array($selectOptions) && count($selectOptions)) {
         include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
         $actions = new ilSelectInputGUI('', 'selected_cmd');
         $actions->setOptions($selectOptions);
         $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showMail'));
         $ilToolbar->addInputItem($actions);
         $ilToolbar->addFormButton($this->lng->txt('submit'), 'changeFolder');
     }
     // Navigation
     $prevMail = $this->umail->getPreviousMail((int) $_GET['mail_id']);
     $nextMail = $this->umail->getNextMail((int) $_GET['mail_id']);
     if (is_array($prevMail) || is_array($nextMail)) {
         $ilToolbar->addSeparator();
         if ($prevMail['mail_id']) {
             $this->ctrl->setParameter($this, 'mail_id', $prevMail['mail_id']);
             $ilToolbar->addButton($this->lng->txt('previous'), $this->ctrl->getLinkTarget($this, 'showMail'));
             $this->ctrl->clearParameters($this);
         }
         if ($nextMail['mail_id']) {
             $this->ctrl->setParameter($this, 'mail_id', $nextMail['mail_id']);
             $ilToolbar->addButton($this->lng->txt('next'), $this->ctrl->getLinkTarget($this, 'showMail'));
             $this->ctrl->clearParameters($this);
         }
     }
     $this->tpl->setContent($form->getHTML());
     $this->tpl->show();
 }
 public function getFormElement($a_query, $a_field_name)
 {
     include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
     $a_post_name = 'query[' . $a_field_name . ']';
     switch ($a_field_name) {
         case 'general_offline':
             $offline_options = array('0' => $this->lng->txt('search_any'), self::ONLINE_QUERY => $this->lng->txt('search_option_online'), self::OFFLINE_QUERY => $this->lng->txt('search_option_offline'));
             $offline = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $offline->setOptions($offline_options);
             $offline->setValue($a_query['general_offline']);
             return $offline;
         case 'lom_content':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_content']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
             // General
         // General
         case 'lom_language':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_language']);
             $select->setOptions(ilMDUtilSelect::_getLanguageSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_keyword':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_keyword']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         case 'lom_coverage':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_coverage']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         case 'lom_structure':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_structure']);
             $select->setOptions(ilMDUtilSelect::_getStructureSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
             // Lifecycle
         // Lifecycle
         case 'lom_status':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_status']);
             $select->setOptions(ilMDUtilSelect::_getStatusSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_version':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_version']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         case 'lom_contribute':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], 'query[' . 'lom_role' . ']');
             $select->setValue($a_query['lom_role']);
             $select->setOptions(ilMDUtilSelect::_getRoleSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             $text = new ilTextInputGUI($this->lng->txt('meta_entry'), 'query[' . 'lom_role_entry' . ']');
             $text->setValue($a_query['lom_role_entry']);
             $text->setSize(30);
             $text->setMaxLength(255);
             $select->addSubItem($text);
             return $select;
             // Technical
         // Technical
         case 'lom_format':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_format']);
             $select->setOptions(ilMDUtilSelect::_getFormatSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_operating_system':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_operating_system']);
             $select->setOptions(ilMDUtilSelect::_getOperatingSystemSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_browser':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_browser']);
             $select->setOptions(ilMDUtilSelect::_getBrowserSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
             // Education
         // Education
         case 'lom_interactivity':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_interactivity']);
             $select->setOptions(ilMDUtilSelect::_getInteractivityTypeSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_resource':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_resource']);
             $select->setOptions(ilMDUtilSelect::_getLearningResourceTypeSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_level':
             $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
             $html = $this->getRangeSelect($this->lng->txt('from'), ilMDUtilSelect::_getInteractivityLevelSelect($a_query['lom_level_start'], 'query[' . 'lom_level_start' . ']', array(0 => $this->lng->txt('search_any'))), $this->lng->txt('until'), ilMDUtilSelect::_getInteractivityLevelSelect($a_query['lom_level_end'], 'query[' . 'lom_level_end' . ']', array(0 => $this->lng->txt('search_any'))));
             $range->setHTML($html);
             return $range;
         case 'lom_density':
             $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
             $html = $this->getRangeSelect($this->lng->txt('from'), ilMDUtilSelect::_getSemanticDensitySelect($a_query['lom_density_start'], 'query[' . 'lom_density_start' . ']', array(0 => $this->lng->txt('search_any'))), $this->lng->txt('until'), ilMDUtilSelect::_getSemanticDensitySelect($a_query['lom_density_end'], 'query[' . 'lom_density_end' . ']', array(0 => $this->lng->txt('search_any'))));
             $range->setHTML($html);
             return $range;
         case 'lom_user_role':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_user_role']);
             $select->setOptions(ilMDUtilSelect::_getIntendedEndUserRoleSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_context':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_context']);
             $select->setOptions(ilMDUtilSelect::_getContextSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_difficulty':
             $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
             $html = $this->getRangeSelect($this->lng->txt('from'), ilMDUtilSelect::_getDifficultySelect($a_query['lom_difficulty_start'], 'query[' . 'lom_difficulty_start' . ']', array(0 => $this->lng->txt('search_any'))), $this->lng->txt('until'), ilMDUtilSelect::_getDifficultySelect($a_query['lom_difficulty_end'], 'query[' . 'lom_difficulty_end' . ']', array(0 => $this->lng->txt('search_any'))));
             $range->setHTML($html);
             return $range;
             // Rights
         // Rights
         case 'lom_costs':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_costs']);
             $select->setOptions(ilMDUtilSelect::_getCostsSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_copyright':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_copyright']);
             $select->setOptions(ilMDUtilSelect::_getCopyrightAndOtherRestrictionsSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
             // Classification
         // Classification
         case 'lom_purpose':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_purpose']);
             $select->setOptions(ilMDUtilSelect::_getPurposeSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_taxon':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_taxon']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         default:
             if (substr($a_field_name, 0, 3) != 'adv') {
                 break;
             }
             // Advanced meta data
             $field_id = substr($a_field_name, 4);
             include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
             $field = ilAdvancedMDFieldDefinition::_getInstanceByFieldId($field_id);
             switch ($field->getFieldType()) {
                 case ilAdvancedMDFieldDefinition::TYPE_TEXT:
                     $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
                     $text->setSubmitFormOnEnter(true);
                     $text->setValue($a_query[$a_field_name]);
                     $text->setSize(30);
                     $text->setMaxLength(255);
                     return $text;
                 case ilAdvancedMDFieldDefinition::TYPE_SELECT:
                     $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
                     $select->setValue($a_query[$a_field_name]);
                     $select->setOptions($field->getFieldValuesForSearch());
                     return $select;
                 case ilAdvancedMDFieldDefinition::TYPE_DATE:
                 case ilAdvancedMDFieldDefinition::TYPE_DATETIME:
                     $check = new ilCheckboxInputGUI($this->active_fields[$a_field_name], $a_post_name);
                     $check->setValue(1);
                     $check->setChecked($a_query[$a_field_name]);
                     $time = new ilDateTimeInputGUI($this->lng->txt('from'), $a_field_name . '_start');
                     $time->setShowTime($field->getFieldType() != ilAdvancedMDFieldDefinition::TYPE_DATE);
                     $time->setDate(new ilDateTime(mktime(8, 0, 0, date('m'), date('d'), date('Y')), IL_CAL_UNIX));
                     $check->addSubItem($time);
                     $time = new ilDateTimeInputGUI($this->lng->txt('until'), $a_field_name . '_end');
                     $time->setShowTime($field->getFieldType() != ilAdvancedMDFieldDefinition::TYPE_DATE);
                     $time->setDate(new ilDateTime(mktime(16, 0, 0, date('m'), date('d'), date('Y')), IL_CAL_UNIX));
                     $check->addSubItem($time);
                     return $check;
             }
     }
     return null;
 }
 /**
  * add type specific input fields to a form  
  * 
  * @param object	form, property or radio option
  * @param array		(assoc) input values
  * @param string	configuration level ("type" or "object")
  * @param string	parent field value
  * @param string	parent option value
  * @param int		maximum recursion depth
  */
 function addFormElements($a_object, $a_values = array(), $a_level = "object", $a_parentfield = '', $a_parentvalue = '', $a_maxdepth = "3")
 {
     // recursion end
     if ($a_maxdepth == 0) {
         return;
     }
     foreach ($this->getInputFields($a_level, $a_parentfield, $a_parentvalue) as $field) {
         $value = $a_values['field_' . $field->field_name];
         $value = $value ? $value : $field->default;
         switch ($field->field_type) {
             case self::FIELDTYPE_HEADER:
                 $item = new ilFormSectionHeaderGUI();
                 $item->setTitle($field->title);
                 break;
             case self::FIELDTYPE_DESCRIPTION:
                 $item = new ilCustomInputGUI($field->title);
                 $item->setHtml(nl2br($field->description));
                 break;
             case self::FIELDTYPE_TEXT:
                 $item = new ilTextInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setRequired($field->required ? true : false);
                 $item->setSize($field->size);
                 $item->setValue($value);
                 break;
             case self::FIELDTYPE_TEXTAREA:
                 $item = new ilTextAreaInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setRequired($field->required ? true : false);
                 $item->setUseRte($field->richtext ? true : false);
                 $item->setRows($field->rows);
                 $item->setCols($field->cols);
                 $item->setValue($value);
                 break;
             case self::FIELDTYPE_PASSWORD:
                 $item = new ilPasswordInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setRequired($field->required ? true : false);
                 $item->setValue($value);
                 break;
             case self::FIELDTYPE_CHECKBOX:
                 $item = new ilCheckboxInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 if ($value) {
                     $item->setChecked(true);
                 }
                 break;
             case self::FIELDTYPE_RADIO:
                 $item = new ilRadioGroupInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setValue($value);
                 foreach ($field->options as $option) {
                     $ropt = new ilRadioOption($option->title, $option->value);
                     $ropt->setInfo($option->description);
                     // add the sub items to the option
                     $item->addOption($ropt);
                     $this->addFormElements($ropt, $a_values, $a_level, $field->field_name, $option->value, $a_maxdepth - 1);
                 }
                 break;
             default:
                 continue 2;
         }
         // add the item to the form or to the parent item
         if (is_a($a_object, 'ilPropertyFormGUI')) {
             $a_object->addItem($item);
         } else {
             $a_object->addSubItem($item);
         }
         // add the sub items to the item
         if (is_a($item, 'ilSubEnabledFormPropertyGUI')) {
             $this->addFormElements($item, $a_level, $a_values, $field->field_name, '', $a_maxdepth - 1);
         }
     }
 }
 private function buildManScoringParticipantForm($questionGuiList, $activeId, $pass, $initValues = false)
 {
     global $ilCtrl, $lng;
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once 'Services/Form/classes/class.ilFormSectionHeaderGUI.php';
     require_once 'Services/Form/classes/class.ilCustomInputGUI.php';
     require_once 'Services/Form/classes/class.ilCheckboxInputGUI.php';
     require_once 'Services/Form/classes/class.ilTextInputGUI.php';
     require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
     $ilCtrl->setParameter($this, 'active_id', $activeId);
     $ilCtrl->setParameter($this, 'pass', $pass);
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle(sprintf($lng->txt('manscoring_results_pass'), $pass + 1));
     $form->setTableWidth('100%');
     foreach ($questionGuiList as $questionId => $questionGUI) {
         $questionHeader = sprintf($lng->txt('tst_manscoring_question_section_header'), $questionGUI->object->getTitle());
         $questionSolution = $questionGUI->getSolutionOutput($activeId, $pass, false, false, true, false, false, true);
         $bestSolution = $questionGUI->object->getSuggestedSolutionOutput();
         $sect = new ilFormSectionHeaderGUI();
         $sect->setTitle($questionHeader . ' [' . $this->lng->txt('question_id_short') . ': ' . $questionGUI->object->getId() . ']');
         $form->addItem($sect);
         $cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_question_and_user_solution'));
         $cust->setHtml($questionSolution);
         $form->addItem($cust);
         $text = new ilTextInputGUI($lng->txt('tst_change_points_for_question'), "question__{$questionId}__points");
         if ($initValues) {
             $text->setValue(assQuestion::_getReachedPoints($activeId, $questionId, $pass));
         }
         $form->addItem($text);
         $nonedit = new ilNonEditableValueGUI($lng->txt('tst_manscoring_input_max_points_for_question'), "question__{$questionId}__maxpoints");
         if ($initValues) {
             $nonedit->setValue(assQuestion::_getMaximumPoints($questionId));
         }
         $form->addItem($nonedit);
         $area = new ilTextAreaInputGUI($lng->txt('set_manual_feedback'), "question__{$questionId}__feedback");
         $area->setUseRTE(true);
         if ($initValues) {
             $area->setValue($this->object->getManualFeedback($activeId, $questionId, $pass));
         }
         $form->addItem($area);
         if (strlen(trim($bestSolution))) {
             $cust = new ilCustomInputGUI($lng->txt('tst_show_solution_suggested'));
             $cust->setHtml($bestSolution);
             $form->addItem($cust);
         }
     }
     $sect = new ilFormSectionHeaderGUI();
     $sect->setTitle($lng->txt('tst_participant'));
     $form->addItem($sect);
     $check = new ilCheckboxInputGUI($lng->txt('set_manscoring_done'), 'manscoring_done');
     if ($initValues && ilTestService::isManScoringDone($activeId)) {
         $check->setChecked(true);
     }
     $form->addItem($check);
     $check = new ilCheckboxInputGUI($lng->txt('tst_manscoring_user_notification'), 'manscoring_notify');
     $form->addItem($check);
     $form->addCommandButton('saveManScoringParticipantScreen', $lng->txt('save'));
     $form->addCommandButton('saveReturnManScoringParticipantScreen', $lng->txt('save_return'));
     $form->addCommandButton('saveNextManScoringParticipantScreen', $lng->txt('save_and_next'));
     return $form;
 }
 protected function __initForm()
 {
     global $lng, $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     // code handling
     if ($this->code_enabled) {
         include_once 'Services/Registration/classes/class.ilRegistrationCode.php';
         $code = new ilTextInputGUI($lng->txt("registration_code"), "usr_registration_code");
         $code->setSize(40);
         $code->setMaxLength(ilRegistrationCode::CODE_LENGTH);
         if ((bool) $this->registration_settings->registrationCodeRequired()) {
             $code->setRequired(true);
             $code->setInfo($lng->txt("registration_code_required_info"));
         } else {
             $code->setInfo($lng->txt("registration_code_optional_info"));
         }
         $this->form->addItem($code);
     }
     // user defined fields
     $user_defined_data = $ilUser->getUserDefinedData();
     include_once './Services/User/classes/class.ilUserDefinedFields.php';
     $user_defined_fields =& ilUserDefinedFields::_getInstance();
     $custom_fields = array();
     foreach ($user_defined_fields->getRegistrationDefinitions() as $field_id => $definition) {
         if ($definition['field_type'] == UDF_TYPE_TEXT) {
             $custom_fields["udf_" . $definition['field_id']] = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
             $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
             $custom_fields["udf_" . $definition['field_id']]->setMaxLength(255);
             $custom_fields["udf_" . $definition['field_id']]->setSize(40);
         } else {
             if ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
                 $custom_fields["udf_" . $definition['field_id']] = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
                 $custom_fields["udf_" . $definition['field_id']]->setUseRte(true);
             } else {
                 $custom_fields["udf_" . $definition['field_id']] = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
                 $custom_fields["udf_" . $definition['field_id']]->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
             }
         }
         if ($definition['required']) {
             $custom_fields["udf_" . $definition['field_id']]->setRequired(true);
         }
     }
     // standard fields
     include_once "./Services/User/classes/class.ilUserProfile.php";
     $up = new ilUserProfile();
     $up->setMode(ilUserProfile::MODE_REGISTRATION);
     $up->skipGroup("preferences");
     // add fields to form
     $up->addStandardFieldsToForm($this->form, NULL, $custom_fields);
     unset($custom_fields);
     // set language selection to current display language
     $flang = $this->form->getItemByPostVar("usr_language");
     if ($flang) {
         $flang->setValue($lng->getLangKey());
     }
     // add information to role selection (if not hidden)
     if ($this->code_enabled) {
         $role = $this->form->getItemByPostVar("usr_roles");
         if ($role && $role->getType() == "select") {
             $role->setInfo($lng->txt("registration_code_role_info"));
         }
     }
     // user agreement
     $field = new ilFormSectionHeaderGUI();
     $field->setTitle($lng->txt("usr_agreement"));
     $this->form->addItem($field);
     $field = new ilCustomInputGUI();
     $field->setHTML('<div id="agreement">' . ilUserAgreement::_getText() . '</div>');
     $this->form->addItem($field);
     $field = new ilCheckboxInputGUI($lng->txt("accept_usr_agreement"), "usr_agreement");
     $field->setRequired(true);
     $field->setValue(1);
     $this->form->addItem($field);
     $this->form->addCommandButton("saveForm", $lng->txt("register"));
 }
 /**
  * add the properties of a question part to the form
  *
  * @param object    form object to extend
  * @param object    question part object
  * @param integer    counter of the question part
  */
 private function initPartProperties($form, $part_obj = null, $counter = "1")
 {
     // Use a dummy part object for a new booking definition
     if (!isset($part_obj)) {
         $part_obj = new assAccountingQuestionPart($this->object);
     }
     // Part identifier (is 0 for a new part)
     $item = new ilHiddenInputGUI("parts[]");
     $item->setValue($part_obj->getPartId());
     $form->addItem($item);
     // Title
     $item = new ilFormSectionHeaderGUI();
     $item->setTitle($this->plugin->txt('accounting_table') . ' ' . $counter);
     $form->addItem($item);
     // Position
     $item = new ilNumberInputGUI($this->plugin->txt('position'), 'position_' . $part_obj->getPartId());
     $item->setSize(2);
     $item->setDecimals(1);
     $item->SetInfo($this->plugin->txt('position_info'));
     if ($part_obj->getPartId()) {
         $item->setValue(sprintf("%01.1f", $part_obj->getPosition()));
     }
     $form->addItem($item);
     // Text
     $item = new ilTextAreaInputGUI($this->plugin->txt("question_part"), 'text_' . $part_obj->getPartId());
     $item->setValue($this->object->prepareTextareaOutput($part_obj->getText()));
     $item->setRows(10);
     $item->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $item->setUseRte(TRUE);
         include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
         $item->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
         $item->addPlugin("latex");
         $item->addButton("latex");
         $item->addButton("pastelatex");
         $item->setRTESupport($this->object->getId(), "qpl", "assessment");
     } else {
         $item->setRteTags(self::getSelfAssessmentTags());
         $item->setUseTagsForRteOnly(false);
     }
     $form->addItem($item);
     // Booking XML definition
     $item = new ilCustomInputGUI($this->plugin->txt('booking_xml'));
     $item->setInfo($this->plugin->txt('booking_xml_info'));
     $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_edit_xml.html');
     $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($part_obj->getBookingXML()));
     $tpl->setVariable("NAME", 'booking_xml_' . $part_obj->getPartId());
     $item->setHTML($tpl->get());
     // Booking file
     $subitem = new ilFileInputGUI($this->plugin->txt('booking_file'), "booking_file_" . $part_obj->getPartId());
     $subitem->setSuffixes(array('xml'));
     $item->addSubItem($subitem);
     // Download button
     if (strlen($part_obj->getBookingXML())) {
         $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html');
         $this->ctrl->setParameter($this, 'xmltype', 'booking');
         $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId());
         $tpl->setCurrentBlock('button');
         $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'downloadXml'));
         $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('download_booking_xml'));
         $tpl->ParseCurrentBlock();
         $subitem = new ilcustomInputGUI('');
         $subitem->setHTML($tpl->get());
         $item->addSubItem($subitem);
     }
     $form->addItem($item);
     // Delete Button
     if ($part_obj->getPartId()) {
         $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html');
         $tpl->setCurrentBlock('button');
         $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId());
         $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'deletePart'));
         $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('delete_accounting_table'));
         $tpl->ParseCurrentBlock();
         $item = new ilcustomInputGUI();
         $item->setHTML($tpl->get());
         $form->addItem($item);
     }
 }
 protected function addFieldsToEditForm(ilPropertyFormGUI $a_form)
 {
     // subtype
     $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
     $subtype->setRequired(false);
     $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
     foreach ($subtypes as $idx => $st) {
         $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
     }
     $a_form->addItem($subtype);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_appearance"));
     $a_form->addItem($header);
     // column separators
     $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
     $column_separators->setValue(1);
     $column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
     $column_separators->setRequired(false);
     $a_form->addItem($column_separators);
     // row separators
     $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
     $row_separators->setValue(1);
     $row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
     $row_separators->setRequired(false);
     $a_form->addItem($row_separators);
     // neutral column separators
     $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
     $neutral_column_separator->setValue(1);
     $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
     $neutral_column_separator->setRequired(false);
     $a_form->addItem($neutral_column_separator);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_columns"));
     $a_form->addItem($header);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $columns = new ilCategoryWizardInputGUI("", "columns");
     $columns->setRequired(false);
     $columns->setAllowMove(true);
     $columns->setShowWizard(true);
     $columns->setShowNeutralCategory(true);
     $columns->setDisabledScale(false);
     $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
     $columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
     $columns->setShowSavePhrase(true);
     $a_form->addItem($columns);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_column_settings"));
     $a_form->addItem($header);
     // bipolar adjectives
     $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
     $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
     // left pole
     $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
     $bipolar1->setRequired(false);
     $bipolar->addSubItem($bipolar1);
     // right pole
     $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
     $bipolar2->setRequired(false);
     $bipolar->addSubItem($bipolar2);
     $a_form->addItem($bipolar);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_rows"));
     $a_form->addItem($header);
     // matrix rows
     include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
     $rows = new ilMatrixRowWizardInputGUI("", "rows");
     $rows->setRequired(false);
     $rows->setAllowMove(true);
     $rows->setLabelText($this->lng->txt('label'));
     $rows->setUseOtherAnswer(true);
     $a_form->addItem($rows);
     // values
     $subtype->setValue($this->object->getSubtype());
     $column_separators->setChecked($this->object->getColumnSeparators());
     $row_separators->setChecked($this->object->getRowSeparators());
     $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
     if (!$this->object->getColumnCount()) {
         $this->object->columns->addCategory("");
     }
     $columns->setValues($this->object->getColumns());
     $bipolar1->setValue($this->object->getBipolarAdjective(0));
     $bipolar2->setValue($this->object->getBipolarAdjective(1));
     if ($this->object->getRowCount() == 0) {
         $this->object->getRows()->addCategory("");
     }
     $rows->setValues($this->object->getRows());
 }
 /**
  * Init public profile form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initPublicProfileForm()
 {
     global $lng, $ilUser, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setTitle($lng->txt("public_profile"));
     $this->form->setDescription($lng->txt("user_public_profile_info"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     $portfolio_id = $this->getProfilePortfolio();
     if (!$portfolio_id) {
         // Activate public profile
         $radg = new ilRadioGroupInputGUI($lng->txt("user_activate_public_profile"), "public_profile");
         $info = $this->lng->txt("user_activate_public_profile_info");
         $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g")) ? $ilUser->prefs["public_profile"] : "n";
         if (!$ilSetting->get('enable_global_profiles') && $pub_prof == "g") {
             $pub_prof = "y";
         }
         $radg->setValue($pub_prof);
         $op1 = new ilRadioOption($lng->txt("usr_public_profile_disabled"), "n", $lng->txt("usr_public_profile_disabled_info"));
         $radg->addOption($op1);
         $op2 = new ilRadioOption($lng->txt("usr_public_profile_logged_in"), "y");
         $radg->addOption($op2);
         if ($ilSetting->get('enable_global_profiles')) {
             $op3 = new ilRadioOption($lng->txt("usr_public_profile_global"), "g");
             $radg->addOption($op3);
         }
         $this->form->addItem($radg);
         // #11773
         if ($ilSetting->get('user_portfolios')) {
             // #10826
             $prtf = "<br />" . $lng->txt("user_profile_portfolio");
             $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio\">&raquo; " . $lng->txt("user_portfolios") . "</a>";
             $info .= $prtf;
         }
         $radg->setInfo($info);
     } else {
         $prtf = $lng->txt("user_profile_portfolio_selected");
         $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&prt_id=" . $portfolio_id . "\">&raquo; " . $lng->txt("portfolio") . "</a>";
         $info = new ilCustomInputGUI($lng->txt("user_activate_public_profile"));
         $info->setHTML($prtf);
         $this->form->addItem($info);
     }
     $this->showPublicProfileFields($this->form, $ilUser->prefs);
     $this->form->addCommandButton("savePublicProfile", $lng->txt("save"));
 }
 /**
  * Init the form to add or edit a type
  * 
  * @param	string		xml data of input		
  */
 private function initFormDefinition($a_xml = null)
 {
     global $lng, $ilCtrl;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     if (!isset($a_xml)) {
         $a_xml = $this->type->getXML();
     }
     $form = new ilPropertyFormGUI();
     $form->setId('edit_xml');
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($this->txt('type_definition'));
     $item = new ilCustomInputGUI('');
     $tpl = new ilTemplate('tpl.edit_xml.html', true, true, "Customizing/global/plugins/Services/Repository/RepositoryObject/ExternalContent/");
     $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($a_xml));
     $item->setHTML($tpl->get());
     $item->setInfo($this->txt('type_definition_info'));
     $form->addItem($item);
     $form->addCommandButton('submitFormDefinition', $lng->txt('save'));
     $this->form = $form;
 }
 /**
  * Show membership limitations
  *
  * @access protected
  * @return
  */
 protected function fillMembershipLimitation()
 {
     global $ilAccess, $ilCtrl;
     include_once 'Modules/Course/classes/class.ilObjCourseGrouping.php';
     if (!($items = ilObjCourseGrouping::_getGroupingItems($this->container))) {
         return true;
     }
     $mem = new ilCustomInputGUI($this->lng->txt('groupings'));
     $tpl = new ilTemplate('tpl.membership_limitation_form.html', true, true, 'Services/Membership');
     $tpl->setVariable('LIMIT_INTRO', $this->lng->txt($this->type . '_grp_info_reg'));
     foreach ($items as $ref_id) {
         $obj_id = ilObject::_lookupObjId($ref_id);
         $type = ilObject::_lookupType($obj_id);
         $title = ilObject::_lookupTitle($obj_id);
         if ($ilAccess->checkAccess('visible', '', $ref_id, $type)) {
             include_once './Services/Link/classes/class.ilLink.php';
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
             $tpl->setVariable('LINK_ITEM', $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
             $tpl->setVariable('ITEM_LINKED_TITLE', $title);
         } else {
             $tpl->setVariable('ITEM_TITLE');
         }
         $tpl->setCurrentBlock('items');
         $tpl->setVariable('TYPE_ICON', ilObject::_getIcon($obj_id, tiny, $type));
         $tpl->setVariable('ALT_ICON', $this->lng->txt('obj_' . $type));
         $tpl->parseCurrentBlock();
     }
     $mem->setHtml($tpl->get());
     if (!ilObjCourseGrouping::_checkGroupingDependencies($this->container)) {
         $mem->setAlert($this->container->getMessage());
         $this->enableRegistration(false);
     }
     $this->form->addItem($mem);
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(ilPropertyFormGUI $form)
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($lng->txt('passwd_encoder_' . $this->getName()));
     $form->addItem($header);
     $salt = new ilCustomInputGUI($lng->txt('passwd_encoder_bcrypt_client_salt'), 'bcrypt_salt');
     $info = array($lng->txt('passwd_encoder_client_bcrypt_salt_info'));
     if (!$this->isBcryptSupported()) {
         $info[] = sprintf($lng->txt('passwd_encoder_client_bcrypt_salt_info_php537'), PHP_VERSION);
     }
     if (1 == count($info)) {
         $salt->setInfo(current($info));
     } else {
         $salt->setInfo('<ul><li>' . implode('</li><li>', $info) . '</li></ul>');
     }
     $salt->setHtml($this->getClientSaltLocation());
     $form->addItem($salt);
 }
Example #21
0
 /**
  * Init the form to change the settings value type
  *
  * @return   object  property form to change settings type
  */
 function initSettingsTypeForm()
 {
     include_once "./Services/Administration/classes/class.ilSetting.php";
     $type = ilSetting::_getValueType();
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setId("settings_type");
     $form->setTitle($this->lng->txt("settings_type"));
     $form->setFormAction("setup.php?cmd=gateway");
     $item = new ilNonEditableValueGUI($this->lng->txt('settings_type_current'));
     $item->setValue(strtoupper($type));
     if ($type == "clob") {
         $item->setInfo($this->lng->txt('settings_info_clob'));
         $form->addCommandButton("showLongerSettings", $this->lng->txt("settings_show_longer"));
         $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_text"));
     } else {
         $item->setInfo($this->lng->txt('settings_info_text'));
         $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_clob"));
     }
     $form->addItem($item);
     if (is_array($this->longer_settings)) {
         $item = new ilCustomInputGUI($this->lng->txt('settings_longer_values'));
         if (count($this->longer_settings)) {
             foreach ($this->longer_settings as $row) {
                 $subitem = new ilCustomInputGUI(sprintf($this->lng->txt('settings_key_info'), $row['module'], $row['keyword']));
                 $subitem->setInfo($row['value']);
                 $item->addSubItem($subitem);
             }
         } else {
             $item->setHTML($this->lng->txt('settings_no_longer_values'));
         }
         $form->addItem($item);
     }
     return $form;
 }
 function addBasicQuestionFormProperties($form)
 {
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // author
         $author = new ilTextInputGUI($this->lng->txt("author"), "author");
         $author->setValue($this->object->getAuthor());
         $author->setRequired(TRUE);
         $form->addItem($author);
         // description
         $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
         $description->setValue($this->object->getComment());
         $description->setRequired(FALSE);
         $form->addItem($description);
     } else {
         // author as hidden field
         $hi = new ilHiddenInputGUI("author");
         $author = ilUtil::prepareFormOutput($this->object->getAuthor());
         if (trim($author) == "") {
             $author = "-";
         }
         $hi->setValue($author);
         $form->addItem($hi);
     }
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) {
             $question->setUseRte(TRUE);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $question->addPlugin("latex");
             $question->addButton("latex");
             $question->addButton("pastelatex");
             $question->setRTESupport($this->object->getId(), "qpl", "assessment");
         }
     } else {
         $question->setRteTags(self::getSelfAssessmentTags());
         $question->setUseTagsForRteOnly(false);
     }
     $form->addItem($question);
     $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
     $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps'));
     $tpl->parseCurrentBlock();
     $button = new ilCustomInputGUI('&nbsp;', '');
     $button->setHtml($tpl->get());
     $form->addItem($button);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // duration
         $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
         $duration->setShowHours(TRUE);
         $duration->setShowMinutes(TRUE);
         $duration->setShowSeconds(TRUE);
         $ewt = $this->object->getEstimatedWorkingTime();
         $duration->setHours($ewt["h"]);
         $duration->setMinutes($ewt["m"]);
         $duration->setSeconds($ewt["s"]);
         $duration->setRequired(FALSE);
         $form->addItem($duration);
     } else {
         // number of tries
         if (strlen($this->object->getNrOfTries())) {
             $nr_tries = $this->object->getNrOfTries();
         } else {
             $nr_tries = $this->object->getDefaultNrOfTries();
         }
         /*if ($nr_tries <= 0)
         		{
         			$nr_tries = 1;
         		}*/
         if ($nr_tries < 0) {
             $nr_tries = 0;
         }
         $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
         $ni->setValue($nr_tries);
         //$ni->setMinValue(1);
         $ni->setMinValue(0);
         $ni->setSize(5);
         $ni->setMaxLength(5);
         $ni->setRequired(true);
         $form->addItem($ni);
     }
 }
 private function initForm()
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
     $this->form_gui->setTitle($this->lng->txt('ldap_configure'));
     $active = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_enable'), 'active');
     $active->setValue(1);
     $this->form_gui->addItem($active);
     $ds = new ilCheckboxInputGUI($this->lng->txt('ldap_as_ds'), 'ds');
     $ds->setValue(1);
     $ds->setInfo($this->lng->txt('ldap_as_ds_info'));
     $this->form_gui->addItem($ds);
     $servername = new ilTextInputGUI($this->lng->txt('ldap_server_name'), 'server_name');
     $servername->setRequired(true);
     $servername->setInfo($this->lng->txt('ldap_server_name_info'));
     $servername->setSize(32);
     $servername->setMaxLength(32);
     $this->form_gui->addItem($servername);
     $serverurl = new ilTextInputGUI($this->lng->txt('ldap_server'), 'server_url');
     $serverurl->setRequired(true);
     $serverurl->setInfo($this->lng->txt('ldap_server_url_info'));
     $serverurl->setSize(64);
     $serverurl->setMaxLength(255);
     $this->form_gui->addItem($serverurl);
     $version = new ilSelectInputGUI($this->lng->txt('ldap_version'), 'version');
     $version->setOptions(array(2 => 2, 3 => 3));
     $version->setInfo($this->lng->txt('ldap_server_version_info'));
     $this->form_gui->addItem($version);
     $basedsn = new ilTextInputGUI($this->lng->txt('basedn'), 'base_dn');
     $basedsn->setRequired(true);
     $basedsn->setSize(64);
     $basedsn->setMaxLength(255);
     $this->form_gui->addItem($basedsn);
     $referrals = new ilCheckboxInputGUI($this->lng->txt('ldap_referrals'), 'referrals');
     $referrals->setValue(1);
     $referrals->setInfo($this->lng->txt('ldap_referrals_info'));
     $this->form_gui->addItem($referrals);
     $section_security = new ilFormSectionHeaderGUI();
     $section_security->setTitle($this->lng->txt('ldap_server_security_settings'));
     $this->form_gui->addItem($section_security);
     $tls = new ilCheckboxInputGUI($this->lng->txt('ldap_tls'), 'tls');
     $tls->setValue(1);
     $this->form_gui->addItem($tls);
     $binding = new ilRadioGroupInputGUI($this->lng->txt('ldap_server_binding'), 'binding_type');
     $anonymous = new ilRadioOption($this->lng->txt('ldap_bind_anonymous'), IL_LDAP_BIND_ANONYMOUS);
     $binding->addOption($anonymous);
     $user = new ilRadioOption($this->lng->txt('ldap_bind_user'), IL_LDAP_BIND_USER);
     $dn = new ilTextInputGUI($this->lng->txt('ldap_server_bind_dn'), 'bind_dn');
     $dn->setSize(64);
     $dn->setMaxLength(255);
     $user->addSubItem($dn);
     $pass = new ilPasswordInputGUI($this->lng->txt('ldap_server_bind_pass'), 'bind_pass');
     $pass->setSkipSyntaxCheck(true);
     $pass->setSize(12);
     $pass->setMaxLength(36);
     $user->addSubItem($pass);
     $binding->addOption($user);
     $this->form_gui->addItem($binding);
     $section_auth = new ilFormSectionHeaderGUI();
     $section_auth->setTitle($this->lng->txt('ldap_authentication_settings'));
     $this->form_gui->addItem($section_auth);
     $search_base = new ilTextInputGUI($this->lng->txt('ldap_user_dn'), 'search_base');
     $search_base->setInfo($this->lng->txt('ldap_search_base_info'));
     $search_base->setSize(64);
     $search_base->setMaxLength(255);
     $this->form_gui->addItem($search_base);
     $user_scope = new ilSelectInputGUI($this->lng->txt('ldap_user_scope'), 'user_scope');
     $user_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
     $user_scope->setInfo($this->lng->txt('ldap_user_scope_info'));
     $this->form_gui->addItem($user_scope);
     $user_attribute = new ilTextInputGUI($this->lng->txt('ldap_user_attribute'), 'user_attribute');
     $user_attribute->setSize(16);
     $user_attribute->setMaxLength(64);
     $user_attribute->setRequired(true);
     $this->form_gui->addItem($user_attribute);
     $filter = new ilTextInputGUI($this->lng->txt('ldap_search_filter'), 'filter');
     $filter->setInfo($this->lng->txt('ldap_filter_info'));
     $filter->setSize(64);
     $filter->setMaxLength(512);
     $this->form_gui->addItem($filter);
     $section_restrictions = new ilFormSectionHeaderGUI();
     $section_restrictions->setTitle($this->lng->txt('ldap_group_restrictions'));
     $this->form_gui->addItem($section_restrictions);
     $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_search_base'), 'group_dn');
     $group_dn->setInfo($this->lng->txt('ldap_group_dn_info'));
     $group_dn->setSize(64);
     $group_dn->setMaxLength(255);
     $this->form_gui->addItem($group_dn);
     $group_scope = new ilSelectInputGUI($this->lng->txt('ldap_group_scope'), 'group_scope');
     $group_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
     $group_scope->setInfo($this->lng->txt('ldap_group_scope_info'));
     $this->form_gui->addItem($group_scope);
     $group_filter = new ilTextInputGUI($this->lng->txt('ldap_group_filter'), 'group_filter');
     $group_filter->setInfo($this->lng->txt('ldap_group_filter_info'));
     $group_filter->setSize(64);
     $group_filter->setMaxLength(255);
     $this->form_gui->addItem($group_filter);
     $group_member = new ilTextInputGUI($this->lng->txt('ldap_group_member'), 'group_member');
     $group_member->setInfo($this->lng->txt('ldap_group_member_info'));
     $group_member->setSize(32);
     $group_member->setMaxLength(255);
     $this->form_gui->addItem($group_member);
     $group_member_isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_memberisdn'), 'memberisdn');
     #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info'));
     $this->form_gui->addItem($group_member_isdn);
     #$group_member->addSubItem($group_member_isdn);
     $group = new ilTextInputGUI($this->lng->txt('ldap_group_name'), 'group');
     $group->setInfo($this->lng->txt('ldap_group_name_info'));
     $group->setSize(32);
     $group->setMaxLength(255);
     $this->form_gui->addItem($group);
     $group_atrr = new ilTextInputGUI($this->lng->txt('ldap_group_attribute'), 'group_attribute');
     $group_atrr->setInfo($this->lng->txt('ldap_group_attribute_info'));
     $group_atrr->setSize(16);
     $group_atrr->setMaxLength(64);
     $this->form_gui->addItem($group_atrr);
     $group_optional = new ilCheckboxInputGUI($this->lng->txt('ldap_group_membership'), 'group_optional');
     $group_optional->setOptionTitle($this->lng->txt('ldap_group_member_optional'));
     $group_optional->setInfo($this->lng->txt('ldap_group_optional_info'));
     $group_optional->setValue(1);
     $group_user_filter = new ilTextInputGUI($this->lng->txt('ldap_group_user_filter'), 'group_user_filter');
     $group_user_filter->setSize(64);
     $group_user_filter->setMaxLength(255);
     $group_optional->addSubItem($group_user_filter);
     $this->form_gui->addItem($group_optional);
     $section_sync = new ilFormSectionHeaderGUI();
     $section_sync->setTitle($this->lng->txt('ldap_user_sync'));
     $this->form_gui->addItem($section_sync);
     $ci_gui = new ilCustomInputGUI($this->lng->txt('ldap_moment_sync'));
     $sync_on_login = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_login'), 'sync_on_login');
     $sync_on_login->setValue(1);
     $ci_gui->addSubItem($sync_on_login);
     $sync_per_cron = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_cron'), 'sync_per_cron');
     $sync_per_cron->setValue(1);
     $ci_gui->addSubItem($sync_per_cron);
     $ci_gui->setInfo($this->lng->txt('ldap_user_sync_info'));
     $this->form_gui->addItem($ci_gui);
     $global_role = new ilSelectInputGUI($this->lng->txt('ldap_global_role_assignment'), 'global_role');
     $global_role->setOptions($this->prepareRoleSelect(false));
     $global_role->setInfo($this->lng->txt('ldap_global_role_info'));
     $this->form_gui->addItem($global_role);
     $migr = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_migration'), 'migration');
     $migr->setInfo($this->lng->txt('auth_ldap_migration_info'));
     $migr->setValue(1);
     $this->form_gui->addItem($migr);
     include_once "Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php";
     ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_LDAP, $this->form_gui, ilAdministrationSettingsFormHandler::getSettingsGUIInstance("auth"));
     $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
 }
 /**
  * Init server info form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initServerInfoForm()
 {
     global $lng, $ilClientIniFile, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // installation name
     $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), "");
     $ne->setValue($ilClientIniFile->readVariable("client", "name"));
     $ne->setInfo($ilClientIniFile->readVariable("client", "description"));
     $this->form->addItem($ne);
     // client id
     $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "");
     $ne->setValue(CLIENT_ID);
     $this->form->addItem($ne);
     // installation id
     $ne = new ilNonEditableValueGUI($lng->txt("inst_id"), "");
     $ne->setValue($ilSetting->get("inst_id"));
     $this->form->addItem($ne);
     // database version
     $ne = new ilNonEditableValueGUI($lng->txt("db_version"), "");
     $ne->setValue($ilSetting->get("db_version"));
     include_once "./Services/Database/classes/class.ilDBUpdate.php";
     $this->form->addItem($ne);
     // ilias version
     $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), "");
     $ne->setValue($ilSetting->get("ilias_version"));
     $this->form->addItem($ne);
     // version controll information, object can be created by factory in later revisions (if we support git etc.)
     require_once 'Services/Administration/classes/class.ilSubversionInformation.php';
     $vc = new ilSubversionInformation();
     $revision_info = $vc->getInformationAsHtml();
     if ($revision_info) {
         $ne = new ilCustomInputGUI($lng->txt('vc_information'), '');
         $ne->setHtml($revision_info);
         $this->form->addItem($ne);
     }
     // host
     $ne = new ilNonEditableValueGUI($lng->txt("host"), "");
     $ne->setValue($_SERVER["SERVER_NAME"]);
     $this->form->addItem($ne);
     // ip & port
     $ne = new ilNonEditableValueGUI($lng->txt("ip_address") . " & " . $this->lng->txt("port"), "");
     $ne->setValue($_SERVER["SERVER_ADDR"] . ":" . $_SERVER["SERVER_PORT"]);
     $this->form->addItem($ne);
     // server
     $ne = new ilNonEditableValueGUI($lng->txt("server_software"), "");
     $ne->setValue($_SERVER["SERVER_SOFTWARE"]);
     $this->form->addItem($ne);
     // http path
     $ne = new ilNonEditableValueGUI($lng->txt("http_path"), "");
     $ne->setValue(ILIAS_HTTP_PATH);
     $this->form->addItem($ne);
     // absolute path
     $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), "");
     $ne->setValue(ILIAS_ABSOLUTE_PATH);
     $this->form->addItem($ne);
     $not_set = $lng->txt("path_not_set");
     // convert
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_convert"), "");
     $ne->setValue(PATH_TO_CONVERT ? PATH_TO_CONVERT : $not_set);
     $this->form->addItem($ne);
     // zip
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_zip"), "");
     $ne->setValue(PATH_TO_ZIP ? PATH_TO_ZIP : $not_set);
     $this->form->addItem($ne);
     // unzip
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_unzip"), "");
     $ne->setValue(PATH_TO_UNZIP ? PATH_TO_UNZIP : $not_set);
     $this->form->addItem($ne);
     // java
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_java"), "");
     $ne->setValue(PATH_TO_JAVA ? PATH_TO_JAVA : $not_set);
     $this->form->addItem($ne);
     // htmldoc
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_htmldoc"), "");
     $ne->setValue(PATH_TO_HTMLDOC ? PATH_TO_HTMLDOC : $not_set);
     $this->form->addItem($ne);
     // mkisofs
     $ne = new ilNonEditableValueGUI($lng->txt("path_to_mkisofs"), "");
     $ne->setValue(PATH_TO_MKISOFS ? PATH_TO_MKISOFS : $not_set);
     $this->form->addItem($ne);
     // latex
     $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), "");
     $ne->setValue(URL_TO_LATEX ? URL_TO_LATEX : $not_set);
     $this->form->addItem($ne);
     $this->form->setTitle($lng->txt("server_data"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
 /**
  * initEditCustomForm
  *
  * @param string $a_mode
  */
 public function initForm($a_mode = "create")
 {
     global $ilCtrl, $ilErr, $lng;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $item = new ilTextInputGUI($lng->txt('title'), 'title');
     $item->setRequired(true);
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_visible'), 'is_visible');
     $this->form->addItem($item);
     $item = new ilTextAreaInputGUI($lng->txt('additional_info'), 'description');
     $item->setUseRte(true);
     //        $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings');
     $item->setRteTagSet('mini');
     $this->form->addItem($item);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($lng->txt('dcl_permissions_form'));
     $this->form->addItem($section);
     $item = new ilCustomInputGUI();
     $item->setHtml($lng->txt('dcl_table_info'));
     $item->setTitle($lng->txt('dcl_table_info_title'));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_add_perm'), 'add_perm');
     //		$item->setInfo($lng->txt("dcl_add_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_perm'), 'edit_perm');
     //		$item->setInfo($lng->txt("dcl_edit_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_delete_perm'), 'delete_perm');
     //		$item->setInfo($lng->txt("dcl_delete_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_by_owner'), 'edit_by_owner');
     //		$item->setInfo($lng->txt("dcl_edit_by_owner_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_export_enabled'), 'export_enabled');
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_limited'), 'limited');
     $sitem1 = new ilDateTimeInputGUI($lng->txt('dcl_limit_start'), 'limit_start');
     $sitem2 = new ilDateTimeInputGUI($lng->txt('dcl_limit_end'), 'limit_end');
     //		$item->setInfo($lng->txt("dcl_limited_info"));
     $item->addSubItem($sitem1);
     $item->addSubItem($sitem2);
     $this->form->addItem($item);
     if ($a_mode == "edit") {
         $this->form->addCommandButton('update', $lng->txt('dcl_table_' . $a_mode));
     } else {
         $this->form->addCommandButton('save', $lng->txt('dcl_table_' . $a_mode));
     }
     $this->form->addCommandButton('cancel', $lng->txt('cancel'));
     $this->form->setFormAction($ilCtrl->getFormAction($this, $a_mode));
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt('dcl_edit_table'));
     } else {
         $this->form->setTitle($lng->txt('dcl_new_table'));
     }
 }
 function initMailRatersForm($appr_id, array $rec_ids)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "mailRatersAction"));
     $form->setTitle($this->lng->txt('compose'));
     $all_data = $this->object->getRatersData($appr_id);
     $rec_data = array();
     foreach ($rec_ids as $rec_id) {
         if (isset($all_data[$rec_id])) {
             $rec_data[] = $all_data[$rec_id]["lastname"] . ", " . $all_data[$rec_id]["firstname"] . " (" . $all_data[$rec_id]["email"] . ")";
         }
     }
     sort($rec_data);
     $rec = new ilCustomInputGUI($this->lng->txt('recipients'));
     $rec->setHTML(implode("<br />", $rec_data));
     $form->addItem($rec);
     $subject = new ilTextInputGUI($this->lng->txt('subject'), 'subject');
     $subject->setSize(50);
     $subject->setRequired(true);
     $form->addItem($subject);
     $existingdata = $this->object->getExternalCodeRecipients();
     $existingcolumns = array();
     if (count($existingdata)) {
         $first = array_shift($existingdata);
         foreach ($first as $key => $value) {
             if (strcmp($key, 'code') != 0 && strcmp($key, 'email') != 0 && strcmp($key, 'sent') != 0) {
                 array_push($existingcolumns, '[' . $key . ']');
             }
         }
     }
     $mailmessage_u = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_registered'), 'message_u');
     $mailmessage_u->setRequired(true);
     $mailmessage_u->setCols(80);
     $mailmessage_u->setRows(10);
     $form->addItem($mailmessage_u);
     $mailmessage_a = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_anonymous'), 'message_a');
     $mailmessage_a->setRequired(true);
     $mailmessage_a->setCols(80);
     $mailmessage_a->setRows(10);
     $mailmessage_a->setInfo(sprintf($this->lng->txt('message_content_info'), join($existingcolumns, ', ')));
     $form->addItem($mailmessage_a);
     $recf = new ilHiddenInputGUI("rtr_id");
     $recf->setValue(implode(";", $rec_ids));
     $form->addItem($recf);
     $form->addCommandButton("mailRatersAction", $this->lng->txt("send"));
     $form->addCommandButton("editRaters", $this->lng->txt("cancel"));
     $subject->setValue(sprintf($this->lng->txt('survey_360_rater_subject_default'), $this->object->getTitle()));
     $mailmessage_u->setValue($this->lng->txt('survey_360_rater_message_content_registered_default'));
     $mailmessage_a->setValue($this->lng->txt('survey_360_rater_message_content_anonymous_default'));
     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);
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("multiplechoice");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setValue($this->object->label);
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setValue($this->object->getAuthor());
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setValue($this->object->getDescription());
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
     $form->addItem($question);
     // subtype
     $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
     $subtype->setRequired(false);
     $subtype->setValue($this->object->getSubtype());
     $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
     foreach ($subtypes as $idx => $st) {
         $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
     }
     $form->addItem($subtype);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getObligatory());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_appearance"));
     $form->addItem($header);
     // column separators
     $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
     $column_separators->setValue(1);
     $column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
     $column_separators->setChecked($this->object->getColumnSeparators());
     $column_separators->setRequired(false);
     $form->addItem($column_separators);
     // row separators
     $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
     $row_separators->setValue(1);
     $row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
     $row_separators->setChecked($this->object->getRowSeparators());
     $row_separators->setRequired(false);
     $form->addItem($row_separators);
     // neutral column separators
     $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
     $neutral_column_separator->setValue(1);
     $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
     $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
     $neutral_column_separator->setRequired(false);
     $form->addItem($neutral_column_separator);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_columns"));
     $form->addItem($header);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $columns = new ilCategoryWizardInputGUI("", "columns");
     $columns->setRequired(false);
     $columns->setAllowMove(true);
     $columns->setShowWizard(true);
     $columns->setShowNeutralCategory(true);
     $columns->setDisabledScale(false);
     $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
     $columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
     $columns->setShowSavePhrase(true);
     if (!$this->object->getColumnCount()) {
         $this->object->columns->addCategory("");
     }
     $columns->setValues($this->object->getColumns());
     $form->addItem($columns);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_column_settings"));
     $form->addItem($header);
     // bipolar adjectives
     $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
     $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
     // left pole
     $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
     $bipolar1->setValue($this->object->getBipolarAdjective(0));
     $bipolar1->setRequired(false);
     $bipolar->addSubItem($bipolar1);
     // right pole
     $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
     $bipolar2->setValue($this->object->getBipolarAdjective(1));
     $bipolar2->setRequired(false);
     $bipolar->addSubItem($bipolar2);
     $form->addItem($bipolar);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_rows"));
     $form->addItem($header);
     // matrix rows
     include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
     $rows = new ilMatrixRowWizardInputGUI("", "rows");
     $rows->setRequired(false);
     $rows->setAllowMove(true);
     $rows->setLabelText($this->lng->txt('label'));
     $rows->setUseOtherAnswer(true);
     if ($this->object->getRowCount() == 0) {
         $this->object->getRows()->addCategory("");
     }
     $rows->setValues($this->object->getRows());
     $form->addItem($rows);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand(array("wizardcolumns", "savePhrasecolumns"))) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
Example #29
0
 protected function initAssignmentTextForm(ilExAssignment $a_ass, $a_read_only = false, $a_cancel_cmd = "showOverview", $a_peer_review_cmd = null, $a_peer_rating_html = null)
 {
     global $ilCtrl, $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->lng->txt("exc_assignment") . " \"" . $a_ass->getTitle() . "\"");
     if (!$a_read_only) {
         $text = new ilTextAreaInputGUI($this->lng->txt("exc_your_text"), "atxt");
         $text->setRequired((bool) $a_ass->getMandatory());
         $text->setRows(40);
         $form->addItem($text);
         // custom rte tags
         $text->setUseRte(true);
         $text->setRTESupport($ilUser->getId(), "exca~", "exc_ass");
         // see ilObjForumGUI
         $text->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext'));
         $form->setFormAction($ilCtrl->getFormAction($this, "updateAssignmentText"));
         $form->addCommandButton("updateAssignmentTextAndReturn", $this->lng->txt("save_return"));
         $form->addCommandButton("updateAssignmentText", $this->lng->txt("save"));
     } else {
         $text = new ilNonEditableValueGUI($this->lng->txt("exc_files_returned_text"), "atxt", true);
         $form->addItem($text);
         if (!$a_peer_review_cmd) {
             $form->setFormAction($ilCtrl->getFormAction($this, "showOverview"));
         } else {
             $rating = new ilCustomInputGUI($this->lng->txt("exc_peer_review_rating"));
             $rating->setHtml($a_peer_rating_html);
             $form->addItem($rating);
             $comm = new ilTextAreaInputGUI($this->lng->txt("exc_peer_review_comment"), "comm");
             $comm->setCols(75);
             $comm->setRows(15);
             $form->addItem($comm);
             $form->setFormAction($ilCtrl->getFormAction($this, $a_peer_review_cmd));
             $form->addCommandButton($a_peer_review_cmd, $this->lng->txt("save"));
         }
     }
     $form->addCommandButton($a_cancel_cmd, $this->lng->txt("cancel"));
     return $form;
 }
 /**
  * Show create/edit single link
  * @param int form mode
  * @return 
  */
 protected function initFormLink($a_mode)
 {
     global $ilTabs;
     $ilTabs->activateTab("id_content");
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     switch ($a_mode) {
         case self::LINK_MOD_CREATE:
             // Header
             $this->ctrl->setParameter($this, 'new_type', 'webr');
             $this->form->setTitle($this->lng->txt('webr_new_link'));
             $this->form->setTableWidth('600px');
             // Buttons
             $this->form->addCommandButton('save', $this->lng->txt('webr_add'));
             $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             break;
         case self::LINK_MOD_ADD:
             // Header
             $this->form->setTitle($this->lng->txt('webr_new_link'));
             // Buttons
             $this->form->addCommandButton('saveAddLink', $this->lng->txt('webr_add'));
             $this->form->addCommandButton('view', $this->lng->txt('cancel'));
             break;
         case self::LINK_MOD_EDIT:
             // Header
             $this->ctrl->setParameter($this, 'link_id', (int) $_REQUEST['link_id']);
             $this->form->setTitle($this->lng->txt('webr_edit'));
             // Buttons
             $this->form->addCommandButton('updateLink', $this->lng->txt('save'));
             $this->form->addCommandButton('view', $this->lng->txt('cancel'));
             break;
     }
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     if ($a_mode == self::LINK_MOD_ADD and $this->isContainerMetaDataRequired()) {
         ilUtil::sendInfo($this->lng->txt('webr_container_info'));
         $this->form->setTitle($this->lng->txt('webr_edit_list'));
         // List Title
         $title = new ilTextInputGUI($this->lng->txt('webr_list_title'), 'lti');
         $title->setRequired(true);
         $title->setSize(40);
         $title->setMaxLength(127);
         $this->form->addItem($title);
         // List Description
         $desc = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'), 'tde');
         $desc->setRows(3);
         $desc->setCols(40);
         $this->form->addItem($desc);
         // Addtional section
         $sect = new ilFormSectionHeaderGUI();
         $sect->setTitle($this->lng->txt('webr_add'));
         $this->form->addItem($sect);
     }
     // Target
     /*
     $tar = new ilTextInputGUI($this->lng->txt('webr_link_target'),'tar');
     $tar->setValue("http://");
     
     $tar->setSize(40);
     $tar->setMaxLength(500);
     */
     include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
     $tar = new ilLinkInputGUI($this->lng->txt('webr_link_target'), 'tar');
     $tar->setInternalLinkFilterTypes(array("PageObject", "GlossaryItem", "RepositoryItem"));
     $tar->setRequired(true);
     $this->form->addItem($tar);
     // Title
     $tit = new ilTextInputGUI($this->lng->txt('webr_link_title'), 'tit');
     $tit->setRequired(true);
     $tit->setSize(40);
     $tit->setMaxLength(127);
     $this->form->addItem($tit);
     // Description
     $des = new ilTextAreaInputGUI($this->lng->txt('description'), 'des');
     $des->setRows(3);
     $des->setCols(40);
     $this->form->addItem($des);
     if ($a_mode != self::LINK_MOD_CREATE) {
         // Active
         $act = new ilCheckboxInputGUI($this->lng->txt('active'), 'act');
         $act->setChecked(true);
         $act->setValue(1);
         $this->form->addItem($act);
         // Check
         $che = new ilCheckboxInputGUI($this->lng->txt('webr_disable_check'), 'che');
         $che->setValue(1);
         $this->form->addItem($che);
     }
     // Valid
     if ($a_mode == self::LINK_MOD_EDIT) {
         $val = new ilCheckboxInputGUI($this->lng->txt('valid'), 'vali');
         $this->form->addItem($val);
     }
     if (ilParameterAppender::_isEnabled() && $a_mode != self::LINK_MOD_CREATE) {
         $dyn = new ilNonEditableValueGUI($this->lng->txt('links_dyn_parameter'));
         $dyn->setInfo($this->lng->txt('links_dynamic_info'));
         if (count($links = ilParameterAppender::_getParams((int) $_GET['link_id']))) {
             $ex = new ilCustomInputGUI($this->lng->txt('links_existing_params'), 'ex');
             $dyn->addSubItem($ex);
             foreach ($links as $id => $link) {
                 $p = new ilCustomInputGUI();
                 $ptpl = new ilTemplate('tpl.link_dyn_param_edit.html', true, true, 'Modules/WebResource');
                 $ptpl->setVariable('INFO_TXT', ilParameterAppender::parameterToInfo($link['name'], $link['value']));
                 $this->ctrl->setParameter($this, 'param_id', $id);
                 $ptpl->setVariable('LINK_DEL', $this->ctrl->getLinkTarget($this, 'deleteParameterForm'));
                 $ptpl->setVariable('LINK_TXT', $this->lng->txt('delete'));
                 $p->setHtml($ptpl->get());
                 $dyn->addSubItem($p);
             }
         }
         // Existing parameters
         // New parameter
         if ($a_mode != self::LINK_MOD_CREATE) {
             #$new = new ilCustomInputGUI($this->lng->txt('links_add_param'),'');
             #$dyn->addSubItem($new);
         }
         // Dynyamic name
         $nam = new ilTextInputGUI($this->lng->txt('links_name'), 'nam');
         $nam->setSize(12);
         $nam->setMaxLength(128);
         $dyn->addSubItem($nam);
         // Dynamic value
         $val = new ilSelectInputGUI($this->lng->txt('links_value'), 'val');
         $val->setOptions(ilParameterAppender::_getOptionSelect());
         $val->setValue(0);
         $dyn->addSubItem($val);
         $this->form->addItem($dyn);
     }
 }