本文整理汇总了PHP中rex_select::setDisabled方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_select::setDisabled方法的具体用法?PHP rex_select::setDisabled怎么用?PHP rex_select::setDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_select
的用法示例。
在下文中一共展示了rex_select::setDisabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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() == global_settings_metainfo::PREFIX) {
$restrictionsSelect = new rex_select();
$restrictionsSelect->setSize(1);
$restrictionsSelect->setDisabled(true);
} else {
trigger_error('Unexpected TablePrefix "' . $table->getPrefix() . '"!', E_USER_ERROR);
exit;
}
$restrictionsSelect->setMultiple(true);
$this->setSelect($restrictionsSelect);
$this->setNotice($I18N->msg('ctrl'));
}
示例2: 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());
}
示例3: 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;
}
示例4: rex_version_header
function rex_version_header($params)
{
global $REX, $I18N;
$return = "";
$rex_version_article = $REX['LOGIN']->getSessionVar("rex_version_article");
if (!is_array($rex_version_article)) {
$rex_version_article = array();
}
$working_version_empty = TRUE;
$gw = rex_sql::factory();
$gw->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'article_slice where article_id=' . $params['article_id'] . ' and clang=' . $params['clang'] . ' and revision=1 LIMIT 1');
if ($gw->getRows() > 0) {
$working_version_empty = FALSE;
}
$revisions = array();
$revisions[0] = $I18N->msg("version_liveversion");
$revisions[1] = $I18N->msg("version_workingversion");
$version_id = rex_request("rex_set_version", "int", "-1");
if ($version_id === 0) {
$rex_version_article[$params['article_id']] = 0;
} elseif ($version_id == 1) {
$rex_version_article[$params['article_id']] = 1;
} elseif (!isset($rex_version_article[$params['article_id']])) {
$rex_version_article[$params['article_id']] = 1;
}
$func = rex_request("rex_version_func", "string");
switch ($func) {
case "copy_work_to_live":
if ($working_version_empty) {
$return .= rex_warning($I18N->msg("version_warning_working_version_to_live"));
} else {
if (!$REX['USER']->hasPerm('version[only_working_version]')) {
require $REX['INCLUDE_PATH'] . '/addons/version/functions/function_rex_copyrevisioncontent.inc.php';
// rex_copyRevisionContent($article_id,$clang,$from_revision_id, $to_revision_id, $gc->getValue("id"),$delete_to_revision);
rex_copyRevisionContent($params['article_id'], $params['clang'], 1, 0, 0, TRUE);
$return .= rex_info($I18N->msg("version_info_working_version_to_live"));
}
}
break;
case "copy_live_to_work":
require $REX['INCLUDE_PATH'] . '/addons/version/functions/function_rex_copyrevisioncontent.inc.php';
// rex_copyRevisionContent($article_id,$clang,$from_revision_id, $to_revision_id, $gc->getValue("id"),$delete_to_revision);
rex_copyRevisionContent($params['article_id'], $params['clang'], 0, 1, 0, TRUE);
$return .= rex_info($I18N->msg("version_info_live_version_to_working"));
break;
}
if ($REX['USER']->hasPerm('version[only_working_version]')) {
$rex_version_article[$params['article_id']] = 1;
unset($revisions[0]);
}
$REX['LOGIN']->setSessionVar("rex_version_article", $rex_version_article);
$link = 'index.php?page=' . $params['page'] . '&article_id=' . $params['article_id'] . '&clang=' . $params['clang'];
$return .= '
<div id="rex-version-header" class="rex-toolbar rex-toolbar-has-form rex-version-revision-' . $rex_version_article[$params['article_id']] . '">
<div class="rex-toolbar-content rex-version-header">
<form action="index.php" method="post">
<fieldset>
<input type="hidden" name="page" value="' . $params['page'] . '" />
<input type="hidden" name="mode" value="' . $params['mode'] . '" />
<input type="hidden" name="article_id" value="' . $params['article_id'] . '" />
<input type="hidden" name="clang" value="' . $params['clang'] . '" />
<input type="hidden" name="ctype" value="' . $params['ctype'] . '" />
';
$s = new rex_select();
foreach ($revisions as $k => $r) {
$s->addOption($r, $k);
}
$s->setSelected($rex_version_article[$params['article_id']]);
$s->setName('rex_set_version');
$s->setId('rex-select-version-id');
$s->setSize('1');
$s->setAttribute('onchange', 'this.form.submit();');
if ($REX['USER']->hasPerm('version[only_working_version]')) {
$s->setDisabled();
}
$return .= '<ul class="rex-display-inline">';
$return .= '<li class="rex-navi-first"><label for="rex-select-version-id">' . $I18N->msg('version') . ':</label> ' . $s->get() . '</li>';
if ($REX['USER']->hasPerm('version[only_working_version]')) {
if ($rex_version_article[$params['article_id']] > 0) {
$return .= '<li><a href="' . $link . '&rex_version_func=copy_live_to_work">' . $I18N->msg('version_copy_from_liveversion') . '</a></li>';
$return .= '<li><a href="/' . rex_getUrl($params['article_id'], $params['clang'], array("rex_version" => 1)) . '" target="_blank">' . $I18N->msg("version_preview") . '</a></li>';
}
} else {
if ($rex_version_article[$params['article_id']] > 0) {
if (!$working_version_empty) {
$return .= '<li><a href="' . $link . '&rex_version_func=copy_work_to_live">' . $I18N->msg('version_working_to_live') . '</a></li>';
}
$return .= '<li><a href="../' . rex_getUrl($params['article_id'], $params['clang'], array("rex_version" => 1)) . '" target="_blank">' . $I18N->msg("version_preview") . '</a></li>';
} else {
$return .= '<li><a href="' . $link . '&rex_version_func=copy_live_to_work" onclick="return confirm(\'' . $I18N->msg('version_confirm_copy_live_to_workingversion') . '\');">' . $I18N->msg('version_copy_live_to_workingversion') . '</a></li>';
}
}
$return .= '</ul>';
$return .= '
<noscript>
<input type="submit" />
</noscript>
</fieldset>
//.........这里部分代码省略.........