34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
<?php
|
|
|
|
$definePref = array(
|
|
'NAF4' => array( 'init' => '', 'txt' => 'Afficher les anciens NAF'),
|
|
'NACE' => array( 'init' => '', 'txt' => 'Afficher les codes NACES'),
|
|
'NEWS' => array( 'init' => '', 'txt' => 'Afficher les news Google©'),
|
|
'MAPPY' => array( 'init' => '', 'txt' => 'Afficher les façades d\'immeubles'),
|
|
'CARTES' => array( 'init' => '', 'txt' => 'Afficher les cartes et les plans'),
|
|
'VOIRSURV' => array( 'init' => '', 'txt' => 'Afficher les entités sous surveillances'),
|
|
);
|
|
|
|
function hasPref($name, $userInfo = ''){
|
|
$return = FALSE;
|
|
if($userInfo == '' && isset($_SESSION['tabInfo']['pref']) ){
|
|
$userInfo = $_SESSION['tabInfo'];
|
|
}elseif($userInfo == '' && !isset($_SESSION['tabInfo']['pref']) ||
|
|
!isset($userInfo['pref'])){
|
|
$userInfo = array( 'pref' => '' );
|
|
}
|
|
if (preg_match('/\b'.$name.'\b/i', $userInfo['pref'])) $return = TRUE;
|
|
return $return;
|
|
}
|
|
|
|
function formElementPref($userInfo){
|
|
global $definePref;
|
|
$inputElements = '';
|
|
foreach($definePref as $pref => $infos){
|
|
(hasPref($pref, $userInfo)==TRUE) ? $checked = 'checked' : $checked = $infos['init'];
|
|
$inputElements.= '<input type="checkbox" name="frmOptions[pref][]" value="'.strtolower($pref).'" '.$checked.' class="noborder"/> '.$infos['txt'].'<br/>'."\n";
|
|
}
|
|
return $inputElements;
|
|
}
|
|
|
|
?>
|