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