noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
document_modele.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  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 /*! \file
00021  * \brief Manage the document template
00022  */
00023 
00024 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00025 require_once("class_document_modele.php");
00026 $sub_action=(isset ($_REQUEST['sa']))?$_REQUEST['sa']:"";
00027 echo js_include('modele_document.js');
00028 echo '<div class="content">';
00029 // show the form for adding a template
00030 //
00031 $doc=new Document_modele($cn);
00032 
00033 //-----------------------------------------------------
00034 // Document     add a template
00035 //-----------------------------------------------------
00036 if ( $sub_action=='add_document')
00037 {
00038     require_once("class_document_modele.php");
00039     $doc=new Document_modele($cn);
00040     $doc->md_name=$_POST['md_name'];
00041     $doc->md_id=-1; // because it is a new model
00042     $doc->md_type=$_POST['md_type'];
00043     $doc->start=$_POST['start_seq'];
00044     $doc->md_affect=$_POST['md_affect'];
00045     $doc->Save();
00046 }
00047 //-----------------------------------------------------
00048 // Document remove a template
00049 //-----------------------------------------------------
00050 if ( $sub_action=='rm_template')
00051 {
00052     require_once("class_document_modele.php");
00053     // Get all the document to remove
00054 
00055     foreach ( $_POST as $name=>$value )
00056     {
00057         list ($id) = sscanf ($name,"dm_remove_%d");
00058         if ( $id == null ) continue;
00059         // a document has to be removed
00060         $doc=new Document_modele($cn);
00061         $doc->md_id=$id;
00062         $doc->Delete();
00063     }
00064 
00065 }
00066 //----------------------------------------------------------------------
00067 // Document modify a template
00068 //----------------------------------------------------------------------
00069 if ( $sub_action == 'mod_template')
00070   {
00071     require_once('class_document_modele.php');
00072     $doc=new Document_modele($cn,$_POST['id']);
00073     $doc->update($_POST);
00074   }
00075 //-----------------------------------------------------
00076 // Default action : Show the list
00077 //-----------------------------------------------------
00078 echo $doc->myList();
00079 echo '<div id="add_modele" class="inner_box" style="display:none">';
00080 echo HtmlInput::title_box("Ajout d'un modèle", "add_modele", "hide");
00081 echo $doc->form('');
00082 echo '</div>';
00083 
00084 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations