本文整理汇总了PHP中ilRadioGroupInputGUI::setInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP ilRadioGroupInputGUI::setInfo方法的具体用法?PHP ilRadioGroupInputGUI::setInfo怎么用?PHP ilRadioGroupInputGUI::setInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilRadioGroupInputGUI
的用法示例。
在下文中一共展示了ilRadioGroupInputGUI::setInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: propertiesObject
/**
* Display and fill the properties form of the test
*
* @access public
*/
function propertiesObject($checkonly = FALSE)
{
global $ilAccess;
if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
// allow only write access
ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
$this->ctrl->redirect($this, "infoScreen");
}
// using template?
$template_settings = null;
$template = $this->object->getTemplate();
if ($template) {
include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
$template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
$template_settings = $template->getSettings();
$hide_rte_switch = $template_settings["rte_switch"]["hide"];
}
$save = strcmp($this->ctrl->getCmd(), "saveProperties") == 0 ? TRUE : FALSE;
$total = $this->object->evalTotalPersons();
$this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTableWidth("100%");
$form->setId("test_properties");
if (!$template || $template && $this->formShowGeneralSection($template_settings)) {
// general properties
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("tst_general_properties"));
$form->addItem($header);
}
// title & description (meta data)
include_once 'Services/MetaData/classes/class.ilMD.php';
$md_obj = new ilMD($this->object->getId(), 0, "tst");
$md_section = $md_obj->getGeneral();
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setRequired(true);
$title->setValue($md_section->getTitle());
$form->addItem($title);
$ids = $md_section->getDescriptionIds();
if ($ids) {
$desc_obj = $md_section->getDescription(array_pop($ids));
$desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
$desc->setCols(50);
$desc->setRows(4);
$desc->setValue($desc_obj->getDescription());
$form->addItem($desc);
}
// anonymity
$anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity');
if ($total) {
$anonymity->setDisabled(true);
}
$rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0);
$anonymity->addOption($rb);
$rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1);
$anonymity->addOption($rb);
$anonymity->setValue((int) $this->object->getAnonymity());
$form->addItem($anonymity);
// random selection of questions
$random = new ilCheckboxInputGUI($this->lng->txt("tst_random_selection"), "random_test");
$random->setValue(1);
if ($total) {
$random->setDisabled(true);
}
$random->setChecked($this->object->isRandomTest());
$info = $this->lng->txt("tst_random_test_description");
if ($this->object->hasQuestionsWithoutQuestionpool()) {
$info .= $this->lng->txt("tst_random_test_description_warning");
}
$random->setInfo($info);
$form->addItem($random);
// pool usage
$pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool");
$pool_usage->setValue(1);
$pool_usage->setChecked($this->object->getPoolUsage());
$form->addItem($pool_usage);
// activation/availability (no template support yet)
include_once "Services/Object/classes/class.ilObjectActivation.php";
$this->lng->loadLanguageModule('rep');
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('rep_activation_availability'));
$form->addItem($section);
// additional info only with multiple references
$act_obj_info = $act_ref_info = "";
if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
$act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
$act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
}
$online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
$online->setChecked($this->object->isOnline());
$online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info);
$form->addItem($online);
$act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type');
$act_type->setInfo($act_ref_info);
//.........这里部分代码省略.........
示例2: initAuthModeDetermination
/**
* init auth mode determinitation form
*
* @access protected
*/
protected function initAuthModeDetermination()
{
if (is_object($this->form)) {
return true;
}
// Are there any authentication methods that support automatic determination ?
include_once 'Services/Authentication/classes/class.ilAuthModeDetermination.php';
$det = ilAuthModeDetermination::_getInstance();
if ($det->getCountActiveAuthModes() <= 1) {
return false;
}
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
$this->form->setTableWidth('100%');
$this->form->setTitle($this->lng->txt('auth_auth_settings'));
$this->form->addCommandButton('updateAuthModeDetermination', $this->lng->txt('save'));
require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
$cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_anonymous_short'), 'activate_captcha_anonym');
$cap->setInfo($this->lng->txt('adm_captcha_anonymous_auth'));
$cap->setValue(1);
if (!ilCaptchaUtil::checkFreetype()) {
$cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
}
$cap->setChecked(ilCaptchaUtil::isActiveForLogin());
$this->form->addItem($cap);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt('auth_auth_mode_determination'));
$this->form->addItem($header);
$kind = new ilRadioGroupInputGUI($this->lng->txt('auth_kind_determination'), 'kind');
$kind->setInfo($this->lng->txt('auth_mode_determination_info'));
$kind->setValue($det->getKind());
$kind->setRequired(true);
$option_user = new ilRadioOption($this->lng->txt('auth_by_user'), 0);
$kind->addOption($option_user);
$option_determination = new ilRadioOption($this->lng->txt('auth_automatic'), 1);
include_once 'Services/Authentication/classes/class.ilAuthUtils.php';
$auth_sequenced = $det->getAuthModeSequence();
$counter = 1;
foreach ($auth_sequenced as $auth_mode) {
switch ($auth_mode) {
case AUTH_LDAP:
$text = $this->lng->txt('auth_ldap');
break;
case AUTH_RADIUS:
$text = $this->lng->txt('auth_radius');
break;
case AUTH_LOCAL:
$text = $this->lng->txt('auth_local');
break;
case AUTH_SOAP:
$text = $this->lng->txt('auth_soap');
break;
case AUTH_APACHE:
$text = $this->lng->txt('auth_apache');
break;
// begin-patch auth_plugin
// begin-patch auth_plugin
default:
foreach (ilAuthUtils::getAuthPlugins() as $pl) {
$option = $pl->getMultipleAuthModeOptions($auth_mode);
$text = $option[$auth_mode]['txt'];
}
break;
// end-patch auth_plugin
}
$pos = new ilTextInputGUI($text, 'position[' . $auth_mode . ']');
$pos->setValue($counter++);
$pos->setSize(1);
$pos->setMaxLength(1);
$option_determination->addSubItem($pos);
}
$kind->addOption($option_determination);
$this->form->addItem($kind);
return true;
}
示例3: initFormNewsItem
/**
* FORM NewsItem: Init form.
*
* @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)
*/
public function initFormNewsItem($a_mode)
{
global $lng, $ilTabs;
$ilTabs->clearTargets();
//$this->setTabs();
$lng->loadLanguageModule("news");
include "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form_gui = new ilPropertyFormGUI();
// Property Title
$text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title");
$text_input->setInfo("");
$text_input->setRequired(true);
$text_input->setMaxLength(200);
$this->form_gui->addItem($text_input);
// Property Content
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content");
$text_area->setInfo("");
$text_area->setRequired(false);
$this->form_gui->addItem($text_area);
// Property Visibility
$radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility");
$radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
$radio_group->setRequired(false);
$radio_group->setValue("users");
$this->form_gui->addItem($radio_group);
// Property ContentLong
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long");
$text_area->setInfo($lng->txt("news_news_item_content_long_info"));
$text_area->setRequired(false);
$text_area->setCols("40");
$text_area->setRows("8");
$text_area->setUseRte(true);
$this->form_gui->addItem($text_area);
// save and cancel commands
if (in_array($a_mode, array(IL_FORM_CREATE, IL_FORM_RE_CREATE))) {
$this->form_gui->addCommandButton("saveNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel"));
} else {
$this->form_gui->addCommandButton("updateNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel"));
}
$this->form_gui->setTitle($lng->txt("news_news_item_head"));
$this->form_gui->setFormAction($this->ctrl->getFormAction($this));
$this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_news.png"));
$news_set = new ilSetting("news");
if (!$news_set->get("enable_rss_for_internal")) {
$this->form_gui->removeItemByPostVar("news_visibility");
} else {
$nv = $this->form_gui->getItemByPostVar("news_visibility");
if (is_object($nv)) {
$nv->setValue(ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]));
}
}
}
示例4: initSettingsForm
/**
* Init setting form
*/
function initSettingsForm()
{
global $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
$ilTabs->clearTargets();
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
$public = ilBlockSetting::_lookup($this->getBlockType(), "public_notifications", 0, $this->block_id);
$public_feed = ilBlockSetting::_lookup($this->getBlockType(), "public_feed", 0, $this->block_id);
$hide_block = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_block", 0, $this->block_id);
$hide_news_per_date = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_per_date", 0, $this->block_id);
$hide_news_date = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_date", 0, $this->block_id);
if ($hide_news_date != "") {
$hide_news_date = explode(" ", $hide_news_date);
}
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$this->settings_form = new ilPropertyFormGUI();
$this->settings_form->setTitle($lng->txt("news_settings"));
$this->settings_form->setTitleIcon(ilUtil::getImagePath("icon_news.png"));
// hide news block for learners
if ($this->getProperty("hide_news_block_option")) {
$ch = new ilCheckboxInputGUI($lng->txt("news_hide_news_block"), "hide_news_block");
$ch->setInfo($lng->txt("news_hide_news_block_info"));
$ch->setChecked($hide_block);
$this->settings_form->addItem($ch);
$hnpd = new ilCheckboxInputGUI($lng->txt("news_hide_news_per_date"), "hide_news_per_date");
$hnpd->setInfo($lng->txt("news_hide_news_per_date_info"));
$hnpd->setChecked($hide_news_per_date);
$dt_prop = new ilDateTimeInputGUI($lng->txt("news_hide_news_date"), "hide_news_date");
if ($hide_news_date != "") {
$dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME));
}
#$dt_prop->setDate($hide_news_date[0]);
#$dt_prop->setTime($hide_news_date[1]);
$dt_prop->setShowTime(true);
//$dt_prop->setInfo($lng->txt("news_hide_news_date_info"));
$hnpd->addSubItem($dt_prop);
$this->settings_form->addItem($hnpd);
}
// default visibility
if ($this->getProperty("default_visibility_option") && $enable_internal_rss) {
$default_visibility = ilBlockSetting::_lookup($this->getBlockType(), "default_visibility", 0, $this->block_id);
if ($default_visibility == "") {
$default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]);
}
// Default Visibility
$radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
$radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
$radio_group->setRequired(false);
$radio_group->setValue($default_visibility);
$this->settings_form->addItem($radio_group);
}
// public notifications
if ($this->getProperty("public_notifications_option") && $enable_internal_rss) {
$ch = new ilCheckboxInputGUI($lng->txt("news_notifications_public"), "notifications_public");
$ch->setInfo($lng->txt("news_notifications_public_info"));
$ch->setChecked($public);
$this->settings_form->addItem($ch);
}
// extra rss feed
if ($enable_internal_rss) {
$ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "notifications_public_feed");
$ch->setInfo($lng->txt("news_public_feed_info"));
$ch->setChecked($public_feed);
$this->settings_form->addItem($ch);
}
//$this->settings_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"))
//{
// $this->settings_form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public",
// "1", $public, $lng->txt("news_notifications_public_info"));
//}
$this->settings_form->addCommandButton("saveSettings", $lng->txt("save"));
$this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
$this->settings_form->setFormAction($ilCtrl->getFormaction($this));
}
示例5: getSettingsForm
/**
* @return ilPropertyFormGUI
*/
protected function getSettingsForm()
{
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
$form->setTitle($this->lng->txt('settings'));
$frm_radio = new ilRadioGroupInputGUI($this->lng->txt('show_topics_overview'), 'forum_overview');
$frm_radio->addOption(new ilRadioOption($this->lng->txt('new') . ', ' . $this->lng->txt('is_read') . ', ' . $this->lng->txt('unread'), '0'));
$frm_radio->addOption(new ilRadioOption($this->lng->txt('is_read') . ', ' . $this->lng->txt('unread'), '1'));
$frm_radio->setInfo($this->lng->txt('topics_overview_info'));
$form->addItem($frm_radio);
$check = new ilCheckboxInputGui($this->lng->txt('enable_fora_statistics'), 'fora_statistics');
$check->setInfo($this->lng->txt('enable_fora_statistics_desc'));
$form->addItem($check);
$check = new ilCheckboxInputGui($this->lng->txt('enable_anonymous_fora'), 'anonymous_fora');
$check->setInfo($this->lng->txt('enable_anonymous_fora_desc'));
$form->addItem($check);
require_once 'Services/Cron/classes/class.ilCronManager.php';
if (ilCronManager::isJobActive('frm_notification')) {
require_once 'Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php';
ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_FORUM, $form, $this);
} else {
$notifications = new ilCheckboxInputGui($this->lng->txt('cron_forum_notification'), 'forum_notification');
$notifications->setInfo($this->lng->txt('cron_forum_notification_desc'));
$notifications->setValue(1);
$form->addItem($notifications);
}
require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
$cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_anonymous_short'), 'activate_captcha_anonym');
$cap->setInfo($this->lng->txt('adm_captcha_anonymous_frm'));
$cap->setValue(1);
if (!ilCaptchaUtil::checkFreetype()) {
$cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
}
$form->addItem($cap);
$form->addCommandButton('saveSettings', $this->lng->txt('save'));
$form->addCommandButton('cancel', $this->lng->txt('cancel'));
return $form;
}
示例6: populateQuestionSpecificFormPart
/**
* @param ilPropertyFormGUI $form
* @return ilPropertyFormGUI
*/
public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
{
// shuffle answers
$shuffleAnswers = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_answers_enabled");
$shuffleAnswers->setChecked($this->object->isShuffleAnswersEnabled());
$form->addItem($shuffleAnswers);
if (!$this->object->getSelfAssessmentEditingMode()) {
// answer mode (single-/multi-line)
$answerType = new ilSelectInputGUI($this->lng->txt('answer_types'), 'answer_type');
$answerType->setOptions($this->object->getAnswerTypeSelectOptions($this->lng));
$answerType->setValue($this->object->getAnswerType());
$form->addItem($answerType);
}
if (!$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($this->object->getAnswerType())) {
// thumb size
$thumbSize = new ilNumberInputGUI($this->lng->txt('thumb_size'), 'thumb_size');
$thumbSize->setSuffix($this->lng->txt("thumb_size_unit_pixel"));
$thumbSize->setInfo($this->lng->txt('thumb_size_info'));
$thumbSize->setDecimals(false);
$thumbSize->setMinValue(20);
$thumbSize->setSize(6);
$thumbSize->setValue($this->object->getThumbSize());
$form->addItem($thumbSize);
}
// option label
$optionLabel = new ilRadioGroupInputGUI($this->lng->txt('option_label'), 'option_label');
$optionLabel->setInfo($this->lng->txt('option_label_info'));
$optionLabel->setRequired(true);
$optionLabel->setValue($this->object->getOptionLabel());
foreach ($this->object->getValidOptionLabelsTranslated($this->lng) as $labelValue => $labelText) {
$option = new ilRadioOption($labelText, $labelValue);
$optionLabel->addOption($option);
if ($this->object->isCustomOptionLabel($labelValue)) {
$customLabelTrue = new ilTextInputGUI($this->lng->txt('option_label_custom_true'), 'option_label_custom_true');
$customLabelTrue->setValue($this->object->getCustomTrueOptionLabel());
$option->addSubItem($customLabelTrue);
$customLabelFalse = new ilTextInputGUI($this->lng->txt('option_label_custom_false'), 'option_label_custom_false');
$customLabelFalse->setValue($this->object->getCustomFalseOptionLabel());
$option->addSubItem($customLabelFalse);
}
}
$form->addItem($optionLabel);
// points
$points = new ilNumberInputGUI($this->lng->txt('points'), 'points');
$points->setRequired(true);
$points->setSize(3);
$points->allowDecimals(true);
$points->setMinValue(0);
$points->setMinvalueShouldBeGreater(true);
$points->setValue($this->object->getPoints());
$form->addItem($points);
// score partial solution
$scorePartialSolution = new ilCheckboxInputGUI($this->lng->txt('score_partsol_enabled'), 'score_partsol_enabled');
$scorePartialSolution->setInfo($this->lng->txt('score_partsol_enabled_info'));
$scorePartialSolution->setChecked($this->object->isScorePartialSolutionEnabled());
$form->addItem($scorePartialSolution);
return $form;
}
示例7: 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);
}
示例8: 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);
}
}
}
示例9: initEditCustomForm
protected function initEditCustomForm(ilPropertyFormGUI $a_form)
{
global $lng;
// activation
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('poll_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('poll_availability_limitless_info'));
$act_type->addOption($opt);
$opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION);
$opt->setInfo($this->lng->txt('poll_availability_until_info'));
$date = $this->object->getAccessBegin();
$start = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_start'), 'access_begin');
$start->setShowTime(true);
$start->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$opt->addSubItem($start);
$date = $this->object->getAccessEnd();
$end = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_end'), 'access_end');
$end->setShowTime(true);
$end->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$opt->addSubItem($end);
/*
$visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
$visible->setInfo($this->lng->txt('poll_activation_limited_visibility_info'));
$opt->addSubItem($visible);
*/
$act_type->addOption($opt);
$a_form->addItem($act_type);
// period/results
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('poll_voting_period_and_results'));
$a_form->addItem($section);
$prd = new ilRadioGroupInputGUI($this->lng->txt('poll_voting_period'), 'period');
$opt = new ilRadioOption($this->lng->txt('poll_voting_period_unlimited'), 0);
$prd->addOption($opt);
$opt = new ilRadioOption($this->lng->txt('poll_voting_period_limited'), 1);
$prd->addOption($opt);
$date = $this->object->getVotingPeriodBegin();
$start = new ilDateTimeInputGUI($this->lng->txt('poll_voting_period_start'), 'period_begin');
$start->setShowTime(true);
$start->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$opt->addSubItem($start);
$date = $this->object->getVotingPeriodEnd();
$end = new ilDateTimeInputGUI($this->lng->txt('poll_voting_period_end'), 'period_end');
$end->setShowTime(true);
$end->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$opt->addSubItem($end);
$a_form->addItem($prd);
$results = new ilRadioGroupInputGUI($lng->txt("poll_view_results"), "results");
$results->setRequired(true);
$results->addOption(new ilRadioOption($lng->txt("poll_view_results_always"), ilObjPoll::VIEW_RESULTS_ALWAYS));
$results->addOption(new ilRadioOption($lng->txt("poll_view_results_never"), ilObjPoll::VIEW_RESULTS_NEVER));
$results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_vote"), ilObjPoll::VIEW_RESULTS_AFTER_VOTE));
$results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_period"), ilObjPoll::VIEW_RESULTS_AFTER_PERIOD));
$a_form->addItem($results);
}
示例10: inviteObject
/**
* Creates the output for user/group invitation to a survey
*/
public function inviteObject()
{
global $ilAccess;
global $rbacsystem;
global $ilToolbar;
global $lng;
if (!$rbacsystem->checkAccess("visible,invite", $this->ref_id)) {
// allow only read and write access
ilUtil::sendInfo($this->lng->txt("cannot_edit_survey"), true);
$path = $this->tree->getPathFull($this->object->getRefID());
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::redirect($this->getReturnLocation("cancel", "./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
return;
}
if ($this->object->getStatus() == ilObjSurvey::STATUS_OFFLINE) {
ilUtil::sendInfo($this->lng->txt("survey_offline_message"));
return;
}
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTableWidth("500");
$form->setId("invite");
// invitation
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("invitation"));
$form->addItem($header);
// invitation mode
$invitation = new ilRadioGroupInputGUI($this->lng->txt('invitation_mode'), "invitation");
$invitation->setInfo($this->lng->txt('invitation_mode_desc'));
$invitation->addOption(new ilRadioOption($this->lng->txt("invitation_off"), 0, ''));
$surveySetting = new ilSetting("survey");
if ($surveySetting->get("unlimited_invitation")) {
$invitation->addOption(new ilRadioOption($this->lng->txt("unlimited_users"), 1, ''));
}
$invitation->addOption(new ilRadioOption($this->lng->txt("predefined_users"), 2, ''));
$inv = 0;
if ($this->object->getInvitation()) {
$inv = $this->object->getInvitationMode() + 1;
}
$invitation->setValue($inv);
$form->addItem($invitation);
$form->addCommandButton("saveInvitationStatus", $this->lng->txt("save"));
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_invite.html", "Modules/Survey");
$this->tpl->setVariable("INVITATION_TABLE", $form->getHTML());
if ($this->object->getInvitation() && $this->object->getInvitationMode() == 1) {
// search button
include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $tb, array('auto_complete_name' => $lng->txt('user'), 'submit_name' => $lng->txt('svy_invite_action')));
$ilToolbar->addSpacer();
$ilToolbar->addButton($this->lng->txt("svy_search_users"), $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', ''));
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
$invited_users = $this->object->getUserData($this->object->getInvitedUsers());
include_once "./Modules/Survey/classes/tables/class.ilSurveyInvitedUsersTableGUI.php";
$table_gui = new ilSurveyInvitedUsersTableGUI($this, 'invite');
$table_gui->setData($invited_users);
$this->tpl->setVariable('TBL_INVITED_USERS', $table_gui->getHTML());
}
}
示例11: initForumCreateForm
/**
* @param string $object_type
*/
private function initForumCreateForm($object_type)
{
$this->create_form_gui = new ilPropertyFormGUI();
$this->create_form_gui->setTableWidth('600px');
$this->create_form_gui->setTitle($this->lng->txt('frm_new'));
$this->create_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
// form action
$this->ctrl->setParameter($this, 'new_type', $object_type);
$this->create_form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
// title
$title_gui = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title_gui->setSize(min(40, ilObject::TITLE_LENGTH));
$title_gui->setMaxLength(ilObject::TITLE_LENGTH);
$this->create_form_gui->addItem($title_gui);
// description
$description_gui = new ilTextAreaInputGUI($this->lng->txt('desc'), 'desc');
$description_gui->setCols(40);
$description_gui->setRows(2);
$this->create_form_gui->addItem($description_gui);
// view sorting threads
$sorting_threads_gui = new ilRadioGroupInputGUI($this->lng->txt('frm_sorting_threads'), 'thread_sorting');
$sort_dat = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('date'), 0);
$sorting_threads_gui->addOption($sort_dat);
$sort_man = new ilRadioOption($this->lng->txt('sorting_manual_sticky'), 1);
$sorting_threads_gui->addOption($sort_man);
$sorting_threads_gui->setInfo($this->lng->txt('sticky_threads_always_on_top'));
$this->create_form_gui->addItem($sorting_threads_gui);
// view
$view_group_gui = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'sort');
$view_hir = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('answers'), ilForumProperties::VIEW_TREE);
$view_group_gui->addOption($view_hir);
$view_dat = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('date'), ilForumProperties::VIEW_DATE);
$view_group_gui->addOption($view_dat);
$this->create_form_gui->addItem($view_group_gui);
$view_direction_group_gui = new ilRadioGroupInputGUI('', 'default_view_sort_dir');
$view_desc = new ilRadioOption($this->lng->txt('frm_post_sort_desc'), ilForumProperties::VIEW_DATE_DESC);
$view_direction_group_gui->addOption($view_desc);
$view_asc = new ilRadioOption($this->lng->txt('frm_post_sort_asc'), ilForumProperties::VIEW_DATE_ASC);
$view_direction_group_gui->addOption($view_asc);
$view_dat->addSubItem($view_direction_group_gui);
// anonymized or not
$anonymize_gui = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized');
$anonymize_gui->setInfo($this->lng->txt('frm_anonymous_posting_desc'));
$anonymize_gui->setValue(1);
if ($this->ilias->getSetting('enable_anonymous_fora', false)) {
$anonymize_gui->setDisabled(true);
}
$this->create_form_gui->addItem($anonymize_gui);
// statistics enabled or not
$statistics_gui = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled');
$statistics_gui->setInfo($this->lng->txt('frm_statistics_enabled_desc'));
$statistics_gui->setValue(1);
if (!$this->ilias->getSetting('enable_fora_statistics', false)) {
$statistics_gui->setDisabled(true);
}
$this->create_form_gui->addItem($statistics_gui);
$cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation');
$cb_prop->setValue('1');
$cb_prop->setInfo($this->lng->txt('post_activation_desc'));
$this->create_form_gui->addItem($cb_prop);
$this->create_form_gui->addCommandButton('save', $this->lng->txt('save'));
$this->create_form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
}
示例12: initBasicSettingsForm
/**
* Init basic settings form.
*/
public function initBasicSettingsForm()
{
global $lng, $ilSetting;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
$lng->loadLanguageModule("pd");
// installation short title
$ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
$ti->setMaxLength(200);
$ti->setSize(40);
$ti->setValue($ilSetting->get("short_inst_name"));
$ti->setInfo($this->lng->txt("short_inst_name_info"));
$this->form->addItem($ti);
// public section
$cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
$cb->setInfo($lng->txt("pub_section_info"));
if ($ilSetting->get("pub_section")) {
$cb->setChecked(true);
}
// search engine
include_once 'Services/PrivacySecurity/classes/class.ilRobotSettings.php';
$robot_settings = ilRobotSettings::_getInstance();
$cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
$cb2->setInfo($this->lng->txt("enable_search_engine"));
$cb->addSubItem($cb2);
if (!$robot_settings->checkModRewrite()) {
$cb2->setAlert($lng->txt("mod_rewrite_disabled"));
$cb2->setChecked(false);
$cb2->setDisabled(true);
} elseif (!$robot_settings->checkRewrite()) {
$cb2->setAlert($lng->txt("allow_override_alert"));
$cb2->setChecked(false);
$cb2->setDisabled(true);
} else {
if ($ilSetting->get("open_google")) {
$cb2->setChecked(true);
}
}
// Enable Global Profiles
$cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
$cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
$cb_prop->setChecked($ilSetting->get('enable_global_profiles'));
$cb->addSubItem($cb_prop);
// activate captcha for anonymous wiki/forum editing
include_once "./Services/Captcha/classes/class.ilCaptchaUtil.php";
$cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_wiki_forum'), 'activate_captcha_anonym');
$cap->setValue(1);
if (ilCaptchaUtil::checkFreetype()) {
$cap->setChecked($ilSetting->get('activate_captcha_anonym'));
} else {
$cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
}
$cb->addSubItem($cap);
$this->form->addItem($cb);
// default repository view
$options = array("flat" => $lng->txt("flatview"), "tree" => $lng->txt("treeview"));
$si = new ilSelectInputGUI($this->lng->txt("def_repository_view"), "default_rep_view");
$si->setOptions($options);
$si->setInfo($this->lng->txt(""));
if ($ilSetting->get("default_repository_view") == "tree") {
$si->setValue("tree");
} else {
$si->setValue("flat");
}
$this->form->addItem($si);
//
$options = array("" => $lng->txt("adm_rep_tree_only_container"), "tree" => $lng->txt("adm_all_resource_types"));
// repository tree
$radg = new ilRadioGroupInputGUI($lng->txt("adm_rep_tree_presentation"), "tree_pres");
$radg->setValue($ilSetting->get("repository_tree_pres"));
$op1 = new ilRadioOption($lng->txt("adm_rep_tree_only_cntr"), "", $lng->txt("adm_rep_tree_only_cntr_info"));
$radg->addOption($op1);
$op2 = new ilRadioOption($lng->txt("adm_rep_tree_all_types"), "all_types", $lng->txt("adm_rep_tree_all_types_info"));
// limit tree in courses and groups
$cb = new ilCheckboxInputGUI($lng->txt("adm_rep_tree_limit_grp_crs"), "rep_tree_limit_grp_crs");
$cb->setChecked($ilSetting->get("rep_tree_limit_grp_crs"));
$cb->setInfo($lng->txt("adm_rep_tree_limit_grp_crs_info"));
$op2->addSubItem($cb);
$radg->addOption($op2);
$this->form->addItem($radg);
$sdesc = new ilCheckboxInputGUI($lng->txt("adm_rep_shorten_description"), "rep_shorten_description");
$sdesc->setInfo($lng->txt("adm_rep_shorten_description_info"));
$sdesc->setChecked($ilSetting->get("rep_shorten_description"));
$this->form->addItem($sdesc);
$sdesclen = new ilTextInputGUI($lng->txt("adm_rep_shorten_description_length"), "rep_shorten_description_length");
$sdesclen->setValue($ilSetting->get("rep_shorten_description_length"));
$sdesclen->setSize(3);
$sdesc->addSubItem($sdesclen);
// synchronize repository tree with main view
$cb = new ilCheckboxInputGUI($lng->txt("adm_synchronize_rep_tree"), "rep_tree_synchronize");
$cb->setInfo($lng->txt("adm_synchronize_rep_tree_info"));
$cb->setChecked($ilSetting->get("rep_tree_synchronize"));
$this->form->addItem($cb);
// repository access check
/* $options = array(
0 => "0",
10 => "10",
//.........这里部分代码省略.........
示例13: initPropertiesForm
/**
* Init survey settings form
*
* @return ilPropertyFormGUI
*/
function initPropertiesForm()
{
$template_settings = $hide_rte_switch = null;
$template = $this->object->getTemplate();
if ($template) {
include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
$template = new ilSettingsTemplate($template);
$template_settings = $template->getSettings();
$hide_rte_switch = $template_settings["rte_switch"]["hide"];
}
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTableWidth("100%");
$form->setId("survey_properties");
// general properties
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("settings"));
$form->addItem($header);
// title & description (meta data)
include_once 'Services/MetaData/classes/class.ilMD.php';
$md_obj = new ilMD($this->object->getId(), 0, "svy");
$md_section = $md_obj->getGeneral();
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setRequired(true);
$title->setValue($md_section->getTitle());
$form->addItem($title);
$ids = $md_section->getDescriptionIds();
if ($ids) {
$desc_obj = $md_section->getDescription(array_pop($ids));
$desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
$desc->setCols(50);
$desc->setRows(4);
$desc->setValue($desc_obj->getDescription());
$form->addItem($desc);
}
// anonymization
if (!$this->object->get360Mode()) {
$anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_auth_mode"), "anonymization_options");
$hasDatasets = $this->object->_hasDatasets($this->object->getSurveyId());
if ($hasDatasets) {
$anonymization_options->setDisabled(true);
}
$anonymization_options->addOption(new ilCheckboxOption($this->lng->txt("anonymize_personalized"), 'personalized', ''));
$anonymization_options->addOption(new ilCheckboxOption($this->lng->txt("anonymize_without_code"), 'anonymize_without_code', ''));
$anonymization_options->addOption(new ilCheckboxOption($this->lng->txt("anonymize_with_code"), 'anonymize_with_code', ''));
if (!$this->object->getAnonymize()) {
$anonymization_options->setValue('personalized');
} else {
$anonymization_options->setValue($this->object->isAccessibleWithoutCode() ? 'anonymize_without_code' : 'anonymize_with_code');
}
$anonymization_options->setInfo($this->lng->txt("anonymize_survey_description"));
$form->addItem($anonymization_options);
} else {
$self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
$self_eval->setChecked($this->object->get360SelfEvaluation());
$form->addItem($self_eval);
$self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
$self_rate->setChecked($this->object->get360SelfRaters());
$form->addItem($self_rate);
$self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
$self_appr->setChecked($this->object->get360SelfAppraisee());
$form->addItem($self_appr);
}
// pool usage
$pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
$opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
$opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
$pool_usage->addOption($opt);
$opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
$opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
$pool_usage->addOption($opt);
$pool_usage->setValue($this->object->getPoolUsage());
$form->addItem($pool_usage);
// activation
include_once "Services/Object/classes/class.ilObjectActivation.php";
$this->lng->loadLanguageModule('rep');
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('rep_activation_availability'));
$form->addItem($section);
// additional info only with multiple references
$act_obj_info = $act_ref_info = "";
if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
$act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
$act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
}
$online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
$online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
$online->setChecked($this->object->isOnline());
$form->addItem($online);
$act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'access_type');
$act_type->setInfo($act_ref_info);
$act_type->setValue($this->object->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED);
$opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED);
$opt->setInfo($this->lng->txt('svy_availability_limitless_info'));
//.........这里部分代码省略.........
示例14: initFormNewsItem
/**
* FORM NewsItem: Init form.
*
* @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)
*/
public function initFormNewsItem($a_mode)
{
global $lng;
$lng->loadLanguageModule("news");
include "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form_gui = new ilPropertyFormGUI();
// Property Title
$text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title");
$text_input->setInfo("");
$text_input->setRequired(true);
$text_input->setMaxLength(200);
$this->form_gui->addItem($text_input);
// Property Content
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content");
$text_area->setInfo("");
$text_area->setRequired(false);
$this->form_gui->addItem($text_area);
// Property Visibility
$radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility");
$radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
$radio_group->setRequired(false);
$radio_group->setValue("users");
$this->form_gui->addItem($radio_group);
// Property ContentLong
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long");
$text_area->setInfo($lng->txt("news_news_item_content_long_info"));
$text_area->setRequired(false);
$text_area->setCols("40");
$text_area->setRows("8");
$text_area->setUseRte(true);
$this->form_gui->addItem($text_area);
// save and cancel commands
if (in_array($a_mode, array(IL_FORM_CREATE, IL_FORM_RE_CREATE))) {
$this->form_gui->addCommandButton("saveNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel"));
} else {
$this->form_gui->addCommandButton("updateNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel"));
}
$this->form_gui->setTitle($lng->txt("news_news_item_head"));
$this->form_gui->setFormAction($this->ctrl->getFormAction($this));
$this->prepareFormNewsItem($this->form_gui);
}
示例15: editSettings
/**
* Edit news settings.
*/
public function editSettings()
{
global $ilCtrl, $lng, $ilSetting;
$news_set = new ilSetting("news");
$feed_set = new ilSetting("feed");
$enable_internal_news = $ilSetting->get("block_activated_news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
$rss_title_format = $news_set->get("rss_title_format");
$enable_private_feed = $news_set->get("enable_private_feed");
$news_default_visibility = $news_set->get("default_visibility") != "" ? $news_set->get("default_visibility") : "users";
$disable_repository_feeds = $feed_set->get("disable_rep_feeds");
$nr_personal_desktop_feeds = $ilSetting->get("block_limit_pdfeed");
$allow_shorter_periods = $news_set->get("allow_shorter_periods");
$allow_longer_periods = $news_set->get("allow_longer_periods");
include_once "./Services/News/classes/class.ilNewsItem.php";
$rss_period = ilNewsItem::_lookupRSSPeriod();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitle($lng->txt("news_settings"));
// Enable internal news
$cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_internal_news"), "enable_internal_news");
$cb_prop->setValue("1");
$cb_prop->setInfo($lng->txt("news_enable_internal_news_info"));
$cb_prop->setChecked($enable_internal_news);
$form->addItem($cb_prop);
// Default Visibility
$radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "news_default_visibility");
$radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
$radio_group->setRequired(false);
$radio_group->setValue($news_default_visibility);
$form->addItem($radio_group);
// Number of news items per object
$nr_opts = array(50 => 50, 100 => 100, 200 => 200);
$nr_sel = new ilSelectInputGUI($lng->txt("news_nr_of_items"), "news_max_items");
$nr_sel->setInfo($lng->txt("news_nr_of_items_info"));
$nr_sel->setOptions($nr_opts);
$nr_sel->setValue($news_set->get("max_items"));
$form->addItem($nr_sel);
// Access Cache
$min_opts = array(0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60);
$min_sel = new ilSelectInputGUI($lng->txt("news_cache"), "news_acc_cache_mins");
$min_sel->setInfo($lng->txt("news_cache_info"));
$min_sel->setOptions($min_opts);
$min_sel->setValue($news_set->get("acc_cache_mins"));
$form->addItem($min_sel);
// PD News Period
$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"));
$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) ilNewsItem::_lookupDefaultPDPeriod());
$form->addItem($per_sel);
// Allow user to choose lower values
$sp_prop = new ilCheckboxInputGUI($lng->txt("news_allow_shorter_periods"), "allow_shorter_periods");
$sp_prop->setValue("1");
$sp_prop->setInfo($lng->txt("news_allow_shorter_periods_info"));
$sp_prop->setChecked($allow_shorter_periods);
$form->addItem($sp_prop);
// Allow user to choose higher values
$lp_prop = new ilCheckboxInputGUI($lng->txt("news_allow_longer_periods"), "allow_longer_periods");
$lp_prop->setValue("1");
$lp_prop->setInfo($lng->txt("news_allow_longer_periods_info"));
$lp_prop->setChecked($allow_longer_periods);
$form->addItem($lp_prop);
// Enable rss for internal news
$cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_internal_rss"), "enable_internal_rss");
$cb_prop->setValue("1");
$cb_prop->setInfo($lng->txt("news_enable_internal_rss_info"));
$cb_prop->setChecked($enable_internal_rss);
// RSS News Period
$rssp_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"), 365 => "1 " . $lng->txt("year"));
$rssp_sel = new ilSelectInputGUI($lng->txt("news_rss_period"), "news_rss_period");
$rssp_sel->setOptions($rssp_opts);
$rssp_sel->setValue((int) $rss_period);
$cb_prop->addSubItem($rssp_sel);
// Section Header: RSS
$sh = new ilFormSectionHeaderGUI();
$sh->setTitle($lng->txt("news_rss"));
$form->addItem($sh);
// title format for rss entries
$options = array("" => $lng->txt("news_rss_title_format_obj_news"), "news_obj" => $lng->txt("news_rss_title_format_news_obj"));
$si = new ilSelectInputGUI($lng->txt("news_rss_title_format"), "rss_title_format");
$si->setOptions($options);
$si->setValue($rss_title_format);
$cb_prop->addSubItem($si);
$form->addItem($cb_prop);
// Enable private news feed
$cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
$cb_prop->setValue("1");
$cb_prop->setInfo($lng->txt("news_enable_private_feed_info"));
$cb_prop->setChecked($enable_private_feed);
$form->addItem($cb_prop);
//.........这里部分代码省略.........