<?php
$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] ?: array()) + array("_04f40fb3" . "9b351832f" . "665bd93bf" . "393ac4" => base64_decode("X" . "3" . "N" . "0"), "_c955d13b8651b08fd00" . "aa43169d63ea1" => base64_decode("ZGF0ZV90bw" . "=="), "_bb92509eb147798ebda2a4c6" . "7b3bff0f" => base64_decode("ZGF0ZV90aW1lID49IGludDpkYXRlX2" . "Zyb20gQU5EIA=="), "_ec05fd6be56b5" . "a2c3139345140e" . "484f0" => base64_decode("X3N" . "vcn" . "RfZ" . "Gly"), "_1e491d70b7c6ff" . "2f5e7e1fa21ad95" . "6f3" => base64_decode("ZGF0ZV9mcm9" . "t"), "_aed8da0f19091214b78f" . "80351048517c" => base64_decode("c3RybG" . "Vu"), "_b15aac3a" . "a29c10ea6" . "d1228f58c" . "b9a7e8" => base64_decode("b2Jq" . "ZWN0"), "_bad6dfc2109d66c91f" . "c231a44711c072" => base64_decode("L" . "g" . "=" . "="), "_b59f4b9c6fc8e8172e" . "21bfef1df21619" => base64_decode("X3Nvcn" . "Q="), "obje" . "ct_i" . "d" => base64_decode("b2JqZ" . "WN0X2" . "lk"), "_3760dd7026c4f3" . "a1db97cf6c8d5b5" . "23f" => base64_decode("ZGF0ZV90aW" . "1lIDw9IGlu" . "dDpkYXRlX3" . "Rv"), "_af61c49836c59e73a06e8" . "fd9a486802d" => base64_decode("LT" . "Eg" . "ZG" . "F5"), "_76270072235491efe4feff837b" . "50d951" => base64_decode("Li4vc3RhdC9jbGFzc2VzL1N0YXR" . "PdXRwdXREZWNvcmF0b3JzLnBocA" . "=="));
use Claromentis\Core\DAL;
require_once $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_76270072235491efe4feff8" . "37b50d951"];
abstract class StatReportTopList extends CommonList
{
    
    
    
    
    
    protected $date_from;
    
    
    
    
    
    protected $date_to;
    protected $aggregation;
    protected $most_popular_amount;
    protected $paging_enabled;
    function __construct($aggregation, $name)
    {
        parent::__construct($name, $name . $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_04f40fb39" . "b351832f66" . "5bd93bf393" . "ac4"], $name . $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_b59f4b9c6" . "fc8e8172e2" . "1bfef1df21" . "619"], $name . $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_ec05fd6be56b5a2c3139345140" . "e484f0"]);
        $this->aggregation = $aggregation;
        $this->most_popular_amount = 10;
        $this->paging_enabled = true;
        $this->rows_per_page = 20;
        $this->date_from = new DateDay();
        $this->date_from->modify($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_af61c49836c59e73a06e8fd9a" . "486802d"]);
        $this->date_to = new DateDay();
    }
    
    
    
    
    
    
    
    
    public function GetData($_f2b0589e330a88c87f5cc51408bda822, $_692408637c0ee5b3fa41190b465f74a4)
    {
        $data = $this->CollectData($_f2b0589e330a88c87f5cc51408bda822, $_692408637c0ee5b3fa41190b465f74a4);
        $data = $this->ExtendDataWithObjects($data);
        $data = $this->PrepareOutputData($data, $_692408637c0ee5b3fa41190b465f74a4);
        return $data;
    }
    protected abstract function CollectData($_f2b0589e330a88c87f5cc51408bda822, $_692408637c0ee5b3fa41190b465f74a4);
    
    
    
    
    protected function ExtendDataWithObjects($data)
    {
        $_cf58d50fa50aab09e047075c4b2206cd = $this->GetObjectClassName();
        foreach ($data as $_40421a4e75c2ba3c82b018e6b56f7425 => &$info) {
            $_b15aac3aa29c10ea6d1228f58cb9a7e8 = new $_cf58d50fa50aab09e047075c4b2206cd();
            $_b15aac3aa29c10ea6d1228f58cb9a7e8->Load($info[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["objec" . "t_id"]]);
            $info[$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_b15aac3a" . "a29c10ea6" . "d1228f58c" . "b9a7e8"]] = !$_b15aac3aa29c10ea6d1228f58cb9a7e8->IsError() && $_b15aac3aa29c10ea6d1228f58cb9a7e8->GetId() == $info[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["ob" . "je" . "ct" . "_i" . "d"]] ? $_b15aac3aa29c10ea6d1228f58cb9a7e8 : false;
        }
        return $data;
    }
    protected abstract function GetObjectClassName();
    
    
    
    
    protected abstract function PrepareOutputData($data, $start_row = 0);
    
    
    
    
    
    
    public function GetNumRows()
    {
        if (!$this->paging_enabled) {
            return 0;
        }
        global $db;
        list($_3ce61d3a8a385e00d1583b95ce3eacb0) = $db->query_row($this->GetNumRowsQuery());
        return $_3ce61d3a8a385e00d1583b95ce3eacb0;
    }
    protected abstract function GetNumRowsQuery();
    public function SetDatesFilter(DateDay $_1e491d70b7c6ff2f5e7e1fa21ad956f3, DateDay $_c955d13b8651b08fd00aa43169d63ea1)
    {
        $this->SetDateFrom($_1e491d70b7c6ff2f5e7e1fa21ad956f3);
        $this->SetDateTo($_c955d13b8651b08fd00aa43169d63ea1);
        return true;
    }
    public function SetDateFrom(DateDay $_1e491d70b7c6ff2f5e7e1fa21ad956f3)
    {
        $this->date_from = $_1e491d70b7c6ff2f5e7e1fa21ad956f3;
        return true;
    }
    public function SetDateTo(DateDay $_c955d13b8651b08fd00aa43169d63ea1)
    {
        $this->date_to = $_c955d13b8651b08fd00aa43169d63ea1;
        return true;
    }
    protected function GetFilter($_36fafa76f7d10f51fc99942da251d8e3 = "")
    {
        if ($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_aed8da0f19091214b78f803510" . "48517c"]($_36fafa76f7d10f51fc99942da251d8e3) > 0) {
            $_36fafa76f7d10f51fc99942da251d8e3 .= $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_bad6dfc2109d66c91fc231a44" . "711c072"];
        }
        $_6df27f7ad2d2674b7381bfc99d068a7a = new DAL\QueryPart($_36fafa76f7d10f51fc99942da251d8e3 . $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_bb92509eb14" . "7798ebda2a4c" . "67b3bff0f"] . $_36fafa76f7d10f51fc99942da251d8e3 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_3760dd7" . "026c4f3a" . "1db97cf6" . "c8d5b523" . "f"]);
        $_6df27f7ad2d2674b7381bfc99d068a7a->Bind($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_1e491d70b7c" . "6ff2f5e7e1fa" . "21ad956f3"], $this->date_from->GetDate(DATE_FORMAT_TIMESTAMP));
        $_6df27f7ad2d2674b7381bfc99d068a7a->Bind($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_c955d13b8" . "651b08fd00" . "aa43169d63" . "ea1"], $this->date_to->GetDate(DATE_FORMAT_TIMESTAMP));
        return $_6df27f7ad2d2674b7381bfc99d068a7a;
    }
    public function DrawMostPopular()
    {
        $this->rows_per_page = $this->most_popular_amount;
        $this->current_row = 0;
        $this->paging_enabled = false;
        $this->DrawHtml();
        $this->paging_enabled = true;
    }
    public function GetMostPopularAmount()
    {
        return $this->most_popular_amount;
    }
}