".$archivo."";
for ($i = 0 ; $i < count($file); $i++) {
if(strlen(trim($file[$i]))>0){ //No tratamos lineas en blanco
$line=split (";", $file[$i]) ;
if (count($line)!=count($fields)) {
print("
"._("Unknown file format")."
");
exit ;
}
//cargamos los campos
$count=0;
foreach ($line as $value){
$campo=$fields[$count];
$cells[$i][$campo] =utf8_encode(trim($value));
$count++;
}
}
}
} else {
$status =_("An error has occurred while uploading the file");
print ($status);
exit;
}
}
else {
$status = _("An error has occurred while uploading the file");
print ($status);
exit;
}
// //print $status;
echo "
"._("Imported Groups")."
"._("Code")." |
"._("Full Name")." |
";
$numgroups=0;
$groupsfail=0;
$excludes = array() ;
//Validamos Campos
foreach ($cells as $key => $value){
$error=0;
foreach ($fields as $field) {
//muestra($key." => ".$value[$field]) ;
switch ($field) {
case "code":
if (existGroup($ldap,$value[$field])){
$error=1;
}
break;
case "fullName":
// if ($value[$field] == ""){
// //muestra(" *** El usuario de tener Nombre y Apellidos"."
");
// $error=2;
// }else{
// $value[$field]=$value[$field];
// }
break;
}
}
if ($error==0 && @createGroup ($ldap, $value["code"], $value["fullName"])){
//muestra($value["Template"].";".$value["fullName"].";".$value["userName"].";".$value["password"].";".$value["groups"].";".$value["profile"]);
print "";
print("".$value["code"]." | "."".$value["fullName"]." | ");
print "
";
$numgroups++;
}else{
switch ($error) {
case 1:
$mensaje=_("The group already exists");
break;
case 2:
$mensaje=_("Wrong description");
break;
default:
$mensaje=_("Error LDAP");
}
//muestra("ERROR: ".$error);
$nogroups=$nogroups."".$value["code"]." | "."".$value["fullName"]." | ".$mensaje." |
";
$groupsfail++;
}
}
print "
Total {$numgroups} "._("groups")." |
";
print "
";
//Tabla erroneos
if ($groupsfail>0){
echo "
";
echo "
"._("Not Imported Groups")."
"._("Code")." |
"._("Full Name")." |
"._("Error")." |
";
echo $nogroups;
print "
Total {$groupsfail} "._("groups")." |
";
print "
";
}
}
?>