@@ -30,26 +30,26 @@ discard block |
||
30 | 30 | $result = Database::query("SELECT name FROM $tbl_session WHERE id='$id_session'"); |
31 | 31 | |
32 | 32 | if (!list($session_name)=Database::fetch_row($result)) { |
33 | - header('Location: session_list.php'); |
|
34 | - exit; |
|
33 | + header('Location: session_list.php'); |
|
34 | + exit; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | if ($action == 'delete') { |
38 | - $idChecked = $_REQUEST['idChecked']; |
|
39 | - if (is_array($idChecked) && count($idChecked)>0) { |
|
40 | - $my_temp = array(); |
|
41 | - foreach ($idChecked as $id){ |
|
42 | - $my_temp[]= Database::escape_string($id);// forcing the escape_string |
|
43 | - } |
|
44 | - $idChecked = $my_temp; |
|
45 | - $idChecked="'".implode("','", $idChecked)."'"; |
|
46 | - $result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
47 | - $nbr_affected_rows=Database::affected_rows($result); |
|
48 | - Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
49 | - Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'"); |
|
50 | - } |
|
51 | - header('Location: '.api_get_self().'?id_session='.$id_session.'&sort='.$sort); |
|
52 | - exit(); |
|
38 | + $idChecked = $_REQUEST['idChecked']; |
|
39 | + if (is_array($idChecked) && count($idChecked)>0) { |
|
40 | + $my_temp = array(); |
|
41 | + foreach ($idChecked as $id){ |
|
42 | + $my_temp[]= Database::escape_string($id);// forcing the escape_string |
|
43 | + } |
|
44 | + $idChecked = $my_temp; |
|
45 | + $idChecked="'".implode("','", $idChecked)."'"; |
|
46 | + $result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
47 | + $nbr_affected_rows=Database::affected_rows($result); |
|
48 | + Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
49 | + Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'"); |
|
50 | + } |
|
51 | + header('Location: '.api_get_self().'?id_session='.$id_session.'&sort='.$sort); |
|
52 | + exit(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $limit = 20; |
@@ -82,17 +82,17 @@ discard block |
||
82 | 82 | $tableCourses = array(); |
83 | 83 | |
84 | 84 | foreach ($Courses as $key=>$enreg) { |
85 | - $course = array(); |
|
86 | - $course[] = '<input type="checkbox" name="idChecked[]" value="'.$enreg['id'].'">'; |
|
87 | - $course[] = api_htmlentities($enreg['title'],ENT_QUOTES,$charset); |
|
88 | - $course[] = '<a href="session_course_user_list.php?id_session='.$id_session.'&course_code='.$enreg['code'].'">'.$enreg['nbr_users'].' '.get_lang('Users').'</a>'; |
|
89 | - $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$enreg['code'].'/?id_session='.$id_session.'">'. |
|
90 | - Display::return_icon('course_home.gif', get_lang('Course')).'</a> |
|
85 | + $course = array(); |
|
86 | + $course[] = '<input type="checkbox" name="idChecked[]" value="'.$enreg['id'].'">'; |
|
87 | + $course[] = api_htmlentities($enreg['title'],ENT_QUOTES,$charset); |
|
88 | + $course[] = '<a href="session_course_user_list.php?id_session='.$id_session.'&course_code='.$enreg['code'].'">'.$enreg['nbr_users'].' '.get_lang('Users').'</a>'; |
|
89 | + $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$enreg['code'].'/?id_session='.$id_session.'">'. |
|
90 | + Display::return_icon('course_home.gif', get_lang('Course')).'</a> |
|
91 | 91 | <a href="session_course_edit.php?id_session='.$id_session.'&page=session_course_list.php&course_code='.$enreg['code'].'">'. |
92 | - Display::return_icon('edit.png', get_lang('Edit')).'</a> |
|
92 | + Display::return_icon('edit.png', get_lang('Edit')).'</a> |
|
93 | 93 | <a href="'.api_get_self().'?id_session='.$id_session.'&sort='.$sort.'&action=delete&idChecked[]='.$enreg['id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)).'\')) return false;">'. |
94 | - Display::return_icon('delete.png', get_lang('Delete')).'</a>'; |
|
95 | - $tableCourses[] = $course; |
|
94 | + Display::return_icon('delete.png', get_lang('Delete')).'</a>'; |
|
95 | + $tableCourses[] = $course; |
|
96 | 96 | } |
97 | 97 | echo '<form method="post" action="'.api_get_self().'">'; |
98 | 98 | Display :: display_sortable_table($tableHeader, $tableCourses, array (), array ()); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | //If session is not active we stop de script |
235 | 235 | if (!api_is_allowed_to_session_edit()) { |
236 | - api_not_allowed(); |
|
236 | + api_not_allowed(); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $entityManager = Database::getManager(); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | if ($exercise_info->start_time != '0000-00-00 00:00:00') { |
354 | 354 | $allowed_time = api_strtotime($exercise_info->start_time, 'UTC'); |
355 | 355 | if ($now < $allowed_time) { |
356 | - continue; |
|
356 | + continue; |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | $exercise_info->exercise = Display::url( |
@@ -583,11 +583,11 @@ discard block |
||
583 | 583 | window.location.href=ui.tab; |
584 | 584 | }); |
585 | 585 | <?php |
586 | - //Displays js code to use a jqgrid |
|
587 | - echo Display::grid_js('courses', '', $columns_courses, $column_model_courses, $extra_params_courses, $new_course_list); |
|
588 | - echo Display::grid_js('list_default', $url, $columns, $column_model,$extra_params,array(), ''); |
|
589 | - echo Display::grid_js('list_course', $url_by_course, $columns, $column_model,$extra_params_course,array(),''); |
|
590 | - echo Display::grid_js('list_week', $url_week, $column_week, $column_week_model, $extra_params_week,array(),''); |
|
586 | + //Displays js code to use a jqgrid |
|
587 | + echo Display::grid_js('courses', '', $columns_courses, $column_model_courses, $extra_params_courses, $new_course_list); |
|
588 | + echo Display::grid_js('list_default', $url, $columns, $column_model,$extra_params,array(), ''); |
|
589 | + echo Display::grid_js('list_course', $url_by_course, $columns, $column_model,$extra_params_course,array(),''); |
|
590 | + echo Display::grid_js('list_week', $url_week, $column_week, $column_week_model, $extra_params_week,array(),''); |
|
591 | 591 | |
592 | 592 | if (!api_is_anonymous()) { |
593 | 593 | echo Display::grid_js('exercises', '', $column_exercise, $column_exercise_model, $extra_params_exercise, $my_real_array); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $sessionRepository = Database::getManager()->getRepository('ChamiloCoreBundle:Session'); |
156 | 156 | $courses = $sessionRepository->getCoursesOrderedByPosition($session); |
157 | 157 | |
158 | - foreach ($courses as $course) { |
|
158 | + foreach ($courses as $course) { |
|
159 | 159 | //select the number of users |
160 | 160 | $sql = "SELECT count(*) |
161 | 161 | FROM $tbl_session_rel_user sru, |
@@ -167,37 +167,37 @@ discard block |
||
167 | 167 | sru.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND |
168 | 168 | srcru.session_id = '".intval($sessionId)."'"; |
169 | 169 | |
170 | - $rs = Database::query($sql); |
|
170 | + $rs = Database::query($sql); |
|
171 | 171 | $numberOfUsers = Database::result($rs, 0, 0); |
172 | 172 | |
173 | - // Get coachs of the courses in session |
|
173 | + // Get coachs of the courses in session |
|
174 | 174 | |
175 | - $sql = "SELECT user.lastname, user.firstname, user.username |
|
175 | + $sql = "SELECT user.lastname, user.firstname, user.username |
|
176 | 176 | FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user |
177 | 177 | WHERE |
178 | 178 | session_rcru.user_id = user.user_id AND |
179 | 179 | session_rcru.session_id = '".intval($sessionId)."' AND |
180 | 180 | session_rcru.c_id ='".intval($course->getId())."' AND |
181 | 181 | session_rcru.status=2"; |
182 | - $rs = Database::query($sql); |
|
182 | + $rs = Database::query($sql); |
|
183 | 183 | |
184 | - $coachs = array(); |
|
185 | - if (Database::num_rows($rs) > 0) { |
|
186 | - while($info_coach = Database::fetch_array($rs)) { |
|
184 | + $coachs = array(); |
|
185 | + if (Database::num_rows($rs) > 0) { |
|
186 | + while($info_coach = Database::fetch_array($rs)) { |
|
187 | 187 | $coachs[] = api_get_person_name( |
188 | 188 | $info_coach['firstname'], |
189 | 189 | $info_coach['lastname'] |
190 | 190 | ).' ('.$info_coach['username'].')'; |
191 | - } |
|
192 | - } else { |
|
193 | - $coach = get_lang('None'); |
|
194 | - } |
|
191 | + } |
|
192 | + } else { |
|
193 | + $coach = get_lang('None'); |
|
194 | + } |
|
195 | 195 | |
196 | - if (count($coachs) > 0) { |
|
197 | - $coach = implode('<br />',$coachs); |
|
198 | - } else { |
|
199 | - $coach = get_lang('None'); |
|
200 | - } |
|
196 | + if (count($coachs) > 0) { |
|
197 | + $coach = implode('<br />',$coachs); |
|
198 | + } else { |
|
199 | + $coach = get_lang('None'); |
|
200 | + } |
|
201 | 201 | |
202 | 202 | $orderButtons = null; |
203 | 203 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | |
234 | 234 | $courseUrl = api_get_course_url($course->getCode(), $sessionId); |
235 | 235 | |
236 | - // hide_course_breadcrumb the parameter has been added to hide the name |
|
237 | - // of the course, that appeared in the default $interbreadcrumb |
|
236 | + // hide_course_breadcrumb the parameter has been added to hide the name |
|
237 | + // of the course, that appeared in the default $interbreadcrumb |
|
238 | 238 | $courseItem .= ' |
239 | 239 | <tr> |
240 | 240 | <td class="title">'.Display::url( |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | </td> |
261 | 261 | </tr>'; |
262 | 262 | $count++; |
263 | - } |
|
263 | + } |
|
264 | 264 | $courseListToShow .= $courseItem; |
265 | 265 | } |
266 | 266 | $courseListToShow .= '</table><br />'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $add_type = 'unique'; |
39 | 39 | |
40 | 40 | if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { |
41 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
41 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null; |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | |
409 | 409 | if ($use_extra_fields) { |
410 | 410 | $final_result = array(); |
411 | - if (count($extra_field_result)>1) { |
|
412 | - for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
411 | + if (count($extra_field_result)>1) { |
|
412 | + for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
413 | 413 | if (is_array($extra_field_result[$i+1])) { |
414 | 414 | $final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]); |
415 | 415 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | 'official_code' => $user['official_code'] |
486 | 486 | ) ; |
487 | 487 | unset($users[$uid]); |
488 | - } |
|
488 | + } |
|
489 | 489 | } |
490 | 490 | unset($users); //clean to free memory |
491 | 491 | |
@@ -529,12 +529,12 @@ discard block |
||
529 | 529 | } |
530 | 530 | |
531 | 531 | if ($add_type == 'multiple') { |
532 | - $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'. |
|
532 | + $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'. |
|
533 | 533 | Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
534 | - $link_add_type_multiple = Display::url(Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'), ''); |
|
534 | + $link_add_type_multiple = Display::url(Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'), ''); |
|
535 | 535 | } else { |
536 | - $link_add_type_unique = Display::url(Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'), ''); |
|
537 | - $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
536 | + $link_add_type_unique = Display::url(Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'), ''); |
|
537 | + $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
538 | 538 | } |
539 | 539 | $link_add_group = Display::url( |
540 | 540 | Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'), |
@@ -562,30 +562,30 @@ discard block |
||
562 | 562 | <?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?> |
563 | 563 | <?php |
564 | 564 | if ($add_type=='multiple') { |
565 | - if (is_array($extra_field_list)) { |
|
566 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
567 | - echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
568 | - foreach ($new_field_list as $new_field) { |
|
569 | - echo $new_field['name']; |
|
570 | - $varname = 'field_'.$new_field['variable']; |
|
571 | - echo ' <select name="'.$varname.'">'; |
|
572 | - echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
573 | - foreach ($new_field['data'] as $option) { |
|
574 | - $checked=''; |
|
575 | - if (isset($_POST[$varname])) { |
|
576 | - if ($_POST[$varname]==$option[1]) { |
|
577 | - $checked = 'selected="true"'; |
|
578 | - } |
|
579 | - } |
|
580 | - echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; |
|
581 | - } |
|
582 | - echo '</select>'; |
|
583 | - echo ' '; |
|
584 | - } |
|
585 | - echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
586 | - echo '<br /><br />'; |
|
587 | - } |
|
588 | - } |
|
565 | + if (is_array($extra_field_list)) { |
|
566 | + if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
567 | + echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
568 | + foreach ($new_field_list as $new_field) { |
|
569 | + echo $new_field['name']; |
|
570 | + $varname = 'field_'.$new_field['variable']; |
|
571 | + echo ' <select name="'.$varname.'">'; |
|
572 | + echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
573 | + foreach ($new_field['data'] as $option) { |
|
574 | + $checked=''; |
|
575 | + if (isset($_POST[$varname])) { |
|
576 | + if ($_POST[$varname]==$option[1]) { |
|
577 | + $checked = 'selected="true"'; |
|
578 | + } |
|
579 | + } |
|
580 | + echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; |
|
581 | + } |
|
582 | + echo '</select>'; |
|
583 | + echo ' '; |
|
584 | + } |
|
585 | + echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
586 | + echo '<br /><br />'; |
|
587 | + } |
|
588 | + } |
|
589 | 589 | } |
590 | 590 | ?> |
591 | 591 | <input type="hidden" name="form_sent" value="1" /> |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | |
594 | 594 | <?php |
595 | 595 | if (!empty($errorMsg)) { |
596 | - Display::display_normal_message($errorMsg); //main API |
|
596 | + Display::display_normal_message($errorMsg); //main API |
|
597 | 597 | } |
598 | 598 | ?> |
599 | 599 | <div id="multiple-add-session" class="row"> |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | <label><?php echo get_lang('UserListInPlatform') ?> </label> |
603 | 603 | <?php |
604 | 604 | if (!($add_type=='multiple')) { |
605 | - ?> |
|
605 | + ?> |
|
606 | 606 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" class="form-control" /> |
607 | 607 | <div id="ajax_list_users_single" class="select-list-ajax"></div> |
608 | 608 | <?php |
@@ -611,21 +611,21 @@ discard block |
||
611 | 611 | <div id="ajax_list_users_multiple"> |
612 | 612 | <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" class="form-control"> |
613 | 613 | <?php |
614 | - foreach ($nosessionUsersList as $uid => $enreg) { |
|
615 | - ?> |
|
614 | + foreach ($nosessionUsersList as $uid => $enreg) { |
|
615 | + ?> |
|
616 | 616 | <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>> |
617 | 617 | <?php |
618 | - $personName = api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].') '.$enreg['official_code']; |
|
619 | - if ($showOfficialCode) { |
|
620 | - $officialCode = !empty($enreg['official_code']) ? $enreg['official_code'].' - ' : '? - '; |
|
621 | - $personName = $officialCode.api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; |
|
622 | - } |
|
623 | - echo $personName; |
|
624 | - ?> |
|
618 | + $personName = api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].') '.$enreg['official_code']; |
|
619 | + if ($showOfficialCode) { |
|
620 | + $officialCode = !empty($enreg['official_code']) ? $enreg['official_code'].' - ' : '? - '; |
|
621 | + $personName = $officialCode.api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; |
|
622 | + } |
|
623 | + echo $personName; |
|
624 | + ?> |
|
625 | 625 | </option> |
626 | 626 | <?php |
627 | - } |
|
628 | - ?> |
|
627 | + } |
|
628 | + ?> |
|
629 | 629 | </select> |
630 | 630 | </div> |
631 | 631 | <input type="checkbox" onchange="checked_in_no_session(this.checked);" name="user_with_any_session" id="user_with_any_session_id"> |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | <?php |
634 | 634 | } |
635 | 635 | unset($nosessionUsersList); |
636 | - ?> |
|
636 | + ?> |
|
637 | 637 | </div> |
638 | 638 | </div> |
639 | 639 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | <?php |
678 | 678 | } |
679 | 679 | if (!empty($addProcess)) { |
680 | - echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
680 | + echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
681 | 681 | } else { |
682 | 682 | echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>'; |
683 | 683 | } |
@@ -70,13 +70,13 @@ |
||
70 | 70 | <tr> |
71 | 71 | <td align="center"> |
72 | 72 | <?php |
73 | - echo Display::select( |
|
74 | - 'sessions[]', |
|
75 | - $sessionList, |
|
76 | - '', |
|
77 | - array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'sessions', 'size'=>'15px'), |
|
78 | - false |
|
79 | - ); |
|
73 | + echo Display::select( |
|
74 | + 'sessions[]', |
|
75 | + $sessionList, |
|
76 | + '', |
|
77 | + array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'sessions', 'size'=>'15px'), |
|
78 | + false |
|
79 | + ); |
|
80 | 80 | ?> |
81 | 81 | </td> |
82 | 82 | <td align="center"> |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | $sql = "SELECT * FROM $tbl_session_category WHERE id='".$id."' ORDER BY name"; |
30 | 30 | $result = Database::query($sql); |
31 | 31 | if (!$infos = Database::fetch_array($result)) { |
32 | - header('Location: session_list.php'); |
|
33 | - exit(); |
|
32 | + header('Location: session_list.php'); |
|
33 | + exit(); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | list($year_start,$month_start,$day_start)=explode('-',$infos['date_start']); |
37 | 37 | list($year_end,$month_end,$day_end)=explode('-',$infos['date_end']); |
38 | 38 | |
39 | 39 | if (!api_is_platform_admin() && $infos['session_admin_id']!=$_user['user_id'] && !api_is_session_admin()) { |
40 | - api_not_allowed(true); |
|
40 | + api_not_allowed(true); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if (isset($_POST['formSent']) && $_POST['formSent']) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $day_end |
61 | 61 | ); |
62 | 62 | if ($return == strval(intval($return))) { |
63 | - Display::addFlash(Display::return_message(get_lang('SessionCategoryUpdate'))); |
|
63 | + Display::addFlash(Display::return_message(get_lang('SessionCategoryUpdate'))); |
|
64 | 64 | header('Location: session_category_list.php'); |
65 | 65 | exit(); |
66 | 66 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // display the header |
74 | 74 | Display::display_header($tool_name); |
75 | 75 | if (!empty($return)) { |
76 | - Display::display_error_message($return,false); |
|
76 | + Display::display_error_message($return,false); |
|
77 | 77 | } |
78 | 78 | ?> |
79 | 79 | <div class="row"> |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | $result = Database::query($sql); |
38 | 38 | |
39 | 39 | if (!list($session_name,$course_title) = Database::fetch_row($result)) { |
40 | - header('Location: session_course_list.php?id_session='.$id_session); |
|
41 | - exit(); |
|
40 | + header('Location: session_course_list.php?id_session='.$id_session); |
|
41 | + exit(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | //$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); |
@@ -48,63 +48,63 @@ discard block |
||
48 | 48 | |
49 | 49 | $arr_infos = array(); |
50 | 50 | if (isset($_POST['formSent']) && $_POST['formSent']) { |
51 | - $formSent = 1; |
|
51 | + $formSent = 1; |
|
52 | 52 | |
53 | - // get all tutor by course_code in the session |
|
54 | - $sql = "SELECT user_id |
|
53 | + // get all tutor by course_code in the session |
|
54 | + $sql = "SELECT user_id |
|
55 | 55 | FROM $tbl_session_rel_course_rel_user |
56 | 56 | WHERE session_id = '$id_session' AND c_id = '".$courseId."' AND status = 2"; |
57 | - $rs_coaches = Database::query($sql); |
|
57 | + $rs_coaches = Database::query($sql); |
|
58 | 58 | |
59 | - $coaches_course_session = array(); |
|
60 | - if (Database::num_rows($rs_coaches) > 0){ |
|
61 | - while ($row_coaches = Database::fetch_row($rs_coaches)) { |
|
62 | - $coaches_course_session[] = $row_coaches[0]; |
|
63 | - } |
|
64 | - } |
|
59 | + $coaches_course_session = array(); |
|
60 | + if (Database::num_rows($rs_coaches) > 0){ |
|
61 | + while ($row_coaches = Database::fetch_row($rs_coaches)) { |
|
62 | + $coaches_course_session[] = $row_coaches[0]; |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - $id_coaches= $_POST['id_coach']; |
|
66 | + $id_coaches= $_POST['id_coach']; |
|
67 | 67 | |
68 | - if (is_array($id_coaches) && count($id_coaches) > 0) { |
|
68 | + if (is_array($id_coaches) && count($id_coaches) > 0) { |
|
69 | 69 | |
70 | - foreach ($id_coaches as $id_coach) { |
|
71 | - $id_coach = intval($id_coach); |
|
70 | + foreach ($id_coaches as $id_coach) { |
|
71 | + $id_coach = intval($id_coach); |
|
72 | 72 | $rs1 = SessionManager::set_coach_to_course_session( |
73 | 73 | $id_coach, |
74 | 74 | $id_session, |
75 | 75 | $courseId |
76 | 76 | ); |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | - // set status to 0 other tutors from multiple list |
|
80 | - $array_intersect = array_diff($coaches_course_session,$id_coaches); |
|
79 | + // set status to 0 other tutors from multiple list |
|
80 | + $array_intersect = array_diff($coaches_course_session,$id_coaches); |
|
81 | 81 | |
82 | - foreach ($array_intersect as $no_coach_user_id) { |
|
83 | - $rs2 = SessionManager::set_coach_to_course_session( |
|
84 | - $no_coach_user_id, |
|
85 | - $id_session, |
|
82 | + foreach ($array_intersect as $no_coach_user_id) { |
|
83 | + $rs2 = SessionManager::set_coach_to_course_session( |
|
84 | + $no_coach_user_id, |
|
85 | + $id_session, |
|
86 | 86 | $courseId, |
87 | - true |
|
88 | - ); |
|
89 | - } |
|
87 | + true |
|
88 | + ); |
|
89 | + } |
|
90 | 90 | |
91 | - header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session); |
|
92 | - exit(); |
|
93 | - } |
|
91 | + header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session); |
|
92 | + exit(); |
|
93 | + } |
|
94 | 94 | } else { |
95 | - $sql = "SELECT user_id |
|
95 | + $sql = "SELECT user_id |
|
96 | 96 | FROM $tbl_session_rel_course_rel_user |
97 | 97 | WHERE |
98 | 98 | session_id = '$id_session' AND |
99 | 99 | c_id = '".$courseId."' AND |
100 | 100 | status = 2 "; |
101 | - $rs = Database::query($sql); |
|
101 | + $rs = Database::query($sql); |
|
102 | 102 | |
103 | - if (Database::num_rows($rs) > 0) { |
|
104 | - while ($infos = Database::fetch_array($rs)) { |
|
105 | - $arr_infos[] = $infos['user_id']; |
|
106 | - } |
|
107 | - } |
|
103 | + if (Database::num_rows($rs) > 0) { |
|
104 | + while ($infos = Database::fetch_array($rs)) { |
|
105 | + $arr_infos[] = $infos['user_id']; |
|
106 | + } |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
@@ -197,12 +197,12 @@ |
||
197 | 197 | if (!empty($rows_session_category)) { |
198 | 198 | foreach($rows_session_category as $category) { |
199 | 199 | if($category['id'] == $categoryId) |
200 | - echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>'; |
|
201 | - else |
|
202 | - echo '<option value="'.$category['id'].'">'.$category['name'].'</option>'; |
|
200 | + echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>'; |
|
201 | + else |
|
202 | + echo '<option value="'.$category['id'].'">'.$category['name'].'</option>'; |
|
203 | 203 | } |
204 | 204 | } |
205 | - ?> |
|
205 | + ?> |
|
206 | 206 | </select> |
207 | 207 | </td> |
208 | 208 | </tr> |
@@ -29,29 +29,29 @@ discard block |
||
29 | 29 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
30 | 30 | |
31 | 31 | if (isset($_POST['formSent']) && $_POST['formSent']) { |
32 | - $formSent = 1; |
|
33 | - $name = $_POST['name']; |
|
34 | - $year_start = $_POST['year_start']; |
|
35 | - $month_start = $_POST['month_start']; |
|
36 | - $day_start = $_POST['day_start']; |
|
37 | - $year_end = $_POST['year_end']; |
|
38 | - $month_end = $_POST['month_end']; |
|
39 | - $day_end = $_POST['day_end']; |
|
40 | - $return = SessionManager::create_category_session( |
|
41 | - $name, |
|
42 | - $year_start, |
|
43 | - $month_start, |
|
44 | - $day_start, |
|
45 | - $year_end, |
|
46 | - $month_end, |
|
47 | - $day_end |
|
48 | - ); |
|
32 | + $formSent = 1; |
|
33 | + $name = $_POST['name']; |
|
34 | + $year_start = $_POST['year_start']; |
|
35 | + $month_start = $_POST['month_start']; |
|
36 | + $day_start = $_POST['day_start']; |
|
37 | + $year_end = $_POST['year_end']; |
|
38 | + $month_end = $_POST['month_end']; |
|
39 | + $day_end = $_POST['day_end']; |
|
40 | + $return = SessionManager::create_category_session( |
|
41 | + $name, |
|
42 | + $year_start, |
|
43 | + $month_start, |
|
44 | + $day_start, |
|
45 | + $year_end, |
|
46 | + $month_end, |
|
47 | + $day_end |
|
48 | + ); |
|
49 | 49 | |
50 | - if ($return == strval(intval($return))) { |
|
51 | - Display::addFlash(Display::return_message(get_lang('SessionCategoryAdded'))); |
|
52 | - header('Location: session_category_list.php'); |
|
53 | - exit(); |
|
54 | - } |
|
50 | + if ($return == strval(intval($return))) { |
|
51 | + Display::addFlash(Display::return_message(get_lang('SessionCategoryAdded'))); |
|
52 | + header('Location: session_category_list.php'); |
|
53 | + exit(); |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | $thisYear = date('Y'); |
57 | 57 | $thisMonth = date('m'); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //display the header |
62 | 62 | Display::display_header($tool_name); |
63 | 63 | if (!empty($return)) { |
64 | - Display::display_error_message($return,false); |
|
64 | + Display::display_error_message($return,false); |
|
65 | 65 | } |
66 | 66 | ?> |
67 | 67 | <div class="row"> |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | / |
140 | 140 | <select name="year_start"> |
141 | 141 | <?php |
142 | - for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) { |
|
143 | - ?> |
|
142 | + for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) { |
|
143 | + ?> |
|
144 | 144 | <option value="<?php echo $i; ?>" <?php if((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
145 | 145 | <?php |
146 | - } |
|
147 | - ?> |
|
146 | + } |
|
147 | + ?> |
|
148 | 148 | </select> |
149 | 149 | </div> |
150 | 150 | <div class="col-md-3"></div> |