patch
This commit is contained in:
parent
29f4115c62
commit
f71dee1791
2 changed files with 23 additions and 15 deletions
32
api.php
32
api.php
|
@ -43,21 +43,27 @@
|
|||
|
||||
case 'rechercher':
|
||||
|
||||
// Exemple URL: /api.php/chercher?req=math&duree=30&themes=algebre,geometrie
|
||||
|
||||
$query = isset($_GET["req"]) ? $_GET["req"] : "";
|
||||
$length = isset($_GET["duree"]) ? $_GET["duree"] : "";
|
||||
$themes = isset($_GET["themes"]) ? explode(",", $_GET["themes"]) : [];
|
||||
$tout_les_insa = isset($_GET["tout_les_insa"]) ? true : false;
|
||||
//print_r($_GET);
|
||||
try {
|
||||
$results = RechercheExercices($query, $length, $themes,$tout_les_insa);
|
||||
echo json_encode(["status" => "1", "resultats" => $results]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(["status" => "0", "msg" => $e->getMessage()]);
|
||||
if(isset($_SESSION["utilisateur_authentifie"]) && ($_SESSION["utilisateur_authentifie"] == 1)){
|
||||
|
||||
// Exemple URL: /api.php/chercher?req=math&duree=30&themes=algebre,geometrie
|
||||
|
||||
$query = isset($_GET["req"]) ? $_GET["req"] : "";
|
||||
$length = isset($_GET["duree"]) ? $_GET["duree"] : "";
|
||||
$themes = isset($_GET["themes"]) ? explode(",", $_GET["themes"]) : [];
|
||||
$tout_les_insa = isset($_GET["tout_les_insa"]) ? true : false;
|
||||
//print_r($_GET);
|
||||
try {
|
||||
$results = RechercheExercices($query, $length, $themes,$tout_les_insa);
|
||||
echo json_encode(["status" => "1", "resultats" => $results]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(["status" => "0", "msg" => $e->getMessage()]);
|
||||
}
|
||||
|
||||
}else{
|
||||
echo json_encode(["status" => "1", "resultats" => []]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'decomposer_ensemble':
|
||||
|
|
|
@ -63,8 +63,10 @@
|
|||
<div class="barre-recherche centre-horizontal">
|
||||
<form id="recherche_form">
|
||||
<input class="champ" type="text" id="recherche_input" placeholder="Rechercher une fiche, annale ...">
|
||||
<label class="champ" for="tout-les-insa-switch">Activer la recherche sur tout les INSA</label>
|
||||
<input class="champ checkbox" type="checkbox" id="tout_les_insa_switch">
|
||||
<div hidden>
|
||||
<label class="champ" for="tout-les-insa-switch">Activer la recherche sur tout les INSA</label>
|
||||
<input class="champ checkbox" type="checkbox" id="tout_les_insa_switch">
|
||||
</div>
|
||||
<input hidden type="submit">
|
||||
<input hidden class="champ" type="text" id="themes_input" placeholder="themes (appuyez sur la touche entrée entre chaque thèmes)">
|
||||
<input hidden class="champ" type="number" id="duree_input" placeholder="durée en minutes">
|
||||
|
|
Loading…
Reference in a new issue