noalyss Version-9
document_modele.inc.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// Copyright Author Dany De Bontridder danydb@aevalys.eu
20/*! \file
21 * \brief Manage the document template
22 */
23
24if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
25
27
28$sub_action=$http->request("sa","string","");
29echo js_include('modele_document.js');
30echo '<div class="content">';
31// show the form for adding a template
32//
34
35//-----------------------------------------------------
36// Document add a template
37//-----------------------------------------------------
38if ( $sub_action=='add_document')
39{
41 $doc->md_name=$http->post('md_name');
42 $doc->md_id=-1; // because it is a new model
43 $doc->md_type=$http->post('md_type',"number");
44 $doc->start=$http->post('start_seq',"number");
45 $doc->md_affect=$http->post('md_affect');
46 $doc->Save();
47}
48//-----------------------------------------------------
49// Document remove a template
50//-----------------------------------------------------
51if ( $sub_action=='rm_template')
52{
53 // Get all the document to remove
54
55 foreach ( $_POST as $name=>$value )
56 {
57 list ($id) = sscanf ($name,"dm_remove_%d");
58 if ( $id == null ) continue;
59 // a document has to be removed
61 $doc->md_id=$id;
62 $doc->Delete();
63 }
64
65}
66//----------------------------------------------------------------------
67// Document modify a template
68//----------------------------------------------------------------------
69if ( $sub_action == 'mod_template')
70 {
71 $id=$http->post("id","number");
73 $doc->update($_POST);
74 }
75//-----------------------------------------------------
76// Default action : Show the list
77//-----------------------------------------------------
78echo $doc->myList();
79echo '<div id="add_modele" class="inner_box" style="position:fixed;top:120px;display:none">';
80echo HtmlInput::title_box(_("Ajout d'un modèle"), "add_modele", "hide");
81echo $doc->form('');
82echo '</div>';
83
84?>
Class for the document template.
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
manage the http input (get , post, request) and extract from an array
$_POST['ac']
Definition: do.php:310
js_include($p_string)
create the HTML for including of a javascript file if a file is included twice, the second time it wi...