noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
ajax_anc_search.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  *
00024  * \brief show a screen to search a ca account
00025  *
00026  */
00027 
00028 // parameter are gDossier , c1 : the control id to update,
00029 // c2 the control id which contains the pa_id
00030 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00031 require_once("class_itext.php");
00032 require_once("class_ihidden.php");
00033 require_once("class_ibutton.php");
00034 require_once ('class_database.php');
00035 require_once ("ac_common.php");
00036 require_once ('class_dossier.php');
00037 require_once ('class_anc_account.php');
00038 require_once ('class_anc_plan.php');
00039 require_once('function_javascript.php');
00040 
00041 echo HtmlInput::title_box(_("Recherche activité"), $ctl);
00042 
00043 //------------- FORM ----------------------------------
00044 echo '<FORM id="anc_search_form" METHOD="GET" onsubmit="search_anc_form(this);return false">';
00045 echo '<span>'._('Recherche').':';
00046 
00047 $texte=new IText('plabel');
00048 $texte->value=HtmlInput::default_value('plabel',"", $_GET);
00049 echo $texte->input();
00050 echo '</span>';
00051 echo dossier::hidden();
00052 $hid=new IHidden();
00053 echo $hid->input("c1",$_REQUEST['c1']);
00054 echo $hid->input("c2",$_REQUEST['c2']);
00055 echo $hid->input("go");
00056 echo HtmlInput::submit("go",_("Recherche"));
00057 echo '</form>';
00058 //------------- FORM ----------------------------------
00059 if ( isset($_REQUEST['go']))
00060 {
00061     $cn=Dossier::connect();
00062     $plan=new Anc_Plan($cn,$_REQUEST['c2']);
00063     $plan->pa_id=$_REQUEST['c2'];
00064     if ( $plan->exist()==false)
00065         exit(_("Ce plan n'existe pas"));
00066 
00067     $sql="select po_name , po_description from poste_analytique ".
00068          "where pa_id=$1 and ".
00069          " (po_name ~* $2 or po_description ~* $3) order by po_name";
00070     $array=$cn->get_array($sql,array($_REQUEST['c2'],$_REQUEST['plabel'],$_REQUEST['plabel']));
00071 
00072     if (empty($array) == true)
00073     {
00074         echo _("Aucun poste trouvé");
00075         return;
00076     }
00077     $button=new IButton();
00078     $button->name=_("Choix");
00079     $button->label=_("Choix");
00080 
00081     echo '<table>';
00082     foreach ($array as $line)
00083     {
00084         $button->javascript=sprintf("$('%s').value='%s';removeDiv('%s')",
00085                                     $_REQUEST['c1'],
00086                                     $line['po_name'],$ctl);
00087         echo '<tr>'.
00088         '<td>'.
00089         $button->input().
00090         '</td>'.
00091         '<td>'.
00092         h($line['po_name']).
00093         '</td><td>'.
00094         h($line['po_description']).
00095         '</tr>';
00096     }
00097     echo '</table>';
00098 }
 All Data Structures Namespaces Files Functions Variables Enumerations