File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -5084,7 +5084,7 @@ public static function importCSV(
5084
5084
}
5085
5085
}
5086
5086
5087
- $ session_name = $ enreg ['SessionName ' ];
5087
+ $ session_name = trim ( trim ( api_utf8_decode ( $ enreg ['SessionName ' ]), ' " ' )) ;
5088
5088
5089
5089
if ($ debug ) {
5090
5090
$ logger ->addInfo ('--------------------------------------- ' );
@@ -5536,6 +5536,7 @@ public static function importCSV(
5536
5536
}
5537
5537
}
5538
5538
5539
+ $ position = 0 ;
5539
5540
foreach ($ courses as $ course ) {
5540
5541
$ courseArray = bracketsToArray ($ course );
5541
5542
$ course_code = $ courseArray [0 ];
@@ -5546,7 +5547,7 @@ public static function importCSV(
5546
5547
5547
5548
// Adding the course to a session.
5548
5549
$ sql = "INSERT IGNORE INTO $ tbl_session_course
5549
- SET c_id = ' $ courseId', session_id=' $ session_id' " ;
5550
+ SET c_id = ' $ courseId', session_id=' $ session_id', position = ' $ position ' " ;
5550
5551
Database::query ($ sql );
5551
5552
5552
5553
self ::installCourse ($ session_id , $ courseInfo ['real_id ' ]);
@@ -5934,6 +5935,7 @@ public static function importCSV(
5934
5935
}
5935
5936
}
5936
5937
$ inserted_in_course [$ course_code ] = $ courseInfo ['title ' ];
5938
+ $ position ++;
5937
5939
}
5938
5940
}
5939
5941
$ access_url_id = api_get_current_access_url_id ();
Original file line number Diff line number Diff line change 162
162
}
163
163
164
164
// Courses
165
- $ sql = "SELECT DISTINCT c.code, sc.c_id
166
- FROM $ tbl_course c
167
- INNER JOIN $ tbl_session_course_user sc
168
- ON c.id = sc.c_id AND sc.session_id = ' " .$ row ['id ' ]."' " ;
165
+ $ sql = "SELECT DISTINCT c.code, sc.c_id, sr.position
166
+ FROM $ tbl_course c
167
+ INNER JOIN $ tbl_session_course_user sc
168
+ ON c.id = sc.c_id AND sc.session_id = ' " .$ row ['id ' ]."'
169
+ INNER JOIN $ tbl_session_course sr
170
+ ON sc.session_id = sr.session_id AND sc.c_id = sr.c_id
171
+ ORDER BY sr.position ASC " ;
169
172
170
173
$ rsCourses = Database::query ($ sql );
171
174
Original file line number Diff line number Diff line change 188
188
foreach ($ root ->Session as $ node_session ) {
189
189
$ course_counter = 0 ;
190
190
$ user_counter = 0 ;
191
-
192
- $ session_name = trim (api_utf8_decode ($ node_session ->SessionName ));
191
+ $ session_name = trim (trim (api_utf8_decode ($ node_session ->SessionName ), '" ' ));
193
192
$ coach = UserManager::purify_username (
194
193
api_utf8_decode ($ node_session ->Coach ),
195
194
$ purification_option_for_usernames
345
344
}
346
345
347
346
// Adding courses to a session.
347
+ $ position = 0 ;
348
348
foreach ($ node_session ->Course as $ node_course ) {
349
349
$ course_code = Database::escape_string (trim (api_utf8_decode ($ node_course ->CourseCode )));
350
350
// Verify that the course pointed by the course code node exists.
357
357
if (!$ session_course_relation ) {
358
358
$ sql_course = "INSERT INTO $ tbl_session_course SET
359
359
c_id = $ courseId,
360
- session_id = $ session_id " ;
360
+ session_id = $ session_id,
361
+ position = $ position " ;
361
362
$ rs_course = Database::query ($ sql_course );
362
363
SessionManager::installCourse ($ session_id , $ courseId );
363
364
}
408
409
$ sql = "UPDATE $ tbl_session_course SET nbr_users=' $ users_in_course_counter' WHERE c_id=' $ courseId' " ;
409
410
Database::query ($ sql );
410
411
$ inserted_in_course [$ course_code ] = $ course_info ['title ' ];
412
+ $ position ++;
411
413
}
412
414
}
413
415
Database::query ("UPDATE $ tbl_session SET nbr_users=' $ user_counter', nbr_courses=' $ course_counter' WHERE id=' $ session_id' " );
You can’t perform that action at this time.
0 commit comments