Completed
Push — 1.11.x ( 6904fa...6a92e6 )
by José
525:44 queued 484:20
created
main/session/resume_session.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
260 260
 			</td>
261 261
 		</tr>';
262 262
         $count++;
263
-	}
263
+    }
264 264
     $courseListToShow .= $courseItem;
265 265
 }
266 266
 $courseListToShow .= '</table><br />';
Please login to merge, or discard this patch.
main/session/add_users_to_session.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.'&amp;add='.$addProcess.'&amp;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.'&amp;add='.$addProcess.'&amp;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
 block discarded – undo
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 '&nbsp;<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 '&nbsp;&nbsp;';
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 '&nbsp;<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 '&nbsp;&nbsp;';
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
main/session/add_teachers_to_session.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -70,13 +70,13 @@
 block discarded – undo
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">
Please login to merge, or discard this patch.
main/session/session_category_edit.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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">
Please login to merge, or discard this patch.
main/session/session_course_edit.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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';
Please login to merge, or discard this patch.
main/session/add_many_session_to_category.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -197,12 +197,12 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
main/session/session_category_add.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -29,29 +29,29 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
main/session/session_edit.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name" => get_lang('SessionOverview'));
42 42
 
43 43
 if (isset($_POST['formSent']) && $_POST['formSent']) {
44
-	$formSent = 1;
44
+    $formSent = 1;
45 45
 }
46 46
 
47 47
 $order_clause = 'ORDER BY ';
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
         WHERE status='1'".$order_clause;
53 53
 
54 54
 if (api_is_multiple_url_enabled()) {
55
-	$table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
56
-	$access_url_id = api_get_current_access_url_id();
57
-	if ($access_url_id != -1) {
58
-		$sql = "SELECT DISTINCT u.user_id,lastname,firstname,username
55
+    $table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
56
+    $access_url_id = api_get_current_access_url_id();
57
+    if ($access_url_id != -1) {
58
+        $sql = "SELECT DISTINCT u.user_id,lastname,firstname,username
59 59
 		        FROM $tbl_user u
60 60
                 INNER JOIN $table_access_url_rel_user url_rel_user
61 61
                 ON (url_rel_user.user_id = u.user_id)
62 62
 			    WHERE status='1' AND access_url_id = '$access_url_id' $order_clause";
63
-	}
63
+    }
64 64
 }
65 65
 
66 66
 $result = Database::query($sql);
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
     );
171 171
 
172 172
     if ($return == strval(intval($return))) {
173
-		header('Location: resume_session.php?id_session=' . $return);
174
-		exit();
175
-	}
173
+        header('Location: resume_session.php?id_session=' . $return);
174
+        exit();
175
+    }
176 176
 }
177 177
 
178 178
 // display the header
Please login to merge, or discard this patch.
main/session/session_export.php 1 patch
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 set_time_limit(0);
38 38
 
39 39
 if (isset($_POST['formSent'])) {
40
-	$formSent = $_POST['formSent'];
41
-	$file_type = isset($_POST['file_type']) ? $_POST['file_type'] : 'csv';
42
-	$session_id = $_POST['session_id'];
43
-	if (empty($session_id)) {
44
-		$sql = "SELECT
40
+    $formSent = $_POST['formSent'];
41
+    $file_type = isset($_POST['file_type']) ? $_POST['file_type'] : 'csv';
42
+    $session_id = $_POST['session_id'];
43
+    if (empty($session_id)) {
44
+        $sql = "SELECT
45 45
 					s.id,
46 46
 					name,
47 47
 					id_coach,
@@ -55,84 +55,84 @@  discard block
 block discarded – undo
55 55
 				ON $tbl_user.user_id = s.id_coach
56 56
 				ORDER BY id";
57 57
 
58
-		if (api_is_multiple_url_enabled()) {
59
-			$tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
60
-			$access_url_id = api_get_current_access_url_id();
61
-			if ($access_url_id != -1){
62
-			$sql = "SELECT s.id, name,id_coach,username,access_start_date,access_end_date,visibility,session_category_id
58
+        if (api_is_multiple_url_enabled()) {
59
+            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
60
+            $access_url_id = api_get_current_access_url_id();
61
+            if ($access_url_id != -1){
62
+            $sql = "SELECT s.id, name,id_coach,username,access_start_date,access_end_date,visibility,session_category_id
63 63
 					FROM $tbl_session s
64 64
 					INNER JOIN $tbl_session_rel_access_url as session_rel_url
65 65
 					ON (s.id= session_rel_url.session_id)
66 66
 					INNER JOIN $tbl_user u ON (u.user_id = s.id_coach)
67 67
 					WHERE access_url_id = $access_url_id
68 68
 					ORDER BY id";
69
-			}
70
-		}
69
+            }
70
+        }
71 71
 
72
-		$result = Database::query($sql);
73
-	} else {
74
-		$sql = "SELECT s.id,name,username,access_start_date,access_end_date,visibility,session_category_id
72
+        $result = Database::query($sql);
73
+    } else {
74
+        $sql = "SELECT s.id,name,username,access_start_date,access_end_date,visibility,session_category_id
75 75
 				FROM $tbl_session s
76 76
 				INNER JOIN $tbl_user
77 77
 					ON $tbl_user.user_id = s.id_coach
78 78
 				WHERE id='$session_id'";
79
-		$result = Database::query($sql);
80
-	}
79
+        $result = Database::query($sql);
80
+    }
81 81
 
82
-	if (Database::num_rows($result)) {
82
+    if (Database::num_rows($result)) {
83 83
 
84 84
 
85 85
 
86
-		$sessionListToExport = [];
86
+        $sessionListToExport = [];
87 87
 
88
-		if (in_array($file_type, ['csv', 'xls'])) {
88
+        if (in_array($file_type, ['csv', 'xls'])) {
89 89
 
90
-			$archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time();
90
+            $archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time();
91 91
 
92
-			$cvs = true;
93
-			$sessionListToExport[] = [
94
-				'SessionName',
95
-				'Coach',
96
-				'DateStart',
97
-				'DateEnd',
98
-				'Visibility',
99
-				'SessionCategory',
100
-				'Users',
101
-				'Courses'
102
-			];
103
-		} else {
104
-			if (!file_exists($archivePath)) {
105
-				mkdir($archivePath, api_get_permissions_for_new_directories(), true);
106
-			}
92
+            $cvs = true;
93
+            $sessionListToExport[] = [
94
+                'SessionName',
95
+                'Coach',
96
+                'DateStart',
97
+                'DateEnd',
98
+                'Visibility',
99
+                'SessionCategory',
100
+                'Users',
101
+                'Courses'
102
+            ];
103
+        } else {
104
+            if (!file_exists($archivePath)) {
105
+                mkdir($archivePath, api_get_permissions_for_new_directories(), true);
106
+            }
107 107
 
108
-			if (!file_exists($archivePath.'index.html')) {
109
-				$fp = fopen($archivePath.'index.html', 'w');
110
-				fputs($fp, '<html><head></head><body></body></html>');
111
-				fclose($fp);
112
-			}
108
+            if (!file_exists($archivePath.'index.html')) {
109
+                $fp = fopen($archivePath.'index.html', 'w');
110
+                fputs($fp, '<html><head></head><body></body></html>');
111
+                fclose($fp);
112
+            }
113 113
 
114
-			$archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time().'.'.$file_type;
115
-			while (file_exists($archivePath.$archiveFile)) {
116
-				$archiveFile ='export_users_'.$session_id.'_'.api_get_local_time().'_'.uniqid('').'.'.$file_type;
117
-			}
114
+            $archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time().'.'.$file_type;
115
+            while (file_exists($archivePath.$archiveFile)) {
116
+                $archiveFile ='export_users_'.$session_id.'_'.api_get_local_time().'_'.uniqid('').'.'.$file_type;
117
+            }
118 118
 
119
-			$cvs = false;
120
-			$fp = fopen($archivePath.$archiveFile, 'w');
121
-			fputs($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Sessions>\n");
122
-		}
119
+            $cvs = false;
120
+            $fp = fopen($archivePath.$archiveFile, 'w');
121
+            fputs($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Sessions>\n");
122
+        }
123 123
 
124 124
 
125
-		while ($row = Database::fetch_array($result)) {
126
-			$row['name'] = str_replace(';',',',$row['name']);
127
-			$row['username'] = str_replace(';',',',$row['username']);
128
-			$row['access_start_date'] = str_replace(';',',',$row['access_start_date']);
129
-			$row['access_end_date'] = str_replace(';',',',$row['access_end_date']);
130
-			$row['visibility'] = str_replace(';',',',$row['visibility']);
131
-			$row['session_category'] = str_replace(';',',',$row['session_category_id']);
125
+        while ($row = Database::fetch_array($result)) {
126
+            $row['name'] = str_replace(';',',',$row['name']);
127
+            $row['username'] = str_replace(';',',',$row['username']);
128
+            $row['access_start_date'] = str_replace(';',',',$row['access_start_date']);
129
+            $row['access_end_date'] = str_replace(';',',',$row['access_end_date']);
130
+            $row['visibility'] = str_replace(';',',',$row['visibility']);
131
+            $row['session_category'] = str_replace(';',',',$row['session_category_id']);
132 132
 
133 133
 
134
-			// users
135
-			$sql = "SELECT DISTINCT $tbl_user.username
134
+            // users
135
+            $sql = "SELECT DISTINCT $tbl_user.username
136 136
 					FROM $tbl_user
137 137
 					INNER JOIN $tbl_session_user
138 138
 					ON
@@ -140,33 +140,33 @@  discard block
 block discarded – undo
140 140
 						$tbl_session_user.relation_type<>".SESSION_RELATION_TYPE_RRHH." AND
141 141
 						$tbl_session_user.session_id = '".$row['id']."'";
142 142
 
143
-			$rsUsers = Database::query($sql);
144
-			$users = '';
145
-			while ($rowUsers = Database::fetch_array($rsUsers)){
146
-				if($cvs){
147
-					$users .= str_replace(';',',',$rowUsers['username']).'|';
148
-				} else {
149
-					$users .= "\t\t<User>$rowUsers[username]</User>\n";
150
-				}
151
-			}
152
-
153
-			if (!empty($users) && $cvs) {
154
-				$users = api_substr($users, 0, api_strlen($users) - 1);
155
-			}
156
-
157
-			// Courses
158
-			$sql = "SELECT DISTINCT c.code, sc.id, c_id
143
+            $rsUsers = Database::query($sql);
144
+            $users = '';
145
+            while ($rowUsers = Database::fetch_array($rsUsers)){
146
+                if($cvs){
147
+                    $users .= str_replace(';',',',$rowUsers['username']).'|';
148
+                } else {
149
+                    $users .= "\t\t<User>$rowUsers[username]</User>\n";
150
+                }
151
+            }
152
+
153
+            if (!empty($users) && $cvs) {
154
+                $users = api_substr($users, 0, api_strlen($users) - 1);
155
+            }
156
+
157
+            // Courses
158
+            $sql = "SELECT DISTINCT c.code, sc.id, c_id
159 159
 					FROM $tbl_course c
160 160
 					INNER JOIN $tbl_session_course_user sc
161 161
 						ON c.id = sc.c_id
162 162
 						AND sc.session_id = '".$row['id']."'";
163 163
 
164
-			$rsCourses = Database::query($sql);
164
+            $rsCourses = Database::query($sql);
165 165
 
166
-			$courses = '';
167
-			while ($rowCourses = Database::fetch_array($rsCourses)) {
168
-				// get coachs from a course
169
-				$sql = "SELECT u.username
166
+            $courses = '';
167
+            while ($rowCourses = Database::fetch_array($rsCourses)) {
168
+                // get coachs from a course
169
+                $sql = "SELECT u.username
170 170
 						FROM $tbl_session_course_user scu
171 171
 						INNER JOIN $tbl_user u
172 172
 						ON u.user_id = scu.user_id
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
 							scu.session_id = '".$row['id']."' AND
176 176
 							scu.status = 2 ";
177 177
 
178
-				$rs_coachs = Database::query($sql);
179
-				$coachs = array();
180
-				while ($row_coachs = Database::fetch_array($rs_coachs)) {
181
-					$coachs[] = $row_coachs['username'];
182
-				}
183
-
184
-				$coachs = implode(",", $coachs);
185
-
186
-				if ($cvs) {
187
-					$courses .= str_replace(';',',',$rowCourses['code']);
188
-					$courses .= '['.str_replace(';',',',$coachs).'][';
189
-				} else {
190
-					$courses .= "\t\t<Course>\n";
191
-					$courses .= "\t\t\t<CourseCode>$rowCourses[code]</CourseCode>\n";
192
-					$courses .= "\t\t\t<Coach>$coachs</Coach>\n";
193
-				}
194
-
195
-				// rel user courses
196
-				$sql = "SELECT DISTINCT u.username
178
+                $rs_coachs = Database::query($sql);
179
+                $coachs = array();
180
+                while ($row_coachs = Database::fetch_array($rs_coachs)) {
181
+                    $coachs[] = $row_coachs['username'];
182
+                }
183
+
184
+                $coachs = implode(",", $coachs);
185
+
186
+                if ($cvs) {
187
+                    $courses .= str_replace(';',',',$rowCourses['code']);
188
+                    $courses .= '['.str_replace(';',',',$coachs).'][';
189
+                } else {
190
+                    $courses .= "\t\t<Course>\n";
191
+                    $courses .= "\t\t\t<CourseCode>$rowCourses[code]</CourseCode>\n";
192
+                    $courses .= "\t\t\t<Coach>$coachs</Coach>\n";
193
+                }
194
+
195
+                // rel user courses
196
+                $sql = "SELECT DISTINCT u.username
197 197
 						FROM $tbl_session_course_user scu
198 198
 						INNER JOIN $tbl_session_user su
199 199
 						ON
@@ -206,80 +206,80 @@  discard block
 block discarded – undo
206 206
 							scu.c_id='".$rowCourses['c_id']."' AND
207 207
 							scu.session_id='".$row['id']."'";
208 208
 
209
-				$rsUsersCourse = Database::query($sql);
210
-				$userscourse = '';
211
-				while ($rowUsersCourse = Database::fetch_array($rsUsersCourse)){
212
-					if ($cvs) {
213
-						$userscourse .= str_replace(';',',',$rowUsersCourse['username']).',';
214
-					} else {
215
-						$courses .= "\t\t\t<User>$rowUsersCourse[username]</User>\n";
216
-					}
217
-				}
218
-
219
-				if ($cvs) {
220
-					if (!empty($userscourse)) {
221
-						$userscourse = api_substr(
222
-							$userscourse,
223
-							0,
224
-							api_strlen($userscourse) - 1
225
-						);
226
-					}
227
-
228
-					$courses .= $userscourse.']|';
229
-				} else {
230
-					$courses .= "\t\t</Course>\n";
231
-				}
232
-			}
233
-
234
-			if (!empty($courses) && $cvs) {
235
-				$courses = api_substr($courses, 0, api_strlen($courses) - 1);
236
-			}
237
-			$add .= $courses;
238
-
239
-
240
-			if (in_array($file_type, ['csv', 'xls'])) {
241
-				$sessionListToExport[] = [
242
-					$row['name'],
243
-					$row['username'],
244
-					$row['access_start_date'],
245
-					$row['access_end_date'],
246
-					$row['visibility'],
247
-					$row['session_category'],
248
-					$users,
249
-					$courses
250
-				];
251
-			} else {
252
-				$add = "\t<Session>\n"
253
-						 ."\t\t<SessionName>$row[name]</SessionName>\n"
254
-						 ."\t\t<Coach>$row[username]</Coach>\n"
255
-						 ."\t\t<DateStart>$row[access_start_date]</DateStart>\n"
256
-						 ."\t\t<DateEnd>$row[access_end_date]</DateEnd>\n"
257
-						 ."\t\t<Visibility>$row[visibility]</Visibility>\n"
258
-						 ."\t\t<SessionCategory>$row[session_category]</SessionCategory>\n";
259
-			}
260
-
261
-		 	if (!$cvs) {
262
-				$add .= "\t</Session>\n";
263
-				fputs($fp, $add);
264
-			}
265
-		}
266
-
267
-		switch ($file_type) {
268
-			case 'xml':
269
-				fputs($fp, "</Sessions>\n");
270
-				fclose($fp);
271
-				$errorMsg = get_lang('UserListHasBeenExported').'<br/>
209
+                $rsUsersCourse = Database::query($sql);
210
+                $userscourse = '';
211
+                while ($rowUsersCourse = Database::fetch_array($rsUsersCourse)){
212
+                    if ($cvs) {
213
+                        $userscourse .= str_replace(';',',',$rowUsersCourse['username']).',';
214
+                    } else {
215
+                        $courses .= "\t\t\t<User>$rowUsersCourse[username]</User>\n";
216
+                    }
217
+                }
218
+
219
+                if ($cvs) {
220
+                    if (!empty($userscourse)) {
221
+                        $userscourse = api_substr(
222
+                            $userscourse,
223
+                            0,
224
+                            api_strlen($userscourse) - 1
225
+                        );
226
+                    }
227
+
228
+                    $courses .= $userscourse.']|';
229
+                } else {
230
+                    $courses .= "\t\t</Course>\n";
231
+                }
232
+            }
233
+
234
+            if (!empty($courses) && $cvs) {
235
+                $courses = api_substr($courses, 0, api_strlen($courses) - 1);
236
+            }
237
+            $add .= $courses;
238
+
239
+
240
+            if (in_array($file_type, ['csv', 'xls'])) {
241
+                $sessionListToExport[] = [
242
+                    $row['name'],
243
+                    $row['username'],
244
+                    $row['access_start_date'],
245
+                    $row['access_end_date'],
246
+                    $row['visibility'],
247
+                    $row['session_category'],
248
+                    $users,
249
+                    $courses
250
+                ];
251
+            } else {
252
+                $add = "\t<Session>\n"
253
+                            ."\t\t<SessionName>$row[name]</SessionName>\n"
254
+                            ."\t\t<Coach>$row[username]</Coach>\n"
255
+                            ."\t\t<DateStart>$row[access_start_date]</DateStart>\n"
256
+                            ."\t\t<DateEnd>$row[access_end_date]</DateEnd>\n"
257
+                            ."\t\t<Visibility>$row[visibility]</Visibility>\n"
258
+                            ."\t\t<SessionCategory>$row[session_category]</SessionCategory>\n";
259
+            }
260
+
261
+                if (!$cvs) {
262
+                $add .= "\t</Session>\n";
263
+                fputs($fp, $add);
264
+            }
265
+        }
266
+
267
+        switch ($file_type) {
268
+            case 'xml':
269
+                fputs($fp, "</Sessions>\n");
270
+                fclose($fp);
271
+                $errorMsg = get_lang('UserListHasBeenExported').'<br/>
272 272
 				<a class="btn btn-default" href="'.$archiveURL.$archiveFile.'">'.get_lang('ClickHereToDownloadTheFile').'</a>';
273
-				break;
274
-			case 'csv':
275
-				Export::arrayToCsv($sessionListToExport, $archiveFile);
276
-				exit;
277
-			case 'xls':
278
-				Export::arrayToXls($sessionListToExport, $archiveFile);
279
-				exit;
280
-				break;
281
-		}
282
-	}
273
+                break;
274
+            case 'csv':
275
+                Export::arrayToCsv($sessionListToExport, $archiveFile);
276
+                exit;
277
+            case 'xls':
278
+                Export::arrayToXls($sessionListToExport, $archiveFile);
279
+                exit;
280
+                break;
281
+        }
282
+    }
283 283
 }
284 284
 
285 285
 // display the header
@@ -289,26 +289,26 @@  discard block
 block discarded – undo
289 289
 $sql = "SELECT id, name FROM $tbl_session ORDER BY name";
290 290
 
291 291
 if (api_is_multiple_url_enabled()) {
292
-	$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
293
-	$access_url_id = api_get_current_access_url_id();
294
-	if ($access_url_id != -1){
295
-	$sql = "SELECT s.id, name FROM $tbl_session s
292
+    $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
293
+    $access_url_id = api_get_current_access_url_id();
294
+    if ($access_url_id != -1){
295
+    $sql = "SELECT s.id, name FROM $tbl_session s
296 296
 			INNER JOIN $tbl_session_rel_access_url as session_rel_url
297 297
 			ON (s.id = session_rel_url.session_id)
298 298
 			WHERE access_url_id = $access_url_id
299 299
 			ORDER BY name";
300
-	}
300
+    }
301 301
 }
302 302
 $result = Database::query($sql);
303 303
 $Sessions = Database::store_result($result);
304 304
 
305 305
 echo '<div class="actions">';
306 306
 echo '<a href="../session/session_list.php">'.
307
-		Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('SessionList'),'',ICON_SIZE_MEDIUM).'</a>';
307
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('SessionList'),'',ICON_SIZE_MEDIUM).'</a>';
308 308
 echo '</div>';
309 309
 
310 310
 if (!empty($errorMsg)) {
311
-	Display::display_normal_message($errorMsg, false); //main API
311
+    Display::display_normal_message($errorMsg, false); //main API
312 312
 }
313 313
 
314 314
 $form = new FormValidator('session_export', 'post', api_get_self());
Please login to merge, or discard this patch.