本文整理汇总了PHP中xajaxResponse::setEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP xajaxResponse::setEvent方法的具体用法?PHP xajaxResponse::setEvent怎么用?PHP xajaxResponse::setEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xajaxResponse
的用法示例。
在下文中一共展示了xajaxResponse::setEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: XAJAX_changeList
function XAJAX_changeList($select)
{
$objResponse = new xajaxResponse();
if ($select == 'Normal') {
$auswahl = array('u0' => 'an alle User');
$erg = db_query("SELECT `name`,`id` FROM `prefix_groups` ORDER BY `id`");
while ($RRrow = db_fetch_object($erg)) {
$auswahl['g' . $RRrow->id] = $RRrow->name;
}
$listeB = '';
$listeT = '';
foreach ($auswahl as $k => $v) {
if (strpos($k, 'u') !== false) {
$listeB .= '<option value="P' . $k . '">' . $v . ' PrivMsg</option>' . "\n";
$listeB .= '<option value="E' . $k . '">' . $v . ' eMail</option>' . "\n";
} elseif (strpos($k, 'g') !== false) {
$listeT .= '<option value="P' . $k . '">' . $v . ' PrivMsg</option>' . "\n";
$listeT .= '<option value="E' . $k . '">' . $v . ' eMail</option>' . "\n";
}
}
$content = <<<END
<select id="nl_auswahl" name="auswahl">
<option value="Enews" selected="selected">eMail Newsletter</option>
<optgroup label="Benutzer">
{$listeB}
</optgroup>
<optgroup label="Gruppen">
{$listeT}
</optgroup>
\t\t</select>
END;
$objResponse->assign('cb_html_cont', 'style.display', '');
} else {
$erg = db_query("SELECT * FROM `prefix_grundrechte` ORDER BY `id` ASC");
$listeG = '';
while ($row = db_fetch_assoc($erg)) {
$listeG .= '<optgroup label="' . $row['name'] . '">';
$listeG .= '<option value="Pr' . $row['id'] . '"> PrivMsg</option>';
$listeG .= '<option value="Er' . $row['id'] . '"> eMail</option>';
$listeG .= '</optgroup>';
}
$content = <<<END
<select name="auswahl" id="nl_auswahl">
<option selected="selected" disabled="disabled">Bitte treffen Sie eine Auswahl</option>
{$listeG}
</select>
\t\t\t<input type="checkbox" name="andhigher" id="cb_andhigher" value="1" />
\t\t\t<label for="cb_andhigher">und für alle höheren Rechte</label>
END;
}
$objResponse->assign('list', 'innerHTML', $content);
$objResponse->setEvent('nl_auswahl', 'onchange', 'checkEmail();');
return $objResponse;
}
示例2: save_model
function save_model($forms)
{
global $DB;
$obj = new xajaxResponse();
$form = $forms['modeledit'];
$formid = intval($form['id']);
$pid = intval($form['pid']);
$error = false;
$obj->script("removeClass(xajax.\$('id_model_name'),'alert');");
if (empty($form['name'])) {
$error = true;
$obj->setEvent("id_model_name", "onmouseover", "popup('<span class=\\\"red bold\\\">" . trans("Model name is required!") . "</span>')");
}
if (!$error) {
if (!$form['id']) {
$error = $DB->GetOne('SELECT COUNT(*) FROM netdevicemodels WHERE netdeviceproducerid = ? AND UPPER(name) = ? ', array($pid, strtoupper($form['name']))) ? true : false;
} else {
$error = $DB->GetOne('SELECT COUNT(*) FROM netdevicemodels WHERE id <> ? AND netdeviceproducerid = ? AND UPPER(name) = ?', array($formid, $pid, strtoupper($form['name']))) ? true : false;
}
if ($error) {
$obj->setEvent("id_model_name", "onmouseover", "popup('<span class=\\\"red bold\\\">" . trans("Model already exists!") . "</span>')");
}
}
if ($error) {
$obj->script("addClass(xajax.\$('id_model_name'),'alert');");
$obj->script("xajax.\$('id_model_name').focus();");
} else {
if ($formid) {
$DB->Execute('UPDATE netdevicemodels SET name = ?, alternative_name = ? WHERE id = ?', array($form['name'], $form['alternative_name'] ? $form['alternative_name'] : NULL, $formid));
$obj->script("xajax_cancel_model();");
$obj->script("self.location.href='?m=netdevmodels&page=1&p_id={$pid}';");
} else {
$DB->Execute('INSERT INTO netdevicemodels (netdeviceproducerid, name, alternative_name) VALUES (?, ?, ?)', array($pid, $form['name'], $form['alternative_name'] ? $form['alternative_name'] : NULL));
$obj->script("xajax_cancel_model();");
$obj->script("self.location.href='?m=netdevmodels&page=1&p_id={$pid}';");
}
}
return $obj;
}