<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

class ComboboxSemester4Kursplanung extends ComboboxSemester
{
  protected function getDatamodulAry(): array
  {
    $dbwhlsem = new DBWorkHLSemester(1, true);
    $semAry = $dbwhlsem->getAllSemesterSinceDate(DateTimeOperations::getDateNow());

    if (empty($semAry)) {
      $toolSettings = ToolSettingsAPI::getToolSettings(GetOperations::getVarValue('tool_id', 3));
      $semArySettings = explode(',', $toolSettings->kurskopie_semester);
      foreach ($semArySettings as $key => $semester) {
        $semArySettings[$key] = trim($semester);
      }

      $semAry = $dbwhlsem->getSemesterBySemAry($semArySettings, true);
    }

    return $semAry;
  }
}