/
elenco_clienti_view.php
418 lines (367 loc) · 19.1 KB
/
elenco_clienti_view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ATTENTION!
* If you see this message in your browser (Internet Explorer, Mozilla Firefox, Google Chrome, etc.)
* this means that PHP is not properly installed on your web server. Please refer to the PHP manual
* for more details: http://php.net/manual/install.php
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
include_once dirname(__FILE__) . '/' . 'components/utils/check_utils.php';
CheckPHPVersion();
CheckTemplatesCacheFolderIsExistsAndWritable();
include_once dirname(__FILE__) . '/' . 'phpgen_settings.php';
include_once dirname(__FILE__) . '/' . 'database_engine/mysql_engine.php';
include_once dirname(__FILE__) . '/' . 'components/page.php';
include_once dirname(__FILE__) . '/' . 'authorization.php';
function GetConnectionOptions()
{
$result = GetGlobalConnectionOptions();
$result['client_encoding'] = 'utf8';
GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);
return $result;
}
// OnGlobalBeforePageExecute event handler
// OnBeforePageExecute event handler
class elenco_clienti_viewPage extends Page
{
protected function DoBeforeCreate()
{
$this->dataset = new TableDataset(
new MyPDOConnectionFactory(),
GetConnectionOptions(),
'`elenco_clienti_view`');
$field = new StringField('cli-codcli');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('descrizione');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
}
protected function DoPrepare() {
}
protected function CreatePageNavigator()
{
$result = new CompositePageNavigator($this);
$partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
$partitionNavigator->SetRowsPerPage(25);
$result->AddPageNavigator($partitionNavigator);
return $result;
}
public function GetPageList()
{
$currentPageCaption = $this->GetShortCaption();
$result = new PageList($this);
$result->AddGroup($this->RenderText('Default'));
if (GetCurrentUserGrantForDataSource('clienti')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Clienti'), 'clienti.php', $this->RenderText('Clienti'), $currentPageCaption == $this->RenderText('Clienti'), false, $this->RenderText('Default')));
if (GetCurrentUserGrantForDataSource('articoli')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Articoli'), 'articoli.php', $this->RenderText('Articoli'), $currentPageCaption == $this->RenderText('Articoli'), false, $this->RenderText('Default')));
if (GetCurrentUserGrantForDataSource('famiglie')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Famiglie'), 'famiglie.php', $this->RenderText('Famiglie'), $currentPageCaption == $this->RenderText('Famiglie'), false, $this->RenderText('Default')));
if (GetCurrentUserGrantForDataSource('listino_voci')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Listino Voci'), 'listino_voci.php', $this->RenderText('Listino Voci'), $currentPageCaption == $this->RenderText('Listino Voci'), false, $this->RenderText('Default')));
if (GetCurrentUserGrantForDataSource('listino_articoli')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Listino Articoli'), 'listino_articoli.php', $this->RenderText('Listino Articoli'), $currentPageCaption == $this->RenderText('Listino Articoli'), false, $this->RenderText('Default')));
if (GetCurrentUserGrantForDataSource('voci_costo')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Voci Costo'), 'voci_costo.php', $this->RenderText('Voci Costo'), $currentPageCaption == $this->RenderText('Voci Costo'), false, $this->RenderText('Default')));
if (GetCurrentUserGrantForDataSource('formule_calcolo')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Formule Calcolo'), 'formule_calcolo.php', $this->RenderText('Formule Calcolo'), $currentPageCaption == $this->RenderText('Formule Calcolo'), false, $this->RenderText('Default')));
if (GetCurrentUserGrantForDataSource('scontistica_clienti')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Scontistica Clienti'), 'scontistica_clienti.php', $this->RenderText('Scontistica Clienti'), $currentPageCaption == $this->RenderText('Scontistica Clienti'), false, $this->RenderText('Default')));
if ( HasAdminPage() && GetApplication()->HasAdminGrantForCurrentUser() ) {
$result->AddGroup('Admin area');
$result->AddPage(new PageLink($this->GetLocalizerCaptions()->GetMessageString('AdminPage'), 'phpgen_admin.php', $this->GetLocalizerCaptions()->GetMessageString('AdminPage'), false, false, 'Admin area'));
}
return $result;
}
protected function CreateRssGenerator()
{
return null;
}
protected function CreateGridSearchControl(Grid $grid)
{
$grid->UseFilter = true;
$grid->SearchControl = new SimpleSearch('elenco_clienti_viewssearch', $this->dataset,
array('cli-codcli', 'descrizione'),
array($this->RenderText('Cli-codcli'), $this->RenderText('Descrizione')),
array(
'=' => $this->GetLocalizerCaptions()->GetMessageString('equals'),
'<>' => $this->GetLocalizerCaptions()->GetMessageString('doesNotEquals'),
'<' => $this->GetLocalizerCaptions()->GetMessageString('isLessThan'),
'<=' => $this->GetLocalizerCaptions()->GetMessageString('isLessThanOrEqualsTo'),
'>' => $this->GetLocalizerCaptions()->GetMessageString('isGreaterThan'),
'>=' => $this->GetLocalizerCaptions()->GetMessageString('isGreaterThanOrEqualsTo'),
'ILIKE' => $this->GetLocalizerCaptions()->GetMessageString('Like'),
'STARTS' => $this->GetLocalizerCaptions()->GetMessageString('StartsWith'),
'ENDS' => $this->GetLocalizerCaptions()->GetMessageString('EndsWith'),
'CONTAINS' => $this->GetLocalizerCaptions()->GetMessageString('Contains')
), $this->GetLocalizerCaptions(), $this, 'CONTAINS'
);
}
protected function CreateGridAdvancedSearchControl(Grid $grid)
{
$this->AdvancedSearchControl = new AdvancedSearchControl('elenco_clienti_viewasearch', $this->dataset, $this->GetLocalizerCaptions(), $this->GetColumnVariableContainer(), $this->CreateLinkBuilder());
$this->AdvancedSearchControl->setTimerInterval(1000);
$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('cli-codcli', $this->RenderText('Cli-codcli')));
$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('descrizione', $this->RenderText('Descrizione')));
}
protected function AddOperationsColumns(Grid $grid)
{
$actionsBandName = 'actions';
$grid->AddBandToBegin($actionsBandName, $this->GetLocalizerCaptions()->GetMessageString('Actions'), true);
if ($this->GetSecurityInfo()->HasViewGrant())
{
$column = new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('View'), OPERATION_VIEW, $this->dataset);
$grid->AddViewColumn($column, $actionsBandName);
$column->SetImagePath('images/view_action.png');
}
if ($this->GetSecurityInfo()->HasEditGrant())
{
$column = new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Edit'), OPERATION_EDIT, $this->dataset);
$grid->AddViewColumn($column, $actionsBandName);
$column->SetImagePath('images/edit_action.png');
$column->OnShow->AddListener('ShowEditButtonHandler', $this);
}
if ($this->GetSecurityInfo()->HasDeleteGrant())
{
$column = new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset);
$grid->AddViewColumn($column, $actionsBandName);
$column->SetImagePath('images/delete_action.png');
$column->OnShow->AddListener('ShowDeleteButtonHandler', $this);
$column->SetAdditionalAttribute("data-modal-delete", "true");
$column->SetAdditionalAttribute("data-delete-handler-name", $this->GetModalGridDeleteHandler());
}
}
protected function AddFieldColumns(Grid $grid)
{
//
// View column for cli-codcli field
//
$column = new TextViewColumn('cli-codcli', 'Cli-codcli', $this->dataset);
$column->SetOrderable(true);
$column->SetDescription($this->RenderText(''));
$column->SetFixedWidth(null);
$grid->AddViewColumn($column);
//
// View column for descrizione field
//
$column = new TextViewColumn('descrizione', 'Descrizione', $this->dataset);
$column->SetOrderable(true);
$column->SetMaxLength(75);
$column->SetFullTextWindowHandlerName('elenco_clienti_viewGrid_descrizione_handler_list');
$column->SetDescription($this->RenderText(''));
$column->SetFixedWidth(null);
$grid->AddViewColumn($column);
}
protected function AddSingleRecordViewColumns(Grid $grid)
{
//
// View column for cli-codcli field
//
$column = new TextViewColumn('cli-codcli', 'Cli-codcli', $this->dataset);
$column->SetOrderable(true);
$grid->AddSingleRecordViewColumn($column);
//
// View column for descrizione field
//
$column = new TextViewColumn('descrizione', 'Descrizione', $this->dataset);
$column->SetOrderable(true);
$column->SetMaxLength(75);
$column->SetFullTextWindowHandlerName('elenco_clienti_viewGrid_descrizione_handler_view');
$grid->AddSingleRecordViewColumn($column);
}
protected function AddEditColumns(Grid $grid)
{
//
// Edit column for cli-codcli field
//
$editor = new TextEdit('cli-codcli_edit');
$editor->SetSize(15);
$editor->SetMaxLength(15);
$editColumn = new CustomEditColumn('Cli-codcli', 'cli-codcli', $editor, $this->dataset);
$editColumn->SetAllowSetToNull(true);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddEditColumn($editColumn);
//
// Edit column for descrizione field
//
$editor = new TextAreaEdit('descrizione_edit', 50, 8);
$editColumn = new CustomEditColumn('Descrizione', 'descrizione', $editor, $this->dataset);
$editColumn->SetAllowSetToNull(true);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddEditColumn($editColumn);
}
protected function AddInsertColumns(Grid $grid)
{
//
// Edit column for cli-codcli field
//
$editor = new TextEdit('cli-codcli_edit');
$editor->SetSize(15);
$editor->SetMaxLength(15);
$editColumn = new CustomEditColumn('Cli-codcli', 'cli-codcli', $editor, $this->dataset);
$editColumn->SetAllowSetToNull(true);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddInsertColumn($editColumn);
//
// Edit column for descrizione field
//
$editor = new TextAreaEdit('descrizione_edit', 50, 8);
$editColumn = new CustomEditColumn('Descrizione', 'descrizione', $editor, $this->dataset);
$editColumn->SetAllowSetToNull(true);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddInsertColumn($editColumn);
if ($this->GetSecurityInfo()->HasAddGrant())
{
$grid->SetShowAddButton(true);
$grid->SetShowInlineAddButton(false);
}
else
{
$grid->SetShowInlineAddButton(false);
$grid->SetShowAddButton(false);
}
}
protected function AddPrintColumns(Grid $grid)
{
//
// View column for cli-codcli field
//
$column = new TextViewColumn('cli-codcli', 'Cli-codcli', $this->dataset);
$column->SetOrderable(true);
$grid->AddPrintColumn($column);
//
// View column for descrizione field
//
$column = new TextViewColumn('descrizione', 'Descrizione', $this->dataset);
$column->SetOrderable(true);
$grid->AddPrintColumn($column);
}
protected function AddExportColumns(Grid $grid)
{
//
// View column for cli-codcli field
//
$column = new TextViewColumn('cli-codcli', 'Cli-codcli', $this->dataset);
$column->SetOrderable(true);
$grid->AddExportColumn($column);
//
// View column for descrizione field
//
$column = new TextViewColumn('descrizione', 'Descrizione', $this->dataset);
$column->SetOrderable(true);
$grid->AddExportColumn($column);
}
public function GetPageDirection()
{
return null;
}
protected function ApplyCommonColumnEditProperties(CustomEditColumn $column)
{
$column->SetDisplaySetToNullCheckBox(false);
$column->SetDisplaySetToDefaultCheckBox(false);
$column->SetVariableContainer($this->GetColumnVariableContainer());
}
function GetCustomClientScript()
{
return ;
}
function GetOnPageLoadedClientScript()
{
return ;
}
public function ShowEditButtonHandler(&$show)
{
if ($this->GetRecordPermission() != null)
$show = $this->GetRecordPermission()->HasEditGrant($this->GetDataset());
}
public function ShowDeleteButtonHandler(&$show)
{
if ($this->GetRecordPermission() != null)
$show = $this->GetRecordPermission()->HasDeleteGrant($this->GetDataset());
}
public function GetModalGridDeleteHandler() { return 'elenco_clienti_view_modal_delete'; }
protected function GetEnableModalGridDelete() { return true; }
protected function CreateGrid()
{
$result = new Grid($this, $this->dataset, 'elenco_clienti_viewGrid');
if ($this->GetSecurityInfo()->HasDeleteGrant())
$result->SetAllowDeleteSelected(true);
else
$result->SetAllowDeleteSelected(false);
ApplyCommonPageSettings($this, $result);
$result->SetUseImagesForActions(true);
$result->SetUseFixedHeader(false);
$result->SetShowLineNumbers(false);
$result->SetHighlightRowAtHover(false);
$result->SetWidth('');
$this->CreateGridSearchControl($result);
$this->CreateGridAdvancedSearchControl($result);
$this->AddFieldColumns($result);
$this->AddSingleRecordViewColumns($result);
$this->AddEditColumns($result);
$this->AddInsertColumns($result);
$this->AddPrintColumns($result);
$this->AddExportColumns($result);
$this->AddOperationsColumns($result);
$this->SetShowPageList(true);
$this->SetHidePageListByDefault(false);
$this->SetExportToExcelAvailable(false);
$this->SetExportToWordAvailable(false);
$this->SetExportToXmlAvailable(false);
$this->SetExportToCsvAvailable(false);
$this->SetExportToPdfAvailable(false);
$this->SetPrinterFriendlyAvailable(false);
$this->SetSimpleSearchAvailable(false);
$this->SetAdvancedSearchAvailable(false);
$this->SetFilterRowAvailable(false);
$this->SetVisualEffectsEnabled(true);
$this->SetShowTopPageNavigator(true);
$this->SetShowBottomPageNavigator(true);
//
// Http Handlers
//
//
// View column for descrizione field
//
$column = new TextViewColumn('descrizione', 'Descrizione', $this->dataset);
$column->SetOrderable(true);
$handler = new ShowTextBlobHandler($this->dataset, $this, 'elenco_clienti_viewGrid_descrizione_handler_list', $column);
GetApplication()->RegisterHTTPHandler($handler);//
// View column for descrizione field
//
$column = new TextViewColumn('descrizione', 'Descrizione', $this->dataset);
$column->SetOrderable(true);
$handler = new ShowTextBlobHandler($this->dataset, $this, 'elenco_clienti_viewGrid_descrizione_handler_view', $column);
GetApplication()->RegisterHTTPHandler($handler);
return $result;
}
public function OpenAdvancedSearchByDefault()
{
return false;
}
protected function DoGetGridHeader()
{
return '';
}
}
SetUpUserAuthorization(GetApplication());
try
{
$Page = new elenco_clienti_viewPage("elenco_clienti_view.php", "elenco_clienti_view", GetCurrentUserGrantForDataSource("elenco_clienti_view"), 'UTF-8');
$Page->SetShortCaption('Elenco Clienti View');
$Page->SetHeader(GetPagesHeader());
$Page->SetFooter(GetPagesFooter());
$Page->SetCaption('Elenco Clienti View');
$Page->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource("elenco_clienti_view"));
GetApplication()->SetEnableLessRunTimeCompile(GetEnableLessFilesRunTimeCompilation());
GetApplication()->SetCanUserChangeOwnPassword(
!function_exists('CanUserChangeOwnPassword') || CanUserChangeOwnPassword());
GetApplication()->SetMainPage($Page);
GetApplication()->Run();
}
catch(Exception $e)
{
ShowErrorPage($e->getMessage());
}