@@ -112,7 +112,7 @@ |
||
112 | 112 | <script> |
113 | 113 | $(function() { |
114 | 114 | <?php |
115 | - echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
115 | + echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
116 | 116 | ?> |
117 | 117 | }); |
118 | 118 | </script> |
@@ -107,7 +107,7 @@ |
||
107 | 107 | <?php |
108 | 108 | echo Display :: get_alphabet_options($first_letter_course); |
109 | 109 | echo Display :: get_numeric_options(0,9,$first_letter_course); |
110 | - ?> |
|
110 | + ?> |
|
111 | 111 | </select> |
112 | 112 | </td> |
113 | 113 | <td width="20%"> </td> |
@@ -53,91 +53,91 @@ discard block |
||
53 | 53 | //if ($annee == "" && $composante == "" && $etape == "") { |
54 | 54 | if (empty($annee) && empty($id_session)) |
55 | 55 | { |
56 | - Display::display_header($tool_name); |
|
57 | - echo '<div style="align:center">'; |
|
58 | - echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU'); |
|
59 | - echo '<form method="get" action="'.api_get_self().'"><br />'; |
|
60 | - echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> '; |
|
61 | - echo '<input type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> '; |
|
62 | - echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
63 | - echo '</form>'; |
|
64 | - echo '</div>'; |
|
56 | + Display::display_header($tool_name); |
|
57 | + echo '<div style="align:center">'; |
|
58 | + echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU'); |
|
59 | + echo '<form method="get" action="'.api_get_self().'"><br />'; |
|
60 | + echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> '; |
|
61 | + echo '<input type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> '; |
|
62 | + echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
63 | + echo '</form>'; |
|
64 | + echo '</div>'; |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | elseif(!empty($annee) && empty($id_session)) |
68 | 68 | { |
69 | - Display::display_header($tool_name); |
|
70 | - echo '<div style="align:center">'; |
|
71 | - echo Display::return_icon('course.gif', get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />'; |
|
72 | - echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
73 | - echo '<select name="id_session">'; |
|
74 | - |
|
75 | - $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
76 | - $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " . |
|
77 | - " FROM $tbl_session ". |
|
78 | - " ORDER BY name"; |
|
79 | - $result = Database::query($sql); |
|
80 | - |
|
81 | - $sessions=Database::store_result($result); |
|
82 | - $nbr_results=count($sessions); |
|
83 | - foreach($sessions as $row) { |
|
84 | - echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>'; |
|
85 | - } |
|
86 | - echo '</select>'; |
|
87 | - echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
88 | - echo '</form>'; |
|
89 | - echo '</div>'; |
|
69 | + Display::display_header($tool_name); |
|
70 | + echo '<div style="align:center">'; |
|
71 | + echo Display::return_icon('course.gif', get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />'; |
|
72 | + echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
73 | + echo '<select name="id_session">'; |
|
74 | + |
|
75 | + $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
76 | + $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " . |
|
77 | + " FROM $tbl_session ". |
|
78 | + " ORDER BY name"; |
|
79 | + $result = Database::query($sql); |
|
80 | + |
|
81 | + $sessions=Database::store_result($result); |
|
82 | + $nbr_results=count($sessions); |
|
83 | + foreach($sessions as $row) { |
|
84 | + echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>'; |
|
85 | + } |
|
86 | + echo '</select>'; |
|
87 | + echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
88 | + echo '</form>'; |
|
89 | + echo '</div>'; |
|
90 | 90 | } |
91 | 91 | // form4 annee != 0; composante != 0 etape != 0 |
92 | 92 | //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') { |
93 | 93 | elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) |
94 | 94 | { |
95 | - Display::display_header($tool_name); |
|
96 | - echo '<div style="align: center;">'; |
|
97 | - echo '<br />'; |
|
98 | - echo '<br />'; |
|
99 | - echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
100 | - //echo "Connection ..."; |
|
101 | - $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
102 | - ldap_set_version($ds); |
|
103 | - |
|
104 | - if ($ds) { |
|
105 | - |
|
106 | - $r = false; |
|
107 | - $res = ldap_handle_bind($ds, $r); |
|
108 | - |
|
109 | - //$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))"); |
|
110 | - //echo "(ou=*$annee,ou=$composante)"; |
|
111 | - $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
112 | - |
|
113 | - $info = ldap_get_entries($ds, $sr); |
|
114 | - |
|
115 | - for ($key = 0; $key < $info["count"]; $key ++) { |
|
116 | - $nom_form[] = $info[$key]["sn"][0]; |
|
117 | - $prenom_form[] = $info[$key]["givenname"][0]; |
|
118 | - $email_form[] = $info[$key]["mail"][0]; |
|
119 | - // Get uid from dn |
|
120 | - //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
121 | - //$username_form[] = $dn_array[0]; // uid is first key |
|
122 | - $username_form[] = $info[$key]['uid'][0]; |
|
123 | - $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
124 | - //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
125 | - //$password_form[] = $val[0]; |
|
126 | - $password_form[] = $info[$key]['userPassword'][0]; |
|
127 | - } |
|
128 | - ldap_unbind($ds); |
|
129 | - |
|
130 | - /*-----------------------------------------------*/ |
|
131 | - |
|
132 | - asort($nom_form); |
|
133 | - reset($nom_form); |
|
134 | - |
|
135 | - $statut=5; |
|
136 | - include ('ldap_form_add_users_group.php'); |
|
137 | - } else { |
|
138 | - echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
139 | - } |
|
140 | - echo '<br /><br />'; |
|
95 | + Display::display_header($tool_name); |
|
96 | + echo '<div style="align: center;">'; |
|
97 | + echo '<br />'; |
|
98 | + echo '<br />'; |
|
99 | + echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
100 | + //echo "Connection ..."; |
|
101 | + $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
102 | + ldap_set_version($ds); |
|
103 | + |
|
104 | + if ($ds) { |
|
105 | + |
|
106 | + $r = false; |
|
107 | + $res = ldap_handle_bind($ds, $r); |
|
108 | + |
|
109 | + //$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))"); |
|
110 | + //echo "(ou=*$annee,ou=$composante)"; |
|
111 | + $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
112 | + |
|
113 | + $info = ldap_get_entries($ds, $sr); |
|
114 | + |
|
115 | + for ($key = 0; $key < $info["count"]; $key ++) { |
|
116 | + $nom_form[] = $info[$key]["sn"][0]; |
|
117 | + $prenom_form[] = $info[$key]["givenname"][0]; |
|
118 | + $email_form[] = $info[$key]["mail"][0]; |
|
119 | + // Get uid from dn |
|
120 | + //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
121 | + //$username_form[] = $dn_array[0]; // uid is first key |
|
122 | + $username_form[] = $info[$key]['uid'][0]; |
|
123 | + $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
124 | + //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
125 | + //$password_form[] = $val[0]; |
|
126 | + $password_form[] = $info[$key]['userPassword'][0]; |
|
127 | + } |
|
128 | + ldap_unbind($ds); |
|
129 | + |
|
130 | + /*-----------------------------------------------*/ |
|
131 | + |
|
132 | + asort($nom_form); |
|
133 | + reset($nom_form); |
|
134 | + |
|
135 | + $statut=5; |
|
136 | + include ('ldap_form_add_users_group.php'); |
|
137 | + } else { |
|
138 | + echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
139 | + } |
|
140 | + echo '<br /><br />'; |
|
141 | 141 | echo '<a href="ldap_import_students.php?annee=">'.get_lang('BackToNewSearch').'</a>'; |
142 | 142 | echo '<br /><br />'; |
143 | 143 | echo '</div>'; |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | } |
146 | 146 | elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes')) |
147 | 147 | { |
148 | - $id=$_POST['username_form']; |
|
149 | - $UserList=array(); |
|
150 | - $userid_match_login = array(); |
|
151 | - foreach ($id as $form_index=>$user_id) |
|
152 | - { |
|
153 | - if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
154 | - { |
|
155 | - $tmp = ldap_add_user($user_id); |
|
156 | - $UserList[]= $tmp; |
|
157 | - $userid_match_login[$tmp] = $user_id; |
|
158 | - } |
|
159 | - } |
|
160 | - if (!empty($_POST['id_session'])) { |
|
161 | - $num = 0; |
|
162 | - $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
163 | - $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
164 | - foreach ($UserList as $user_id) { |
|
148 | + $id=$_POST['username_form']; |
|
149 | + $UserList=array(); |
|
150 | + $userid_match_login = array(); |
|
151 | + foreach ($id as $form_index=>$user_id) |
|
152 | + { |
|
153 | + if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
154 | + { |
|
155 | + $tmp = ldap_add_user($user_id); |
|
156 | + $UserList[]= $tmp; |
|
157 | + $userid_match_login[$tmp] = $user_id; |
|
158 | + } |
|
159 | + } |
|
160 | + if (!empty($_POST['id_session'])) { |
|
161 | + $num = 0; |
|
162 | + $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
163 | + $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
164 | + foreach ($UserList as $user_id) { |
|
165 | 165 | $res_user = Database::insert( |
166 | 166 | $tbl_session_user, |
167 | 167 | [ |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | if ($res_user !== false) { |
174 | 174 | $num++; |
175 | 175 | } |
176 | - } |
|
177 | - |
|
178 | - if($num>0) { |
|
179 | - $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session); |
|
180 | - $res = Database::query($sql); |
|
181 | - } |
|
182 | - header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session'])); |
|
183 | - } |
|
184 | - /* |
|
176 | + } |
|
177 | + |
|
178 | + if($num>0) { |
|
179 | + $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session); |
|
180 | + $res = Database::query($sql); |
|
181 | + } |
|
182 | + header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session'])); |
|
183 | + } |
|
184 | + /* |
|
185 | 185 | else |
186 | 186 | { |
187 | 187 | Display :: display_header($tool_name); |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | Display :: display_normal_message($message,false); |
201 | 201 | } |
202 | 202 | */ |
203 | - else |
|
204 | - { |
|
205 | - Display::display_header($tool_name); |
|
206 | - $message=get_lang('NoUserAdded'); |
|
207 | - Display :: display_normal_message($message,false); |
|
208 | - } |
|
209 | - echo '<br /><br />'; |
|
203 | + else |
|
204 | + { |
|
205 | + Display::display_header($tool_name); |
|
206 | + $message=get_lang('NoUserAdded'); |
|
207 | + Display :: display_normal_message($message,false); |
|
208 | + } |
|
209 | + echo '<br /><br />'; |
|
210 | 210 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
211 | 211 | echo '<br /><br />'; |
212 | 212 | } |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | api_protect_global_admin_script(); |
15 | 15 | if (!api_get_multiple_access_url()) { |
16 | - header('Location: index.php'); |
|
17 | - exit; |
|
16 | + header('Location: index.php'); |
|
17 | + exit; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | $form_sent = 0; |
@@ -44,36 +44,36 @@ discard block |
||
44 | 44 | api_display_tool_title($tool_name); |
45 | 45 | |
46 | 46 | if ($_POST['form_sent']) { |
47 | - $form_sent = $_POST['form_sent']; |
|
48 | - $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ; |
|
49 | - $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; |
|
50 | - $first_letter_user = $_POST['first_letter_user']; |
|
47 | + $form_sent = $_POST['form_sent']; |
|
48 | + $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ; |
|
49 | + $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; |
|
50 | + $first_letter_user = $_POST['first_letter_user']; |
|
51 | 51 | |
52 | - foreach($users as $key => $value) { |
|
53 | - $users[$key] = intval($value); |
|
54 | - } |
|
52 | + foreach($users as $key => $value) { |
|
53 | + $users[$key] = intval($value); |
|
54 | + } |
|
55 | 55 | |
56 | - if ($form_sent == 1) { |
|
57 | - if (count($users) == 0 || count($url_list) == 0) { |
|
58 | - Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); |
|
59 | - } else { |
|
60 | - UrlManager::add_users_to_urls($users,$url_list); |
|
61 | - Display :: display_confirmation_message(get_lang('UsersBelongURL')); |
|
62 | - } |
|
63 | - } |
|
56 | + if ($form_sent == 1) { |
|
57 | + if (count($users) == 0 || count($url_list) == 0) { |
|
58 | + Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); |
|
59 | + } else { |
|
60 | + UrlManager::add_users_to_urls($users,$url_list); |
|
61 | + Display :: display_confirmation_message(get_lang('UsersBelongURL')); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /* Display GUI */ |
67 | 67 | if (empty($first_letter_user)) { |
68 | - $sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
|
69 | - $result = Database::query($sql); |
|
70 | - $num_row = Database::fetch_array($result); |
|
68 | + $sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
|
69 | + $result = Database::query($sql); |
|
70 | + $num_row = Database::fetch_array($result); |
|
71 | 71 | if ($num_row['nb_users']>1000) { |
72 | 72 | //if there are too much users to gracefully handle with the HTML select list, |
73 | 73 | // assign a default filter on users names |
74 | 74 | $first_letter_user = 'A'; |
75 | 75 | } |
76 | - unset($result); |
|
76 | + unset($result); |
|
77 | 77 | } |
78 | 78 | $first_letter_user_lower = Database::escape_string(api_strtolower($first_letter_user)); |
79 | 79 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | <option value="">--</option> |
105 | 105 | <?php |
106 | 106 | echo Display :: get_alphabet_options($first_letter_user); |
107 | - ?> |
|
107 | + ?> |
|
108 | 108 | </select> |
109 | 109 | </td> |
110 | 110 | <td width="20%"> </td> |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | <td width="40%" align="center"> |
117 | 117 | <select name="user_list[]" multiple="multiple" size="20" style="width:380px;"> |
118 | 118 | <?php |
119 | - foreach ($db_users as $user) { |
|
120 | - ?> |
|
119 | + foreach ($db_users as $user) { |
|
120 | + ?> |
|
121 | 121 | <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>> |
122 | 122 | <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?> |
123 | 123 | </option> |
124 | 124 | <?php |
125 | - } |
|
126 | - ?> |
|
125 | + } |
|
126 | + ?> |
|
127 | 127 | </select> |
128 | 128 | </td> |
129 | 129 | <td width="20%" valign="middle" align="center"> |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | <td width="40%" align="center"> |
133 | 133 | <select name="url_list[]" multiple="multiple" size="20" style="width:230px;"> |
134 | 134 | <?php |
135 | - foreach ($db_urls as $url_obj) { |
|
136 | - ?> |
|
135 | + foreach ($db_urls as $url_obj) { |
|
136 | + ?> |
|
137 | 137 | <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>> |
138 | 138 | <?php echo $url_obj['url']; ?> |
139 | 139 | </option> |
140 | 140 | <?php |
141 | - } |
|
142 | - ?> |
|
141 | + } |
|
142 | + ?> |
|
143 | 143 | </select> |
144 | 144 | </td> |
145 | 145 | </tr> |
@@ -44,121 +44,121 @@ |
||
44 | 44 | $users=Database::store_result($result); |
45 | 45 | |
46 | 46 | foreach($Sessions as $session){ |
47 | - $id_session = $session['id']; |
|
48 | - $name_session = $session['name']; |
|
49 | - $UserList=array(); |
|
50 | - $UserUpdate=array(); |
|
51 | - $UserAdd=array(); |
|
47 | + $id_session = $session['id']; |
|
48 | + $name_session = $session['name']; |
|
49 | + $UserList=array(); |
|
50 | + $UserUpdate=array(); |
|
51 | + $UserAdd=array(); |
|
52 | 52 | |
53 | - // Parse des code etape de la session |
|
54 | - /* |
|
53 | + // Parse des code etape de la session |
|
54 | + /* |
|
55 | 55 | $sql = "SELECT id_session, code_etape, etape_description, code_ufr, annee |
56 | 56 | FROM $tbl_session_rel_etape |
57 | 57 | WHERE id_session='$id_session' |
58 | 58 | ORDER BY code_ufr, code_etape"; |
59 | 59 | $result = Database::query($sql); |
60 | 60 | */ |
61 | - $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
62 | - ldap_set_version($ds); |
|
63 | - // Import des utilisateurs des etapes dans la session |
|
64 | - if ($ds) |
|
65 | - { |
|
66 | - $r = false; |
|
67 | - $res = ldap_handle_bind($ds, $r); |
|
68 | - $UserList=array(); |
|
69 | - if($result !== false) |
|
70 | - { |
|
71 | - //while($row = Database::fetch_array($result)) |
|
72 | - //{ |
|
73 | - /* |
|
61 | + $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
62 | + ldap_set_version($ds); |
|
63 | + // Import des utilisateurs des etapes dans la session |
|
64 | + if ($ds) |
|
65 | + { |
|
66 | + $r = false; |
|
67 | + $res = ldap_handle_bind($ds, $r); |
|
68 | + $UserList=array(); |
|
69 | + if($result !== false) |
|
70 | + { |
|
71 | + //while($row = Database::fetch_array($result)) |
|
72 | + //{ |
|
73 | + /* |
|
74 | 74 | $annee = $row['annee']; |
75 | 75 | $code_ufr = $row['code_ufr']; |
76 | 76 | $etape = $row['code_etape']; |
77 | 77 | */ |
78 | - // LDAP Query |
|
79 | - // edupersonorgunitdn=ou=12CI1,ou=2006,ou=diploma,o=Paris1,dc=univ-paris1,dc=fr |
|
80 | - //etapescommented |
|
81 | - //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "edupersonorgunitdn=ou=$etape,ou=$annee,ou=diploma,$LDAPbasedn"); |
|
82 | - $sr = @ ldap_search($ds, $ldap_basedn, '(uid=*)'); |
|
83 | - $info = ldap_get_entries($ds, $sr); |
|
84 | - for ($key = 0; $key < $info["count"]; $key ++) |
|
85 | - { |
|
86 | - echo "<pre>"; |
|
87 | - print_r($info[$key]); |
|
88 | - echo "</pre>"; |
|
89 | - $lastname = api_utf8_decode($info[$key]["sn"][0]); |
|
90 | - $firstname = api_utf8_decode($info[$key]["givenname"][0]); |
|
91 | - $email = $info[$key]["mail"][0]; |
|
92 | - // Get uid from dn |
|
93 | - $dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
94 | - $username = $dn_array[0]; // uid is first key |
|
95 | - $outab[] = $info[$key]["edupersonprimaryaffiliation"][0]; // Ici "student" |
|
96 | - $val = ldap_get_values_len($ds, $sr, "userPassword"); |
|
97 | - $password = $val[0]; |
|
98 | - // Pour faciliter la gestion on ajoute le code "etape-annee" |
|
99 | - $official_code=$etape."-".$annee; |
|
100 | - $auth_source="ldap"; |
|
101 | - // Pas de date d'expiration d'etudiant (a recuperer par rapport au shadow expire LDAP) |
|
102 | - $expiration_date='0000-00-00 00:00:00'; |
|
103 | - $active=1; |
|
104 | - // Ajout de l'utilisateur |
|
105 | - if (UserManager::is_username_available($username)) { |
|
106 | - $user_id = UserManager::create_user($firstname,$lastname,$status,$email,$username,$password,$official_code,api_get_setting('platformLanguage'),$phone,$picture_uri,$auth_source,$expiration_date,$active); |
|
107 | - $UserAdd[]=$user_id; |
|
108 | - } else { |
|
109 | - $user = api_get_user_info_from_username($username); |
|
110 | - $user_id=$user['user_id']; |
|
111 | - UserManager::update_user($user_id, $firstname, $lastname, $username, null, null, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active); |
|
112 | - $UserUpdate[]=$user_id; |
|
113 | - } |
|
114 | - $UserList[]=$user_id; |
|
115 | - } |
|
116 | - //} |
|
117 | - } |
|
118 | - if (isset($included) && ($included)) |
|
119 | - { |
|
120 | - $message .= "> $name_session: ".count($UserAdd)." ".get_lang('Added').' '.get_lang('And').' '.count($UserUpdate).' '.get_lang('Modified').'<br/>'; |
|
121 | - } |
|
122 | - else |
|
123 | - { |
|
124 | - print "> $name_session: ".count($UserAdd).get_lang('Added').' '.get_lang('And').' '.count($UserUpdate).' '.get_lang('Modified')."\n"; |
|
125 | - } |
|
78 | + // LDAP Query |
|
79 | + // edupersonorgunitdn=ou=12CI1,ou=2006,ou=diploma,o=Paris1,dc=univ-paris1,dc=fr |
|
80 | + //etapescommented |
|
81 | + //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "edupersonorgunitdn=ou=$etape,ou=$annee,ou=diploma,$LDAPbasedn"); |
|
82 | + $sr = @ ldap_search($ds, $ldap_basedn, '(uid=*)'); |
|
83 | + $info = ldap_get_entries($ds, $sr); |
|
84 | + for ($key = 0; $key < $info["count"]; $key ++) |
|
85 | + { |
|
86 | + echo "<pre>"; |
|
87 | + print_r($info[$key]); |
|
88 | + echo "</pre>"; |
|
89 | + $lastname = api_utf8_decode($info[$key]["sn"][0]); |
|
90 | + $firstname = api_utf8_decode($info[$key]["givenname"][0]); |
|
91 | + $email = $info[$key]["mail"][0]; |
|
92 | + // Get uid from dn |
|
93 | + $dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
94 | + $username = $dn_array[0]; // uid is first key |
|
95 | + $outab[] = $info[$key]["edupersonprimaryaffiliation"][0]; // Ici "student" |
|
96 | + $val = ldap_get_values_len($ds, $sr, "userPassword"); |
|
97 | + $password = $val[0]; |
|
98 | + // Pour faciliter la gestion on ajoute le code "etape-annee" |
|
99 | + $official_code=$etape."-".$annee; |
|
100 | + $auth_source="ldap"; |
|
101 | + // Pas de date d'expiration d'etudiant (a recuperer par rapport au shadow expire LDAP) |
|
102 | + $expiration_date='0000-00-00 00:00:00'; |
|
103 | + $active=1; |
|
104 | + // Ajout de l'utilisateur |
|
105 | + if (UserManager::is_username_available($username)) { |
|
106 | + $user_id = UserManager::create_user($firstname,$lastname,$status,$email,$username,$password,$official_code,api_get_setting('platformLanguage'),$phone,$picture_uri,$auth_source,$expiration_date,$active); |
|
107 | + $UserAdd[]=$user_id; |
|
108 | + } else { |
|
109 | + $user = api_get_user_info_from_username($username); |
|
110 | + $user_id=$user['user_id']; |
|
111 | + UserManager::update_user($user_id, $firstname, $lastname, $username, null, null, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active); |
|
112 | + $UserUpdate[]=$user_id; |
|
113 | + } |
|
114 | + $UserList[]=$user_id; |
|
115 | + } |
|
116 | + //} |
|
117 | + } |
|
118 | + if (isset($included) && ($included)) |
|
119 | + { |
|
120 | + $message .= "> $name_session: ".count($UserAdd)." ".get_lang('Added').' '.get_lang('And').' '.count($UserUpdate).' '.get_lang('Modified').'<br/>'; |
|
121 | + } |
|
122 | + else |
|
123 | + { |
|
124 | + print "> $name_session: ".count($UserAdd).get_lang('Added').' '.get_lang('And').' '.count($UserUpdate).' '.get_lang('Modified')."\n"; |
|
125 | + } |
|
126 | 126 | |
127 | - // Une fois les utilisateurs importer dans la base des utilisateurs, on peux les affecter la session |
|
128 | - $result=Database::query("SELECT c_id FROM $tbl_session_rel_course WHERE session_id='$id_session'"); |
|
129 | - $CourseList=array(); |
|
130 | - while($row=Database::fetch_array($result)) { |
|
131 | - $CourseList[]= $row['c_id']; |
|
132 | - } |
|
127 | + // Une fois les utilisateurs importer dans la base des utilisateurs, on peux les affecter la session |
|
128 | + $result=Database::query("SELECT c_id FROM $tbl_session_rel_course WHERE session_id='$id_session'"); |
|
129 | + $CourseList=array(); |
|
130 | + while($row=Database::fetch_array($result)) { |
|
131 | + $CourseList[]= $row['c_id']; |
|
132 | + } |
|
133 | 133 | |
134 | - foreach ($CourseList as $enreg_course) { |
|
135 | - // On ajoute la relation entre l'utilisateur et le cours |
|
136 | - foreach ($UserList as $enreg_user) { |
|
137 | - $sql = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user(session_id,c_id,user_id) |
|
134 | + foreach ($CourseList as $enreg_course) { |
|
135 | + // On ajoute la relation entre l'utilisateur et le cours |
|
136 | + foreach ($UserList as $enreg_user) { |
|
137 | + $sql = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user(session_id,c_id,user_id) |
|
138 | 138 | VALUES('$id_session','$enreg_course','$enreg_user')"; |
139 | - Database::query($sql); |
|
140 | - } |
|
141 | - $sql = "SELECT COUNT(user_id) as nbUsers " . |
|
142 | - "FROM $tbl_session_rel_course_rel_user " . |
|
143 | - "WHERE session_id='$id_session' AND c_id='$enreg_course'"; |
|
144 | - $rs = Database::query($sql); |
|
145 | - list($nbr_users) = Database::fetch_array($rs); |
|
146 | - $sql = "UPDATE $tbl_session_rel_course SET nbr_users=$nbr_users |
|
139 | + Database::query($sql); |
|
140 | + } |
|
141 | + $sql = "SELECT COUNT(user_id) as nbUsers " . |
|
142 | + "FROM $tbl_session_rel_course_rel_user " . |
|
143 | + "WHERE session_id='$id_session' AND c_id='$enreg_course'"; |
|
144 | + $rs = Database::query($sql); |
|
145 | + list($nbr_users) = Database::fetch_array($rs); |
|
146 | + $sql = "UPDATE $tbl_session_rel_course SET nbr_users=$nbr_users |
|
147 | 147 | WHERE session_id='$id_session' AND c_id = '$enreg_course'"; |
148 | - Database::query($sql); |
|
149 | - } |
|
150 | - // On ajoute la relation entre l'utilisateur et la session |
|
151 | - foreach($UserList as $enreg_user){ |
|
152 | - $sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at) " . |
|
153 | - "VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')"; |
|
154 | - Database::query($sql); |
|
155 | - } |
|
156 | - $sql = "SELECT COUNT(user_id) as nbUsers " . |
|
157 | - "FROM $tbl_session_rel_user " . |
|
158 | - "WHERE session_id='$id_session' AND relation_type<>".SESSION_RELATION_TYPE_RRHH.""; |
|
159 | - $rs = Database::query($sql); |
|
160 | - list($nbr_users) = Database::fetch_array($rs); |
|
161 | - $sql = "UPDATE $tbl_session SET nbr_users=$nbr_users WHERE id='$id_session'"; |
|
162 | - Database::query($sql); |
|
163 | - } |
|
148 | + Database::query($sql); |
|
149 | + } |
|
150 | + // On ajoute la relation entre l'utilisateur et la session |
|
151 | + foreach($UserList as $enreg_user){ |
|
152 | + $sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at) " . |
|
153 | + "VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')"; |
|
154 | + Database::query($sql); |
|
155 | + } |
|
156 | + $sql = "SELECT COUNT(user_id) as nbUsers " . |
|
157 | + "FROM $tbl_session_rel_user " . |
|
158 | + "WHERE session_id='$id_session' AND relation_type<>".SESSION_RELATION_TYPE_RRHH.""; |
|
159 | + $rs = Database::query($sql); |
|
160 | + list($nbr_users) = Database::fetch_array($rs); |
|
161 | + $sql = "UPDATE $tbl_session SET nbr_users=$nbr_users WHERE id='$id_session'"; |
|
162 | + Database::query($sql); |
|
163 | + } |
|
164 | 164 | } |
@@ -241,10 +241,10 @@ |
||
241 | 241 | return $users; |
242 | 242 | } |
243 | 243 | /** |
244 | - * XML-parser: handle start of element |
|
245 | - * @param string $parser Deprecated? |
|
246 | - * @param string $data The data to be parsed |
|
247 | - */ |
|
244 | + * XML-parser: handle start of element |
|
245 | + * @param string $parser Deprecated? |
|
246 | + * @param string $data The data to be parsed |
|
247 | + */ |
|
248 | 248 | function element_start($parser, $data) |
249 | 249 | { |
250 | 250 | $data = api_utf8_decode($data); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $output = array(); |
31 | 31 | if (!empty($_GET['fill'])) { |
32 | 32 | switch ($_GET['fill']) { |
33 | - case 'users': |
|
34 | - require api_get_path(SYS_TEST_PATH).'datafiller/fill_users.php'; |
|
33 | + case 'users': |
|
34 | + require api_get_path(SYS_TEST_PATH).'datafiller/fill_users.php'; |
|
35 | 35 | $output = fill_users(); |
36 | 36 | break; |
37 | 37 | case 'courses': |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | $result .= '<table>'; |
54 | 54 | foreach ($output as $line) { |
55 | 55 | $result .= '<tr>'; |
56 | - $result .= '<td class="filler-report-data-init">'.$line['line-init'].' </td><td class="filler-report-data">'.$line['line-info'].'</td>'; |
|
57 | - $result .= '</tr>'; |
|
56 | + $result .= '<td class="filler-report-data-init">'.$line['line-init'].' </td><td class="filler-report-data">'.$line['line-info'].'</td>'; |
|
57 | + $result .= '</tr>'; |
|
58 | 58 | } |
59 | 59 | $result .= '</table>'; |
60 | 60 | $result .= '</div>'; |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($add_type == 'multiple') { |
127 | - $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>'; |
|
128 | - $link_add_type_multiple = get_lang('SessionAddTypeMultiple'); |
|
127 | + $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>'; |
|
128 | + $link_add_type_multiple = get_lang('SessionAddTypeMultiple'); |
|
129 | 129 | } else { |
130 | - $link_add_type_unique = get_lang('SessionAddTypeUnique'); |
|
131 | - $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>'; |
|
130 | + $link_add_type_unique = get_lang('SessionAddTypeUnique'); |
|
131 | + $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | $url_list = UrlManager::get_url_data(); |
@@ -192,34 +192,34 @@ discard block |
||
192 | 192 | <?php } else { ?> |
193 | 193 | <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;"> |
194 | 194 | <?php |
195 | - foreach ($noUserGroupList as $noItem) { |
|
196 | - ?> |
|
195 | + foreach ($noUserGroupList as $noItem) { |
|
196 | + ?> |
|
197 | 197 | <option value="<?php echo $noItem['id']; ?>"> |
198 | 198 | <?php echo $noItem['name']; ?> |
199 | 199 | </option> |
200 | 200 | <?php |
201 | - } |
|
202 | - ?> |
|
201 | + } |
|
202 | + ?> |
|
203 | 203 | </select> |
204 | 204 | <?php |
205 | - } |
|
206 | - ?> |
|
205 | + } |
|
206 | + ?> |
|
207 | 207 | </div> |
208 | 208 | </td> |
209 | 209 | <td width="10%" valign="middle" align="center"> |
210 | 210 | <?php |
211 | - if ($ajax_search) { |
|
212 | - ?> |
|
211 | + if ($ajax_search) { |
|
212 | + ?> |
|
213 | 213 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button> |
214 | 214 | <?php |
215 | - } else { |
|
216 | - ?> |
|
215 | + } else { |
|
216 | + ?> |
|
217 | 217 | <button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" ></button> |
218 | 218 | <br /><br /> |
219 | 219 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" ></button> |
220 | 220 | <?php |
221 | - } |
|
222 | - ?> |
|
221 | + } |
|
222 | + ?> |
|
223 | 223 | <br /><br /><br /><br /><br /><br /> |
224 | 224 | </td> |
225 | 225 | <td align="center"> |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | <td colspan="3" align="center"> |
241 | 241 | <br /> |
242 | 242 | <?php |
243 | - if(isset($_GET['add'])) |
|
244 | - echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>'; |
|
245 | - else |
|
246 | - echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>'; |
|
247 | - ?> |
|
243 | + if(isset($_GET['add'])) |
|
244 | + echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>'; |
|
245 | + else |
|
246 | + echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>'; |
|
247 | + ?> |
|
248 | 248 | </td> |
249 | 249 | </tr> |
250 | 250 | </table> |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | <?php |
402 | 402 | $selected_letter = isset($_POST['firstLetterUser']) ? $_POST['firstLetterUser'] : null; |
403 | 403 | echo Display :: get_alphabet_options($selected_letter); |
404 | - ?> |
|
404 | + ?> |
|
405 | 405 | </select> |
406 | 406 | </div> |
407 | 407 | </td> |
@@ -412,59 +412,59 @@ discard block |
||
412 | 412 | <td align="center"> |
413 | 413 | <div id="content_source"> |
414 | 414 | <?php |
415 | - if (!($add_type=='multiple')) { |
|
416 | - ?> |
|
415 | + if (!($add_type=='multiple')) { |
|
416 | + ?> |
|
417 | 417 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single',document.getElementById('relation').value)" /> |
418 | 418 | <div id="ajax_list_users_single"></div> |
419 | 419 | <?php |
420 | - } else { |
|
421 | - ?> |
|
420 | + } else { |
|
421 | + ?> |
|
422 | 422 | <div id="ajax_origin_list_multiple"> |
423 | 423 | <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;"> |
424 | 424 | <?php |
425 | - if (!empty($nosessionUsersList)) { |
|
426 | - foreach($nosessionUsersList as $enreg) { |
|
427 | - ?> |
|
425 | + if (!empty($nosessionUsersList)) { |
|
426 | + foreach($nosessionUsersList as $enreg) { |
|
427 | + ?> |
|
428 | 428 | <option value="<?php echo $enreg['user_id']; ?>" > <?php echo $enreg['firstname'].' '.$enreg['lastname'].' ('.$enreg['username'].')'; ?></option> |
429 | 429 | <?php |
430 | - } |
|
431 | - } |
|
432 | - ?> |
|
430 | + } |
|
431 | + } |
|
432 | + ?> |
|
433 | 433 | </select> |
434 | 434 | </div> |
435 | 435 | <?php |
436 | - } |
|
437 | - unset($nosessionUsersList); |
|
438 | - ?> |
|
436 | + } |
|
437 | + unset($nosessionUsersList); |
|
438 | + ?> |
|
439 | 439 | </div> |
440 | 440 | </td> |
441 | 441 | <td width="10%" valign="middle" align="center"> |
442 | 442 | <?php |
443 | - if ($ajax_search) { |
|
444 | - ?> |
|
443 | + if ($ajax_search) { |
|
444 | + ?> |
|
445 | 445 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" ><em class="fa fa-arrow-left"></em></button> |
446 | 446 | <?php |
447 | - } else { |
|
448 | - ?> |
|
447 | + } else { |
|
448 | + ?> |
|
449 | 449 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))"><em class="fa fa-arrow-right"></em></button> |
450 | 450 | <br /><br /> |
451 | 451 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))"><em class="fa fa-arrow-left"></em></button> |
452 | 452 | <?php |
453 | - } |
|
454 | - ?> |
|
453 | + } |
|
454 | + ?> |
|
455 | 455 | <br /><br /><br /><br /><br /> |
456 | 456 | </td> |
457 | 457 | <td align="center"> |
458 | 458 | <div id="ajax_destination_list"> |
459 | 459 | <select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" style="width:360px;"> |
460 | 460 | <?php |
461 | - if (!empty($sessionUsersList)) { |
|
462 | - foreach($sessionUsersList as $enreg) { ?> |
|
461 | + if (!empty($sessionUsersList)) { |
|
462 | + foreach($sessionUsersList as $enreg) { ?> |
|
463 | 463 | <option value="<?php echo $enreg['user_id']; ?>"> |
464 | 464 | <?php echo $enreg['firstname'].' '.$enreg['lastname'].' ('.$enreg['username'].')'; ?> |
465 | 465 | </option> |
466 | 466 | <?php } |
467 | - } unset($sessionUsersList); |
|
467 | + } unset($sessionUsersList); |
|
468 | 468 | ?> |
469 | 469 | </select> |
470 | 470 | </div> |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | <td colspan="3" align="center"> |
475 | 475 | <br /> |
476 | 476 | <?php |
477 | - echo '<button class="btn btn-success" type="button" value="" onclick="valide()" ><em class="fa fa-floppy-o"></em> '.get_lang('SubscribeUsersToGroup').'</button>'; |
|
478 | - ?> |
|
477 | + echo '<button class="btn btn-success" type="button" value="" onclick="valide()" ><em class="fa fa-floppy-o"></em> '.get_lang('SubscribeUsersToGroup').'</button>'; |
|
478 | + ?> |
|
479 | 479 | </td> |
480 | 480 | </tr> |
481 | 481 | </table> |