protected function initLicenseForm()
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "updateLicense"));
     $form->setTitle($this->lng->txt('edit_license'));
     $exist = new ilNumberInputGUI($this->lng->txt("existing_licenses"), "licenses");
     $exist->setInfo($this->lng->txt("zero_licenses_explanation"));
     $exist->setMaxLength(10);
     $exist->setSize(10);
     $exist->setValue($this->license->getLicenses());
     $form->addItem($exist);
     $info_used = new ilNonEditableValueGUI($this->lng->txt("used_licenses"));
     $info_used->setInfo($this->lng->txt("used_licenses_explanation"));
     $info_used->setValue($this->license->getAccesses());
     $form->addItem($info_used);
     $remaining_licenses = $this->license->getLicenses() == "0" ? $this->lng->txt("arbitrary") : $this->license->getRemainingLicenses();
     $info_remain = new ilNonEditableValueGUI($this->lng->txt("remaining_licenses"));
     $info_remain->setInfo($this->lng->txt("remaining_licenses_explanation"));
     $info_remain->setValue($remaining_licenses);
     $form->addItem($info_remain);
     $info_potential = new ilNonEditableValueGUI($this->lng->txt("potential_accesses"));
     $info_potential->setInfo($this->lng->txt("potential_accesses_explanation"));
     $info_potential->setValue($this->license->getPotentialAccesses());
     $form->addItem($info_potential);
     $comm = new ilTextAreaInputGUI($this->lng->txt("comment"), "remarks");
     $comm->setRows(5);
     $comm->setValue($this->license->getRemarks());
     $form->addItem($comm);
     $form->addCommandButton('updateLicense', $this->lng->txt('save'));
     return $form;
 }
 protected function initPluginSettings()
 {
     $n = new ilNonEditableValueGUI($this->getPluginHookObject()->txt('info_token_expires'));
     $n->setValue(date(DATE_ISO8601, $this->getPluginObject()->getValidThrough()));
     $this->form->addItem($n);
     $this->form->getItemByPostVar('root_folder')->setDisabled(true);
 }
 public function InvoiceNumberObject()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $invObj = new ilUserDefinedInvoiceNumber();
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
     $form_gui = new ilPropertyFormGUI();
     $form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveInvoiceNumber'));
     $form_gui->setTitle($this->lng->txt('invoice_number_setting'));
     // invoice_type
     $radio_group = new ilRadioGroupInputGUI($this->lng->txt('invoice_number'), 'ud_invoice_number');
     $radio_option_1 = new ilRadioOption($this->lng->txt('ilias_invoice_number'), '0');
     $radio_group->addOption($radio_option_1);
     $radio_option_2 = new ilRadioOption($this->lng->txt('userdefined_invoice_number'), '1');
     $radio_group->addOption($radio_option_2);
     $radio_group->setRequired(true);
     $radio_group->setValue($invObj->getUDInvoiceNumberActive(), '0');
     $radio_group->setPostVar('ud_invoice_number');
     $form_gui->addItem($radio_group);
     // incremental current value
     $cur_num = new ilNonEditableValueGUI($this->lng->txt('incremental_current_value'), 'inc_current_value');
     $cur_num->setValue(ilUserDefinedInvoiceNumber::_getIncCurrentValue(), 1);
     $radio_option_2->addSubItem($cur_num);
     // incremental start value
     $inc_num = new ilNumberInputGUI($this->lng->txt('incremental_start_value'), 'inc_start_value');
     $inc_num->setValue($this->error != "" && isset($_POST['incremental_start_value']) ? ilUtil::prepareFormOutput($_POST['incremental_start_value'], true) : ilUtil::prepareFormOutput($invObj->getIncStartValue(), true));
     $inc_num->setInfo($this->lng->txt('incremental_start_value_info'));
     $radio_option_2->addSubItem($inc_num);
     // reset period of current value
     $sel_reset = new ilSelectInputGUI($this->lng->txt('invoice_number_reset_period'), 'inc_reset_period');
     $sel_reset->setValue($this->error != "" && isset($_POST['inc_reset_period']) ? $_POST['inc_reset_period'] : $invObj->getIncResetPeriod());
     $reset_options = array(1 => $this->lng->txt('yearly'), 2 => $this->lng->txt('monthly'));
     $sel_reset->setOptions($reset_options);
     $radio_option_2->addSubItem($sel_reset);
     // invoice_number_text
     $inp = new ilTextAreaInputGUI($this->lng->txt('invoice_number_text'), 'invoice_number_text');
     $inp->setValue($this->error != "" && isset($_POST['invoice_number_text']) ? ilUtil::prepareFormOutput($_POST['invoice_number_text'], true) : ilUtil::prepareFormOutput($invObj->getInvoiceNumberText(), true));
     $inp->setRequired(false);
     $inp->setCols(60);
     $inp->setRows(3);
     $radio_option_2->addSubItem($inp);
     // PLACEHOLDERS
     $prop = new ilInvoiceNumberPlaceholdersPropertyGUI();
     $radio_option_2->addSubItem($prop);
     $form_gui->addCommandButton('saveInvoiceNumber', $this->lng->txt('save'));
     $this->tpl->setVariable('FORM', $form_gui->getHTML());
 }
 /**
  * Init settings property form
  *
  * @access protected
  */
 protected function initFormSettings()
 {
     if (is_object($this->form)) {
         return true;
     }
     include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     $this->form->setTitle($this->lng->txt('cal_global_settings'));
     $this->form->addCommandButton('save', $this->lng->txt('save'));
     #$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
     $check = new ilCheckboxInputGUI($this->lng->txt('enable_calendar'), 'enable');
     $check->setValue(1);
     $check->setChecked($this->settings->isEnabled() ? true : false);
     $this->form->addItem($check);
     $server_tz = new ilNonEditableValueGUI($this->lng->txt('cal_server_tz'));
     $server_tz->setValue(ilTimeZone::_getDefaultTimeZone());
     $this->form->addItem($server_tz);
     $select = new ilSelectInputGUI($this->lng->txt('cal_def_timezone'), 'default_timezone');
     $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
     $select->setInfo($this->lng->txt('cal_def_timezone_info'));
     $select->setValue($this->settings->getDefaultTimeZone());
     $this->form->addItem($select);
     $year = date("Y");
     $select = new ilSelectInputGUI($this->lng->txt('cal_def_date_format'), 'default_date_format');
     $select->setOptions(array(ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year, ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31", ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year));
     $select->setInfo($this->lng->txt('cal_def_date_format_info'));
     $select->setValue($this->settings->getDefaultDateFormat());
     $this->form->addItem($select);
     $select = new ilSelectInputGUI($this->lng->txt('cal_def_time_format'), 'default_time_format');
     $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm'));
     $select->setInfo($this->lng->txt('cal_def_time_format_info'));
     $select->setValue($this->settings->getDefaultTimeFormat());
     $this->form->addItem($select);
     // Weekstart
     $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_def_week_start'), 'default_week_start');
     $radio->setValue($this->settings->getDefaultWeekStart());
     $option = new ilRadioOption($this->lng->txt('l_su'), 0);
     $radio->addOption($option);
     $option = new ilRadioOption($this->lng->txt('l_mo'), 1);
     $radio->addOption($option);
     $this->form->addItem($radio);
     // Day start
     $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst');
     $day_start->setOptions(ilCalendarUtil::getHourSelection($this->settings->getDefaultTimeFormat()));
     $day_start->setValue($this->settings->getDefaultDayStart());
     $this->form->addItem($day_start);
     $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den');
     $day_end->setOptions(ilCalendarUtil::getHourSelection($this->settings->getDefaultTimeFormat()));
     $day_end->setValue($this->settings->getDefaultDayEnd());
     $this->form->addItem($day_end);
     $sync = new ilCheckboxInputGUI($this->lng->txt('cal_webcal_sync'), 'webcal');
     $sync->setValue(1);
     $sync->setChecked($this->settings->isWebCalSyncEnabled());
     $sync->setInfo($this->lng->txt('cal_webcal_sync_info'));
     $sync_min = new ilNumberInputGUI('', 'webcal_hours');
     $sync_min->setSize(2);
     $sync_min->setMaxLength(3);
     $sync_min->setValue($this->settings->getWebCalSyncHours());
     $sync_min->setSuffix($this->lng->txt('hours'));
     $sync->addSubItem($sync_min);
     $this->form->addItem($sync);
     // enable milestone planning in groups
     $mil = new ilFormSectionHeaderGUI();
     $mil->setTitle($this->lng->txt('cal_milestone_settings'));
     $this->form->addItem($mil);
     $checkm = new ilCheckboxInputGUI($this->lng->txt('cal_enable_group_milestones'), 'enable_grp_milestones');
     $checkm->setValue(1);
     $checkm->setChecked($this->settings->getEnableGroupMilestones() ? true : false);
     $checkm->setInfo($this->lng->txt('cal_enable_group_milestones_desc'));
     $this->form->addItem($checkm);
     // Consultation hours
     $con = new ilFormSectionHeaderGUI();
     $con->setTitle($this->lng->txt('cal_ch_form_header'));
     $this->form->addItem($con);
     $ch = new ilCheckboxInputGUI($this->lng->txt('cal_ch_form'), 'ch');
     $ch->setInfo($this->lng->txt('cal_ch_form_info'));
     $ch->setValue(1);
     $ch->setChecked($this->settings->areConsultationHoursEnabled());
     $this->form->addItem($ch);
     // repository visibility default
     $rep = new ilFormSectionHeaderGUI();
     $rep->setTitle($GLOBALS['lng']->txt('cal_setting_global_vis_repos'));
     $this->form->addItem($rep);
     $crs = new ilCheckboxInputGUI($GLOBALS['lng']->txt('cal_setting_global_crs_vis'), 'visible_crs');
     $crs->setInfo($GLOBALS['lng']->txt('cal_setting_global_crs_vis_info'));
     $crs->setValue(1);
     $crs->setInfo($GLOBALS['lng']->txt('cal_setting_global_crs_vis_info'));
     $crs->setChecked($this->settings->isCourseCalendarEnabled());
     $this->form->addItem($crs);
     $grp = new ilCheckboxInputGUI($GLOBALS['lng']->txt('cal_setting_global_grp_vis'), 'visible_grp');
     $grp->setInfo($GLOBALS['lng']->txt('cal_setting_global_grp_vis_info'));
     $grp->setValue(1);
     $grp->setInfo($GLOBALS['lng']->txt('cal_setting_global_grp_vis_info'));
     $grp->setChecked($this->settings->isGroupCalendarEnabled());
     $this->form->addItem($grp);
     // Notifications
     $not = new ilFormSectionHeaderGUI();
     $not->setTitle($this->lng->txt('notifications'));
     $this->form->addItem($not);
     $cgn = new ilCheckboxInputGUI($this->lng->txt('cal_notification'), 'cn');
     $cgn->setOptionTitle($this->lng->txt('cal_notification_crsgrp'));
     $cgn->setValue(1);
     $cgn->setChecked($this->settings->isNotificationEnabled());
     $cgn->setInfo($this->lng->txt('cal_adm_notification_info'));
     $this->form->addItem($cgn);
     $cnu = new ilCheckboxInputGUI('', 'cnu');
     $cnu->setOptionTitle($this->lng->txt('cal_notification_users'));
     $cnu->setValue(1);
     $cnu->setChecked($this->settings->isUserNotificationEnabled());
     $cnu->setInfo($this->lng->txt('cal_adm_notification_user_info'));
     $this->form->addItem($cnu);
     // Registration
     $book = new ilFormSectionHeaderGUI();
     $book->setTitle($this->lng->txt('cal_registrations'));
     $this->form->addItem($book);
     $cgn = new ilCheckboxInputGUI($this->lng->txt('cal_cg_registrations'), 'cgr');
     $cgn->setValue(1);
     $cgn->setChecked($this->settings->isCGRegistrationEnabled());
     $cgn->setInfo($this->lng->txt('cal_cg_registration_info'));
     $this->form->addItem($cgn);
     // Synchronisation cache
     $sec = new ilFormSectionHeaderGUI();
     $sec->setTitle($this->lng->txt('cal_cache_settings'));
     $this->form->addItem($sec);
     $cache = new ilRadioGroupInputGUI($this->lng->txt('cal_sync_cache'), 'sync_cache');
     $cache->setValue((int) $this->settings->isSynchronisationCacheEnabled());
     $cache->setInfo($this->lng->txt('cal_sync_cache_info'));
     $cache->setRequired(true);
     $sync_cache = new ilRadioOption($this->lng->txt('cal_sync_disabled'), 0);
     $cache->addOption($sync_cache);
     $sync_cache = new ilRadioOption($this->lng->txt('cal_sync_enabled'), 1);
     $cache->addOption($sync_cache);
     $cache_t = new ilNumberInputGUI('', 'sync_cache_time');
     $cache_t->setValue($this->settings->getSynchronisationCacheMinutes());
     $cache_t->setMinValue(0);
     $cache_t->setSize(3);
     $cache_t->setMaxLength(3);
     $cache_t->setSuffix($this->lng->txt('form_minutes'));
     $sync_cache->addSubItem($cache_t);
     $this->form->addItem($cache);
     // Calendar cache
     $cache = new ilRadioGroupInputGUI($this->lng->txt('cal_cache'), 'cache');
     $cache->setValue((int) $this->settings->isCacheUsed());
     $cache->setInfo($this->lng->txt('cal_cache_info'));
     $cache->setRequired(true);
     $sync_cache = new ilRadioOption($this->lng->txt('cal_cache_disabled'), 0);
     $cache->addOption($sync_cache);
     $sync_cache = new ilRadioOption($this->lng->txt('cal_cache_enabled'), 1);
     $cache->addOption($sync_cache);
     $cache_t = new ilNumberInputGUI('', 'cache_time');
     $cache_t->setValue($this->settings->getCacheMinutes());
     $cache_t->setMinValue(0);
     $cache_t->setSize(3);
     $cache_t->setMaxLength(3);
     $cache_t->setSuffix($this->lng->txt('form_minutes'));
     $sync_cache->addSubItem($cache_t);
     $this->form->addItem($cache);
 }
 /**
  * init settings form
  *
  * @access protected
  */
 protected function initSettingsForm($a_mode = 'update')
 {
     if (is_object($this->form)) {
         return true;
     }
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'settings'));
     $this->form->setTitle($this->lng->txt('ecs_connection_settings'));
     $ena = new ilCheckboxInputGUI($this->lng->txt('ecs_active'), 'active');
     $ena->setChecked($this->settings->isEnabled());
     $ena->setValue(1);
     $this->form->addItem($ena);
     $ser = new ilTextInputGUI($this->lng->txt('ecs_server_url'), 'server');
     $ser->setValue((string) $this->settings->getServer());
     $ser->setRequired(true);
     $this->form->addItem($ser);
     $pro = new ilSelectInputGUI($this->lng->txt('ecs_protocol'), 'protocol');
     // fixed to https
     #$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTP => $this->lng->txt('http'),
     #		ilECSSetting::PROTOCOL_HTTPS => $this->lng->txt('https')));
     $pro->setOptions(array(ilECSSetting::PROTOCOL_HTTPS => 'HTTPS'));
     $pro->setValue($this->settings->getProtocol());
     $pro->setRequired(true);
     $this->form->addItem($pro);
     $por = new ilTextInputGUI($this->lng->txt('ecs_port'), 'port');
     $por->setSize(5);
     $por->setMaxLength(5);
     $por->setValue((string) $this->settings->getPort());
     $por->setRequired(true);
     $this->form->addItem($por);
     $tcer = new ilRadioGroupInputGUI($this->lng->txt('ecs_auth_type'), 'auth_type');
     $tcer->setValue($this->settings->getAuthType());
     $this->form->addItem($tcer);
     // Certificate based authentication
     $cert_based = new ilRadioOption($this->lng->txt('ecs_auth_type_cert'), ilECSSetting::AUTH_CERTIFICATE);
     $tcer->addOption($cert_based);
     $cli = new ilTextInputGUI($this->lng->txt('ecs_client_cert'), 'client_cert');
     $cli->setSize(60);
     $cli->setValue((string) $this->settings->getClientCertPath());
     $cli->setRequired(true);
     $cert_based->addSubItem($cli);
     $key = new ilTextInputGUI($this->lng->txt('ecs_cert_key'), 'key_path');
     $key->setSize(60);
     $key->setValue((string) $this->settings->getKeyPath());
     $key->setRequired(true);
     $cert_based->addSubItem($key);
     $cerp = new ilTextInputGUI($this->lng->txt('ecs_key_password'), 'key_password');
     $cerp->setSize(12);
     $cerp->setValue((string) $this->settings->getKeyPassword());
     $cerp->setInputType('password');
     $cerp->setRequired(true);
     $cert_based->addSubItem($cerp);
     $cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'), 'ca_cert');
     $cer->setSize(60);
     $cer->setValue((string) $this->settings->getCACertPath());
     $cer->setRequired(true);
     $cert_based->addSubItem($cer);
     // Apache auth
     $apa_based = new ilRadioOption($this->lng->txt('ecs_auth_type_apache'), ilECSSetting::AUTH_APACHE);
     $tcer->addOption($apa_based);
     $user = new ilTextInputGUI($this->lng->txt('ecs_apache_user'), 'auth_user');
     $user->setSize(32);
     $user->setValue((string) $this->settings->getAuthUser());
     $user->setRequired(true);
     $apa_based->addSubItem($user);
     $pass = new ilPasswordInputGUI($this->lng->txt('ecs_apache_pass'), 'auth_pass');
     $pass->setRetype(false);
     $pass->setSize(16);
     $pass->setMaxLength(32);
     $pass->setValue((string) $this->settings->getAuthPass());
     $pass->setRequired(true);
     $apa_based->addSubItem($pass);
     $ser = new ilNonEditableValueGUI($this->lng->txt('cert_serial'));
     $ser->setValue($this->settings->getCertSerialNumber() ? $this->settings->getCertSerialNumber() : $this->lng->txt('ecs_no_value'));
     $cert_based->addSubItem($ser);
     $loc = new ilFormSectionHeaderGUI();
     $loc->setTitle($this->lng->txt('ecs_local_settings'));
     $this->form->addItem($loc);
     $pol = new ilDurationInputGUI($this->lng->txt('ecs_polling'), 'polling');
     $pol->setShowDays(false);
     $pol->setShowHours(false);
     $pol->setShowMinutes(true);
     $pol->setShowSeconds(true);
     $pol->setSeconds($this->settings->getPollingTimeSeconds());
     $pol->setMinutes($this->settings->getPollingTimeMinutes());
     $pol->setRequired(true);
     $pol->setInfo($this->lng->txt('ecs_polling_info'));
     $this->form->addItem($pol);
     $imp = new ilCustomInputGUI($this->lng->txt('ecs_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->settings->getImportId());
     if ($this->settings->getImportId()) {
         $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->settings->getImportId()));
     }
     $imp->setHTML($tpl->get());
     $imp->setInfo($this->lng->txt('ecs_import_id_info'));
     $this->form->addItem($imp);
     $loc = new ilFormSectionHeaderGUI();
     $loc->setTitle($this->lng->txt('ecs_remote_user_settings'));
     $this->form->addItem($loc);
     $role = new ilSelectInputGUI($this->lng->txt('ecs_role'), 'global_role');
     $role->setOptions($this->prepareRoleSelect());
     $role->setValue($this->settings->getGlobalRole());
     $role->setInfo($this->lng->txt('ecs_global_role_info'));
     $role->setRequired(true);
     $this->form->addItem($role);
     $duration = new ilDurationInputGUI($this->lng->txt('ecs_account_duration'), 'duration');
     $duration->setInfo($this->lng->txt('ecs_account_duration_info'));
     $duration->setMonths($this->settings->getDuration());
     $duration->setShowSeconds(false);
     $duration->setShowMinutes(false);
     $duration->setShowHours(false);
     $duration->setShowDays(false);
     $duration->setShowMonths(true);
     $duration->setRequired(true);
     $this->form->addItem($duration);
     // Email recipients
     $loc = new ilFormSectionHeaderGUI();
     $loc->setTitle($this->lng->txt('ecs_notifications'));
     $this->form->addItem($loc);
     $rcp_user = new ilTextInputGUI($this->lng->txt('ecs_user_rcp'), 'user_recipients');
     $rcp_user->setValue((string) $this->settings->getUserRecipientsAsString());
     $rcp_user->setInfo($this->lng->txt('ecs_user_rcp_info'));
     $this->form->addItem($rcp_user);
     $rcp_econ = new ilTextInputGUI($this->lng->txt('ecs_econ_rcp'), 'econtent_recipients');
     $rcp_econ->setValue((string) $this->settings->getEContentRecipientsAsString());
     $rcp_econ->setInfo($this->lng->txt('ecs_econ_rcp_info'));
     $this->form->addItem($rcp_econ);
     $rcp_app = new ilTextInputGUI($this->lng->txt('ecs_approval_rcp'), 'approval_recipients');
     $rcp_app->setValue((string) $this->settings->getApprovalRecipientsAsString());
     $rcp_app->setInfo($this->lng->txt('ecs_approval_rcp_info'));
     $this->form->addItem($rcp_app);
     if ($a_mode == 'update') {
         $this->form->addCommandButton('update', $this->lng->txt('save'));
     } else {
         $this->form->addCommandButton('save', $this->lng->txt('save'));
     }
     $this->form->addCommandButton('overview', $this->lng->txt('cancel'));
 }
 public function showDetails()
 {
     global $ilMainMenu, $ilTabs, $ilToolbar, $ilUser;
     $this->__initPaymentObject();
     $this->__initPricesObject();
     $this->__initShoppingCartObject();
     $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'), 'ilias.php?baseClass=ilShopController');
     $this->tpl->getStandardTemplate();
     $ilTabs->setTabActive('buy');
     $ilMainMenu->setActive('shop');
     if ($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES) {
         ilUtil::sendInfo($this->lng->txt('pay_expires_info'));
         return false;
     }
     $extension_prices = array();
     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
         include_once './Services/Payment/classes/class.ilPaymentBookings.php';
         $has_extension_price = ilPaymentBookings::_hasAccesstoExtensionPrice($ilUser->getId(), $this->pobject->getPobjectId());
         if ($has_extension_price) {
             $extension_prices = $this->price_obj->getExtensionPrices();
         }
     }
     $org_prices = $this->price_obj->getPrices();
     $tmp_prices = array_merge($org_prices, $extension_prices);
     $prices = array();
     foreach ($tmp_prices as $price) {
         // expired prices must be filtered out
         if ($price['price_type'] == ilPaymentPrices::TYPE_DURATION_DATE && $price['duration_until'] < date('Y-m-d')) {
             //do nothing
         } else {
             $prices[] = $price;
         }
     }
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $buyedObject = "";
     if ($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId())) {
         $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
         if (is_array($prices) && count($prices) > 1) {
             ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc_choose_another'));
         } else {
             ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc'));
         }
     }
     $this->ctrl->setParameter($this, "ref_id", $this->pobject->getRefId());
     $subtype = '';
     if ($this->object) {
         if ($this->object->getType() == 'exc') {
             $subtype = ' (' . $this->lng->txt($this->pobject->getSubtype()) . ')';
         }
         $form->setTitle($this->object->getTitle() . ' ' . $subtype);
         $form->setTitleIcon(ilObject::_getIcon($this->object->getId()));
     } else {
         ilUtil::sendFailure($this->lng->txt('object_not_found'));
     }
     // payment infos
     $info = new ilNonEditableValueGUI($this->lng->txt('info'));
     $info->setValue($this->lng->txt('pay_info'));
     $form->addItem($info);
     if (is_array($buyedObject)) {
         if (is_array($prices) && count($prices) > 1) {
             $button_txt = $this->lng->txt('pay_change_price');
         } else {
             $button_txt = $this->lng->txt('pay_add_to_shopping_cart');
         }
     } else {
         $button_txt = $this->lng->txt('pay_add_to_shopping_cart');
     }
     $rg_prices = new ilRadioGroupInputGUI($this->lng->txt('prices'), 'price_id');
     if (is_array($prices)) {
         foreach ($prices as $price) {
             if (is_array($buyedObject) && $buyedObject["price_id"] == $price['price_id']) {
                 $rg_prices->setValue($price['price_id']);
             } else {
                 if (count($prices) == 1) {
                     $rg_prices->setValue($price['price_id']);
                 }
             }
             switch ($price['price_type']) {
                 case ilPaymentPrices::TYPE_DURATION_MONTH:
                     $txt_price = $price['duration'] . ' ' . $this->lng->txt('paya_months') . ': ';
                     break;
                 case ilPaymentPrices::TYPE_DURATION_DATE:
                     $txt_price = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)) . ':  ';
                     break;
                 case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                     $txt_price = $this->lng->txt('unlimited_duration') . ': ';
                     break;
             }
             $tmp_price = $price['price'];
             $extension_txt = '';
             if ($price['extension'] == 1) {
                 $extension_txt = '(' . $this->lng->txt('extension_price') . ')';
             }
             $price_row = new ilRadioOption($txt_price . ' ' . ilPaymentPrices::_formatPriceToString((double) $tmp_price) . ' ' . $extension_txt, $price['price_id']);
             $price_row->setInfo($price['description']);
             $rg_prices->addOption($price_row);
         }
         $form->addItem($rg_prices);
     }
     $form->addCommandButton('addToShoppingCart', $button_txt);
     return $this->tpl->setContent($form->getHTML());
 }
 /**
  * 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);
     // 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));
 }
 /**
  * Init edit form
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initEditForm($a_mode = "edit")
 {
     global $lng, $ilCtrl, $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     if ($a_mode != "add_file") {
         // title
         $ti = new ilTextInputGUI($lng->txt("title"), "flst_title");
         $ti->setMaxLength(80);
         $ti->setSize(40);
         $form->addItem($ti);
         // language
         require_once "Services/MetaData/classes/class.ilMDLanguageItem.php";
         $lang = ilMDLanguageItem::_getLanguages();
         $si = new ilSelectInputGUI($lng->txt("language"), "flst_language");
         $si->setOptions($lang);
         $form->addItem($si);
     }
     if (in_array($a_mode, array("create", "add_file"))) {
         // file
         $fi = new ilFileInputGUI($lng->txt("file"), "file");
         $fi->setRequired(true);
         $form->addItem($fi);
     } else {
         if (in_array($a_mode, array("select_file"))) {
             // file
             $ne = new ilNonEditableValueGUI($lng->txt("file"), "");
             if (isset($_GET["file_ref_id"])) {
                 include_once "./Modules/File/classes/class.ilObjFile.php";
                 $file_obj = new ilObjFile((int) $_GET["file_ref_id"]);
                 if (is_object($file_obj)) {
                     // ref id as hidden input
                     $hi = new ilHiddenInputGUI("file_ref_id");
                     $hi->setValue((int) $_GET["file_ref_id"]);
                     $form->addItem($hi);
                     $ne->setValue($file_obj->getTitle());
                 }
             } else {
                 if (isset($_GET["fl_wsp_id"])) {
                     // we need the object id for the instance
                     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                     $tree = new ilWorkspaceTree($ilUser->getId());
                     $node = $tree->getNodeData((int) $_GET["fl_wsp_id"]);
                     include_once "./Modules/File/classes/class.ilObjFile.php";
                     $file_obj = new ilObjFile($node["obj_id"], false);
                     if (is_object($file_obj)) {
                         // ref id as hidden input
                         $hi = new ilHiddenInputGUI("file_ref_id");
                         $hi->setValue("wsp_" . (int) $node["obj_id"]);
                         $form->addItem($hi);
                         $ne->setValue($file_obj->getTitle());
                     }
                     $this->tpl->parseCurrentBlock();
                 }
             }
             $form->addItem($ne);
         }
     }
     switch ($a_mode) {
         case "edit":
             $ti->setValue($this->content_obj->getListTitle());
             $si->setValue($this->content_obj->getLanguage());
             $form->addCommandButton("saveProperties", $lng->txt("save"));
             $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
             $form->setTitle($lng->txt("cont_edit_file_list_properties"));
             break;
         case "create":
         case "select_file":
             if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
                 $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
             } else {
                 $s_lang = $ilUser->getLanguage();
             }
             $si->setValue($s_lang);
             $form->addCommandButton("create_flst", $lng->txt("save"));
             $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
             $form->setTitle($lng->txt("cont_insert_file_list"));
             break;
         case "add_file":
             $form->addCommandButton("insertNewFileItem", $lng->txt("save"));
             $form->addCommandButton("editFiles", $lng->txt("cancel"));
             $form->setTitle($lng->txt("cont_insert_file_item"));
             break;
     }
     $form->setFormAction($ilCtrl->getFormAction($this));
     return $form;
 }
 /**
  * Show course defined fields
  *
  * @access protected
  */
 protected function showCustomFields()
 {
     global $ilUser;
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     include_once 'Modules/Course/classes/Export/class.ilCourseUserData.php';
     if (!count($cdf_fields = ilCourseDefinedFieldDefinition::_getFields($this->container->getId()))) {
         return true;
     }
     $cdf = new ilNonEditableValueGUI($this->lng->txt('ps_crs_user_fields'));
     $cdf->setValue($this->lng->txt($this->type . '_ps_cdf_info'));
     $cdf->setRequired(true);
     foreach ($cdf_fields as $field_obj) {
         $course_user_data = new ilCourseUserData($ilUser->getId(), $field_obj->getId());
         switch ($field_obj->getType()) {
             case IL_CDF_TYPE_SELECT:
                 $select = new ilSelectInputGUI($field_obj->getName(), 'cdf[' . $field_obj->getId() . ']');
                 $select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                 $select->setOptions($field_obj->prepareSelectBox());
                 if ($field_obj->isRequired()) {
                     $select->setRequired(true);
                 }
                 $cdf->addSubItem($select);
                 break;
             case IL_CDF_TYPE_TEXT:
                 $text = new ilTextInputGUI($field_obj->getName(), 'cdf[' . $field_obj->getId() . ']');
                 $text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
                 $text->setSize(32);
                 $text->setMaxLength(255);
                 if ($field_obj->isRequired()) {
                     $text->setRequired(true);
                 }
                 $cdf->addSubItem($text);
                 break;
         }
     }
     $this->form->addItem($cdf);
     return true;
 }
 /**
  * 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);
     }
 }
 /**
  * Show Privacy settings
  *
  * @access public
  */
 public function showPrivacy()
 {
     $privacy = ilPrivacySettings::_getInstance();
     $this->tabs_gui->setTabActive('show_privacy');
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('ps_privacy_protection'));
     include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
     if (ilMemberAgreement::_hasAgreements()) {
         $html = new ilNonEditableValueGUI();
         $html->setValue($this->lng->txt('ps_warning_modify'));
         $form->addItem($html);
     }
     $value = array();
     if ($privacy->enabledCourseExport()) {
         $value[] = "export_course";
     }
     if ($privacy->enabledGroupExport()) {
         $value[] = "export_group";
     }
     if ($privacy->courseConfirmationRequired()) {
         $value[] = "export_confirm_course";
     }
     if ($privacy->groupConfirmationRequired()) {
         $value[] = "export_confirm_group";
     }
     if ($privacy->enabledGroupAccessTimes()) {
         $value[] = "grp_access_times";
     }
     if ($privacy->enabledCourseAccessTimes()) {
         $value[] = "crs_access_times";
     }
     $group = new ilCheckboxGroupInputGUI($this->lng->txt('ps_profile_export'), 'profile_protection');
     $group->setValue($value);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_course'));
     $check->setValue('export_course');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_groups'));
     $check->setValue('export_group');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_confirm'));
     $check->setValue('export_confirm_course');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_confirm_group'));
     $check->setValue('export_confirm_group');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_show_grp_access'));
     $check->setValue('grp_access_times');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_show_crs_access'));
     $check->setValue('crs_access_times');
     $group->addOption($check);
     $form->addItem($group);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_fora_statistics'), 'fora_statistics');
     $check->setInfo($this->lng->txt('enable_fora_statistics_desc'));
     $check->setChecked($privacy->enabledForaStatistics());
     $form->addItem($check);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_anonymous_fora'), 'anonymous_fora');
     $check->setInfo($this->lng->txt('enable_anonymous_fora_desc'));
     $check->setChecked($privacy->enabledAnonymousFora());
     $form->addItem($check);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd');
     $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc'));
     $check->setChecked($privacy->enabledSahsProtocolData());
     $form->addItem($check);
     $check = new ilCheckboxInputGui($this->lng->txt('rbac_log'), 'rbac_log');
     $check->setInfo($this->lng->txt('rbac_log_info'));
     $check->setChecked($privacy->enabledRbacLog());
     $form->addItem($check);
     $age = new ilNumberInputGUI($this->lng->txt('rbac_log_age'), 'rbac_log_age');
     $age->setInfo($this->lng->txt('rbac_log_age_info'));
     $age->setValue($privacy->getRbacLogAge());
     $age->setMinValue(1);
     $age->setMaxValue(24);
     $age->setSize(2);
     $age->setMaxLength(2);
     $check->addSubItem($age);
     $form->addCommandButton('save_privacy', $this->lng->txt('save'));
     $this->tpl->setContent($form->getHTML());
 }
 protected function initEditUserForm($a_user_id, $a_obj_id, $a_cancel = null)
 {
     global $lng, $ilCtrl;
     include_once 'Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($a_obj_id);
     $lp_mode = $olp->getCurrentMode();
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "updateUser"));
     $form->setTitle($lng->txt("edit") . ": " . ilObject::_lookupTitle($a_obj_id));
     $form->setDescription($lng->txt('trac_mode') . ": " . $olp->getModeText($lp_mode));
     include_once "Services/User/classes/class.ilUserUtil.php";
     $user = new ilNonEditableValueGUI($lng->txt("user"), null, true);
     $user->setValue(ilUserUtil::getNamePresentation($a_user_id, true));
     $form->addItem($user);
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $marks = new ilLPMarks($a_obj_id, $a_user_id);
     $type = ilObject::_lookupType($a_obj_id);
     if ($type != 'lm') {
         $mark = new ilTextInputGUI($lng->txt("trac_mark"), "mark");
         $mark->setValue($marks->getMark());
         $mark->setMaxLength(32);
         $form->addItem($mark);
     }
     $comm = new ilTextInputGUI($lng->txt("trac_comment"), "comment");
     $comm->setValue($marks->getComment());
     $form->addItem($comm);
     if ($lp_mode == ilLPObjSettings::LP_MODE_MANUAL || $lp_mode == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) {
         include_once "./Services/Tracking/classes/class.ilLPStatus.php";
         $completed = ilLPStatus::_lookupStatus($a_obj_id, $a_user_id);
         $status = new ilCheckboxInputGUI($lng->txt('trac_completed'), "completed");
         $status->setChecked($completed == ilLPStatus::LP_STATUS_COMPLETED_NUM);
         $form->addItem($status);
     }
     $form->addCommandButton("updateUser", $lng->txt('save'));
     if ($a_cancel) {
         $form->addCommandButton($a_cancel, $lng->txt('cancel'));
     }
     return $form;
 }
 /**
  * Edit settings.
  */
 public function settings()
 {
     global $lng, $ilAccess;
     $this->tabs_gui->setTabActive('settings');
     $form_settings = new ilSetting("certificate");
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('certificate_settings'));
     $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active");
     $active->setChecked($form_settings->get("active"));
     $form->addItem($active);
     $info = new ilNonEditableValueGUI($this->lng->txt("info"), "info");
     $info->setValue($this->lng->txt("certificate_usage"));
     $form->addItem($info);
     $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background");
     $bgimage->setRequired(FALSE);
     if (count($_POST)) {
         // handle the background upload
         if (strlen($_FILES["background"]["tmp_name"])) {
             if ($bgimage->checkInput()) {
                 $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]);
                 if ($result == FALSE) {
                     $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage"));
                 }
             }
         }
     }
     if (strlen($this->object->hasBackgroundImage())) {
         $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
     }
     $bgimage->setInfo($this->lng->txt("default_background_info"));
     $form->addItem($bgimage);
     $format = new ilSelectInputGUI($this->lng->txt("certificate_page_format"), "pageformat");
     $defaultformats = array("a4" => $this->lng->txt("certificate_a4"), "a4landscape" => $this->lng->txt("certificate_a4_landscape"), "a5" => $this->lng->txt("certificate_a5"), "a5landscape" => $this->lng->txt("certificate_a5_landscape"), "letter" => $this->lng->txt("certificate_letter"), "letterlandscape" => $this->lng->txt("certificate_letter_landscape"));
     $format->setOptions($defaultformats);
     $format->setValue($form_settings->get("pageformat"));
     $format->setInfo($this->lng->txt("certificate_page_format_info"));
     $form->addItem($format);
     if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
         $form->addCommandButton('save', $this->lng->txt('save'));
     }
     $this->tpl->setContent($form->getHTML());
     if (strcmp($this->ctrl->getCmd(), "save") == 0) {
         if ($_POST["background_delete"]) {
             $this->object->deleteBackgroundImage();
         }
     }
 }
 /**
  * initEditCustomForm
  *
  * @param string $a_mode values: create | edit
  */
 public function initForm($a_mode = "create")
 {
     global $ilCtrl, $lng;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt('dcl_edit_field'));
         $hidden_prop = new ilHiddenInputGUI("field_id");
         $this->form->addItem($hidden_prop);
         $this->form->setFormAction($ilCtrl->getFormAction($this), "update");
         $this->form->addCommandButton('update', $lng->txt('dcl_update_field'));
     } else {
         $this->form->setTitle($lng->txt('dcl_new_field'));
         $hidden_prop = new ilHiddenInputGUI("table_id");
         $hidden_prop->setValue($this->field_obj->getTableId());
         $this->form->addItem($hidden_prop);
         $this->form->setFormAction($ilCtrl->getFormAction($this), "save");
         $this->form->addCommandButton('save', $lng->txt('dcl_create_field'));
     }
     $this->form->addCommandButton('cancel', $lng->txt('cancel'));
     $text_prop = new ilTextInputGUI($lng->txt("title"), "title");
     $text_prop->setRequired(true);
     $text_prop->setInfo(sprintf($lng->txt('fieldtitle_allow_chars'), ilDataCollectionField::_getTitleValidChars(false)));
     $text_prop->setValidationRegexp(ilDataCollectionField::_getTitleValidChars(true));
     $this->form->addItem($text_prop);
     $edit_datatype = new ilRadioGroupInputGUI($lng->txt('dcl_datatype'), 'datatype');
     foreach (ilDataCollectionDatatype::getAllDatatypes() as $datatype) {
         $opt = new ilRadioOption($lng->txt('dcl_' . $datatype['title']), $datatype['id']);
         foreach (ilDataCollectionDatatype::getProperties($datatype['id']) as $property) {
             //Type Reference: List Tabels
             if ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE and $property['id'] == ilDataCollectionField::PROPERTYID_REFERENCE) {
                 $options = array();
                 // Get Tables
                 require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
                 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
                 foreach ($tables as $table) {
                     foreach ($table->getRecordFields() as $field) {
                         //referencing references may lead to endless loops.
                         if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
                             $options[$field->getId()] = $table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle();
                         }
                     }
                 }
                 $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']);
                 $table_selection->setOptions($options);
                 //$table_selection->setValue($this->table_id);
                 $opt->addSubItem($table_selection);
             } elseif ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCELIST and $property['id'] == ilDataCollectionField::PROPERTYID_N_REFERENCE) {
                 // Get Tables
                 require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
                 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
                 foreach ($tables as $table) {
                     foreach ($table->getRecordFields() as $field) {
                         //referencing references may lead to endless loops.
                         if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCELIST) {
                             $options[$field->getId()] = $table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle();
                         }
                     }
                 }
                 $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']);
                 $table_selection->setOptions($options);
                 $opt->addSubItem($table_selection);
             } elseif ($property['id'] == ilDataCollectionField::PROPERTYID_FORMULA_EXPRESSION) {
                 $table = ilDataCollectionCache::getTableCache((int) $_GET['table_id']);
                 $fields = array();
                 foreach ($table->getFieldsForFormula() as $f) {
                     $placeholder = $f->isStandardField() ? $f->getId() : $f->getTitle();
                     $fields[] = '<a class="dclPropExpressionField" data-placeholder="' . $placeholder . '">' . $f->getTitle() . '</a>';
                 }
                 $subitem = new ilTextAreaInputGUI($lng->txt('dcl_prop_expression'), 'prop_' . $property['id']);
                 $operators = implode(', ', array_keys(ilDclExpressionParser::getOperators()));
                 $functions = implode(', ', ilDclExpressionParser::getFunctions());
                 $subitem->setInfo(sprintf($lng->txt('dcl_prop_expression_info'), $operators, $functions, implode('<br>', $fields)));
                 $opt->addSubItem($subitem);
             } elseif ($property['datatype_id'] == $datatype['id']) {
                 //All other Types: List properties saved in propertie definition table
                 if ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN) {
                     $subitem = new ilCheckboxInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     $opt->addSubItem($subitem);
                 } elseif ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_NUMBER) {
                     $subitem = new ilNumberInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     // TODO: Nicer way to add additional info to fields (need changes in language-logic)
                     /*if($lng->txt('dcl_'.$property['title'].'_info') != '-dcl_'.$property['title'].'_info-') {
                     			$subitem->setInfo($lng->txt('dcl_'.$property['title'].'_info'));
                     		}*/
                     $subitem->setSize(5);
                     if ($property['title'] == 'length') {
                         $subitem->setMaxValue(4000);
                         $subitem->setInfo($lng->txt('dcl_' . $property['title'] . '_info'));
                     }
                     $opt->addSubItem($subitem);
                 } elseif ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_NON_EDITABLE_VALUE) {
                     $subitem = new ilNonEditableValueGUI($lng->txt('dcl_' . $property['title']));
                     $subitem->setValue(implode(', ', ilDataCollectionDatatype::$mob_suffixes));
                     $opt->addSubItem($subitem);
                 } else {
                     $subitem = new ilTextInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']);
                     // TODO: Nicer way to add additional info to fields (need changes in language-logic)
                     /*if($lng->txt('dcl_'.$property['title'].'_info') != '-dcl_'.$property['title'].'_info-') {
                     			$subitem->setInfo($lng->txt('dcl_'.$property['title'].'_info'));
                     		}*/
                     if ($property['title'] == 'regex') {
                         $subitem->setInfo($lng->txt('dcl_' . $property['title'] . '_info'));
                     }
                     $opt->addSubItem($subitem);
                 }
             }
         }
         $edit_datatype->addOption($opt);
     }
     $edit_datatype->setRequired(true);
     //you can't change type but we still need it in POST
     if ($a_mode == "edit") {
         $edit_datatype->setDisabled(true);
     }
     $this->form->addItem($edit_datatype);
     // Description
     $text_prop = new ilTextAreaInputGUI($lng->txt("dcl_field_description"), "description");
     $this->form->addItem($text_prop);
     // Required
     $cb = new ilCheckboxInputGUI($lng->txt("dcl_field_required"), "required");
     $this->form->addItem($cb);
     //Unique
     $cb = new ilCheckboxInputGUI($lng->txt("dcl_unique"), "unique");
     $this->form->addItem($cb);
 }
 protected function initFormTimeBuffer(ilPropertyFormGUI $form)
 {
     $tbuffer = new ilNonEditableValueGUI(ilViteroPlugin::getInstance()->txt('time_buffer'), 'dummy');
     // Buffer before
     $buffer_before = new ilSelectInputGUI(ilViteroPlugin::getInstance()->txt('time_buffer_before'), 'buffer_before');
     $buffer_before->setOptions(array(0 => '0 min', 15 => '15 min', 30 => '30 min', 45 => '45 min', 60 => '1 h'));
     $buffer_before->setValue(ilViteroSettings::getInstance()->getStandardGracePeriodBefore());
     $tbuffer->addSubItem($buffer_before);
     // Buffer after
     $buffer_after = new ilSelectInputGUI(ilViteroPlugin::getInstance()->txt('time_buffer_after'), 'buffer_after');
     $buffer_after->setOptions(array(0 => '0 min', 15 => '15 min', 30 => '30 min', 45 => '45 min', 60 => '1 h'));
     $buffer_after->setValue(ilViteroSettings::getInstance()->getStandardGracePeriodAfter());
     $tbuffer->addSubItem($buffer_after);
     $form->addItem($tbuffer);
     return true;
 }
 /**
  * Add standard fields to form
  */
 function addStandardFieldsToForm($a_form, $a_user = NULL, array $custom_fields = NULL)
 {
     global $ilSetting, $lng, $rbacreview, $ilias;
     // custom registration settings
     if (self::$mode == self::MODE_REGISTRATION) {
         include_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
         $registration_settings = new ilRegistrationSettings();
         self::$user_field["username"]["group"] = "login_data";
         self::$user_field["password"]["group"] = "login_data";
         self::$user_field["language"]["default"] = $lng->lang_key;
         // different position for role
         $roles = self::$user_field["roles"];
         unset(self::$user_field["roles"]);
         self::$user_field["roles"] = $roles;
         self::$user_field["roles"]["group"] = "settings";
     }
     $fields = $this->getStandardFields();
     $current_group = "";
     $custom_fields_done = false;
     foreach ($fields as $f => $p) {
         // next group? -> diplay subheader
         if ($p["group"] != $current_group && ilUserProfile::userSettingVisible($f)) {
             if (is_array($custom_fields) && !$custom_fields_done) {
                 // should be appended to "other" or at least before "settings"
                 if ($current_group == "other" || $p["group"] == "settings") {
                     // add "other" subheader
                     if ($current_group != "other") {
                         $sh = new ilFormSectionHeaderGUI();
                         $sh->setTitle($lng->txt("other"));
                         $a_form->addItem($sh);
                     }
                     foreach ($custom_fields as $custom_field) {
                         $a_form->addItem($custom_field);
                     }
                     $custom_fields_done = true;
                 }
             }
             $sh = new ilFormSectionHeaderGUI();
             $sh->setTitle($lng->txt($p["group"]));
             $a_form->addItem($sh);
             $current_group = $p["group"];
         }
         $m = "";
         if (isset($p["method"])) {
             $m = $p["method"];
         }
         $lv = isset($p["lang_var"]) && $p["lang_var"] != "" ? $p["lang_var"] : $f;
         switch ($p["input"]) {
             case "login":
                 if ((int) $ilSetting->get('allow_change_loginname') || self::$mode == self::MODE_REGISTRATION) {
                     $val = new ilTextInputGUI($lng->txt('username'), 'username');
                     if ($a_user) {
                         $val->setValue($a_user->getLogin());
                     }
                     $val->setMaxLength(32);
                     $val->setSize(40);
                     $val->setRequired(true);
                 } else {
                     // user account name
                     $val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un');
                     if ($a_user) {
                         $val->setValue($a_user->getLogin());
                     }
                 }
                 $a_form->addItem($val);
                 break;
             case "text":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ti->setValue($a_user->{$m}());
                     }
                     $ti->setMaxLength($p["maxlength"]);
                     $ti->setSize($p["size"]);
                     $ti->setRequired($ilSetting->get("require_" . $f));
                     if (!$ti->getRequired() || $ti->getValue()) {
                         $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ti);
                 }
                 break;
             case "sel_country":
                 if (ilUserProfile::userSettingVisible($f)) {
                     include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php";
                     $ci = new ilCountrySelectInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ci->setValue($a_user->{$m}());
                     }
                     $ci->setRequired($ilSetting->get("require_" . $f));
                     if (!$ci->getRequired() || $ci->getValue()) {
                         $ci->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ci);
                 }
                 break;
             case "birthday":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $bi = new ilBirthdayInputGUI($lng->txt($lv), "usr_" . $f);
                     include_once "./Services/Calendar/classes/class.ilDateTime.php";
                     $date = null;
                     if ($a_user && strlen($a_user->{$m}())) {
                         $date = new ilDateTime($a_user->{$m}(), IL_CAL_DATE);
                         $bi->setDate($date);
                     }
                     $bi->setShowEmpty(true);
                     $bi->setStartYear(1900);
                     $bi->setRequired($ilSetting->get("require_" . $f));
                     if (!$bi->getRequired() || $date) {
                         $bi->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($bi);
                 }
                 break;
             case "radio":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $rg = new ilRadioGroupInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $rg->setValue($a_user->{$m}());
                     }
                     foreach ($p["values"] as $k => $v) {
                         $op = new ilRadioOption($lng->txt($v), $k);
                         $rg->addOption($op);
                     }
                     $rg->setRequired($ilSetting->get("require_" . $f));
                     if (!$rg->getRequired() || $rg->getValue()) {
                         $rg->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($rg);
                 }
                 break;
             case "picture":
                 if (ilUserProfile::userSettingVisible("upload") && $a_user) {
                     $ii = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
                     $ii->setDisabled($ilSetting->get("usr_settings_disable_upload"));
                     $upload = $a_form->getFileUpload("userfile");
                     if ($upload["name"]) {
                         $ii->setPending($upload["name"]);
                     } else {
                         $im = ilObjUser::_getPersonalPicturePath($a_user->getId(), "small", true, true);
                         if ($im != "") {
                             $ii->setImage($im);
                             $ii->setAlt($lng->txt("personal_picture"));
                         }
                     }
                     // ilinc link as info
                     if (ilUserProfile::userSettingVisible("upload") and $ilSetting->get("ilinc_active")) {
                         include_once './Modules/ILinc/classes/class.ilObjiLincUser.php';
                         $ilinc_user = new ilObjiLincUser($a_user);
                         if ($ilinc_user->id) {
                             include_once './Modules/ILinc/classes/class.ilnetucateXMLAPI.php';
                             $ilincAPI = new ilnetucateXMLAPI();
                             $ilincAPI->uploadPicture($ilinc_user);
                             $response = $ilincAPI->sendRequest("uploadPicture");
                             // return URL to user's personal page
                             $url = trim($response->data['url']['cdata']);
                             $desc = $lng->txt("ilinc_upload_pic_text") . " " . '<a href="' . $url . '">' . $lng->txt("ilinc_upload_pic_linktext") . '</a>';
                             $ii->setInfo($desc);
                         }
                     }
                     $a_form->addItem($ii);
                 }
                 break;
             case "roles":
                 if (self::$mode == self::MODE_DESKTOP) {
                     if (ilUserProfile::userSettingVisible("roles")) {
                         $global_roles = $rbacreview->getGlobalRoles();
                         foreach ($global_roles as $role_id) {
                             if (in_array($role_id, $rbacreview->assignedRoles($a_user->getId()))) {
                                 $roleObj = $ilias->obj_factory->getInstanceByObjId($role_id);
                                 $role_names .= $roleObj->getTitle() . ", ";
                                 unset($roleObj);
                             }
                         }
                         $dr = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr");
                         $dr->setValue(substr($role_names, 0, -2));
                         $a_form->addItem($dr);
                     }
                 } else {
                     if (self::$mode == self::MODE_REGISTRATION) {
                         if ($registration_settings->roleSelectionEnabled()) {
                             include_once "./Services/AccessControl/classes/class.ilObjRole.php";
                             $options = array();
                             foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
                                 $options[$role["id"]] = $role["title"];
                             }
                             // registration form validation will take care of missing field / value
                             if ($options) {
                                 if (sizeof($options) > 1) {
                                     $ta = new ilSelectInputGUI($lng->txt('default_role'), "usr_" . $f);
                                     $ta->setOptions($options);
                                     $ta->setRequired($ilSetting->get("require_" . $f));
                                     if (!$ta->getRequired()) {
                                         $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                                     }
                                 } else {
                                     $ta = new ilHiddenInputGUI("usr_" . $f);
                                     $ta->setValue(array_shift(array_keys($options)));
                                 }
                                 $a_form->addItem($ta);
                             }
                         }
                     }
                 }
                 break;
             case "email":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $em = new ilEMailInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $em->setValue($a_user->{$m}());
                     }
                     $em->setRequired($ilSetting->get("require_" . $f));
                     if (!$em->getRequired() || $em->getValue()) {
                         $em->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     if (self::MODE_REGISTRATION == self::$mode) {
                         $em->setRetype(true);
                     }
                     $a_form->addItem($em);
                 }
                 break;
             case "textarea":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ta = new ilTextAreaInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ta->setValue($a_user->{$m}());
                     }
                     $ta->setRows($p["rows"]);
                     $ta->setCols($p["cols"]);
                     $ta->setRequired($ilSetting->get("require_" . $f));
                     if (!$ta->getRequired() || $ta->getValue()) {
                         $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ta);
                 }
                 break;
             case "messenger":
                 if (ilUserProfile::userSettingVisible("instant_messengers")) {
                     $im_arr = $p["types"];
                     foreach ($im_arr as $im_name) {
                         $im = new ilTextInputGUI($lng->txt("im_" . $im_name), "usr_im_" . $im_name);
                         if ($a_user) {
                             $im->setValue($a_user->getInstantMessengerId($im_name));
                         }
                         $im->setMaxLength($p["maxlength"]);
                         $im->setSize($p["size"]);
                         $im->setRequired($ilSetting->get("require_" . "instant_messengers"));
                         if (!$im->getRequired() || $im->getValue()) {
                             $im->setDisabled($ilSetting->get("usr_settings_disable_" . "instant_messengers"));
                         }
                         $a_form->addItem($im);
                     }
                 }
                 break;
             case "password":
                 if (self::$mode == self::MODE_REGISTRATION) {
                     if (!$registration_settings->passwordGenerationEnabled()) {
                         $ta = new ilPasswordInputGUI($lng->txt($lv), "usr_" . $f);
                         $ta->setRequired(true);
                         // $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
                     } else {
                         $ta = new ilNonEditableValueGUI($lng->txt($lv));
                         $ta->setValue($lng->txt("reg_passwd_via_mail"));
                     }
                     $a_form->addItem($ta);
                 }
                 break;
             case "language":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ta = new ilSelectInputGUI($lng->txt($lv), "usr_" . $f);
                     if ($a_user) {
                         $ta->setValue($a_user->{$m}());
                     }
                     $options = array();
                     $lng->loadLanguageModule("meta");
                     foreach ($lng->getInstalledLanguages() as $lang_key) {
                         $options[$lang_key] = $lng->txt("meta_l_" . $lang_key);
                     }
                     asort($options);
                     // #9728
                     $ta->setOptions($options);
                     $ta->setRequired($ilSetting->get("require_" . $f));
                     if (!$ta->getRequired() || $ta->getValue()) {
                         $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     $a_form->addItem($ta);
                 }
                 break;
             case "multitext":
                 if (ilUserProfile::userSettingVisible($f)) {
                     $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f);
                     $ti->setMulti(true);
                     if ($a_user) {
                         $ti->setValue($a_user->{$m}());
                     }
                     $ti->setMaxLength($p["maxlength"]);
                     $ti->setSize($p["size"]);
                     $ti->setRequired($ilSetting->get("require_" . $f));
                     if (!$ti->getRequired() || $ti->getValue()) {
                         $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
                     }
                     if ($this->ajax_href) {
                         // add field to ajax call
                         $ti->setDataSource($this->ajax_href . "&f=" . $f);
                     }
                     $a_form->addItem($ti);
                 }
                 break;
         }
     }
     // append custom fields as "other"
     if (is_array($custom_fields) && !$custom_fields_done) {
         // add "other" subheader
         if ($current_group != "other") {
             $sh = new ilFormSectionHeaderGUI();
             $sh->setTitle($lng->txt("other"));
             $a_form->addItem($sh);
         }
         foreach ($custom_fields as $custom_field) {
             $a_form->addItem($custom_field);
         }
     }
 }
 /**
  * Init settings form.
  */
 public function initSettingsForm()
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
     $ti->setMaxLength(128);
     $ti->setSize(40);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // description
     $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
     $ta->setCols(40);
     $ta->setRows(2);
     $this->form->addItem($ta);
     // online
     $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
     $cb->setOptionTitle($lng->txt(""));
     $cb->setValue("y");
     $this->form->addItem($cb);
     // startfile
     require_once "./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
     $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
     $ne = new ilNonEditableValueGUI($lng->txt("cont_startfile"), "");
     if ($startfile != "") {
         $ne->setValue(basename($startfile));
     } else {
         $ne->setValue(basename($this->lng->txt("no_start_file")));
     }
     $this->form->addItem($ne);
     $this->form->addCommandButton("saveProperties", $lng->txt("save"));
     $this->form->addCommandButton("toFilesystem", $lng->txt("cont_set_start_file"));
     $this->form->setTitle($lng->txt("cont_lm_properties"));
     $this->form->setFormAction($ilCtrl->getFormAction($this, "saveProperties"));
 }
 /**
  * Init settings form.
  */
 public function initSettingsForm()
 {
     global $lng, $ilCtrl, $ilAccess;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
     $ti->setSize(min(40, ilObject::TITLE_LENGTH));
     $ti->setMaxLength(ilObject::TITLE_LENGTH);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // description
     $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
     $ta->setCols(40);
     $ta->setRows(2);
     $this->form->addItem($ta);
     // online
     $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
     $cb->setOptionTitle($lng->txt(""));
     $cb->setValue("y");
     $this->form->addItem($cb);
     // startfile
     require_once "./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
     $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
     $ne = new ilNonEditableValueGUI($lng->txt("cont_startfile"), "");
     if ($startfile != "") {
         $ne->setValue(basename($startfile));
     } else {
         $ne->setValue(basename($this->lng->txt("no_start_file")));
     }
     $this->form->addItem($ne);
     include_once "Services/License/classes/class.ilLicenseAccess.php";
     if (ilLicenseAccess::_isEnabled()) {
         $lic = new ilCheckboxInputGUI($lng->txt("cont_license"), "lic");
         $lic->setInfo($lng->txt("cont_license_info"));
         $this->form->addItem($lic);
         if (!$ilAccess->checkAccess('edit_permission', '', $this->ref_id)) {
             $lic->setDisabled(true);
         }
     }
     $bib = new ilCheckboxInputGUI($lng->txt("cont_biblio"), "bib");
     $bib->setInfo($lng->txt("cont_biblio_info"));
     $this->form->addItem($bib);
     $this->form->addCommandButton("saveProperties", $lng->txt("save"));
     $this->form->addCommandButton("toFilesystem", $lng->txt("cont_set_start_file"));
     $this->form->setTitle($lng->txt("cont_lm_properties"));
     $this->form->setFormAction($ilCtrl->getFormAction($this, "saveProperties"));
 }
 /**
  * Init form table for new role assignments
  *
  * @param string mode edit | create
  * @param object object of ilLDAPRoleAsssignmentRule
  * @access protected
  * 
  */
 protected function initFormRoleAssignments($a_mode)
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once 'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     switch ($a_mode) {
         case 'edit':
             $this->form->setTitle($this->lng->txt('ldap_edit_role_ass_rule'));
             $this->form->addCommandButton('updateRoleAssignment', $this->lng->txt('save'));
             $this->form->addCommandButton('roleAssignments', $this->lng->txt('cancel'));
             break;
         case 'create':
             $this->form->setTitle($this->lng->txt('ldap_add_role_ass_rule'));
             $this->form->addCommandButton('addRoleAssignment', $this->lng->txt('ldap_btn_add_role_ass'));
             $this->form->addCommandButton('roleAssignments', $this->lng->txt('cancel'));
             break;
     }
     // Role Selection
     $role = new ilRadioGroupInputGUI($this->lng->txt('ldap_ilias_role'), 'role_name');
     $role->setRequired(true);
     $global = new ilRadioOption($this->lng->txt('ldap_global_role'), 0);
     $role->addOption($global);
     $role_select = new ilSelectInputGUI('', 'role_id');
     $role_select->setOptions($this->prepareGlobalRoleSelection());
     $global->addSubItem($role_select);
     $local = new ilRadioOption($this->lng->txt('ldap_local_role'), 1);
     $role->addOption($local);
     include_once './Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php';
     $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject');
     $role_search->setSize(40);
     $local->addSubItem($role_search);
     $role->setInfo($this->lng->txt('ldap_role_name_info'));
     $this->form->addItem($role);
     // Update options
     $update = new ilNonEditableValueGUI($this->lng->txt('ldap_update_roles'), 'update_roles');
     $update->setValue($this->lng->txt('ldap_check_role_assignment'));
     $add = new ilCheckboxInputGUI('', 'add_missing');
     $add->setOptionTitle($this->lng->txt('ldap_add_missing'));
     $update->addSubItem($add);
     $remove = new ilCheckboxInputGUI('', 'remove_deprecated');
     $remove->setOptionTitle($this->lng->txt('ldap_remove_deprecated'));
     $update->addSubItem($remove);
     $this->form->addItem($update);
     // Assignment Type
     $group = new ilRadioGroupInputGUI($this->lng->txt('ldap_assignment_type'), 'type');
     #$group->setValue($current_rule->getType());
     $group->setRequired(true);
     // Option by group
     $radio_group = new ilRadioOption($this->lng->txt('ldap_role_by_group'), ilLDAPRoleAssignmentRule::TYPE_GROUP);
     $dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'), 'dn');
     #$dn->setValue($current_rule->getDN());
     $dn->setSize(32);
     $dn->setMaxLength(512);
     $dn->setInfo($this->lng->txt('ldap_role_grp_dn_info'));
     $radio_group->addSubItem($dn);
     $at = new ilTextInputGUI($this->lng->txt('ldap_role_grp_at'), 'at');
     #$at->setValue($current_rule->getMemberAttribute());
     $at->setSize(16);
     $at->setMaxLength(128);
     $radio_group->addSubItem($at);
     $isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_role_grp_isdn'), 'isdn');
     #$isdn->setChecked($current_rule->isMemberAttributeDN());
     $isdn->setInfo($this->lng->txt('ldap_group_member_info'));
     $radio_group->addSubItem($isdn);
     $radio_group->setInfo($this->lng->txt('ldap_role_grp_info'));
     $group->addOption($radio_group);
     // Option by Attribute
     $radio_attribute = new ilRadioOption($this->lng->txt('ldap_role_by_attribute'), ilLDAPRoleAssignmentRule::TYPE_ATTRIBUTE);
     $name = new ilTextInputGUI($this->lng->txt('ldap_role_at_name'), 'name');
     #$name->setValue($current_rule->getAttributeName());
     $name->setSize(32);
     $name->setMaxLength(128);
     #$name->setInfo($this->lng->txt('ldap_role_at_name_info'));
     $radio_attribute->addSubItem($name);
     // Radio Attribute
     $val = new ilTextInputGUI($this->lng->txt('ldap_role_at_value'), 'value');
     #$val->setValue($current_rule->getAttributeValue());
     $val->setSize(32);
     $val->setMaxLength(128);
     #$val->setInfo($this->lng->txt('ldap_role_at_value_info'));
     $radio_attribute->addSubItem($val);
     $radio_attribute->setInfo($this->lng->txt('ldap_role_at_info'));
     $group->addOption($radio_attribute);
     // Option by Plugin
     $pl_active = (bool) $this->hasActiveRoleAssignmentPlugins();
     $pl = new ilRadioOption($this->lng->txt('ldap_plugin'), 3);
     $pl->setInfo($this->lng->txt('ldap_plugin_info'));
     $pl->setDisabled(!$pl_active);
     $id = new ilNumberInputGUI($this->lng->txt('ldap_plugin_id'), 'plugin_id');
     $id->setDisabled(!$pl_active);
     $id->setSize(3);
     $id->setMaxLength(3);
     $id->setMaxValue(999);
     $id->setMinValue(1);
     $pl->addSubItem($id);
     $group->addOption($pl);
     $this->form->addItem($group);
 }
 /**
  * 
  * @param
  * @return
  */
 protected function initPropertiesForm()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->lng->loadLanguageModule('file');
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this), 'update');
     $form->setTitle($this->lng->txt('file_edit'));
     $form->addCommandButton('update', $this->lng->txt('save'));
     $form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $title->setValue($this->object->getTitle());
     $title->setInfo($this->lng->txt("if_no_title_then_filename"));
     $form->addItem($title);
     $upload_possible = true;
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
         $upload_possible = ilDiskQuotaHandler::isUploadPossible();
     }
     if ($upload_possible) {
         $file = new ilFileInputGUI($this->lng->txt('obj_file'), 'file');
         $file->setRequired(false);
         //		$file->enableFileNameSelection('title');
         $form->addItem($file);
         $group = new ilRadioGroupInputGUI('', 'replace');
         $group->setValue(0);
         $replace = new ilRadioOption($this->lng->txt('replace_file'), 1);
         $replace->setInfo($this->lng->txt('replace_file_info'));
         $group->addOption($replace);
         $keep = new ilRadioOption($this->lng->txt('file_new_version'), 0);
         $keep->setInfo($this->lng->txt('file_new_version_info'));
         $group->addOption($keep);
         $file->addSubItem($group);
     } else {
         $file = new ilNonEditableValueGUI($this->lng->txt('obj_file'));
         $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning"));
         $form->addItem($file);
     }
     $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $desc->setRows(3);
     #$desc->setCols(40);
     $form->addItem($desc);
     if ($this->id_type == self::REPOSITORY_NODE_ID) {
         $this->lng->loadLanguageModule('rating');
         $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
         $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
         $form->addItem($rate);
     }
     return $form;
 }
 /**
  * Init form settings
  */
 protected function dInitFormTreeSettings(ilPropertyFormGUI $form = null)
 {
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
     include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
     if ($form instanceof ilPropertyFormGUI) {
         return $form;
     }
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
     $assignment = new ilECSNodeMappingAssignment($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid'], 0);
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'dEditTree'));
     $form->setTitle($this->lng->txt('general_settings'));
     $form->addCommandButton('dUpdateTreeSettings', $this->lng->txt('save'));
     $form->addCommandButton('dTrees', $this->lng->txt('cancel'));
     $form->setTableWidth('30%');
     // CMS id (readonly)
     include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
     $cmsid = new ilNumberInputGUI($this->lng->txt('ecs_cms_id'), 'cmsid');
     $cmsid->setValue(ilECSCmsData::lookupCmsId(ilECSCmsTree::lookupRootId((int) $_REQUEST['tid'])));
     $cmsid->setDisabled(true);
     $cmsid->setSize(7);
     $cmsid->setMaxLength(12);
     $form->addItem($cmsid);
     $mapping_status = ilECSMappingUtils::lookupMappingStatus($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid']);
     $mapping_advanced = $mapping_status != ilECSMappingUtils::MAPPED_MANUAL ? true : false;
     // Status (readonly)
     $status = new ilNonEditableValueGUI($this->lng->txt('status'), '');
     $status->setValue(ilECSMappingUtils::mappingStatusToString($mapping_status));
     $form->addItem($status);
     // title update
     $title = new ilCheckboxInputGUI($this->lng->txt('ecs_title_updates'), 'title');
     $title->setValue(1);
     $title->setChecked($assignment->isTitleUpdateEnabled());
     #$title->setInfo($this->lng->txt('ecs_title_update_info'));
     $form->addItem($title);
     $position = new ilCheckboxInputGUI($this->lng->txt('ecs_position_updates'), 'position');
     $position->setDisabled(!$mapping_advanced);
     $position->setChecked($mapping_advanced && $assignment->isPositionUpdateEnabled());
     $position->setValue(1);
     #$position->setInfo($this->lng->txt('ecs_position_update_info'));
     $form->addItem($position);
     $tree = new ilCheckboxInputGUI($this->lng->txt('ecs_tree_updates'), 'tree');
     $tree->setDisabled(!$mapping_advanced);
     $tree->setChecked($mapping_advanced && $assignment->isTreeUpdateEnabled());
     $tree->setValue(1);
     #$tree->setInfo($this->lng->txt('ecs_tree_update_info'));
     $form->addItem($tree);
     return $form;
 }
 public function addCustomer()
 {
     global $ilToolbar, $ilCtrl;
     isset($_POST['sell_id']) ? $sell_id = $_POST['sell_id'] : ($sell_id = $_GET['sell_id']);
     isset($_POST['user_id']) ? $user_id = $_POST['user_id'] : ($user_id = $_GET['user_id']);
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html", 'Services/Payment');
     $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUser'));
     $ilCtrl->setParameter($this, "sell_id", $sell_id);
     $ilCtrl->setParameter($this, "user_id", $user_id);
     $pObjectId = ilPaymentObject::_lookupPobjectId($sell_id);
     $obj = new ilPaymentObject($this->user_obj, $pObjectId);
     // get obj
     $tmp_obj = ilObjectFactory::getInstanceByRefId($sell_id, false);
     if ($tmp_obj) {
         $tmp_object['title'] = $tmp_obj->getTitle();
     } else {
         $tmp_object['title'] = $this->lng->txt('object_not_found');
     }
     // get customer_obj
     $tmp_user = ilObjectFactory::getInstanceByObjId($user_id);
     // get vendor_obj
     $tmp_vendor = ilObjectFactory::getInstanceByObjId($obj->getVendorId());
     $oForm = new ilPropertyFormGUI();
     $oForm->setFormAction($ilCtrl->getFormAction($this, 'saveCustomer'));
     $oForm->setTitle($this->lng->txt($tmp_user->getFullname() . ' [' . $tmp_user->getLogin() . ']'));
     //transaction
     $oTransaction = new ilTextInputGUI();
     $oTransaction->setTitle($this->lng->txt('paya_transaction'));
     $oTransaction->setValue(ilUtil::prepareFormOutput($_POST['transaction'], true));
     $oTransaction->setPostVar('transaction');
     $oForm->addItem($oTransaction);
     //object
     $oObject = new ilNonEditableValueGUI($this->lng->txt('title'));
     $oObject->setValue($tmp_obj->getTitle());
     $oForm->addItem($oObject);
     //vendor
     $oVendor = new ilNonEditableValueGUI($this->lng->txt('paya_vendor'));
     $oVendor->setValue($tmp_vendor->getFullname() . ' [' . $tmp_vendor->getLogin() . ']');
     $oForm->addItem($oVendor);
     // pay methods
     $oPayMethods = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
     $payOptions = ilPayMethods::getPayMethodsOptions(false);
     $oPayMethods->setOptions($payOptions);
     $oPayMethods->setValue($_POST['pay_method']);
     $oPayMethods->setPostVar('pay_method');
     $oForm->addItem($oPayMethods);
     //duration
     $duration_options = array();
     $price_obj = new ilPaymentPrices($pObjectId);
     $standard_prices = array();
     $extension_prices = array();
     $standard_prices = $price_obj->getPrices();
     $extension_prices = $price_obj->getExtensionPrices();
     $prices = array_merge($standard_prices, $extension_prices);
     if (is_array($prices)) {
         $genSet = ilPaymentSettings::_getInstance();
         $currency_unit = $genSet->get('currency_unit');
         foreach ($prices as $price) {
             switch ($price['price_type']) {
                 case ilPaymentPrices::TYPE_DURATION_MONTH:
                     $txt_duration = $price['duration'] . ' ' . $this->lng->txt('paya_months') . ' -> ' . $price['price'] . ' ' . $currency_unit;
                     break;
                 case ilPaymentPrices::TYPE_DURATION_DATE:
                     include_once './Services/Calendar/classes/class.ilDatepresentation.php';
                     $txt_duration = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)) . " -> " . ilPaymentPrices::_getPriceString($price["price_id"]) . ' ' . $currency_unit;
                     break;
                 case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                     $txt_duration = $this->lng->txt('unlimited_duration') . ' -> ' . $price['price'] . ' ' . $currency_unit;
                     break;
             }
             $txt_extension = '';
             if ($price['extension'] == 1) {
                 $txt_extension = ' (' . $this->lng->txt('extension_price') . ') ';
             }
             $duration_options[$price['price_id']] = $txt_duration . '' . $txt_extension;
         }
     }
     $oDuration = new ilSelectInputGUI($this->lng->txt('duration'), 'duration');
     $oDuration->setOptions($duration_options);
     $oDuration->setValue($_POST['duration']);
     $oForm->addItem($oDuration);
     //payed
     $o_payed = new ilSelectInputGUI();
     $payed_option = array('1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_payed->setTitle($this->lng->txt('paya_payed'));
     $o_payed->setOptions($payed_option);
     $o_payed->setValue($_POST['payed']);
     $o_payed->setPostVar('payed');
     $oForm->addItem($o_payed);
     $o_access = new ilSelectInputGUI();
     $access_option = array('1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_access->setTitle($this->lng->txt('paya_access'));
     $o_access->setOptions($access_option);
     $o_access->setValue($_POST['access']);
     $o_access->setPostVar('access');
     $oForm->addItem($o_access);
     $oForm->addCommandButton('saveCustomer', $this->lng->txt('save'));
     $oForm->addCommandButton('showStatistics', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $oForm->getHTML());
 }
 /**
  * Init survey settings form
  * 
  * @return ilPropertyFormGUI
  */
 function initPropertiesForm()
 {
     $template_settings = $hide_rte_switch = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template);
         $template_settings = $template->getSettings();
         $hide_rte_switch = $template_settings["rte_switch"]["hide"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("survey_properties");
     // general properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("settings"));
     $form->addItem($header);
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->object->getId(), 0, "svy");
     $md_section = $md_obj->getGeneral();
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(true);
     $title->setValue($md_section->getTitle());
     $form->addItem($title);
     $ids = $md_section->getDescriptionIds();
     if ($ids) {
         $desc_obj = $md_section->getDescription(array_pop($ids));
         $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
         $desc->setCols(50);
         $desc->setRows(4);
         $desc->setValue($desc_obj->getDescription());
         $form->addItem($desc);
     }
     // pool usage
     $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
     $pool_usage->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
     $pool_usage->addOption($opt);
     $pool_usage->setValue($this->object->getPoolUsage());
     $form->addItem($pool_usage);
     // 360°: appraisees
     if ($this->object->get360Mode()) {
         $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
         $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info"));
         $self_eval->setChecked($this->object->get360SelfEvaluation());
         $form->addItem($self_eval);
         $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
         $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info"));
         $self_rate->setChecked($this->object->get360SelfRaters());
         $form->addItem($self_rate);
         $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
         $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info"));
         $self_appr->setChecked($this->object->get360SelfAppraisee());
         $form->addItem($self_appr);
     }
     // activation
     include_once "Services/Object/classes/class.ilObjectActivation.php";
     $this->lng->loadLanguageModule('rep');
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $form->addItem($section);
     // additional info only with multiple references
     $act_obj_info = $act_ref_info = "";
     if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
         $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
         $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
     }
     $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
     $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
     $online->setChecked($this->object->isOnline());
     $form->addItem($online);
     $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type');
     // $act_type->setInfo($this->lng->txt('svy_availability_until_info'));
     $act_type->setChecked($this->object->isActivationLimited());
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
     $dur->setShowTime(true);
     $date = $this->object->getActivationStartDate();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->object->getActivationEndDate();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $act_type->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
     $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info'));
     $visible->setChecked($this->object->getActivationVisibility());
     $act_type->addSubItem($visible);
     $form->addItem($act_type);
     // before start
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_before_start'));
     $form->addItem($section);
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction");
     $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->setInfo($this->lng->txt("survey_introduction_info"));
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->addButton("pastelatex");
     $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($intro);
     // access
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_access'));
     $form->addItem($section);
     // enable start date
     $start = $this->object->getStartDate();
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date");
     $enablestartingtime->setValue(1);
     // $enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     $enablestartingtime->setChecked($start);
     // start date
     $startingtime = new ilDateTimeInputGUI('', 'start_date');
     $startingtime->setShowTime(true);
     if ($start) {
         $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     // enable end date
     $end = $this->object->getEndDate();
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date");
     $enableendingtime->setValue(1);
     // $enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     $enableendingtime->setChecked($end);
     // end date
     $endingtime = new ilDateTimeInputGUI('', 'end_date');
     $endingtime->setShowTime(true);
     if ($end) {
         $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // anonymization
     if (!$this->object->get360Mode()) {
         $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes");
         $codes->setInfo($this->lng->txt("survey_access_codes_info"));
         $codes->setChecked(!$this->object->isAccessibleWithoutCode());
         $form->addItem($codes);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $codes->setDisabled(true);
         }
     }
     // question behaviour
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour'));
     $form->addItem($section);
     // show question titles
     $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles");
     $show_question_titles->setValue(1);
     $show_question_titles->setChecked($this->object->getShowQuestionTitles());
     $form->addItem($show_question_titles);
     // finishing
     $info = new ilFormSectionHeaderGUI();
     $info->setTitle($this->lng->txt("svy_settings_section_finishing"));
     $form->addItem($info);
     $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own");
     $view_own->setInfo($this->lng->txt("svy_results_view_own_info"));
     $view_own->setChecked($this->object->hasViewOwnResults());
     $form->addItem($view_own);
     $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own");
     $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info"));
     $mail_own->setChecked($this->object->hasMailOwnResults());
     $form->addItem($mail_own);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro");
     $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->addButton("pastelatex");
     $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($finalstatement);
     // mail notification
     $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification");
     // $mailnotification->setOptionTitle($this->lng->txt("activate"));
     $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info"));
     // #11762
     $mailnotification->setValue(1);
     $mailnotification->setChecked($this->object->getMailNotification());
     // addresses
     $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses");
     $mailaddresses->setValue($this->object->getMailAddresses());
     $mailaddresses->setSize(80);
     $mailaddresses->setInfo($this->lng->txt('mailaddresses_info'));
     $mailaddresses->setRequired(true);
     // participant data
     $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata");
     $participantdata->setValue($this->object->getMailParticipantData());
     $participantdata->setRows(6);
     $participantdata->setCols(80);
     $participantdata->setUseRte(false);
     $participantdata->setInfo($this->lng->txt("mailparticipantdata_info"));
     // #12755 - because of privacy concerns we restrict user data to a minimum
     $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login");
     $txt = array();
     foreach ($placeholders as $placeholder => $caption) {
         $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption);
     }
     $txt = implode("<br />", $txt);
     $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true);
     $participantdatainfo->setValue($txt);
     $mailnotification->addSubItem($mailaddresses);
     $mailnotification->addSubItem($participantdata);
     $mailnotification->addSubItem($participantdatainfo);
     $form->addItem($mailnotification);
     // tutor notification - currently not available for 360°
     if (!$this->object->get360Mode()) {
         // parent course?
         global $tree;
         $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp");
         if (!$has_parent) {
             $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs");
         }
         $num_inv = sizeof($this->object->getInvitedUsers());
         // notification
         $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut");
         $tut->setChecked($this->object->getTutorNotificationStatus());
         $form->addItem($tut);
         $tut_logins = array();
         $tuts = $this->object->getTutorNotificationRecipients();
         if ($tuts) {
             foreach ($tuts as $tut_id) {
                 $tmp = ilObjUser::_lookupName($tut_id);
                 if ($tmp["login"]) {
                     $tut_logins[] = $tmp["login"];
                 }
             }
         }
         $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids");
         $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
         $tut_ids->setRequired(true);
         $tut_ids->setMulti(true);
         $tut_ids->setMultiValues($tut_logins);
         $tut_ids->setValue(array_shift($tut_logins));
         $tut->addSubItem($tut_ids);
         $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp");
         $tut_grp->setRequired(true);
         $tut_grp->setValue($this->object->getTutorNotificationTarget());
         $tut->addSubItem($tut_grp);
         $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $tut_grp->addOption($tut_grp_crs);
         $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $tut_grp->addOption($tut_grp_inv);
     }
     // reminders
     // reminder - currently not available for 360°
     if (!$this->object->get360Mode()) {
         $info = new ilFormSectionHeaderGUI();
         $info->setTitle($this->lng->txt("svy_settings_section_reminders"));
         $form->addItem($info);
         $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd");
         $rmd->setChecked($this->object->getReminderStatus());
         $form->addItem($rmd);
         $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start");
         $rmd_start->setRequired(true);
         $start = $this->object->getReminderStart();
         if ($start) {
             $rmd_start->setDate($start);
         }
         $rmd->addSubItem($rmd_start);
         $end = $this->object->getReminderEnd();
         $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end");
         $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end);
         if ($end) {
             $rmd_end->setDate($end);
         }
         $rmd->addSubItem($rmd_end);
         $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq");
         $rmd_freq->setRequired(true);
         $rmd_freq->setSize(3);
         $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days"));
         $rmd_freq->setValue($this->object->getReminderFrequency());
         $rmd_freq->setMinValue(1);
         $rmd->addSubItem($rmd_freq);
         $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp");
         $rmd_grp->setRequired(true);
         $rmd_grp->setValue($this->object->getReminderTarget());
         $rmd->addSubItem($rmd_grp);
         $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $rmd_grp->addOption($rmd_grp_crs);
         $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $rmd_grp->addOption($rmd_grp_inv);
     }
     // results
     $results = new ilFormSectionHeaderGUI();
     $results->setTitle($this->lng->txt("results"));
     $form->addItem($results);
     // evaluation access
     if (!$this->object->get360Mode()) {
         $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access");
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_off_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_all_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info"));
         $evaluation_access->addOption($option);
         $evaluation_access->setValue($this->object->getEvaluationAccess());
         $form->addItem($evaluation_access);
         $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options");
         $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers");
         $option->setInfo($this->lng->txt("survey_results_personalized_info"));
         $anonymization_options->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon");
         $option->setInfo($this->lng->txt("survey_results_anonymized_info"));
         $anonymization_options->addOption($option);
         $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers");
         $form->addItem($anonymization_options);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $anonymization_options->setDisabled(true);
         }
     } else {
         $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res");
         $ts_results->setValue($this->object->get360Results());
         $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE);
         $option->setInfo($this->lng->txt("survey_360_results_none_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN);
         $option->setInfo($this->lng->txt("survey_360_results_own_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL);
         $option->setInfo($this->lng->txt("survey_360_results_all_info"));
         $ts_results->addOption($option);
         $form->addItem($ts_results);
     }
     // competence service activation for 360 mode
     include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php";
     $skmg_set = new ilSkillManagementSettings();
     if ($this->object->get360Mode() && $skmg_set->isActivated()) {
         $other = new ilFormSectionHeaderGUI();
         $other->setTitle($this->lng->txt("other"));
         $form->addItem($other);
         $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service");
         $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info"));
         $skill_service->setChecked($this->object->get360SkillService());
         $form->addItem($skill_service);
     }
     $form->addCommandButton("saveProperties", $this->lng->txt("save"));
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
 /**
  * init form
  *
  * @access protected
  * @param string mode ('edit' | 'create')
  * @return
  */
 protected function initForm($a_mode, $a_as_milestone = false, $a_edit_single_app = false)
 {
     global $ilUser, $tpl;
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
     $this->form = new ilPropertyFormGUI();
     include_once './Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initDomEvent();
     $resp_info = false;
     switch ($a_mode) {
         case 'create':
             $this->ctrl->saveParameter($this, array('seed', 'idate'));
             $this->form->setFormAction($this->ctrl->getFormAction($this));
             if ($a_as_milestone) {
                 $this->form->setTitle($this->lng->txt('cal_new_ms'));
                 $this->form->addCommandButton('saveMilestone', $this->lng->txt('cal_add_milestone'));
                 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             } else {
                 $this->form->setTitle($this->lng->txt('cal_new_app'));
                 $this->form->addCommandButton('save', $this->lng->txt('cal_add_appointment'));
                 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             }
             break;
         case 'edit':
             if ($a_as_milestone) {
                 $this->form->setTitle($this->lng->txt('cal_edit_milestone'));
             } else {
                 $this->form->setTitle($this->lng->txt('cal_edit_appointment'));
             }
             $this->ctrl->saveParameter($this, array('seed', 'app_id', 'idate'));
             $this->form->setFormAction($this->ctrl->getFormAction($this));
             $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
             $cat = $ass->getFirstAssignment();
             include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
             $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat);
             $type = ilObject::_lookupType($cat_info['obj_id']);
             if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ && ($type == "grp" || $type == "crs")) {
                 $resp_info = true;
                 $this->form->addCommandButton('editResponsibleUsers', $this->lng->txt('cal_change_responsible_users'));
             }
             $this->form->addCommandButton('update', $this->lng->txt('save'));
             // $this->form->addCommandButton('askDelete',$this->lng->txt('delete'));
             $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
             break;
     }
     // title
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $title->setValue($this->app->getTitle());
     $title->setRequired(true);
     $title->setMaxLength(128);
     $title->setSize(32);
     $this->form->addItem($title);
     // calendar selection
     $calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'), 'calendar');
     if ($_POST['category']) {
         $calendar->setValue((int) $_POST['calendar']);
         $selected_calendar = (int) $_POST['calendar'];
     } else {
         if ($_GET['category_id']) {
             $calendar->setValue((int) $_GET['category_id']);
             $selected_calendar = (int) $_GET['category_id'];
         } elseif ($a_mode == 'edit') {
             $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
             $cat = $ass->getFirstAssignment();
             $calendar->setValue($cat);
             $selected_calendar = $cat;
         } elseif (isset($_GET['ref_id'])) {
             include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
             $obj_cal = ilObject::_lookupObjId($_GET['ref_id']);
             $calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal));
             $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal);
         }
     }
     $calendar->setRequired(true);
     $cats = ilCalendarCategories::_getInstance($ilUser->getId());
     $calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
     include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
     if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) {
         $notification_cals = $cats->getNotificationCalendars();
         $notification_cals = count($notification_cals) ? implode(',', $notification_cals) : '';
         $calendar->addCustomAttribute("onchange=\"ilToggleNotification(new Array(" . $notification_cals . "));\"");
     }
     $this->form->addItem($calendar);
     if (!$a_as_milestone) {
         include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
         $tpl->addJavaScript('./Services/Form/js/date_duration.js');
         $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
         $dur->setStartText($this->lng->txt('cal_start'));
         $dur->setEndText($this->lng->txt('cal_end'));
         $dur->enableToggleFullTime($this->lng->txt('cal_fullday_title'), $this->app->isFullday() ? true : false);
         $dur->setShowTime(true);
         $dur->setStart($this->app->getStart());
         $dur->setEnd($this->app->getEnd());
         $this->form->addItem($dur);
         // recurrence
         include_once './Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php';
         $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
         $rec->setRecurrence($this->rec);
         $this->form->addItem($rec);
         // location
         $where = new ilTextInputGUI($this->lng->txt('cal_where'), 'location');
         $where->setValue($this->app->getLocation());
         $where->setMaxLength(128);
         $where->setSize(32);
         $this->form->addItem($where);
     } else {
         $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'), 'event[start]');
         $deadline->setDate($this->app->getStart());
         $deadline->setShowTime(false);
         $deadline->setMinuteStepSize(5);
         $this->form->addItem($deadline);
         // completion
         $completion_vals = array();
         for ($i = 0; $i <= 100; $i += 5) {
             $completion_vals[$i] = $i . " %";
         }
         $compl = new ilSelectInputGUI($this->lng->txt('cal_task_completion'), 'completion');
         $compl->setOptions($completion_vals);
         $compl->setValue($this->app->getCompletion());
         $this->form->addItem($compl);
     }
     $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $desc->setValue($this->app->getDescription());
     $desc->setRows(5);
     $this->form->addItem($desc);
     if ($a_as_milestone && $a_mode == "edit" && $resp_info) {
         // users responsible
         $users = $this->app->readResponsibleUsers();
         $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'), $users);
         $delim = "";
         foreach ($users as $r) {
             $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
             $delim = "<br />";
         }
         if (count($users) > 0) {
             $resp->setValue($value);
         } else {
             $resp->setValue("-");
         }
         $this->form->addItem($resp);
     }
     if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
         $notu = new ilTextWizardInputGUI($this->lng->txt('cal_user_notification'), 'notu');
         $notu->setInfo($this->lng->txt('cal_user_notification_info'));
         $notu->setSize(20);
         $notu->setMaxLength(64);
         $values = array();
         foreach ($this->notification->getRecipients() as $rcp) {
             switch ($rcp['type']) {
                 case ilCalendarUserNotification::TYPE_USER:
                     $values[] = ilObjUser::_lookupLogin($rcp['usr_id']);
                     break;
                 case ilCalendarUserNotification::TYPE_EMAIL:
                     $values[] = $rcp['email'];
                     break;
             }
         }
         if (count($values)) {
             $notu->setValues($values);
         } else {
             $notu->setValues(array(''));
         }
         $this->form->addItem($notu);
     }
     // Notifications
     include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
     if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars())) {
         $selected_cal = new ilCalendarCategory($selected_calendar);
         $disabled = true;
         if ($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ) {
             if (ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp') {
                 $disabled = false;
             }
         }
         $tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js');
         $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'), 'not');
         $not->setInfo($this->lng->txt('cal_notification_info'));
         $not->setValue(1);
         $not->setChecked($this->app->isNotificationEnabled());
         $not->setDisabled($disabled);
         $this->form->addItem($not);
     }
 }
 /**
  * init general settings form
  * @return 
  */
 protected function initFormGeneralSettings()
 {
     global $ilSetting;
     $this->setSubTabs('settings');
     $this->tabs_gui->setTabActive('settings');
     $this->tabs_gui->setSubTabActive('general_settings');
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings'));
     $this->form->setTitle($this->lng->txt('general_settings'));
     $lua = new ilCheckboxInputGUI($this->lng->txt('enable_local_user_administration'), 'lua');
     $lua->setInfo($this->lng->txt('enable_local_user_administration_info'));
     $lua->setValue(1);
     $this->form->addItem($lua);
     $lrua = new ilCheckboxInputGUI($this->lng->txt('restrict_user_access'), 'lrua');
     $lrua->setInfo($this->lng->txt('restrict_user_access_info'));
     $lrua->setValue(1);
     $this->form->addItem($lrua);
     // enable alphabetical navigation in user administration
     $alph = new ilCheckboxInputGUI($this->lng->txt('user_adm_enable_alpha_nav'), 'user_adm_alpha_nav');
     //$alph->setInfo($this->lng->txt('restrict_user_access_info'));
     $alph->setValue(1);
     $this->form->addItem($alph);
     // account codes
     $code = new ilCheckboxInputGUI($this->lng->txt("user_account_code_setting"), "user_reactivate_code");
     $code->setInfo($this->lng->txt('user_account_code_setting_info'));
     $this->form->addItem($code);
     // delete own account
     $own = new ilCheckboxInputGUI($this->lng->txt("user_allow_delete_own_account"), "user_own_account");
     $this->form->addItem($own);
     $own_email = new ilEMailInputGUI($this->lng->txt("user_delete_own_account_notification_email"), "user_own_account_email");
     $own->addSubItem($own_email);
     // BEGIN SESSION SETTINGS
     // create session handling radio group
     $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type');
     // first option, fixed session duration
     $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED);
     // create session reminder subform
     $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled");
     $expires = ilSession::getSessionExpireValue();
     $time = ilFormat::_secondsToString($expires, true);
     $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" . sprintf($this->lng->txt('session_reminder_session_duration'), $time));
     $fixed->addSubItem($cb);
     // add session handling to radio group
     $ssettings->addOption($fixed);
     // second option, session control
     $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT);
     // add session control subform
     require_once 'Services/Authentication/classes/class.ilSessionControl.php';
     // this is the max count of active sessions
     // that are getting started simlutanously
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_count_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (min) idle time the session can be deleted,
     // if there are further requests for new sessions,
     // but max session count is reached yet
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_min_idle_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (max) idle timeout the session expires
     // and become invalid, so it is not considered anymore
     // when calculating current count of active sessions
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // this is the max duration that can elapse between the first and the secnd
     // request to the system before the session is immidietly deleted
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle_after_first_request'), 'session_max_idle_after_first_request');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info'));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // add session control to radio group
     $ssettings->addOption($ldsh);
     // add radio group to form
     if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $this->form->addItem($ssettings);
     } else {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config");
         $ti->setValue($this->lng->txt('session_config_maintenance_disabled'));
         $ssettings->setDisabled(true);
         $ti->addSubItem($ssettings);
         $this->form->addItem($ti);
     }
     // END SESSION SETTINGS
     $this->lng->loadLanguageModule('ps');
     $pass = new ilFormSectionHeaderGUI();
     $pass->setTitle($this->lng->txt('ps_password_settings'));
     $this->form->addItem($pass);
     // password generation
     $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation"), "passwd_auto_generate");
     $cb->setChecked($ilSetting->get("passwd_auto_generate"));
     $cb->setInfo($this->lng->txt("passwd_generation_info"));
     $this->form->addItem($cb);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'), 'password_change_on_first_login_enabled');
     $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info'));
     $this->form->addItem($check);
     include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_must_not_contain_loginame'), 'password_must_not_contain_loginame');
     $check->setInfo($this->lng->txt('ps_password_must_not_contain_loginame_info'));
     $this->form->addItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'), 'password_chars_and_numbers_enabled');
     //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled'));
     $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info'));
     $this->form->addItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'), 'password_special_chars_enabled');
     //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled'));
     $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info'));
     $this->form->addItem($check);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_min_length'), 'password_min_length');
     $text->setInfo($this->lng->txt('ps_password_min_length_info'));
     $text->setSize(1);
     $text->setMaxLength(2);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_length'), 'password_max_length');
     $text->setInfo($this->lng->txt('ps_password_max_length_info'));
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_uppercase_chars_num'), 'password_ucase_chars_num');
     $text->setInfo($this->lng->txt('ps_password_uppercase_chars_num_info'));
     $text->setMinValue(0);
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_lowercase_chars_num'), 'password_lowercase_chars_num');
     $text->setInfo($this->lng->txt('ps_password_lowercase_chars_num_info'));
     $text->setMinValue(0);
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_age'), 'password_max_age');
     $text->setInfo($this->lng->txt('ps_password_max_age_info'));
     $text->setSize(2);
     $text->setMaxLength(3);
     $this->form->addItem($text);
     // password assistance
     $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance");
     $cb->setInfo($this->lng->txt("password_assistance_info"));
     $this->form->addItem($cb);
     $pass = new ilFormSectionHeaderGUI();
     $pass->setTitle($this->lng->txt('ps_security_protection'));
     $this->form->addItem($pass);
     $text = new ilNumberInputGUI($this->lng->txt('ps_login_max_attempts'), 'login_max_attempts');
     $text->setInfo($this->lng->txt('ps_login_max_attempts_info'));
     $text->setSize(1);
     $text->setMaxLength(2);
     $this->form->addItem($text);
     // prevent login from multiple pcs at the same time
     $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins');
     $objCb->setValue(1);
     $objCb->setInfo($this->lng->txt('ps_prevent_simultaneous_logins_info'));
     $this->form->addItem($objCb);
     $log = new ilFormSectionHeaderGUI();
     $log->setTitle($this->lng->txt('loginname_settings'));
     $this->form->addItem($log);
     $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname');
     $chbChangeLogin->setValue(1);
     $this->form->addItem($chbChangeLogin);
     $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname');
     $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info'));
     $chbCreateHistory->setValue(1);
     $chbChangeLogin->addSubItem($chbCreateHistory);
     $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames');
     $chbReuseLoginnames->setValue(1);
     $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info'));
     $chbChangeLogin->addSubItem($chbReuseLoginnames);
     $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time');
     $chbChangeBlockingTime->allowDecimals(true);
     $chbChangeBlockingTime->setSuffix($this->lng->txt('days'));
     $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info'));
     $chbChangeBlockingTime->setSize(10);
     $chbChangeBlockingTime->setMaxLength(10);
     $chbChangeLogin->addSubItem($chbChangeBlockingTime);
     $this->form->addCommandButton('saveGeneralSettings', $this->lng->txt('save'));
 }
 function showPlugin()
 {
     global $ilCtrl, $ilTabs, $lng, $tpl, $ilDB, $ilToolbar;
     if (!$_GET["ctype"] || !$_GET["cname"] || !$_GET["slot_id"] || !$_GET["plugin_id"]) {
         $ilCtrl->redirect($this, "listPlugins");
     }
     include_once "./Services/Component/classes/class.ilPluginSlot.php";
     $slot = new ilPluginSlot($_GET["ctype"], $_GET["cname"], $_GET["slot_id"]);
     $plugin = null;
     foreach ($slot->getPluginsInformation() as $item) {
         if ($item["id"] == $_GET["plugin_id"]) {
             $plugin = $item;
             break;
         }
     }
     if (!$plugin) {
         $ilCtrl->redirect($this, "listPlugins");
     }
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($lng->txt("cmps_plugins"), $ilCtrl->getLinkTarget($this, "listPlugins"));
     $ilCtrl->setParameter($this, "ctype", $_GET["ctype"]);
     $ilCtrl->setParameter($this, "cname", $_GET["cname"]);
     $ilCtrl->setParameter($this, "slot_id", $_GET["slot_id"]);
     $ilCtrl->setParameter($this, "plugin_id", $_GET["plugin_id"]);
     $ilCtrl->setParameter($this, "pname", $plugin["name"]);
     $langs = ilPlugin::getAvailableLangFiles($slot->getPluginsDirectory() . "/" . $plugin["name"] . "/lang");
     // dbupdate
     $file = ilPlugin::getDBUpdateScriptName($_GET["ctype"], $_GET["cname"], ilPluginSlot::lookupSlotName($_GET["ctype"], $_GET["cname"], $_GET["slot_id"]), $plugin["name"]);
     $db_curr = $db_file = null;
     if (@is_file($file)) {
         include_once "./Services/Component/classes/class.ilPluginDBUpdate.php";
         $dbupdate = new ilPluginDBUpdate($_GET["ctype"], $_GET["cname"], $_GET["slot_id"], $plugin["name"], $ilDB, true, "");
         $db_curr = $dbupdate->getCurrentVersion();
         $db_file = $dbupdate->getFileVersion();
         /* update command
         			if ($db_file > $db_curr)
         			{
         				$ilToolbar->addButton($lng->txt("cmps_update_db"),
         					$ilCtrl->getLinkTarget($this, "updatePluginDB"));
         			} */
     }
     // toolbar actions
     if ($plugin["activation_possible"]) {
         $ilToolbar->addButton($lng->txt("cmps_activate"), $ilCtrl->getLinkTarget($this, "activatePlugin"));
     }
     // deactivation/refresh languages button
     if ($plugin["is_active"]) {
         // refresh languages button
         if (count($langs) > 0) {
             $ilToolbar->addButton($lng->txt("cmps_refresh"), $ilCtrl->getLinkTarget($this, "refreshLanguages"));
         }
         // configure button
         if (ilPlugin::hasConfigureClass($slot->getPluginsDirectory(), $plugin["name"]) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($plugin["name"]))) {
             $ilToolbar->addButton($lng->txt("cmps_configure"), $ilCtrl->getLinkTargetByClass(strtolower(ilPlugin::getConfigureClassName($plugin["name"])), "configure"));
         }
         // deactivate button
         $ilToolbar->addButton($lng->txt("cmps_deactivate"), $ilCtrl->getLinkTarget($this, "deactivatePlugin"));
     }
     // update button
     if ($plugin["needs_update"]) {
         $ilToolbar->addButton($lng->txt("cmps_update"), $ilCtrl->getLinkTarget($this, "updatePlugin"));
     }
     // info
     $resp = array();
     if (strlen($plugin["responsible"])) {
         $responsibles = explode('/', $plugin["responsible_mail"]);
         foreach ($responsibles as $responsible) {
             if (!strlen($responsible = trim($responsible))) {
                 continue;
             }
             $resp[] = $responsible;
         }
         $resp = $plugin["responsible"] . " (" . implode(" / ", $resp) . ")";
     }
     if ($plugin["is_active"]) {
         $status = $lng->txt("cmps_active");
     } else {
         $r = $status["inactive_reason"] != "" ? " (" . $status["inactive_reason"] . ")" : "";
         $status = $lng->txt("cmps_inactive") . $r;
     }
     $info[""][$lng->txt("cmps_name")] = $plugin["name"];
     $info[""][$lng->txt("cmps_id")] = $plugin["id"];
     $info[""][$lng->txt("cmps_version")] = $plugin["version"];
     if ($resp) {
         $info[""][$lng->txt("cmps_responsible")] = $resp;
     }
     $info[""][$lng->txt("cmps_ilias_min_version")] = $plugin["ilias_min_version"];
     $info[""][$lng->txt("cmps_ilias_max_version")] = $plugin["ilias_max_version"];
     $info[""][$lng->txt("cmps_status")] = $status;
     if (sizeof($langs)) {
         $lang_files = array();
         foreach ($langs as $lang) {
             $lang_files[] = $lang["file"];
         }
         $info[""][$lng->txt("cmps_languages")] = implode(", ", $lang_files);
     } else {
         $info[""][$lng->txt("cmps_languages")] = $lng->txt("cmps_no_language_file_available");
     }
     $info[$lng->txt("cmps_basic_files")]["plugin.php"] = $plugin["plugin_php_file_status"] ? $lng->txt("cmps_available") : $lng->txt("cmps_missing");
     $info[$lng->txt("cmps_basic_files")][$lng->txt("cmps_class_file")] = ($plugin["class_file_status"] ? $lng->txt("cmps_available") : $lng->txt("cmps_missing")) . " (" . $plugin["class_file"] . ")";
     if (!$db_file) {
         $info[$lng->txt("cmps_database")][$lng->txt("file")] = $lng->txt("cmps_no_db_update_file_available");
     } else {
         $info[$lng->txt("cmps_database")][$lng->txt("file")] = "dbupdate.php";
         $info[$lng->txt("cmps_database")][$lng->txt("cmps_current_version")] = $db_curr;
         $info[$lng->txt("cmps_database")][$lng->txt("cmps_file_version")] = $db_file;
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setTitle($lng->txt("cmps_plugin"));
     foreach ($info as $section => $items) {
         if (trim($section)) {
             $sec = new ilFormSectionHeaderGUI();
             $sec->setTitle($section);
             $form->addItem($sec);
         }
         foreach ($items as $key => $value) {
             $non = new ilNonEditableValueGUI($key);
             $non->setValue($value);
             $form->addItem($non);
         }
     }
     $tpl->setContent($form->getHTML());
 }
 function initStylePropertiesForm()
 {
     global $ilSetting;
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->lng->loadLanguageModule("style");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $fixed_style = $ilSetting->get("fixed_content_style_id");
     $style_id = $this->object->getStyleSheetId();
     if ($fixed_style > 0) {
         $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
         $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" . $this->lng->txt("global_fixed") . ")");
         $form->addItem($st);
     } else {
         $st_styles = ilObjStyleSheet::_getStandardStyles(true, false, $_GET["ref_id"]);
         $st_styles[0] = $this->lng->txt("default");
         ksort($st_styles);
         if ($style_id > 0) {
             // individual style
             if (!ilObjStyleSheet::_lookupStandard($style_id)) {
                 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
                 $st->setValue(ilObject::_lookupTitle($style_id));
                 $form->addItem($st);
                 // delete command
                 $form->addCommandButton("editStyle", $this->lng->txt("style_edit_style"));
                 $form->addCommandButton("deleteStyle", $this->lng->txt("style_delete_style"));
             }
         }
         if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
             $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"), "style_id");
             $style_sel->setOptions($st_styles);
             $style_sel->setValue($style_id);
             $form->addItem($style_sel);
             $form->addCommandButton("saveStyleSettings", $this->lng->txt("save"));
             $form->addCommandButton("createStyle", $this->lng->txt("sty_create_ind_style"));
         }
     }
     $form->setTitle($this->lng->txt("blog_style"));
     $form->setFormAction($this->ctrl->getFormAction($this));
     return $form;
 }
 /**
  * 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;
 }
 public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->setValue($this->object->getPoints());
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $form->addItem($points);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("applet_attributes"));
     $form->addItem($header);
     // java applet
     $javaapplet = $this->object->getJavaAppletFilename();
     $applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName');
     $applet->setSuffixes(array('jar', 'class'));
     $applet->setRequired(false);
     if (strlen($javaapplet)) {
         $filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet');
         $filename->setValue($javaapplet);
         $applet->addSubItem($filename);
         $delete = new ilCheckboxInputGUI('', 'delete_applet');
         $delete->setOptionTitle($this->lng->txt('delete'));
         $delete->setValue(1);
         $applet->addSubItem($delete);
     }
     $form->addItem($applet);
     // Code
     $code = new ilTextInputGUI($this->lng->txt("code"), "java_code");
     $code->setValue($this->object->getJavaCode());
     $code->setRequired(TRUE);
     $form->addItem($code);
     if (!strlen($javaapplet)) {
         // Archive
         $archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive");
         $archive->setValue($this->object->getJavaArchive());
         $archive->setRequired(false);
         $form->addItem($archive);
         // Codebase
         $codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase");
         $codebase->setValue($this->object->getJavaCodebase());
         $codebase->setRequired(false);
         $form->addItem($codebase);
     }
     // Width
     $width = new ilNumberInputGUI($this->lng->txt("width"), "java_width");
     $width->setDecimals(0);
     $width->setSize(6);
     $width->setMinValue(50);
     $width->setMaxLength(6);
     $width->setValue($this->object->getJavaWidth());
     $width->setRequired(TRUE);
     $form->addItem($width);
     // Height
     $height = new ilNumberInputGUI($this->lng->txt("height"), "java_height");
     $height->setDecimals(0);
     $height->setSize(6);
     $height->setMinValue(50);
     $height->setMaxLength(6);
     $height->setValue($this->object->getJavaHeight());
     $height->setRequired(TRUE);
     $form->addItem($height);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("applet_parameters"));
     $form->addItem($header);
     include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
     $kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp");
     $values = array();
     for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
         $param = $this->object->getParameter($i);
         array_push($values, array($param['name'], $param['value']));
     }
     if (count($values) == 0) {
         array_push($values, array("", ""));
     }
     $kvp->setKeyName($this->lng->txt('name'));
     $kvp->setValueName($this->lng->txt('value'));
     $kvp->setValues($values);
     $form->addItem($kvp);
 }
 /**
  * Init add cast item form.
  */
 function initAddCastItemForm($a_mode = "create")
 {
     global $lng, $ilCtrl, $ilTabs;
     $this->checkPermission("write");
     $ilTabs->activateTab("edit_content");
     $lng->loadLanguageModule("mcst");
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     include "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setMultipart(true);
     // Property Title
     $text_input = new ilTextInputGUI($lng->txt("title"), "title");
     $text_input->setMaxLength(200);
     $this->form_gui->addItem($text_input);
     // Property Content
     $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
     $text_area->setRequired(false);
     $this->form_gui->addItem($text_area);
     // Property Visibility
     if ($enable_internal_rss) {
         $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
         $radio_option = new ilRadioOption($lng->txt("access_users"), "users");
         $radio_group->addOption($radio_option);
         $radio_option = new ilRadioOption($lng->txt("access_public"), "public");
         $radio_group->addOption($radio_option);
         $radio_group->setInfo($lng->txt("mcst_visibility_info"));
         $radio_group->setRequired(true);
         $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
         $this->form_gui->addItem($radio_group);
     }
     // Duration
     $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
     $dur->setInfo($lng->txt("mcst_duration_info"));
     $dur->setShowDays(false);
     $dur->setShowHours(true);
     $dur->setShowSeconds(true);
     $this->form_gui->addItem($dur);
     foreach (ilObjMediaCast::$purposes as $purpose) {
         if ($purpose == "VideoAlternative" && $a_mode == "create") {
             continue;
         }
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title"));
         $this->form_gui->addItem($section);
         if ($a_mode != "create") {
             $value = new ilHiddenInputGUI("value_" . $purpose);
             $label = new ilNonEditableValueGUI($lng->txt("value"));
             $label->setPostVar("label_value_" . $purpose);
             $label->setInfo($lng->txt("mcst_current_value_info"));
             $this->form_gui->addItem($label);
             $this->form_gui->addItem($value);
         }
         $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose);
         $file->setSuffixes($this->purposeSuffixes[$purpose]);
         $this->form_gui->addItem($file);
         $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose);
         $text_input->setPattern("/https?\\:\\/\\/.+/i");
         $text_input->setInfo($lng->txt("mcst_reference_info"));
         $this->form_gui->addItem($text_input);
         if ($purpose != "Standard") {
             $clearCheckBox = new ilCheckboxInputGUI();
             $clearCheckBox->setPostVar("delete_" . $purpose);
             $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
             $this->form_gui->addItem($clearCheckBox);
         } else {
             // mime type selection
             $mimeTypeSelection = new ilSelectInputGUI();
             $mimeTypeSelection->setPostVar("mimetype_" . $purpose);
             $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype"));
             $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info"));
             $options = array("" => $lng->txt("mcst_automatic_detection"));
             $options = array_merge($options, $this->mimeTypes);
             $mimeTypeSelection->setOptions($options);
             $this->form_gui->addItem($mimeTypeSelection);
             // preview picure
             $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic");
             $pp->setSuffixes(array("png", "jpeg", "jpg"));
             $pp->setInfo($lng->txt("mcst_preview_picture_info") . " mp4, mp3, png, jp(e)g, gif");
             $this->form_gui->addItem($pp);
         }
     }
     // save/cancel button
     if ($a_mode == "create") {
         $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
         $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
     } else {
         $this->form_gui->setTitle($lng->txt("mcst_edit_item"));
         $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
     }
     $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
 }