noalyss Version-9
export_anc_axis_csv.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 * Export ANALYTIC Axis in CSV
24 */
25if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
26
28$pa_id=$http->get("pa_id","number");
29$name=$cn->get_value("select pa_name from plan_analytique where pa_id=$1",
30 [$pa_id]);
31$array=$cn->get_array(" select
32 po_name,
33 po_amount,
34 po_description,
35 ga_description
36 from
37 poste_analytique
38 left join groupe_analytique using (ga_id)
39 where poste_analytique.pa_id=$1 order by po_name asc ",[$pa_id]);
41$output->send_header();
42$output->write_header([
43 _("Nom"),
44 _("Description"),
45 _("Montant"),
46 _("Groupe"),
47]);
48if ($array != FALSE )
49{
50 $nb_array=count($array);
51 for ($i=0;$i<$nb_array;$i++) {
52 $output->add($array[$i]['po_name']);
53 $output->add($array[$i]['po_description']);
54 $output->add($array[$i]['po_amount'],"number");
55 $output->add($array[$i]['ga_description']);
56 $output->write();
57 }
58
59}
manage the http input (get , post, request) and extract from an array
Manage the CSV : manage files and write CSV record.