hellofacteurV1/ctrl/admin_flux_recherche.php

46 lines
1.4 KiB
PHP
Executable File

<?php
/**
* Script cherchant les flux pour une recherche lancée par un administrateur
* Les éventuels résultats sont listés pour sélection
* Peut être appelé en ajax ou directement en php si JS désactivé
*
**/
$form["recherche"]=trim($_POST["recherche"]);
$ajax_on=false;
if(!empty($_POST["ajax"]))
{
$ajax_on=true;
session_save_path(SESSIONS_REP);
ini_set("session.use_only_cookies",1);
session_start();
header('Content-Type: text/html; charset=utf-8');
require_once("../modele/FclFlux_flux.php");
}
if(empty($form["recherche"]))
$select=get_html_alerte_msg((array) ERREUR_UTILISA_CHAMPS_ABSENTS);
else
{
if($_SESSION["statut"]!="administrateur")
$select=get_html_alerte_msg((array) ERREUR_IMPREVUE);
else
{
if(empty($Bd))
require("../modele/connexion-bd.php");
$flux=FclFlux_flux::recherche_globale($form["recherche"],"id_flux,nom");
$Bd=null;
if(!empty($flux))
{
$select="<div class='form-group'>
<label for='liste_flux'>".count($flux)." résultat(s) correspondant</label>
<select name='liste_flux' id='liste_flux' autofocus class='form-control'>
<option value='0'></option>";
foreach ($flux as $flux_info)
$select.="<option value='".$flux_info["id_flux"]."'>".htmlentities(affiche_utf8($flux_info["nom"],UTF8_OK))."</option>\n";
$select.="</select></div>";
}
else
$select=get_html_alerte_msg((array) ERREUR_SQL_RECHERCHE);
}
}
if((!empty($select))&&($ajax_on))
echo $select;