本文整理汇总了PHP中ilSelectInputGUI::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP ilSelectInputGUI::setOptions方法的具体用法?PHP ilSelectInputGUI::setOptions怎么用?PHP ilSelectInputGUI::setOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilSelectInputGUI
的用法示例。
在下文中一共展示了ilSelectInputGUI::setOptions方法的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: initFilter
/**
* Init Filter
*/
function initFilter()
{
global $lng, $ilUser;
// period
$per = $_SESSION["news_pd_news_per"] != "" ? $_SESSION["news_pd_news_per"] : ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
$news_set = new ilSetting("news");
$allow_shorter_periods = $news_set->get("allow_shorter_periods");
$allow_longer_periods = $news_set->get("allow_longer_periods");
$default_per = ilNewsItem::_lookupDefaultPDPeriod();
$options = array(2 => sprintf($lng->txt("news_period_x_days"), 2), 3 => sprintf($lng->txt("news_period_x_days"), 3), 5 => sprintf($lng->txt("news_period_x_days"), 5), 7 => $lng->txt("news_period_1_week"), 14 => sprintf($lng->txt("news_period_x_weeks"), 2), 30 => $lng->txt("news_period_1_month"), 60 => sprintf($lng->txt("news_period_x_months"), 2), 120 => sprintf($lng->txt("news_period_x_months"), 4), 180 => sprintf($lng->txt("news_period_x_months"), 6), 366 => $lng->txt("news_period_1_year"));
$unset = array();
foreach ($options as $k => $opt) {
if (!$allow_shorter_periods && $k < $default_per) {
$unset[$k] = $k;
}
if (!$allow_longer_periods && $k > $default_per) {
$unset[$k] = $k;
}
}
foreach ($unset as $k) {
unset($options[$k]);
}
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$si = new ilSelectInputGUI($this->lng->txt("news_time_period"), "news_per");
$si->setOptions($options);
$si->setValue($per);
$this->addFilterItem($si);
// related to...
$si = new ilSelectInputGUI($this->lng->txt("context"), "news_ref_id");
$si->setOptions($this->contexts);
$si->setValue($this->selected_context);
$this->addFilterItem($si);
}
示例3: listFields
/**
* list fields
*/
public function listFields()
{
global $tpl, $lng, $ilCtrl, $ilToolbar;
// Show tables
require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
$tables = $this->parent_obj->object->getTables();
foreach ($tables as $table) {
$options[$table->getId()] = $table->getTitle();
}
include_once './Services/Form/classes/class.ilSelectInputGUI.php';
$table_selection = new ilSelectInputGUI('', 'table_id');
$table_selection->setOptions($options);
$table_selection->setValue($this->table_id);
$ilToolbar->setFormAction($ilCtrl->getFormActionByClass("ilDataCollectionFieldListGUI", "doTableSwitch"));
$ilToolbar->addText($lng->txt("dcl_table"));
$ilToolbar->addInputItem($table_selection);
$ilToolbar->addFormButton($lng->txt('change'), 'doTableSwitch');
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt("dcl_add_new_table"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "create"));
$ilToolbar->addSeparator();
$ilCtrl->setParameterByClass("ildatacollectiontableeditgui", "table_id", $this->table_id);
$ilToolbar->addButton($lng->txt("dcl_table_settings"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "edit"));
$ilToolbar->addButton($lng->txt("dcl_delete_table"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "confirmDelete"));
$ilToolbar->addButton($lng->txt("dcl_add_new_field"), $ilCtrl->getLinkTargetByClass("ildatacollectionfieldeditgui", "create"));
// requested not to implement this way...
// $tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
require_once './Modules/DataCollection/classes/class.ilDataCollectionFieldListTableGUI.php';
$list = new ilDataCollectionFieldListTableGUI($this, $ilCtrl->getCmd(), $this->table_id);
$tpl->setContent($list->getHTML());
}
示例4: getDeveloperRubricCardFormCommandRow
private function getDeveloperRubricCardFormCommandRow($form_action)
{
global $ilUser;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
//configure the command row
$rubric_commandrow_tpl = new ilTemplate('tpl.lp_rubricform_commandrow.html', true, true, 'Services/Tracking');
$select_prop = new ilSelectInputGUI('Title', 'selected_cmdrubric');
$options = array('behavior_1' => $this->lng->txt('rubric_option_behavior_1'), 'behavior_2' => $this->lng->txt('rubric_option_behavior_2'), 'behavior_3' => $this->lng->txt('rubric_option_behavior_3'), 'behavior_4' => $this->lng->txt('rubric_option_behavior_4'), 'behavior_5' => $this->lng->txt('rubric_option_behavior_5'), 'add_group' => $this->lng->txt('rubric_option_add_group'), 'del_group' => $this->lng->txt('rubric_option_del_group'), 'add_criteria' => $this->lng->txt('rubric_option_add_criteria'), 'del_criteria' => $this->lng->txt('rubric_option_del_criteria'));
$select_prop->setOptions($options);
$rubric_commandrow_tpl->setVariable('RURBRIC_COMMANDROW_SELECT', $select_prop->render());
$rubric_commandrow_tpl->setVariable('RUBRIC_SAVE', $this->lng->txt('save'));
$rubric_commandrow_tpl->setVariable('RUBRIC_EXECUTE', $this->lng->txt('execute'));
$rubric_commandrow_tpl->setVariable('FORM_ACTION', $form_action);
$rubric_commandrow_tpl->setVariable('PASSING_GRADE_VALUE', "{$this->passing_grade}");
if (!is_null($this->rubric_locked)) {
$rubric_commandrow_tpl->setVariable('RUBRIC_DISABLED', 'disabled');
$rubric_commandrow_tpl->setVariable('RUBRIC_LOCK', $this->lng->txt('rubric_card_unlock'));
$tmp_user = ilObjectFactory::getInstanceByObjId($this->rubric_owner, false);
if ($this->rubric_owner !== $ilUser->getId()) {
$rubric_commandrow_tpl->setVariable('USER_LOCK', 'disabled');
}
ilUtil::sendInfo($this->lng->txt('rubric_locked_info') . ' ' . $tmp_user->getFullName() . ' ' . $this->rubric_locked);
} else {
$rubric_commandrow_tpl->setVariable('RUBRIC_LOCK', $this->lng->txt('rubric_card_lock'));
}
$rubric_commandrow_tpl->setVariable('EXPORT', $this->lng->txt('rubric_option_export_pdf'));
return $rubric_commandrow_tpl;
}
示例5: editSettings
/**
* Edit news settings.
*/
public function editSettings()
{
global $ilCtrl, $lng, $ilSetting, $ilTabs, $ilToolbar;
$ilTabs->activateTab("settings");
if (OH_REF_ID > 0) {
ilUtil::sendInfo("This installation is used for online help authoring. Help modules cannot be imported.");
return;
}
if ($this->checkPermissionBool("write")) {
// help file
include_once "./Services/Form/classes/class.ilFileInputGUI.php";
$fi = new ilFileInputGUI($lng->txt("help_help_file"), "help_file");
$fi->setSuffixes(array("zip"));
$ilToolbar->addInputItem($fi, true);
$ilToolbar->addFormButton($lng->txt("upload"), "uploadHelpFile");
$ilToolbar->addSeparator();
// help mode
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$options = array("" => $lng->txt("help_tooltips_and_help"), "1" => $lng->txt("help_help_only"), "2" => $lng->txt("help_tooltips_only"));
$si = new ilSelectInputGUI($this->lng->txt("help_mode"), "help_mode");
$si->setOptions($options);
$si->setValue($ilSetting->get("help_mode"));
$ilToolbar->addInputItem($si);
$ilToolbar->addFormButton($lng->txt("help_set_mode"), "setMode");
}
$ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
include_once "./Services/Help/classes/class.ilHelpModuleTableGUI.php";
$tab = new ilHelpModuleTableGUI($this, "editSettings");
$this->tpl->setContent($tab->getHTML());
}
示例6: 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();
}
示例7: parse
public function parse($scoSelected, $report, $reports)
{
global $ilCtrl, $lng;
$lng->loadLanguageModule("scormtrac");
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($ilCtrl->getFormAction($this->parent_obj));
$options = array("all" => $lng->txt("all"));
$scos = $this->parent_obj->object->getTrackedItems();
foreach ($scos as $row) {
$options[$row->getId()] = $row->getTitle();
}
$si = new ilSelectInputGUI($lng->txt("chapter"), "scoSelected");
$si->setOptions($options);
$si->setValue($scoSelected);
$this->form->addItem($si);
$options = array("choose" => $lng->txt("please_choose"));
for ($i = 0; $i < count($reports); $i++) {
$options[$reports[$i]] = $lng->txt(strtolower($reports[$i]));
}
$si = new ilSelectInputGUI($lng->txt("report"), "report");
$si->setOptions($options);
$si->setValue($report);
$this->form->addItem($si);
$this->form->addCommandButton($this->parent_cmd, $lng->txt("apply_filter"));
}
示例8: getToolbar
/**
* Get toolbar
*
* @return object toolbar
*/
function getToolbar()
{
global $ilCtrl, $lng, $tpl;
// toolbar
$tb = new ilToolbarGUI();
$tb->setFormAction($ilCtrl->getFormAction($this));
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$options = array("WholePicture" => $lng->txt("cont_WholePicture"), "Rect" => $lng->txt("cont_Rect"), "Circle" => $lng->txt("cont_Circle"), "Poly" => $lng->txt("cont_Poly"));
$si = new ilSelectInputGUI($lng->txt("cont_shape"), "shape");
$si->setOptions($options);
$tb->addInputItem($si, true);
$tb->addFormButton($lng->txt("cont_add_area"), "addNewArea");
// highlight mode
/* if (strtolower(get_class($this)) == "ilimagemapeditorgui")
{
$st_item = $this->media_object->getMediaItem("Standard");
$tb->addSeparator();
$options = ilMapArea::getAllHighlightModes();
$hl = new ilSelectInputGUI($lng->txt("cont_highlight_mode"), "highlight_mode");
$hl->setOptions($options);
// $hl->setValue($st_item->getHighlightMode());
$tb->addInputItem($hl, true);
$options = ilMapArea::getAllHighlightClasses();
$hc = new ilSelectInputGUI($lng->txt("cont_highlight_class"), "highlight_class");
$hc->setOptions($options);
// $hc->setValue($st_item->getHighlightClass());
$tb->addInputItem($hc, false);
$tb->addFormButton($lng->txt("cont_set"), "setHighlight");
}*/
return $tb;
}
示例9: listTemplates
/**
* List templates
*/
function listTemplates()
{
// list pages
include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
$pages = ilWikiPage::getAllPages($this->wiki->getId());
$options = array("" => $this->lng->txt("please_select"));
foreach ($pages as $p) {
//if (!in_array($p["id"], $ipages_ids))
//{
$options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
//}
}
$this->toolbar->setFormAction($this->ctrl->getFormAction($this));
$this->toolbar->setOpenFormTag(true);
$this->toolbar->setCloseFormTag(false);
if (count($options) > 0) {
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id");
$si->setOptions($options);
$this->toolbar->addInputItem($si);
$this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add");
$this->toolbar->addSeparator();
}
// empty page as template?
include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
$cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ");
$cb->setChecked($this->wiki->getEmptyPageTemplate());
$this->toolbar->addInputItem($cb, true);
$this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings");
include_once "./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php";
$tab = new ilWikiPageTemplatesTableGUI($this, "listTemplates", $this->wiki->getId());
$tab->setOpenFormTag(false);
$tab->setCloseFormTag(true);
$this->tpl->setContent($tab->getHTML());
}
示例10: initForm
/**
* Add all fields to the form
*/
protected function initForm()
{
$this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
$this->setTitle($this->lng->txt('orgu_settings'));
$item = new ilTextInputGUI($this->lng->txt('title'), 'title');
$item->setRequired(true);
$item->setValue($this->obj_orgu->getTitle());
$this->addItem($item);
$item = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
$item->setValue($this->obj_orgu->getDescription());
$this->addItem($item);
$item = new ilFormSectionHeaderGUI();
$item->setTitle($this->lng->txt('orgu_type'));
$this->addItem($item);
$types = ilOrgUnitType::getAllTypes();
$options = array(0 => '');
/** @var ilOrgUnitType $type */
foreach ($types as $type) {
$options[$type->getId()] = $type->getTitle();
}
asort($options);
$item = new ilSelectInputGUI($this->lng->txt('orgu_type'), 'orgu_type');
$item->setOptions($options);
$item->setValue($this->obj_orgu->getOrgUnitTypeId());
$this->addItem($item);
$item = new ilFormSectionHeaderGUI();
$item->setTitle($this->lng->txt('ext_id'));
$this->addItem($item);
$item = new ilTextInputGUI($this->lng->txt('ext_id'), 'ext_id');
$item->setValue($this->obj_orgu->getImportId());
$this->addItem($item);
$this->addCommandButton('updateSettings', $this->lng->txt('save'));
}
示例11: populateNewQuestionSelectionRuleInputs
private function populateNewQuestionSelectionRuleInputs()
{
$availablePools = $this->questionSetConfig->getSelectableQuestionPools();
require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
$poolSelection = new ilSelectInputGUI(null, 'quest_pool_id');
$poolSelection->setOptions($this->buildSourcePoolSelectOptionsArray($availablePools));
$this->addInputItem($poolSelection, true);
$this->addFormButton($this->lng->txt('tst_rnd_quest_set_tb_add_pool_btn'), ilTestRandomQuestionSetConfigGUI::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM);
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:9,代码来源:class.ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI.php
示例12: build
public function build()
{
$this->setFormAction($this->ctrl->getFormAction($this->parentGUI));
$select = new ilSelectInputGUI($this->lng->txt("tst_analysis"), self::SKILL_PROFILE_PARAM);
$select->setOptions($this->buildEvaluationModeOptionsArray());
$select->setValue($this->getSelectedEvaluationMode());
$this->addInputItem($select, true);
$this->addFormButton($this->lng->txt("select"), $this->parentCMD);
}
示例13: viewToolbar
protected function viewToolbar($a_is_initial = false)
{
global $ilToolbar, $lng, $ilCtrl;
$current_figure = (int) $_POST["fig"];
$current_time_frame = (string) $_POST["tfr"];
$current_scope = (int) $_POST["scp"];
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$view = new ilSelectInputGUI($lng->txt("wiki_stat_figure"), "fig");
$view->setOptions($this->page_id ? ilWikiStat::getFigureOptionsPage() : ilWikiStat::getFigureOptions());
if ($current_figure) {
$view->setValue($current_figure);
} else {
if ($a_is_initial) {
// default
$current_figure = $this->page_id ? ilWikiStat::KEY_FIGURE_WIKI_PAGE_CHANGES : ilWikiStat::KEY_FIGURE_WIKI_NUM_PAGES;
}
}
$ilToolbar->addInputItem($view, true);
$options = array();
include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
$lng->loadLanguageModule("dateplaner");
foreach (ilWikiStat::getAvailableMonths($this->wiki_id) as $month) {
$parts = explode("-", $month);
$options[$month] = ilCalendarUtil::_numericMonthToString((int) $parts[1]) . " " . $parts[0];
}
krsort($options);
$tframe = new ilSelectInputGUI($lng->txt("month"), "tfr");
$tframe->setOptions($options);
if ($current_time_frame) {
$tframe->setValue($current_time_frame);
} else {
if ($a_is_initial) {
$current_time_frame = array_shift(array_keys($options));
// default
}
}
$ilToolbar->addInputItem($tframe, true);
$scope = new ilSelectInputGUI($lng->txt("wiki_stat_scope"), "scp");
$scope->setOptions(array(1 => "1 " . $lng->txt("month"), 2 => "2 " . $lng->txt("months"), 3 => "3 " . $lng->txt("months"), 4 => "4 " . $lng->txt("months"), 5 => "5 " . $lng->txt("months"), 6 => "6 " . $lng->txt("months")));
if ($current_scope) {
$scope->setValue($current_scope);
} else {
if ($a_is_initial) {
$current_scope = 1;
// default
}
}
$ilToolbar->addInputItem($scope, true);
$ilToolbar->setFormAction($ilCtrl->getFormAction($this, "view"));
$ilToolbar->addFormButton($lng->txt("show"), "view");
if ($current_figure && $current_time_frame && $current_scope) {
$ilToolbar->addSeparator();
$ilToolbar->addFormButton($lng->txt("export"), "export");
return array("figure" => $current_figure, "month" => $current_time_frame, "scope" => $current_scope);
}
}
示例14: build
public function build()
{
$availablePools = $this->testOBJ->getAvailableQuestionpools(true, $this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired(), false, true, true);
require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
$poolSelection = new ilSelectInputGUI(null, 'quest_pool_id');
$poolSelection->setOptions($this->buildSourcePoolSelectOptionsArray($availablePools));
$this->addInputItem($poolSelection, true);
$this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
$this->addFormButton($this->lng->txt('tst_rnd_quest_set_tb_add_pool_btn'), ilTestRandomQuestionSetConfigGUI::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM);
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:10,代码来源:class.ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI.php
示例15: getToolbar
/**
* Get toolbar
*
* @return object toolbar
*/
function getToolbar()
{
global $ilCtrl, $lng;
// toolbar
$tb = new ilToolbarGUI();
$tb->setFormAction($ilCtrl->getFormAction($this));
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$options = array("Rect" => $lng->txt("cont_Rect"), "Circle" => $lng->txt("cont_Circle"), "Poly" => $lng->txt("cont_Poly"), "Marker" => $lng->txt("cont_marker"));
$si = new ilSelectInputGUI($lng->txt("cont_trigger_area"), "shape");
$si->setOptions($options);
$tb->addInputItem($si, true);
$tb->addFormButton($lng->txt("add"), "addNewArea");
return $tb;
}