function claro_is_course_registration_pending($courseId = null, $userId = null) { if (!$courseId) { $courseId = claro_get_current_course_id(); } if (!$userId) { $userId = claro_get_current_user_id(); } $privileges = claro_get_course_user_privilege($courseId, $userId); return $privileges['is_coursePending']; }
/** * Get the profile id of the current user in a given course * @param string $courseId id (sysCode) of the course * @return int id of the current user's profile in the course */ function claro_get_current_user_profile_id_in_course($courseId = null) { $courseId = empty($courseId) ? claro_get_current_course_id() : $courseId; $userPrivilege = claro_get_course_user_privilege($courseId, claro_get_current_user_id()); return $userPrivilege['_profileId']; }
/** * Check that the user has the privilege required to download the requested file * @param String $requestedUrl path of the requested file to test * @return boolean true if the user can download the file */ public function isAllowedToDownload($requestedUrl) { if (!$this->isModuleAllowed()) { return false; } if (!is_null($this->cid)) { $courseUserPrivilege = claro_get_course_user_privilege($this->cid, $this->uid); if (!$courseUserPrivilege['is_courseMember']) { pushClaroMessage('course not allowed', 'debug'); return false; } else { if (claro_is_in_a_group()) { if (!claro_is_group_allowed()) { pushClaroMessage('group not allowed', 'debug'); return false; } else { return true; } } else { return $this->isDocumentDownloadableInCourse($requestedUrl); } } } else { return false; } }