|
@@ -6342,6 +6342,50 @@ class CourseManager
|
|
|
return api_get_path(WEB_COURSE_PATH).$course->getDirectory().'/course-pic85x85.png';
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public static function getCountOpenCourses()
|
|
|
+ {
|
|
|
+ $visibility = [
|
|
|
+ COURSE_VISIBILITY_REGISTERED,
|
|
|
+ COURSE_VISIBILITY_OPEN_PLATFORM,
|
|
|
+ COURSE_VISIBILITY_OPEN_WORLD,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $table = Database::get_main_table(TABLE_MAIN_COURSE);
|
|
|
+ $sql = "SELECT count(id) count
|
|
|
+ FROM $table
|
|
|
+ WHERE visibility IN (".implode(',', $visibility).")";
|
|
|
+ $result = Database::query($sql);
|
|
|
+ $row = Database::fetch_array($result);
|
|
|
+
|
|
|
+ return (int) $row['count'];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public static function getCountExercisesFromOpenCourse()
|
|
|
+ {
|
|
|
+ $visibility = [
|
|
|
+ COURSE_VISIBILITY_REGISTERED,
|
|
|
+ COURSE_VISIBILITY_OPEN_PLATFORM,
|
|
|
+ COURSE_VISIBILITY_OPEN_WORLD,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $table = Database::get_main_table(TABLE_MAIN_COURSE);
|
|
|
+ $tableExercise = Database::get_course_table(TABLE_QUIZ_TEST);
|
|
|
+ $sql = "SELECT count(e.iid) count
|
|
|
+ FROM $table c INNER JOIN $tableExercise e
|
|
|
+ ON (c.id = e.c_id)
|
|
|
+ WHERE e.active <> -1 AND visibility IN (".implode(',', $visibility).")";
|
|
|
+ $result = Database::query($sql);
|
|
|
+ $row = Database::fetch_array($result);
|
|
|
+
|
|
|
+ return (int) $row['count'];
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Check if a specific access-url-related setting is a problem or not.
|
|
|
*
|