本文整理汇总了PHP中ilRadioOption::setInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP ilRadioOption::setInfo方法的具体用法?PHP ilRadioOption::setInfo怎么用?PHP ilRadioOption::setInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilRadioOption
的用法示例。
在下文中一共展示了ilRadioOption::setInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToForm
public function addToForm()
{
global $lng;
$def = $this->getADT()->getCopyOfDefinition();
$selection = $this->getADT()->getSelection();
$options = $def->getOptions();
asort($options);
// ?
if (!$this->isRequired()) {
$options = array("" => "-") + $options;
} else {
if ($this->getADT()->isNull()) {
$options = array("" => $lng->txt("please_select")) + $options;
}
}
if (!(bool) $this->force_radio) {
$select = new ilSelectInputGUI($this->getTitle(), $this->getElementId());
$select->setOptions($options);
} else {
$select = new ilRadioGroupInputGUI($this->getTitle(), $this->getElementId());
foreach ($options as $value => $caption) {
$option = new ilRadioOption($caption, $value);
if (is_array($this->option_infos) && array_key_exists($value, $this->option_infos)) {
$option->setInfo($this->option_infos[$value]);
}
$select->addOption($option);
}
}
$this->addBasicFieldProperties($select, $def);
$select->setValue($selection);
$this->addToParentElement($select);
}
示例2: addFormProperties
/**
* add the configuration elements to a property form
* @param object property form
*/
public function addFormProperties(ilPropertyFormGUI $a_form)
{
global $lng;
$lng->loadLanguageModule('adve');
$availability = new ilRadioGroupInputGUI($lng->txt('char_selector'), 'char_selector_availability');
$inactive = new ilRadioOption($lng->txt('char_selector_inactive'), ilCharSelectorConfig::INACTIVE);
$inactive->setInfo($lng->txt('char_selector_inactive_info_' . $this->config->getContext()));
$inherit = new ilRadioOption($lng->txt('char_selector_inherit'), ilCharSelectorConfig::INHERIT);
$inherit->setInfo($lng->txt('char_selector_inherit_info_' . $this->config->getContext()));
$enabled = new ilRadioOption($lng->txt('char_selector_enabled'), ilCharSelectorConfig::ENABLED);
$enabled->setInfo($lng->txt('char_selector_enabled_info_' . $this->config->getContext()));
$disabled = new ilRadioOption($lng->txt('char_selector_disabled'), ilCharSelectorConfig::DISABLED);
$disabled->setInfo($lng->txt('char_selector_disabled_info_' . $this->config->getContext()));
$blocks = new ilSelectInputGUI($lng->txt('char_selector_blocks'), 'char_selector_blocks');
$blocks->setInfo($lng->txt('char_selector_blocks_info'));
$blocks->setOptions($this->config->getBlockOptions());
$blocks->setMulti(true);
$enabled->addSubItem($blocks);
$custom_items = new ilTextAreaInputGUI($lng->txt('char_selector_custom_items'), 'char_selector_custom_items');
$tpl = new ilTemplate("tpl.char_selector_custom_info.html", true, true, "Services/UIComponent/CharSelector");
$tpl->setVariable('1', $lng->txt('char_selector_custom_items_info1'));
$tpl->setVariable('2a', $lng->txt('char_selector_custom_items_info2a'));
$tpl->setVariable('2b', $lng->txt('char_selector_custom_items_info2b'));
$tpl->setVariable('3a', $lng->txt('char_selector_custom_items_info3a'));
$tpl->setVariable('3b', $lng->txt('char_selector_custom_items_info3b'));
$tpl->setVariable('4a', $lng->txt('char_selector_custom_items_info4a'));
$tpl->setVariable('4b', $lng->txt('char_selector_custom_items_info4b'));
$tpl->setVariable('5a', $lng->txt('char_selector_custom_items_info5a'));
$tpl->setVariable('5b', $lng->txt('char_selector_custom_items_info5b'));
$tpl->setVariable('6a', $lng->txt('char_selector_custom_items_info6a'));
$tpl->setVariable('6b', $lng->txt('char_selector_custom_items_info6b'));
$custom_items->setInfo($tpl->get());
$enabled->addSubItem($custom_items);
switch ($this->config->getContext()) {
case ilCharSelectorConfig::CONTEXT_ADMIN:
$availability->addOption($inactive);
$availability->addOption($enabled);
$availability->addOption($disabled);
$a_form->addItem($availability);
break;
case ilCharSelectorConfig::CONTEXT_USER:
case ilCharSelectorConfig::CONTEXT_TEST:
$availability->addOption($inherit);
$availability->addOption($enabled);
$availability->addOption($disabled);
$a_form->addItem($availability);
break;
}
}
示例3: initPluginCreationFormSection
/**
* @param ilRadioOption $option
* @throws ilCloudPluginConfigException
*/
public function initPluginCreationFormSection(ilRadioOption $option)
{
$option->setInfo($this->txt("create_info1") . "</br>" . $this->txt("create_info2") . $this->getAdminConfigObject()->getAppName() . $this->txt("create_info3"));
$sub_selection = new ilRadioGroupInputGUI($this->txt(self::F_BASE_FOLDER), "dropbox_base_folder");
$sub_selection->setRequired(true);
$option_default = new ilRadioOption($this->txt("default_base_folder"), self::F_DROPBOX_DEFAULT_BASE_FOLDER);
$option_custom = new ilRadioOption($this->txt("custom_base_folder"), self::F_DROPBOX_CUSTOM_FOLDER_SELECTION);
$custom_base_folder_input = new ilTextInputGUI($this->txt("custom_base_folder_input"), self::F_DROPBOX_CUSTOM_BASE_FOLDER_INPUT);
$custom_base_folder_input->setRequired(true);
$custom_base_folder_input->setInfo($this->txt("custom_base_folder_input_info"));
$option_custom->addSubItem($custom_base_folder_input);
$sub_selection->addOption($option_default);
$sub_selection->addOption($option_custom);
$sub_selection->setValue(self::F_DROPBOX_DEFAULT_BASE_FOLDER);
$option->addSubItem($sub_selection);
$sub_selection2 = new ilCheckboxInputGUI($this->txt(self::F_ONLINE), self::F_ONLINE);
if ($this->getAdminConfigObject()->getValue('config_default_online')) {
$sub_selection2->setChecked(true);
}
$option->addSubItem($sub_selection2);
}
示例4: initForm
public function initForm($a_as_multi_assignment = FALSE)
{
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setTitle($this->lng->txt('crs_loc_tst_assignment'));
$form->setFormAction($this->ctrl->getFormAction($this->getGUI()));
if ($a_as_multi_assignment) {
$form->addCommandButton('saveMultiTestAssignment', $this->lng->txt('save'));
} else {
$form->addCommandButton('saveTest', $this->lng->txt('save'));
}
switch ($this->getTestType()) {
case ilLOSettings::TYPE_TEST_INITIAL:
$form->setTitle($this->lng->txt('crs_loc_settings_itest_tbl'));
break;
case ilLOSettings::TYPE_TEST_QUALIFIED:
$form->setTitle($this->lng->txt('crs_loc_settings_qtest_tbl'));
break;
}
$assignable = $this->getAssignableTests();
$cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'), 'mode');
$cr_mode->setRequired(true);
$cr_mode->setValue(self::TEST_NEW);
$new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'), self::TEST_NEW);
switch ($this->getTestType()) {
case ilLOSettings::TYPE_TEST_INITIAL:
$new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info"));
break;
case ilLOSettings::TYPE_TEST_QUALIFIED:
$new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info"));
break;
}
// title
$ti = new ilTextInputGUI($this->lng->txt("title"), "title");
$ti->setMaxLength(128);
$ti->setSize(40);
$ti->setRequired(true);
$new->addSubItem($ti);
// description
$ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
$ta->setCols(40);
$ta->setRows(2);
$new->addSubItem($ta);
// Question assignment type
include_once './Modules/Test/classes/class.ilObjTest.php';
$this->lng->loadLanguageModule('assessment');
$qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'), 'qtype');
$qst->setRequired(true);
$random = new ilRadioOption($this->lng->txt('tst_question_set_type_random'), ilObjTest::QUESTION_SET_TYPE_RANDOM);
$qst->addOption($random);
$fixed = new ilRadioOption($this->lng->txt('tst_question_set_type_fixed'), ilObjTest::QUESTION_SET_TYPE_FIXED);
$qst->addOption($fixed);
$new->addSubItem($qst);
$cr_mode->addOption($new);
// assign existing
$existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'), self::TEST_ASSIGN);
switch ($this->getTestType()) {
case ilLOSettings::TYPE_TEST_INITIAL:
$existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info"));
break;
case ilLOSettings::TYPE_TEST_QUALIFIED:
$existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info"));
break;
}
if (!$assignable) {
$existing->setDisabled(true);
}
$cr_mode->addOption($existing);
$options = array();
$options[''] = $this->lng->txt('select_one');
foreach ((array) $assignable as $tst_ref_id) {
$tst_obj_id = ilObject::_lookupObjId($tst_ref_id);
$options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id);
}
$selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'), 'tst');
$selectable->setRequired(true);
$selectable->setOptions($options);
$existing->addSubItem($selectable);
$form->addItem($cr_mode);
if ($a_as_multi_assignment) {
include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
$assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
include_once './Modules/Course/classes/class.ilCourseObjective.php';
$objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainer()->getId(), FALSE);
$options = array();
$options[''] = $this->lng->txt('select_one');
foreach ($objective_ids as $oid) {
$already_assigned_tst = $assignments->getTestByObjective($oid, $this->getTestType());
if (!$already_assigned_tst) {
$options[$oid] = ilCourseObjective::lookupObjectiveTitle($oid);
}
}
$objective = new ilSelectInputGUI($this->lng->txt('crs_objectives'), 'objective');
$objective->setRequired(TRUE);
$objective->setOptions($options);
$form->addItem($objective);
}
return $form;
}
示例5: initCategoryMappingForm
/**
* Init category mapping form
* @return
*/
protected function initCategoryMappingForm($a_mode = 'add')
{
global $ilDB;
if (is_object($this->form)) {
return true;
}
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
$this->form = new ilPropertyFormGUI();
if ($a_mode == 'add') {
$this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
$this->form->setFormAction($this->ctrl->getFormAction($this, 'categoryMapping'));
$this->form->addCommandButton('addCategoryMapping', $this->lng->txt('save'));
$this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
} else {
$this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
$this->form->setFormAction($this->ctrl->getFormAction($this, 'editCategoryMapping'));
$this->form->addCommandButton('updateCategoryMapping', $this->lng->txt('save'));
$this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
}
$imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'), 'import_id');
$imp->setRequired(true);
$tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
$tpl->setVariable('SIZE', 5);
$tpl->setVariable('MAXLENGTH', 11);
$tpl->setVariable('POST_VAR', 'import_id');
$tpl->setVariable('PROPERTY_VALUE', $this->rule->getContainerId());
if ($this->settings->getImportId()) {
$tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->rule->getContainerId()));
}
$imp->setHTML($tpl->get());
$imp->setInfo($this->lng->txt('ecs_import_id_info'));
$this->form->addItem($imp);
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
$select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'), 'field');
$select->setValue($this->rule->getFieldName());
$select->setRequired(true);
$select->setOptions(ilECSCategoryMapping::getPossibleFields());
$this->form->addItem($select);
// Value
$value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'), 'type');
$value->setValue($this->rule->getMappingType());
$value->setRequired(true);
$fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'), ilECSCategoryMappingRule::TYPE_FIXED);
$fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
$fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'), 'mapping_value');
$fixed_val->setValue($this->rule->getMappingValue());
$fixed_val->setMaxLength(255);
$fixed_val->setSize(40);
$fixed_val->setRequired(true);
$fixed->addSubItem($fixed_val);
$value->addOption($fixed);
$duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'), ilECSCategoryMappingRule::TYPE_DURATION);
$duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
$dur_start = new ilDateTimeInputGUI($this->lng->txt('from'), 'dur_begin');
$dur_start->setDate($this->rule->getDateRangeStart());
$duration->addSubItem($dur_start);
$dur_end = new ilDateTimeInputGUI($this->lng->txt('to'), 'dur_end');
$dur_end->setDate($this->rule->getDateRangeEnd());
$duration->addSubItem($dur_end);
$value->addOption($duration);
$type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'), ilECSCategoryMappingRule::TYPE_BY_TYPE);
$type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info'));
$options = ilECSUtils::getPossibleRemoteTypes(true);
$types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type');
$types->setOptions($options);
$types->setValue($this->rule->getByType());
$types->setRequired(true);
$type->addSubitem($types);
$value->addOption($type);
$this->form->addItem($value);
}
示例6: initForm
/**
* Init profile form
*
* @param bool $a_insert
* @return ilPropertyFormGUI
*/
protected function initForm($a_insert = false)
{
global $ilCtrl, $ilToolbar;
$is_template = $this->getPageConfig()->getEnablePCType("PlaceHolder");
if (!$is_template) {
$ilToolbar->addButton($this->lng->txt("cont_edit_personal_data"), $ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "jumptoprofile"), "profile");
$lng_suffix = "";
} else {
$lng_suffix = "_template";
}
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
if ($a_insert) {
$form->setTitle($this->lng->txt("cont_insert_profile"));
} else {
$form->setTitle($this->lng->txt("cont_update_profile"));
}
$mode = new ilRadioGroupInputGUI($this->lng->txt("cont_profile_mode"), "mode");
$form->addItem($mode);
$mode_inherit = new ilRadioOption($this->lng->txt("cont_profile_mode_inherit"), "inherit");
$mode_inherit->setInfo($this->lng->txt("cont_profile_mode" . $lng_suffix . "_inherit_info"));
$mode->addOption($mode_inherit);
$mode_manual = new ilRadioOption($this->lng->txt("cont_profile_mode_manual"), "manual");
$mode_manual->setInfo($this->lng->txt("cont_profile_mode_manual_info"));
$mode->addOption($mode_manual);
$prefs = array();
if ($a_insert) {
$mode->setValue("inherit");
} else {
$mode_value = $this->content_obj->getMode();
$mode->setValue($mode_value);
$prefs = array();
if ($mode_value == "manual") {
foreach ($this->content_obj->getFields() as $name) {
$prefs["public_" . $name] = "y";
}
}
}
// always has to be set
$im_arr = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
foreach ($im_arr as $im) {
if (!isset($prefs["public_im_" . $im])) {
$prefs["public_im_" . $im] = "n";
}
}
include_once "Services/User/classes/class.ilPersonalProfileGUI.php";
$profile = new ilPersonalProfileGUI();
$profile->showPublicProfileFields($form, $prefs, $mode_manual, $is_template);
if ($a_insert) {
$form->addCommandButton("create_profile", $this->lng->txt("save"));
$form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
} else {
$form->addCommandButton("update", $this->lng->txt("save"));
$form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
}
return $form;
}
示例7: showDetails
public function showDetails()
{
global $ilMainMenu, $ilTabs, $ilToolbar, $ilUser;
$this->__initPaymentObject();
$this->__initPricesObject();
$this->__initShoppingCartObject();
$ilToolbar->addButton($this->lng->txt('payment_back_to_shop'), 'ilias.php?baseClass=ilShopController');
$this->tpl->getStandardTemplate();
$ilTabs->setTabActive('buy');
$ilMainMenu->setActive('shop');
if ($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES) {
ilUtil::sendInfo($this->lng->txt('pay_expires_info'));
return false;
}
$extension_prices = array();
if ($ilUser->getId() != ANONYMOUS_USER_ID) {
include_once './Services/Payment/classes/class.ilPaymentBookings.php';
$has_extension_price = ilPaymentBookings::_hasAccesstoExtensionPrice($ilUser->getId(), $this->pobject->getPobjectId());
if ($has_extension_price) {
$extension_prices = $this->price_obj->getExtensionPrices();
}
}
$org_prices = $this->price_obj->getPrices();
$tmp_prices = array_merge($org_prices, $extension_prices);
$prices = array();
foreach ($tmp_prices as $price) {
// expired prices must be filtered out
if ($price['price_type'] == ilPaymentPrices::TYPE_DURATION_DATE && $price['duration_until'] < date('Y-m-d')) {
//do nothing
} else {
$prices[] = $price;
}
}
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$buyedObject = "";
if ($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId())) {
$buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
if (is_array($prices) && count($prices) > 1) {
ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc_choose_another'));
} else {
ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc'));
}
}
$this->ctrl->setParameter($this, "ref_id", $this->pobject->getRefId());
$subtype = '';
if ($this->object) {
if ($this->object->getType() == 'exc') {
$subtype = ' (' . $this->lng->txt($this->pobject->getSubtype()) . ')';
}
$form->setTitle($this->object->getTitle() . ' ' . $subtype);
$form->setTitleIcon(ilObject::_getIcon($this->object->getId()));
} else {
ilUtil::sendFailure($this->lng->txt('object_not_found'));
}
// payment infos
$info = new ilNonEditableValueGUI($this->lng->txt('info'));
$info->setValue($this->lng->txt('pay_info'));
$form->addItem($info);
if (is_array($buyedObject)) {
if (is_array($prices) && count($prices) > 1) {
$button_txt = $this->lng->txt('pay_change_price');
} else {
$button_txt = $this->lng->txt('pay_add_to_shopping_cart');
}
} else {
$button_txt = $this->lng->txt('pay_add_to_shopping_cart');
}
$rg_prices = new ilRadioGroupInputGUI($this->lng->txt('prices'), 'price_id');
if (is_array($prices)) {
foreach ($prices as $price) {
if (is_array($buyedObject) && $buyedObject["price_id"] == $price['price_id']) {
$rg_prices->setValue($price['price_id']);
} else {
if (count($prices) == 1) {
$rg_prices->setValue($price['price_id']);
}
}
switch ($price['price_type']) {
case ilPaymentPrices::TYPE_DURATION_MONTH:
$txt_price = $price['duration'] . ' ' . $this->lng->txt('paya_months') . ': ';
break;
case ilPaymentPrices::TYPE_DURATION_DATE:
$txt_price = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)) . ': ';
break;
case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
$txt_price = $this->lng->txt('unlimited_duration') . ': ';
break;
}
$tmp_price = $price['price'];
$extension_txt = '';
if ($price['extension'] == 1) {
$extension_txt = '(' . $this->lng->txt('extension_price') . ')';
}
$price_row = new ilRadioOption($txt_price . ' ' . ilPaymentPrices::_formatPriceToString((double) $tmp_price) . ' ' . $extension_txt, $price['price_id']);
$price_row->setInfo($price['description']);
$rg_prices->addOption($price_row);
}
$form->addItem($rg_prices);
//.........这里部分代码省略.........
示例8: initQuestionForm
protected function initQuestionForm($a_read_only = false)
{
global $lng, $ilCtrl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this, "saveQuestion"));
$form->setTitle($lng->txt("obj_poll"));
$question = new ilTextAreaInputGUI($lng->txt("poll_question"), "question");
$question->setRequired(true);
$question->setCols(40);
$question->setRows(2);
$question->setValue($this->object->getQuestion());
$question->setDisabled($a_read_only);
$form->addItem($question);
$dimensions = " (" . ilObjPoll::getImageSize() . "px)";
$img = new ilImageFileInputGUI($lng->txt("poll_image") . $dimensions, "image");
$img->setDisabled($a_read_only);
$form->addItem($img);
// show existing file
$file = $this->object->getImageFullPath(true);
if ($file) {
$img->setImage($file);
}
$anonymous = new ilRadioGroupInputGUI($lng->txt("poll_mode"), "mode");
$anonymous->setRequired(true);
$option = new ilRadioOption($lng->txt("poll_mode_anonymous"), 0);
$option->setInfo($lng->txt("poll_mode_anonymous_info"));
$anonymous->addOption($option);
$option = new ilRadioOption($lng->txt("poll_mode_personal"), 1);
$option->setInfo($lng->txt("poll_mode_personal_info"));
$anonymous->addOption($option);
$anonymous->setValue($this->object->getNonAnonymous());
$anonymous->setDisabled($a_read_only);
$form->addItem($anonymous);
$nanswers = new ilNumberInputGUI($lng->txt("poll_max_number_of_answers"), "nanswers");
$nanswers->setRequired(true);
$nanswers->setMinValue(1);
$nanswers->setSize(3);
$nanswers->setValue($this->object->getMaxNumberOfAnswers());
$nanswers->setDisabled($a_read_only);
$form->addItem($nanswers);
$answers = new ilTextInputGUI($lng->txt("poll_answers"), "answers");
$answers->setRequired(true);
$answers->setMulti(true, true);
$answers->setDisabled($a_read_only);
$form->addItem($answers);
$multi_answers = array();
foreach ($this->object->getAnswers() as $idx => $item) {
if (!$idx) {
$answers->setValue($item["answer"]);
}
$multi_answers[] = $item["answer"];
}
$answers->setMultiValues($multi_answers);
if (!$a_read_only) {
$form->addCommandButton("saveQuestion", $lng->txt("save"));
}
return $form;
}
示例9: initEditCustomForm
protected function initEditCustomForm(ilPropertyFormGUI $a_form)
{
// activation/availability
include_once "Services/Object/classes/class.ilObjectActivation.php";
$this->lng->loadLanguageModule('rep');
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('rep_activation_availability'));
$a_form->addItem($section);
// additional info only with multiple references
$act_obj_info = $act_ref_info = "";
if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
$act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
$act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
}
$online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
$online->setInfo($this->lng->txt('prtt_activation_online_info') . $act_obj_info);
$a_form->addItem($online);
$act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'access_type');
$act_type->setInfo($act_ref_info);
$opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED);
$opt->setInfo($this->lng->txt('prtt_availability_limitless_info'));
$act_type->addOption($opt);
$opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION);
$opt->setInfo($this->lng->txt('prtt_availability_until_info'));
$this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
$dur = new ilDateDurationInputGUI("", "access_period");
$dur->setShowTime(true);
$date = $this->object->getActivationStartDate();
$dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$dur->setStartText($this->lng->txt('rep_activation_limited_start'));
$date = $this->object->getActivationEndDate();
$dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$dur->setEndText($this->lng->txt('rep_activation_limited_end'));
$opt->addSubItem($dur);
$visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
$visible->setInfo($this->lng->txt('prtt_activation_limited_visibility_info'));
$opt->addSubItem($visible);
$act_type->addOption($opt);
$a_form->addItem($act_type);
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('properties'));
$a_form->addItem($section);
parent::initEditCustomForm($a_form);
}
示例10: addFormElements
/**
* 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);
}
}
}
示例11: settingsObject
/**
* display survey settings form
*
* Default settings tab for Survey settings
*
* @access public
*/
function settingsObject()
{
global $ilAccess, $rbacreview, $lng, $ilCtrl, $tpl, $ilTabs;
$ilTabs->activateTab("settings");
$surveySetting = new ilSetting("survey");
$unlimited_invitation = array_key_exists("unlimited_invitation", $_GET) ? $_GET["unlimited_invitation"] : $surveySetting->get("unlimited_invitation");
$use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitle($lng->txt("survey_defaults"));
// unlimited invitation
$enable = new ilCheckboxInputGUI($lng->txt("survey_unlimited_invitation"), "unlimited_invitation");
$enable->setChecked($unlimited_invitation);
$enable->setInfo($lng->txt("survey_unlimited_invitation_desc"));
$form->addItem($enable);
// Survey Code
$code = new ilCheckboxInputGUI($lng->txt("use_anonymous_id"), "use_anonymous_id");
$code->setChecked($use_anonymous_id);
$code->setInfo($lng->txt("use_anonymous_id_desc"));
$form->addItem($code);
// Skipped
$eval_skipped = new ilRadioGroupInputGUI($lng->txt("svy_eval_skipped_value"), "skcust");
$eval_skipped->setRequired(true);
$form->addItem($eval_skipped);
$eval_skipped->setValue($surveySetting->get("skipped_is_custom", false) ? "cust" : "lng");
$skipped_lng = new ilRadioOption($lng->txt("svy_eval_skipped_value_lng"), "lng");
$skipped_lng->setInfo(sprintf($lng->txt("svy_eval_skipped_value_lng_info"), $lng->txt("skipped")));
$eval_skipped->addOption($skipped_lng);
$skipped_cust = new ilRadioOption($lng->txt("svy_eval_skipped_value_custom"), "cust");
$skipped_cust->setInfo($lng->txt("svy_eval_skipped_value_custom_info"));
$eval_skipped->addOption($skipped_cust);
$skipped_cust_value = new ilTextInputGUI($lng->txt("svy_eval_skipped_value_custom_value"), "cust_value");
$skipped_cust_value->setSize(15);
$skipped_cust_value->setValue($surveySetting->get("skipped_custom_value", ""));
$skipped_cust->addSubItem($skipped_cust_value);
if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
$form->addCommandButton("saveSettings", $lng->txt("save"));
}
$tpl->setVariable("ADM_CONTENT", $form->getHTML());
}
示例12: addResultDetailsSettingsFormSection
private function addResultDetailsSettingsFormSection(ilPropertyFormGUI $form)
{
// HEADER: result settings
$header_tr = new ilFormSectionHeaderGUI();
$header_tr->setTitle($this->lng->txt('tst_results_details_options'));
$form->addItem($header_tr);
// show solution details
$showSolutionDetails = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_details'), 'solution_details');
$showSolutionDetails->setInfo($this->lng->txt('tst_show_solution_details_desc'));
$showSolutionDetails->setChecked($this->testOBJ->getShowSolutionDetails());
$form->addItem($showSolutionDetails);
// best solution in test results
$results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt('tst_results_print_best_solution'), 'print_bs_with_res');
$results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info'));
$results_print_best_solution->setChecked((bool) $this->testOBJ->isBestSolutionPrintedWithResult());
$showSolutionDetails->addSubItem($results_print_best_solution);
// show solution feedback ==> solution feedback in test results
$showSolutionFeedbackOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_feedback'), 'solution_feedback');
$showSolutionFeedbackOption->setInfo($this->lng->txt('tst_show_solution_feedback_desc'));
$showSolutionFeedbackOption->setChecked($this->testOBJ->getShowSolutionFeedback());
$form->addItem($showSolutionFeedbackOption);
// show suggested solution
$showSuggestedSolutionOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_suggested'), 'solution_suggested');
$showSuggestedSolutionOption->setInfo($this->lng->txt('tst_show_solution_suggested_desc'));
$showSuggestedSolutionOption->setChecked($this->testOBJ->getShowSolutionSuggested());
$form->addItem($showSuggestedSolutionOption);
// show solution printview ==> list of answers
$showSolutionPrintview = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_printview'), 'solution_printview');
$showSolutionPrintview->setInfo($this->lng->txt('tst_show_solution_printview_desc'));
$showSolutionPrintview->setChecked($this->testOBJ->getShowSolutionPrintview());
$form->addItem($showSolutionPrintview);
// show best solution in list of answers
$solutionCompareInput = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_compare'), 'solution_compare');
$solutionCompareInput->setChecked($this->testOBJ->getShowSolutionListComparison());
$showSolutionPrintview->addSubItem($solutionCompareInput);
// solution answers only ==> printview of results (answers only)
$solutionAnswersOnly = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_answers_only'), 'solution_answers_only');
$solutionAnswersOnly->setInfo($this->lng->txt('tst_show_solution_answers_only_desc'));
$solutionAnswersOnly->setChecked($this->testOBJ->getShowSolutionAnswersOnly());
$showSolutionPrintview->addSubItem($solutionAnswersOnly);
// high score
$highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled");
$highscore->setValue(1);
$highscore->setChecked($this->testOBJ->getHighscoreEnabled());
$highscore->setInfo($this->lng->txt("tst_highscore_description"));
$form->addItem($highscore);
$highscore_tables = new ilRadioGroupInputGUI($this->lng->txt('tst_highscore_mode'), 'highscore_mode');
$highscore_tables->setRequired(true);
$highscore_tables->setValue($this->testOBJ->getHighscoreMode());
$highscore_table_own = new ilRadioOption($this->lng->txt('tst_highscore_own_table'), ilObjTest::HIGHSCORE_SHOW_OWN_TABLE);
$highscore_table_own->setInfo($this->lng->txt('tst_highscore_own_table_description'));
$highscore_tables->addOption($highscore_table_own);
$highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_top_table'), ilObjTest::HIGHSCORE_SHOW_TOP_TABLE);
$highscore_table_other->setInfo($this->lng->txt('tst_highscore_top_table_description'));
$highscore_tables->addOption($highscore_table_other);
$highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_all_tables'), ilObjTest::HIGHSCORE_SHOW_ALL_TABLES);
$highscore_table_other->setInfo($this->lng->txt('tst_highscore_all_tables_description'));
$highscore_tables->addOption($highscore_table_other);
$highscore->addSubItem($highscore_tables);
$highscore_top_num = new ilNumberInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num");
$highscore_top_num->setSize(4);
$highscore_top_num->setRequired(true);
$highscore_top_num->setMinValue(1);
$highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit"));
$highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum(null));
$highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description"));
$highscore->addSubItem($highscore_top_num);
$highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon");
$highscore_anon->setValue(1);
$highscore_anon->setChecked($this->testOBJ->getHighscoreAnon());
$highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description"));
$highscore->addSubItem($highscore_anon);
$highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts");
$highscore_achieved_ts->setValue(1);
$highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS());
$highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description"));
$highscore->addSubItem($highscore_achieved_ts);
$highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score");
$highscore_score->setValue(1);
$highscore_score->setChecked($this->testOBJ->getHighscoreScore());
$highscore_score->setInfo($this->lng->txt("tst_highscore_score_description"));
$highscore->addSubItem($highscore_score);
$highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage");
$highscore_percentage->setValue(1);
$highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage());
$highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description"));
$highscore->addSubItem($highscore_percentage);
$highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints");
$highscore_hints->setValue(1);
$highscore_hints->setChecked($this->testOBJ->getHighscoreHints());
$highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description"));
$highscore->addSubItem($highscore_hints);
$highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime");
$highscore_wtime->setValue(1);
$highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime());
$highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description"));
$highscore->addSubItem($highscore_wtime);
// show signature placeholder
$showSignaturePlaceholder = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_signature'), 'solution_signature');
$showSignaturePlaceholder->setInfo($this->lng->txt('tst_show_solution_signature_desc'));
//.........这里部分代码省略.........
示例13: initRoleForm
/**
* Shoew add role
* @global type $rbacreview
* @global type $objDefinition
* @return ilPropertyFormGUI
*/
protected function initRoleForm()
{
global $rbacreview, $objDefinition;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt('role_new'));
$form->addCommandButton('addrole', $this->lng->txt('role_new'));
$form->addCommandButton('perm', $this->lng->txt('cancel'));
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setValidationRegexp('/^(?!il_).*$/');
$title->setValidationFailureMessage($this->lng->txt('msg_role_reserved_prefix'));
$title->setSize(40);
$title->setMaxLength(70);
$title->setRequired(true);
$form->addItem($title);
$desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
$desc->setCols(40);
$desc->setRows(3);
$form->addItem($desc);
$pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'pro');
$pro->setInfo($this->lng->txt('role_protect_permissions_desc'));
$pro->setValue(1);
$form->addItem($pro);
$pd = new ilCheckboxInputGUI($this->lng->txt('rbac_role_add_to_desktop'), 'desktop');
$pd->setInfo($this->lng->txt('rbac_role_add_to_desktop_info'));
$pd->setValue(1);
$form->addItem($pd);
if (!$this->isInAdministration()) {
$rights = new ilRadioGroupInputGUI($this->lng->txt("rbac_role_rights_copy"), 'rights');
$option = new ilRadioOption($this->lng->txt("rbac_role_rights_copy_empty"), 0);
$rights->addOption($option);
$parent_role_ids = $rbacreview->getParentRoleIds($this->gui_obj->object->getRefId(), true);
$ids = array();
foreach ($parent_role_ids as $id => $tmp) {
$ids[] = $id;
}
// Sort ids
$sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type DESC,title', 'obj_id');
// Sort roles by title
$sorted_roles = ilUtil::sortArray(array_values($parent_role_ids), 'title', ASC);
$key = 0;
foreach ($sorted_ids as $id) {
$par = $parent_role_ids[$id];
if ($par["obj_id"] != SYSTEM_ROLE_ID) {
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$option = new ilRadioOption(($par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt')) . ": " . ilObjRole::_getTranslation($par["title"]), $par["obj_id"]);
$option->setInfo($par["desc"]);
$rights->addOption($option);
}
$key++;
}
$form->addItem($rights);
}
// Local policy only for containers
if ($objDefinition->isContainer($this->getCurrentObject()->getType())) {
$check = new ilCheckboxInputGui($this->lng->txt("rbac_role_rights_copy_change_existing"), 'existing');
$check->setInfo($this->lng->txt('rbac_change_existing_objects_desc_new_role'));
$form->addItem($check);
}
return $form;
}
示例14: initEditForm
function initEditForm()
{
$this->lng->loadLanguageModule($this->object->getType());
$this->setEditTabs();
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt($this->object->getType() . "_edit"));
// Show didactic template type
$this->initDidacticTemplate($form);
// sorting
include_once 'Services/Container/classes/class.ilContainerSortingSettings.php';
$settings = new ilContainerSortingSettings($this->object->getId());
$sort = new ilRadioGroupInputGUI($this->lng->txt('sorting_header'), "sorting");
$sort_title = new ilRadioOption($this->lng->txt('sorting_title_header'), ilContainer::SORT_TITLE);
$sort_title->setInfo($this->lng->txt('sorting_info_title'));
$sort->addOption($sort_title);
$sort_manual = new ilRadioOption($this->lng->txt('sorting_manual_header'), ilContainer::SORT_MANUAL);
$sort_manual->setInfo($this->lng->txt('sorting_info_manual'));
$sort->addOption($sort_manual);
$sort->setValue($settings->getSortMode());
$form->addItem($sort);
$this->showCustomIconsEditing(1, $form, false);
// Edit ecs export settings
include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
$ecs = new ilECSCategorySettings($this->object);
$ecs->addSettingsToForm($form, 'cat');
$form->addCommandButton("update", $this->lng->txt("save"));
$form->addCommandButton("addTranslation", $this->lng->txt("add_translation"));
return $form;
}
示例15: displayCache
public function displayCache()
{
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
require_once 'Services/GlobalCache/classes/class.ilGlobalCache.php';
$this->checkDisplayMode('setup_cache');
/**
* @var $ini ilIniFile
*/
$ini = $this->setup->getClient()->ini;
$cache_form = new ilPropertyFormGUI();
$cache_form->setTitle($this->lng->txt('global_cache_configuration'));
$cache_form->addCommandButton('saveCache', $this->lng->txt('save'));
$cache_form->setFormAction('setup.php?cmd=gateway');
$activate_global_cache = 'activate_global_cache';
$global_cache_service_type = 'global_cache_service_type';
$activate_cache = new ilCheckboxInputGUI($this->lng->txt($activate_global_cache), $activate_global_cache);
$activate_cache->setChecked($ini->readVariable('cache', $activate_global_cache));
$service_type = new ilRadioGroupInputGUI($this->lng->txt($global_cache_service_type), $global_cache_service_type);
$some_inactive = false;
$message = '';
foreach (ilGlobalCache::getAllTypes() as $type) {
$option = new ilRadioOption($this->lng->txt($global_cache_service_type . '_' . $type->getServiceType()), $type->getServiceType());
$option->setInfo($this->lng->txt('global_cache_install_info_' . $type->getServiceType()));
if (!$type->isCacheServiceInstallable()) {
$option->setDisabled(true);
$message .= $this->lng->txt($global_cache_service_type . '_' . $type->getServiceType()) . ': ' . $type->getInstallationFailureReason() . '; ';
$some_inactive = true;
}
$service_type->addOption($option);
}
if ($some_inactive) {
$service_type->setAlert($message);
ilUtil::sendInfo($this->lng->txt('global_cache_supported_services'));
}
$service_type->setValue($ini->readVariable('cache', $global_cache_service_type));
$activate_cache->addSubItem($service_type);
$cache_form->addItem($activate_cache);
$this->tpl->setVariable('SETUP_CONTENT', $cache_form->getHTML());
}