';
//id
print '
';
//name
print '
';
print $msg["admin_connecteurs_outauth_anonymgroupname"];
print '
';
//fullname
print '
';
print $msg["admin_connecteurs_outauth_anonymgroupfullname"];
print '
';
$pmbusers_sql = "SELECT userid, username, nom, prenom FROM users";
$pmbusers_res = mysql_query($pmbusers_sql, $dbh);
$pmbusers = array();
while($pmbusers_row = mysql_fetch_assoc($pmbusers_res)) {
$pmbusers[] = $pmbusers_row;
}
$sql = "SELECT esgroup_pmbusernum FROM es_esgroups WHERE esgroup_id = -1";
$res = mysql_query($sql, $dbh);
if (!mysql_numrows($res))
$esg_pmbuserid = 1;
else
$esg_pmbuserid = mysql_result($res, 0, 0);
//pmbuser
print '
';
print '
';
//buttons
print "
";
print '';
}
function update_esgroup_from_form() {
global $msg, $charset,$dbh,$id;
global $es_group_name, $es_group_fullname, $es_group_pmbuserid/*, $es_group_esusers*/, $es_group_emprgroups;
if (!is_array($es_group_esusers))
$es_group_esusers = array($es_group_esusers);
if (!is_array($es_group_emprgroups))
$es_group_emprgroups = array($es_group_emprgroups);
if (!$id) {
//Ajout d'un nouveau groupe
if (!$es_group_name) {
print $msg['es_group_error_emptyfield'];
show_esgroup_form(0, stripslashes($es_group_name), stripslashes($es_group_fullname), stripslashes($es_group_pmbuserid), array(), $es_group_emprgroups);
return false;
}
if (es_esgroup::name_exists($es_group_name)) {
print $msg['es_group_error_namealreadyexists'];
show_esgroup_form(0, stripslashes($es_group_name), stripslashes($es_group_fullname), stripslashes($es_group_pmbuserid), array(), $es_group_emprgroups);
return false;
}
$new_esgroup = es_esgroup::add_new();
$new_esgroup->esgroup_name = $es_group_name;
$new_esgroup->esgroup_fullname = $es_group_fullname;
$new_esgroup->esgroup_pmbuserid = $es_group_pmbuserid;
// $new_esgroup->esgroup_esusers = $es_group_esusers;
$new_esgroup->esgroup_emprgroups = $es_group_emprgroups;
$new_esgroup->commit_to_db();
}
else {
$thegroup = new es_esgroup($id);
if ($the_group->error) {
return false;
}
$thegroup->esgroup_name = $es_group_name;
$thegroup->esgroup_fullname = $es_group_fullname;
$thegroup->esgroup_pmbuserid = $es_group_pmbuserid;
$thegroup->esgroup_esusers = $es_group_esusers;
$thegroup->esgroup_emprgroups = $es_group_emprgroups;
$thegroup->commit_to_db();
}
return true;
}
switch ($action) {
case "add":
show_esgroup_form(0, '', '');
break;
case "edit":
$esg_name='';
$esg_fullname='';
$esg_pmbuserid='';
$esg_esusers=array();
$esg_emprgroups=array();
if ($id) {
$the_group = new es_esgroup($id);
if ($the_group->error) {
$id = 0;
}
else {
$esg_name=$the_group->esgroup_name;
$esg_fullname=$the_group->esgroup_fullname;
$esg_pmbuserid=$the_group->esgroup_pmbuserid;
$esg_esusers=$the_group->esgroup_esusers;
$esg_emprgroups=$the_group->esgroup_emprgroups;
}
}
show_esgroup_form($id, $esg_name, $esg_fullname, $esg_pmbuserid, $esg_esusers, $esg_emprgroups);
break;
case "editanonymous":
show_esgroup_form_anonymous();
break;
case "update":
if (update_esgroup_from_form())
list_groups();
break;
case 'updateanonymous':
if ($es_group_pmbuserid) {
$es_group_pmbuserid += 0;
$sql = "REPLACE INTO es_esgroups SET esgroup_id = -1, esgroup_name = '".$msg["admin_connecteurs_outauth_anonymgroupname"]."', esgroup_fullname = '".$msg["admin_connecteurs_outauth_anonymgroupfullname"]."', esgroup_pmbusernum = ".$es_group_pmbuserid;
mysql_query($sql, $dbh);
}
list_groups();
break;
case "del":
if ($id) {
$the_groupe = new es_esgroup($id);
$the_groupe->delete();
}
list_groups();
break;
default:
list_groups();
break;
}
?>