本文整理汇总了PHP中ilSelectInputGUI::setDisabled方法的典型用法代码示例。如果您正苦于以下问题:PHP ilSelectInputGUI::setDisabled方法的具体用法?PHP ilSelectInputGUI::setDisabled怎么用?PHP ilSelectInputGUI::setDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilSelectInputGUI
的用法示例。
在下文中一共展示了ilSelectInputGUI::setDisabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initForm
protected function initForm()
{
$this->setTitle($this->pl->txt('form_title'));
$te = new ilSelectInputGUI($this->txt(self::F_UDF_FIELD_ID), self::F_UDF_FIELD_ID);
$te->setDisabled(!$this->is_new);
$te->setRequired(true);
$te->setOptions(ilUDFCheck::getDefinitionData());
$this->addItem($te);
if (!$this->is_new) {
$te = new ilHiddenInputGUI($this->txt(self::F_UDF_FIELD_ID), self::F_UDF_FIELD_ID);
$this->addItem($te);
switch (ilUDFCheck::getDefinitionTypeForId($this->object->getUdfFieldId())) {
case ilUDFCheck::TYPE_TEXT:
$se = new ilTextInputGUI($this->pl->txt(self::F_CHECK_VALUE), self::F_CHECK_VALUE);
$this->addItem($se);
break;
case ilUDFCheck::TYPE_SELECT:
$se = new ilSelectInputGUI($this->pl->txt(self::F_CHECK_VALUE), self::F_CHECK_VALUE);
$se->setOptions(ilUDFCheck::getDefinitionValuesForId($this->object->getUdfFieldId()));
$this->addItem($se);
break;
}
}
$this->addCommandButtons();
}
示例2: addStandardFieldsToForm
/**
* Add standard fields to form
*/
function addStandardFieldsToForm($a_form, $a_user = NULL, array $custom_fields = NULL)
{
global $ilSetting, $lng, $rbacreview, $ilias;
// custom registration settings
if (self::$mode == self::MODE_REGISTRATION) {
include_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
$registration_settings = new ilRegistrationSettings();
self::$user_field["username"]["group"] = "login_data";
self::$user_field["password"]["group"] = "login_data";
self::$user_field["language"]["default"] = $lng->lang_key;
// different position for role
$roles = self::$user_field["roles"];
unset(self::$user_field["roles"]);
self::$user_field["roles"] = $roles;
self::$user_field["roles"]["group"] = "settings";
}
$fields = $this->getStandardFields();
$current_group = "";
$custom_fields_done = false;
foreach ($fields as $f => $p) {
// next group? -> diplay subheader
if ($p["group"] != $current_group && ilUserProfile::userSettingVisible($f)) {
if (is_array($custom_fields) && !$custom_fields_done) {
// should be appended to "other" or at least before "settings"
if ($current_group == "other" || $p["group"] == "settings") {
// add "other" subheader
if ($current_group != "other") {
$sh = new ilFormSectionHeaderGUI();
$sh->setTitle($lng->txt("other"));
$a_form->addItem($sh);
}
foreach ($custom_fields as $custom_field) {
$a_form->addItem($custom_field);
}
$custom_fields_done = true;
}
}
$sh = new ilFormSectionHeaderGUI();
$sh->setTitle($lng->txt($p["group"]));
$a_form->addItem($sh);
$current_group = $p["group"];
}
$m = "";
if (isset($p["method"])) {
$m = $p["method"];
}
$lv = isset($p["lang_var"]) && $p["lang_var"] != "" ? $p["lang_var"] : $f;
switch ($p["input"]) {
case "login":
if ((int) $ilSetting->get('allow_change_loginname') || self::$mode == self::MODE_REGISTRATION) {
$val = new ilTextInputGUI($lng->txt('username'), 'username');
if ($a_user) {
$val->setValue($a_user->getLogin());
}
$val->setMaxLength(32);
$val->setSize(40);
$val->setRequired(true);
} else {
// user account name
$val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un');
if ($a_user) {
$val->setValue($a_user->getLogin());
}
}
$a_form->addItem($val);
break;
case "text":
if (ilUserProfile::userSettingVisible($f)) {
$ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f);
if ($a_user) {
$ti->setValue($a_user->{$m}());
}
$ti->setMaxLength($p["maxlength"]);
$ti->setSize($p["size"]);
$ti->setRequired($ilSetting->get("require_" . $f));
if (!$ti->getRequired() || $ti->getValue()) {
$ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
}
$a_form->addItem($ti);
}
break;
case "sel_country":
if (ilUserProfile::userSettingVisible($f)) {
include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php";
$ci = new ilCountrySelectInputGUI($lng->txt($lv), "usr_" . $f);
if ($a_user) {
$ci->setValue($a_user->{$m}());
}
$ci->setRequired($ilSetting->get("require_" . $f));
if (!$ci->getRequired() || $ci->getValue()) {
$ci->setDisabled($ilSetting->get("usr_settings_disable_" . $f));
}
$a_form->addItem($ci);
}
break;
case "birthday":
if (ilUserProfile::userSettingVisible($f)) {
//.........这里部分代码省略.........
示例3: initUnitForm
/**
* @param assFormulaQuestionUnitCategory $category
* @param assFormulaQuestionUnit $unit
* @return ilPropertyFormGUI
*/
protected function initUnitForm(assFormulaQuestionUnitCategory $category = null, assFormulaQuestionUnit $unit = null)
{
if ($this->unit_form instanceof ilPropertyFormGUI) {
return $this->unit_form;
}
$unit_in_use = false;
if ($unit instanceof assFormulaQuestionUnit && $this->repository->isUnitInUse($unit->getId())) {
$unit_in_use = true;
}
$this->unit_form = new ilPropertyFormGUI();
$title = new ilTextInputGUI($this->lng->txt('unit'), 'unit_title');
$title->setDisabled($unit_in_use);
$title->setRequired(true);
$this->unit_form->addItem($title);
$baseunit = new ilSelectInputGUI($this->lng->txt('baseunit'), 'base_unit');
$items = $this->repository->getCategorizedUnits();
$options = array();
$category_name = '';
$new_category = false;
foreach ((array) $items as $item) {
if ($unit instanceof assFormulaQuestionUnit && $unit->getId() == $item->getId()) {
continue;
}
/**
* @var $item assFormulaQuestionUnitCategory|assFormulaQuestionUnitCategory
*/
if ($item instanceof assFormulaQuestionUnitCategory) {
if ($category_name != $item->getDisplayString()) {
$new_category = true;
$category_name = $item->getDisplayString();
}
continue;
}
$options[$item->getId()] = $item->getDisplayString() . ($new_category ? ' (' . $category_name . ')' : '');
$new_category = false;
}
$baseunit->setDisabled($unit_in_use);
$baseunit->setOptions(array(0 => $this->lng->txt('no_selection')) + $options);
$this->unit_form->addItem($baseunit);
$factor = new ilNumberInputGUI($this->lng->txt('factor'), 'factor');
$factor->setRequired(true);
$factor->setSize(3);
$factor->setMinValue(0);
$factor->allowDecimals(true);
$factor->setDisabled($unit_in_use);
$this->unit_form->addItem($factor);
if (null === $unit) {
$this->unit_form->setTitle($this->lng->txt('new_unit'));
$this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'addUnit'));
$this->unit_form->addCommandButton('addUnit', $this->lng->txt('save'));
} else {
$this->ctrl->setParameter($this, 'unit_id', $unit->getId());
if ($unit_in_use) {
$this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'showUnitsOfCategory'));
} else {
$this->unit_form->addCommandButton('saveUnit', $this->lng->txt('save'));
$this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'saveUnit'));
}
$this->unit_form->setTitle(sprintf($this->lng->txt('un_sel_cat_sel_unit'), $category->getDisplayString(), $unit->getDisplayString()));
}
$this->unit_form->addCommandButton('showUnitsOfCategory', $this->lng->txt('cancel'));
return $this->unit_form;
}
示例4: initGeneralSettingsForm
/**
* Init general settings form.
*
*/
public function initGeneralSettingsForm()
{
global $lng, $ilUser, $styleDefinition, $ilSetting;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
// language
if ($this->userSettingVisible("language")) {
$languages = $this->lng->getInstalledLanguages();
$options = array();
foreach ($languages as $lang_key) {
$options[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
}
$si = new ilSelectInputGUI($this->lng->txt("language"), "language");
$si->setOptions($options);
$si->setValue($ilUser->getLanguage());
$si->setDisabled($ilSetting->get("usr_settings_disable_language"));
$this->form->addItem($si);
}
// skin/style
include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
if ($this->userSettingVisible("skin_style")) {
$templates = $styleDefinition->getAllTemplates();
if (is_array($templates)) {
$si = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
$options = array();
foreach ($templates as $template) {
// get styles information of template
$styleDef = new ilStyleDefinition($template["id"]);
$styleDef->startParsing();
$styles = $styleDef->getStyles();
foreach ($styles as $style) {
if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
continue;
}
$options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"];
}
}
$si->setOptions($options);
$si->setValue($ilUser->skin . ":" . $ilUser->prefs["style"]);
$si->setDisabled($ilSetting->get("usr_settings_disable_skin_style"));
$this->form->addItem($si);
}
}
// screen reader optimization
if ($this->userSettingVisible("screen_reader_optimization")) {
$cb = new ilCheckboxInputGUI($this->lng->txt("user_screen_reader_optimization"), "screen_reader_optimization");
$cb->setChecked($ilUser->prefs["screen_reader_optimization"]);
$cb->setDisabled($ilSetting->get("usr_settings_disable_screen_reader_optimization"));
$cb->setInfo($this->lng->txt("user_screen_reader_optimization_info"));
$this->form->addItem($cb);
}
// hits per page
if ($this->userSettingVisible("hits_per_page")) {
$si = new ilSelectInputGUI($this->lng->txt("hits_per_page"), "hits_per_page");
$hits_options = array(10, 15, 20, 30, 40, 50, 100, 9999);
$options = array();
foreach ($hits_options as $hits_option) {
$hstr = $hits_option == 9999 ? $this->lng->txt("no_limit") : $hits_option;
$options[$hits_option] = $hstr;
}
$si->setOptions($options);
$si->setValue($ilUser->prefs["hits_per_page"]);
$si->setDisabled($ilSetting->get("usr_settings_disable_hits_per_page"));
$this->form->addItem($si);
}
// Users Online
if ($this->userSettingVisible("show_users_online")) {
$si = new ilSelectInputGUI($this->lng->txt("show_users_online"), "show_users_online");
$options = array("y" => $this->lng->txt("users_online_show_y"), "associated" => $this->lng->txt("users_online_show_associated"), "n" => $this->lng->txt("users_online_show_n"));
$si->setOptions($options);
$si->setValue($ilUser->prefs["show_users_online"]);
$si->setDisabled($ilSetting->get("usr_settings_disable_show_users_online"));
$this->form->addItem($si);
}
// Store last visited
$lv = new ilSelectInputGUI($this->lng->txt("user_store_last_visited"), "store_last_visited");
$options = array(0 => $this->lng->txt("user_lv_keep_entries"), 1 => $this->lng->txt("user_lv_keep_only_for_session"), 2 => $this->lng->txt("user_lv_do_not_store"));
$lv->setOptions($options);
$lv->setValue((int) $ilUser->prefs["store_last_visited"]);
$this->form->addItem($lv);
// hide_own_online_status
if ($this->userSettingVisible("hide_own_online_status")) {
$cb = new ilCheckboxInputGUI($this->lng->txt("hide_own_online_status"), "hide_own_online_status");
$cb->setChecked($ilUser->prefs["hide_own_online_status"] == "y");
$cb->setDisabled($ilSetting->get("usr_settings_disable_hide_own_online_status"));
$this->form->addItem($cb);
}
include_once 'Services/Authentication/classes/class.ilSessionReminder.php';
if (ilSessionReminder::isGloballyActivated()) {
$cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
$cb->setInfo($this->lng->txt('session_reminder_info'));
$cb->setValue(1);
$cb->setChecked((int) $ilUser->getPref('session_reminder_enabled'));
$expires = ilSession::getSessionExpireValue();
$lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time');
$lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilFormat::_secondsToString($expires, true)));
//.........这里部分代码省略.........
示例5: showECSStart
/**
* Show special form for ecs start
*
* @access private
* @param object ilAdvMDFieldDefinition
*/
private function showECSStart($def)
{
global $ilUser;
$this->lng->loadLanguageModule('ecs');
include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php';
$value_start = ilAdvancedMDValue::_getInstance($this->obj_id, $def->getFieldId());
$unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8, 0, 0, date('m'), date('d'), date('Y'));
$time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'), 'md[' . $def->getFieldId() . ']');
$time->setShowTime(true);
$time->setDate(new ilDateTime($unixtime, IL_CAL_UNIX));
$time->enableDateActivation($this->lng->txt('enabled'), 'md_activated[' . $def->getFieldId() . ']', $value_start->getValue() ? true : false);
$time->setDisabled($value_start->isDisabled());
$mapping = ilECSDataMappingSettings::_getInstance();
if ($field_id = $mapping->getMappingByECSName('end')) {
$value_end = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
list($hours, $minutes) = $this->parseDuration($value_start->getValue(), $value_end->getValue());
$duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'), 'ecs_duration');
$duration->setHours($hours);
$duration->setMinutes($minutes);
#$duration->setInfo($this->lng->txt('ecs_duration_info'));
$duration->setShowHours(true);
$duration->setShowMinutes(true);
$time->addSubItem($duration);
}
if ($field_id = $mapping->getMappingByECSName('cycle')) {
$value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
$cycle_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
switch ($cycle_def->getFieldType()) {
case ilAdvancedMDFieldDefinition::TYPE_TEXT:
$text = new ilTextInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
$text->setValue($value->getValue());
$text->setSize(20);
$text->setMaxLength(512);
$text->setDisabled($value->isDisabled());
$time->addSubItem($text);
break;
case ilAdvancedMDFieldDefinition::TYPE_SELECT:
$select = new ilSelectInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
$select->setOptions($cycle_def->getFieldValuesForSelect());
$select->setValue($value->getValue());
$select->setDisabled($value->isDisabled());
$time->addSubItem($select);
break;
}
}
if ($field_id = $mapping->getMappingByECSName('room')) {
$value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
$room_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
switch ($room_def->getFieldType()) {
case ilAdvancedMDFieldDefinition::TYPE_TEXT:
$text = new ilTextInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
$text->setValue($value->getValue());
$text->setSize(20);
$text->setMaxLength(512);
$text->setDisabled($value->isDisabled());
$time->addSubItem($text);
break;
case ilAdvancedMDFieldDefinition::TYPE_SELECT:
$select = new ilSelectInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
$select->setOptions($cycle_def->getFieldValuesForSelect());
$select->setValue($value->getValue());
$select->setDisabled($value->isDisabled());
$time->addSubItem($select);
break;
}
}
$this->form->addItem($time);
}
示例6: initFormRoomSize
/**
* Ini form for room size
* @param ilPropertyFormGUI $form
* @return bool
*/
protected function initFormRoomSize(ilPropertyFormGUI $form, $a_create = true)
{
$room_size_list = ilViteroUtils::getRoomSizeList();
if (!count($room_size_list)) {
return false;
}
$room_size = new ilSelectInputGUI(ilViteroPlugin::getInstance()->txt('room_size'), 'room_size');
$room_size->setOptions($room_size_list);
if (!$a_create) {
$room_size->setDisabled(true);
}
$form->addItem($room_size);
return true;
}
示例7: initForm
/**
* Initializes a form for either displaying a room, adding a new room or editing an existing
* room. The difference between those three forms is subtle but important: the form for
* displaying rooms displays the information of the room without the ability of editing them.
* The form for creating a room allows the input of values but contains no values initially. The
* form for editing a room contains information that have been set before.
* The creation of either those forms is determined by the mode parameter.
*
* @param string $a_mode the mode this form is centered around
*
* @return ilPropertyFormGUI the form with the given mode
*/
private function initForm($a_mode = "show")
{
$form_gui =& new ilPropertyFormGUI();
$form_gui->setMultipart(true);
$form_gui->setTitle($this->lng->txt("rep_robj_xrs_room_properties"));
$form_gui->setDescription($this->lng->txt("rep_robj_xrs_room_prop_description"));
$name = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_name"), "name");
$name->setDisabled(true);
$form_gui->addItem($name);
$type = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_type"), "type");
$type->setDisabled(true);
$form_gui->addItem($type);
$min_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_min_alloc"), "min_alloc");
$min_alloc->setDisabled(true);
$form_gui->addItem($min_alloc);
$max_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_max_alloc"), "max_alloc");
$max_alloc->setDisabled(true);
$form_gui->addItem($max_alloc);
$floor_plan = new ilSelectInputGUI($this->lng->txt("rep_robj_xrs_room_floor_plans"), "file_id");
$floor_plan->setOptions($this->room_obj->getAllFloorplans());
$floor_plan->setDisabled(true);
$form_gui->addItem($floor_plan);
if (count($this->room_obj->getAllAvailableAttributes())) {
$defined_attributes = $this->room_obj->getAttributes();
$show_mode_with_exist_attrs = $a_mode == "show" && count($defined_attributes) > 0;
if ($a_mode == "edit" || $a_mode == "create" || $show_mode_with_exist_attrs) {
$attributes_header = new ilFormSectionHeaderGUI();
$attribute_header_text = $this->createAttributeHeaderText();
$attributes_header->setTitle($this->lng->txt("rep_robj_xrs_room_attributes") . $attribute_header_text);
$form_gui->addItem($attributes_header);
}
foreach ($this->room_obj->getAllAvailableAttributes() as $attr) {
$attribute_amount_by_id = $this->room_obj->getAttributeAmountById($attr['id']);
$amount_not_given = !ilRoomSharingNumericUtils::isPositiveNumber($attribute_amount_by_id, true);
if ($a_mode == "show" && $amount_not_given) {
continue;
} else {
$attr_field = new ilRoomSharingNumberInputGUI($attr['name'], self::ATTRIBUTE_ID_PREFIX . $attr['id']);
$attr_field->setValue($attribute_amount_by_id);
$attr_field->setMinValue(0);
$attr_field->setDisabled($a_mode == "show");
$form_gui->addItem($attr_field);
}
}
}
if ($a_mode == "edit" || $a_mode == "create") {
$name->setDisabled(false);
$name->setRequired(true);
$type->setDisabled(false);
$min_alloc->setDisabled(false);
$min_alloc->setMinValue(0);
$max_alloc->setDisabled(false);
$max_alloc->setRequired(true);
$max_alloc->setMinValue(0);
$floor_plan->setDisabled(false);
if ($a_mode == "create") {
$min_alloc->setValue("0");
$form_gui->addCommandButton($this->ctrl->getLinkTarget($this, "addRoom"), $this->lng->txt("rep_robj_xrs_add_room"));
} else {
$form_gui->addCommandButton("saveRoom", $this->lng->txt("save"));
}
}
if ($a_mode == "edit" || $a_mode == "show") {
$name->setValue($this->room_obj->getName());
$type->setValue($this->room_obj->getType());
$min_alloc->setValue($this->room_obj->getMinAlloc());
$max_alloc->setValue($this->room_obj->getMaxAlloc());
$floor_plan->setValue($this->room_obj->getFileId());
if ($a_mode == "show") {
$floor_plan->setDisabled(true);
$mobj = new ilObjMediaObject($this->room_obj->getFileId());
$mitems = $mobj->getMediaItems();
if (!empty($mitems)) {
$med = $mobj->getMediaItem("Standard");
$target = $med->getThumbnailTarget();
$image_with_link = "<br><a target='_blank' href='" . $mobj->getDataDirectory() . "/" . $med->getLocation() . "'>" . ilUtil::img($target) . "</a>";
$floor_plan->setInfo($image_with_link);
}
}
}
$form_gui->setFormAction($this->ctrl->getFormAction($this));
return $form_gui;
}
示例8: initMailOptionsForm
/**
* Initialises the mail options form
*
* @access private
*
*/
private function initMailOptionsForm()
{
global $ilCtrl, $ilSetting, $lng, $ilUser;
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($ilCtrl->getFormAction($this, 'saveOptions'));
$this->form->setTitle($lng->txt('mail_settings'));
// BEGIN INCOMING
if ($ilSetting->get('usr_settings_hide_mail_incoming_mail') != '1') {
$options = array(IL_MAIL_LOCAL => $lng->txt('mail_incoming_local'), IL_MAIL_EMAIL => $lng->txt('mail_incoming_smtp'), IL_MAIL_BOTH => $lng->txt('mail_incoming_both'));
$si = new ilSelectInputGUI($lng->txt('mail_incoming'), 'incoming_type');
$si->setOptions($options);
if (!strlen(ilObjUser::_lookupEmail($ilUser->getId())) || $ilSetting->get('usr_settings_disable_mail_incoming_mail') == '1') {
$si->setDisabled(true);
}
$this->form->addItem($si);
}
// BEGIN LINEBREAK_OPTIONS
$options = array();
for ($i = 50; $i <= 80; $i++) {
$options[$i] = $i;
}
$si = new ilSelectInputGUI($lng->txt('linebreak'), 'linebreak');
$si->setOptions($options);
$this->form->addItem($si);
// BEGIN SIGNATURE
$ta = new ilTextAreaInputGUI($lng->txt('signature'), 'signature');
$ta->setRows(10);
$ta->setCols(60);
$this->form->addItem($ta);
// BEGIN CRONJOB NOTIFICATION
if ($ilSetting->get('mail_notification')) {
$cb = new ilCheckboxInputGUI($lng->txt('cron_mail_notification'), 'cronjob_notification');
$cb->setInfo($lng->txt('mail_cronjob_notification_info'));
$cb->setValue(1);
$this->form->addItem($cb);
}
$this->form->addCommandButton('saveOptions', $lng->txt('save'));
}
示例9: addHeadingObject
/**
* Creates a form to add a heading to a survey
*
* @param integer $question_id The id of the question directly after the heading. If the id is given, an existing heading will be edited
* @access public
*/
function addHeadingObject($checkonly = false, $question_id = "")
{
$this->questionsSubtabs("questions");
global $ilAccess;
$save = strcmp($this->ctrl->getCmd(), "saveHeading") == 0 ? TRUE : FALSE;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTableWidth("100%");
$form->setId("survey_heading");
// general properties
$header = new ilFormSectionHeaderGUI();
if ($question_id) {
$header->setTitle($this->lng->txt("edit_heading"));
} else {
$header->setTitle($this->lng->txt("add_heading"));
}
$form->addItem($header);
$survey_questions =& $this->object->getSurveyQuestions();
// heading
$heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
$heading->setValue($this->object->prepareTextareaOutput(array_key_exists('heading', $_POST) ? $_POST['heading'] : $survey_questions[$question_id]["heading"]));
$heading->setRows(10);
$heading->setCols(80);
$heading->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
$heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
$heading->setRTESupport($this->object->getId(), "svy", "survey", null, false, "3.4.7");
$heading->setRequired(true);
$form->addItem($heading);
$insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
$options = array();
foreach ($survey_questions as $key => $value) {
$options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
}
$insertbefore->setOptions($options);
$insertbefore->setValue(array_key_exists('insertbefore', $_REQUEST) ? $_REQUEST['insertbefore'] : $question_id);
$insertbefore->setRequired(true);
if ($question_id || array_key_exists('insertbefore', $_REQUEST)) {
$insertbefore->setDisabled(true);
}
$form->addItem($insertbefore);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form->addCommandButton("saveHeading", $this->lng->txt("save"));
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form->addCommandButton("cancelHeading", $this->lng->txt("cancel"));
}
$errors = false;
if ($save) {
$errors = !$form->checkInput();
$form->setValuesByPost();
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}
return $errors;
}
示例10: initForm
/**
* Init form
*/
protected function initForm()
{
$this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
$title = $this->isNew ? $this->pl->txt('choose_cert_type') : $this->pl->txt('edit_settings');
// Certificate Type
$type = $this->getTypeInput();
$n_types = count($type->getOptions());
if ($this->isNew) {
if (!$n_types) {
ilUtil::sendInfo($this->pl->txt('msg_no_types_available'));
} else {
$this->setTitle($title);
$this->addItem($type);
$this->addCommandButton('createDefinition', $this->pl->txt('save'));
}
return;
} else {
if ($n_types > 1) {
$this->setTitle($title);
$checkbox = new ilCheckboxInputGUI($this->pl->txt('change_cert_type'), 'change_type');
$checkbox->addSubItem($type);
$checkbox->setInfo($this->pl->txt('current_type') . ' ' . $this->definition->getType()->getTitle());
$this->addItem($checkbox);
}
}
// Add all settings inputs
$settings_inputs = $this->getSettingsInputs();
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->pl->txt('certificate'));
$this->addItem($header);
$this->addItem($settings_inputs[srCertificateTypeSetting::IDENTIFIER_DEFAULT_LANG]);
$this->addItem($settings_inputs[srCertificateTypeSetting::IDENTIFIER_VALIDITY_TYPE]);
$this->addItem($settings_inputs[srCertificateTypeSetting::IDENTIFIER_GENERATION]);
$this->addItem($settings_inputs[srCertificateTypeSetting::IDENTIFIER_DOWNLOADABLE]);
$this->addItem($settings_inputs[srCertificateTypeSetting::IDENTIFIER_SCORM_TIMING]);
// Custom settings
/** @var srCertificateCustomDefinitionSetting $setting */
foreach ($this->definition->getCustomSettings() as $setting) {
switch ($setting->getSettingTypeId()) {
case srCertificateCustomTypeSetting::SETTING_TYPE_BOOLEAN:
$item = new ilCheckboxInputGUI($setting->getLabel($this->user->getLanguage()), 'custom_setting_' . $setting->getIdentifier());
if ($setting->getValue()) {
$item->setChecked(true);
}
break;
case srCertificateCustomTypeSetting::SETTING_TYPE_SELECT:
$item = new ilSelectInputGUI($setting->getLabel($this->user->getLanguage()), 'custom_setting_' . $setting->getIdentifier());
$item->setValue($setting->getValue());
$item->setOptions($setting->getCustomTypeSetting()->getData(true));
break;
}
$item->setDisabled(!$setting->isEditable());
$this->addItem($item);
}
// Notification
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->pl->txt('setting_id_notification'));
$this->addItem($header);
$this->addItem($settings_inputs[srCertificateTypeSetting::IDENTIFIER_NOTIFICATION]);
if (isset($settings_inputs[srCertificateTypeSetting::IDENTIFIER_NOTIFICATION_USER])) {
$this->addItem($settings_inputs[srCertificateTypeSetting::IDENTIFIER_NOTIFICATION_USER]);
}
$this->addCommandButton("updateDefinition", "Save");
}