19 function buildMenu( $menu, $tree, $pages, $active = NULL ) {
30 logWrite(
'elaboro il menu ' . $menu,
'menu', LOG_DEBUG );
33 if( is_array( $tree ) ) {
36 logWrite(
'voci da elaborare per il menu ' . $menu .
': ' . count( $tree ),
'menu', LOG_DEBUG );
39 foreach( $tree as
$k => $v ) {
42 logWrite(
'elaboro la pagina ' .
$k .
' per il menu ' . $menu,
'menu', LOG_DEBUG );
64 if( isset( $pages[
$k ][
'menu'][ $menu ] ) ) {
66 if( ! empty( $pages[
$k ][
'menu'][ $menu ][
'label'] ) || ( count( $v ) > 0 && in_array(
$k, $pages[ $active ][
'parents'][
'id'] ) ) ) {
68 if( ! isset( $pages[
$k ][
'auth'][
'groups'] ) || ( isset(
$_SESSION[
'account'][
'gruppi'] ) && count( array_intersect( $pages[ $k ][
'auth'][
'groups'],
$_SESSION[
'account'][
'gruppi'] ) ) > 0 ) ) {
79 $key = $pages[
$k ][
'menu'][ $menu ][
'priority'] .
'|' .
$k;
82 if( empty( $pages[ $k ][
'menu'][ $menu ][
'label'] ) ) {
83 logWrite(
'voce vuota: ' . $k .
' -> ' . $menu .
': ' . $key,
'menu', LOG_ERR );
88 'label' => $pages[ $k ][
'menu'][ $menu ][
'label']
90 'location' => ( ( isset( $pages[ $k ][
'forced'] ) ) ? $pages[ $k ][
'url'] : $pages[ $k ][
'path'] )
92 'target' => ( ( isset( $pages[ $k ][
'menu'][ $menu ][
'target'] ) && ! empty( $pages[ $k ][
'menu'][ $menu ][
'target'] ) ) ? $pages[ $k ][
'menu'][ $menu ][
'target'] : NULL )
94 'active' => ( $k == $active ) ?
true :
false 96 'current' => ( in_array( $k, $pages[ $active ][
'parents'][
'id'] ) ) ?
true :
false 100 logWrite( $k .
' -> ' . $menu .
': ' . $key,
'menu', LOG_DEBUG );
110 in_array( $k, $pages[ $active ][
'parents'][
'id'] )
112 ! isset( $pages[ $k ][
'menu'][ $menu ][
'subpages'] )
114 $pages[ $k ][
'menu'][ $menu ][
'subpages'] !=
'NEVER_SHOW' 119 isset( $pages[ $k ][
'menu'][ $menu ][
'subpages'] )
121 $pages[ $k ][
'menu'][ $menu ][
'subpages'] ==
'ALWAYS_SHOW' 125 logWrite(
'vado in ricorsione per ' . $k .
' -> ' . $menu,
'menu', LOG_DEBUG );
126 $nav[ $key ][
'content'] =
buildMenu( $menu, $v, $pages, $active );
132 logWrite(
'permessi insufficienti per visualizzare la pagina ' . $k .
' nel menu ' . $menu,
'menu', LOG_DEBUG );
139 logWrite(
'la pagina ' .
$k .
' non ha label nel menu ' . $menu .
' e non fa parte del path della pagina attiva',
'menu', LOG_DEBUG );
146 logWrite(
'la pagina ' .
$k .
' non appartiene al menu ' . $menu,
'menu', LOG_DEBUG );
155 logWrite(
'albero malformato (non è un array)',
'menu', LOG_DEBUG );
160 ksort( $nav, SORT_NUMERIC );
181 if( is_array(
$page[
'parents'] ) ) {
184 foreach(
$page[
'parents'][
'id'] as
$k => $v ) {
187 if( ! empty( $v ) ) {
191 'location' =>
$page[
'parents'][
'path'][
$k ],
192 'label' =>
$page[
'parents'][
'h1'][ $k ],
193 'active' => ( $v == $active ) ?
true :
false 218 if( isset(
$page[
'path'] ) && is_array(
$page[
'path'] ) ) {
221 foreach(
$page[
'path'] as
$k => $v ) {
225 'location' =>
$page[
'path'][
$k ],
226 'country' => strtolower( substr( $k, strpos( $k,
'-' ) + 1 ) ),
227 'active' => ( $k == $lang ) ?
true :
false 233 logWrite(
'generate ' . count( $nav ) .
' bandiere per il cambio lingua',
'localization', LOG_DEBUG );
238 logWrite(
'impossibile generare le bandiere per il cambio lingua',
'localization', LOG_NOTICE );
logWrite( $m, $f='site', $l=LOG_NOTICE, $d=DIRECTORY_LOG, $t=CURRENT_LOG_LEVEL, $s=SITE_STATUS)
scrive un messaggio nei log del sito
if(isset( $_REQUEST['amazonCheckoutSessionId'])) $_SESSION['carrello']