noalyss Version-9
ajax_add_concerned_card.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// Copyright 2014 Author Dany De Bontridder danydb@aevalys.eu
22// require_once '.php';
23/**
24 *@file
25 *@brief insert concerned operation , call from follow up
26 */
27
28if (!defined('ALLOWED'))
29 die('Appel direct ne sont pas permis');
30
32
33ob_start();
34try
35{
36 $ag_id=$http->get("ag_id");
37}
38catch (Exception $exc)
39{
40 echo $exc->getMessage();
41 error_log($exc->getTraceAsString());
42 return;
43}
44/*
45 * security Who can do it ?
46 */
47if ( ! $g_user->can_write_action($ag_id) ) {
48 record_log(__FILE__."security : access refused");
49 return;
50}
51
52
53$r=HtmlInput::title_box(_("Détail fiche"), 'search_card');
54//--------------------------------------------------------------------------------------------------------------------
55// Form search
56//--------------------------------------------------------------------------------------------------------------------
57$r.='<form id="search_card1_frm" method="GET" onsubmit="action_concerned_search_card(this);return false;">';
58$q=new IText('query');
59$q->value=(isset($query))?$query:'';
60$r.='<span style="margin-left:50px">';
61$r.=_('Fiche contenant').Icon_Action::infobulle(19);
62$r.=$q->input();
63
64// where to search
65$select=new ISelect("search_in");
66$select->value=$cn->make_array("select ad_id, ad_text from attr_def where ad_search_followup = 1 order by 2 ",1);
67$select->selected=$http->get("search_in","string","");
68$r.=_("limité aux champs ").$select->input();
69
70$r.='</span>';
71$r.=dossier::hidden().HtmlInput::hidden('op2', 'add_concerned_card');
72$r.=HtmlInput::request_to_hidden(array('ag_id'));
73
74// Search by category
75$sel_Category=new ISelect("search_cat");
76$sel_Category->value=$cn->make_array("select fd_id,fd_label from fiche_def order by 2",1);
77$sel_Category->set_value($http->request("search_cat","string","-1"));
78$r.=_("Catégorie")." ".$sel_Category->input();
79
80// search also inactive card
81$inactive=$http->get("inactive_card","string",0);
82if ($inactive=="undefined" || $inactive == "") $inactive=0;
83$is=new InputSwitch("inactive_card",$inactive);
84$is->value=$inactive;
85$r.=_("Fiches inactives").$is->input();
86
87$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton");
88$r.='</form>';
89
90
91$query=$http->get("query", "string","");
93$sql_array['typecard']='all';
94$sql_array['search_in']=$select->selected;
95$sql_array['inactive_card']=$inactive;
96$sql_array['search_cat']=$sel_Category->selected;
97
99/* Build the SQL and show result */
102
103//--------------------------------------------------------------------------------------------------------------------
104// Result
105//--------------------------------------------------------------------------------------------------------------------
106
107/* We limit the search to MAX_SEARCH_CARD records */
108$a=$cn->get_array($sql);
109$r.='<form id="search_card2_frm" method="POST" onsubmit="action_concerned_save_card(this);return false;" '
110 . ' style="height:45rem">';
111$r.=HtmlInput::request_to_hidden(array('ag_id'));
112$r.=dossier::hidden().HtmlInput::hidden('op2', 'link_concerned_card').HtmlInput::hidden("op","card");
113// element to update with the answer
114$r.=HtmlInput::hidden("ctl","concerned_card_td");
116for ($i=0; $i<count($a); $i++)
117{
118 $ic=new ICheckBox("selected_card[]");
119 $ic->value=$a[$i]['f_id'];
120 $ic->set_range("select_card_ck");
121 $array[$i]['checkbox']=$ic->input();
122 $array[$i]['quick_code']=$a[$i]['quick_code'];
123 $array[$i]['name']=h($a[$i]['vw_name']);
124 $array[$i]['first_name']=h($a[$i]['vw_first_name']);
125 $array[$i]['description']=h($a[$i]['vw_description']);
126 $array[$i]['company']=h($a[$i]['company']);
127}//foreach
128
129// No accountancy history
131echo $r;
132require_once(NOALYSS_TEMPLATE.'/card_multiple_result.php');
133echo '<ul class="aligned-block">';
134echo '<li>';
135echo HtmlInput::submit("add_concerned_card",_("Ajouter"));
136echo '</li>';
137echo '<li>';
138echo HtmlInput::button_close("search_card");
139echo '</li>';
140echo '</ul>';
141echo '</form>';
142$response=ob_get_contents();
143ob_end_clean();
144
145
147if ( !headers_sent() ) { header('Content-type: text/xml; charset=UTF-8');} else {echo $response;echo $html;}
148echo <<<EOF
149<?xml version="1.0" encoding="UTF-8"?>
150<data>
151<ctl>unused</ctl>
152<code>$html</code>
153</data>
154EOF;
155?>
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1342
global $g_user
if no group available , then stop
$ag_id
Definition: action.inc.php:54
$sql_array['query']
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
for($i=0; $i< count($a); $i++) $accvis
h( $row[ 'oa_description'])
in follow-up , add multiple cards to an event, an action
static button_close($div_name, $class='smallbutton')
close button for the HTML popup
static request_to_hidden(array $array)
transform $_REQUEST data to hidden
static hidden($p_name, $p_value, $p_id="")
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 , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
Html Input.
Definition: itext.class.php:30
show a switch, when you click on it an hidden field is changed, the value is 1 or 0
escape_xml($p_xml)
When data are transfered thanks ajax in a xml document, the xml can not contains some character,...