Пример #1
0
 /**
  * @codeCoverageIgnore
  */
 public static function getList($parent = null)
 {
     $list = new BzdList();
     foreach (parent::getList() as $media) {
         if ($media instanceof Page) {
             // Ignore if we're looking for pages with a specific parent
             if ($parent != null && $media->parentPage != $parent) {
                 continue;
             }
             $list->add($media);
         }
     }
     $sortedList = new BzdList();
     for ($i = 0; $i < $list->count(); $i++) {
         $firstPage = null;
         foreach ($list as $page) {
             if (($firstPage == null || $firstPage->getPosition() > $page->getPosition()) && !$sortedList->contains($page)) {
                 $firstPage = $page;
             }
         }
         $sortedList->add($firstPage);
     }
     return $sortedList;
 }