|
|
|
|
@ -134,6 +134,9 @@ if ($showImportIcon) { |
|
|
|
|
echo "</div><br />"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return int |
|
|
|
|
*/ |
|
|
|
|
function get_count_courses() |
|
|
|
|
{ |
|
|
|
|
$userId = api_get_user_id(); |
|
|
|
|
@ -165,6 +168,15 @@ function get_count_courses() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($drhLoaded == false) { |
|
|
|
|
$isGeneralCoach = SessionManager::user_is_general_coach( |
|
|
|
|
api_get_user_id(), |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if ($isGeneralCoach) { |
|
|
|
|
$courseList = SessionManager::getCoursesInSession($sessionId); |
|
|
|
|
$count = count($courseList); |
|
|
|
|
} else { |
|
|
|
|
$count = CourseManager::getCoursesFollowedByUser( |
|
|
|
|
$userId, |
|
|
|
|
COURSEMANAGER, |
|
|
|
|
@ -177,10 +189,19 @@ function get_count_courses() |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param $from |
|
|
|
|
* @param $limit |
|
|
|
|
* @param $column |
|
|
|
|
* @param $direction |
|
|
|
|
* |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
function get_courses($from, $limit, $column, $direction) |
|
|
|
|
{ |
|
|
|
|
$userId = api_get_user_id(); |
|
|
|
|
@ -205,6 +226,21 @@ function get_courses($from, $limit, $column, $direction) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($drhLoaded == false) { |
|
|
|
|
$isGeneralCoach = SessionManager::user_is_general_coach( |
|
|
|
|
api_get_user_id(), |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// General coach can see all reports |
|
|
|
|
if ($isGeneralCoach) { |
|
|
|
|
$courseList = SessionManager::getCoursesInSession($sessionId); |
|
|
|
|
$courses = []; |
|
|
|
|
if (!empty($courseList)) { |
|
|
|
|
foreach ($courseList as $courseId) { |
|
|
|
|
$courses[] = api_get_course_info_by_id($courseId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$courses = CourseManager::getCoursesFollowedByUser( |
|
|
|
|
$userId, |
|
|
|
|
COURSEMANAGER, |
|
|
|
|
@ -219,6 +255,10 @@ function get_courses($from, $limit, $column, $direction) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$courseList = array(); |
|
|
|
|
if (!empty($courses)) { |
|
|
|
|
foreach ($courses as $data) { |
|
|
|
|
|