/** * Gets id of lesson corresponded to given course * @param integer id of course * @throws LearnException with error bit set (one of): * - LearnException::EXC_ERR_ALL_GIVEUP * - LearnException::EXC_ERR_ALL_LOGIC * @return integer/bool id of linked (corresponded) lesson or * FALSE if there is no lesson corresponded to the course. */ public static final function CourseGetLinkedLesson($courseId) { $arMap = CLearnLesson::GetCourseToLessonMap(); if (!isset($arMap['C' . $courseId])) { return false; } // return id of corresponded lesson return $arMap['C' . $courseId]; }
/** * Gets id of lesson corresponded to given course * @param integer id of course * @throws LearnException with error bit set (one of): * - LearnException::EXC_ERR_ALL_GIVEUP * - LearnException::EXC_ERR_ALL_LOGIC * @return integer/bool id of linked (corresponded) lesson or * FALSE if there is no lesson corresponded to the course. */ public static final function CourseGetLinkedLesson($courseId) { $arMap = CLearnLesson::GetCourseToLessonMap(); if (!isset($arMap['C' . $courseId])) { // Logic error throw new LearnException('EA_LOGIC: is DB corrupted?', LearnException::EXC_ERR_ALL_GIVEUP | LearnException::EXC_ERR_ALL_LOGIC); } // return id of corresponded lesson return $arMap['C' . $courseId]; }