本文整理汇总了PHP中xajaxResponse类的典型用法代码示例。如果您正苦于以下问题:PHP xajaxResponse类的具体用法?PHP xajaxResponse怎么用?PHP xajaxResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了xajaxResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testForm
function testForm($formData)
{
$objResponse = new xajaxResponse();
$objResponse->alert("formData: " . print_r($formData, true));
$objResponse->assign("submittedDiv", "innerHTML", nl2br(print_r($formData, true)));
return $objResponse;
}
示例2: mostrarVentas
function mostrarVentas()
{
$objResponse = new xajaxResponse();
$controlHome = new ManejadorHome();
$recursoCompras = $controlHome->obtenerTodasLasVentas();
$resultado = '<table cellspacing="0" class="" border="1">';
$resultado .= '<thead>';
$resultado .= '<tr>';
$resultado .= '<th>FECHA</th>';
$resultado .= '<th>PRODUCTO</th>';
$resultado .= '<th>CLIENTE</th>';
$resultado .= '<th>CU</th>';
$resultado .= '<th>CANTIDAD</th>';
$resultado .= '</tr>';
$resultado .= '</thead>';
while ($rowCompras = mysql_fetch_array($recursoCompras)) {
$resultado .= '<td>' . $rowCompras[fecha] . '</td>';
$resultado .= '<td>' . $rowCompras[nombreProducto] . '</td>';
$resultado .= '<td>' . $rowCompras[nombreCliente] . '</td>';
$resultado .= '<td>' . $rowCompras[cu] . '</td>';
$resultado .= '<td>' . $rowCompras[can] . '</td>';
$resultado .= '</tr>';
}
$resultado .= '</table>';
$objResponse->addAssign("ventas", "innerHTML", $resultado);
return $objResponse;
}
示例3: confirm
function confirm($seconds)
{
sleep($seconds);
$objResponse = new xajaxResponse();
$objResponse->append('outputDIV', 'innerHTML', '<br />confirmation from theFrame.php call');
return $objResponse;
}
示例4: removeHandler
function removeHandler($sId, $sHandler)
{
$objResponse = new xajaxResponse();
$objResponse->removeHandler($sId, "click", $sHandler);
$objResponse->append('log', 'innerHTML', "{$sHandler} disabled.<br />");
return $objResponse;
}
示例5: search_sessions
function search_sessions($needle, $type)
{
global $tbl_session_rel_access_url, $tbl_session, $user_id;
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
$needle = Database::escape_string($needle);
$assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
$assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
$without_assigned_sessions = '';
if (count($assigned_sessions_id) > 0) {
$without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")";
}
if (api_is_multiple_url_enabled()) {
$sql = " SELECT s.id, s.name FROM {$tbl_session} s\n LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n WHERE s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "";
} else {
$sql = "SELECT s.id, s.name FROM {$tbl_session} s\n WHERE s.name LIKE '{$needle}%' {$without_assigned_sessions} ";
}
$rs = Database::query($sql);
$return .= '<select class="form-control" id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20">';
while ($session = Database::fetch_array($rs)) {
$return .= '<option value="' . $session['id'] . '" title="' . htmlspecialchars($session['name'], ENT_QUOTES) . '">' . $session['name'] . '</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_sessions_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例6: search_courses
function search_courses($needle, $type)
{
global $tbl_course, $tbl_course_rel_access_url, $user_id;
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$needle = Database::escape_string($needle);
$assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm);
foreach ($assigned_courses_code as &$value) {
$value = "'" . $value . "'";
}
$without_assigned_courses = '';
if (count($assigned_courses_code) > 0) {
$without_assigned_courses = " AND c.code NOT IN(" . implode(',', $assigned_courses_code) . ")";
}
if (api_is_multiple_url_enabled()) {
$sql = "SELECT c.code, c.title\n FROM {$tbl_course} c\n\t\t\t\t\tLEFT JOIN {$tbl_course_rel_access_url} a\n ON (a.c_id = c.id)\n \tWHERE\n \t\tc.code LIKE '{$needle}%' {$without_assigned_courses} AND\n \t\taccess_url_id = " . api_get_current_access_url_id();
} else {
$sql = "SELECT c.code, c.title\n \t\tFROM {$tbl_course} c\n \tWHERE\n \t\tc.code LIKE '{$needle}%'\n \t\t{$without_assigned_courses} ";
}
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
while ($course = Database::fetch_array($rs)) {
$return .= '<option value="' . $course['code'] . '" title="' . htmlspecialchars($course['title'], ENT_QUOTES) . '">' . $course['title'] . ' (' . $course['code'] . ')</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例7: 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;
}
示例8: search_courses
/**
* Search for a list of available courses by title or code, based on
* a given string
* @param string String to search for
* @param int Deprecated param
* @return string A formatted, xajax answer block
* @assert () === false
*/
function search_courses($needle, $id)
{
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
// search courses where username or firstname or lastname begins likes $needle
$sql = 'SELECT code, title FROM ' . $tbl_course . ' u ' . ' WHERE (title LIKE "' . $needle . '%" ' . ' OR code LIKE "' . $needle . '%" ' . ' ) ' . ' ORDER BY title, code ' . ' LIMIT 11';
$rs = Database::query($sql);
$i = 0;
while ($course = Database::fetch_array($rs)) {
$i++;
if ($i <= 10) {
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($course['code']) . '\',\'' . addslashes($course['title']) . ' (' . addslashes($course['code']) . ')' . '\')">' . $course['title'] . ' (' . $course['code'] . ')</a><br />';
} else {
$return .= '...<br />';
}
}
}
$xajax_response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
示例9: load_main
function load_main()
{
$objResponse = new xajaxResponse();
$text .= gen_main();
$objResponse->assign("site_wrapper", "innerHTML", $text);
return $objResponse;
}
示例10: ws_delete
function ws_delete($window_name, $form = '')
{
global $base, $include, $conf, $self, $onadb;
// Check permissions
if (!(auth('host_del') or auth('subnet_del'))) {
$response = new xajaxResponse();
$response->addScript("alert('Permission denied!');");
return $response->getXML();
}
// If an array in a string was provided, build the array and store it in $form
$form = parse_options_string($form);
// Instantiate the xajaxResponse object
$response = new xajaxResponse();
$js = '';
// Run the module
list($status, $output) = run_module('tag_del', array('tag' => $form['id'], 'commit' => 'Y'));
// If the module returned an error code display a popup warning
if ($status) {
$js .= "alert('Delete failed. " . preg_replace('/[\\s\']+/', ' ', $self['error']) . "');";
} else {
// If there's (refresh) js, send it to the browser
if ($form['js']) {
$js .= $form['js'];
}
}
// Return an XML response
$response->addScript($js);
return $response->getXML();
}
示例11: ChangeCity
/**
* Формирует список городов для выбранной страны.
*
* @param integer $country_id код страны
* @param integer $city_id код города
*/
function ChangeCity($country_id, $city_id)
{
$objResponse = new xajaxResponse();
// $countries = country::GetCountries();
$cities = city::GetCities($country_id);
$select = "<select name=\"ff_city\" id=\"ff_city\" ";
$select .= "style=\"width:254px;\">";
$select .= "<option value=\"0\"";
if ($city_id == 0) {
$select .= " selected";
}
$select .= ">Все города</option>";
if ($cities) {
foreach ($cities as $id => $city) {
$select .= "<option value=\"" . $id . "\"";
if ($id == $city_id) {
$select .= " selected";
}
$select .= ">" . $city . "</option>";
}
$select .= "</select>";
}
$objResponse->assign("city_select", "innerHTML", $select);
return $objResponse;
}
示例12: eventHandlerThree
function eventHandlerThree()
{
$objResponse = new xajaxResponse();
$objResponse->append('log', 'innerHTML', 'Message from event handler three.<br />');
$objResponse->setReturnValue('return value from event handler three.');
return $objResponse;
}
示例13: sortdata
function sortdata($table, $column, $direction)
{
global $tpl;
global $user_data;
global $getmonth;
$objResponse = new xajaxResponse();
//include('settings/template.php');
include 'settings/tables.php';
if ($user_data == '') {
require_once 'lib/functions/get_userdata.php';
}
if ($table == $tbl_goals) {
//define sort column
$goals_order = $column . " " . $direction;
include "lib/functions/fetch_goals.php";
$tpl->assign('ay_goals', $ay_goals);
//define direction DESC or ASC
if ($direction == 'DESC') {
$tpl->assign("sort_" . $column, 'ASC');
} else {
$tpl->assign("sort_" . $column, 'DESC');
}
//update template
$html = $tpl->fetch('modules/improve/goals/sort_' . $column . '.tpl');
$objResponse->assign("sortdiv_" . $column, "innerHTML", $html);
$html2 = $tpl->fetch("modules/improve/goals/goal_entries.tpl");
$objResponse->assign("goal_entries", "innerHTML", $html2);
}
return $objResponse;
}
示例14: enviar_mail
function enviar_mail($formulario)
{
$respuesta = new xajaxResponse('utf-8');
if ($formulario['nombre'] == "") {
$error = "Por favor dinos tu nombre";
} elseif ($formulario['email'] == "") {
$error = "Por favor escribe un correo electrónico para comunicarnos";
} elseif ($formulario['telefono'] == "") {
$error = "Necesitamos un número telefónico para comunicarnos";
} elseif ($formulario['mensaje'] == "") {
$error = "Cual es tu mensaje ?";
} else {
$error = "";
}
if ($error != "") {
$respuesta->addAlert("{$error}");
return $respuesta;
}
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: NuestraRed.org <correo@nuestrared.org>\r\n";
$headers .= "Reply-To: correo@nuestrared.org\r\n";
$headers .= "Return-path: correo@nuestrared.org\r\n";
$headers .= "Cc: correo@nuestrared.org" . "\r\n";
$asunto = "Mensaje de Nuestra Red ";
$cuerpo = "\n<img src='http://nuestrared.org/images/logo.png' style='width:100%'>\nGracias <strong>{$formulario['nombre']}</strong> por comunicarse con <a href='NuestraRed.org'>NuestraRed.org</a>\n<div>\n<h3>{$asunto}</h3>\n<li><strong>Nombre</strong> {$formulario['nombre']}</li>\n<li><strong>Email</strong> {$formulario['email']}</li>\n<li><strong>Teléfono</strong> {$formulario['telefono']}</li>\n<li><strong>Mensaje</strong> {$formulario['mensaje']}</li>\n</div> \n<p>Sigue en contacto con <a href='NuestraRed.org'>NuestraRed.org</a></p>\n\n";
if (mail("{$formulario['email']}", "{$asunto}", "{$cuerpo}", "{$headers}")) {
$mensaje = "{$cuerpo}";
} else {
$mensaje = "<div class='alert alert-danger'><h2>Error enviando correo </h2>";
}
$respuesta->addAssign("div_contacto", "innerHTML", "{$mensaje}");
//$respuesta->addAlert("Hola Mundo");
return $respuesta;
}
示例15: ajax_refreshCart
public function ajax_refreshCart()
{
$objResponse = new xajaxResponse();
$objResponse->clear("cart-contents", "innerHTML");
$objResponse->append("cart-contents", "innerHTML", $this->getCartTemplate());
return $objResponse;
}