@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Code |
10 | 10 | */ |
11 | 11 | // resetting the course id |
12 | -$cidReset=true; |
|
12 | +$cidReset = true; |
|
13 | 13 | require_once('../inc/global.inc.php'); |
14 | 14 | // setting the section (for the tabs) |
15 | 15 | $this_section = SECTION_PLATFORM_ADMIN; |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | api_protect_admin_script(); |
18 | 18 | require('../auth/ldap/authldap.php'); |
19 | 19 | |
20 | -$annee_base=date('Y'); |
|
20 | +$annee_base = date('Y'); |
|
21 | 21 | |
22 | 22 | $tool_name = get_lang('LDAPImport'); |
23 | 23 | // setting breadcrumbs |
24 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
24 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
25 | 25 | |
26 | 26 | $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript"> |
27 | 27 | var buttoncheck = 1; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | echo '</div>'; |
65 | 65 | |
66 | 66 | } |
67 | -elseif(!empty($annee) && empty($id_session)) |
|
67 | +elseif (!empty($annee) && empty($id_session)) |
|
68 | 68 | { |
69 | 69 | Display::display_header($tool_name); |
70 | 70 | echo '<div style="align:center">'; |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | echo '<select name="id_session">'; |
74 | 74 | |
75 | 75 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
76 | - $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " . |
|
76 | + $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date ". |
|
77 | 77 | " FROM $tbl_session ". |
78 | 78 | " ORDER BY name"; |
79 | 79 | $result = Database::query($sql); |
80 | 80 | |
81 | - $sessions=Database::store_result($result); |
|
82 | - $nbr_results=count($sessions); |
|
83 | - foreach($sessions as $row) { |
|
81 | + $sessions = Database::store_result($result); |
|
82 | + $nbr_results = count($sessions); |
|
83 | + foreach ($sessions as $row) { |
|
84 | 84 | echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>'; |
85 | 85 | } |
86 | 86 | echo '</select>'; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $info = ldap_get_entries($ds, $sr); |
114 | 114 | |
115 | - for ($key = 0; $key < $info["count"]; $key ++) { |
|
115 | + for ($key = 0; $key < $info["count"]; $key++) { |
|
116 | 116 | $nom_form[] = $info[$key]["sn"][0]; |
117 | 117 | $prenom_form[] = $info[$key]["givenname"][0]; |
118 | 118 | $email_form[] = $info[$key]["mail"][0]; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | asort($nom_form); |
133 | 133 | reset($nom_form); |
134 | 134 | |
135 | - $statut=5; |
|
135 | + $statut = 5; |
|
136 | 136 | include ('ldap_form_add_users_group.php'); |
137 | 137 | } else { |
138 | 138 | echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
@@ -143,24 +143,24 @@ discard block |
||
143 | 143 | echo '</div>'; |
144 | 144 | |
145 | 145 | } |
146 | -elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes')) |
|
146 | +elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes')) |
|
147 | 147 | { |
148 | - $id=$_POST['username_form']; |
|
149 | - $UserList=array(); |
|
148 | + $id = $_POST['username_form']; |
|
149 | + $UserList = array(); |
|
150 | 150 | $userid_match_login = array(); |
151 | 151 | foreach ($id as $form_index=>$user_id) |
152 | 152 | { |
153 | - if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
153 | + if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) |
|
154 | 154 | { |
155 | 155 | $tmp = ldap_add_user($user_id); |
156 | - $UserList[]= $tmp; |
|
156 | + $UserList[] = $tmp; |
|
157 | 157 | $userid_match_login[$tmp] = $user_id; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | if (!empty($_POST['id_session'])) { |
161 | 161 | $num = 0; |
162 | 162 | $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
163 | - $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
163 | + $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
164 | 164 | foreach ($UserList as $user_id) { |
165 | 165 | $res_user = Database::insert( |
166 | 166 | $tbl_session_user, |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | - if($num>0) { |
|
178 | + if ($num > 0) { |
|
179 | 179 | $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session); |
180 | 180 | $res = Database::query($sql); |
181 | 181 | } |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | else |
204 | 204 | { |
205 | 205 | Display::display_header($tool_name); |
206 | - $message=get_lang('NoUserAdded'); |
|
207 | - Display :: display_normal_message($message,false); |
|
206 | + $message = get_lang('NoUserAdded'); |
|
207 | + Display :: display_normal_message($message, false); |
|
208 | 208 | } |
209 | 209 | echo '<br /><br />'; |
210 | 210 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | echo '</form>'; |
64 | 64 | echo '</div>'; |
65 | 65 | |
66 | -} |
|
67 | -elseif(!empty($annee) && empty($id_session)) |
|
66 | +} elseif(!empty($annee) && empty($id_session)) |
|
68 | 67 | { |
69 | 68 | Display::display_header($tool_name); |
70 | 69 | echo '<div style="align:center">'; |
@@ -142,8 +141,7 @@ discard block |
||
142 | 141 | echo '<br /><br />'; |
143 | 142 | echo '</div>'; |
144 | 143 | |
145 | -} |
|
146 | -elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes')) |
|
144 | +} elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes')) |
|
147 | 145 | { |
148 | 146 | $id=$_POST['username_form']; |
149 | 147 | $UserList=array(); |
@@ -53,93 +53,93 @@ 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( |
|
72 | - 'course.png', |
|
73 | - get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />'; |
|
74 | - echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
75 | - echo '<select name="id_session">'; |
|
76 | - |
|
77 | - $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
78 | - $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " . |
|
79 | - " FROM $tbl_session ". |
|
80 | - " ORDER BY name"; |
|
81 | - $result = Database::query($sql); |
|
82 | - |
|
83 | - $sessions=Database::store_result($result); |
|
84 | - $nbr_results=count($sessions); |
|
85 | - foreach($sessions as $row) { |
|
86 | - echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>'; |
|
87 | - } |
|
88 | - echo '</select>'; |
|
89 | - echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
90 | - echo '</form>'; |
|
91 | - echo '</div>'; |
|
69 | + Display::display_header($tool_name); |
|
70 | + echo '<div style="align:center">'; |
|
71 | + echo Display::return_icon( |
|
72 | + 'course.png', |
|
73 | + get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />'; |
|
74 | + echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
75 | + echo '<select name="id_session">'; |
|
76 | + |
|
77 | + $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
78 | + $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " . |
|
79 | + " FROM $tbl_session ". |
|
80 | + " ORDER BY name"; |
|
81 | + $result = Database::query($sql); |
|
82 | + |
|
83 | + $sessions=Database::store_result($result); |
|
84 | + $nbr_results=count($sessions); |
|
85 | + foreach($sessions as $row) { |
|
86 | + echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>'; |
|
87 | + } |
|
88 | + echo '</select>'; |
|
89 | + echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
90 | + echo '</form>'; |
|
91 | + echo '</div>'; |
|
92 | 92 | } |
93 | 93 | // form4 annee != 0; composante != 0 etape != 0 |
94 | 94 | //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') { |
95 | 95 | elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) |
96 | 96 | { |
97 | - Display::display_header($tool_name); |
|
98 | - echo '<div style="align: center;">'; |
|
99 | - echo '<br />'; |
|
100 | - echo '<br />'; |
|
101 | - echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
102 | - //echo "Connection ..."; |
|
103 | - $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
104 | - ldap_set_version($ds); |
|
105 | - |
|
106 | - if ($ds) { |
|
107 | - |
|
108 | - $r = false; |
|
109 | - $res = ldap_handle_bind($ds, $r); |
|
110 | - |
|
111 | - //$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))"); |
|
112 | - //echo "(ou=*$annee,ou=$composante)"; |
|
113 | - $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
114 | - |
|
115 | - $info = ldap_get_entries($ds, $sr); |
|
116 | - |
|
117 | - for ($key = 0; $key < $info["count"]; $key ++) { |
|
118 | - $nom_form[] = $info[$key]["sn"][0]; |
|
119 | - $prenom_form[] = $info[$key]["givenname"][0]; |
|
120 | - $email_form[] = $info[$key]["mail"][0]; |
|
121 | - // Get uid from dn |
|
122 | - //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
123 | - //$username_form[] = $dn_array[0]; // uid is first key |
|
124 | - $username_form[] = $info[$key]['uid'][0]; |
|
125 | - $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
126 | - //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
127 | - //$password_form[] = $val[0]; |
|
128 | - $password_form[] = $info[$key]['userPassword'][0]; |
|
129 | - } |
|
130 | - ldap_unbind($ds); |
|
131 | - |
|
132 | - /*-----------------------------------------------*/ |
|
133 | - |
|
134 | - asort($nom_form); |
|
135 | - reset($nom_form); |
|
136 | - |
|
137 | - $statut=5; |
|
138 | - include ('ldap_form_add_users_group.php'); |
|
139 | - } else { |
|
140 | - echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
141 | - } |
|
142 | - echo '<br /><br />'; |
|
97 | + Display::display_header($tool_name); |
|
98 | + echo '<div style="align: center;">'; |
|
99 | + echo '<br />'; |
|
100 | + echo '<br />'; |
|
101 | + echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
102 | + //echo "Connection ..."; |
|
103 | + $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
104 | + ldap_set_version($ds); |
|
105 | + |
|
106 | + if ($ds) { |
|
107 | + |
|
108 | + $r = false; |
|
109 | + $res = ldap_handle_bind($ds, $r); |
|
110 | + |
|
111 | + //$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))"); |
|
112 | + //echo "(ou=*$annee,ou=$composante)"; |
|
113 | + $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
114 | + |
|
115 | + $info = ldap_get_entries($ds, $sr); |
|
116 | + |
|
117 | + for ($key = 0; $key < $info["count"]; $key ++) { |
|
118 | + $nom_form[] = $info[$key]["sn"][0]; |
|
119 | + $prenom_form[] = $info[$key]["givenname"][0]; |
|
120 | + $email_form[] = $info[$key]["mail"][0]; |
|
121 | + // Get uid from dn |
|
122 | + //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
123 | + //$username_form[] = $dn_array[0]; // uid is first key |
|
124 | + $username_form[] = $info[$key]['uid'][0]; |
|
125 | + $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
126 | + //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
127 | + //$password_form[] = $val[0]; |
|
128 | + $password_form[] = $info[$key]['userPassword'][0]; |
|
129 | + } |
|
130 | + ldap_unbind($ds); |
|
131 | + |
|
132 | + /*-----------------------------------------------*/ |
|
133 | + |
|
134 | + asort($nom_form); |
|
135 | + reset($nom_form); |
|
136 | + |
|
137 | + $statut=5; |
|
138 | + include ('ldap_form_add_users_group.php'); |
|
139 | + } else { |
|
140 | + echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
141 | + } |
|
142 | + echo '<br /><br />'; |
|
143 | 143 | echo '<a href="ldap_import_students.php?annee=">'.get_lang('BackToNewSearch').'</a>'; |
144 | 144 | echo '<br /><br />'; |
145 | 145 | echo '</div>'; |
@@ -147,23 +147,23 @@ discard block |
||
147 | 147 | } |
148 | 148 | elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes')) |
149 | 149 | { |
150 | - $id=$_POST['username_form']; |
|
151 | - $UserList=array(); |
|
152 | - $userid_match_login = array(); |
|
153 | - foreach ($id as $form_index=>$user_id) |
|
154 | - { |
|
155 | - if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
156 | - { |
|
157 | - $tmp = ldap_add_user($user_id); |
|
158 | - $UserList[]= $tmp; |
|
159 | - $userid_match_login[$tmp] = $user_id; |
|
160 | - } |
|
161 | - } |
|
162 | - if (!empty($_POST['id_session'])) { |
|
163 | - $num = 0; |
|
164 | - $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
165 | - $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
166 | - foreach ($UserList as $user_id) { |
|
150 | + $id=$_POST['username_form']; |
|
151 | + $UserList=array(); |
|
152 | + $userid_match_login = array(); |
|
153 | + foreach ($id as $form_index=>$user_id) |
|
154 | + { |
|
155 | + if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
156 | + { |
|
157 | + $tmp = ldap_add_user($user_id); |
|
158 | + $UserList[]= $tmp; |
|
159 | + $userid_match_login[$tmp] = $user_id; |
|
160 | + } |
|
161 | + } |
|
162 | + if (!empty($_POST['id_session'])) { |
|
163 | + $num = 0; |
|
164 | + $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
165 | + $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
166 | + foreach ($UserList as $user_id) { |
|
167 | 167 | $res_user = Database::insert( |
168 | 168 | $tbl_session_user, |
169 | 169 | [ |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | if ($res_user !== false) { |
176 | 176 | $num++; |
177 | 177 | } |
178 | - } |
|
179 | - |
|
180 | - if($num>0) { |
|
181 | - $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session); |
|
182 | - $res = Database::query($sql); |
|
183 | - } |
|
184 | - header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session'])); |
|
185 | - } |
|
186 | - /* |
|
178 | + } |
|
179 | + |
|
180 | + if($num>0) { |
|
181 | + $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session); |
|
182 | + $res = Database::query($sql); |
|
183 | + } |
|
184 | + header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session'])); |
|
185 | + } |
|
186 | + /* |
|
187 | 187 | else |
188 | 188 | { |
189 | 189 | Display :: display_header($tool_name); |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | Display :: display_normal_message($message,false); |
203 | 203 | } |
204 | 204 | */ |
205 | - else |
|
206 | - { |
|
207 | - Display::display_header($tool_name); |
|
208 | - $message=get_lang('NoUserAdded'); |
|
209 | - Display :: display_normal_message($message,false); |
|
210 | - } |
|
211 | - echo '<br /><br />'; |
|
205 | + else |
|
206 | + { |
|
207 | + Display::display_header($tool_name); |
|
208 | + $message=get_lang('NoUserAdded'); |
|
209 | + Display :: display_normal_message($message,false); |
|
210 | + } |
|
211 | + echo '<br /><br />'; |
|
212 | 212 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
213 | 213 | echo '<br /><br />'; |
214 | 214 | } |
@@ -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> |
@@ -20,24 +20,24 @@ discard block |
||
20 | 20 | $form_sent = 0; |
21 | 21 | $first_letter_user = ''; |
22 | 22 | $first_letter_course = ''; |
23 | -$courses = array (); |
|
23 | +$courses = array(); |
|
24 | 24 | $url_list = array(); |
25 | 25 | $users = array(); |
26 | 26 | |
27 | 27 | $tbl_access_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
28 | 28 | $tbl_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
29 | -$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
29 | +$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
30 | 30 | |
31 | 31 | /* Header */ |
32 | 32 | $tool_name = get_lang('AddUsersToURL'); |
33 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | -$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
33 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | +$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
35 | 35 | |
36 | 36 | Display :: display_header($tool_name); |
37 | 37 | |
38 | 38 | echo '<div class="actions">'; |
39 | 39 | echo Display::url( |
40 | - Display::return_icon('edit.png', get_lang('EditUsersToURL'),''), |
|
40 | + Display::return_icon('edit.png', get_lang('EditUsersToURL'), ''), |
|
41 | 41 | api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'); |
42 | 42 | echo '</div>'; |
43 | 43 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | |
46 | 46 | if ($_POST['form_sent']) { |
47 | 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() ; |
|
48 | + $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array(); |
|
49 | + $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array(); |
|
50 | 50 | $first_letter_user = $_POST['first_letter_user']; |
51 | 51 | |
52 | - foreach($users as $key => $value) { |
|
52 | + foreach ($users as $key => $value) { |
|
53 | 53 | $users[$key] = intval($value); |
54 | 54 | } |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if (count($users) == 0 || count($url_list) == 0) { |
58 | 58 | Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); |
59 | 59 | } else { |
60 | - UrlManager::add_users_to_urls($users,$url_list); |
|
60 | + UrlManager::add_users_to_urls($users, $url_list); |
|
61 | 61 | Display :: display_confirmation_message(get_lang('UsersBelongURL')); |
62 | 62 | } |
63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
69 | 69 | $result = Database::query($sql); |
70 | 70 | $num_row = Database::fetch_array($result); |
71 | - if ($num_row['nb_users']>1000) { |
|
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'; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <td width="40%" align="center"> |
100 | 100 | <b><?php echo get_lang('UserList'); ?></b> |
101 | 101 | <br/><br/> |
102 | - <?php echo get_lang('Select').' ' ; echo $target_name == 'firstname'? get_lang('FirstName') : get_lang('LastName'); ?> |
|
102 | + <?php echo get_lang('Select').' '; echo $target_name == 'firstname' ? get_lang('FirstName') : get_lang('LastName'); ?> |
|
103 | 103 | <select name="first_letter_user" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"> |
104 | 104 | <option value="">--</option> |
105 | 105 | <?php |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | <?php |
119 | 119 | foreach ($db_users as $user) { |
120 | 120 | ?> |
121 | - <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>> |
|
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 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | <?php |
135 | 135 | foreach ($db_urls as $url_obj) { |
136 | 136 | ?> |
137 | - <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>> |
|
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 |
@@ -118,7 +118,10 @@ discard block |
||
118 | 118 | <?php |
119 | 119 | foreach ($db_users as $user) { |
120 | 120 | ?> |
121 | - <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>> |
|
121 | + <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) { |
|
122 | + echo 'selected="selected"'; |
|
123 | +} |
|
124 | +?>> |
|
122 | 125 | <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?> |
123 | 126 | </option> |
124 | 127 | <?php |
@@ -134,7 +137,10 @@ discard block |
||
134 | 137 | <?php |
135 | 138 | foreach ($db_urls as $url_obj) { |
136 | 139 | ?> |
137 | - <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>> |
|
140 | + <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) { |
|
141 | + echo 'selected="selected"'; |
|
142 | +} |
|
143 | +?>> |
|
138 | 144 | <?php echo $url_obj['url']; ?> |
139 | 145 | </option> |
140 | 146 | <?php |
@@ -189,8 +189,8 @@ |
||
189 | 189 | { |
190 | 190 | $code = CourseRequestManager::get_course_request_code($id); |
191 | 191 | $result = '<a href="course_request_edit.php?id='.$id.'&caller=0">'.Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'. |
192 | - ' <a href="?accept_course_request='.$id.'">'.Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'),16).'</a>'. |
|
193 | - ' <a href="?reject_course_request='.$id.'">'.Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'),16).'</a>'; |
|
192 | + ' <a href="?accept_course_request='.$id.'">'.Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>'. |
|
193 | + ' <a href="?reject_course_request='.$id.'">'.Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>'; |
|
194 | 194 | if (!CourseRequestManager::additional_info_asked($id)) { |
195 | 195 | $result .= ' <a href="?request_info='.$id.'">'.Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;')).'</a>'; |
196 | 196 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $tool_name = get_lang('ConfigureInscription'); |
47 | 47 | if (!empty($action)) { |
48 | 48 | $interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription')); |
49 | - switch($action) { |
|
49 | + switch ($action) { |
|
50 | 50 | case 'edit_top': |
51 | 51 | $tool_name = get_lang('EditTopRegister'); |
52 | 52 | break; |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | // This request is only the preparation for the update of the home_top |
142 | 142 | $home_top = ''; |
143 | 143 | if (is_file($homep.$topf.'_'.$lang.$ext) && is_readable($homep.$topf.'_'.$lang.$ext)) { |
144 | - $home_top = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
144 | + $home_top = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
145 | 145 | } elseif (is_file($homep.$topf.$lang.$ext) && is_readable($homep.$topf.$lang.$ext)) { |
146 | - $home_top = @(string)file_get_contents($homep.$topf.$lang.$ext); |
|
146 | + $home_top = @(string) file_get_contents($homep.$topf.$lang.$ext); |
|
147 | 147 | } else { |
148 | 148 | $errorMsg = get_lang('HomePageFilesNotReadable'); |
149 | 149 | } |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | if (api_is_western_name_order()) { |
185 | 185 | // FIRST NAME and LAST NAME |
186 | 186 | $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled')); |
187 | - $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled')); |
|
187 | + $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled')); |
|
188 | 188 | } else { |
189 | 189 | // LAST NAME and FIRST NAME |
190 | - $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled')); |
|
190 | + $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled')); |
|
191 | 191 | $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled')); |
192 | 192 | } |
193 | 193 | $form->applyFilter('firstname', 'trim'); |
194 | 194 | $form->applyFilter('lastname', 'trim'); |
195 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
195 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
196 | 196 | $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
197 | 197 | |
198 | 198 | |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); |
211 | 211 | $form->addRule('username', get_lang('UsernameWrong'), 'username'); |
212 | 212 | $form->addRule('username', get_lang('UserTaken'), 'username_available'); |
213 | - $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
213 | + $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
214 | 214 | |
215 | 215 | // PASSWORD |
216 | - $form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled')); |
|
216 | + $form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled')); |
|
217 | 217 | $form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 40, 'disabled' => 'disabled')); |
218 | 218 | $form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required'); |
219 | 219 | $form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required'); |
@@ -241,25 +241,25 @@ discard block |
||
241 | 241 | |
242 | 242 | // EXTENDED FIELDS |
243 | 243 | if (api_get_setting('extended_profile') == 'true' && |
244 | - api_get_setting('extendedprofile_registration','mycomptetences') == 'true' |
|
244 | + api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true' |
|
245 | 245 | ) { |
246 | 246 | $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130')); |
247 | 247 | } |
248 | 248 | |
249 | 249 | if (api_get_setting('extended_profile') == 'true' && |
250 | - api_get_setting('extendedprofile_registration','mydiplomas') == 'true' |
|
250 | + api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true' |
|
251 | 251 | ) { |
252 | 252 | $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130')); |
253 | 253 | } |
254 | 254 | |
255 | 255 | if (api_get_setting('extended_profile') == 'true' && |
256 | - api_get_setting('extendedprofile_registration','myteach') == 'true' |
|
256 | + api_get_setting('extendedprofile_registration', 'myteach') == 'true' |
|
257 | 257 | ) { |
258 | 258 | $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130')); |
259 | 259 | } |
260 | 260 | |
261 | 261 | if (api_get_setting('extended_profile') == 'true' && |
262 | - api_get_setting('extendedprofile_registration','mypersonalopenarea') == 'true' |
|
262 | + api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true' |
|
263 | 263 | ) { |
264 | 264 | $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130')); |
265 | 265 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | if ($term_preview['type'] == 1) { |
308 | 308 | $form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').' <a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>'); |
309 | - $form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required'); |
|
309 | + $form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required'); |
|
310 | 310 | } else { |
311 | 311 | if (!empty($term_preview['content'])) { |
312 | 312 | $preview = LegalManager::show_last_condition($term_preview); |
@@ -343,14 +343,14 @@ discard block |
||
343 | 343 | |
344 | 344 | $form->setDefaults($defaults); |
345 | 345 | |
346 | -switch ($action){ |
|
346 | +switch ($action) { |
|
347 | 347 | case 'edit_top': |
348 | 348 | if ($action == 'edit_top') { |
349 | 349 | $name = $topf; |
350 | 350 | $open = $home_top; |
351 | 351 | } else { |
352 | 352 | $name = $newsf; |
353 | - $open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
353 | + $open = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
354 | 354 | $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
355 | 355 | } |
356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | $default = array(); |
362 | 362 | $form = new FormValidator('configure_inscription_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;')); |
363 | - $renderer =& $form->defaultRenderer(); |
|
363 | + $renderer = & $form->defaultRenderer(); |
|
364 | 364 | $renderer->setHeaderTemplate(''); |
365 | 365 | $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); |
366 | 366 | $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>'); |
@@ -379,9 +379,9 @@ discard block |
||
379 | 379 | |
380 | 380 | $open = ''; |
381 | 381 | if (file_exists($homep.$topf.'_'.$lang.$ext)) { |
382 | - $open = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
382 | + $open = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
383 | 383 | } else { |
384 | - $open = @(string)file_get_contents($homep.$topf.$ext); |
|
384 | + $open = @(string) file_get_contents($homep.$topf.$ext); |
|
385 | 385 | } |
386 | 386 | $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
387 | 387 | if (!empty($open)) { |
@@ -22,7 +22,7 @@ |
||
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | -$formSequence = new FormValidator('sequence_form', 'post', api_get_self(),null,null,'inline'); |
|
25 | +$formSequence = new FormValidator('sequence_form', 'post', api_get_self(), null, null, 'inline'); |
|
26 | 26 | $formSequence->addText('name', get_lang('Sequence'), true, ['cols-size' => [3, 8, 1]]); |
27 | 27 | $formSequence->addButtonCreate(get_lang('AddSequence'), 'submit_sequence', false, ['cols-size' => [3, 8, 1]]); |
28 | 28 |
@@ -8,43 +8,43 @@ discard block |
||
8 | 8 | */ |
9 | 9 | exit(); //not yet functional, needs to be revised |
10 | 10 | |
11 | -$cidReset=true; |
|
11 | +$cidReset = true; |
|
12 | 12 | |
13 | 13 | require('../inc/global.inc.php'); |
14 | 14 | $libpath = api_get_path(LIBRARY_PATH); |
15 | 15 | require("../auth/ldap/authldap.php"); |
16 | -$annee_base=date('Y'); |
|
16 | +$annee_base = date('Y'); |
|
17 | 17 | // setting the section (for the tabs) |
18 | 18 | $this_section = SECTION_PLATFORM_ADMIN; |
19 | 19 | api_protect_admin_script(); |
20 | 20 | |
21 | 21 | // setting breadcrumbs |
22 | -$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); |
|
23 | -$interbreadcrumb[]=array('url' => api_get_self(),"name" => get_lang('SessionsList')); |
|
22 | +$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
23 | +$interbreadcrumb[] = array('url' => api_get_self(), "name" => get_lang('SessionsList')); |
|
24 | 24 | |
25 | 25 | // Database Table Definitions |
26 | 26 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
27 | -$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); |
|
28 | -$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
29 | -$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
30 | -$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
|
31 | -$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
32 | -$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
33 | -$tbl_class = Database::get_main_table(TABLE_MAIN_CLASS); |
|
34 | -$tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER); |
|
27 | +$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); |
|
28 | +$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
29 | +$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
30 | +$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
|
31 | +$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
32 | +$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
33 | +$tbl_class = Database::get_main_table(TABLE_MAIN_CLASS); |
|
34 | +$tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER); |
|
35 | 35 | |
36 | -$tbl_session_rel_etape = "session_rel_etape"; |
|
36 | +$tbl_session_rel_etape = "session_rel_etape"; |
|
37 | 37 | |
38 | -$id_session=intval($_GET['id_session']); |
|
38 | +$id_session = intval($_GET['id_session']); |
|
39 | 39 | |
40 | -$formSent=0; |
|
41 | -$errorMsg=$firstLetterUser=$firstLetterSession=''; |
|
42 | -$UserList=$SessionList=array(); |
|
43 | -$users=$sessions=array(); |
|
44 | -$noPHP_SELF=true; |
|
40 | +$formSent = 0; |
|
41 | +$errorMsg = $firstLetterUser = $firstLetterSession = ''; |
|
42 | +$UserList = $SessionList = array(); |
|
43 | +$users = $sessions = array(); |
|
44 | +$noPHP_SELF = true; |
|
45 | 45 | |
46 | -$page=intval($_GET['page']); |
|
47 | -$action=$_REQUEST['action']; |
|
46 | +$page = intval($_GET['page']); |
|
47 | +$action = $_REQUEST['action']; |
|
48 | 48 | |
49 | 49 | $tool_name = get_lang('Synchro LDAP : Import Etudiants/Etapes dans session'); |
50 | 50 | Display::display_header($tool_name); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | </form> |
60 | 60 | |
61 | 61 | <?php |
62 | -if (isset($action) && ($action=="synchro")) { |
|
63 | - $included=true; |
|
62 | +if (isset($action) && ($action == "synchro")) { |
|
63 | + $included = true; |
|
64 | 64 | require('ldap_synchro.php'); |
65 | - Display :: display_normal_message($message,false); |
|
65 | + Display :: display_normal_message($message, false); |
|
66 | 66 | } |
67 | 67 | Display::display_footer(); |
68 | 68 | ?> |
@@ -60,9 +60,9 @@ |
||
60 | 60 | |
61 | 61 | <?php |
62 | 62 | if (isset($action) && ($action=="synchro")) { |
63 | - $included=true; |
|
64 | - require('ldap_synchro.php'); |
|
65 | - Display :: display_normal_message($message,false); |
|
63 | + $included=true; |
|
64 | + require('ldap_synchro.php'); |
|
65 | + Display :: display_normal_message($message,false); |
|
66 | 66 | } |
67 | 67 | Display::display_footer(); |
68 | 68 | ?> |
@@ -13,8 +13,8 @@ |
||
13 | 13 | |
14 | 14 | $tool_name = get_lang('Export'); |
15 | 15 | |
16 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
17 | -$interbreadcrumb[] = array ('url' => 'usergroups.php', 'name' => get_lang('Classes')); |
|
16 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
17 | +$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes')); |
|
18 | 18 | |
19 | 19 | set_time_limit(0); |
20 | 20 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | // Setting breadcrumbs. |
22 | 22 | $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
23 | -$interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('Classes')); |
|
23 | +$interbreadcrumb[] = array('url' => 'class_list.php', 'name' => get_lang('Classes')); |
|
24 | 24 | |
25 | 25 | // Setting the name of the tool. |
26 | 26 | $tool_name = get_lang("AddClasses"); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1 |
27 | 27 | ) { |
28 | 28 | $access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
29 | - $sql.= " INNER JOIN $access_url_rel_course_table url_rel_course |
|
29 | + $sql .= " INNER JOIN $access_url_rel_course_table url_rel_course |
|
30 | 30 | ON (c.id = url_rel_course.c_id)"; |
31 | 31 | } |
32 | 32 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if ((api_is_platform_admin() || api_is_session_admin()) && |
63 | 63 | api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1 |
64 | 64 | ) { |
65 | - $sql.= " AND url_rel_course.access_url_id = ".api_get_current_access_url_id(); |
|
65 | + $sql .= " AND url_rel_course.access_url_id = ".api_get_current_access_url_id(); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $res = Database::query($sql); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1 |
102 | 102 | ) { |
103 | 103 | $access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
104 | - $sql.= " INNER JOIN $access_url_rel_course_table url_rel_course |
|
104 | + $sql .= " INNER JOIN $access_url_rel_course_table url_rel_course |
|
105 | 105 | ON (course.id = url_rel_course.c_id)"; |
106 | 106 | } |
107 | 107 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if ((api_is_platform_admin() || api_is_session_admin()) && |
137 | 137 | api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1 |
138 | 138 | ) { |
139 | - $sql.= " AND url_rel_course.access_url_id=".api_get_current_access_url_id(); |
|
139 | + $sql .= " AND url_rel_course.access_url_id=".api_get_current_access_url_id(); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $sql .= " ORDER BY col$column $direction "; |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | |
207 | 207 | if (isset($_GET['session_id']) && !empty($_GET['session_id'])) { |
208 | 208 | $sessionId = intval($_GET['session_id']); |
209 | - $sql.= " WHERE s.id = ".$sessionId; |
|
209 | + $sql .= " WHERE s.id = ".$sessionId; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | $sql .= " ORDER BY col$column $direction "; |
213 | 213 | $sql .= " LIMIT $from,$number_of_items"; |
214 | 214 | $res = Database::query($sql); |
215 | - $courses = array (); |
|
215 | + $courses = array(); |
|
216 | 216 | while ($course = Database::fetch_array($res)) { |
217 | 217 | // Place colour icons in front of courses. |
218 | 218 | $show_visual_code = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function get_course_visibility_icon($v) { |
257 | 257 | $style = 'margin-bottom:0;margin-right:5px;'; |
258 | - switch($v) { |
|
258 | + switch ($v) { |
|
259 | 259 | case 0: |
260 | 260 | return Display::return_icon('bullet_red.png', get_lang('CourseVisibilityClosed'), array('style' => $style)); |
261 | 261 | break; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $form->setDefaults($defaults); |
343 | 343 | $content .= $form->return_form(); |
344 | 344 | } else { |
345 | - $interbreadcrumb[] = array ('url' => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
345 | + $interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
346 | 346 | $tool_name = get_lang('CourseList'); |
347 | 347 | |
348 | 348 | if (isset($_GET['action'])) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE); |
370 | 370 | $form->addElement('text', 'keyword', null, array('id' => 'course-search-keyword')); |
371 | 371 | $form->addButtonSearch(get_lang('SearchCourse')); |
372 | - $advanced = '<a class="btn btn-default" href="'. api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> '.get_lang('AdvancedSearch').'</a>'; |
|
372 | + $advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> '.get_lang('AdvancedSearch').'</a>'; |
|
373 | 373 | |
374 | 374 | // Create a filter by session |
375 | 375 | $sessionFilter = new FormValidator('course_filter', 'get', '', '', array(), FormValidator::LAYOUT_INLINE); |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | $courseListUrl = api_get_self(); |
391 | 391 | $actions .= '<div class="row">'; |
392 | 392 | $actions .= '<div class="col-md-2">'; |
393 | - $actions .= '<a href="course_add.php">'.Display::return_icon('new_course.png', get_lang('AddCourse'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
393 | + $actions .= '<a href="course_add.php">'.Display::return_icon('new_course.png', get_lang('AddCourse'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
394 | 394 | if (api_get_setting('course_validation') == 'true') { |
395 | - $actions .= '<a href="course_request_review.php">'.Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
395 | + $actions .= '<a href="course_request_review.php">'.Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
396 | 396 | } |
397 | 397 | $actions .= '</div>'; |
398 | 398 | $actions .= '<div class="col-md-4">'; |
@@ -430,18 +430,18 @@ discard block |
||
430 | 430 | $table = new SortableTable('courses', 'get_number_of_courses', 'get_course_data', 2, 20, 'ASC', 'course-list'); |
431 | 431 | } |
432 | 432 | |
433 | - $parameters=array(); |
|
433 | + $parameters = array(); |
|
434 | 434 | |
435 | 435 | if (isset ($_GET['keyword'])) { |
436 | - $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
436 | + $parameters = array('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
437 | 437 | } elseif (isset ($_GET['keyword_code'])) { |
438 | - $parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']); |
|
439 | - $parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']); |
|
438 | + $parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']); |
|
439 | + $parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']); |
|
440 | 440 | $parameters['keyword_category'] = Security::remove_XSS($_GET['keyword_category']); |
441 | 441 | $parameters['keyword_language'] = Security::remove_XSS($_GET['keyword_language']); |
442 | - $parameters['keyword_visibility'] = Security::remove_XSS($_GET['keyword_visibility']); |
|
443 | - $parameters['keyword_subscribe'] = Security::remove_XSS($_GET['keyword_subscribe']); |
|
444 | - $parameters['keyword_unsubscribe'] = Security::remove_XSS($_GET['keyword_unsubscribe']); |
|
442 | + $parameters['keyword_visibility'] = Security::remove_XSS($_GET['keyword_visibility']); |
|
443 | + $parameters['keyword_subscribe'] = Security::remove_XSS($_GET['keyword_subscribe']); |
|
444 | + $parameters['keyword_unsubscribe'] = Security::remove_XSS($_GET['keyword_unsubscribe']); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | $table->set_additional_parameters($parameters); |