Browse Source

Update api.lib.php

pielRouge 6 years ago
parent
commit
dfc9f56634
1 changed files with 15 additions and 1 deletions
  1. 15 1
      main/inc/lib/api.lib.php

+ 15 - 1
main/inc/lib/api.lib.php

@@ -2026,7 +2026,7 @@ function api_get_course_info($course_code = null, $strict = false)
  *
  * @return \Chamilo\CoreBundle\Entity\Course
  */
-function api_get_course_entity($courseId)
+function api_get_course_entity($courseId = 0)
 {
     if (empty($courseId)) {
         $courseId = api_get_course_int_id();
@@ -2035,6 +2035,20 @@ function api_get_course_entity($courseId)
     return Database::getManager()->getRepository('ChamiloCoreBundle:Course')->find($courseId);
 }
 
+/**
+ * @param int $id
+ *
+ * @return \Chamilo\CoreBundle\Entity\Session
+ */
+function api_get_session_entity($id = 0)
+{
+    if (empty($id)) {
+        $id = api_get_session_id();
+    }
+
+    return Database::getManager()->getRepository('ChamiloCoreBundle:Session')->find($id);
+}
+
 /**
  * Returns the current course info array.