From 44cb9081c784a604a3294c42fa810450efa35369 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 21 May 2010 16:45:43 +0200 Subject: [PATCH] Adding api_get_group_id() (Not social network group) --- main/inc/lib/main_api.lib.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index a7b472f5b4..7ba588f7be 100755 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -1436,13 +1436,22 @@ class api_failure { /* CONFIGURATION SETTINGS */ /** - * Gets the current Chamilo (not PHP/cookie) session ID, if active + * Gets the current Chamilo (not PHP/cookie) session ID * @return int O if no active session, the session ID otherwise */ function api_get_session_id() { - return empty($_SESSION['id_session']) ? 0 : (int)$_SESSION['id_session']; + return empty($_SESSION['id_session']) ? 0 : intval($_SESSION['id_session']); } +/** + * Gets the current Chamilo (not social network) group ID + * @return int O if no active session, the session ID otherwise + */ +function api_get_group_id() { + return empty($_SESSION['_gid']) ? 0 : intval($_SESSION['_gid']); +} + + /** * Gets the current or given session name * @param int Session ID (optional)