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
if (count($t_u) && count($t_r)) {
$form = str_replace('',htmlentities($msg['dom_prf_rights_lib'],ENT_QUOTES,$charset),$form);
$theader = " | ";
foreach($t_u as $k=>$v) {
$theader.= "".htmlentities($v, ENT_QUOTES, $charset)." | ";
}
$theader.="
";
$form = str_replace ('', $theader.'', $form);
foreach($t_r as $k1=>$v1) {
$r_form = "!!res_prf_header!! | ";
$lheader = htmlentities($v1, ENT_QUOTES, $charset);
$r_form = str_replace('!!res_prf_header!!', $lheader, $r_form);
foreach($t_u as $k=>$v) {
$r_form.= " | ";
$r_rows = "";
foreach($t_ctl as $k2=>$v2) {
$r_rows.="
---|
|
|
";
}
$r_form = str_replace('', $r_rows, $r_form);
}
$form = str_replace ('', $r_form.'', $form);
$r_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);
if ($maj) {
$form = str_replace('',$maj_form,$form);
}
print $form;
}
switch ($action) {
case 'update' :
$dom->saveDomainRights($chk_rights);
show_domain($id,true);
break;
case 'view' :
default:
show_domain($id);
break;
}
?>