本文整理汇总了PHP中rex_select::addSqlOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_select::addSqlOptions方法的具体用法?PHP rex_select::addSqlOptions怎么用?PHP rex_select::addSqlOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_select
的用法示例。
在下文中一共展示了rex_select::addSqlOptions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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));
}
示例3:
echo $mediaCatSelect->get();
?>
</p>
</div>
<div class="rex-form-row">
<p class="rex-form-col-a rex-form-select">
<label for="default_job_category_id"><?php
echo $I18N->msg('d2u_stellenmarkt_hr4you_sync_settings_default_job_category_id');
?>
</label>
<?php
$contactIdSelect = new rex_select();
$contactIdSelect->setSize(1);
$contactIdSelect->setName('settings[default_job_category_id]');
$contactIdSelect->addSqlOptions("SELECT interne_bezeichnung, kategorie_id FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_kategorien`");
$contactIdSelect->setSelected($REX['ADDON']['hr4you_sync']['settings']['default_job_category_id']);
echo $contactIdSelect->get();
?>
</p>
</div>
<div class="rex-form-row rex-form-element-v1">
<p class="rex-form-submit">
<input type="submit" class="rex-form-submit" name="sendit" value="<?php
echo $I18N->msg('d2u_stellenmarkt_hr4you_sync_settings_save');
?>
" />
</p>
</div>
</div>
示例4:
echo $ortIdSelect->get();
?>
</p>
</div>
<div class="rex-form-row">
<p class="rex-form-col-a rex-form-select">
<label for="default_zielgruppe_id"><?php
echo $I18N->msg('d2u_kurse_kufer_import_settings_default_zielgruppe_id');
?>
</label>
<?php
$zielgruppeIdSelect = new rex_select();
$zielgruppeIdSelect->setSize(1);
$zielgruppeIdSelect->setName('settings[default_zielgruppe_id]');
$zielgruppeIdSelect->addSqlOptions('SELECT name, zielgruppe_id FROM ' . $REX['TABLE_PREFIX'] . 'd2u_kurse_zielgruppen ORDER BY name');
$zielgruppeIdSelect->setSelected($REX['ADDON']['kufer_import']['settings']['default_zielgruppe_id']);
echo $zielgruppeIdSelect->get();
?>
</p>
</div>
<div class="rex-form-row rex-form-element-v1">
<p class="rex-form-submit">
<input type="submit" class="rex-form-submit" name="sendit" value="<?php
echo $I18N->msg('d2u_kurse_kufer_import_settings_save');
?>
" />
</p>
</div>
</div>
示例5:
<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 = [];
$n['field'] = '<a class="btn btn-abort" href="' . rex_url::currentBackendPage() . '">' . rex_i18n::msg('form_abort') . '</a>';
$formElements[] = $n;
$n = [];
$n['field'] = '<button class="btn btn-apply rex-form-aligned" type="submit" name="send" value="1"' . rex::getAccesskey(rex_i18n::msg('update'), 'apply') . '>' . rex_i18n::msg('update') . '</button>';