Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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 ?>