/** * 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')); }
/** * Show settings screen. */ function editSettings() { global $ilUser, $lng, $ilCtrl, $ilSetting; $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); $allow_shorter_periods = $news_set->get("allow_shorter_periods"); $allow_longer_periods = $news_set->get("allow_longer_periods"); $enable_private_feed = $news_set->get("enable_private_feed"); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; if ($allow_shorter_periods || $allow_longer_periods) { $form = new ilPropertyFormGUI(); include_once "./Services/News/classes/class.ilNewsItem.php"; $default_per = ilNewsItem::_lookupDefaultPDPeriod(); $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId()); $form->setTitle($lng->txt("news_settings")); $form->setTitleIcon(ilUtil::getImagePath("icon_news.png")); $form->setTableWidth("100%"); $per_opts = array(2 => "2 " . $lng->txt("days"), 3 => "3 " . $lng->txt("days"), 5 => "5 " . $lng->txt("days"), 7 => "1 " . $lng->txt("week"), 14 => "2 " . $lng->txt("weeks"), 30 => "1 " . $lng->txt("month"), 60 => "2 " . $lng->txt("months"), 120 => "4 " . $lng->txt("months"), 180 => "6 " . $lng->txt("months"), 366 => "1 " . $lng->txt("year")); $unset = array(); foreach ($per_opts as $k => $opt) { if (!$allow_shorter_periods && $k < $default_per) { $unset[$k] = $k; } if (!$allow_longer_periods && $k > $default_per) { $unset[$k] = $k; } } foreach ($unset as $k) { unset($per_opts[$k]); } $per_sel = new ilSelectInputGUI($lng->txt("news_pd_period"), "news_pd_period"); //$per_sel->setInfo($lng->txt("news_pd_period_info")); $per_sel->setOptions($per_opts); $per_sel->setValue((int) $per); $form->addItem($per_sel); //$form->addCheckboxProperty($lng->txt("news_public_feed"), "notifications_public_feed", // "1", $public_feed, $lng->txt("news_public_feed_info")); //if ($this->getProperty("public_notifications_option")) //{ // $form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public", // "1", $public, $lng->txt("news_notifications_public_info")); //} $form->addCommandButton("saveSettings", $lng->txt("save")); $form->addCommandButton("cancelSettings", $lng->txt("cancel")); $form->setFormAction($ilCtrl->getFormaction($this)); $returnForm = $form->getHTML(); } if ($enable_private_feed) { $feed_form = new ilPropertyFormGUI(); $feed_form->setTitle($lng->txt("priv_feed_settings")); $feed_form->setTitleIcon(ilUtil::getImagePath("privrss.png")); $feed_form->setTableWidth("100%"); $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed"); $retype_pass = new ilTextInputGUI($lng->txt("retype_password"), "retype_password"); $desired_pass = new ilTextInputGUI($lng->txt("desired_password"), "desired_password"); // user has already valid password if (ilObjUser::_getFeedPass($_SESSION[AccountId]) != false) { $enable_private_feed->setChecked(true); $desired_pass->setValue("******"); } $desired_pass->setInputType("password"); $retype_pass->setInputType("password"); $feed_form->addItem($enable_private_feed); $feed_form->addItem($desired_pass); $feed_form->addItem($retype_pass); $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save")); $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel")); $feed_form->setFormAction($ilCtrl->getFormaction($this)); $returnForm .= $returnForm == "" ? $feed_form->getHTML() : "<br>" . $feed_form->getHTML(); } return $returnForm; }
/** * fill registration type * * @access protected * @return */ protected function fillRegistrationType() { global $ilUser; if ($this->container->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED) { $reg = new ilCustomInputGUI($this->lng->txt('mem_reg_type')); #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated')); $reg->setAlert($this->lng->txt('crs_info_reg_deactivated')); #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated')); #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); #$reg->setValue($this->lng->txt('crs_info_reg_deactivated')); #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert')); $this->form->addItem($reg); // Disable registration $this->enableRegistration(false); return true; } switch ($this->container->getSubscriptionType()) { case IL_CRS_SUBSCRIPTION_DIRECT: // no "request" info if waiting list is active if ($this->isWaitingListActive()) { return true; } $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); $txt->setValue($this->lng->txt('crs_info_reg_direct')); $this->form->addItem($txt); break; case IL_CRS_SUBSCRIPTION_PASSWORD: $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); $txt->setValue($this->lng->txt('crs_subscription_options_password')); $pass = new ilTextInputGUI($this->lng->txt('passwd'), 'grp_passw'); $pass->setInputType('password'); $pass->setSize(12); $pass->setMaxLength(32); #$pass->setRequired(true); $pass->setInfo($this->lng->txt('crs_info_reg_password')); $txt->addSubItem($pass); $this->form->addItem($txt); break; case IL_CRS_SUBSCRIPTION_CONFIRMATION: // no "request" info if waiting list is active if ($this->isWaitingListActive()) { return true; } $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); $txt->setValue($this->lng->txt('crs_subscription_options_confirmation')); $sub = new ilTextAreaInputGUI($this->lng->txt('crs_reg_subject'), 'subject'); $sub->setValue($_POST['subject']); $sub->setInfo($this->lng->txt('crs_info_reg_confirmation')); $sub->setCols(40); $sub->setRows(5); if ($this->participants->isSubscriber($ilUser->getId())) { $sub_data = $this->participants->getSubscriberData($ilUser->getId()); $sub->setValue($sub_data['subject']); $sub->setInfo(''); ilUtil::sendFailure($this->lng->txt('crs_reg_user_already_subscribed')); $this->enableRegistration(false); } $txt->addSubItem($sub); $this->form->addItem($txt); break; default: return true; } return true; }
/** * fill registration procedure * * @access protected * @param * @return */ protected function fillRegistrationType() { global $ilUser; if ($this->getWaitingList()->isOnList($ilUser->getId())) { return true; } switch ($this->container->getRegistrationType()) { case GRP_REGISTRATION_DEACTIVATED: $reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); $reg->setValue($this->lng->txt('grp_reg_disabled')); #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert')); $this->form->addItem($reg); // Disable registration $this->enableRegistration(false); break; case GRP_REGISTRATION_PASSWORD: $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); $txt->setValue($this->lng->txt('grp_pass_request')); $pass = new ilTextInputGUI($this->lng->txt('passwd'), 'grp_passw'); $pass->setInputType('password'); $pass->setSize(12); $pass->setMaxLength(32); #$pass->setRequired(true); $pass->setInfo($this->lng->txt('group_password_registration_msg')); $txt->addSubItem($pass); $this->form->addItem($txt); break; case GRP_REGISTRATION_REQUEST: // no "request" info if waiting list is active if ($this->isWaitingListActive()) { return true; } $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); $txt->setValue($this->lng->txt('grp_reg_request')); $sub = new ilTextAreaInputGUI($this->lng->txt('grp_reg_subject'), 'subject'); $sub->setValue($_POST['subject']); $sub->setInfo($this->lng->txt('group_req_registration_msg')); $sub->setCols(40); $sub->setRows(5); if ($this->participants->isSubscriber($ilUser->getId())) { $sub_data = $this->participants->getSubscriberData($ilUser->getId()); $sub->setValue($sub_data['subject']); $sub->setInfo(''); ilUtil::sendFailure($this->lng->txt('grp_already_assigned')); $this->enableRegistration(false); } $txt->addSubItem($sub); $this->form->addItem($txt); break; case GRP_REGISTRATION_DIRECT: // no "direct registration" info if waiting list is active if ($this->isWaitingListActive()) { return true; } $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type')); $txt->setValue($this->lng->txt('group_req_direct')); $this->form->addItem($txt); break; default: return true; } return true; }