<?php

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

        $usergroupId = idval($this->Get->get('ugid'));
        if ($usergroupId > 0) {
            $DB  = DB::singleton(dsn());
            $SQL = SQL::newSelect('usergroup');
            $SQL->setSelect('usergroup_name');
            $SQL->addWhereOpr('usergroup_id', $usergroupId);
            $name = strval($DB->query($SQL->get(dsn()), 'one'));
            if ($name !== '') {
                $Tpl->add(null, ['ugid' => $usergroupId, 'name' => $name]);
            }
        }
        return $Tpl->get();
    }
}
