".$msg["admin_connecteurs_setcateg_name"]." ".$msg["admin_connecteurs_setcateg_setcount"]." "; $parity=1; foreach($categs->categs as &$acateg) { $pair_impair = $parity++ % 2 ? 'even' : 'odd'; $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"document.location='./admin.php?categ=connecteurs&sub=categout_sets&action=edit&id=$acateg->id';\" "; print ""; print "".htmlentities($acateg->name ,ENT_QUOTES, $charset).""; print "".count($acateg->sets).""; print ""; } if (!count($categs->categs)) { print ''.$msg["admin_connecteurs_sets_nosetcateg"].''; } print " "; } function show_categ_form($id=0, $setcateg_name='', $setcateg_sets=array()) { global $msg, $charset; print '
'; if (!$id) print '

'.$msg['admin_connecteurs_setcateg_add'].'

'; else print '

'.$msg['admin_connecteurs_setcateg_edit'].'

'; print '
'; //id print ''; //name print '

'; print '
'; //included sets $out_sets = new connector_out_sets(); $included_sets = ''; print '

'; print $included_sets; print '
'; //buttons print "
"; print " "; print ''; print "
"; if ($id) { print confirmation_delete("./admin.php?categ=connecteurs&sub=categout_sets&action=del&id="); print ""; } print "
 "; print ''; } function update_setcateg_from_form() { global $msg, $charset,$dbh,$id; global $setcateg_name, $setcateg_sets; if (!$id) { //Ajout d'un nouveau set if (!$setcateg_name) { print $msg['admin_connecteurs_setcateg_emptyfield']; show_categ_form(0, stripslashes($setcateg_name)); return false; } if (connector_out_setcateg::name_exists($set_caption)) { print $msg['admin_connecteurs_setcateg_namealreadyexists']; show_categ_form(0, stripslashes($setcateg_name)); return false; } $new_setcateg = connector_out_setcateg::add_new(); $new_setcateg->name = $setcateg_name; $new_setcateg->sets = $setcateg_sets; $new_setcateg->commit_to_db(); } else { $thecateg = new connector_out_setcateg($id); if ($thecateg->error) { return false; } $thecateg->caption = $setcateg_name; $thecateg->sets = $setcateg_sets; $thecateg->commit_to_db(); } return true; } switch ($action) { case "add": show_categ_form(0, '', array()); break; case "edit": $categ_name=''; $categ_sets=array(); if ($id) { $the_categ = new connector_out_setcateg($id); if ($the_categ->error) { $id = 0; } else { $categ_name=$the_categ->name; $categ_sets=$the_categ->sets; } } show_categ_form($id, $categ_name, $categ_sets); break; case "update": if (update_setcateg_from_form()) list_categ(); break; case "del": if ($id) { $the_categ = new connector_out_setcateg($id); $the_categ->delete(); } list_categ(); break; default: list_categ(); break; } ?>