GlisWeb framework
_default.view.php
Vai alla documentazione di questo file.
1 <?php
2 
12  // debug
13  // print_r( $_REQUEST );
14 
15  // innesco la GET
16  // $_REQUEST['__view__'][ $ct['view']['id'] ] = array();
17 
18  // debug
19  // print_r( $ct['page']['backurl'] );
20 /*
21  // costruisco il backurl dall'id della backpage
22  if( isset( $ct['view']['backpage'] ) ) {
23  $ct['view']['backurl'] = urlencode( $ct['pages'][ $ct['view']['backpage'] ]['url'][ $cf['localization']['language']['ietf'] ] . '?' . (
24  ( isset( $ct['etc']['table'] ) )
25  ? $ct['etc']['table'] . '[id]=' . $_REQUEST[ $ct['etc']['table'] ]['id'] . '&' . $ct['etc']['table'] . '[__method__]=get&__backurl__='
26  : NULL
27  ) );
28  }
29 */
30  // id della vista
31  if( ! isset( $ct['view']['id'] ) ) {
32  $ct['view']['id'] = md5(
33  $ct['view']['table']
34  );
35  }
36 
37  // aggiungo le colonne da prelevare
38  // $_REQUEST['__view__'][ $ct['view']['id'] ]['__fields__'] = array_keys( $ct['view']['cols'] );
39  // $ct['view']['data']['__fields__'] = array_keys( $ct['view']['cols'] );
40  $_REQUEST['__view__'][ $ct['view']['id'] ]['__fields__'] = array_keys( $ct['view']['cols'] );
41 
42 # // aggiungo i campi di filtro
43 # if( isset( $_REQUEST['__view__'][ $ct['view']['id'] ]['__filters__'] ) ) {
44 # $ct['view']['data']['__filters__'] = $_REQUEST['__view__'][ $ct['view']['id'] ]['__filters__'];
45 # }
46 
47 # // aggiungo la ricerca
48 # if( isset( $_REQUEST['__view__'][ $ct['view']['id'] ]['__search__'] ) ) {
49 # $ct['view']['data']['__search__'] = $_REQUEST['__view__'][ $ct['view']['id'] ]['__search__'];
50 # }
51 
52 # // aggiungo l'ordinamento
53 # if( isset( $_REQUEST['__view__'][ $ct['view']['id'] ]['__sort__'] ) ) {
54 # $ct['view']['data']['__sort__'] = $_REQUEST['__view__'][ $ct['view']['id'] ]['__sort__'];
55 # }
56 
57  // imposto la paginazione
58  if( ! isset( $_REQUEST['__view__'][ $ct['view']['id'] ]['__pager__']['page'] ) ) {
59  $_REQUEST['__view__'][ $ct['view']['id'] ]['__pager__']['page'] = 0;
60  }
61  if( ! isset( $_REQUEST['__view__'][ $ct['view']['id'] ]['__pager__']['rows'] ) ) {
62  $_REQUEST['__view__'][ $ct['view']['id'] ]['__pager__']['rows'] = 20;
63  }
64 
65 # // paginazione
66 # $ct['view']['data']['__pager__'] = $_REQUEST['__view__'][ $ct['view']['id'] ]['__pager__'];
67 
68  // debug
69  // print_r( $_REQUEST[ $ct['etc']['table'] ]['id'] );
70  // print_r( $_REQUEST['__view__'][ $ct['view']['id'] ][ $ct['page']['id'] . '_' . $_REQUEST[ $ct['etc']['table'] ]['id'] ] );
71 /*
72  //
73  if( isset( $ct['etc']['table'] ) && isset( $_REQUEST['__view__'][ $ct['view']['id'] ][ $ct['page']['id'] . '_' . $_REQUEST[ $ct['etc']['table'] ]['id'] ] ) ) {
74  $_REQUEST['__view__'][ $ct['view']['id'] ] = array_replace_recursive(
75  $_REQUEST['__view__'][ $ct['view']['id'] ],
76  $_REQUEST['__view__'][ $ct['view']['id'] ][ $ct['page']['id'] . '_' . $_REQUEST[ $ct['etc']['table'] ]['id'] ]
77  );
78  }
79 */
80  // debug
81  // print_r( $filters );
82 
83  // prelevamento dei dati
84  // controller( $cf['mysql']['connection'], $_REQUEST['__view__'][ $ct['view']['id'] ], $ct['view']['table'], METHOD_GET, NULL, $_REQUEST['__err__'][ $k ] );
85  controller( $cf['mysql']['connection'], $ct['view']['data'], $ct['view']['table'], METHOD_GET, NULL, $_REQUEST['__err__'][ $ct['view']['id'] ], $_REQUEST['__view__'][ $ct['view']['id'] ] );
86 #print_r( $_REQUEST['__view__'][ $ct['view']['id'] ]);
87 #print_r( $_REQUEST['__view__'][ $ct['view']['id'] ]);
88  // debug
89  // echo 'dati: ' . print_r( $ct['view']['data'], true );
90 
91  // campo di gestione di default
92  if( ! isset( $ct['view']['open']['field'] ) ) {
93  $ct['view']['open']['field'] = 'id';
94  }
95 
96  // tabella di gestione di default
97  if( ! isset( $ct['view']['open']['table'] ) ) {
98  $ct['view']['open']['table'] = $ct['view']['table'];
99  }
100 
101  // debug
102  // echo $ct['view']['open']['table'] . PHP_EOL;
103 
104  // pagina di inserimento
105  if( ! isset( $ct['view']['insert']['page'] ) && isset( $ct['view']['open']['page'] ) ) {
106  $ct['view']['insert']['page'] = $ct['view']['open']['page'];
107  }
108 
109  // percorso della pagina di gestione
110  if( isset( $ct['view']['open']['page'] ) && ! empty( $ct['view']['open']['page'] ) && ( getAclPermission( $ct['view']['table'], METHOD_PUT ) || getAclPermission( $ct['view']['table'], METHOD_GET ) ) ) {
111 // if( isset( $ct['view']['open']['page'] ) && ! empty( $ct['view']['open']['page'] ) ) {
112  $ct['view']['open']['path'] = $cf['contents']['pages'][ $ct['view']['open']['page'] ]['path'][ $cf['localization']['language']['ietf'] ];
113  }
114 
115  // percorso della pagina di inserimento
116  if( isset( $ct['view']['insert']['page'] ) && ! empty( $ct['view']['insert']['page'] ) && getAclPermission( $ct['view']['table'], METHOD_POST ) ) {
117 // if( isset( $ct['view']['insert']['page'] ) && ! empty( $ct['view']['insert']['page'] ) ) {
118  $ct['view']['insert']['path'] = $cf['contents']['pages'][ $ct['view']['insert']['page'] ]['path'][ $cf['localization']['language']['ietf'] ];
119  }
120 
121  // debug
122  // print_r( $_REQUEST['__view__'][ $ct['view']['id'] ] );
123  // print_r( $_SESSION );
124  // print_r( $_REQUEST );
125  // var_dump( $ct['view']['table'] );
126  // echo 'dati: ' . print_r( $ct['view']['data'], true );
127  // print_r( $_REQUEST['__err__'][ $k ] );
128  // print_r( $ct['view']['data'] );
129  // print_r( $ct['view']['open'] );
130  // print_r( $ct['pages'] );
131 
132 ?>
if(isset( $cx['contatti'])) if(isset( $cf['site']['contatti'])) $ct['contatti']
Definition: _035.common.php:24
controller( $c, &$d, $t, $a=METHOD_GET, $p=NULL, &$e=array(), &$i=array(), &$pi=array())
$cf['ricerca']['template']
Definition: _030.common.php:7
const METHOD_POST
Definition: _config.php:282
if(! isset( $ct['view']['id'])) $_REQUEST['__view__'][ $ct['view']['id']]['__fields__']
const METHOD_GET
Definition: _config.php:280
const METHOD_PUT
Definition: _config.php:283
getAclPermission( $t, $a, &$i=NULL)
Definition: _acl.utils.php:44