noalyss Version-9
ajax_anc_search.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22/*!\file
23 *
24 * \brief show a screen to search a ca account
25 *
26 */
27
28// parameter are gDossier , c1 : the control id to update,
29// c2 the control id which contains the pa_id
30if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
31require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
32require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
34
35$texte=new IText('plabel');
36$texte->value=$http->get('plabel',"string","");
37
38echo HtmlInput::title_box(_("Recherche activité"), $ctl);
39
40//------------- FORM ----------------------------------
41echo '<FORM id="anc_search_form" METHOD="GET" onsubmit="search_anc_form(this);return false">';
42echo '<span>'._('Recherche').':';
43
44echo $texte->input();
45echo '</span>';
46echo dossier::hidden();
48$c1=$http->request('c1');
49$c2=$http->request('c2');
50
51echo $hid->input("c1",$c1);
52echo $hid->input("c2",$c2);
53echo $hid->input("go");
54echo HtmlInput::submit("go",_("Recherche"));
55echo '</form>';
56//------------- FORM ----------------------------------
57if ( isset($_REQUEST['go']))
58{
60 $plan=new Anc_Plan($cn,$c2);
61 $plan->pa_id=$c2;
62 if ( $plan->exist()==false)
63 exit(_("Ce plan n'existe pas"));
64 $plabel=$http->request("plabel");
65 $sql="select po_name , po_description from poste_analytique ".
66 "where pa_id=$1 and ".
67 " (po_name ilike '%'||$2||'%' or po_description ilike '%'|| $3||'%') order by po_name";
68 $array=$cn->get_array($sql,array($c2,$plabel,$plabel));
69
70 if (empty($array) == true)
71 {
72 echo _("Aucun poste trouvé");
73 return;
74 }
75
76 echo '<table>';
77 foreach ($array as $line)
78 {
79 $js=sprintf("onclick=\"$('%s').value='%s';removeDiv('%s')\"",
80 $c1,
81 $line['po_name'],$ctl);
82
83 echo '<tr>'.
84 '<td>'.
85 HtmlInput::anchor(h($line['po_name']), "", $js).
86 '</td>'.
87 '<td>'.
88 h($line['po_description']).
89 '</tr>';
90 }
91 echo '</table>';
92}
h( $row[ 'oa_description'])
$_REQUEST['ac']
Concerns the Analytic plan (table plan_analytique)
static connect()
static anchor($p_text, $p_url="", $p_js="", $p_style=' class="line" ', $p_title="click", array $p_attribute=[])
Return a simple anchor with a url or a javascript if $p_js is not null then p_url will be javascript:...
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
manage the http input (get , post, request) and extract from an array
Html Input.
Html Input.
Definition: itext.class.php:30
for($e=0; $e< count($afiche); $e++) exit