<?php

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

        $aliasId = idval($this->Get->get('aid'));
        if ($aliasId > 0) {
            $DB  = DB::singleton(dsn());
            $SQL = SQL::newSelect('alias');
            $SQL->setSelect('alias_name');
            $SQL->addWhereOpr('alias_id', $aliasId);
            $SQL->addWhereOpr('alias_blog_id', BID);
            $name = strval($DB->query($SQL->get(dsn()), 'one'));
            if ($name !== '') {
                $Tpl->add(null, ['aid' => $aliasId, 'name' => $name]);
            }
        }
        return $Tpl->get();
    }
}
