28 lines
1.0 KiB
PHP
28 lines
1.0 KiB
PHP
|
<?php
|
|||
|
|
|||
|
$definePref = array(
|
|||
|
'NAF4' => array( 'init' => '', 'txt' => 'Afficher les anciens NAF'),
|
|||
|
'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<69>s sous surveillances'),
|
|||
|
);
|
|||
|
|
|||
|
function hasPref($name, $userInfo = ''){
|
|||
|
$return = FALSE;
|
|||
|
if($userInfo == ''){ $userInfo = $_SESSION['tabInfo']; }
|
|||
|
if (preg_match('/'.$name.'/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.'/> '.$infos['txt'].'<br/>';
|
|||
|
}
|
|||
|
return $inputElements;
|
|||
|
}
|
|||
|
|
|||
|
?>
|