public function settings() { global $rbacreview; $this->tabs_gui->setSubTabActive('shib_settings'); // set already saved data or default value for port $settings = $this->ilias->getAllSettings(); // Compose role list $role_list = $rbacreview->getRolesByFilter(2); $role = array(); if (!isset($settings["shib_user_default_role"])) { $settings["shib_user_default_role"] = 4; } if (!isset($settings["shib_idp_list"]) || $settings["shib_idp_list"] == '') { $settings["shib_idp_list"] = "urn:mace:organization1:providerID, Example Organization 1\nurn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/SWITCHaai"; } if (!isset($settings["shib_login_button"]) || $settings["shib_login_button"] == '') { $settings["shib_login_button"] = "templates/default/images/shib_login_button.png"; } if (!isset($settings["shib_hos_type"]) || $settings["shib_hos_type"] == '') { $settings["shib_hos_type"] = 'internal_wayf'; } foreach ($role_list as $data) { $role[$data["obj_id"]] = $data["title"]; } // Set text field content $shib_settings = array('shib_login', 'shib_title', 'shib_firstname', 'shib_lastname', 'shib_email', 'shib_gender', 'shib_institution', 'shib_department', 'shib_zipcode', 'shib_city', 'shib_country', 'shib_street', 'shib_phone_office', 'shib_phone_home', 'shib_phone_mobile', 'shib_language', 'shib_matriculation'); //set PropertyFormGUI include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $propertys = new ilPropertyFormGUI(); $propertys->setTitle($this->lng->txt("shib")); $propertys->setFormAction($this->ctrl->getFormAction($this, "save")); $propertys->addCommandButton("save", $this->lng->txt("save")); $propertys->addCommandButton("settings", $this->lng->txt("cancel")); //set enable shibboleth support $enable = new ilCheckboxInputGUI(); $enable->setTitle($this->lng->txt("shib_active")); $read_me_link = "./Services/AuthShibboleth/README.SHIBBOLETH.txt"; $info = "<a href='" . $read_me_link . "' target='_blank'>" . $this->lng->txt("auth_shib_instructions") . "</a>"; $enable->setInfo($info); $enable->setPostVar("shib[active]"); $enable->setChecked($settings["shib_active"]); //set allow local authentication $local = new ilCheckboxInputGUI(); $local->setTitle($this->lng->txt("auth_allow_local")); $local->setPostVar("shib[auth_allow_local]"); $local->setChecked($settings['shib_auth_allow_local']); //set user default role $defaultrole = new ilSelectInputGUI(); $defaultrole->setTitle($this->lng->txt("shib_user_default_role")); $defaultrole->setPostVar("shib[user_default_role]"); $defaultrole->setOptions($role); $defaultrole->setRequired(true); $defaultrole->setValue($settings["shib_user_default_role"]); //set name of federation $name = new ilTextInputGUI(); $name->setTitle($this->lng->txt("shib_federation_name")); $name->setPostVar("shib[federation_name]"); $name->setSize(40); $name->setMaxLength(50); $name->setRequired(true); $name->setValue(stripslashes($settings["shib_federation_name"])); //set Organize selection group include_once "./Services/Form/classes/class.ilRadioGroupInputGUI.php"; include_once "./Services/Form/classes/class.ilRadioOption.php"; $organize = new ilRadioGroupInputGUI(); $organize->setTitle($this->lng->txt("shib_login_type")); $organize->setPostVar("shib[hos_type]"); $organize->setRequired(true); $organize->setValue($settings["shib_hos_type"]); //set 1. option internalwayf $internalwayf = new ilRadioOption(); $internalwayf->setTitle($this->lng->txt("shib_login_internal_wayf")); $internalwayf->setValue("internal_wayf"); //set 1. option internalwayf textbox idplist $idplist = new ilTextAreaInputGUI(); $idplist->setInfo($this->lng->txt("shib_idp_list")); $idplist->setPostVar("shib[idp_list]"); $idplist->setRows(3); $idplist->setCols(50); $idplist->setValue($settings["shib_idp_list"]); //set 2. Option externalwayf $externalwayf = new ilRadioOption(); $externalwayf->setTitle($this->lng->txt("shib_login_external_wayf")); $externalwayf->setValue("external_wayf"); //set 2. Option externalwayf textfield path to login button image $loginbutton = new ilTextInputGUI(); $loginbutton->setInfo($this->lng->txt("shib_login_button")); $loginbutton->setPostVar("shib[login_button]"); $loginbutton->setSize(50); $loginbutton->setMaxLength(255); $loginbutton->setValue($settings["shib_login_button"]); //set 3. Option embeddedwayf $embeddedwayf = new ilRadioOption(); $embeddedwayf->setTitle($this->lng->txt("shib_login_embedded_wayf")); $embeddedwayf->setInfo($this->lng->txt("shib_login_embedded_wayf_description")); $embeddedwayf->setValue("embedded_wayf"); //set login instructions $logininstruction = new ilTextAreaInputGUI(); $logininstruction->setTitle($this->lng->txt("auth_login_instructions")); $logininstruction->setPostVar("shib[login_instructions]"); $logininstruction->setRows(3); $logininstruction->setCols(50); $logininstruction->setValue(stripslashes($settings["shib_login_instructions"])); //set path to data manipulation API $dataconv = new ilTextInputGUI(); $dataconv->setTitle($this->lng->txt("shib_data_conv")); $dataconv->setPostVar("shib[data_conv]"); $dataconv->setSize(80); $dataconv->setMaxLength(512); $dataconv->setValue($settings["shib_data_conv"]); //field mappings $fields = array(); foreach ($shib_settings as $setting) { $field = ereg_replace('shib_', '', $setting); $textinput = new ilTextInputGUI(); $textinput->setTitle($this->lng->txt($setting)); $textinput->setPostVar("shib[" . $field . "]"); $textinput->setValue($settings[$setting]); $textinput->setSize(40); $textinput->setMaxLength(50); $checkinput = new ilCheckboxInputGUI(""); $checkinput->setOptionTitle($this->lng->txt("shib_update")); $checkinput->setPostVar("shib[update_" . $field . "]"); $checkinput->setChecked($settings["shib_update_" . $field]); if ($setting == 'shib_login' || $setting == 'shib_title' || $setting == 'shib_firstname' || $setting == 'shib_lastname' || $setting == 'shib_email') { $textinput->setRequired(true); } $fields[$setting] = array("text" => $textinput, "check" => $checkinput); } $propertys->addItem($enable); $propertys->addItem($local); $propertys->addItem($defaultrole); $propertys->addItem($name); $internalwayf->addSubItem($idplist); $organize->addOption($internalwayf); $externalwayf->addSubItem($loginbutton); $organize->addOption($externalwayf); $organize->addOption($embeddedwayf); $propertys->addItem($organize); $propertys->addItem($logininstruction); $propertys->addItem($dataconv); foreach ($shib_settings as $setting) { $propertys->addItem($fields[$setting]["text"]); if ($setting != "shib_login") { $propertys->addItem($fields[$setting]["check"]); } } $this->tpl->setContent($propertys->getHTML()); }
public function editPriceObject() { $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id']; $price = ilPaymentPrices::_getPrice($price_id); $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false); if ($tmp_obj) { $form->setTitle($tmp_obj->getTitle()); } else { $form->setTitle($this->lng->txt('object_not_found')); } //price_type $radio_group = new ilRadioGroupInputGUI('', 'price_type'); $radio_group->setTitle($this->lng->txt('duration')); $radio_group->setRequired(true); $radio_group->setValue($price['price_type']); $radio_group->setPostVar('price_type'); $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH); // duration month $oDuration = new ilNumberInputGUI(); $oDuration->setTitle($this->lng->txt('paya_months')); $oDuration->setSize('20%'); $oDuration->setValue($price['duration']); $oDuration->setPostVar('duration_month'); $radio_option_1->addSubItem($oDuration); $radio_group->addOption($radio_option_1); $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE); // duration_date from $o_date_from = new ilDateTimeInputGUI(); $o_date_from->setTitle($this->lng->txt('cal_from')); $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE)); $o_date_from->setPostVar('duration_date_from'); $radio_option_3->addSubItem($o_date_from); // duration_date until $o_date_until = new ilDateTimeInputGUI(); $o_date_until->setTitle($this->lng->txt('cal_until')); $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE)); $o_date_until->setPostVar('duration_date_until'); $radio_option_3->addSubItem($o_date_until); $radio_group->addOption($radio_option_3); $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION); $radio_group->addOption($radio_option_2); $form->addItem($radio_group); // description $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $oDescription->setRows(4); $oDescription->setCols(35); $oDescription->setValue($price['description']); $form->addItem($oDescription); // price $oPrice = new ilNumberInputGUI(); $oPrice->setTitle($this->lng->txt('price_a')); $oPrice->setSize('20%'); $oPrice->setRequired(true); $oPrice->setValue($price['price']); include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $oPrice->setInfo($genSet->get('currency_unit')); $oPrice->setPostVar('price'); $oPrice->allowDecimals(true); $form->addItem($oPrice); //extension $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension'); $oExtension->setChecked($price['extension']); $form->addItem($oExtension); $o_hidden_1 = new ilHiddenInputGUI('pobject_id'); $o_hidden_1->setValue((int) $_GET['pobject_id']); $o_hidden_1->setPostVar('pobject_id'); $o_hidden_2 = new ilHiddenInputGUI('price_id'); $o_hidden_2->setValue((int) $_GET['price_id']); $o_hidden_2->setPostVar('price_id'); $form->addItem($o_hidden_1); $form->addItem($o_hidden_2); $form->addCommandButton('updatePrice', $this->lng->txt('save')); $form->addCommandButton('editPrices', $this->lng->txt('cancel')); $this->tpl->setVariable('FORM', $form->getHTML()); }
public function generateCodes($view = "choice") { $this->coupon_obj->setId($_GET['coupon_id']); $this->ctrl->setParameter($this, 'coupon_id', $_GET['coupon_id']); $this->__showButtons(); $this->coupon_obj->getCouponById(ilUtil::stripSlashes($_GET['coupon_id'])); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $oForm_1 = new ilPropertyFormGUI(); $oForm_1->setId('save_frm'); $oForm_1->setFormAction($this->ctrl->getFormAction($this), 'saveCodeForm'); $oForm_1->setTitle($this->lng->txt("paya_coupons_coupon") . " " . $this->coupon_obj->getTitle() . ": " . $this->lng->txt('paya_coupons_code_generation')); if ($view == "choice") { $oTypeRadio = new ilRadioGroupInputGUI($this->lng->txt('paya_coupons_generate_codes'), 'generate_type'); $radio_option = new ilRadioOption($this->lng->txt('paya_coupons_type_auto'), 'auto'); $oTypeRadio->addOption($radio_option); $radio_option = new ilRadioOption($this->lng->txt('paya_coupons_type_self'), 'self'); $oTypeRadio->addOption($radio_option); $oTypeRadio->setValue(isset($_POST["generate_type"]) ? $_POST["generate_type"] : "auto"); $oTypeRadio->setPostVar('generate_type'); $oForm_1->addItem($oTypeRadio); $oNumCodes = new ilNumberInputGUI($this->lng->txt("paya_coupons_number_of_codes"), 'generate_number'); $oNumCodes->setSize(5); $oNumCodes->setValue($_POST['generate_number']); $oNumCodes->setRequired(true); $oForm_1->addItem($oNumCodes); $oLength = new ilNumberInputGUI($this->lng->txt("paya_coupons_code_length"), 'generate_length'); $oLength->setSize(5); $oLength->setValue($_POST['generate_length']); $oLength->setRequired(true); $oLength->setInfo($this->lng->txt('paya_coupons_type_self')); $oForm_1->addItem($oLength); $oForm_1->addCommandButton('saveCodeForm', $this->lng->txt('save')); $this->tpl->setVariable('FORM', $oForm_1->getHTML()); $oForm_2 = new ilPropertyformGUI(); $oForm_2->setId('import_frm'); $oForm_2->setFormAction($this->ctrl->getFormAction($this), 'showCodeImport'); $oForm_2->addCommandButton('showCodeImport', $this->lng->txt('import')); $this->tpl->setVariable('FORM_2', $oForm_2->getHTML()); } else { if ($view == "input") { if (is_numeric($_POST['generate_number']) && $_POST['generate_number'] > 0) { for ($i = 0; $i < $_POST['generate_number']; $i++) { $index = $i + 1; $oLoopCode = new ilTextInputGUI('#' . $index, 'codes[' . $i . ']'); $oForm_1->addItem($oLoopCode); } $oForm_1->addCommandButton('saveCodeForm', $this->lng->txt('save')); } $this->tpl->setVariable('FORM', $oForm_1->getHTML()); $oLoopCode = new ilTextInputGUI(); } } return true; }