本文整理汇总了PHP中xajaxResponse::script方法的典型用法代码示例。如果您正苦于以下问题:PHP xajaxResponse::script方法的具体用法?PHP xajaxResponse::script怎么用?PHP xajaxResponse::script使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xajaxResponse
的用法示例。
在下文中一共展示了xajaxResponse::script方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RFGetCitysByCid
/**
* Возвращает select со списком городов указанной страны в для фильтра регионов в каталоге фрилансеров.
*
* @param int $country название страны транслит
* @param array $attr опционально. атрибуты select например: array('name'=>'pf_city', 'class'=>'flt-p-sel',...);
*
* @return unknown
*/
function RFGetCitysByCid($country, $attr = array())
{
$objResponse = new xajaxResponse();
if (!$attr) {
$attr = array('name' => 'pf_city', 'class' => 'b-select__select');
}
$sAttr = '';
foreach ($attr as $key => $val) {
$sAttr .= ' ' . $key . '="' . $val . '"';
}
if ($country) {
$cities = city::GetCities(country::getCountryIDByTranslit($country));
}
$objResponse->script('$("b-select__city").set("html","");');
$objResponse->script('new Element("option", { value: "0", text: "Все города" }).inject($("b-select__city"));');
$js = '';
if ($cities) {
foreach ($cities as $cityid => $city) {
$js .= 'new Element("option", { value: "' . translit(strtolower($city)) . '", text: "' . $city . '" }).inject($("b-select__city"));' . "\n";
}
}
if ($js) {
$objResponse->script($js);
}
return $objResponse;
}
示例2: ajaxpreview
function ajaxpreview($params)
{
global $gCms;
$urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
$config =& $gCms->GetConfig();
$contentops =& $gCms->GetContentOperations();
$content_type = $params['content_type'];
$contentops->LoadContentType($content_type);
$contentobj = UnserializeObject($params["serialized_content"]);
if (strtolower(get_class($contentobj)) != strtolower($content_type)) {
copycontentobj($contentobj, $content_type, $params);
}
updatecontentobj($contentobj, true, $params);
$tmpfname = createtmpfname($contentobj);
// str_replace is because of stupid windows machines.... when will they die.
$_SESSION['cms_preview'] = str_replace('\\', '/', $tmpfname);
$tmpvar = substr(str_shuffle(md5($tmpfname)), -3);
$url = $config["root_url"] . '/index.php?' . $config['query_var'] . "=__CMS_PREVIEW_PAGE__&r={$tmpvar}";
// temporary
$objResponse = new xajaxResponse();
$objResponse->assign("previewframe", "src", $url);
$objResponse->assign("serialized_content", "value", SerializeObject($contentobj));
$count = 0;
foreach ($contentobj->TabNames() as $tabname) {
$objResponse->script("Element.removeClassName('editab" . $count . "', 'active');Element.removeClassName('editab" . $count . "_c', 'active');\$('editab" . $count . "_c').style.display = 'none';");
$count++;
}
$objResponse->script("Element.addClassName('edittabpreview', 'active');Element.addClassName('edittabpreview_c', 'active');\$('edittabpreview_c').style.display = '';");
return $objResponse;
}
示例3: reguser
function reguser($form)
{
global $db, $tablepre, $onlineip;
$obj = new xajaxResponse();
$usernamereg = '/^\\s*$|^c:\\con\\con$|[%,\\*\\"\\s\\t\\<\\>\\&]|\\xA1\\xA1|\\xAC\\xA3|^guest|^\\xD3\\xCE\\xBF\\xCD|\\xB9\\x43\\xAB\\xC8/i';
$emailreg = '/^(([^<>()[\\]\\.,;:\\s@"\']+(\\.[^<>()[\\]\\.,;:\\s@"\']+)*)|("[^"\']+"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-zA-Z\\d\\-]+\\.)+[a-zA-Z]{2,}))$/';
$username = addslashes(trim($form['username']));
$password = trim($form['password']);
$email = trim($form['email']);
if (empty($username) || preg_match($usernamereg, $username) || strlen($username) < 3 || strlen($username) > 15 || preg_match("~/|\\|\\'|\"~", $password) || strlen($password) < 6 || strlen($password) > 20 || !preg_match($emailreg, $email)) {
return $obj->redirect(WEB_URL);
}
$sql = "SELECT * FROM `{$tablepre}members` where username='{$name}' or (regip='{$onlineip}' AND DATE(regdate)=CURDATE())";
$query = $db->query($sql) or error('Unable to fetch member.', __FILE__, __LINE__, $db->error());
if ($db->num_rows($query)) {
return $obj->script("\$('chk_stat').className = d_err;\$('chk_stat').setHTML('此ID已被注册或者您今天已经注册过会员,请勿多次提交申请。');\$('regbotton').disabled = 'disabled';");
}
$sql = "INSERT INTO `{$tablepre}members` (username,password,email,regdate,regip) VALUES ('{$username}',MD5('{$password}'),'{$email}',now(),'{$onlineip}')";
$db->query($sql) or error('Unable to insert into member.', __FILE__, __LINE__, $db->error());
$uid = $db->insert_id();
$db->query("INSERT INTO `{$tablepre}box` (uid,time) VALUES ('{$uid}',now())") or error('Unable to insert into box.', __FILE__, __LINE__, $db->error());
$db->query("INSERT INTO `{$tablepre}memberdata` (uid,username,lastloginip,lastvisit) VALUES ('{$uid}','{$username}','{$onlineip}',UNIX_TIMESTAMP())");
$obj->script("\$('regbotton').disabled = 'disabled';alert('注册成功!');");
return $obj;
}
示例4: move_to
function move_to($pos)
{
global $maxseq;
$response = new xajaxResponse();
if ($pos > $maxseq) {
$response->script("alert(\"{$pos} is out of range!\")");
return $response;
}
$_SESSION['testpos'] = $pos;
$response->script("document.location.reload()");
return $response;
}
示例5: getPromoFeedbacks
/**
* возвращает отзывы сервису в промоблок Безопасной Сделки.
*/
function getPromoFeedbacks()
{
$objResponse = new xajaxResponse();
$feedbacksFromFrl = sbr_meta::getServiceFeedbacksFromFrl();
$feedbacksFromEmp = sbr_meta::getServiceFeedbacksFromEmp();
ob_start();
include $_SERVER['DOCUMENT_ROOT'] . '/promo/sbr/new/tpl.feedbacks.php';
$html = ob_get_clean();
$objResponse->assign('promo-feedbacks', 'innerHTML', $html);
$objResponse->script('PromoSBR.newFeedbacksLoaded()');
$objResponse->script("JSScroll(\$('promo-feedbacks'), true)");
return $objResponse;
}
示例6: AddUser
function AddUser($login)
{
$objResponse = new xajaxResponse();
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
$user = new users();
$user->GetUser($login);
if ($user->login && !is_emp($user->role) && !$user->is_banned && $user->active == 't') {
$inner = "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n<tr>\n\t<td width=\"60\">" . view_avatar($user->login, $user->photo) . "</td>\n\t<td valign=\"top\"><a href=\"/users/" . $user->login . "\" class=\"frlname11\" title=\"" . $user->uname . " " . $user->usurname . "\">" . $user->uname . " " . $user->usurname . " [" . $user->login . "]" . "</a> \n\t<a href=\"javascript:reload_form();\" class=\"blue\">изменить</a></td>\n</tr>\n</table>";
$objResponse->assign("usersel", "innerHTML", $inner);
$objResponse->script("document.getElementById('next').disabled = false;document.getElementById('login').value = '" . $login . "';");
} else {
$objResponse->script("reload_form();\n\t\t document.getElementById('usersel').innerHTML = document.getElementById('usersel').innerHTML + '" . ref_scr(view_error("Такого фрилансера не существует")) . "';\n\t\t document.getElementById('elogin').value = '" . $login . "';");
}
return $objResponse;
}
示例7: logout
function logout()
{
$objResponse = new xajaxResponse();
session_destroy();
$objResponse->script("location.reload();");
return $objResponse;
}
示例8: dojob
function dojob($job, $arg1, $continue, $completedCount, $failureCount)
{
$this->_job = $job;
$this->_args = array($arg1);
$objResponse = new xajaxResponse();
if (!is_numeric($completedCount)) {
$completedCount = 0;
}
$this->_completed = $completedCount;
$this->_failures = $failureCount;
if ($continue !== 'false') {
/**
* This method will set processed, remaining, failures, but subclass
* can also override calculateProgress
*/
$this->__executeJob();
$this->calculateProgress();
if ($this->_processed == 0 && $this->_failures > 0) {
$objResponse->assign("messageText", "className", "error");
$objResponse->assign("progressSpinner", "className", "hidden");
$objResponse->assign("messageText", "innerHTML", "Job Failure (Completed: " . $this->_completed . ", Failures: " . $this->_failures . ")");
} else {
$percentage = 0;
if ($this->_remaining > 0) {
if ($this->_completed > 0) {
$percentage = floor($this->_completed / ($this->_totalItems / 100));
}
} else {
$percentage = 100;
}
$level = 0;
if ($percentage > 0) {
$level = floor($percentage / 10);
}
if ($level > 0) {
$rsimage = theme_image_src('rs.gif');
for ($i = 0; $i <= $level; $i++) {
$objResponse->assign("status{$i}", "src", $rsimage);
}
}
$objResponse->assign("percentage", "innerHTML", "{$percentage}%");
if ($this->_remaining > 0) {
$objResponse->assign("messageText", "innerHTML", "Completed " . $this->_completed . " of " . $this->_totalItems . " (Failures: " . $this->_failures . ")");
$objResponse->assign("progressSpinner", "className", "");
// todo - how to get waitCursor to start again.
$objResponse->script("xajax_" . $this->_id . ".dojob('{$job}', '{$arg1}', document.forms['progressForm']['continue'].value, '{$this->_completed}', '" . $this->_failures . "');");
} else {
$objResponse->assign("messageText", "innerHTML", "Job Complete (Completed: " . $this->_completed . ", Failures: " . $this->_failures . ")");
$objResponse->assign("progressSpinner", "className", "hidden");
}
}
} else {
$objResponse->assign("messageText", "innerHTML", "Job Aborted (Completed: " . $this->_completed . ", Failures: " . $this->_failures . ")");
$objResponse->assign("progressSpinner", "className", "hidden");
}
if (strlen($this->_debug) > 0) {
$objResponse->assign("debug", "innerHTML", $this->_debug);
}
return $objResponse;
}
示例9: login
function login($user, $pass)
{
$objResponse = new xajaxResponse();
$success = false;
//$user = mysql_real_escape_string($user);
//$pass = mysql_real_escape_string($pass);
global $dba;
$sql = "SELECT * FROM sysuser WHERE user = '" . $user . "' AND pass = '" . $pass . "'";
$stmt = $dba->query($sql);
if ($stmt) {
if ($stmt->rowCount() > 0) {
$success = true;
}
if ($success) {
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$_SESSION['user']['id'] = $row['id'];
$_SESSION['user']['name'] = $row['name'];
$_SESSION['user']['username'] = $row['user'];
$_SESSION['user']['admin'] = $row['admin'];
}
$objResponse->call('xajax_load_main');
$objResponse->call('xajax_do_reload_shift');
} else {
$objResponse->call('xajax_show_alert', 'danger', 'Ups!', 'Forkert brugernavn eller adgangskode');
}
} else {
$objResponse->script('swal("FEJL 1000", "Der skete sku en fejl.. Beboeren blev ikke indskrevet :( Kontakt en administrator", "error")');
}
return $objResponse;
}
示例10: modifyValue
function modifyValue()
{
$objResponse = new xajaxResponse();
$objResponse->script('if (undefined == this.value) this.value = 1; else this.value += 1;');
$objResponse->call('this.logValue');
return $objResponse;
}
示例11: quickPRJGetYandexKassaLink
function quickPRJGetYandexKassaLink($payment)
{
$objResponse = new xajaxResponse();
$bill = new billing(get_uid(false));
$billReserveId = $bill->checkoutOrder();
$sum = $bill->getRealPayedSum();
$payed_sum = $bill->getOrderPayedSum();
if ($sum > 0) {
$_SESSION['quickprj_is_begin'] = 1;
$yandex_kassa = new yandex_kassa();
$html_form = $yandex_kassa->render($sum, $bill->account->id, $payment, $billReserveId);
$objResponse->script('$("quick_pro_div_wait_txt").set("html", \'' . $html_form . '\');');
$objResponse->script("\$('quick_pro_div_wait_txt').getElements('form')[0].submit();");
}
return $objResponse;
}
示例12: SaveStatus
function SaveStatus($text, $statusType, $login = NULL)
{
session_start();
$freelancer = new freelancer();
$text = addslashes(substr(stripslashes(trim($text)), 0, 200));
close_tags($text, 's');
$freelancer->status_text = antispam(htmlspecialchars(htmlspecialchars_decode(change_q_x(trim($text), true, false), ENT_QUOTES), ENT_QUOTES));
$freelancer->status_type = intval($statusType);
if ($freelancer->statusToStr($statusType)) {
$stdStatus = "";
$objResponse = new xajaxResponse();
$uid = hasPermissions('users') && $login != $_SESSION['login'] ? $freelancer->GetUid($err, $login) : get_uid(false);
$pro = hasPermissions('users') && $login != $_SESSION['login'] ? is_pro(true, $uid) : is_pro();
$error = $freelancer->Update($uid, $res);
if (!$freelancer->status_text) {
$freelancer->status_text = $stdStatus;
}
$freelancer->status_text = stripslashes($freelancer->status_text);
switch ($freelancer->status_type) {
case 1:
$status_cls = 'b-status b-status_busy';
break;
case 2:
$status_cls = 'b-status b-status_abs';
break;
case -1:
$status_cls = 'b-status b-status_no';
break;
default:
$status_cls = 'b-status b-status_free';
}
if (!$noassign) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
$stop_words = new stop_words(hasPermissions('users'));
$sStatusText = $pro ? $freelancer->status_text : $stop_words->replace($freelancer->status_text);
//$GLOBALS['xajax']->setCharEncoding("windows-1251");
$jsobj = json_encode(array('data' => iconv('CP1251', 'UTF8', $freelancer->status_text)));
$objResponse->assign("statusText", "innerHTML", $freelancer->status_text == $stdStatus ? "" : reformat($sStatusText, 40, 0, 1, 25));
$objResponse->assign("statusTitle", "innerHTML", $freelancer->statusToStr($statusType));
// $objResponse->assign("statusTitle", "style.display", $statusType > -1 ? '' : 'none');
$objResponse->script("statusType = {$statusType};\n\t\t\t statusTxt = document.getElementById('statusText').innerHTML;\n\t\t\t statusTxtSrc = {$jsobj};");
}
$objResponse->script("\$('bstatus').erase('class');\n \$('bstatus').addClass('{$status_cls}');");
}
return $objResponse;
}
示例13: disminuirVisitas
function disminuirVisitas($source, $event, $formData)
{
global $GSPAnel;
$objResponse = new xajaxResponse();
$task = newObject("example", $formData["ID"]);
if ($task->ID < 2) {
$objResponse->script("alert('Selecciona un ejemplo primero')");
} else {
$valorvisitas = $task->visita - 1;
$task->visita = $valorvisitas;
$task->save();
$objResponse->script("alert('Visitas: {$task->visita}')");
$objResponse->script("tableGrid_{$GSPAnel->dGrid->id}.refresh()");
$objResponse->script("xajax_wForm.requestloadFromId({$task->ID},'{$GSPAnel->aForms[0]->id}','example')");
}
return $objResponse;
}
示例14: setnodeblockade
function setnodeblockade($idek)
{
global $DB, $LMS;
$obj = new xajaxResponse();
$tmp = $DB->GetOne('SELECT blockade FROM nodes WHERE id = ? LIMIT 1 ;',array($idek));
$tmp = intval($tmp);
if ($tmp == 1) $tmp = 0 ; else $tmp = 1;
$LMS->SetNode(array('action'=>'blockade','type'=>'node','id'=>$idek,'set'=>$tmp));
if ($tmp == 0) {
$obj->script("document.getElementById('src_blockade".$idek."').src='img/padlockoff.png';");
} else {
$obj->script("document.getElementById('src_blockade".$idek."').src='img/padlock.png';");
}
return $obj;
}
示例15: close_shift
function close_shift()
{
$objResponse = new xajaxResponse();
if ($_SESSION['shift']['id'] != 0) {
$sql = "CALL shift_close(" . $_SESSION['shift']['id'] . ", " . $_SESSION['user']['id'] . ")";
global $dba;
$stmt = $dba->query($sql);
if ($stmt) {
$objResponse->call('xajax_show_alert', 'success', 'Yay!', 'Vagten blev afsluttet');
} else {
$objResponse->script('swal("Hov!", "Der skete en fejl. Vagten blev ikke afsluttet :(", "error")');
}
$objResponse->call('xajax_do_reload_shift');
} else {
$objResponse->script('swal("what?", "Der er ingen vagt started... fejl måske?", "error")');
}
return $objResponse;
}