noalyss Version-9
adm.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/*!\brief include from adm.inc.php and concerned only the customer card and
21 * the customer category
22 */
23if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
24
26
27$low_action=$http->request('sb',"string","list");
28/*! \file
29 * \brief Called from the module "Gestion" to manage the customer
30 */
31$href=basename($_SERVER['PHP_SELF']);
32
33
34
35//-----------------------------------------------------
36// Remove a card
37//-----------------------------------------------------
38if ( isset($_POST['action_fiche'] ) )
39{
40 if ( $_POST['action_fiche'] == 'delete_card')
41 {
42 if ( $g_user->check_action(FICADD) == 0 )
43 {
44 alert(_('Vous ne pouvez pas enlever de fiche'));
45 return;
46 }
47
48 $f_id=$http->request('f_id',"number");
49
50 $fiche=new Admin($cn,$f_id);
51 $fiche->remove();
52 $low_action="list";
53 }
54
55}
56
57//-----------------------------------------------------
58// list of Admin
59//-----------------------------------------------------
60if ( $low_action == "list" )
61{
62
63 ?>
64 <div class="content">
65 <div>
66 <form method="get" action="<?php echo $href; ?>">
67 <?php
68 echo '<h2>' . "Exercice " . $g_user->get_exercice() . '</h2>';
69 echo dossier::hidden();
70 $a=$http->get("query","string","");
71 echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$a);
72
73 echo HtmlInput::request_to_hidden(array('ac'));
74 $choice_cat=$http->request("choice_cat","string", 1);
75 if ( $choice_cat == 1 )
76 {
77 $sel_card=new ISelect('cat');
78 $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
79 ' where frd_id=$1 '.
80 ' order by fd_label ',1,array(FICHE_TYPE_ADM_TAX));
81 $sel_card->selected=$http->get("cat","number",-1);
82 $sel_card->javascript=' onchange="waiting_box();submit(this);"';
83 echo _('Catégorie :').$sel_card->input();
84 } else
85 {
86 $cat=$http->request('cat', 'string','');
87 echo HtmlInput::hidden("cat",$cat);
88 echo HtmlInput::hidden('choice_cat', 0);
89 }
90 echo Dossier::hidden();
91
92 ?>
93 <input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
94 <input type="hidden" name="p_action" value="adm">
95 </form>
96 </div>
97 <?php
98 $adm=new Admin($cn);
99 $search=$http->get("query","string","");
100 $sql="";
101 $cat=$http->request("cat","number",-1);
102 if ( $cat != -1)
103 {
104 $sql=sprintf(" and fd_id = %d",$cat);
105 }
106
107 echo '<div class="content">';
108 echo $adm->Summary($search,'adm',$sql);
109
110
111 echo '<br>';
112 echo '<br>';
113 echo '<br>';
114 if ($g_user->check_action(FICADD)==1)
115 {
116 /* Add button */
117 $f_add_button=new IButton('add_card');
118 $f_add_button->label=_('Créer une nouvelle fiche');
119 $f_add_button->set_attribute('ipopup','ipop_newcard');
120 $f_add_button->set_attribute('win_refresh','yes');
121
122 $f_add_button->set_attribute('type_cat',FICHE_TYPE_ADM_TAX);
123 $f_add_button->javascript=" select_card_type(this);";
124 echo $f_add_button->input();
125
126 $f_cat_button=new IButton('add_cat');
127 $f_cat_button->set_attribute('ipopup','ipop_cat');
128 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_ADM_TAX);
129 $f_cat_button->label=_('Ajout d\'une catégorie');
130 $f_cat_button->javascript='add_category(this)';
131 echo $f_cat_button->input();
132 }
133 echo '</div>';
134 echo '</div>';
135
136
137}
138/*----------------------------------------------------------------------
139 * Detail for a card, Suivi, Contact, Operation,... *
140 * cc stands for customer card
141 *----------------------------------------------------------------------*/
142if ( $low_action == 'detail')
143{
144 /* Menu */
145 require_once NOALYSS_INCLUDE.'/category_card.inc.php';
146return;
147}
148
149
150
152?>
html_page_stop()
end tag
Definition: ac_common.php:468
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
$low_action
Definition: adm.inc.php:27
global $http
Definition: adm.inc.php:25
global $g_user
Definition: adm.inc.php:25
$href
Definition: adm.inc.php:31
$from_poste name
$input_from type
Definition: balance.inc.php:65
class admin are a specific kind of card
Definition: admin.class.php:34
static hidden()
return a string to set gDossier into a FORM
static request_to_hidden(array $array)
transform $_REQUEST data to hidden
static hidden($p_name, $p_value, $p_id="")
Html Input.
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
const FICHE_TYPE_ADM_TAX
Definition: constant.php:253
const FICADD
$_POST['ac']
Definition: do.php:310