<?php
namespace Claromentis\People\NameProvider;

$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("na" . "me" => base64_decode("bm" . "Ft" . "ZQ" . "=="), "_26ea2e897858cc8734f06d5e684" . "4e562" => base64_decode("U0VMRUNUIGlkLCBuYW1lIEZST00gZXh0c" . "mFuZXRfYXJlYXMgT1JERVIgQlkgcHJpbW" . "FyeV9hcmVhIERFU0MsIG5hbWU="), "_0301dac72879547917d" . "01783dd4d945a" => base64_decode("aWQgSU4" . "gaW46aW" . "50Omlkc" . "w=="), "_1b8003906020f45513d54c7a55" . "e9a572" => base64_decode("U0VMRUNUIENPVU5UKDEpI" . "EZST00gZXh0cmFuZXRfYX" . "JlYXM="));
use Claromentis\Core\DAL\QueryBuilder;
use Claromentis\Core\Services;
use PeopleGRENamesProvider;
class AssignableExtranets implements PeopleGRENamesProvider
{
    protected $keywords;
    protected $admin;
    public function __construct()
    {
        $this->admin = new \UsersAdmin(\AuthUser::I()->GetId());
    }
    public function count()
    {
        $_4c8189237e0d0b5cd82c06d69613c88e = new QueryBuilder($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_1b800390" . "6020f4551" . "3d54c7a55" . "e9a572"]);
        $this->addFilter($_4c8189237e0d0b5cd82c06d69613c88e);
        list($_f53d35a1a1e233d98d9ce73d92ab3bb1) = Services::I()->GetDb()->query_row($_4c8189237e0d0b5cd82c06d69613c88e->GetQuery());
        return (int) $_f53d35a1a1e233d98d9ce73d92ab3bb1;
    }
    public function SetFilterKeywords($keywords)
    {
        $this->keywords = $keywords;
    }
    public function GetList($page_size, $_85008ed1ba1db3b691d57c5329e12ac8 = 0)
    {
        $_4c8189237e0d0b5cd82c06d69613c88e = new QueryBuilder($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_26ea2e897858cc" . "8734f06d5e6844e" . "562"]);
        $this->addFilter($_4c8189237e0d0b5cd82c06d69613c88e);
        $_7f5aa4e96d4b415a86ed72ebff677cbe = $_4c8189237e0d0b5cd82c06d69613c88e->GetQuery();
        $_7f5aa4e96d4b415a86ed72ebff677cbe->setLimit($page_size, $_85008ed1ba1db3b691d57c5329e12ac8);
        $_189840d11056515e52402d1412a0b6e4 = Services::I()->GetDb()->query($_7f5aa4e96d4b415a86ed72ebff677cbe);
        $_1f24efd4735b7a11b391147435e7d35d = [];
        while (list($id, $name) = $_189840d11056515e52402d1412a0b6e4->fetchRow()) {
            $_1f24efd4735b7a11b391147435e7d35d[$id] = $name;
        }
        return $_1f24efd4735b7a11b391147435e7d35d;
    }
    protected function addFilter(QueryBuilder $_4c8189237e0d0b5cd82c06d69613c88e)
    {
        if ($this->keywords) {
            $_4c8189237e0d0b5cd82c06d69613c88e->AddSubstringFilter($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["nam" . "e"], $this->keywords);
        }
        if (!$this->admin->IsPeopleAdmin()) {
            $_4c8189237e0d0b5cd82c06d69613c88e->AddWhereAndClause($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_0301dac72879547917d01783dd4d" . "945a"], $this->admin->GetAssignExAreas());
        }
        return $_4c8189237e0d0b5cd82c06d69613c88e;
    }
}