<?php require_once 'modelo_Sql.php'; $data = json_decode(file_get_contents('php://input'), true); if ($data["op"] == 'inventario') { return Invetario(); } if ($data["op"] == 'Producto') { return Producto($data['_id']); } if ($data['op'] == 'complete') { return autoComplete($data['nombre']); } function Invetario() { $res = array(); $mdl = new Modelo(); $rs = $mdl->query("SELECT * FROM inventario"); $i = 0; while ($row = $rs->fetchArray()) { $res[$i] = array('_id' => $row['_id'], 'Serie' => $row['Serie'], 'Nombre' => $row['Nombre'], 'Cantidad' => $row['Cantidad'], 'Costo' => $row['Costo'], 'Precio' => $row['Precio']); $i++; } print_r(json_encode($res)); } function Producto($id) { $res = array(); $mdl = new Modelo(); $rs = $mdl->query("SELECT * FROM inventario WHERE _id = '{$id}'"); $i = 0;
$oCookie = new Cookie(); $langueAffichage = $oCookie->getLangue(); // Mettre ici le code de gestion de la requête AJAX switch ($_GET['rAjax']) { //requête case 'googleMap': googleMap(); break; case 'googleMapTrajet': googleMapTrajet($lat, $lng); break; case 'visiteOeuvres': visiteOeuvres(); break; case 'autoComplete': autoComplete(); break; case 'afficherSelectRecherche': afficherSelectRecherche(); break; case 'afficherBoutonRecherche': afficherBoutonRecherche(); break; case 'afficherSelectRechercheMobile': afficherSelectRechercheMobile(); break; case 'afficherBoutonRechercheMobile': afficherBoutonRechercheMobile(); break; case 'ajouterCategorie': ajouterCategorie();
$data->sheets[0]['numCols'] - count columns $data->sheets[0]['cells'][$i][$j] - data from $i-row $j-column $data->sheets[0]['cellsInfo'][$i][$j] - extended info about cell $data->sheets[0]['cellsInfo'][$i][$j]['type'] = "date" | "number" | "unknown" if 'type' == "unknown" - use 'raw' value, because cell contain value with format '0.00'; $data->sheets[0]['cellsInfo'][$i][$j]['raw'] = value if cell without format $data->sheets[0]['cellsInfo'][$i][$j]['colspan'] $data->sheets[0]['cellsInfo'][$i][$j]['rowspan'] */ error_reporting(E_ALL ^ E_NOTICE); $numRows = $data->sheets[0]['numRows']; $cells = $data->sheets[0]['cells']; $string = $_GET['q']; autoComplete($numRows, $cells, $string); function autoComplete($numRows, $cells, $string) { $num = count($cells); $results = array_fill(0, $num, null); $j = 0; for ($i = 1; $i <= $numRows; $i++) { preg_match_all("|^{$string}.*|i", $cells[$i][3], $matches); if ($matches[0][0] != null) { $results[$j] = $matches[0][0]; $j++; } } $results = array_filter($results); for ($k = 0; $k < count($results); $k++) { echo '<span style="cursor:default;" onClick="complete_txt(' . "'" . $results[$k] . "'" . ')">' . $results[$k] . '</span><br />';