Exemple #1
0
 public static final function GetByIDAsArr($id)
 {
     global $DB;
     $arData = CLearnGraphNode::GetByID($id);
     // If lesson is course - get additional data
     $courseId = self::GetLinkedCourse($id);
     if ($courseId !== false) {
         $rc = $DB->Query("SELECT SORT, ACTIVE_FROM, ACTIVE_TO, RATING, RATING_TYPE, SCORM\n\t\t\t\tFROM b_learn_course\n\t\t\t\tWHERE ID = '" . (int) ($courseId + 0) . "'", true);
         if ($rc === false) {
             throw new LearnException('EA_SQLERROR', LearnException::EXC_ERR_ALL_GIVEUP);
         }
         $arCourseData = $rc->Fetch();
         if ($arCourseData === false || !isset($arCourseData['SORT'])) {
             throw new LearnException('EA_SQLERROR', LearnException::EXC_ERR_ALL_GIVEUP);
         }
         $arData = array_merge($arData, $arCourseData);
     }
     // convert return data to expected form
     if (isset($arData['ACTIVE']) && is_bool($arData['ACTIVE'])) {
         if ($arData['ACTIVE']) {
             $arData['ACTIVE'] = 'Y';
         } else {
             $arData['ACTIVE'] = 'N';
         }
     }
     $arData['LESSON_ID'] = $arData['ID'];
     return $arData;
 }