<?php
namespace Claromentis\Quiz\Service\DataTable;

$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] ?: array()) + array("question_" . "id" => base64_decode("cXVl" . "c3Rp" . "b25f" . "aWQ="), "_c7f63fb39546fbf14a63bba74acf" . "0b23" => base64_decode("cXVpei5zd" . "GF0aXN0aW" . "NzLmRhdGU" . "="), "_b0ed79db6" . "e1fd65ddbf" . "e9918c9643" . "c82" => base64_decode("cXVpei5zdXJ2ZXku" . "YW5vbnltb3Vz"), "_9137964f9a338e" . "89f979757c23fc0" . "20d" => base64_decode("Y3JlYXRl" . "ZF9kYXRl" . "IERFU0M="), "_a848977a8b89eec21b2e7f0adf" . "a6667c" => base64_decode("cXVpei5z" . "dGF0aXN0" . "aWNzLm5h" . "bWU="), "sur" . "vey" . "_id" => base64_decode("c3VydmV5X2l" . "k"), "_cbc21fb0aa9efa81a0ac7c8bea" . "bd68a8" => base64_decode("cXVpei5zdGF0aXN0" . "aWNzLmFuc3dlcg=="), "_8dabb06efc95df4cff7c4afe91857" . "b53" => base64_decode("bmFt" . "ZQ=="), "_4d707fab93bebb" . "00bbe69e8159697" . "c90" => base64_decode(""), "_67a0d624aebcceb0abd5ce56a53f" . "f06f" => base64_decode("ZG" . "F0" . "ZQ" . "=="), "_fc4332281354cbd9808cb1" . "a2c94c383d" => base64_decode("YW5zd2" . "Vy"), "_49c6565477" . "ee9f822b499" . "a53e6d2995f" => base64_decode("YXJyYXl" . "fa2V5X2" . "V4aXN0c" . "w=="));
use Claromentis\Core\DataTable;
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\TextUtil\ClaText;
use Claromentis\Quiz\Facade\AttemptFacade;
use Claromentis\Quiz\Facade\SurveyFacade;
use Claromentis\Quiz\Service\DataTable\Decorator\PlainText;
use Claromentis\Core\Security\SecurityContext;
use User;
class SurveyStatisticsSource implements DataTable\Contract\DataSource
{
    
    
    
    
    use DataTable\Shared\ColumnHelper;
    protected $survey_facade;
    protected $attempt_facade;
    protected $row_count = 0;
    protected $lmsg;
    protected $cla_text;
    public function __construct(SurveyFacade $survey_facade, AttemptFacade $attempt_facade, Lmsg $lmsg, ClaText $cla_text)
    {
        $this->survey_facade = $survey_facade;
        $this->attempt_facade = $attempt_facade;
        $this->lmsg = $lmsg;
        $this->cla_text = $cla_text;
    }
    public function Columns(SecurityContext $context, DataTable\Contract\Parameters $_4c4d12d3e4f6cac68e3eecffe9887915 = null)
    {
        $_a42c86642011ef739b88ee80672c387d = [[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_67a0d624aebcceb0abd5ce56a53ff06" . "f"], ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_c7f63fb39546fbf14a" . "63bba74acf0b23"]), new PlainText()], [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_8dabb06efc95df4cff7c" . "4afe91857b53"], ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_a848977a8b89eec21" . "b2e7f0adfa6667c"]), new PlainText()], [$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_fc4332281354cbd9808cb1a2c94c383" . "d"], ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_cbc21fb0aa9efa81a0ac7c8bea" . "bd68a8"]), new DataTable\Decorator\TextUnsafe()]];
        return $this->CreateWithColumns($_a42c86642011ef739b88ee80672c387d);
    }
    public function Data(SecurityContext $context, DataTable\Contract\Parameters $_4c4d12d3e4f6cac68e3eecffe9887915, DataTable\Contract\TableFilter $_03e9164d0a343b742df4793268b80767)
    {
        $survey_id = $_4c4d12d3e4f6cac68e3eecffe9887915->GetValue($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["survey_i" . "d"]);
        $question_id = $_4c4d12d3e4f6cac68e3eecffe9887915->GetValue($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["question_" . "id"]);
        $_1f50e30be8c2fefa6881834e71d504a2 = $_4c4d12d3e4f6cac68e3eecffe9887915->GetOffset();
        $_f11369824f533e8206f9ccc0c9aab3a0 = $_4c4d12d3e4f6cac68e3eecffe9887915->GetLimit();
        $_e6c850126cff293d170e2d7ab4e2aad4 = $this->attempt_facade->GetSurveyAttempts($survey_id, true, false, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_9137964f9" . "a338e89f97" . "9757c23fc0" . "20d"], $_f11369824f533e8206f9ccc0c9aab3a0, $_1f50e30be8c2fefa6881834e71d504a2, $question_id);
        $_a0006f2e6058ce959e86bebdcded2da8 = [];
        foreach ($_e6c850126cff293d170e2d7ab4e2aad4 as $_7adc269a13af5c45b5a1caf4ec75a795) {
            $_438a59ff9a606f4fff68fbed8a95d9fa = $this->attempt_facade->GetAttemptAnswers($_7adc269a13af5c45b5a1caf4ec75a795);
            if (!$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_49c65654" . "77ee9f822" . "b499a53e6" . "d2995f"]($question_id, $_438a59ff9a606f4fff68fbed8a95d9fa)) {
                continue;
            }
            $_fc4332281354cbd9808cb1a2c94c383d = $_438a59ff9a606f4fff68fbed8a95d9fa[$question_id];
            $_64666bcf1e5aaa07774f3d7439ff264d = new \Date($_7adc269a13af5c45b5a1caf4ec75a795->completed_date);
            $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_67a0d624aebcceb0abd5ce" . "56a53ff06f"]] = $_64666bcf1e5aaa07774f3d7439ff264d->getDate(DATE_FORMAT_ISO);
            $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_8dabb06efc9" . "5df4cff7c4af" . "e91857b53"]] = User::GetNameById($_7adc269a13af5c45b5a1caf4ec75a795->user_id) ?: ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_b0ed79db6e1fd65dd" . "bfe9918c9643c82"]);
            $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_fc4332281354cbd98" . "08cb1a2c94c383d"]] = $this->cla_text->ParseLinks($_fc4332281354cbd9808cb1a2c94c383d->GetResponseText() ?? $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_4d707fab93bebb00bbe69e81596" . "97c90"]);
            $_a0006f2e6058ce959e86bebdcded2da8[] = $_b8cfc2e06d9d1fec1893ea4a054002bf;
        }
        
        
        $this->row_count = $this->attempt_facade->CountSurveyQuestionAnswers($survey_id, $question_id, true);
        return $_a0006f2e6058ce959e86bebdcded2da8;
    }
    
    
    
    
    
    
    
    
    
    public function Count(SecurityContext $context, DataTable\Contract\Parameters $_4c4d12d3e4f6cac68e3eecffe9887915, DataTable\Contract\TableFilter $_e0bd284b1527841bc9c635873b56303b)
    {
        return $this->row_count;
    }
    
    
    
    
    
    
    public function Filters() : array
    {
        return [];
    }
}