noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
report.inc.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018 
00019  */
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 /* ! \file
00022  * \brief handle your own report: create or view report
00023  */
00024 if (!defined('ALLOWED'))
00025     die('Appel direct ne sont pas permis');
00026 include_once ("ac_common.php");
00027 include_once ("user_menu.php");
00028 require_once("class_ifile.php");
00029 require_once("class_ibutton.php");
00030 require_once('class_acc_report.php');
00031 require_once('class_dossier.php');
00032 require_once('class_database.php');
00033 include_once ("class_user.php");
00034 include_once ("user_menu.php");
00035 require_once('class_ipopup.php');
00036 
00037 
00038 $gDossier=dossier::id();
00039 $str_dossier=dossier::get();
00040 
00041 /* Admin. Dossier */
00042 $rep=new Database($gDossier);
00043 
00044 
00045 $cn=new Database($gDossier);
00046 
00047 $rap=new Acc_Report($cn);
00048 $menu=0;
00049 if (isset($_POST["del_form"]))
00050 {
00051     $rap->id=$_POST['fr_id'];
00052     $rap->delete();
00053     $menu=1;
00054 }
00055 if (isset($_POST["record"]))
00056 {
00057     $rap->from_array($_POST);
00058     $rap->save();
00059     $menu=1;
00060 }
00061 if (isset($_POST['update']))
00062 {
00063     $rap->from_array($_POST);
00064     $rap->save($_POST);
00065     $menu=1;
00066 }
00067 if (isset($_POST['upload']))
00068 {
00069     $rap->upload();
00070     $menu=1;
00071 }
00072 
00073 if (isset($_REQUEST["action"]) && $menu == 0)
00074 {
00075 
00076     $action=$_REQUEST ["action"];
00077     $rap->id=(isset($_REQUEST ['fr_id']))?$_REQUEST['fr_id']:0;
00078 
00079     if ($action=="add"&&!isset($_REQUEST['fr_id']))
00080     {
00081 
00082         echo '<DIV class="content">';
00083         echo '<h1>'._('Définition').'</h1>';
00084         echo '<form method="post" >';
00085         echo dossier::hidden();
00086         $rap->id=0;
00087         echo $rap->form(15);
00088 
00089         echo HtmlInput::submit("record", _("Sauve"));
00090         echo '</form>';
00091         echo '<span class="notice">'._("Les lignes vides seront effacées").'</span>';
00092         echo "</DIV>";
00093         echo '<DIV class="content">';
00094 
00095         echo '<form method="post" enctype="multipart/form-data">';
00096         echo '<h1> Importation</h1>';
00097         echo dossier::hidden();
00098         $rap->id=0;
00099         $wUpload=new IFile();
00100         $wUpload->name='report';
00101         $wUpload->value='report_value';
00102         echo _('Importer ce rapport').' ';
00103         echo $wUpload->input();
00104         echo HtmlInput::submit("upload", _("Sauve"));
00105         echo '</form>';
00106         echo '<span class="notice">'._("Les lignes vides seront effacées").'</span>';
00107         echo "</DIV>";
00108     }
00109     if ($action=="view")
00110     {
00111         echo '<DIV class="content">';
00112         $rap->id=$_REQUEST ['fr_id'];
00113         echo '<form method="post" style="display:inline">';
00114         $rap->load();
00115         echo h1($rap->name);
00116         echo $rap->form();
00117         echo HtmlInput::hidden("fr_id", $rap->id);
00118         echo HtmlInput::hidden("action", "record");
00119         echo HtmlInput::submit("update", _("Mise a jour"));
00120         echo HtmlInput::submit("del_form", _("Effacement"));
00121 
00122         echo '</form>';
00123         echo '<form method="get" action="export.php" style="display:inline">';
00124         echo dossier::hidden();
00125         echo HtmlInput::hidden("act", "CSV:reportinit");
00126         echo HtmlInput::hidden('f', $rap->id);
00127         echo HtmlInput::submit('bt_csv', "Export CSV");
00128         echo HtmlInput::request_to_hidden(array('ac', 'action', 'p_action', 'fr_id'));
00129         $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier']));
00130         echo '<a style="display:inline" class="smallbutton" href="do.php?'.$href.'">'._('Retour').'</a>';
00131         echo '</form>';
00132         echo '<span class="notice">'._("Les lignes vides seront effacées").'</span>';
00133         echo "</DIV>";
00134     }
00135 }
00136 else
00137 {
00138 
00139     $lis=$rap->get_list();
00140     $ac="&ac=".$_REQUEST['ac'];
00141     $p_action='p_action=defreport';
00142     echo '<div class="content">';
00143    echo _('Filtre')." ".HtmlInput::filter_table("rapport_table_id", '0', 1);
00144 
00145     echo '<TABLE id="rapport_table_id" class="vert_mtitle">';
00146     echo '<TR><TD class="first"><A HREF="?'.$p_action.$ac.'&action=add&'.$str_dossier.'">Ajout</A></TD></TR>';
00147 
00148     foreach ($lis as $row)
00149     {
00150         printf('<TR><TD><A  HREF="?'.$p_action.$ac.'&action=view&fr_id=%s&%s">%s</A></TD></TR>', $row->id, $str_dossier, $row->name);
00151     }
00152     echo "</TABLE>";
00153     echo '</div>';
00154 }
00155 html_page_stop();
00156 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations