Révision d072e29c src/pipethistory.php

/dev/null
1
<?php
2
session_start ();
3
require("headers.php");
4

  
5
/*
6
 * IMPORTANT NOTE: This generated file contains only a subset of huge amount
7
 * of options that can be used with phpMyEdit. To get information about all
8
 * features offered by phpMyEdit, check official documentation. It is available
9
 * online and also for download on phpMyEdit project management page:
10
 *
11
 * http://platon.sk/projects/main_page.php?project_id=5
12
 *
13
 * This file was generated by:
14
 *
15
 *                    phpMyEdit version: unknown
16
 *       phpMyEdit.class.php core class: 1.204
17
 *            phpMyEditSetup.php script: 1.50
18
 *              generating setup script: 1.50
19
 */
20

  
21

  
22

  
23
/*************************/
24
//
25
// Connect to DB and 
26
// handle session/authentification
27
//
28
/*************************/
29
require_once ("connect_entry.php");
30
require_once ("session.php");
31
// connect to DB
32
$connexion = mysql_pconnect (SERVEUR, NOM, PASSE);
33
if (!$connexion)
34
{
35
 echo "Sorry, connexion to " . SERVEUR . " failed\n";
36
 exit;
37
}
38
if (!mysql_select_db (BASE, $connexion))
39
{
40
 echo "Sorry, connexion to database " . BASE . " failed\n";
41
 exit;
42
}
43
// authentification
44
CleanOldSessions($connexion);
45
$session = ControleAcces ("pipethistory.php", $_POST, session_id(), $connexion);
46
if (!is_object($session))
47
	exit;
48

  
49
/*************************/
50
//
51
// According to login:
52
// Define priviledge options
53
// to pass to phpMyEdit
54
//
55
/*************************/
56

  
57
//check that visitor is allowed to use this table
58
$tb = "pip_history";
59
if ($session->target_table != $tb && $session->target_table != "all")
60
{
61
   echo "Sorry, your session is not granted access to table <B> $tb </B><p>";
62
   echo "Please logout and try again with appropriate login<P>";
63
   exit;
64
}
65

  
66
//define priv options and change background color accordingly
67
if ($session->mode == "view"){
68
	$privopt = 'VF';
69
	$colorband = "#00ff00";
70
	$messageband = "You are safely in VIEW mode";
71
}
72
else if ($session->mode == "add"){
73
	$privopt = 'APVF';
74
	$colorband = "orange";
75
	$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions';
76
}
77
else if ($session->mode == "edit"){
78
	$privopt = 'ACPVDF';
79
	$colorband = "rgb(250,0,255)";
80
	$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.';
81
}
82
else{
83
	$privopt = '';
84
	$colorband = "grey";
85
}
86
echo '<style type="text/css"> ';
87
echo	"h4 {background-color: $colorband }";
88
echo '</style>';
89
echo "<h4> $messageband </h4>";
90
echo "<HR>";
91

  
92
//************************/
93
//
94
// Fix a problem displaying
95
// symbols (such as delta)
96
//
97
//************************/
98

  
99
mysql_query("SET NAMES 'UTF8'", $connexion);
100

  
101
//************************/
102
//
103
// Update list of pipet Users
104
//
105
//************************/
106

  
107
mysql_query("DELETE FROM pip_users", $connexion);
108
mysql_query("INSERT INTO pip_users (User) SELECT id FROM lab_members", $connexion);
109
mysql_query("INSERT INTO pip_users (User) SELECT User FROM pip_generic_user", $connexion);
110
mysql_query("DELETE FROM pip_users WHERE User IN (SELECT User FROM pip_nonusers)", $connexion);
111

  
112
/*************************/
113
//
114
// Pass phpMyEdit options
115
//
116
/*************************/
117

  
118

  
119
$opts['dbh'] = $connexion;
120
$opts['tb'] = $tb;
121

  
122
// Name of field which is the unique key
123
$opts['key'] = 'ID';
124

  
125
// Type of key field (int/real/string/date etc.)
126
$opts['key_type'] = 'int';
127

  
128
// Sorting field(s)
129
$opts['sort_field'] = array('ID');
130

  
131
// Number of records to display on the screen
132
// Value of -1 lists all records in a table
133
$opts['inc'] = 15;
134

  
135
// Options you wish to give the users
136
// A - add,  C - change, P - copy, V - view, D - delete,
137
// F - filter, I - initial sort suppressed
138
$opts['options'] = $privopt;
139

  
140
// Number of lines to display on multiple selection filters
141
$opts['multiple'] = '4';
142

  
143
// Navigation style: B - buttons (default), T - text links, G - graphic links
144
// Buttons position: U - up, D - down (default)
145
$opts['navigation'] = 'UDBG';
146

  
147
// Display special page elements
148
$opts['display'] = array(
149
	'form'  => true,
150
	'query' => true,
151
	'sort'  => true,
152
	'time'  => true,
153
	'tabs'  => true
154
);
155

  
156
// Set default prefixes for variables
157
$opts['js']['prefix']               = 'PME_js_';
158
$opts['dhtml']['prefix']            = 'PME_dhtml_';
159
$opts['cgi']['prefix']['operation'] = 'PME_op_';
160
$opts['cgi']['prefix']['sys']       = 'PME_sys_';
161
$opts['cgi']['prefix']['data']      = 'PME_data_';
162

  
163
/* Get the user's default language and use it if possible or you can
164
   specify particular one you want to use. Refer to official documentation
165
   for list of available languages. */
166
$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';
167

  
168
/* Table-level filter capability. If set, it is included in the WHERE clause
169
   of any generated SELECT statement in SQL query. This gives you ability to
170
   work only with subset of data from table.
171

  
172
$opts['filters'] = "column1 like '%11%' AND column2<17";
173
$opts['filters'] = "section_id = 9";
174
$opts['filters'] = "PMEtable0.sessions_count > 200";
175
*/
176

  
177
/* Field definitions
178
   
179
Fields will be displayed left to right on the screen in the order in which they
180
appear in generated list. Here are some most used field options documented.
181

  
182
['name'] is the title used for column headings, etc.;
183
['maxlen'] maximum length to display add/edit/search input boxes
184
['trimlen'] maximum length of string content to display in row listing
185
['width'] is an optional display width specification for the column
186
          e.g.  ['width'] = '100px';
187
['mask'] a string that is used by sprintf() to format field output
188
['sort'] true or false; means the users may sort the display on this column
189
['strip_tags'] true or false; whether to strip tags from content
190
['nowrap'] true or false; whether this field should get a NOWRAP
191
['select'] T - text, N - numeric, D - drop-down, M - multiple selection
192
['options'] optional parameter to control whether a field is displayed
193
  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
194
            Another flags are:
195
            R - indicates that a field is read only
196
            W - indicates that a field is a password field
197
            H - indicates that a field is to be hidden and marked as hidden
198
['URL'] is used to make a field 'clickable' in the display
199
        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
200
['URLtarget']  HTML target link specification (for example: _blank)
201
['textarea']['rows'] and/or ['textarea']['cols']
202
  specifies a textarea is to be used to give multi-line input
203
  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
204
['values'] restricts user input to the specified constants,
205
           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
206
['values']['table'] and ['values']['column'] restricts user input
207
  to the values found in the specified column of another table
208
['values']['description'] = 'desc_column'
209
  The optional ['values']['description'] field allows the value(s) displayed
210
  to the user to be different to those in the ['values']['column'] field.
211
  This is useful for giving more meaning to column values. Multiple
212
  descriptions fields are also possible. Check documentation for this.
213
*/
214

  
215
$opts['fdd']['ID'] = array(
216
  'name'     => 'ID',
217
  'select'   => 'N',
218
  'options'  => 'LAVCPDR', // auto increment
219
  'maxlen'   => 10,
220
  //'default'  => '0',
221
  'sort'     => true
222
);
223
$opts['fdd']['Date'] = array(
224
  'name'     => 'Date',
225
  'options'  => 'LFAVCPD',
226
  'select'   => 'N',
227
  'maxlen'   => 10,
228
  'sort'     => true,
229
  'default'  => date("Y-m-d", strtotime("now"))
230
);
231
$opts['fdd']['Event_Type'] = array(
232
  'name'     => 'Type of Event',
233
  'select'   => 'D',
234
  'maxlen'   => 30,
235
  'default'  => 'Misc',
236
  'values'   => array(
237
  	'table'  => 'pip_events',
238
	'column' => 'Events'),
239
  'sort'     => true
240
);
241
$opts['fdd']['Serial_Number'] = array(
242
  'name'     => 'Pipet Serial Number',
243
  'select'   => 'D',
244
  'maxlen'   => 30,
245
  //'default'  => '0',
246
  'values'   => array(
247
  	'table'  => 'pip_stock',
248
	'column' => 'Serial_Number'),
249
  'sort'     => true
250
);
251
$opts['fdd']['Usage_fromNowOn'] = array(
252
  'name'     => 'Usage after this',
253
  'select'   => 'D',
254
  'maxlen'   => 25,
255
  'sort'     => true,
256
  'default'  => 'Misc',
257
  'values'   => array(
258
  	'table'  => 'pip_usage',
259
	'column' => 'Usage')
260
);
261
$opts['fdd']['Owner_fromNowOn'] = array(
262
  'name'     => 'Owner after this',
263
  'select'   => 'D',
264
  'maxlen'   => 25,
265
  'sort'     => true,
266
  'values'   => array(
267
  	'table'  => 'pip_users',
268
	'column' => 'User')
269
);
270
$opts['fdd']['Comments'] = array(
271
  'name'     => 'Comments',
272
  'select'   => 'T',
273
  'maxlen'   => 1000000000, //4294967295,
274
  'textarea' => array(
275
  	'rows' => 5,
276
  	'cols' => 50),
277
  'sort'     => true
278
);
279
// TRIGGER
280
// Before displaying the view page
281
$opts['triggers']['select']['pre']    = 'pipethistory.TSP.php';
282

  
283
// Now important call to phpMyEdit
284
require_once 'phpMyEdit.class.php';
285
new phpMyEdit($opts);
286

  
287
?>
288

  
289

  

Formats disponibles : Unified diff