本文整理汇总了PHP中rex_select::setMultiple方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_select::setMultiple方法的具体用法?PHP rex_select::setMultiple怎么用?PHP rex_select::setMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_select
的用法示例。
在下文中一共展示了rex_select::setMultiple方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function __construct($tag = '', &$table, $attributes = array())
{
global $I18N;
global $REX;
parent::rex_form_select_element('', $table, $attributes);
$dummy = null;
$this->chkbox_element = new rex_form_checkbox_element('', $dummy);
$this->chkbox_element->setAttribute('name', 'enable_restrictions');
$this->chkbox_element->setAttribute('id', 'enable_restrictions_chkbx');
$this->chkbox_element->addOption($I18N->msg('minfo_field_label_no_restrictions'), '');
if ($table->getPrefix() == 'art_' || $table->getPrefix() == 'cat_') {
$restrictionsSelect = new rex_category_select(false, false, true, false);
} elseif ($table->getPrefix() == 'med_') {
$restrictionsSelect = new rex_mediacategory_select();
} elseif ($table->getPrefix() == 'asd_') {
$restrictionsSelect = new rex_select();
$restrictionsSelect->addSqlOptions('SELECT `name`, `id` FROM ' . $REX['TABLE_PREFIX'] . 'asd_news_category');
$restrictionsSelect->setSize(6);
} else {
trigger_error('Unexpected TablePrefix "' . $table->getPrefix() . '"!', E_USER_ERROR);
exit;
}
$restrictionsSelect->setMultiple(true);
$this->setSelect($restrictionsSelect);
$this->setNotice($I18N->msg('ctrl'));
}
示例2: enterObject
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
{
$multiple = FALSE;
if (isset($this->elements[6]) && $this->elements[6] == 1) {
$multiple = TRUE;
}
$size = (int) $this->getElement(7);
if ($size < 1) {
$size = 1;
}
$SEL = new rex_select();
$SEL->setId("el_" . $this->getId());
if ($multiple) {
if ($size == 1) {
$size = 2;
}
$SEL->setName($this->getFormFieldname() . "[]");
$SEL->setSize($size);
$SEL->setMultiple(1);
} else {
$SEL->setName($this->getFormFieldname());
$SEL->setSize(1);
}
foreach (explode(',', $this->elements[3]) as $v) {
$teile = explode('=', $v);
$wert = $teile[0];
if (isset($teile[1])) {
$bezeichnung = $teile[1];
} else {
$bezeichnung = $teile[0];
}
$SEL->addOption(rex_translate($wert), $bezeichnung);
}
if (!$send && $this->value == "" && isset($this->elements[5]) && $this->elements[5] != "") {
$this->value = $this->elements[5];
}
if (!is_array($this->getValue())) {
$this->value = explode(",", $this->getValue());
}
foreach ($this->getValue() as $v) {
$SEL->setSelected($v);
}
$this->value = implode(",", $this->getValue());
$wc = "";
if (isset($warning[$this->getId()])) {
$wc = $warning[$this->getId()];
}
$SEL->setStyle(' class="select ' . $wc . '"');
$form_output[$this->getId()] = '
<p class="formselect formlabel-' . $this->getName() . '" id="' . $this->getHTMLId() . '">
<label class="select ' . $wc . '" for="el_' . $this->getId() . '" >' . rex_translate($this->getElement(2)) . '</label>' . $SEL->get() . '</p>';
$email_elements[$this->elements[1]] = $this->getValue();
if (!isset($this->elements[4]) || $this->elements[4] != "no_db") {
$sql_elements[$this->elements[1]] = $this->getValue();
}
}
示例3: enterObject
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
{
$this->label = $this->elements[1];
$multiple = FALSE;
if (isset($this->elements[6]) && $this->elements[6] == 1) {
$multiple = TRUE;
}
$SEL = new rex_select();
$SEL->setId("el_" . $this->id);
if ($multiple) {
$SEL->setName("FORM[" . $this->params["form_name"] . "][el_" . $this->id . "][]");
$SEL->setSize(5);
$SEL->setMultiple(1);
if (!is_array($this->value)) {
$this->value = array();
}
} else {
$SEL->setName("FORM[" . $this->params["form_name"] . "][el_" . $this->id . "]");
$SEL->setSize(1);
$this->value = stripslashes($this->value);
}
foreach ($this->getKeys() as $k => $v) {
$SEL->addOption($v, $k);
}
if ($this->value == "" && !$send) {
if (isset($this->elements[5])) {
$SEL->setSelected($this->elements[5]);
}
} else {
if (is_array($this->value)) {
foreach ($this->value as $val) {
$SEL->setSelected($val);
}
} else {
$SEL->setSelected($this->value);
}
}
$wc = "";
if (isset($warning["el_" . $this->getId()])) {
$wc = $warning["el_" . $this->getId()];
}
$SEL->setStyle(' class="select ' . $wc . '"');
$form_output[] = '
<p class="formselect formlabel-' . $this->label . '">
<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label>' . $SEL->get() . '
</p>';
$email_elements[$this->elements[1]] = $this->value;
if (!isset($this->elements[4]) || $this->elements[4] != "no_db") {
$sql_elements[$this->elements[1]] = $this->value;
}
}
示例4: enterObject
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
{
// ***** SELECT FESTLEGEN
$SEL = new rex_select();
$SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]');
$SEL->setId("el_" . $this->id);
$SEL->setSize(5);
$SEL->setMultiple(1);
// ***** SQL - ROHDATEN ZIEHEN
$sql = $this->elements[5];
$teams = rex_sql::factory();
$teams->debugsql = $this->params["debug"];
$teams->setQuery($sql);
for ($t = 0; $t < $teams->getRows(); $t++) {
$SEL->addOption($teams->getValue($this->elements[7]), $teams->getValue($this->elements[6]));
$teams->next();
}
$wc = "";
// if (isset($warning["el_" . $this->getId()])) $wc = $warning["el_" . $this->getId()];
$SEL->setStyle('class="multipleselect ' . $wc . '"');
// ***** EINGELOGGT ODER NICHT SETZEN
if ($send == 0) {
// erster aufruf
// Daten ziehen
if ($this->params["main_id"] > 0) {
$this->value = array();
$g = rex_sql::factory();
$g->debugsql = $this->params["debug"];
$g->setQuery('select ' . $this->elements[3] . ' from ' . $this->elements[1] . ' where ' . $this->elements[2] . '=' . $this->params["main_id"]);
$gg = $g->getArray();
if (is_array($gg)) {
foreach ($gg as $g) {
$this->value[] = $g[$this->elements[3]];
}
}
}
}
// ***** AUSWAHL SETZEN
if (is_array($this->value)) {
foreach ($this->value as $val) {
$SEL->setSelected($val);
}
}
// ***** AUSGEBEN
$form_output[] = '
<p class="formmultipleselect" id="' . $this->getHTMLId() . '">
<label class="multipleselect ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[4] . '</label>
' . $SEL->get() . '
</p>';
}
示例5: count
if ($table != rex::getTable('user') && 0 === strpos($table, rex::getTablePrefix()) && 0 !== strpos($table, rex::getTablePrefix() . rex::getTempPrefix())) {
$tableSelect->setSelected($table);
}
}
$formElements = [];
$n = [];
$n['header'] = '<div id="rex-js-exporttype-sql-div">';
$n['label'] = '<label for="rex-form-exporttables">' . rex_i18n::msg('backup_export_select_tables') . '</label>';
$n['field'] = $tableSelect->get();
$n['footer'] = '</div>';
$formElements[] = $n;
// Vorhandene Exporte auslesen
$sel_dirs = new rex_select();
$sel_dirs->setId('rex-form-exportdir');
$sel_dirs->setName('EXPDIR[]');
$sel_dirs->setMultiple();
$sel_dirs->setSelected($EXPDIR);
$sel_dirs->setStyle('class="form-control"');
$dir = rex_path::frontend();
$folders = rex_finder::factory($dir)->dirsOnly()->ignoreDirs('.*')->ignoreDirs('redaxo');
$folders = iterator_to_array($folders);
$count_folders = count($folders);
if ($count_folders > 4) {
$sel_dirs->setSize($count_folders);
}
foreach ($folders as $file) {
$file = basename($file);
$sel_dirs->addOption($file, $file);
}
$n = [];
$n['header'] = '<div id="rex-js-exporttype-files-div" style="display: none;">';
示例6: enterObject
//.........这里部分代码省略.........
<span class="rex-widget-column rex-widget-column-first">
<a href="#" class="rex-icon-file-open"
onclick="xform_manager_openDatalist(' . $this->getId() . ', \'' . $this->be_em["target_field"] . '\', \'' . $link . '\',\'' . $multiple . '\');return false;"
title="' . $I18N->msg("xform_relation_choose_entry") . '"></a>
<a href="#" class="rex-icon-file-delete"
onclick="xform_manager_deleteDatalist(' . $this->getId() . ',\'' . $multiple . '\');return false;"
title="' . $I18N->msg("xform_relation_delete_entry") . '"></a>
</span>
</p>
</div>
</div>
<div class="rex-clearer"></div>
';
}
$form_output[] = '
<p class="formpopup" id="' . $this->getHTMLId() . '">
<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->be_em["label"] . '</label>
' . $out . '
</p>';
}
// --------------------------------------- POPUP, 1-n
if ($this->be_em["relation_type"] == 4) {
$text = 'not yet implemented';
// TODO
/*
if($this->params["main_id"] < 1)
{
$text = 'Diesen Bereich können Sie erst bearbeiten, wenn der Datensatz angelegt wurde.';
}else
{
$link = 'javascript:rex_xform_openRelation('.$this->getId().',\''.$this->be_em["target_table"].'\',\'id'.
'&rex_em_filter['.$this->be_em["target_field"].']='.$this->params["main_id"].
'&rex_em_set['.$this->be_em["target_field"].']='.$this->params["main_id"].
'&page='.$this->be_em["page"].
'&subpage='.$this->be_em["subpage"].
'\');';
$text = '<a href="'.$link.'">'.
'Link'.
'</a>';
}
*/
$form_output[] = '
<p class="formhtml" id="' . $this->getHTMLId() . '">
<label class="select " for="el_' . $this->getId() . '" >' . $this->be_em["label"] . '</label>
<input type="hidden" name="FORM[' . $this->params["form_name"] . '][el_' . $this->getId() . '][]" id="REX_RELATION_' . $this->getId() . '" />
<span>' . $text . '</span>
</p>';
return;
}
// --------------------------------------- Selectbox, single or multiple
if ($this->be_em["relation_type"] < 2) {
if ($send == 1 && $this->be_em["eoption"] == 0 && count($this->getValue()) == 0) {
// Error. Fehlermeldung ausgeben
$this->params["warning"][] = $this->elements[7];
$this->params["warning_messages"][] = $this->elements[7];
$wc = $this->params["error_class"];
}
$wc = "";
if (isset($warning[$this->getId()])) {
$wc = $warning[$this->getId()];
}
// ----- SELECT BOX
$sss = rex_sql::factory();
$sss->debugsql = $this->params["debug"];
$sss->setQuery('select * from ' . $this->be_em["target_table"] . ' order by ' . $this->be_em["target_field"]);
$SEL = new rex_select();
$SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]');
$SEL->setId("el_" . $this->id);
$SEL->setStyle('class="select"');
$SEL->setDisabled($disabled);
$SEL->setSize(1);
// mit --- keine auswahl ---
if ($this->be_em["relation_type"] == 1) {
$SEL->setMultiple(TRUE);
$SEL->setSize(5);
} elseif ($this->be_em["eoption"] == 1) {
$SEL->addOption("-", "");
}
foreach ($sss->getArray() as $v) {
$s = $v[$this->be_em["target_field"]];
if (strlen($s) > 50) {
$s = substr($s, 0, 45) . ' ... ';
}
$s = $s . ' [id=' . $v["id"] . ']';
$SEL->addOption($s, $v["id"]);
}
// var_dump($this->getValue());
$SEL->setSelected($this->getValue());
$form_output[] = '
<p class="formselect" id="' . $this->getHTMLId() . '">
<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->be_em["label"] . '</label>
' . $SEL->get() . '
</p>';
}
// --------------------------------------- save
$email_elements[$this->getName()] = stripslashes(implode(",", $this->getValue()));
$sql_elements[$this->getName()] = implode(",", $this->getValue());
}
示例7: sort
// zugriff auf module
$sel_module = new rex_select();
$sel_module->setMultiple(1);
$sel_module->setStyle('class=rex-perm-fselect');
$sel_module->setSize(10);
$sel_module->setName('userperm_module[]');
$sel_module->setId('userperm_module');
$sqlmodule = new rex_sql();
$sqlmodule->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'module order by name');
for ($i = 0; $i < $sqlmodule->getRows(); $i++) {
$sel_module->addOption($sqlmodule->getValue('name'), $sqlmodule->getValue('id'));
$sqlmodule->next();
}
// extrarechte - von den addons übergeben
$sel_extra = new rex_select();
$sel_extra->setMultiple(1);
$sel_extra->setStyle('class=rex-perm-fselect');
$sel_extra->setSize(10);
$sel_extra->setName('userperm_extra[]');
$sel_extra->setId('userperm_extra');
if (isset($REX['EXTRAPERM'])) {
sort($REX['EXTRAPERM']);
$sel_extra->addArrayOptions($REX['EXTRAPERM'], false);
}
// --------------------------------- Title
rex_title($I18N->msg('title_user'), '');
// --------------------------------- FUNCTIONS
if (isset($FUNC_UPDATE) && $FUNC_UPDATE != '' || (isset($FUNC_APPLY) and $FUNC_APPLY != '')) {
$loginReset = rex_request('logintriesreset', 'int');
$userstatus = rex_request('userstatus', 'int');
$updateuser = new rex_sql();
示例8: foreach
echo $group ? ' group_' . $group : '';
?>
">
<dt>
<label class="control-label" for="<?php
echo rex_string::normalize($name, '');
?>
"><?php
echo $label;
?>
</label>
</dt>
<dd>
<?php
$newSelect = new rex_select();
$newSelect->setMultiple($this->getVar('multiple'));
$newSelect->setAttribute('class', 'form-control');
$newSelect->setId(rex_string::normalize($name, ''));
$newSelect->setSize($size);
$newSelect->setName($name);
$newSelect->setSelected($this->getVar('selected'));
if (count($options) > 0) {
foreach ($options as $key => $module) {
if (is_array($module)) {
$newSelect->addOption($module['name'], $module['id']);
} else {
$newSelect->addOption($module, $key);
}
}
}
echo $newSelect->get();
示例9: array
if (!$popup && $table["import"] == 1 && $this->hasDataPageFunction("import")) {
echo ' <a href="index.php?' . $link_vars . '&func=import"><b>o ' . $I18N->msg('import') . '</b></a>';
}
echo '</td>';
}
echo '</tr></table><br />';
}
// ----- SUCHE
if ($table["search"] == 1 && $this->hasDataPageFunction("search")) {
$list = rex_request("list", "string", "");
$start = rex_request("start", "string", "");
$sort = rex_request("sort", "string", "");
$sorttype = rex_request("sorttype", "string", "");
$addsql = "";
$search_field_select = new rex_select();
$search_field_select->setMultiple(1);
$search_field_select->setSize(5);
$search_field_select->setName("rex_xform_searchfields[]");
$search_field_select->setStyle("width:100%;");
$search_field_select->addOption('id', "id");
$field_names = array();
foreach ($fields as $field) {
if ($field["type_id"] == "value" && $field["search"] == 1) {
$search_field_select->addOption(rex_translate($field["f2"]) . ' [' . $field["f1"] . ']', $field["f1"]);
}
}
foreach ($rex_xform_searchfields as $cs) {
$search_field_select->setSelected($cs);
}
$suchform = '<table width=770 cellpadding=5 cellspacing=1 border=0 bgcolor=#ffffff class="rex-table">';
$suchform .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="poost" >';
示例10: getOutput
protected function getOutput()
{
$id = $this->getArg('id', 0, true);
if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
return false;
}
$value = $this->getContextData()->getValue('value' . $id);
if ($this->hasArg('isset') && $this->getArg('isset')) {
return $value ? 'true' : 'false';
}
if ($this->hasArg('widget') && $this->getArg('widget')) {
if (!$this->environmentIs(self::ENV_INPUT)) {
return false;
}
$select = new rex_select();
if ($this->hasArg('multiple') && $this->getArg('options')) {
$select->setName('REX_INPUT_VALUE[' . $id . '][]');
$select->setMultiple();
$select->setSelected(rex_var::toArray($value));
} else {
$select->setName('REX_INPUT_VALUE[' . $id . ']');
$select->setSelected($value);
}
if ($this->hasArg('options') && $this->getArg('options')) {
$options = $this->getArg('options');
if (rex_sql::getQueryType($options) == 'SELECT') {
$select->addSqlOptions($options);
} else {
$groups = explode('|', $options);
if (count($groups)) {
foreach ($groups as $group) {
$parseGroup = explode(':', $group);
$groupOptions = $parseGroup[0];
if (count($parseGroup) == 2) {
$select->addOptgroup($parseGroup[0]);
$groupOptions = $parseGroup[1];
}
if (rex_sql::getQueryType($groupOptions) == 'SELECT') {
$select->addSqlOptions($groupOptions);
} else {
$groupOptions = explode(',', $groupOptions);
if (count($groupOptions)) {
foreach ($groupOptions as $groupOption) {
$optionPair = explode('=', $groupOption);
if (count($optionPair) == 1) {
$select->addOption($optionPair[0], $optionPair[0]);
} elseif (count($optionPair) == 2) {
$select->addOption($optionPair[0], $optionPair[1]);
}
}
}
}
}
}
}
}
$widget = '<div class="rex-select-style">' . $select->get() . '</div>';
if ($this->hasArg('output') && $this->getArg('output')) {
$label = $this->hasArg('label') ? $this->getArg('label') : '';
$widget = Dao::getForm($widget, $label, $this->getArg('output'));
}
return self::quote($widget);
}
return self::quote(htmlspecialchars($value));
}
示例11:
$tmp->setName('SELECT[' . $id . ']');
$tmp->addOption('nein', 0);
// Beschreibung ['string'], Wert [int|'string']
$tmp->addOption('ja', 1);
$tmp->setSelected($myREX['settings']['SELECT'][$id]);
// gespeicherte Werte einsetzen
$select8 = $tmp->get();
// MULTISELECT BOX
////////////////////////////////////////////////////////////////////////////////
$id = 1;
// ID dieser MultiSelect Box
$tmp = new rex_select();
// rex_select Objekt initialisieren
$tmp->setSize(4);
// angezeigte Zeilen, Rest wird gescrollt
$tmp->setMultiple(true);
$tmp->setName('MULTISELECT[' . $id . '][]');
// abschließendes [] wichtig!
$tmp->addOption('rot', 0);
// Beschreibung ['string'], Wert [int|'string']
$tmp->addOption('grün', 1);
$tmp->addOption('blau', 'blau');
if (isset($myREX['settings']['MULTISELECT'][$id])) {
$tmp->setSelected($myREX['settings']['MULTISELECT'][$id]);
// gespeicherte Werte einsetzen
}
$multiselect = $tmp->get();
// HTML in Variable speichern
echo '
<div class="rex-addon-output">
<div class="rex-form">
示例12:
echo rex_view::error($e->getMessage());
$addonkey = '';
}
if ($addonkey && isset($addons[$addonkey])) {
$addon = $addons[$addonkey];
$file_id = rex_request('file', 'string');
if ($file_id) {
$new = $file_id == 'new';
$file = $new ? ['version' => '', 'description' => '', 'status' => 1, 'redaxo_versions' => ['5.0.x']] : $addon['files'][$file_id];
$newVersion = rex_addon::get($addonkey)->getVersion();
$redaxo_select = new rex_select();
$redaxo_select->setName('upload[redaxo][]');
$redaxo_select->setId('rex-install-packages-upload-redaxo');
$redaxo_select->setAttribute('class', 'form-control');
$redaxo_select->setSize(4);
$redaxo_select->setMultiple(true);
$redaxo_select->addOption('5.0.x', '5.0.x');
$redaxo_select->setSelected($file['redaxo_versions']);
$uploadCheckboxDisabled = '';
$hiddenField = '';
if ($new || !rex_addon::exists($addonkey)) {
$uploadCheckboxDisabled = ' disabled="disabled"';
$hiddenField = '<input type="hidden" name="upload[upload_file]" value="' . (int) $new . '" />';
}
$panel = '<fieldset>';
$formElements = [];
$n = [];
$n['label'] = '<label for="rex-js-install-packages-upload-version">' . $this->i18n('version') . '</label>';
$n['field'] = '<p class="form-control-static" id="rex-js-install-packages-upload-version">' . ($new ? $newVersion : $file['version']) . '</p>
<input type="hidden" name="upload[oldversion]" value="' . $file['version'] . '" />';
$formElements[] = $n;
示例13:
$sel_ansicht = new rex_select();
$sel_ansicht->setId('aufgaben-ansicht');
$sel_ansicht->setName('config[ansicht]');
$sel_ansicht->setSize(1);
$sel_ansicht->setAttribute('class', 'form-control');
$sel_ansicht->setSelected($this->getConfig('ansicht'));
foreach (['beide' => $this->i18n('aufgaben_settings_beide'), 'liste' => $this->i18n('aufgaben_settings_liste'), 'kanban' => $this->i18n('aufgaben_settings_kanban')] as $type => $name) {
$sel_ansicht->addOption($name, $type);
}
$n = [];
$formElements = [];
$n['label'] = '<label for="aufgaben-ansicht">' . $this->i18n('aufgaben_settings_ansicht') . '</label>';
$n['field'] = '<div class="rex-select-style">' . $sel_ansicht->get() . '</div>';
$formElements[] = $n;
$tableSelect = new rex_select();
$tableSelect->setMultiple();
$tableSelect->setId('aufgabe-mails');
$tableSelect->setName('config[mails][]');
$tableSelect->setAttribute('class', 'form-control');
// Alle E-Mail Adressen holen
$sql_mail = rex_sql::factory();
//$sql_admin->setDebug();
$sql_mail->setTable('rex_user');
$sql_mail->setWhere('email !="" AND status = 1');
$sql_mail->select();
if ($sql_mail->getRows()) {
for ($i = 0; $i < $sql_mail->getRows(); $i++) {
$tableSelect->addOption($sql_mail->getValue('email'), $sql_mail->getValue('email'));
if (in_array($sql_mail->getValue('email'), $this->getConfig('mails'))) {
$tableSelect->setSelected($sql_mail->getValue('email'));
}
示例14: enterObject
//.........这里部分代码省略.........
if ($this->params["main_id"] > 0 && $send == 0) {
$vs = rex_sql::factory();
$sss->debugsql = $this->params["debug"];
$vs->setQuery('select target_id as id from rex_' . $this->params["manager_type"] . '_relation where source_table="' . $this->be_em["source_table"] . '" and source_name="' . $this->getName() . '" and source_id="' . $this->params["main_id"] . '"');
$v = $vs->getArray();
$values = array();
if (count($v) > 0) {
foreach ($v as $w) {
$values[$w["id"]] = $w["id"];
}
}
// Fallback - wenn nichts da, dann vielleicht im Datensatz selbst.
// Nur nštig wenn man Daten aus anderen Tabellen importiert hat und
// man die Datenstruktur angleichen mšchte.
if (trim($this->getValue()) != "") {
$values = array_merge($values, explode(",", $this->getValue()));
}
// Neue Daten speichern
$this->setValue($values);
}
// ---------- Fertigsets einbauen. Sind quasi fest eingebrannte Werte
if (isset($this->params["rex_em_set"][$this->getName()])) {
$values = $this->getValue();
$values[] = $this->params["rex_em_set"][$this->getName()];
$this->setValue($values);
$disabled = TRUE;
}
// ---------- Value angleichen -> immer Array mit IDs daraus machen
if (!is_array($this->getValue())) {
if (trim($this->getValue()) == "") {
$this->setValue(array());
} else {
$this->setValue(explode(",", $this->getValue()));
}
}
// Ab hier ist Value immer Array
// Values prŸfen
$sql = 'select id,' . $this->be_em["target_field"] . ' from ' . $this->be_em["target_table"];
$value_names = array();
if (count($this->getValue()) > 0) {
$addsql = '';
foreach ($this->getValue() as $v) {
if ($addsql != "") {
$addsql .= ' OR ';
}
$addsql .= ' id=' . $v . '';
}
if ($addsql != "") {
$sql .= ' where ' . $addsql;
}
$values = array();
$vs = rex_sql::factory();
$sss->debugsql = $this->params["debug"];
$vs->setQuery($sql);
foreach ($vs->getArray() as $v) {
$value_names[$v["id"]] = $v[$this->be_em["target_field"]];
$values[] = $v["id"];
}
$this->setValue($values);
}
if ($send == 1 && $this->be_em["eoption"] == 0 && count($this->getValue()) == 0) {
// Error. Fehlermeldung ausgeben
$this->params["warning"][] = $this->elements[7];
$this->params["warning_messages"][] = $this->elements[7];
$wc = $this->params["error_class"];
}
$wc = "";
if (isset($warning["el_" . $this->getId()])) {
$wc = $warning["el_" . $this->getId()];
}
// ----- SELECT BOX
$sss = rex_sql::factory();
$sss->debugsql = $this->params["debug"];
$sss->setQuery('select * from ' . $this->be_em["target_table"] . ' order by ' . $this->be_em["target_field"]);
$SEL = new rex_select();
$SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]');
$SEL->setId("el_" . $this->id);
$SEL->setDisabled($disabled);
$SEL->setSize(1);
// mit --- keine auswahl ---
if ($this->be_em["relation_type"] == 1) {
$SEL->setMultiple(TRUE);
$SEL->setSize(5);
} elseif ($this->be_em["eoption"] == 1) {
$SEL->addOption("-", "");
}
foreach ($sss->getArray() as $v) {
$SEL->addOption($v[$this->be_em["target_field"]], $v["id"]);
}
// var_dump($this->getValue());
$SEL->setSelected($this->getValue());
$form_output[] = '
<p class="formselect">
<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->be_em["label"] . '</label>
' . $SEL->get() . '
</p>';
$email_elements[$this->getName()] = stripslashes(implode(",", $this->getValue()));
$sql_elements[$this->getName()] = implode(",", $this->getValue());
return;
}
示例15:
$content .= '
</fieldset>';
/* whitelist */
$content .= '
<fieldset>
<legend>' . $this->i18n('config_whitelist') . '</legend>';
$formElements = [];
$n = [];
$n['label'] = '<label for="emailobfuscator-config-articles">' . $this->i18n('config_articles') . '</label>';
$n['field'] = rex_var_linklist::getWidget(1, 'config[articles]', $this->getConfig('articles'));
$formElements[] = $n;
$n = [];
$n['label'] = '<label for="emailobfuscator-config-templates">' . $this->i18n('config_templates') . '</label>';
$select = new rex_select();
$select->setId('emailobfuscator-config-templates');
$select->setMultiple();
$select->setSize(10);
$select->setAttribute('class', 'form-control');
$select->setName('config[templates][]');
$select->addSqlOptions('SELECT `name`, `id` FROM `' . rex::getTablePrefix() . 'template` ORDER BY `name` ASC');
$select->setSelected($this->getConfig('templates'));
$n['field'] = $select->get();
$formElements[] = $n;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$content .= $fragment->parse('core/form/form.php');
$content .= '
</fieldset>';
/* buttons */
$formElements = [];
$n = [];