<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

class FileUploadKuferWebAnmNeu extends FileUpload
{
  private $anminfo;

  public function upload($path = ''): array
  {
    $anminfo = SessionOperations::getVarValueAnmInfo();
    $this->anminfo = $anminfo;

    return parent::upload();
  }

  protected function processInfos($fileNr, $localFilename, $filename, $filetype): void
  {
    $this->anminfo->hauptTn->aryattachmentsJS[] = $filename;
    $attachement = new Attachment($filename, $localFilename, $filetype);
    $this->anminfo->hauptTn->uploadAttachments[] = $attachement;
  }

  protected function postUploadHook()
  {
    SessionOperations::setVarValueAnmInfo($this->anminfo);
  }
}