<?php

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

        $roleId = idval($this->Get->get('rid'));
        if ($roleId > 0) {
            $DB  = DB::singleton(dsn());
            $SQL = SQL::newSelect('role');
            $SQL->setSelect('role_name');
            $SQL->addWhereOpr('role_id', $roleId);
            $name = strval($DB->query($SQL->get(dsn()), 'one'));
            if ($name !== '') {
                $Tpl->add(null, ['rid' => $roleId, 'name' => $name]);
            }
        }
        return $Tpl->get();
    }
}
