getCatalog();
}
if (empty($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;
//Affiche la liste des profils ressources
function show_res_prf_list($id,$maj=false) {
global $dbh, $msg, $charset;
global $dom;
global $res_prf_list_form,$used_list_form,$maj_form;
$form = $res_prf_list_form;
$form = str_replace('!!form_title!!', htmlentities($dom->getComment('res_prf_lib'), ENT_QUOTES, $charset), $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);
$t=$dom->getResourceProperties();
if (count($t)) {
$p_form = "";
foreach($t as $k=>$v){
$p_form.= "";
$p_form.= "";
$p_form.= " ";
$p_form.= "
";
}
$form = str_replace('', $p_form, $form);
}
$rows ="".htmlentities($msg['dom_prf_name'], ENT_QUOTES, $charset)." | ".htmlentities($msg['dom_prf_use'], ENT_QUOTES, $charset)." | ".htmlentities($msg['dom_prf_rule'], ENT_QUOTES, $charset)." |
";
$parity = 1;
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='odd'\" ";
$rows.= "";
$rows.= "".htmlentities($dom->getComment('res_prf_def_lib'), ENT_QUOTES, $charset)." | ";
$rows.= " | ";
$rows.= " | ";
$rows.= "
";
$q=$dom->loadResourceProfiles();
$r=pmb_mysql_query($q, $dbh);
if (pmb_mysql_num_rows($r)) {
//generation selecteur
$selector = "";
$selector .= "";
pmb_mysql_data_seek($r,0);
while(($row=pmb_mysql_fetch_object($r))) {
if ($parity % 2) {
$pair_impair = 'even';
} else {
$pair_impair = 'odd';
}
$parity += 1;
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" ";
$rows.= "";
$rows.= " | ";
$rows.= "";
$rows.= $selector;
$rows = str_replace('!!sel_name!!', "prf_used[".$row->prf_id."]", $rows);
$rows = str_replace('!!sel_script!!', "document.getElementById(\"prf_used[".$row->prf_id."]\").value=\"".$row->prf_used."\";" ,$rows);
$rows.= " | ";
$rows.= "";
$rows.= nl2br(htmlentities($row->prf_hrule,ENT_QUOTES, $charset));
$rows.= "";
$rows.= " | ";
$rows.= "";
$rows.= "";
$rows.= "
";
}
}
$used_list_form = str_replace('!!used_list_lib!!', htmlentities($dom->getComment('res_prf_used_list_lib'),ENT_QUOTES,$charset),$used_list_form);
$used_list_form = str_replace('', $rows,$used_list_form);
$form = str_replace('',$used_list_form,$form);
$bt_calc = "getComment('res_prf_bt_calc')."\" class='bouton' />";
$form = str_replace('', $bt_calc,$form);
$bt_enr = "";
$form = str_replace('', $bt_enr,$form);
$bt_sup = "";
$form = str_replace('', $bt_sup,$form);
if ($maj) {
$form = str_replace('',$maj_form,$form);
}
print $form;
}
//Affiche la liste des profils ressources apres calcul
function show_calc_res_prf_list($id) {
global $dbh,$msg,$charset;
global $dom;
global $res_prf_list_form,$calc_list_form,$unused_list_form;
global $chk_prop;
$form = $res_prf_list_form;
$form = str_replace('!!form_title!!', htmlentities($dom->getComment('res_prf_lib'), ENT_QUOTES, $charset), $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);
$t=$dom->getResourceProperties();
if (count($t)) {
$p_form = "";
foreach($t as $k=>$v){
$p_form.= "";
$p_form.= "";
$p_form.= " ";
$p_form.= "
";
}
$form = str_replace('', $p_form, $form);
}
$rows = "".htmlentities($msg['dom_prf_name'], ENT_QUOTES, $charset)." | ".htmlentities($msg['dom_prf_rule'], ENT_QUOTES, $charset)." |
---|
";
$parity = 1;
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='odd'\" ";
$rows.= "
";
$rows.= "".htmlentities($dom->getComment('res_prf_def_lib'), ENT_QUOTES, $charset)." | ";
$rows.= " | ";
$rows.= "
";
//nouveaux profils
$t_calc=$dom->calcResourceProfiles($chk_prop);
$t_reused=array();
if (count($t_calc)) {
foreach($t_calc as $k=>$v) {
if ($v['old']) $t_reused[]=$v['old'];
if ($parity % 2) {
$pair_impair = 'even';
} else {
$pair_impair = 'odd';
}
$parity += 1;
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" ";
$rows.= "";
$rows.= "".htmlentities($v['name'], ENT_QUOTES, $charset)." | ";
$rows.= "";
$rows.= "";
$rows.= nl2br(htmlentities($v['hrule'],ENT_QUOTES, $charset));
$rows.= "";
$rows.= " | ";
$rows.= "";
$rows.= "";
$rows.= "";
$rows.= "
";
}
}
$calc_list_form = str_replace('!!calc_list_lib!!', htmlentities($dom->getComment('res_prf_calc_list_lib'),ENT_QUOTES,$charset),$calc_list_form);
$calc_list_form = str_replace('', $rows,$calc_list_form);
$form = str_replace('', $calc_list_form,$form);
//anciens profils inutilises a reaffecter
$q_unused=$dom->loadUsedResourceProfiles($t_reused);
$r_unused=pmb_mysql_query($q_unused,$dbh);
if(pmb_mysql_num_rows($r_unused)){
//generation selecteur
$selector = "";
$selector .= "";
$parity = 0;
$rows="".htmlentities($msg['dom_prf_name'], ENT_QUOTES, $charset)." | ".htmlentities($msg['dom_prf_use'], ENT_QUOTES, $charset)." | ".htmlentities($msg['dom_prf_rule'], ENT_QUOTES, $charset)." |
---|
";
while(($row_unused=pmb_mysql_fetch_object($r_unused))) {
if ($parity % 2) {
$pair_impair = 'even';
} else {
$pair_impair = 'odd';
}
$parity += 1;
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" ";
$rows.= "
";
$rows.= "".htmlentities($row_unused->prf_name, ENT_QUOTES, $charset)." | ";
$rows.= "";
$rows.= $selector;
$rows = str_replace('!!sel_name!!', "prf_used[".$row_unused->prf_id."]", $rows);
$rows = str_replace('!!sel_script!!', "document.getElementById(\"prf_used[".$row_unused->prf_id."]\").value=\"".$row_unused->prf_used."\";" ,$rows);
$rows.= " | ";
$rows.= "";
$rows.= nl2br(htmlentities($row_unused->prf_hrule,ENT_QUOTES, $charset));
$rows.= " | ";
$rows.= "";
$rows.= "
";
}
$unused_list_form = str_replace('!!unused_list_lib!!',htmlentities($dom->getComment('res_prf_unused_list_lib'),ENT_QUOTES,$charset),$unused_list_form);
$unused_list_form = str_replace('',$rows,$unused_list_form);
$form = str_replace('',$unused_list_form,$form);
}
$bt_calc = "getComment('res_prf_bt_calc')."\" class='bouton' />";
$form = str_replace('', $bt_calc,$form);
$bt_enr = "";
$form = str_replace('', $bt_enr,$form);
print $form;
}
switch ($action) {
case'calc' :
if (count($chk_prop)) {
show_calc_res_prf_list($id);
} else {
error_form_message(addslashes($msg['dom_prop_chx_err']));
}
break;
case 'update' :
if (!isset($unused_prf_id)) {
$unused_prf_id = array();
}
$dom->saveResourceProfiles($prf_id, $prf_lib, $prf_rule, $prf_hrule, $prf_used, $unused_prf_id);
show_res_prf_list($id,true);
break;
case 'delete' :
$dom->deleteResourceProfiles();
show_res_prf_list($id);
break;
case 'list':
default:
show_res_prf_list($id);
break;
}
?>