<?php

class ACMS_GET_Admin_User_Name extends ACMS_GET
{
    function get()
    {
        $Tpl = new Template($this->tpl, new ACMS_Corrector());

        $userId = idval((string) UID);
        if ($userId > 0) {
            $DB  = DB::singleton(dsn());
            $SQL = SQL::newSelect('user');
            $SQL->setSelect('user_name');
            $SQL->addWhereOpr('user_id', $userId);
            $name = strval($DB->query($SQL->get(dsn()), 'one'));
            if ($name !== '') {
                $Tpl->add(null, ['uid' => $userId, 'name' => $name]);
            }
        }
        return $Tpl->get();
    }
}
