Plugins  LAST
 All Data Structures Files Functions Variables Pages
ajax.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of PhpCompta.
5  *
6  * PhpCompta 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  * PhpCompta 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 PhpCompta; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 // Copyright (2016) Author Dany De Bontridder <dany@alchimerys.be>
21 
22 if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
23 
24 /**
25  * @file
26  * @brief manage the ajax calls
27  */
28 require_once __DIR__."/include/class_impcard_format_sql.php";
29 /// Save a format
30 if (isset($_POST["format_save"])) {
31  $format_id=HtmlInput::default_value_post("format_id", 0);
32  $name=HtmlInput::default_value_post("format_name", "");
33  if ( $format_id == 0 || trim($name)=="")
34  {
35  echo "Paramètre invalide";
36  return;
37  }
39  $format->f_name=html_entity_decode($name,ENT_COMPAT | ENT_HTML401,"utf-8");
40  $format->f_saved=1;
41  $format->save();
42  printf(_("Sauvegarde du modèle %s"), $name);
43  return;
44 }
45 if (isset($_GET["getFormat"]) )
46 {
47  $id=HtmlInput::default_value_get("format_id", -1);
48  if (isNumber($id)==0) {
49  echo 'ERRFORMAT';
50  return;
51  }
52  // retrieve info
54  $array=array();
55  $array['rdelimiter']=$format->f_delimiter;
56  $array['encodage']=$format->f_unicode_encoding;
57  $array['rsurround']=$format->f_surround;
58  $array['skip_row']=$format->f_skiprow;
59  $array['f_position']=explode(',',$format->f_position);
60  header('Content-Type: application/json');
61  echo json_encode($array);
62 
63 }
$format_id
Definition: index.php:61
global $cn
Definition: ajax.php:27
if(!isset($_REQUEST['sb'])) $format
Definition: import_bank.php:43
if(isset($_POST['remove'])) $array
$name