@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $htmlHeadXtra[] = api_get_jqgrid_js(); |
19 | 19 | |
20 | 20 | // setting breadcrumbs |
21 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
22 | -$interbreadcrumb[]=array('url' => 'career_dashboard.php','name' => get_lang('CareersAndPromotions')); |
|
21 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
22 | +$interbreadcrumb[] = array('url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions')); |
|
23 | 23 | |
24 | 24 | Display :: display_header(null); |
25 | 25 | |
26 | -$form = new FormValidator('filter_form','GET', api_get_self()); |
|
26 | +$form = new FormValidator('filter_form', 'GET', api_get_self()); |
|
27 | 27 | |
28 | 28 | $career = new Career(); |
29 | 29 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | // action links |
55 | 55 | echo '<div class="actions" style="margin-bottom:20px">'; |
56 | 56 | echo '<a href="../admin/index.php">'. |
57 | - Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
57 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
58 | 58 | echo '<a href="careers.php">'. |
59 | - Display::return_icon('career.png',get_lang('Careers'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
59 | + Display::return_icon('career.png', get_lang('Careers'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
60 | 60 | echo '<a href="promotions.php">'. |
61 | - Display::return_icon('promotion.png',get_lang('Promotions'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
61 | + Display::return_icon('promotion.png', get_lang('Promotions'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
62 | 62 | echo '</div>'; |
63 | 63 | |
64 | 64 | $form->display(); |
@@ -119,22 +119,22 @@ discard block |
||
119 | 119 | foreach ($career_array as $career_id => $data) { |
120 | 120 | $career = $data['name']; |
121 | 121 | $promotions = $data['promotions']; |
122 | - $career = Display::url($career, 'careers.php?action=edit&id=' . $career_id); |
|
122 | + $career = Display::url($career, 'careers.php?action=edit&id='.$career_id); |
|
123 | 123 | $career = Display::tag('h4', $career); |
124 | - echo '<tr><td style="background-color:#ECF0F1" colspan="3">' . $career . '</td></tr>'; |
|
124 | + echo '<tr><td style="background-color:#ECF0F1" colspan="3">'.$career.'</td></tr>'; |
|
125 | 125 | if (!empty($promotions)) { |
126 | 126 | foreach ($promotions as $promotion_id => $promotion) { |
127 | 127 | $promotion_name = $promotion['name']; |
128 | - $promotion_url = Display::url($promotion_name, 'promotions.php?action=edit&id=' . $promotion_id); |
|
128 | + $promotion_url = Display::url($promotion_name, 'promotions.php?action=edit&id='.$promotion_id); |
|
129 | 129 | $sessions = $promotion['sessions']; |
130 | 130 | echo '<tr>'; |
131 | 131 | $count = count($sessions); |
132 | 132 | $rowspan = ''; |
133 | 133 | if (!empty($count)) { |
134 | 134 | $count++; |
135 | - $rowspan = 'rowspan="' . $count . '"'; |
|
135 | + $rowspan = 'rowspan="'.$count.'"'; |
|
136 | 136 | } |
137 | - echo '<td ' . $rowspan . '>'; |
|
137 | + echo '<td '.$rowspan.'>'; |
|
138 | 138 | echo Display::tag('h5', $promotion_url); |
139 | 139 | echo '</td>'; |
140 | 140 | echo '</tr>'; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $course_list = $session['courses']; |
145 | 145 | |
146 | 146 | $url = Display::url($session['data']['name'], |
147 | - '../session/resume_session.php?id_session=' . $session['data']['id']); |
|
147 | + '../session/resume_session.php?id_session='.$session['data']['id']); |
|
148 | 148 | echo '<tr>'; |
149 | 149 | //Session name |
150 | 150 | echo Display::tag('td', $url); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $url = Display::url( |
159 | 159 | $course['title'], |
160 | - api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . $session['data']['id'] |
|
160 | + api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.$session['data']['id'] |
|
161 | 161 | ); |
162 | 162 | echo Display::tag('td', $url); |
163 | 163 | echo '</tr>'; |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | |
16 | 16 | $tool_name = get_lang('SessionOverview'); |
17 | 17 | |
18 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
19 | -$interbreadcrumb[]=array('url' => 'session_list.php','name' => get_lang('SessionList')); |
|
18 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | +$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList')); |
|
20 | 20 | |
21 | 21 | // Database Table Definitions |
22 | -$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
23 | -$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
22 | +$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
23 | +$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
24 | 24 | $table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
25 | 25 | $url_id = api_get_current_access_url_id(); |
26 | 26 | |
27 | 27 | $action = $_GET['action']; |
28 | 28 | |
29 | -switch($action) { |
|
29 | +switch ($action) { |
|
30 | 30 | case 'add_user_to_url': |
31 | 31 | $user_id = $_REQUEST['user_id']; |
32 | 32 | $result = UrlManager::add_user_to_url($user_id, $url_id); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | -foreach($session_list as $session_item) { |
|
61 | +foreach ($session_list as $session_item) { |
|
62 | 62 | $session_id = $session_item['id']; |
63 | 63 | $html .= '<h3>'.$session_item['name'].'</h3>'; |
64 | 64 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $xajax = new xajax(); |
13 | 13 | $xajax->registerFunction( |
14 | - array('search_courses', 'Accessurleditcoursestourl', 'search_courses') |
|
14 | + array('search_courses', 'Accessurleditcoursestourl', 'search_courses') |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | // setting the section (for the tabs) |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | // Access restrictions |
21 | 21 | api_protect_global_admin_script(); |
22 | 22 | if (!api_get_multiple_access_url()) { |
23 | - header('Location: index.php'); |
|
24 | - exit; |
|
23 | + header('Location: index.php'); |
|
24 | + exit; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Database Table Definitions |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | |
37 | 37 | $add_type = 'multiple'; |
38 | 38 | if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') { |
39 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
39 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $access_url_id = 1; |
43 | 43 | if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') { |
44 | - $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']); |
|
44 | + $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $xajax -> processRequests(); |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | $users = $sessions = array(); |
84 | 84 | |
85 | 85 | if (isset($_POST['form_sent']) && $_POST['form_sent']) { |
86 | - $form_sent = $_POST['form_sent']; |
|
87 | - $course_list = $_POST['course_list']; |
|
88 | - |
|
89 | - if (!is_array($course_list)) { |
|
90 | - $course_list = array(); |
|
91 | - } |
|
92 | - |
|
93 | - if ($form_sent == 1) { |
|
94 | - if ($access_url_id==0) { |
|
95 | - header('Location: access_url_edit_users_to_url.php?action=show_message&message='.get_lang('SelectURL')); |
|
96 | - } elseif (is_array($course_list)) { |
|
97 | - UrlManager::update_urls_rel_course($course_list, $access_url_id); |
|
98 | - header('Location: access_urls.php?action=show_message&message='.get_lang('CoursesWereEdited')); |
|
99 | - } |
|
100 | - } |
|
86 | + $form_sent = $_POST['form_sent']; |
|
87 | + $course_list = $_POST['course_list']; |
|
88 | + |
|
89 | + if (!is_array($course_list)) { |
|
90 | + $course_list = array(); |
|
91 | + } |
|
92 | + |
|
93 | + if ($form_sent == 1) { |
|
94 | + if ($access_url_id==0) { |
|
95 | + header('Location: access_url_edit_users_to_url.php?action=show_message&message='.get_lang('SelectURL')); |
|
96 | + } elseif (is_array($course_list)) { |
|
97 | + UrlManager::update_urls_rel_course($course_list, $access_url_id); |
|
98 | + header('Location: access_urls.php?action=show_message&message='.get_lang('CoursesWereEdited')); |
|
99 | + } |
|
100 | + } |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | Display::display_header($tool_name); |
@@ -109,45 +109,45 @@ discard block |
||
109 | 109 | api_display_tool_title($tool_name); |
110 | 110 | |
111 | 111 | if (isset($_GET['action']) && $_GET['action'] == 'show_message') |
112 | - Display :: display_normal_message(Security::remove_XSS(stripslashes($_GET['message']))); |
|
112 | + Display :: display_normal_message(Security::remove_XSS(stripslashes($_GET['message']))); |
|
113 | 113 | |
114 | 114 | $no_course_list = $course_list = array(); |
115 | 115 | $ajax_search = $add_type == 'unique' ? true : false; |
116 | 116 | |
117 | 117 | if($ajax_search) { |
118 | - $courses = UrlManager::get_url_rel_course_data($access_url_id); |
|
119 | - foreach ($courses as $course) { |
|
120 | - $course_list[$course['c_id']] = $course; |
|
121 | - } |
|
118 | + $courses = UrlManager::get_url_rel_course_data($access_url_id); |
|
119 | + foreach ($courses as $course) { |
|
120 | + $course_list[$course['c_id']] = $course; |
|
121 | + } |
|
122 | 122 | } else { |
123 | - $courses = UrlManager::get_url_rel_course_data(); |
|
123 | + $courses = UrlManager::get_url_rel_course_data(); |
|
124 | 124 | |
125 | - foreach ($courses as $course) { |
|
126 | - if ($course['access_url_id'] == $access_url_id) { |
|
127 | - $course_list[$course['c_id']] = $course; |
|
128 | - } |
|
129 | - } |
|
125 | + foreach ($courses as $course) { |
|
126 | + if ($course['access_url_id'] == $access_url_id) { |
|
127 | + $course_list[$course['c_id']] = $course; |
|
128 | + } |
|
129 | + } |
|
130 | 130 | |
131 | - $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
132 | - $sql="SELECT id, code, title |
|
131 | + $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
132 | + $sql="SELECT id, code, title |
|
133 | 133 | FROM $tbl_course u |
134 | 134 | ORDER BY title, code"; |
135 | - $result = Database::query($sql); |
|
136 | - $courses = Database::store_result($result); |
|
137 | - $course_list_leys = array_keys($course_list); |
|
138 | - foreach ($courses as $course) { |
|
139 | - if (!in_array($course['id'], $course_list_leys)) { |
|
140 | - $no_course_list[$course['id']] = $course; |
|
141 | - } |
|
142 | - } |
|
135 | + $result = Database::query($sql); |
|
136 | + $courses = Database::store_result($result); |
|
137 | + $course_list_leys = array_keys($course_list); |
|
138 | + foreach ($courses as $course) { |
|
139 | + if (!in_array($course['id'], $course_list_leys)) { |
|
140 | + $no_course_list[$course['id']] = $course; |
|
141 | + } |
|
142 | + } |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if($add_type == 'multiple') { |
146 | - $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>'; |
|
147 | - $link_add_type_multiple = get_lang('SessionAddTypeMultiple'); |
|
146 | + $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>'; |
|
147 | + $link_add_type_multiple = get_lang('SessionAddTypeMultiple'); |
|
148 | 148 | } else { |
149 | - $link_add_type_unique = get_lang('SessionAddTypeUnique'); |
|
150 | - $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>'; |
|
149 | + $link_add_type_unique = get_lang('SessionAddTypeUnique'); |
|
150 | + $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>'; |
|
151 | 151 | } |
152 | 152 | $url_list = UrlManager::get_url_data(); |
153 | 153 | ?> |
@@ -160,31 +160,31 @@ discard block |
||
160 | 160 | <select name="access_url_id" onchange="javascript:send();"> |
161 | 161 | <option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option> |
162 | 162 | <?php |
163 | - $url_selected=''; |
|
164 | - foreach ($url_list as $url_obj) { |
|
165 | - $checked = ''; |
|
166 | - if (!empty($access_url_id)) { |
|
167 | - if ($url_obj[0]==$access_url_id) { |
|
168 | - $checked = 'selected=true'; |
|
169 | - $url_selected=$url_obj[1]; |
|
170 | - } |
|
171 | - } |
|
172 | - if ($url_obj['active']==1) { |
|
173 | - ?> |
|
163 | + $url_selected=''; |
|
164 | + foreach ($url_list as $url_obj) { |
|
165 | + $checked = ''; |
|
166 | + if (!empty($access_url_id)) { |
|
167 | + if ($url_obj[0]==$access_url_id) { |
|
168 | + $checked = 'selected=true'; |
|
169 | + $url_selected=$url_obj[1]; |
|
170 | + } |
|
171 | + } |
|
172 | + if ($url_obj['active']==1) { |
|
173 | + ?> |
|
174 | 174 | <option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option> |
175 | 175 | <?php |
176 | - } |
|
177 | - } |
|
178 | - ?> |
|
176 | + } |
|
177 | + } |
|
178 | + ?> |
|
179 | 179 | </select> |
180 | 180 | <br /><br /> |
181 | 181 | <input type="hidden" name="form_sent" value="1" /> |
182 | 182 | <input type="hidden" name="add_type" value = "<?php echo $add_type ?>" /> |
183 | 183 | <?php |
184 | - if(!empty($errorMsg)) { |
|
185 | - Display::display_normal_message($errorMsg); //main API |
|
186 | - } |
|
187 | - ?> |
|
184 | + if(!empty($errorMsg)) { |
|
185 | + Display::display_normal_message($errorMsg); //main API |
|
186 | + } |
|
187 | + ?> |
|
188 | 188 | <table border="0" cellpadding="5" cellspacing="0" width="100%"> |
189 | 189 | |
190 | 190 | <!-- Users --> |
@@ -199,38 +199,38 @@ discard block |
||
199 | 199 | <td align="center"> |
200 | 200 | <div id="content_source"> |
201 | 201 | <?php |
202 | - if($ajax_search) { |
|
203 | - ?> |
|
202 | + if($ajax_search) { |
|
203 | + ?> |
|
204 | 204 | <input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" /> |
205 | 205 | <div id="ajax_list_courses"></div> |
206 | 206 | <?php |
207 | - } else { |
|
208 | - ?> |
|
207 | + } else { |
|
208 | + ?> |
|
209 | 209 | <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;"> |
210 | 210 | <?php |
211 | - foreach($no_course_list as $no_course) { |
|
212 | - ?> |
|
211 | + foreach($no_course_list as $no_course) { |
|
212 | + ?> |
|
213 | 213 | <option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option> |
214 | 214 | <?php |
215 | - } |
|
216 | - unset($no_course_list); |
|
217 | - ?> |
|
215 | + } |
|
216 | + unset($no_course_list); |
|
217 | + ?> |
|
218 | 218 | </select> |
219 | 219 | <?php |
220 | - } |
|
221 | - ?> |
|
220 | + } |
|
221 | + ?> |
|
222 | 222 | </div> |
223 | 223 | </td> |
224 | 224 | <td width="10%" valign="middle" align="center"> |
225 | 225 | <?php |
226 | - if($ajax_search) { |
|
227 | - ?> |
|
226 | + if($ajax_search) { |
|
227 | + ?> |
|
228 | 228 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" > |
229 | 229 | <em class="fa fa-arrow-left"></em> |
230 | 230 | </button> |
231 | 231 | <?php |
232 | - } else { |
|
233 | - ?> |
|
232 | + } else { |
|
233 | + ?> |
|
234 | 234 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" > |
235 | 235 | <em class="fa fa-arrow-right"></em> |
236 | 236 | </button> |
@@ -239,21 +239,21 @@ discard block |
||
239 | 239 | <em class="fa fa-arrow-left"></em> |
240 | 240 | </button> |
241 | 241 | <?php |
242 | - } |
|
243 | - ?> |
|
242 | + } |
|
243 | + ?> |
|
244 | 244 | <br /><br /><br /><br /><br /><br /> |
245 | 245 | </td> |
246 | 246 | <td align="center"> |
247 | 247 | <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;"> |
248 | 248 | <?php |
249 | - foreach($course_list as $course) { |
|
250 | - $courseInfo = api_get_course_info_by_id($course['id']); |
|
251 | - ?> |
|
249 | + foreach($course_list as $course) { |
|
250 | + $courseInfo = api_get_course_info_by_id($course['id']); |
|
251 | + ?> |
|
252 | 252 | <option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option> |
253 | 253 | <?php |
254 | - } |
|
255 | - unset($course_list); |
|
256 | - ?> |
|
254 | + } |
|
255 | + unset($course_list); |
|
256 | + ?> |
|
257 | 257 | |
258 | 258 | </select></td> |
259 | 259 | </tr> |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | <td colspan="3" align="center"> |
262 | 262 | <br /> |
263 | 263 | <?php |
264 | - if(isset($_GET['add'])) |
|
265 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
266 | - else |
|
267 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
268 | - ?> |
|
264 | + if(isset($_GET['add'])) |
|
265 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
266 | + else |
|
267 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
268 | + ?> |
|
269 | 269 | </td> |
270 | 270 | </tr> |
271 | 271 | </table> |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | $interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
36 | 36 | |
37 | 37 | $add_type = 'multiple'; |
38 | -if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') { |
|
38 | +if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { |
|
39 | 39 | $add_type = Security::remove_XSS($_REQUEST['add_type']); |
40 | 40 | } |
41 | 41 | |
42 | 42 | $access_url_id = 1; |
43 | -if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') { |
|
43 | +if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id'] != '') { |
|
44 | 44 | $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']); |
45 | 45 | } |
46 | 46 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if ($form_sent == 1) { |
94 | - if ($access_url_id==0) { |
|
94 | + if ($access_url_id == 0) { |
|
95 | 95 | header('Location: access_url_edit_users_to_url.php?action=show_message&message='.get_lang('SelectURL')); |
96 | 96 | } elseif (is_array($course_list)) { |
97 | 97 | UrlManager::update_urls_rel_course($course_list, $access_url_id); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | Display::display_header($tool_name); |
104 | 104 | |
105 | 105 | echo '<div class="actions">'; |
106 | -echo Display::url( Display::return_icon('view_more_stats.gif', get_lang('AddUserToURL'),''), api_get_path(WEB_CODE_PATH).'admin/access_url_add_courses_to_url.php'); |
|
106 | +echo Display::url(Display::return_icon('view_more_stats.gif', get_lang('AddUserToURL'), ''), api_get_path(WEB_CODE_PATH).'admin/access_url_add_courses_to_url.php'); |
|
107 | 107 | echo '</div>'; |
108 | 108 | |
109 | 109 | api_display_tool_title($tool_name); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $no_course_list = $course_list = array(); |
115 | 115 | $ajax_search = $add_type == 'unique' ? true : false; |
116 | 116 | |
117 | -if($ajax_search) { |
|
117 | +if ($ajax_search) { |
|
118 | 118 | $courses = UrlManager::get_url_rel_course_data($access_url_id); |
119 | 119 | foreach ($courses as $course) { |
120 | 120 | $course_list[$course['c_id']] = $course; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
132 | - $sql="SELECT id, code, title |
|
132 | + $sql = "SELECT id, code, title |
|
133 | 133 | FROM $tbl_course u |
134 | 134 | ORDER BY title, code"; |
135 | 135 | $result = Database::query($sql); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | -if($add_type == 'multiple') { |
|
145 | +if ($add_type == 'multiple') { |
|
146 | 146 | $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>'; |
147 | 147 | $link_add_type_multiple = get_lang('SessionAddTypeMultiple'); |
148 | 148 | } else { |
@@ -155,23 +155,23 @@ discard block |
||
155 | 155 | <?php echo $link_add_type_unique ?> | <?php echo $link_add_type_multiple ?> |
156 | 156 | </div> |
157 | 157 | <br /><br /> |
158 | - <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?> > |
|
158 | + <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?> > |
|
159 | 159 | <?php echo get_lang('SelectUrl').' : '; ?> |
160 | 160 | <select name="access_url_id" onchange="javascript:send();"> |
161 | 161 | <option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option> |
162 | 162 | <?php |
163 | - $url_selected=''; |
|
163 | + $url_selected = ''; |
|
164 | 164 | foreach ($url_list as $url_obj) { |
165 | 165 | $checked = ''; |
166 | 166 | if (!empty($access_url_id)) { |
167 | - if ($url_obj[0]==$access_url_id) { |
|
167 | + if ($url_obj[0] == $access_url_id) { |
|
168 | 168 | $checked = 'selected=true'; |
169 | - $url_selected=$url_obj[1]; |
|
169 | + $url_selected = $url_obj[1]; |
|
170 | 170 | } |
171 | 171 | } |
172 | - if ($url_obj['active']==1) { |
|
172 | + if ($url_obj['active'] == 1) { |
|
173 | 173 | ?> |
174 | - <option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option> |
|
174 | + <option <?php echo $checked; ?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option> |
|
175 | 175 | <?php |
176 | 176 | } |
177 | 177 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | <input type="hidden" name="form_sent" value="1" /> |
182 | 182 | <input type="hidden" name="add_type" value = "<?php echo $add_type ?>" /> |
183 | 183 | <?php |
184 | - if(!empty($errorMsg)) { |
|
184 | + if (!empty($errorMsg)) { |
|
185 | 185 | Display::display_normal_message($errorMsg); //main API |
186 | 186 | } |
187 | 187 | ?> |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | <td align="center"> |
200 | 200 | <div id="content_source"> |
201 | 201 | <?php |
202 | - if($ajax_search) { |
|
202 | + if ($ajax_search) { |
|
203 | 203 | ?> |
204 | 204 | <input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" /> |
205 | 205 | <div id="ajax_list_courses"></div> |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | ?> |
209 | 209 | <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;"> |
210 | 210 | <?php |
211 | - foreach($no_course_list as $no_course) { |
|
211 | + foreach ($no_course_list as $no_course) { |
|
212 | 212 | ?> |
213 | 213 | <option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option> |
214 | 214 | <?php |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | </td> |
224 | 224 | <td width="10%" valign="middle" align="center"> |
225 | 225 | <?php |
226 | - if($ajax_search) { |
|
226 | + if ($ajax_search) { |
|
227 | 227 | ?> |
228 | 228 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" > |
229 | 229 | <em class="fa fa-arrow-left"></em> |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | <td align="center"> |
247 | 247 | <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;"> |
248 | 248 | <?php |
249 | - foreach($course_list as $course) { |
|
249 | + foreach ($course_list as $course) { |
|
250 | 250 | $courseInfo = api_get_course_info_by_id($course['id']); |
251 | 251 | ?> |
252 | 252 | <option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option> |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | <td colspan="3" align="center"> |
262 | 262 | <br /> |
263 | 263 | <?php |
264 | - if(isset($_GET['add'])) |
|
264 | + if (isset($_GET['add'])) |
|
265 | 265 | echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
266 | 266 | else |
267 | 267 | echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
@@ -108,8 +108,9 @@ discard block |
||
108 | 108 | |
109 | 109 | api_display_tool_title($tool_name); |
110 | 110 | |
111 | -if (isset($_GET['action']) && $_GET['action'] == 'show_message') |
|
111 | +if (isset($_GET['action']) && $_GET['action'] == 'show_message') { |
|
112 | 112 | Display :: display_normal_message(Security::remove_XSS(stripslashes($_GET['message']))); |
113 | +} |
|
113 | 114 | |
114 | 115 | $no_course_list = $course_list = array(); |
115 | 116 | $ajax_search = $add_type == 'unique' ? true : false; |
@@ -261,10 +262,11 @@ discard block |
||
261 | 262 | <td colspan="3" align="center"> |
262 | 263 | <br /> |
263 | 264 | <?php |
264 | - if(isset($_GET['add'])) |
|
265 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
266 | - else |
|
267 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
265 | + if(isset($_GET['add'])) { |
|
266 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
267 | + } else { |
|
268 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
269 | + } |
|
268 | 270 | ?> |
269 | 271 | </td> |
270 | 272 | </tr> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | api_protect_admin_script(true); |
17 | 17 | |
18 | 18 | // setting breadcrumbs |
19 | -$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
19 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
20 | 20 | |
21 | 21 | $form = new FormValidator('archive_cleanup_form', 'post', '', '', array(), FormValidator::LAYOUT_BOX); |
22 | 22 | $form->addButtonSend(get_lang('ArchiveDirCleanupProceedButton')); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | if (isset($_GET['msg']) && isset($_GET['type'])) { |
52 | 52 | if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) |
53 | - switch($_GET['type']) { |
|
53 | + switch ($_GET['type']) { |
|
54 | 54 | case 'error': |
55 | 55 | $message = Display::return_message(get_lang($_GET['msg']), 'error'); |
56 | 56 | break; |
@@ -49,10 +49,11 @@ |
||
49 | 49 | Display::display_warning_message(get_lang('ArchiveDirCleanupDescr')); |
50 | 50 | |
51 | 51 | if (isset($_GET['msg']) && isset($_GET['type'])) { |
52 | - if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) |
|
53 | - switch($_GET['type']) { |
|
52 | + if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) { |
|
53 | + switch($_GET['type']) { |
|
54 | 54 | case 'error': |
55 | 55 | $message = Display::return_message(get_lang($_GET['msg']), 'error'); |
56 | + } |
|
56 | 57 | break; |
57 | 58 | case 'confirmation': |
58 | 59 | $message = Display::return_message(get_lang($_GET['msg']), 'confirm'); |
@@ -24,39 +24,39 @@ |
||
24 | 24 | $message = null; |
25 | 25 | |
26 | 26 | if ($form->validate()) { |
27 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
28 | - $htaccess = @file_get_contents($archive_path.'.htaccess'); |
|
29 | - $result = rmdirr($archive_path, true, true); |
|
27 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
28 | + $htaccess = @file_get_contents($archive_path.'.htaccess'); |
|
29 | + $result = rmdirr($archive_path, true, true); |
|
30 | 30 | |
31 | - \Chamilo\CoreBundle\Composer\ScriptHandler::dumpCssFiles(); |
|
31 | + \Chamilo\CoreBundle\Composer\ScriptHandler::dumpCssFiles(); |
|
32 | 32 | |
33 | - if (!empty($htaccess)) { |
|
34 | - @file_put_contents($archive_path.'/.htaccess', $htaccess); |
|
35 | - } |
|
36 | - if ($result) { |
|
37 | - $message = 'ArchiveDirCleanupSucceeded'; |
|
38 | - $type = 'confirmation'; |
|
39 | - } else { |
|
40 | - $message = 'ArchiveDirCleanupFailed'; |
|
41 | - $type = 'error'; |
|
42 | - } |
|
33 | + if (!empty($htaccess)) { |
|
34 | + @file_put_contents($archive_path.'/.htaccess', $htaccess); |
|
35 | + } |
|
36 | + if ($result) { |
|
37 | + $message = 'ArchiveDirCleanupSucceeded'; |
|
38 | + $type = 'confirmation'; |
|
39 | + } else { |
|
40 | + $message = 'ArchiveDirCleanupFailed'; |
|
41 | + $type = 'error'; |
|
42 | + } |
|
43 | 43 | |
44 | - header('Location: '.api_get_self().'?msg='.$message.'&type='.$type); |
|
45 | - exit; |
|
44 | + header('Location: '.api_get_self().'?msg='.$message.'&type='.$type); |
|
45 | + exit; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | Display::display_header(get_lang('ArchiveDirCleanup')); |
49 | 49 | Display::display_warning_message(get_lang('ArchiveDirCleanupDescr')); |
50 | 50 | |
51 | 51 | if (isset($_GET['msg']) && isset($_GET['type'])) { |
52 | - if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) |
|
53 | - switch($_GET['type']) { |
|
54 | - case 'error': |
|
55 | - $message = Display::return_message(get_lang($_GET['msg']), 'error'); |
|
56 | - break; |
|
57 | - case 'confirmation': |
|
58 | - $message = Display::return_message(get_lang($_GET['msg']), 'confirm'); |
|
59 | - } |
|
52 | + if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) |
|
53 | + switch($_GET['type']) { |
|
54 | + case 'error': |
|
55 | + $message = Display::return_message(get_lang($_GET['msg']), 'error'); |
|
56 | + break; |
|
57 | + case 'confirmation': |
|
58 | + $message = Display::return_message(get_lang($_GET['msg']), 'confirm'); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if (!empty($message)) { |
@@ -12,13 +12,13 @@ |
||
12 | 12 | */ |
13 | 13 | function validate_data($courses) |
14 | 14 | { |
15 | - $errors = array (); |
|
16 | - $coursecodes = array (); |
|
15 | + $errors = array(); |
|
16 | + $coursecodes = array(); |
|
17 | 17 | foreach ($courses as $index => $course) { |
18 | - $course['line'] = $index +1; |
|
18 | + $course['line'] = $index + 1; |
|
19 | 19 | |
20 | 20 | // 1. Check whether mandatory fields are set. |
21 | - $mandatory_fields = array ('Code', 'Title', 'CourseCategory'); |
|
21 | + $mandatory_fields = array('Code', 'Title', 'CourseCategory'); |
|
22 | 22 | foreach ($mandatory_fields as $field) { |
23 | 23 | if (!isset($course[$field]) || strlen($course[$field]) == 0) { |
24 | 24 | $course['error'] = get_lang($field.'Mandatory'); |
@@ -151,7 +151,7 @@ |
||
151 | 151 | /** |
152 | 152 | * Read the CSV-file |
153 | 153 | * @param string $file Path to the CSV-file |
154 | - * @return array All course-information read from the file |
|
154 | + * @return Ddeboer\DataImport\Reader\CsvReader All course-information read from the file |
|
155 | 155 | */ |
156 | 156 | function parse_csv_data($file) |
157 | 157 | { |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | $result = Database::query($sql); |
33 | 33 | |
34 | 34 | if (!list ($class_name) = Database::fetch_row($result)) { |
35 | - header('Location: class_list.php?filtreCours=' . urlencode($course)); |
|
35 | + header('Location: class_list.php?filtreCours='.urlencode($course)); |
|
36 | 36 | exit(); |
37 | 37 | } |
38 | 38 | |
39 | 39 | $noPHP_SELF = true; |
40 | 40 | |
41 | -$tool_name = get_lang('AddUsersToAClass') . ' (' . $class_name . ')'; |
|
41 | +$tool_name = get_lang('AddUsersToAClass').' ('.$class_name.')'; |
|
42 | 42 | |
43 | 43 | $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
44 | -$interbreadcrumb[] = array("url" => "class_list.php?filtreCours=" . urlencode($course), "name" => get_lang('AdminClasses')); |
|
44 | +$interbreadcrumb[] = array("url" => "class_list.php?filtreCours=".urlencode($course), "name" => get_lang('AdminClasses')); |
|
45 | 45 | |
46 | 46 | if ($_POST['formSent']) { |
47 | 47 | $form_sent = $_POST['formSent']; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | foreach ($left_user_list as $user_id) { |
60 | 60 | ClassManager :: add_user($user_id, $class_id); |
61 | 61 | } |
62 | - header('Location: class_list.php?filtreCours=' . urlencode($course)); |
|
62 | + header('Location: class_list.php?filtreCours='.urlencode($course)); |
|
63 | 63 | exit(); |
64 | 64 | } |
65 | 65 | } elseif ($remove_from_class) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | foreach ($right_user_list as $index => $user_id) { |
70 | 70 | ClassManager :: unsubscribe_user($user_id, $class_id); |
71 | 71 | } |
72 | - header('Location: class_list.php?filtreCours=' . urlencode($course)); |
|
72 | + header('Location: class_list.php?filtreCours='.urlencode($course)); |
|
73 | 73 | exit(); |
74 | 74 | } |
75 | 75 | } |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | Display :: display_header($tool_name); |
79 | 79 | //api_display_tool_title($tool_name); |
80 | 80 | $target_name = api_sort_by_first_name() ? 'firstname' : 'lastname'; |
81 | -$sql = "SELECT u.user_id,lastname,firstname,username FROM $tbl_user u LEFT JOIN $tbl_class_user cu ON u.user_id=cu.user_id AND class_id='$class_id' WHERE " . $target_name . " LIKE '" . $first_letter_left . "%' AND class_id IS NULL ORDER BY " . (count($left_user_list) > 0 ? "(user_id IN(" . implode(',', $left_user_list) . ")) DESC," : "") . " " . $target_name; |
|
81 | +$sql = "SELECT u.user_id,lastname,firstname,username FROM $tbl_user u LEFT JOIN $tbl_class_user cu ON u.user_id=cu.user_id AND class_id='$class_id' WHERE ".$target_name." LIKE '".$first_letter_left."%' AND class_id IS NULL ORDER BY ".(count($left_user_list) > 0 ? "(user_id IN(".implode(',', $left_user_list).")) DESC," : "")." ".$target_name; |
|
82 | 82 | $result = Database::query($sql); |
83 | 83 | $left_users = Database::store_result($result); |
84 | -$sql = "SELECT u.user_id,lastname,firstname,username FROM $tbl_user u,$tbl_class_user cu WHERE cu.user_id=u.user_id AND class_id='$class_id' AND " . $target_name . " LIKE '" . $first_letter_right . "%' ORDER BY " . (count($right_user_list) > 0 ? "(user_id IN(" . implode(',', $right_user_list) . ")) DESC," : "") . " " . $target_name; |
|
84 | +$sql = "SELECT u.user_id,lastname,firstname,username FROM $tbl_user u,$tbl_class_user cu WHERE cu.user_id=u.user_id AND class_id='$class_id' AND ".$target_name." LIKE '".$first_letter_right."%' ORDER BY ".(count($right_user_list) > 0 ? "(user_id IN(".implode(',', $right_user_list).")) DESC," : "")." ".$target_name; |
|
85 | 85 | $result = Database::query($sql); |
86 | 86 | $right_users = Database::store_result($result); |
87 | 87 | if (!empty($error_message)) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <?php |
123 | 123 | foreach ($left_users as $user) { |
124 | 124 | ?> |
125 | - <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $left_user_list)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')'; ?></option> |
|
125 | + <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $left_user_list)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?></option> |
|
126 | 126 | <?php |
127 | 127 | } |
128 | 128 | ?> |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | <?php |
139 | 139 | foreach ($right_users as $user) { |
140 | 140 | ?> |
141 | - <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $right_user_list)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')'; ?></option> |
|
141 | + <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $right_user_list)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?></option> |
|
142 | 142 | <?php |
143 | 143 | } |
144 | 144 | ?> |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | exit(); |
64 | 64 | } |
65 | 65 | } elseif ($remove_from_class) { |
66 | - if (count($right_user_list) == 0) |
|
67 | - $error_message = get_lang('AtLeastOneUser'); |
|
68 | - else { |
|
66 | + if (count($right_user_list) == 0) { |
|
67 | + $error_message = get_lang('AtLeastOneUser'); |
|
68 | + } else { |
|
69 | 69 | foreach ($right_user_list as $index => $user_id) { |
70 | 70 | ClassManager :: unsubscribe_user($user_id, $class_id); |
71 | 71 | } |
@@ -122,7 +122,10 @@ discard block |
||
122 | 122 | <?php |
123 | 123 | foreach ($left_users as $user) { |
124 | 124 | ?> |
125 | - <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $left_user_list)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')'; ?></option> |
|
125 | + <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $left_user_list)) { |
|
126 | + echo 'selected="selected"'; |
|
127 | +} |
|
128 | +?>><?php echo api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')'; ?></option> |
|
126 | 129 | <?php |
127 | 130 | } |
128 | 131 | ?> |
@@ -138,7 +141,10 @@ discard block |
||
138 | 141 | <?php |
139 | 142 | foreach ($right_users as $user) { |
140 | 143 | ?> |
141 | - <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $right_user_list)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')'; ?></option> |
|
144 | + <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $right_user_list)) { |
|
145 | + echo 'selected="selected"'; |
|
146 | +} |
|
147 | +?>><?php echo api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')'; ?></option> |
|
142 | 148 | <?php |
143 | 149 | } |
144 | 150 | ?> |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | <option value="">--</option> |
264 | 264 | <?php |
265 | 265 | echo Display :: get_alphabet_options($first_letter_user); |
266 | - ?> |
|
266 | + ?> |
|
267 | 267 | </select> |
268 | 268 | </td> |
269 | 269 | <td width="20%"> </td> |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | <select name="firstLetterCourse" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"> |
275 | 275 | <option value="">--</option> |
276 | 276 | <?php |
277 | - echo Display :: get_alphabet_options($first_letter_course); |
|
278 | - ?> |
|
277 | + echo Display :: get_alphabet_options($first_letter_course); |
|
278 | + ?> |
|
279 | 279 | </select> |
280 | 280 | </td> |
281 | 281 | </tr> |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | echo $userName; |
298 | - ?> |
|
298 | + ?> |
|
299 | 299 | </option> |
300 | 300 | <?php |
301 | 301 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $form_sent = 0; |
24 | 24 | $first_letter_user = ''; |
25 | 25 | $first_letter_course = ''; |
26 | -$courses = array (); |
|
26 | +$courses = array(); |
|
27 | 27 | $users = array(); |
28 | 28 | |
29 | 29 | $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | /* Header */ |
33 | 33 | $tool_name = get_lang('AddUsersToACourse'); |
34 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
34 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
35 | 35 | |
36 | 36 | $htmlHeadXtra[] = ' |
37 | 37 | <script type="text/javascript"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // displaying the header |
45 | 45 | Display :: display_header($tool_name); |
46 | 46 | |
47 | -$link_add_group = '<a href="usergroups.php">'.Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').'</a>'; |
|
47 | +$link_add_group = '<a href="usergroups.php">'.Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').'</a>'; |
|
48 | 48 | echo '<div class="actions">'.$link_add_group.'</div>'; |
49 | 49 | |
50 | 50 | $form = new FormValidator('subscribe_user2course'); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | $form->display(); |
53 | 53 | |
54 | 54 | //checking for extra field with filter on |
55 | -$extra_field_list= UserManager::get_extra_fields(); |
|
55 | +$extra_field_list = UserManager::get_extra_fields(); |
|
56 | 56 | $new_field_list = array(); |
57 | 57 | if (is_array($extra_field_list)) { |
58 | 58 | foreach ($extra_field_list as $extra_field) { |
59 | 59 | //if is enabled to filter and is a "<select>" field type |
60 | - if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
60 | + if ($extra_field[8] == 1 && $extra_field[2] == 4) { |
|
61 | 61 | $new_field_list[] = array('name'=> $extra_field[3], 'variable'=>$extra_field[1], 'data'=> $extra_field[9]); |
62 | 62 | } |
63 | 63 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | /* React on POSTed request */ |
67 | 67 | if (isset($_POST['form_sent']) && $_POST['form_sent']) { |
68 | 68 | $form_sent = $_POST['form_sent']; |
69 | - $users = isset($_POST['UserList']) && is_array($_POST['UserList']) ? $_POST['UserList'] : array() ; |
|
70 | - $courses = isset($_POST['CourseList']) && is_array($_POST['CourseList']) ? $_POST['CourseList'] : array() ; |
|
69 | + $users = isset($_POST['UserList']) && is_array($_POST['UserList']) ? $_POST['UserList'] : array(); |
|
70 | + $courses = isset($_POST['CourseList']) && is_array($_POST['CourseList']) ? $_POST['CourseList'] : array(); |
|
71 | 71 | $first_letter_user = $_POST['firstLetterUser']; |
72 | 72 | $first_letter_course = $_POST['firstLetterCourse']; |
73 | 73 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
106 | 106 | $result = Database::query($sql); |
107 | 107 | $num_row = Database::fetch_array($result); |
108 | - if ($num_row['nb_users']>1000) { |
|
108 | + if ($num_row['nb_users'] > 1000) { |
|
109 | 109 | //if there are too much users to gracefully handle with the HTML select list, |
110 | 110 | // assign a default filter on users names |
111 | 111 | $first_letter_user = 'A'; |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | //Filter by Extra Fields |
120 | 120 | $use_extra_fields = false; |
121 | 121 | if (is_array($extra_field_list)) { |
122 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
123 | - $result_list=array(); |
|
122 | + if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
123 | + $result_list = array(); |
|
124 | 124 | foreach ($new_field_list as $new_field) { |
125 | 125 | $varname = 'field_'.$new_field['variable']; |
126 | 126 | if (UserManager::is_extra_field_available($new_field['variable'])) { |
127 | - if (isset($_POST[$varname]) && $_POST[$varname]!='0') { |
|
127 | + if (isset($_POST[$varname]) && $_POST[$varname] != '0') { |
|
128 | 128 | $use_extra_fields = true; |
129 | - $extra_field_result[]= UserManager::get_extra_user_data_by_value( |
|
129 | + $extra_field_result[] = UserManager::get_extra_user_data_by_value( |
|
130 | 130 | $new_field['variable'], |
131 | 131 | $_POST[$varname] |
132 | 132 | ); |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | |
139 | 139 | if ($use_extra_fields) { |
140 | 140 | $final_result = array(); |
141 | - if (count($extra_field_result)>1) { |
|
142 | - for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
143 | - if (is_array($extra_field_result[$i+1])) { |
|
144 | - $final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]); |
|
141 | + if (count($extra_field_result) > 1) { |
|
142 | + for ($i = 0; $i < count($extra_field_result) - 1; $i++) { |
|
143 | + if (is_array($extra_field_result[$i + 1])) { |
|
144 | + $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | } else { |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | if (api_is_multiple_url_enabled()) { |
152 | - if (is_array($final_result) && count($final_result)>0) { |
|
153 | - $where_filter = " AND u.user_id IN ('".implode("','",$final_result)."') "; |
|
152 | + if (is_array($final_result) && count($final_result) > 0) { |
|
153 | + $where_filter = " AND u.user_id IN ('".implode("','", $final_result)."') "; |
|
154 | 154 | } else { |
155 | 155 | //no results |
156 | 156 | $where_filter = " AND u.user_id = -1"; |
157 | 157 | } |
158 | 158 | } else { |
159 | - if (is_array($final_result) && count($final_result)>0) { |
|
160 | - $where_filter = " AND user_id IN ('".implode("','",$final_result)."') "; |
|
159 | + if (is_array($final_result) && count($final_result) > 0) { |
|
160 | + $where_filter = " AND user_id IN ('".implode("','", $final_result)."') "; |
|
161 | 161 | } else { |
162 | 162 | //no results |
163 | 163 | $where_filter = " AND user_id = -1"; |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | $sql = "SELECT user_id, lastname, firstname, username, official_code |
178 | 178 | FROM $tbl_user |
179 | 179 | WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter |
180 | - ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
180 | + ORDER BY ".(count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
181 | 181 | |
182 | 182 | if (api_is_multiple_url_enabled()) { |
183 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
183 | + $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
184 | 184 | $access_url_id = api_get_current_access_url_id(); |
185 | - if ($access_url_id != -1){ |
|
185 | + if ($access_url_id != -1) { |
|
186 | 186 | $sql = "SELECT u.user_id,lastname,firstname,username, official_code |
187 | - FROM ".$tbl_user ." u |
|
187 | + FROM ".$tbl_user." u |
|
188 | 188 | INNER JOIN $tbl_user_rel_access_url user_rel_url |
189 | 189 | ON (user_rel_url.user_id = u.user_id) |
190 | 190 | WHERE |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | access_url_id = $access_url_id AND |
193 | 193 | (".$target_name." LIKE '".$first_letter_user."%' ) |
194 | 194 | $where_filter |
195 | - ORDER BY ". (count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
195 | + ORDER BY ".(count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if (api_is_multiple_url_enabled()) { |
209 | 209 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
210 | 210 | $access_url_id = api_get_current_access_url_id(); |
211 | - if ($access_url_id != -1){ |
|
211 | + if ($access_url_id != -1) { |
|
212 | 212 | $sql = "SELECT code, visual_code, title |
213 | 213 | FROM $tbl_course as course |
214 | 214 | INNER JOIN $tbl_course_rel_access_url course_rel_url |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;"> |
229 | 229 | <?php |
230 | 230 | if (is_array($extra_field_list)) { |
231 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
231 | + if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
232 | 232 | echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
233 | 233 | foreach ($new_field_list as $new_field) { |
234 | 234 | echo $new_field['name']; |
235 | 235 | $varname = 'field_'.$new_field['variable']; |
236 | 236 | echo ' <select name="'.$varname.'">'; |
237 | 237 | echo '<option value="0">--'.get_lang('Select').'--</option>'; |
238 | - foreach ($new_field['data'] as $option) { |
|
239 | - $checked=''; |
|
238 | + foreach ($new_field['data'] as $option) { |
|
239 | + $checked = ''; |
|
240 | 240 | if (isset($_POST[$varname])) { |
241 | - if ($_POST[$varname]==$option[1]) { |
|
241 | + if ($_POST[$varname] == $option[1]) { |
|
242 | 242 | $checked = 'selected="true"'; |
243 | 243 | } |
244 | 244 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | <?php |
286 | 286 | foreach ($db_users as $user) { |
287 | 287 | ?> |
288 | - <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>> |
|
288 | + <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>> |
|
289 | 289 | <?php |
290 | 290 | $userName = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; |
291 | 291 | if ($showOfficialCode) { |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | <?php |
313 | 313 | foreach ($db_courses as $course) { |
314 | 314 | ?> |
315 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>> |
|
315 | + <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>> |
|
316 | 316 | <?php echo '('.$course['visual_code'].') '.$course['title']; ?> |
317 | 317 | </option> |
318 | 318 | <?php |
@@ -285,7 +285,10 @@ discard block |
||
285 | 285 | <?php |
286 | 286 | foreach ($db_users as $user) { |
287 | 287 | ?> |
288 | - <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>> |
|
288 | + <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) { |
|
289 | + echo 'selected="selected"'; |
|
290 | +} |
|
291 | +?>> |
|
289 | 292 | <?php |
290 | 293 | $userName = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; |
291 | 294 | if ($showOfficialCode) { |
@@ -312,7 +315,10 @@ discard block |
||
312 | 315 | <?php |
313 | 316 | foreach ($db_courses as $course) { |
314 | 317 | ?> |
315 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>> |
|
318 | + <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) { |
|
319 | + echo 'selected="selected"'; |
|
320 | +} |
|
321 | +?>> |
|
316 | 322 | <?php echo '('.$course['visual_code'].') '.$course['title']; ?> |
317 | 323 | </option> |
318 | 324 | <?php |
@@ -295,7 +295,7 @@ |
||
295 | 295 | if (isset($_GET['export'])) { |
296 | 296 | $dataToExport = $timeReport->prepareDataToExport($withFilter); |
297 | 297 | |
298 | - $fileName = get_lang('TeacherTimeReport') . ' ' . api_get_local_time(); |
|
298 | + $fileName = get_lang('TeacherTimeReport').' '.api_get_local_time(); |
|
299 | 299 | |
300 | 300 | switch ($_GET['export']) { |
301 | 301 | case 'pdf': |
@@ -50,7 +50,7 @@ |
||
50 | 50 | array('name'=>'certificate', 'index'=>'certificate', 'width'=>'25', 'align'=>'left', 'sortable'=>'false'), |
51 | 51 | array('name'=>'skills', 'index'=>'skills', 'width'=>'300', 'align'=>'left', 'sortable'=>'false'), |
52 | 52 | array('name'=>'actions', 'index'=>'actions', 'width'=>'30', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false') |
53 | - ); |
|
53 | + ); |
|
54 | 54 | //Autowidth |
55 | 55 | $extra_params['autowidth'] = 'true'; |
56 | 56 | //height auto |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | // setting breadcrumbs |
26 | 26 | |
27 | 27 | $tool_name = get_lang('SkillsAndGradebooks'); |
28 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
28 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
29 | 29 | if ($action == 'add_skill') { |
30 | - $interbreadcrumb[]=array('url' => 'skills_gradebook.php','name' => get_lang('SkillsAndGradebooks')); |
|
30 | + $interbreadcrumb[] = array('url' => 'skills_gradebook.php', 'name' => get_lang('SkillsAndGradebooks')); |
|
31 | 31 | $tool_name = get_lang('Add'); |
32 | 32 | } |
33 | 33 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | |
47 | 47 | //Column config |
48 | 48 | $column_model = array( |
49 | - array('name'=>'name', 'index'=>'name', 'width'=>'150', 'align'=>'left'), |
|
50 | - array('name'=>'certificate', 'index'=>'certificate', 'width'=>'25', 'align'=>'left', 'sortable'=>'false'), |
|
51 | - array('name'=>'skills', 'index'=>'skills', 'width'=>'300', 'align'=>'left', 'sortable'=>'false'), |
|
52 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'30', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false') |
|
49 | + array('name'=>'name', 'index'=>'name', 'width'=>'150', 'align'=>'left'), |
|
50 | + array('name'=>'certificate', 'index'=>'certificate', 'width'=>'25', 'align'=>'left', 'sortable'=>'false'), |
|
51 | + array('name'=>'skills', 'index'=>'skills', 'width'=>'300', 'align'=>'left', 'sortable'=>'false'), |
|
52 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'30', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false') |
|
53 | 53 | ); |
54 | 54 | //Autowidth |
55 | 55 | $extra_params['autowidth'] = 'true'; |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | $action_links = 'function action_formatter(cellvalue, options, rowObject) { |
61 | 61 | //certificates |
62 | 62 | if (rowObject[4] == 1) { |
63 | - return \'<a href="?action=add_skill&id=\'+options.rowId+\'">'.Display::return_icon('add.png', get_lang('AddSkill'),'',ICON_SIZE_SMALL).'</a>'.'\'; |
|
63 | + return \'<a href="?action=add_skill&id=\'+options.rowId+\'">'.Display::return_icon('add.png', get_lang('AddSkill'), '', ICON_SIZE_SMALL).'</a>'.'\'; |
|
64 | 64 | } else { |
65 | - return \''.Display::return_icon('add_na.png', get_lang('YourGradebookFirstNeedsACertificateInOrderToBeLinkedToASkill'),'',ICON_SIZE_SMALL).''.'\'; |
|
65 | + return \''.Display::return_icon('add_na.png', get_lang('YourGradebookFirstNeedsACertificateInOrderToBeLinkedToASkill'), '', ICON_SIZE_SMALL).''.'\'; |
|
66 | 66 | } |
67 | 67 | }'; |
68 | 68 | ?> |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | $(function() { |
71 | 71 | <?php |
72 | 72 | // grid definition see the $career->display() function |
73 | - echo Display::grid_js('gradebooks', $url, $columns, $column_model, $extra_params, array(), $action_links,true); |
|
73 | + echo Display::grid_js('gradebooks', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
74 | 74 | ?> |
75 | 75 | }); |
76 | 76 | </script> |
77 | 77 | <?php |
78 | 78 | $gradebook = new Gradebook(); |
79 | 79 | |
80 | -switch($action) { |
|
80 | +switch ($action) { |
|
81 | 81 | case 'display': |
82 | 82 | $gradebook->display(); |
83 | 83 | break; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; |
86 | 86 | $gradebook_info = $gradebook->get($id); |
87 | 87 | $url = api_get_self().'?action='.$action.'&id='.$id; |
88 | - $form = $gradebook->show_skill_form($id, $url, $gradebook_info['name']); |
|
88 | + $form = $gradebook->show_skill_form($id, $url, $gradebook_info['name']); |
|
89 | 89 | if ($form->validate()) { |
90 | 90 | $values = $form->exportValues(); |
91 | 91 | $res = $gradebook->update_skills_to_gradebook($values['id'], $values['skill']); |