예제 #1
0
 /**
  * @access public
  */
 public static final function GetListOfParentPathes($lessonId, $breakOnLessonId = false, $breakBeforeLesson = false, $arIgnoreEdges = array())
 {
     $arPathes = array(array($lessonId));
     $arAlreadyProcessedLessons = array($lessonId);
     if ($breakOnLessonId !== false) {
         // This lesson must be interpreted as parentless.
         // This behaviour can be emulated by adding to
         // $arAlreadyProcessedLessons all immediate parents
         // of this lesson.
         $arEdges = self::ListImmediateParents($breakOnLessonId);
         foreach ($arEdges as $arEdge) {
             $arAlreadyProcessedLessons[] = (int) $arEdge['PARENT_LESSON'];
         }
     }
     if ($breakBeforeLesson !== false) {
         $arAlreadyProcessedLessons[] = (int) $breakBeforeLesson;
     }
     $arAllPathes = self::GetListOfParentPathesRecursive($arPathes, $arAlreadyProcessedLessons, $arIgnoreEdges);
     $arObjPathes = array();
     foreach ($arAllPathes as $arPathBackward) {
         $arPath = array_reverse($arPathBackward);
         $o = new CLearnPath($arPath);
         $o->PopBottom();
         // remove $lessonId
         // skip empty pathes
         if ($o->Count() > 0) {
             $arObjPathes[] = $o;
         }
     }
     return $arObjPathes;
 }