diff --git a/lib/classes/JsonApi/Routes/RangeTree/RangeTreeIndex.php b/lib/classes/JsonApi/Routes/RangeTree/RangeTreeIndex.php deleted file mode 100644 index c706c482204dc2e8ec58e354b5c3602e7d008e7a..0000000000000000000000000000000000000000 --- a/lib/classes/JsonApi/Routes/RangeTree/RangeTreeIndex.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -namespace JsonApi\Routes\RangeTree; - -use Psr\Http\Message\ServerRequestInterface as Request; -use Psr\Http\Message\ResponseInterface as Response; -use JsonApi\Errors\AuthorizationFailedException; -use JsonApi\Errors\RecordNotFoundException; -use JsonApi\JsonApiController; - -/** - * Zeigt eine bestimmte Veranstaltung an. - */ -class RangeTreeIndex extends JsonApiController -{ - - protected $allowedIncludePaths = [ - 'children', - 'courses', - 'institute', - 'parent', - ]; - protected $allowedPagingParameters = ['offset', 'limit']; - - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function __invoke(Request $request, Response $response, $args) - { - $tree = \TreeAbstract::getInstance('StudipSemTree', ['visible_only' => 1]); - $studyAreas = self::mapTree('root', $tree); - list($offset, $limit) = $this->getOffsetAndLimit(); - - return $this->getPaginatedContentResponse( - array_slice($studyAreas, $offset, $limit), - count($studyAreas) - ); - } - - private function mapTree($parentId, &$tree) - { - $level = []; - $kids = $tree->getKids($parentId); - if (is_array($kids) && count($kids) > 0) { - foreach ($kids as $kid) { - $level[] = \StudipStudyArea::find($kid); - $level = array_merge($level, self::mapTree($kid, $tree)); - } - } - - return $level; - } -}