<?php
namespace Claromentis\Infocapture\Controller;

$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] ?: array()) + array("_4d707fab9" . "3bebb00bbe" . "69e8159697" . "c90" => base64_decode(""), "_0cf5025f4732" . "1df1b4f354cce" . "d7a2aba" => base64_decode("aW5mb2NhcHR1cmUu" . "aXNzdWUuZmlsZV9h" . "cmNoaXZlX25hbWU="), "_0a0dab2063e4" . "1b836782d6931" . "e42ff42" => base64_decode("Ln" . "pp" . "cA" . "=="), "filen" . "ame" => base64_decode("ZmlsZW5hbWU" . "="));
use Claromentis\Core\Date\DateFormatter;
use Claromentis\Core\Http\ResponseFactory;
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\Security\SecurityContext;
use Symfony\Component\HttpFoundation\Response;
class IssueController
{
    
    
    
    
    protected $lmsg;
    
    
    
    
    protected $archive_processor;
    
    
    
    
    protected $response_factory;
    public function __construct(Lmsg $lmsg, \ArchiveProcessor $archive_processor, ResponseFactory $response_factory)
    {
        $this->lmsg = $lmsg;
        $this->archive_processor = $archive_processor;
        $this->response_factory = $response_factory;
    }
    
    
    
    
    
    
    
    
    public function DownloadAllFiles(SecurityContext $context, \HDProject $project, \HDIssue $issue)
    {
        $_0d5f1ff8add887935f8be4befcc13eb5 = $project->UserHasPermission(HD_PERM_PRIVATE_NOTES, $issue, $context->GetUserId());
        $_4e7ab34a53ffb13eb0838003f33034d4 = $issue->GetAttachments($_0d5f1ff8add887935f8be4befcc13eb5);
        $_ab4a84d38986787e58597ed7091af8ca = [];
        foreach ($_4e7ab34a53ffb13eb0838003f33034d4 as $_47eed1aeea2c92efe9af919c40d41358) {
            $_ab4a84d38986787e58597ed7091af8ca[] = [$_47eed1aeea2c92efe9af919c40d41358->GetPath(), $_47eed1aeea2c92efe9af919c40d41358->GetProperty($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["fi" . "le" . "na" . "me"]), $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_4d707fab93bebb00bbe" . "69e8159697c90"]];
        }
        $_d8ebd3b65e4caa34f7180a5b4509a978 = $this->archive_processor->CreateArchive($_ab4a84d38986787e58597ed7091af8ca);
        if ($_d8ebd3b65e4caa34f7180a5b4509a978 === false) {
            throw new \Exception($this->archive_processor->GetErrMsg());
        }
        $_d230962d9a57dc6ba2b774d9ba3bb81e = new \DateDay();
        $_d230962d9a57dc6ba2b774d9ba3bb81e = $_d230962d9a57dc6ba2b774d9ba3bb81e->getDate(DateFormatter::LONG_DATE);
        $name = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_0cf5025f47321df1b4f354cced7a2ab" . "a"], $issue->GetId($project), $_d230962d9a57dc6ba2b774d9ba3bb81e) . $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_0a0dab2063e41b8" . "36782d6931e42ff4" . "2"];
        return $this->response_factory->GetFileResponse($name, $_d8ebd3b65e4caa34f7180a5b4509a978, true);
    }
}