Container::getRouter()->generate('administration'),'name' => get_lang('PlatformAdmin')); $htmlHeadXtra[] = ''; $annee = $_GET['annee']; $composante = $_GET['composante']; $etape = $_GET['etape']; $course = $_POST['course']; // form1 annee = 0; composante= 0 etape = 0 //if ($annee == "" && $composante == "" && $etape == "") { if (empty($annee) && empty($course)) { Display::display_header($tool_name); echo '
'; Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')); echo get_lang('LDAPSelectFilterOnUsersOU'); //echo ''.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'
'; ///echo get_lang('FollowEachOfTheseStepsStepByStep').'
'; echo '

'; echo ''.get_lang('LDAPOUAttributeFilter').' : '; echo '
'; echo ''; echo '
'; echo '
'; } /* elseif ($annee <> "" && $composante == "" && $etape == "") // form 2 annee != 0; composante= 0 etape = 0 { Display::display_header($tool_name); $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); ldap_set_version($ds); if ($ds) { $r = false; $res = ldap_handle_bind($ds, $r); //$sr = @ ldap_search($ds, "o=groups,$ldap_basedn", "(&(description=etape*)(cn=*$annee))", array ('cn')); //$sr = @ ldap_search($ds, "ou=$annee, ou=diploma, o=paris1, $ldap_basedn", "ou=02*", array ('description')); //$sr = @ ldap_search($ds, "ou=structures, o=paris1, $ldap_basedn", "businessCategory=pedagogy", array ('ou','description')); $sr = ldap_search($ds, $ldap_basedn, "(ou=*$annee)", array ('ou','description')); // "ou=2006,ou=diploma,o=Paris1,dc=univ-paris1,dc=fr $info = ldap_get_entries($ds, $sr); $composante = array(); for($i = 0; $i < $info['count']; $i ++) { //presupose LDAP server is UTF-8 $composante[$info[$i]['ou'][0]] = api_utf8_decode($info[$i]['description'][0], api_get_system_encoding()); } $oucompotab3=$composante; echo '
'; echo '
'; echo '

'.Display::return_icon('group.gif', get_lang('SelectComponent')).' '.get_lang('SelectComponent').'

'; echo '
'; echo ''.get_lang('RegistrationYear').' : '; echo ''; echo ''.get_lang('Component').' : '; echo ''; echo '
'; echo '
'; echo ''; echo '
'; ldap_close($ds); } echo '
'; echo '
'; echo '
'; echo ''.get_lang('BackToNewSearch').''; echo '
'; echo '
'; } elseif ($annee <> "" && $composante <> "" && $etape == "") // form3 :annee!=0composante=0etape=0 { Display::display_header($tool_name); echo '
'; echo '

'.Display::return_icon('group.gif', get_lang('SearchResults')).' '.get_lang('SearchResults').'

'; $ds = ldap_connect($ldap_host, $ldap_port); ldap_set_version($ds); if ($ds) { $r = false; $res = ldap_handle_bind($ds, $r); // $sr = @ ldap_search($ds, "ou=groups, $LDAPbasedn", "(&(cn=*$annee*)(cn=*$composante*))"); $sr = @ ldap_search($ds, $ldap_basedn, "ou=$composante", array ('ou','description')); //echo "Le nombre de resultats est : ".ldap_count_entries($ds,$sr)."

"; $info = ldap_get_entries($ds, $sr); for ($i = 0; $i <= $info['count']; $i ++) { $description = $info[$i]['description']; $ouetapetab[$i] = $description[0]; $description2 = $info[$i]['ou']; $ouetapetab2[$i] = $description2[0]; } asort($ouetapetab); reset($ouetapetab); echo '

'; echo ''.get_lang('RegistrationYear').':'; echo '

'; echo ''.get_lang('Component').' :'; echo '
'; echo '

'.get_lang('SelectStepAcademicYear').'

'; echo '
'; echo ''.get_lang('Step').': '; echo ''; echo ''; echo '
'; echo ''; echo '
'; ldap_close($ds); } else { // echo "

Unable to connect to LDAP server

"; } echo '
'; echo '
'; echo ''.get_lang('BackToNewSearch').''; echo '
'; } */ elseif(!empty($annee) && empty($course)) { Display::display_header($tool_name); echo '
'; echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'
'; echo '

'; echo ''; echo ''; echo '
'; echo '
'; } // form4 annee != 0; composante != 0 etape != 0 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') { elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed'])) { Display::display_header($tool_name); echo '
'; echo '
'; echo '
'; echo '

'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'

'; //echo "Connection ..."; $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); ldap_set_version($ds); if ($ds) { $r = false; $res = ldap_handle_bind($ds, $r); //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))"); //echo "(ou=*$annee,ou=$composante)"; $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); $info = ldap_get_entries($ds, $sr); for ($key = 0; $key < $info["count"]; $key ++) { $nom_form[] = $info[$key]["sn"][0]; $prenom_form[] = $info[$key]["givenname"][0]; $email_form[] = $info[$key]["mail"][0]; // Get uid from dn //$dn_array=ldap_explode_dn($info[$key]["dn"],1); //$username_form[] = $dn_array[0]; // uid is first key $username_form[] = $info[$key]['uid'][0]; $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" //$val = ldap_get_values_len($ds, $entry, "userPassword"); //$password_form[] = $val[0]; $password_form[] = $info[$key]['userPassword'][0]; } ldap_unbind($ds); /*-----------------------------------------------*/ asort($nom_form); reset($nom_form); $statut=5; include ('ldap_form_add_users_group.php'); } else { echo '

'.get_lang('UnableToConnectTo').' '.$host.'

'; } echo '

'; echo ''.get_lang('BackToNewSearch').''; echo '

'; echo '
'; } elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes')) { $id=$_POST['username_form']; $UserList=array(); $userid_match_login = array(); foreach ($id as $form_index=>$user_id) { if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) { $tmp = ldap_add_user($user_id); $UserList[]= $tmp; $userid_match_login[$tmp] = $user_id; } } if (!empty($_POST['course'])) { foreach($UserList as $user_id) { CourseManager::add_user_to_course($user_id,$_POST['course']); } header('Location: course_information.php?code='.Security::remove_XSS($_POST['course'])); } /* else { Display :: display_header($tool_name); if(count($userid_match_login)>0) { $message=get_lang('LDAPUsersAddedOrUpdated').':
'; foreach($userid_match_login as $user_id => $login) { $message .= '- '.$login.'
'; } } else { $message=get_lang('NoUserAdded'); } Display :: display_normal_message($message,false); } */ else { Display::display_header($tool_name); $message=get_lang('NoUserAdded'); Display :: display_normal_message($message,false); } echo '

'; echo ''.get_lang('BackToNewSearch').''; echo '

'; } Display::display_footer(); ?>