Fix teachers can't subscribe to Session from Course and some minor code fixing

1.10.x
José Loguercio 9 years ago
parent 5c4ff621c7
commit 2839bb5f17
  1. 2
      main/cron/import_csv.php
  2. 20
      main/inc/lib/sessionmanager.lib.php
  3. 4
      main/user/subscribe_user.php

@ -1385,7 +1385,7 @@ class ImportCsv
SessionManager::set_coach_to_course_session(
$userId,
$chamiloSessionId,
$courseInfo['code']
$courseInfo['real_id']
);
break;
}

@ -2785,9 +2785,9 @@ class SessionManager
// and then exit
$sql = "DELETE FROM $tbl_session_rel_course_rel_user
WHERE
session_id = '$session_id' AND
c_id = '$courseId' AND
user_id = '$user_id' ";
session_id = $session_id AND
c_id = $courseId AND
user_id = $user_id ";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0)
return true;
@ -2799,18 +2799,18 @@ class SessionManager
// First check if the user is registered to the course
$sql = "SELECT user_id FROM $tbl_session_rel_course_rel_user
WHERE
session_id = '$session_id' AND
c_id = '$courseId' AND
user_id = '$user_id'";
session_id = $session_id AND
c_id = $courseId AND
user_id = $user_id";
$rs_check = Database::query($sql);
// Then update or insert.
if (Database::num_rows($rs_check) > 0) {
$sql = "UPDATE $tbl_session_rel_course_rel_user SET status = 2
WHERE
session_id = '$session_id' AND
c_id = '$courseId' AND
user_id = '$user_id' ";
session_id = $session_id AND
c_id = $courseId AND
user_id = $user_id ";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
return true;
@ -2819,7 +2819,7 @@ class SessionManager
}
} else {
$sql = "INSERT INTO $tbl_session_rel_course_rel_user(session_id, c_id, user_id, status)
VALUES('$session_id', '$courseId', '$user_id', 2)";
VALUES($session_id, $courseId, $user_id, 2)";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
return true;

@ -60,7 +60,7 @@ if (isset($_REQUEST['register'])) {
$result_simple_sub = SessionManager::set_coach_to_course_session(
$_REQUEST['user_id'],
$current_session_id,
$courseInfo['code']
$courseInfo['real_id']
);
} else {
$result_simple_sub = CourseManager:: subscribe_user(
@ -109,7 +109,7 @@ if (isset($_POST['action'])) {
$is_suscribe[] = SessionManager::set_coach_to_course_session(
$user_id,
$current_session_id,
$courseInfo['code']
$courseInfo['real_id']
);
} else {
$is_suscribe[] = CourseManager::subscribe_user(

Loading…
Cancel
Save