getCatalog();
}
if (!$dom) {
$dom=$ac->setDomain($id);
}
echo window_title($database_window_title.$msg[7].$msg[1003].$msg[1001]);
//construction menu
$admin_menu_acces = "
".htmlentities($msg["admin_menu_acces"], ENT_QUOTES, $charset)." > !!menu_sous_rub!!
";
$admin_menu_acces.= "";
$admin_menu_acces=str_replace('!!menu_sous_rub!!',$menu_sous_rub, $admin_menu_acces);
$admin_layout = str_replace('!!menu_contextuel!!', $admin_menu_acces, $admin_layout);
print $admin_layout;
function show_domain($id,$maj=false) {
global $dbh, $msg, $charset;
global $dom;
global $dom_view_form, $dom_glo_rights_form,$maj_form;
$form = $dom_view_form;
//affichage lien roles utilisateurs
$txt = htmlentities($dom->getComment('user_prf_lib'),ENT_QUOTES,$charset);
$row = "$txt |
";
//affichage lien profils ressources
$txt = htmlentities($dom->getComment('res_prf_lib'),ENT_QUOTES,$charset);
$row.= "$txt |
";
$form = str_replace ('', $row, $form);
//affichage droits
$r_header = $msg['dom_rights_lib'];
$form = str_replace ('!!rights_header!!', htmlentities($r_header, ENT_QUOTES, $charset), $form);
//recuperation roles utilisateurs
$t_u[0]= $dom->getComment('user_prf_def_lib'); //role par defaut
$qu=$dom->loadUsedUserProfiles();
$ru=mysql_query($qu, $dbh);
if (mysql_num_rows($ru)) {
while(($row=mysql_fetch_object($ru))) {
$t_u[$row->prf_id]= $row->prf_name;
}
}
//print '';print_r($t_u);print '
';
//recuperation profils ressources
$t_r[0]=$dom->getComment('res_prf_def_lib'); //profil par defaut
$qr=$dom->loadUsedResourceProfiles();
$rr=mysql_query($qr, $dbh);
if (mysql_num_rows($rr)) {
while(($row=mysql_fetch_object($rr))) {
$t_r[$row->prf_id]= $row->prf_name;
}
}
//print '';print_r($t_r);print '
';
//Recuperation des controles dependants de l'utilisateur
$t_ctl=$dom->getControls(0);
//print '';print_r($t_ctl);print '
';
//Recuperation des controles independants de l'utilisateur
$t_ctli=$dom->getControls(1);
//print '';print_r($t_ctl);print '
';
//Recuperation des droits
$t_rights = $dom->loadDomainRights();
//print '';print_r($t_rights);print '
';
//creation du formulaire
//droits independants des profils
if (count($t_ctli)) {
$r_rows = "";
foreach($t_ctli as $k2=>$v2) {
$r_rows.="
|
|
";
}
$dom_glo_rights_form = str_replace ('', $r_rows, $dom_glo_rights_form);
$form = str_replace('',$dom_glo_rights_form,$form);
}
//droits par profils
$nb_u=count($t_u);
$nb_r=count($t_r);
if ($nb_u && $nb_r) {
$dom_usr_sel= "";
$dom_nb_col_sel= "";
$form = str_replace('',htmlentities($msg['dom_prf_rights_lib'],ENT_QUOTES,$charset),$form);
//1ere colonne
$nr=10;
$l_form="";
foreach($t_r as $k=>$v) {
if(!$nr) {
$l_form.="";
$nr=10;
}
$nr--;
$l_form.= "".htmlentities($v, ENT_QUOTES, $charset)."
";
}
$form = str_replace ('', $l_form, $form);
//autres colonnes
$n_col=1;
foreach($t_u as $k1=>$v1) {
$form = str_replace ('', "5)?"style='display:none'":'')." >
", $form);
$n_col++;
$r_form = "".htmlentities($v1, ENT_QUOTES, $charset)."
";
$nr=10;
foreach($t_r as $k2=>$v2) {
if(!$nr) {
$r_form = str_replace('',"".htmlentities($v1, ENT_QUOTES, $charset)."
",$r_form);
$nr=10;
}
$nr--;
$r_rows = "";
$r_form = str_replace('', $r_rows.'', $r_form);
}
$form = str_replace ('', $r_form, $form);
}
}
//bouton enregistrer
$bt_enr = "";
$form = str_replace('', $bt_enr,$form);
//bouton appliquer
$bt_app = "";
$form = str_replace('', $bt_app,$form);
$chk_sav_spe_rights = " ";
$form = str_replace('', $chk_sav_spe_rights, $form);
//bouton raz droits calculés
$bt_raz ="";
$form = str_replace('', $bt_raz,$form);
if ($maj) {
$form = str_replace('',$maj_form,$form);
}
print $form;
}
switch ($action) {
case 'update' :
$dom->saveDomainRights($chk_rights);
show_domain($id,true);
break;
case 'raz' :
$dom->deleteDomainRights();
case 'view' :
default:
show_domain($id);
break;
}
?>