noalyss  Version-7.2
cat_document.inc.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of NOALYSS.
5  *
6  * NOALYSS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * NOALYSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with NOALYSS; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 // Copyright Author Dany De Bontridder danydb@aevalys.eu
22 
23 /*!\file
24  * \brief this file is included to perform modification on category of document
25  * table document_type
26  */
27 
28 // show list of document
29 if (!defined('ALLOWED'))
30  die('Appel direct ne sont pas permis');
31 require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
32 
33 global $http;
34 
35 if (isset($_POST['add']))
36 {
37  $catDoc=new Document_Type($cn);
38  try
39  {
40  $cat=$http->post('cat');
41  $prefix=$http->post('prefix');
42  $catDoc->insert($cat, $prefix);
43  }
44  catch (Exception $exc)
45  {
46  echo $exc->getMessage();
47  error_log($exc->getTraceAsString());
48  }
49 }
50 if (isset($_POST['save']))
51 {
52  try
53  {
54  $dt_id=$http->post("dt_id", "number");
55  $name=
56  $prefix=
57  $catDoc=new Document_Type($cn, $dt_id);
58  $catDoc->get();
59  $catDoc->dt_value=trim($http->post("dt_name"));;
60  $catDoc->dt_prefix=trim($http->post("dt_prefix"));
61  if ($catDoc->dt_value=="")
62  {
63  alert(_("Le nom ne peut pas ĂȘtre vide"));
64  }
65  else
66  {
67  $catDoc->update();
68  }
69  if ($_POST['seq']!=0&&isNumber($_POST['seq'])==1)
70  {
71  $catDoc->set_number($_POST['seq']);
72  }
73  }
74  catch (Exception $exc)
75  {
76  alert ($exc->getMessage());
77  error_log($exc->getTraceAsString());
78  }
79 }
80 $aList=Document_Type::get_list($cn);
81 $addCat=new IText('cat');
82 $addPrefix=new IText('prefix');
85 $str_submit=HtmlInput::submit('add', _('Ajout'));
86 echo '<div class="content">';
87 require_once NOALYSS_TEMPLATE.'/list_category_document.php';
88 
89 echo '</div>';
90 ?>
$addCat
$addCat
Definition: cat_document.inc.php:81
IText
Definition: itext.class.php:26
$_POST
$_POST['ac']
Definition: do.php:311
$str_submit
$str_submit
Definition: cat_document.inc.php:85
$aList
if(isset($_POST['add'])) if(isset($_POST['save'])) $aList
Definition: cat_document.inc.php:80
$addPrefix
$addPrefix
Definition: cat_document.inc.php:82
isNumber
isNumber($p_int)
Definition: ac_common.php:218
$cat
$cat
Definition: ajax_template_cat_card.php:45
HtmlInput\submit
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
Definition: html_input.class.php:201
$cn
$cn
Definition: ajax_anc_accounting.php:31
alert
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:695
$name
$name
Definition: ajax_get_profile.php:68
$str_addCat
$str_addCat
Definition: cat_document.inc.php:83
$str_addPrefix
$str_addPrefix
Definition: cat_document.inc.php:84
$http
global $http
Definition: cat_document.inc.php:31