private function showPasswordFormCmd()
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once 'Services/Form/classes/class.ilPasswordInputGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->lng->txt("tst_password_form"));
     $form->setDescription($this->lng->txt("tst_password_introduction"));
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->addCommandButton(self::CMD_SAVE_ENTERED_PASSWORD, $this->lng->txt("submit"));
     $form->addCommandButton(self::CMD_BACK_TO_INFO_SCREEN, $this->lng->txt("cancel"));
     $inp = new ilPasswordInputGUI($this->lng->txt("tst_password"), 'password');
     $inp->setRequired(true);
     $inp->setRetype(false);
     $form->addItem($inp);
     $this->tpl->setVariable($this->parentGUI->getContentBlockName(), $this->ctrl->getHTML($form));
 }
 /**
  * Init configuration form.
  *
  * @return object form object
  */
 public function initConfigurationForm()
 {
     global $lng, $ilCtrl, $ilDB;
     $pl = $this->getPluginObject();
     $this->getPluginObject()->includeClass('class.ilOpenmeetingsConfig.php');
     $this->object = ilOpenmeetingsConfig::getInstance();
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setTitle($pl->txt("openmeetings_plugin_configuration"));
     $this->form->setFormAction($ilCtrl->getFormAction($this));
     $this->form->addCommandButton("save", $lng->txt("save"));
     // url (text)
     $ti = new ilTextInputGUI($pl->txt("url"), "frmurl");
     $ti->setRequired(true);
     $ti->setMaxLength(256);
     $ti->setSize(60);
     $this->form->addItem($ti);
     // port (text)
     $ti = new ilTextInputGUI($pl->txt("port"), "frmport");
     $ti->setRequired(true);
     $ti->setMaxLength(10);
     $ti->setSize(10);
     $this->form->addItem($ti);
     // appname
     $ti = new ilTextInputGUI($pl->txt("appname"), "frmappname");
     $ti->setRequired(true);
     $ti->setMaxLength(32);
     $ti->setSize(20);
     $this->form->addItem($ti);
     // username (text)
     $ti = new ilTextInputGUI($pl->txt("username"), "frmusername");
     $ti->setRequired(true);
     $ti->setMaxLength(256);
     $ti->setSize(20);
     $this->form->addItem($ti);
     // password (text)
     $ti = new ilPasswordInputGUI($pl->txt("password"), "frmpassword");
     $ti->setRequired(true);
     $ti->setMaxLength(256);
     $ti->setSize(20);
     $ti->setRetype(false);
     $this->form->addItem($ti);
     foreach ($this->fields as $key => $item) {
         $field = new $item["type"]($this->plugin_object->txt('conf_' . $key), $key);
         $field->setInfo($this->plugin_object->txt($item["info"]));
         if (is_array($item["subelements"])) {
             foreach ($item["subelements"] as $subkey => $subitem) {
                 $subfield = new $subitem["type"]($this->plugin_object->txt('conf_' . $key . "_" . $subkey), $subkey);
                 $subfield->setInfo($this->plugin_object->txt($subitem["info"]));
                 $field->addSubItem($subfield);
             }
         }
         $this->form->addItem($field);
     }
     return $this->form;
 }
Esempio n. 3
0
 /**
  * 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);
         }
     }
 }
Esempio n. 4
0
 /**
  * Init master login form.
  */
 public function initMasterLoginForm()
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // password
     $pi = new ilPasswordInputGUI($lng->txt("password"), "mpassword");
     $pi->setSize(20);
     $pi->setRetype(false);
     $pi->setSkipSyntaxCheck(true);
     $this->form->addItem($pi);
     $this->form->addCommandButton("performMLogin", $lng->txt("login"));
     $this->form->setTitle($lng->txt("admin_login"));
     $this->form->setFormAction("setup.php?cmd=gateway");
 }
Esempio n. 5
0
 /**
  * Show account migration screen
  * @param string $a_message
  */
 public function showAccountMigration($a_message = '')
 {
     /**
      * @var $tpl ilTemplate
      * @var $lng ilLanguage
      */
     global $tpl, $lng;
     $lng->loadLanguageModule('auth');
     self::initStartUpTemplate('tpl.login_account_migration.html');
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'migrateAccount'));
     $form->setTitle($lng->txt('auth_account_migration'));
     $form->addCommandButton('migrateAccount', $lng->txt('save'));
     $form->addCommandButton('showLogin', $lng->txt('cancel'));
     $rad = new ilRadioGroupInputGUI($lng->txt('auth_account_migration_name'), 'account_migration');
     $rad->setValue(1);
     $keep = new ilRadioOption($lng->txt('auth_account_migration_keep'), 1, $lng->txt('auth_info_migrate'));
     $user = new ilTextInputGUI($lng->txt('login'), 'mig_username');
     $user->setRequired(true);
     $user->setValue(ilUtil::prepareFormOutput($_POST['mig_username']));
     $user->setSize(32);
     $user->setMaxLength(128);
     $keep->addSubItem($user);
     $pass = new ilPasswordInputGUI($lng->txt('password'), 'mig_password');
     $pass->setRetype(false);
     $pass->setRequired(true);
     $pass->setValue(ilUtil::prepareFormOutput($_POST['mig_password']));
     $pass->setSize(12);
     $pass->setMaxLength(128);
     $keep->addSubItem($pass);
     $rad->addOption($keep);
     $new = new ilRadioOption($lng->txt('auth_account_migration_new'), 2, $lng->txt('auth_info_add'));
     $rad->addOption($new);
     $form->addItem($rad);
     $tpl->setVariable('MIG_FORM', $form->getHTML());
     if (strlen($a_message)) {
         ilUtil::sendFailure($a_message);
     }
     $tpl->show('DEFAULT');
 }
 /**
  * ilPropertyFormGUI initialisation
  * 
  * @access	private
  */
 private function initAdobeSettingsForm()
 {
     /** 
      * @var $ilCtrl ilCtrl
      * @var $lng 	$lng
      */
     global $lng, $ilCtrl;
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $this->tabs->setTabActive('editAdobeSettings');
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveAdobeSettings'));
     $this->form->setTitle($this->getPluginObject()->txt('adobe_settings'));
     $this->form->addCommandButton('saveAdobeSettings', $lng->txt('save'));
     $this->form->addCommandButton('cancelAdobeSettings', $lng->txt('cancel'));
     $form_server = new ilTextInputGUI($lng->txt('server'), 'server');
     $form_server->setRequired(true);
     $form_server->setInfo($this->getPluginObject()->txt('xavc_host_info'));
     $this->form->addItem($form_server);
     $form_port = new ilNumberInputGUI($lng->txt('port'), 'port');
     $form_port->setSize(5);
     $form_port->setMaxLength(5);
     $form_port->setInfo($this->getPluginObject()->txt('xavc_port_info'));
     $this->form->addItem($form_port);
     $form_login = new ilTextInputGUI($lng->txt('login'), 'login');
     $form_login->setRequired(true);
     $this->form->addItem($form_login);
     $form_passwd = new ilPasswordInputGUI($lng->txt('password'), 'password');
     $form_passwd->setRequired(true);
     $form_passwd->setRetype(false);
     $this->form->addItem($form_passwd);
     //Address to SWITCH Cave Server
     $form_cave = new ilTextInputGUI($this->getPluginObject()->txt('cave'), 'cave');
     $form_cave->setRequired(true);
     // you can choose the mode for the creation of user-accounts at AdobeServer: the AC-Loginname could be the users-email-address or the ilias-loginname
     $radio_group = new ilRadioGroupInputGUI($this->getPluginObject()->txt('user_assignment_mode'), 'user_assignment_mode');
     $radio_option_1 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_email'), 'assign_user_email');
     $radio_group->addOption($radio_option_1);
     $radio_option_2 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_ilias_login'), 'assign_ilias_login');
     $radio_group->addOption($radio_option_2);
     $radio_option_3 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_switch_aai_login'), 'assign_breezeSession');
     $radio_option_3->addSubItem($form_cave);
     $radio_group->addOption($radio_option_3);
     $radio_group->setInfo($this->getPluginObject()->txt('assignment_info'));
     $radio_option_4 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_email_dfn'), 'assign_dfn_email');
     $radio_group->addOption($radio_option_4);
     if (ilAdobeConnectServer::getSetting('user_assignment_mode') != NULL) {
         $radio_group->setDisabled(true);
     }
     $this->form->addItem($radio_group);
     $auth_radio_grp = new ilRadioGroupInputGUI($this->getPluginObject()->txt('auth_mode'), 'auth_mode');
     $auth_radio_opt_1 = new ilRadioOption($this->getPluginObject()->txt('auth_mode_password'), 'auth_mode_password');
     $auth_radio_grp->addOption($auth_radio_opt_1);
     $auth_radio_opt_2 = new ilRadioOption($this->getPluginObject()->txt('auth_mode_header'), 'auth_mode_header');
     $form_x_user_id = new ilTextInputGUI($this->getPluginObject()->txt('x_user_id_header_var'), 'x_user_id');
     $form_x_user_id->setInfo($this->getPluginObject()->txt('xavc_x_user_id_info'));
     $auth_radio_opt_2->addSubItem($form_x_user_id);
     $auth_radio_grp->addOption($auth_radio_opt_2);
     $auth_radio_opt_3 = new ilRadioOption($this->getPluginObject()->txt('auth_mode_switchaai'), 'auth_mode_switchaai');
     $switchaai_checkbox_grp = new ilCheckboxGroupInputGUI($this->getPluginObject()->txt('auth_mode_switchaai_accounts'), 'auth_mode_switchaai_account_type');
     $switchaai_checkbox_grp->addOption(new ilCheckboxOption($this->getPluginObject()->txt('auth_mode_switchaai_local'), AUTH_LOCAL));
     $switchaai_checkbox_grp->addOption(new ilCheckboxOption($this->getPluginObject()->txt('auth_mode_switchaai_ldap'), AUTH_LDAP));
     $auth_radio_opt_3->addSubItem($switchaai_checkbox_grp);
     $auth_radio_grp->addOption($auth_radio_opt_3);
     $form_auth_mode_dfn = new ilRadioOption($this->getPluginObject()->txt('auth_mode_dfn'), 'auth_mode_dfn');
     $auth_radio_grp->addOption($form_auth_mode_dfn);
     $auth_radio_grp->setInfo($this->getPluginObject()->txt('authentification_mode_info'));
     $this->form->addItem($auth_radio_grp);
     $form_lead_time = new ilNumberInputGUI($this->getPluginObject()->txt('schedule_lead_time'), 'schedule_lead_time');
     $form_lead_time->setDecimals(0);
     $form_lead_time->setMinValue(0);
     $form_lead_time->setRequired(true);
     $form_lead_time->setSize(5);
     $form_lead_time->setInfo($this->getPluginObject()->txt('schedule_lead_time_info'));
     $this->form->addItem($form_lead_time);
     $head_line = new ilFormSectionHeaderGUI();
     $head_line->setTitle($this->getPluginObject()->txt('presentation_server_settings'));
     $this->form->addItem($head_line);
     $form_fe_server = new ilTextInputGUI($this->getPluginObject()->txt('presentation_server'), 'presentation_server');
     $form_fe_server->setRequired(true);
     $form_fe_server->setInfo($this->getPluginObject()->txt('xavc_presentation_host_info'));
     $this->form->addItem($form_fe_server);
     $form_fe_port = new ilNumberInputGUI($this->getPluginObject()->txt('presentation_port'), 'presentation_port');
     $form_fe_port->setSize(5);
     $form_fe_port->setMaxLength(5);
     $form_fe_port->setInfo($this->getPluginObject()->txt('xavc_presentation_port_info'));
     $this->form->addItem($form_fe_port);
 }
 /**
  * init edit/create category form 
  *
  * @access protected
  * @return
  */
 protected function initFormCategory($a_mode)
 {
     global $rbacsystem, $ilUser;
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo((int) $_GET['category_id']);
     $this->form = new ilPropertyFormGUI();
     #$this->form->setTableWidth('40%');
     switch ($a_mode) {
         case 'edit':
             $category = new ilCalendarCategory((int) $_GET['category_id']);
             $this->form->setTitle($this->lng->txt('cal_edit_category'));
             $this->ctrl->saveParameter($this, array('seed', 'category_id'));
             $this->form->setFormAction($this->ctrl->getFormAction($this));
             if ($this->isEditable()) {
                 $this->form->addCommandButton('update', $this->lng->txt('save'));
                 /*
                 					if($cat_info['type'] == ilCalendarCategory::TYPE_USR)
                 					{
                 						$this->form->addCommandButton('shareSearch',$this->lng->txt('cal_share'));
                 					}
                 					$this->form->addCommandButton('confirmDelete',$this->lng->txt('delete'));
                 */
                 $this->form->addCommandButton('manage', $this->lng->txt('cancel'));
             }
             break;
         case 'create':
             $this->editable = true;
             $category = new ilCalendarCategory(0);
             $this->ctrl->saveParameter($this, array('category_id'));
             $this->form->setFormAction($this->ctrl->getFormAction($this));
             $this->form->setTitle($this->lng->txt('cal_add_category'));
             $this->form->addCommandButton('save', $this->lng->txt('save'));
             $this->form->addCommandButton('manage', $this->lng->txt('cancel'));
             break;
     }
     // Calendar name
     $title = new ilTextInputGUI($this->lng->txt('cal_calendar_name'), 'title');
     if ($a_mode == 'edit') {
         $title->setDisabled(!$this->isEditable());
     }
     $title->setRequired(true);
     $title->setMaxLength(64);
     $title->setSize(32);
     $title->setValue($category->getTitle());
     $this->form->addItem($title);
     include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
     if ($a_mode == 'create' and $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId())) {
         $type = new ilRadioGroupInputGUI($this->lng->txt('cal_cal_type'), 'type');
         $type->setValue($category->getType());
         $type->setRequired(true);
         $opt = new ilRadioOption($this->lng->txt('cal_type_personal'), ilCalendarCategory::TYPE_USR);
         $type->addOption($opt);
         $opt = new ilRadioOption($this->lng->txt('cal_type_system'), ilCalendarCategory::TYPE_GLOBAL);
         $type->addOption($opt);
         $type->setInfo($this->lng->txt('cal_type_info'));
         $this->form->addItem($type);
     }
     $color = new ilColorPickerInputGUI($this->lng->txt('cal_calendar_color'), 'color');
     $color->setValue($category->getColor());
     if (!$this->isEditable()) {
         $color->setDisabled(true);
     }
     $color->setRequired(true);
     $this->form->addItem($color);
     $location = new ilRadioGroupInputGUI($this->lng->txt('cal_type_rl'), 'type_rl');
     $location->setDisabled($a_mode == 'edit');
     $location_local = new ilRadioOption($this->lng->txt('cal_type_local'), ilCalendarCategory::LTYPE_LOCAL);
     $location->addOption($location_local);
     $location_remote = new ilRadioOption($this->lng->txt('cal_type_remote'), ilCalendarCategory::LTYPE_REMOTE);
     $location->addOption($location_remote);
     $location->setValue($category->getLocationType());
     $url = new ilTextInputGUI($this->lng->txt('cal_remote_url'), 'remote_url');
     $url->setDisabled($a_mode == 'edit');
     $url->setValue($category->getRemoteUrl());
     $url->setMaxLength(500);
     $url->setSize(60);
     $url->setRequired(true);
     $location_remote->addSubItem($url);
     $user = new ilTextInputGUI($this->lng->txt('username'), 'remote_user');
     $user->setDisabled($a_mode == 'edit');
     $user->setValue($category->getRemoteUser());
     $user->setMaxLength(50);
     $user->setSize(20);
     $user->setRequired(false);
     $location_remote->addSubItem($user);
     $pass = new ilPasswordInputGUI($this->lng->txt('password'), 'remote_pass');
     $pass->setDisabled($a_mode == 'edit');
     $pass->setValue($category->getRemotePass());
     $pass->setMaxLength(50);
     $pass->setSize(20);
     $pass->setRetype(false);
     $pass->setInfo($this->lng->txt('remote_pass_info'));
     $location_remote->addSubItem($pass);
     $this->form->addItem($location);
 }
 /**
  * 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'));
 }
 /**
  * Init configuration form.
  *
  * @return object form object
  */
 public function initConfigurationForm()
 {
     global $lng, $ilCtrl;
     $pl = $this->getPluginObject();
     $this->getPluginObject()->includeClass('class.ilViteroSettings.php');
     $settings = ilViteroSettings::getInstance();
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->getPluginObject()->txt('vitero_plugin_configuration'));
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->addCommandButton('save', $lng->txt('save'));
     $form->setShowTopButtons(false);
     // Server url
     $uri = new ilTextInputGUI($this->getPluginObject()->txt('server_uri'), 'server_uri');
     $uri->setRequired(true);
     $uri->setSize(80);
     $uri->setMaxLength(512);
     $uri->setValue($settings->getServerUrl());
     $form->addItem($uri);
     // Admin user
     $admin = new ilTextInputGUI($this->getPluginObject()->txt('admin_user'), 'admin_user');
     $admin->setRequired(true);
     $admin->setSize(16);
     $admin->setMaxLength(128);
     $admin->setValue($settings->getAdminUser());
     $form->addItem($admin);
     // Admin pass
     $pass = new ilPasswordInputGUI($this->getPluginObject()->txt('admin_pass'), 'admin_pass');
     $pass->setSkipSyntaxCheck(true);
     //$pass->setRequired(true);
     $pass->setRetype(true);
     $pass->setSize(12);
     $pass->setMaxLength(32);
     //$pass->setValue($settings->getAdminPass());
     $form->addItem($pass);
     // Customer id
     $cid = new ilNumberInputGUI($this->getPluginObject()->txt('customer_id'), 'customer');
     $cid->setSize(3);
     $cid->setMaxLength(9);
     $cid->setRequired(true);
     $cid->setMinValue(1);
     $cid->setValue($settings->getCustomer());
     $form->addItem($cid);
     // Webstart
     $ws = new ilTextInputGUI($this->getPluginObject()->txt('webstart_url'), 'webstart');
     $ws->setRequired(true);
     $ws->setSize(80);
     $ws->setMaxLength(512);
     $ws->setValue($settings->getWebstartUrl());
     $form->addItem($ws);
     //  Client Section
     $client = new ilFormSectionHeaderGUI();
     $client->setTitle($this->getPluginObject()->txt('client_settings'));
     $form->addItem($client);
     // cafe
     $cafe = new ilCheckboxInputGUI($this->getPluginObject()->txt('cafe_setting'), 'cafe');
     $cafe->setInfo($this->getPluginObject()->txt('cafe_setting_info'));
     $cafe->setValue(1);
     $cafe->setChecked($settings->isCafeEnabled());
     $form->addItem($cafe);
     // content
     $content = new ilCheckboxInputGUI($this->getPluginObject()->txt('content_admin'), 'content');
     $content->setInfo($this->getPluginObject()->txt('content_admin_info'));
     $content->setValue(1);
     $content->setChecked($settings->isContentAdministrationEnabled());
     $form->addItem($content);
     // Standard room
     $standard = new ilCheckboxInputGUI($this->getPluginObject()->txt('standard_room'), 'std_room');
     $standard->setInfo($this->getPluginObject()->txt('standard_room_info'));
     $standard->setValue(1);
     $standard->setChecked($settings->isStandardRoomEnabled());
     $form->addItem($standard);
     // ldap
     $ldap = new ilCheckboxInputGUI($this->getPluginObject()->txt('ldap_setting'), 'ldap');
     $ldap->setInfo($this->getPluginObject()->txt('ldap_setting_info'));
     $ldap->setValue(1);
     $ldap->setChecked($settings->isLdapUsed());
     #$form->addItem($ldap);
     // userprefix
     $prefix = new ilTextInputGUI($this->getPluginObject()->txt('uprefix'), 'uprefix');
     $prefix->setInfo($this->getPluginObject()->txt('uprefix_info'));
     $prefix->setSize(6);
     $prefix->setMaxLength(16);
     $prefix->setValue($settings->getUserPrefix());
     $form->addItem($prefix);
     // avatar
     $ava = new ilCheckboxInputGUI($this->getPluginObject()->txt('avatar'), 'avatar');
     $ava->setValue(1);
     $ava->setChecked($settings->isAvatarEnabled());
     $ava->setInfo($this->getPluginObject()->txt('avatar_info'));
     $form->addItem($ava);
     /*
     if(!class_exists('WSMessage'))
     {
     	$ava->setDisabled(true);
     	$ava->setAlert($this->getPluginObject()->txt('avatar_warning'));
     }
     
     $cert = new ilTextInputGUI($this->getPluginObject()->txt('mtom_cert'),'mtom_cert');
     $cert->setValue($settings->getMTOMCert());
     $cert->setSize(100);
     $cert->setMaxLength(512);
     $cert->setInfo($this->getPluginObject()->txt('mtom_cert_info'));
     if(!class_exists('WSMessage'))
     {
     	$cert->setDisabled(true);
     }
     $ava->addSubItem($cert);
     */
     // grace period before
     $gpb = new ilSelectInputGUI($this->getPluginObject()->txt('std_grace_period_before'), 'grace_period_before');
     $gpb->setInfo($this->getPluginObject()->txt('std_grace_period_before_info'));
     $gpb->setOptions(array(0 => '0 min', 15 => '15 min', 30 => '30 min', 45 => '45 min', 60 => '1 h'));
     $gpb->setValue($settings->getStandardGracePeriodBefore());
     $form->addItem($gpb);
     // grace period after
     $gpa = new ilSelectInputGUI($this->getPluginObject()->txt('std_grace_period_after'), 'grace_period_after');
     $gpa->setInfo($this->getPluginObject()->txt('std_grace_period_after_info'));
     $gpa->setOptions(array(0 => '0 min', 15 => '15 min', 30 => '30 min', 45 => '45 min', 60 => '1 h'));
     $gpa->setValue($settings->getStandardGracePeriodAfter());
     $form->addItem($gpa);
     return $form;
 }
 /**
  * @param string $pwassist_id
  * @return ilPropertyFormGUI
  */
 protected function getAssignPasswordForm($pwassist_id)
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'submitAssignPasswordForm'));
     $form->setTarget('_parent');
     $username = new ilTextInputGUI($this->lng->txt('username'), 'username');
     $username->setRequired(true);
     $form->addItem($username);
     $password = new ilPasswordInputGUI($this->lng->txt('password'), 'password');
     $password->setRequired(true);
     $form->addItem($password);
     $key = new ilHiddenInputGUI('key');
     $key->setValue($pwassist_id);
     $form->addItem($key);
     $form->addCommandButton('submitAssignPasswordForm', $this->lng->txt('submit'));
     return $form;
 }
Esempio n. 11
0
 protected function initPrivateSettingsForm()
 {
     global $ilCtrl, $lng, $ilUser;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $feed_form = new ilPropertyFormGUI();
     $feed_form->setFormAction($ilCtrl->getFormaction($this));
     $feed_form->setTitle($lng->txt("priv_feed_settings"));
     $feed_form->setTableWidth("100%");
     $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
     $enable_private_feed->setChecked($ilUser->_getFeedPass($ilUser->getId()));
     $feed_form->addItem($enable_private_feed);
     $passwd = new ilPasswordInputGUI($lng->txt("password"), "desired_password");
     $passwd->setRequired(true);
     $passwd->setInfo(ilUtil::getPasswordRequirementsInfo());
     $enable_private_feed->addSubItem($passwd);
     $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save"));
     $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
     return $feed_form;
 }
 /**
  * Show account migration screen
  *
  * @access public
  * @param 
  * 
  */
 public function showAccountMigration($a_message = '')
 {
     global $tpl, $lng;
     $lng->loadLanguageModule('auth');
     $tpl->addBlockFile("CONTENT", "content", "tpl.startup_screen.html", "Services/Init");
     $tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
     $tpl->addBlockFile("STARTUP_CONTENT", "startup_content", "tpl.login_account_migration.html", "Services/Init");
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'migrateAccount'));
     $form->setTitle($lng->txt('auth_account_migration'));
     $form->addCommandButton('migrateAccount', $lng->txt('save'));
     $form->addCommandButton('showLogin', $lng->txt('cancel'));
     $rad = new ilRadioGroupInputGUI($lng->txt('auth_account_migration_name'), 'account_migration');
     $rad->setValue(1);
     $keep = new ilRadioOption($lng->txt('auth_account_migration_keep'), 1, $lng->txt('auth_info_migrate'));
     $user = new ilTextInputGUI($lng->txt('login'), 'mig_username');
     $user->setValue(ilUtil::prepareFormOutput($_POST['mig_username']));
     $user->setSize(32);
     $user->setMaxLength(128);
     $keep->addSubItem($user);
     $pass = new ilPasswordInputGUI($lng->txt('password'), 'mig_password');
     $pass->setValue(ilUtil::prepareFormOutput($_POST['mig_password']));
     $pass->setRetype(false);
     $pass->setSize(12);
     $pass->setMaxLength(128);
     $keep->addSubItem($pass);
     $rad->addOption($keep);
     $new = new ilRadioOption($lng->txt('auth_account_migration_new'), 2, $lng->txt('auth_info_add'));
     $rad->addOption($new);
     $form->addItem($rad);
     $tpl->setVariable('MIG_FORM', $form->getHTML());
     if (strlen($a_message)) {
         $this->showFailure($a_message);
     }
     $tpl->show('DEFAULT');
 }
 private function initForm()
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
     $this->form_gui->setTitle($this->lng->txt('ldap_configure'));
     $active = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_enable'), 'active');
     $active->setValue(1);
     $this->form_gui->addItem($active);
     $ds = new ilCheckboxInputGUI($this->lng->txt('ldap_as_ds'), 'ds');
     $ds->setValue(1);
     $ds->setInfo($this->lng->txt('ldap_as_ds_info'));
     $this->form_gui->addItem($ds);
     $servername = new ilTextInputGUI($this->lng->txt('ldap_server_name'), 'server_name');
     $servername->setRequired(true);
     $servername->setInfo($this->lng->txt('ldap_server_name_info'));
     $servername->setSize(32);
     $servername->setMaxLength(32);
     $this->form_gui->addItem($servername);
     $serverurl = new ilTextInputGUI($this->lng->txt('ldap_server'), 'server_url');
     $serverurl->setRequired(true);
     $serverurl->setInfo($this->lng->txt('ldap_server_url_info'));
     $serverurl->setSize(64);
     $serverurl->setMaxLength(255);
     $this->form_gui->addItem($serverurl);
     $version = new ilSelectInputGUI($this->lng->txt('ldap_version'), 'version');
     $version->setOptions(array(2 => 2, 3 => 3));
     $version->setInfo($this->lng->txt('ldap_server_version_info'));
     $this->form_gui->addItem($version);
     $basedsn = new ilTextInputGUI($this->lng->txt('basedn'), 'base_dn');
     $basedsn->setRequired(true);
     $basedsn->setSize(64);
     $basedsn->setMaxLength(255);
     $this->form_gui->addItem($basedsn);
     $referrals = new ilCheckboxInputGUI($this->lng->txt('ldap_referrals'), 'referrals');
     $referrals->setValue(1);
     $referrals->setInfo($this->lng->txt('ldap_referrals_info'));
     $this->form_gui->addItem($referrals);
     $section_security = new ilFormSectionHeaderGUI();
     $section_security->setTitle($this->lng->txt('ldap_server_security_settings'));
     $this->form_gui->addItem($section_security);
     $tls = new ilCheckboxInputGUI($this->lng->txt('ldap_tls'), 'tls');
     $tls->setValue(1);
     $this->form_gui->addItem($tls);
     $binding = new ilRadioGroupInputGUI($this->lng->txt('ldap_server_binding'), 'binding_type');
     $anonymous = new ilRadioOption($this->lng->txt('ldap_bind_anonymous'), IL_LDAP_BIND_ANONYMOUS);
     $binding->addOption($anonymous);
     $user = new ilRadioOption($this->lng->txt('ldap_bind_user'), IL_LDAP_BIND_USER);
     $dn = new ilTextInputGUI($this->lng->txt('ldap_server_bind_dn'), 'bind_dn');
     $dn->setSize(64);
     $dn->setMaxLength(255);
     $user->addSubItem($dn);
     $pass = new ilPasswordInputGUI($this->lng->txt('ldap_server_bind_pass'), 'bind_pass');
     $pass->setSize(12);
     $pass->setMaxLength(36);
     $user->addSubItem($pass);
     $binding->addOption($user);
     $this->form_gui->addItem($binding);
     $section_auth = new ilFormSectionHeaderGUI();
     $section_auth->setTitle($this->lng->txt('ldap_authentication_settings'));
     $this->form_gui->addItem($section_auth);
     $search_base = new ilTextInputGUI($this->lng->txt('ldap_user_dn'), 'search_base');
     $search_base->setInfo($this->lng->txt('ldap_search_base_info'));
     $search_base->setSize(64);
     $search_base->setMaxLength(255);
     $this->form_gui->addItem($search_base);
     $user_scope = new ilSelectInputGUI($this->lng->txt('ldap_user_scope'), 'user_scope');
     $user_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
     $user_scope->setInfo($this->lng->txt('ldap_user_scope_info'));
     $this->form_gui->addItem($user_scope);
     $user_attribute = new ilTextInputGUI($this->lng->txt('ldap_user_attribute'), 'user_attribute');
     $user_attribute->setSize(16);
     $user_attribute->setMaxLength(64);
     $user_attribute->setRequired(true);
     $this->form_gui->addItem($user_attribute);
     $filter = new ilTextInputGUI($this->lng->txt('ldap_search_filter'), 'filter');
     $filter->setInfo($this->lng->txt('ldap_filter_info'));
     $filter->setSize(64);
     $filter->setMaxLength(512);
     $this->form_gui->addItem($filter);
     $section_restrictions = new ilFormSectionHeaderGUI();
     $section_restrictions->setTitle($this->lng->txt('ldap_group_restrictions'));
     $this->form_gui->addItem($section_restrictions);
     $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_search_base'), 'group_dn');
     $group_dn->setInfo($this->lng->txt('ldap_group_dn_info'));
     $group_dn->setSize(64);
     $group_dn->setMaxLength(255);
     $this->form_gui->addItem($group_dn);
     $group_scope = new ilSelectInputGUI($this->lng->txt('ldap_group_scope'), 'group_scope');
     $group_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
     $group_scope->setInfo($this->lng->txt('ldap_group_scope_info'));
     $this->form_gui->addItem($group_scope);
     $group_filter = new ilTextInputGUI($this->lng->txt('ldap_group_filter'), 'group_filter');
     $group_filter->setInfo($this->lng->txt('ldap_group_filter_info'));
     $group_filter->setSize(64);
     $group_filter->setMaxLength(255);
     $this->form_gui->addItem($group_filter);
     $group_member = new ilTextInputGUI($this->lng->txt('ldap_group_member'), 'group_member');
     $group_member->setInfo($this->lng->txt('ldap_group_member_info'));
     $group_member->setSize(32);
     $group_member->setMaxLength(255);
     $this->form_gui->addItem($group_member);
     $group_member_isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_memberisdn'), 'memberisdn');
     #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info'));
     $this->form_gui->addItem($group_member_isdn);
     #$group_member->addSubItem($group_member_isdn);
     $group = new ilTextInputGUI($this->lng->txt('ldap_group_name'), 'group');
     $group->setInfo($this->lng->txt('ldap_group_name_info'));
     $group->setSize(32);
     $group->setMaxLength(255);
     $this->form_gui->addItem($group);
     $group_atrr = new ilTextInputGUI($this->lng->txt('ldap_group_attribute'), 'group_attribute');
     $group_atrr->setInfo($this->lng->txt('ldap_group_attribute_info'));
     $group_atrr->setSize(16);
     $group_atrr->setMaxLength(64);
     $this->form_gui->addItem($group_atrr);
     $group_optional = new ilCheckboxInputGUI($this->lng->txt('ldap_group_membership'), 'group_optional');
     $group_optional->setOptionTitle($this->lng->txt('ldap_group_member_optional'));
     $group_optional->setInfo($this->lng->txt('ldap_group_optional_info'));
     $group_optional->setValue(1);
     $group_user_filter = new ilTextInputGUI($this->lng->txt('ldap_group_user_filter'), 'group_user_filter');
     $group_user_filter->setSize(64);
     $group_user_filter->setMaxLength(255);
     $group_optional->addSubItem($group_user_filter);
     $this->form_gui->addItem($group_optional);
     $section_sync = new ilFormSectionHeaderGUI();
     $section_sync->setTitle($this->lng->txt('ldap_user_sync'));
     $this->form_gui->addItem($section_sync);
     $ci_gui = new ilCustomInputGUI($this->lng->txt('ldap_moment_sync'));
     $sync_on_login = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_login'), 'sync_on_login');
     $sync_on_login->setValue(1);
     $ci_gui->addSubItem($sync_on_login);
     $sync_per_cron = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_cron'), 'sync_per_cron');
     $sync_per_cron->setValue(1);
     $ci_gui->addSubItem($sync_per_cron);
     $ci_gui->setInfo($this->lng->txt('ldap_user_sync_info'));
     $this->form_gui->addItem($ci_gui);
     $global_role = new ilSelectInputGUI($this->lng->txt('ldap_global_role_assignment'), 'global_role');
     $global_role->setOptions($this->prepareRoleSelect(false));
     $global_role->setInfo($this->lng->txt('ldap_global_role_info'));
     $this->form_gui->addItem($global_role);
     $migr = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_migration'), 'migration');
     $migr->setInfo($this->lng->txt('auth_ldap_migration_info'));
     $migr->setValue(1);
     $this->form_gui->addItem($migr);
     $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
 }
Esempio n. 14
0
 /**
  * Init user form
  */
 function initForm($a_mode)
 {
     global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser;
     $settings = $ilSetting->getAll();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
     if ($a_mode == "create") {
         $this->form_gui->setTitle($lng->txt("usr_new"));
     } else {
         $this->form_gui->setTitle($lng->txt("usr_edit"));
     }
     // login data
     $sec_l = new ilFormSectionHeaderGUI();
     $sec_l->setTitle($lng->txt("login_data"));
     $this->form_gui->addItem($sec_l);
     // authentication mode
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
     $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode");
     $option = array();
     foreach ($active_auth_modes as $auth_name => $auth_key) {
         if ($auth_name == 'default') {
             $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
         } else {
             $name = $this->lng->txt('auth_' . $auth_name);
         }
         $option[$auth_name] = $name;
     }
     $am->setOptions($option);
     $this->form_gui->addItem($am);
     if ($a_mode == "edit") {
         $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id");
         $id->setValue($this->object->getId());
         $this->form_gui->addItem($id);
     }
     // login
     $lo = new ilUserLoginInputGUI($lng->txt("login"), "login");
     $lo->setRequired(true);
     if ($a_mode == "edit") {
         $lo->setCurrentUserId($this->object->getId());
         try {
             include_once 'Services/Calendar/classes/class.ilDate.php';
             $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
             $lo->setInfo(sprintf($this->lng->txt('usr_loginname_history_info'), ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)), $last_history_entry[0]));
         } catch (ilUserException $e) {
         }
     }
     $this->form_gui->addItem($lo);
     $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd");
     $pw->setSize(32);
     $pw->setMaxLength(32);
     $pw->setValidateAuthPost("auth_mode");
     if ($a_mode == "create") {
         $pw->setRequiredOnAuth(true);
     }
     $pw->setInfo(ilUtil::getPasswordRequirementsInfo());
     $this->form_gui->addItem($pw);
     // @todo: invisible/hidden passwords
     // external account
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     if (ilAuthUtils::_isExternalAccountEnabled()) {
         $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account");
         $ext->setSize(40);
         $ext->setMaxLength(250);
         $ext->setInfo($lng->txt("user_ext_account_desc"));
         $this->form_gui->addItem($ext);
     }
     // login data
     $sec_si = new ilFormSectionHeaderGUI();
     $sec_si->setTitle($this->lng->txt("system_information"));
     $this->form_gui->addItem($sec_si);
     // create date, approve date, agreement date, last login
     if ($a_mode == "edit") {
         $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner");
         foreach ($sia as $a) {
             $siai = new ilNonEditableValueGUI($lng->txt($a), $a);
             $this->form_gui->addItem($siai);
         }
     }
     // active
     $ac = new ilCheckboxInputGUI($lng->txt("active"), "active");
     $ac->setChecked(true);
     $this->form_gui->addItem($ac);
     // access	@todo: get fields right (names change)
     $lng->loadLanguageModule('crs');
     // access
     $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
     $radg->setValue(1);
     $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1);
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0);
     $radg->addOption($op2);
     //		$ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
     //		$ac->setChecked(true);
     //		$ac->setOptionTitle($lng->txt("crs_unlimited"));
     // access.from
     $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
     $acfrom->setShowTime(true);
     //		$ac->addSubItem($acfrom);
     $op2->addSubItem($acfrom);
     // access.to
     $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
     $acto->setShowTime(true);
     //		$ac->addSubItem($acto);
     $op2->addSubItem($acto);
     //		$this->form_gui->addItem($ac);
     $this->form_gui->addItem($radg);
     require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if (ilDiskQuotaActivationChecker::_isActive()) {
         $lng->loadLanguageModule("file");
         $quota_head = new ilFormSectionHeaderGUI();
         $quota_head->setTitle($lng->txt("repository_disk_quota"));
         $this->form_gui->addItem($quota_head);
         // disk quota
         $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota");
         $disk_quota->setSize(10);
         $disk_quota->setMaxLength(11);
         $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
         $this->form_gui->addItem($disk_quota);
         if ($a_mode == "edit") {
             // show which disk quota is in effect, and explain why
             require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
             $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId());
             if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) {
                 $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
             } else {
                 if (is_infinite($dq_info['role_disk_quota'])) {
                     $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
                 } else {
                     $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
                 }
             }
             $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
             // disk usage
             $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId());
             $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
             if ($du_info['last_update'] === null) {
                 $disk_usage->setValue($lng->txt('unknown'));
             } else {
                 require_once './Services/Utilities/classes/class.ilFormat.php';
                 $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'], 'short'));
                 $info = '<table class="il_user_quota_disk_usage_overview">';
                 // write the count and size of each object type
                 foreach ($du_info['details'] as $detail_data) {
                     $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['size'], 'short') . '</td>' . '</tr>';
                 }
                 $info .= '</table>';
                 $info .= '<br>' . $this->lng->txt('last_update') . ': ' . ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME));
                 $disk_usage->setInfo($info);
             }
             $this->form_gui->addItem($disk_usage);
             // date when the last disk quota reminder was sent to the user
             if (true || $dq_info['last_reminder']) {
                 $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder");
                 $reminder->setValue(ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME)));
                 $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc"));
                 $this->form_gui->addItem($reminder);
             }
         }
     }
     if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         $lng->loadLanguageModule("file");
         $quota_head = new ilFormSectionHeaderGUI();
         $quota_head->setTitle($lng->txt("personal_workspace_disk_quota"));
         $this->form_gui->addItem($quota_head);
         // personal workspace disk quota
         $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota");
         $wsp_disk_quota->setSize(10);
         $wsp_disk_quota->setMaxLength(11);
         $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
         $this->form_gui->addItem($wsp_disk_quota);
         if ($a_mode == "edit") {
             // show which disk quota is in effect, and explain why
             require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
             $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId());
             if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota']) {
                 $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_wsp_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']);
             } else {
                 if (is_infinite($dq_info['role_wsp_disk_quota'])) {
                     $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
                 } else {
                     $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']);
                 }
             }
             $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
         }
         // disk usage
         include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
         $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId());
         $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
         if (!sizeof($du_info)) {
             $disk_usage->setValue($lng->txt('unknown'));
         } else {
             require_once './Services/Utilities/classes/class.ilFormat.php';
             $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId())));
             $info = '<table class="il_user_quota_disk_usage_overview">';
             // write the count and size of each object type
             foreach ($du_info as $detail_data) {
                 $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt("obj_" . $detail_data["src_type"]) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['filesize'], 'short') . '</td>' . '</tr>';
             }
             $info .= '</table>';
             $disk_usage->setInfo($info);
         }
         $this->form_gui->addItem($disk_usage);
     }
     // personal data
     if ($this->isSettingChangeable('gender') or $this->isSettingChangeable('firstname') or $this->isSettingChangeable('lastname') or $this->isSettingChangeable('title') or $this->isSettingChangeable('personal_image') or $this->isSettingChangeable('birhtday')) {
         $sec_pd = new ilFormSectionHeaderGUI();
         $sec_pd->setTitle($this->lng->txt("personal_data"));
         $this->form_gui->addItem($sec_pd);
     }
     // gender
     if ($this->isSettingChangeable('gender')) {
         $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender");
         $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]);
         $female = new ilRadioOption($lng->txt("gender_f"), "f");
         $gndr->addOption($female);
         $male = new ilRadioOption($lng->txt("gender_m"), "m");
         $gndr->addOption($male);
         $this->form_gui->addItem($gndr);
     }
     // firstname, lastname, title
     $fields = array("firstname" => true, "lastname" => true, "title" => isset($settings["require_title"]) && $settings["require_title"]);
     foreach ($fields as $field => $req) {
         if ($this->isSettingChangeable($field)) {
             $inp = new ilTextInputGUI($lng->txt($field), $field);
             $inp->setSize(32);
             $inp->setMaxLength(32);
             $inp->setRequired($req);
             $this->form_gui->addItem($inp);
         }
     }
     // personal image
     if ($this->isSettingChangeable('upload')) {
         $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
         if ($a_mode == "edit" || $a_mode == "upload") {
             $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true, true));
         }
         $this->form_gui->addItem($pi);
     }
     if ($this->isSettingChangeable('birthday')) {
         $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday');
         $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]);
         $birthday->setShowEmpty(true);
         $birthday->setStartYear(1900);
         $this->form_gui->addItem($birthday);
     }
     // institution, department, street, city, zip code, country, phone office
     // phone home, phone mobile, fax, e-mail
     $fields = array(array("institution", 40, 80), array("department", 40, 80), array("street", 40, 40), array("city", 40, 40), array("zipcode", 10, 10), array("country", 40, 40), array("sel_country"), array("phone_office", 30, 30), array("phone_home", 30, 30), array("phone_mobile", 30, 30), array("fax", 30, 30));
     $counter = 0;
     foreach ($fields as $field) {
         if (!$counter++ and $this->isSettingChangeable($field[0])) {
             // contact data
             $sec_cd = new ilFormSectionHeaderGUI();
             $sec_cd->setTitle($this->lng->txt("contact_data"));
             $this->form_gui->addItem($sec_cd);
         }
         if ($this->isSettingChangeable($field[0])) {
             if ($field[0] != "sel_country") {
                 $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]);
                 $inp->setSize($field[1]);
                 $inp->setMaxLength($field[2]);
                 $inp->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]);
                 $this->form_gui->addItem($inp);
             } else {
                 // country selection
                 include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php";
                 $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]);
                 $cs->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]);
                 $this->form_gui->addItem($cs);
             }
         }
     }
     // email
     if ($this->isSettingChangeable('email')) {
         $em = new ilEMailInputGUI($lng->txt("email"), "email");
         $em->setRequired(isset($settings["require_email"]) && $settings["require_email"]);
         $this->form_gui->addItem($em);
     }
     // interests/hobbies
     if ($this->isSettingChangeable('hobby')) {
         $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby");
         $hob->setRows(3);
         $hob->setCols(40);
         $hob->setRequired(isset($settings["require_hobby"]) && $settings["require_hobby"]);
         $this->form_gui->addItem($hob);
     }
     // referral comment
     if ($this->isSettingChangeable('referral_comment')) {
         $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment");
         $rc->setRows(3);
         $rc->setCols(40);
         $rc->setRequired(isset($settings["require_referral_comment"]) && $settings["require_referral_comment"]);
         $this->form_gui->addItem($rc);
     }
     // interests
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("interests"));
     $this->form_gui->addItem($sh);
     $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
     foreach ($multi_fields as $multi_field) {
         if ($this->isSettingChangeable($multi_field)) {
             // see ilUserProfile
             $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field);
             $ti->setMulti(true);
             $ti->setMaxLength(40);
             $ti->setSize(40);
             $ti->setRequired(isset($settings["require_" . $multi_field]) && $settings["require_" . $multi_field]);
             $this->form_gui->addItem($ti);
         }
     }
     // instant messengers
     if ($this->isSettingChangeable('instant_messengers')) {
         $sec_im = new ilFormSectionHeaderGUI();
         $sec_im->setTitle($this->lng->txt("instant_messengers"));
         $this->form_gui->addItem($sec_im);
     }
     // icq, yahoo, msn, aim, skype
     $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
     foreach ($fields as $field) {
         if ($this->isSettingChangeable('instant_messengers')) {
             $im = new ilTextInputGUI($lng->txt("im_" . $field), "im_" . $field);
             $im->setSize(40);
             $im->setMaxLength(40);
             $this->form_gui->addItem($im);
         }
     }
     // other information
     if ($this->isSettingChangeable('user_profile_other')) {
         $sec_oi = new ilFormSectionHeaderGUI();
         $sec_oi->setTitle($this->lng->txt("user_profile_other"));
         $this->form_gui->addItem($sec_oi);
     }
     // matriculation number
     if ($this->isSettingChangeable('matriculation')) {
         $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation");
         $mr->setSize(40);
         $mr->setMaxLength(40);
         $mr->setRequired(isset($settings["require_matriculation"]) && $settings["require_matriculation"]);
         $this->form_gui->addItem($mr);
     }
     // delicious
     if ($this->isSettingChangeable('delicious')) {
         $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious");
         $mr->setSize(40);
         $mr->setMaxLength(40);
         $mr->setRequired(isset($settings["require_delicious"]) && $settings["require_delicious"]);
         $this->form_gui->addItem($mr);
     }
     // client IP
     $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip");
     $ip->setSize(40);
     $ip->setMaxLength(255);
     $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" . '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>");
     $this->form_gui->addItem($ip);
     // additional user defined fields
     include_once './Services/User/classes/class.ilUserDefinedFields.php';
     $user_defined_fields = ilUserDefinedFields::_getInstance();
     if ($this->usrf_ref_id == USER_FOLDER_ID) {
         $all_defs = $user_defined_fields->getDefinitions();
     } else {
         $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions();
     }
     foreach ($all_defs as $field_id => $definition) {
         if ($definition['field_type'] == UDF_TYPE_TEXT) {
             $udf = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
             $udf->setSize(40);
             $udf->setMaxLength(255);
         } else {
             if ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
                 $udf = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $udf->setUseRte(true);
             } else {
                 $udf = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $udf->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
             }
         }
         $udf->setRequired($definition['required']);
         $this->form_gui->addItem($udf);
     }
     // settings
     if ($a_mode == 'create' or $this->isSettingChangeable('language') or $this->isSettingChangeable('skin_style') or $this->isSettingChangeable('hits_per_page') or $this->isSettingChangeable('hide_own_online_status')) {
         $sec_st = new ilFormSectionHeaderGUI();
         $sec_st->setTitle($this->lng->txt("settings"));
         $this->form_gui->addItem($sec_st);
     }
     // role
     if ($a_mode == "create") {
         $role = new ilSelectInputGUI($lng->txt("default_role"), 'default_role');
         $role->setRequired(true);
         $role->setValue($this->default_role);
         $role->setOptions($this->selectable_roles);
         $this->form_gui->addItem($role);
     }
     // language
     if ($this->isSettingChangeable('language')) {
         $lang = new ilSelectInputGUI($lng->txt("language"), 'language');
         $languages = $lng->getInstalledLanguages();
         $lng->loadLanguageModule("meta");
         $options = array();
         foreach ($languages as $l) {
             $options[$l] = $lng->txt("meta_l_" . $l);
         }
         $lang->setOptions($options);
         $lang->setValue($ilSetting->get("language"));
         $this->form_gui->addItem($lang);
     }
     // skin/style
     if ($this->isSettingChangeable('skin_style')) {
         $sk = new ilSelectInputGUI($lng->txt("skin_style"), 'skin_style');
         $templates = $styleDefinition->getAllTemplates();
         include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
         $options = array();
         if (count($templates) > 0 && is_array($templates)) {
             foreach ($templates as $template) {
                 $styleDef =& new ilStyleDefinition($template["id"]);
                 $styleDef->startParsing();
                 $styles = $styleDef->getStyles();
                 foreach ($styles as $style) {
                     if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
                         continue;
                     }
                     $options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"];
                 }
             }
         }
         $sk->setOptions($options);
         $sk->setValue($ilClientIniFile->readVariable("layout", "skin") . ":" . $ilClientIniFile->readVariable("layout", "style"));
         $this->form_gui->addItem($sk);
     }
     // hits per page
     if ($this->isSettingChangeable('hits_per_page')) {
         $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"), 'hits_per_page');
         $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit"));
         $hpp->setOptions($options);
         $hpp->setValue($ilSetting->get("hits_per_page"));
         $this->form_gui->addItem($hpp);
         // users online
         $uo = new ilSelectInputGUI($lng->txt("users_online"), 'show_users_online');
         $options = array("y" => $lng->txt("users_online_show_y"), "associated" => $lng->txt("users_online_show_associated"), "n" => $lng->txt("users_online_show_n"));
         $uo->setOptions($options);
         $uo->setValue($ilSetting->get("show_users_online"));
         $this->form_gui->addItem($uo);
     }
     // hide online status
     if ($this->isSettingChangeable('hide_own_online_status')) {
         $os = new ilCheckboxInputGUI($lng->txt("hide_own_online_status"), "hide_own_online_status");
         $this->form_gui->addItem($os);
     }
     if ((int) $ilSetting->get('session_reminder_enabled')) {
         $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
         $cb->setValue(1);
         $this->form_gui->addItem($cb);
     }
     // Options
     if ($this->isSettingChangeable('send_mail')) {
         $sec_op = new ilFormSectionHeaderGUI();
         $sec_op->setTitle($this->lng->txt("options"));
         $this->form_gui->addItem($sec_op);
     }
     // send email
     $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail');
     $se->setInfo($lng->txt('inform_user_mail_info'));
     $se->setValue('y');
     $se->setChecked($ilUser->getPref('send_info_mails') == 'y');
     $this->form_gui->addItem($se);
     // ignore required fields
     $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf');
     $irf->setInfo($lng->txt('ignore_required_fields_info'));
     $irf->setValue(1);
     $this->form_gui->addItem($irf);
     // @todo: handle all required fields
     // command buttons
     if ($a_mode == "create" || $a_mode == "save") {
         $this->form_gui->addCommandButton("save", $lng->txt("save"));
     }
     if ($a_mode == "edit" || $a_mode == "update") {
         $this->form_gui->addCommandButton("update", $lng->txt("save"));
     }
     $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
 }
 /**
  * Role Mapping Tab
  * @global ilToolbarGUI $ilToolbar 
  */
 public function roleMapping()
 {
     global $ilToolbar;
     $this->setSubTabs();
     $this->tabs_gui->setSubTabActive('ldap_role_mapping');
     $ilToolbar->addButton($this->lng->txt("ldap_new_role_assignment"), $this->ctrl->getLinkTarget($this, 'addRoleMapping'));
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     //Set propertyform for synchronization settings
     include_once "./Services/Form/classes/class.ilCombinationInputGUI.php";
     $propertie_form = new ilPropertyFormGUI();
     $propertie_form->setTitle($this->lng->txt('ldap_role_settings'));
     $propertie_form->setFormAction($this->ctrl->getFormAction($this, "saveSyncronizationSettings"));
     $propertie_form->addCommandButton("saveSyncronizationSettings", $this->lng->txt('save'));
     $role_active = new ilCheckboxInputGUI($this->lng->txt('ldap_role_active'));
     $role_active->setPostVar('role_sync_active');
     $role_active->setChecked($this->server->enabledRoleSynchronization() ? true : false);
     $propertie_form->addItem($role_active);
     $binding = new ilCombinationInputGUI($this->lng->txt('ldap_server_binding'));
     $binding->setInfo($this->lng->txt('ldap_role_bind_user_info'));
     $user = new ilTextInputGUI("");
     $user->setPostVar("role_bind_user");
     $user->setValue($this->server->getRoleBindDN());
     $user->setSize(50);
     $user->setMaxLength(255);
     $binding->addCombinationItem(0, $user, $this->lng->txt('ldap_role_bind_user'));
     $pass = new ilPasswordInputGUI("");
     $pass->setPostVar("role_bind_pass");
     $pass->setValue($this->server->getRoleBindPassword());
     $pass->setSize(12);
     $pass->setMaxLength(36);
     $pass->setRetype(false);
     $binding->addCombinationItem(1, $pass, $this->lng->txt('ldap_role_bind_pass'));
     $propertie_form->addItem($binding);
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_mappings.html', 'Services/LDAP');
     $this->tpl->setVariable("NEW_ASSIGNMENT_TBL", $propertie_form->getHTML());
     //Set Group Assignments Table if mappings exist
     include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
     $mapping_instance = ilLDAPRoleGroupMappingSettings::_getInstanceByServerId($this->server->getServerId());
     $mappings = $mapping_instance->getMappings();
     if (count($mappings)) {
         include_once "./Services/LDAP/classes/class.ilLDAPRoleMappingTableGUI.php";
         $table_gui = new ilLDAPRoleMappingTableGUI($this, $this->server->getServerId(), "roleMapping");
         $table_gui->setTitle($this->lng->txt('ldap_role_group_assignments'));
         $table_gui->setData($mappings);
         $this->tpl->setVariable("RULES_TBL", $table_gui->getHTML());
     }
 }
 /**
  * add type specific input fields to a form  
  * 
  * @param object	form, property or radio option
  * @param array		(assoc) input values
  * @param string	configuration level ("type" or "object")
  * @param string	parent field value
  * @param string	parent option value
  * @param int		maximum recursion depth
  */
 function addFormElements($a_object, $a_values = array(), $a_level = "object", $a_parentfield = '', $a_parentvalue = '', $a_maxdepth = "3")
 {
     // recursion end
     if ($a_maxdepth == 0) {
         return;
     }
     foreach ($this->getInputFields($a_level, $a_parentfield, $a_parentvalue) as $field) {
         $value = $a_values['field_' . $field->field_name];
         $value = $value ? $value : $field->default;
         switch ($field->field_type) {
             case self::FIELDTYPE_HEADER:
                 $item = new ilFormSectionHeaderGUI();
                 $item->setTitle($field->title);
                 break;
             case self::FIELDTYPE_DESCRIPTION:
                 $item = new ilCustomInputGUI($field->title);
                 $item->setHtml(nl2br($field->description));
                 break;
             case self::FIELDTYPE_TEXT:
                 $item = new ilTextInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setRequired($field->required ? true : false);
                 $item->setSize($field->size);
                 $item->setValue($value);
                 break;
             case self::FIELDTYPE_TEXTAREA:
                 $item = new ilTextAreaInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setRequired($field->required ? true : false);
                 $item->setUseRte($field->richtext ? true : false);
                 $item->setRows($field->rows);
                 $item->setCols($field->cols);
                 $item->setValue($value);
                 break;
             case self::FIELDTYPE_PASSWORD:
                 $item = new ilPasswordInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setRequired($field->required ? true : false);
                 $item->setValue($value);
                 break;
             case self::FIELDTYPE_CHECKBOX:
                 $item = new ilCheckboxInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 if ($value) {
                     $item->setChecked(true);
                 }
                 break;
             case self::FIELDTYPE_RADIO:
                 $item = new ilRadioGroupInputGUI($field->title, 'field_' . $field->field_name);
                 $item->setInfo($field->description);
                 $item->setValue($value);
                 foreach ($field->options as $option) {
                     $ropt = new ilRadioOption($option->title, $option->value);
                     $ropt->setInfo($option->description);
                     // add the sub items to the option
                     $item->addOption($ropt);
                     $this->addFormElements($ropt, $a_values, $a_level, $field->field_name, $option->value, $a_maxdepth - 1);
                 }
                 break;
             default:
                 continue 2;
         }
         // add the item to the form or to the parent item
         if (is_a($a_object, 'ilPropertyFormGUI')) {
             $a_object->addItem($item);
         } else {
             $a_object->addSubItem($item);
         }
         // add the sub items to the item
         if (is_a($item, 'ilSubEnabledFormPropertyGUI')) {
             $this->addFormElements($item, $a_level, $a_values, $field->field_name, '', $a_maxdepth - 1);
         }
     }
 }
 protected function initPasswordForm()
 {
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("wsp_set_permission_all_password"));
     $password = new ilPasswordInputGUI($this->lng->txt("password"), "password");
     $password->setRequired(true);
     $form->addItem($password);
     $form->addCommandButton('savepasswordform', $this->lng->txt("save"));
     $form->addCommandButton('share', $this->lng->txt("cancel"));
     return $form;
 }
Esempio n. 18
0
 /**
  * Init password form
  * @return 
  */
 protected function initFormPasswordInstruction()
 {
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     // new password
     $ipass = new ilPasswordInputGUI($this->lng->txt("desired_password"), "new_password");
     $ipass->setRequired(true);
     $this->form->addItem($ipass);
     $this->form->addCommandButton("savePassword", $this->lng->txt("save"));
     $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $this->form->setTitle($this->lng->txt("chg_ilias_and_webfolder_password"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     return $this->form;
 }
 protected function initPasswordForm($a_node_id)
 {
     global $ilCtrl, $lng;
     $this->ctrl->setParameter($this, "item_ref_id", $a_node_id);
     $object_data = $this->getAccessHandler()->getObjectDataFromNode($a_node_id);
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "checkPassword"));
     $form->setTitle($lng->txt("wsp_password_for") . ": " . $object_data["title"]);
     $password = new ilPasswordInputGUI($lng->txt("password"), "password");
     $password->setRetype(false);
     $password->setRequired(true);
     $password->setSkipSyntaxCheck(true);
     $form->addItem($password);
     $form->addCommandButton("checkPassword", $lng->txt("submit"));
     $form->addCommandButton("share", $lng->txt("cancel"));
     return $form;
 }
 /**
  * Init password form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initPasswordForm()
 {
     global $lng, $ilUser, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // Check whether password change is allowed
     if ($this->allowPasswordChange()) {
         // The current password needs to be checked for verification
         // unless the user uses Shibboleth authentication with additional
         // local authentication for WebDAV.
         //if (
         //	($ilUser->getAuthMode(true) != AUTH_SHIBBOLETH || !$ilSetting->get("shib_auth_allow_local"))
         //)
         if ($ilUser->getAuthMode(true) == AUTH_LOCAL) {
             // current password
             $cpass = new ilPasswordInputGUI($lng->txt("current_password"), "current_password");
             $cpass->setRetype(false);
             $cpass->setSkipSyntaxCheck(true);
             // only if a password exists.
             if ($ilUser->getPasswd()) {
                 $cpass->setRequired(true);
             }
             $this->form->addItem($cpass);
         }
         // new password
         $ipass = new ilPasswordInputGUI($lng->txt("desired_password"), "new_password");
         $ipass->setRequired(true);
         $ipass->setInfo(ilUtil::getPasswordRequirementsInfo());
         if ($ilSetting->get("passwd_auto_generate") == 1) {
             $ipass->setPreSelection(true);
             $this->form->addItem($ipass);
             $this->form->addCommandButton("savePassword", $lng->txt("save"));
             $this->form->addCommandButton("showPassword", $lng->txt("new_list_password"));
         } else {
             $this->form->addItem($ipass);
             $this->form->addCommandButton("savePassword", $lng->txt("save"));
         }
         switch ($ilUser->getAuthMode(true)) {
             case AUTH_LOCAL:
                 $this->form->setTitle($lng->txt("chg_password"));
                 break;
             case AUTH_SHIBBOLETH:
             case AUTH_CAS:
                 require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
                 if (ilDAVServer::_isActive()) {
                     $this->form->setTitle($lng->txt("chg_ilias_and_webfolder_password"));
                 } else {
                     $this->form->setTitle($lng->txt("chg_ilias_password"));
                 }
                 break;
             default:
                 $this->form->setTitle($lng->txt("chg_ilias_password"));
                 break;
         }
         $this->form->setFormAction($this->ctrl->getFormAction($this));
     }
 }
 protected function initPasswordForm()
 {
     global $ilCtrl, $lng, $ilUser, $ilTabs;
     if ($this->node_id) {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
         $object_data = ilWorkspaceAccessHandler::getObjectDataFromNode($this->node_id);
     } else {
         $object_data["title"] = ilObject::_lookupTitle($this->portfolio_id);
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "checkPassword"));
     $form->setTitle($lng->txt("wsp_password_for") . ": " . $object_data["title"]);
     $password = new ilPasswordInputGUI($lng->txt("password"), "password");
     $password->setRetype(false);
     $password->setRequired(true);
     $form->addItem($password);
     $form->addCommandButton("checkPassword", $lng->txt("submit"));
     if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
         $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "cancelPassword"));
         $form->addCommandButton("cancelPassword", $lng->txt("cancel"));
     }
     return $form;
 }
 /**
  * @return ilPropertyFormGUI
  */
 public function getClientSettingsForm()
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     $form = new ilPropertyFormGUI();
     $cb = new ilCheckboxInputGUI($lng->txt('chat_enabled'), 'chat_enabled');
     $form->addItem($cb);
     $cb = new ilCheckboxInputGUI($lng->txt('enable_osd'), 'enable_osd');
     $cb->setInfo($lng->txt('hint_osd'));
     $form->addItem($cb);
     $txt = new ilNumberInputGUI($lng->txt('osd_intervall'), 'osd_intervall');
     $txt->setMinValue(1);
     $txt->setRequired(true);
     $txt->setInfo($lng->txt('hint_osd_interval'));
     $cb->addSubItem($txt);
     $cb1 = new ilCheckboxInputGUI($lng->txt('play_invitation_sound'), 'play_invitation_sound');
     $cb1->setInfo($lng->txt('play_invitation_sound'));
     $cb->addSubItem($cb1);
     $cb = new ilCheckboxInputGUI($lng->txt('enable_smilies'), 'enable_smilies');
     $cb->setInfo($lng->txt('hint_enable_smilies'));
     $form->addItem($cb);
     $name = new ilTextInputGUI($lng->txt('instance_name'), 'name');
     $name->setRequired(true);
     $name->setValidationRegexp('/^[a-z0-9_-]+$/i');
     $name->setInfo($lng->txt('hint_unique_name'));
     $form->addItem($name);
     $url = new ilTextInputGUI($lng->txt('ilias_url'), 'url');
     $url->setRequired(true);
     $form->addItem($url);
     $user = new ilTextInputGUI($lng->txt('soap_user'), 'user');
     $user->setInfo($lng->txt('soap_user_hint'));
     $user->setRequired(true);
     $form->addItem($user);
     $password = new ilPasswordInputGUI($lng->txt('soap_user_password'), 'password');
     $password->setRequired(true);
     $form->addItem($password);
     return $form;
 }